hyperframes 0.8.39 → 0.8.41
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 +392 -196
- package/dist/fontLocalizeCli.js +111 -57
- package/dist/hyperframe-runtime.js +18 -18
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +18 -18
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/studio/assets/{hyperframes-player-BBFfad14.js → hyperframes-player-DqvIG-wF.js} +1 -1
- package/dist/studio/assets/{index-3XC5KvGR.js → index-B9EJ5EKe.js} +114 -114
- package/dist/studio/assets/{index-CtYBUtk8.js → index-Ddt4MDp0.js} +1 -1
- package/dist/studio/assets/{index-De_8OqJf.js → index-vUw1oolj.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/studio/index.js +2 -2
- package/dist/studio/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var VERSION;
|
|
|
50
50
|
var init_version = __esm({
|
|
51
51
|
"src/version.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
VERSION = true ? "0.8.
|
|
53
|
+
VERSION = true ? "0.8.41" : "0.0.0-dev";
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -59264,7 +59264,7 @@ var RUNTIME_IIFE;
|
|
|
59264
59264
|
var init_runtime_inline = __esm({
|
|
59265
59265
|
"../core/dist/generated/runtime-inline.js"() {
|
|
59266
59266
|
"use strict";
|
|
59267
|
-
RUNTIME_IIFE = '"use strict";(()=>{var nh=Object.create;var Ro=Object.defineProperty;var rh=Object.getOwnPropertyDescriptor;var ih=Object.getOwnPropertyNames;var oh=Object.getPrototypeOf,ah=Object.prototype.hasOwnProperty;var sh=(e,t,n)=>t in e?Ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var lh=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ih(t))!ah.call(e,i)&&i!==n&&Ro(e,i,{get:()=>t[i],enumerable:!(r=rh(t,i))||r.enumerable});return e};var uh=(e,t,n)=>(n=e!=null?nh(oh(e)):{},lh(t||!e||!e.__esModule?Ro(n,"default",{value:e,enumerable:!0}):n,e));var ye=(e,t,n)=>sh(e,typeof t!="symbol"?t+"":t,n);var Rc=oe((PE,Ra)=>{var ee=String,Cc=function(){return{isColorSupported:!1,reset:ee,bold:ee,dim:ee,italic:ee,underline:ee,inverse:ee,hidden:ee,strikethrough:ee,black:ee,red:ee,green:ee,yellow:ee,blue:ee,magenta:ee,cyan:ee,white:ee,gray:ee,bgBlack:ee,bgRed:ee,bgGreen:ee,bgYellow:ee,bgBlue:ee,bgMagenta:ee,bgCyan:ee,bgWhite:ee,blackBright:ee,redBright:ee,greenBright:ee,yellowBright:ee,blueBright:ee,magentaBright:ee,cyanBright:ee,whiteBright:ee,bgBlackBright:ee,bgRedBright:ee,bgGreenBright:ee,bgYellowBright:ee,bgBlueBright:ee,bgMagentaBright:ee,bgCyanBright:ee,bgWhiteBright:ee}};Ra.exports=Cc();Ra.exports.createColors=Cc});var Ta=oe(()=>{});var Ai=oe((HE,Mc)=>{"use strict";var Tc=Rc(),kc=Ta(),Jn=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=Tc.isColorSupported);let r=d=>d,i=d=>d,o=d=>d;if(t){let{bold:d,gray:m,red:f}=Tc.createColors(!0);i=h=>d(f(h)),r=h=>m(h),kc&&(o=h=>kc(h))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((d,m)=>{let f=l+1+m,h=" "+(" "+f).slice(-u)+" | ";if(f===this.line){if(d.length>160){let v=20,x=Math.max(0,this.column-v),_=Math.max(this.column+v,this.endColumn+v),T=d.slice(x,_),C=r(h.replace(/\\d/g," "))+d.slice(0,Math.min(this.column-1,v-1)).replace(/[^\\t]/g," ");return i(">")+r(h)+o(T)+`\n `+C+i("^")}let b=r(h.replace(/\\d/g," "))+d.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(h)+o(d)+`\n `+b+i("^")}return" "+r(h)+o(d)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};Mc.exports=Jn;Jn.default=Jn});var ka=oe((BE,Nc)=>{"use strict";var kg=/(<)(\\/?style\\b)/gi,Mg=/(<)(!--)/g;function At(e){return typeof e!="string"||!e.includes("<")?e:e.replace(kg,"\\\\3c $2").replace(Mg,"\\\\3c $2")}var Fc={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Fg(e){return e[0].toUpperCase()+e.slice(1)}var Qn=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(At(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(At(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(At(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:At(s)),this.stringify(l,r!==a||i)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(At("/*"+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(At(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 Fc[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"+Fg(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=Fc[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:At(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(At(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)}};Nc.exports=Qn;Qn.default=Qn});var Zn=oe((UE,Lc)=>{"use strict";var Ng=ka();function Ma(e,t){new Ng(t).stringify(e)}Lc.exports=Ma;Ma.default=Ma});var Ei=oe((WE,Fa)=>{"use strict";Fa.exports.isClean=Symbol("isClean");Fa.exports.my=Symbol("my")});var nr=oe((VE,Dc)=>{"use strict";var Lg=Ai(),Dg=ka(),Ig=Zn(),{isClean:er,my:Pg}=Ei();function Na(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=>Na(a,n)):(o==="object"&&i!==null&&(i=Na(i)),n[r]=i)}return n}function ct(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 tr=class{get proxyOf(){return this}constructor(t={}){this.raws={},this[er]=!1,this[Pg]=!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=Na(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 Lg(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[er]=!0}markDirty(){if(this[er]){this[er]=!1;let t=this;for(;t=t.parent;)t[er]=!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(ct(r,this.source.start),ct(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=ct(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:ct(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:ct(n,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let a=n.slice(ct(n,this.source.start),ct(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:ct(n,t.start)}:t.index&&(r=this.positionInside(t.index)),t.end?i={column:t.end.column,line:t.end.line,offset:ct(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 Dg().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=Ig){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)}};Dc.exports=tr;tr.default=tr});var ir=oe((zE,Ic)=>{"use strict";var Og=nr(),rr=class extends Og{constructor(t){super(t),this.type="comment"}};Ic.exports=rr;rr.default=rr});var ar=oe((qE,Pc)=>{"use strict";var Gg=nr(),or=class extends Gg{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"}};Pc.exports=or;or.default=or});var Et=oe(($E,qc)=>{"use strict";var Oc=ir(),Gc=ar(),Hg=nr(),{isClean:Hc,my:Bc}=Ei(),La,Uc,Wc,Da;function Vc(e){return e.map(t=>(t.nodes&&(t.nodes=Vc(t.nodes)),delete t.source,t))}function zc(e){if(e[Hc]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)zc(t)}var je=class e extends Hg{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=Vc(Uc(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 Gc(t)]}else if(t.selector||t.selectors)t=[new Da(t)];else if(t.name)t=[new La(t)];else if(t.text)t=[new Oc(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Bc]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Hc]&&zc(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)}))}};je.registerParse=e=>{Uc=e};je.registerRule=e=>{Da=e};je.registerAtRule=e=>{La=e};je.registerRoot=e=>{Wc=e};qc.exports=je;je.default=je;je.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,La.prototype):e.type==="rule"?Object.setPrototypeOf(e,Da.prototype):e.type==="decl"?Object.setPrototypeOf(e,Gc.prototype):e.type==="comment"?Object.setPrototypeOf(e,Oc.prototype):e.type==="root"&&Object.setPrototypeOf(e,Wc.prototype),e[Bc]=!0,e.nodes&&e.nodes.forEach(t=>{je.rebuild(t)})}});var wi=oe((jE,jc)=>{"use strict";var $c=Et(),sn=class extends $c{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)}};jc.exports=sn;sn.default=sn;$c.registerAtRule(sn)});var _i=oe((KE,Xc)=>{"use strict";var Bg=Et(),Kc,Yc,Gt=class extends Bg{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Kc(new Yc,this,t).stringify()}};Gt.registerLazyResult=e=>{Kc=e};Gt.registerProcessor=e=>{Yc=e};Xc.exports=Gt;Gt.default=Gt});var Qc=oe((YE,Jc)=>{var Ug="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Wg=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},Vg=(e=21)=>{let t="",n=e|0;for(;n--;)t+=Ug[Math.random()*64|0];return t};Jc.exports={nanoid:Vg,customAlphabet:Wg}});var Ci=oe(()=>{});var Ri=oe(()=>{});var Ia=oe(()=>{});var Zc=oe(()=>{});var Oa=oe((iw,nd)=>{"use strict";var{existsSync:zg,readFileSync:qg}=Zc(),{dirname:Pa,join:$g}=Ci(),{SourceMapConsumer:ed,SourceMapGenerator:td}=Ri();function jg(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var sr=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=Pa(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ed(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 jg(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=Pa(t),zg(t)))return this.mapFile=t,qg(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 ed)return td.fromSourceMap(n).toString();if(n instanceof td)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=$g(Pa(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)}};nd.exports=sr;sr.default=sr});var lr=oe((ow,sd)=>{"use strict";var{nanoid:Kg}=Qc(),{isAbsolute:Ba,resolve:Ua}=Ci(),{SourceMapConsumer:Yg,SourceMapGenerator:Xg}=Ri(),{fileURLToPath:rd,pathToFileURL:Ti}=Ia(),id=Ai(),Jg=Oa(),Ga=Ta(),Ha=Symbol("lineToIndexCache"),Qg=!!(Yg&&Xg),od=!!(Ua&&Ba);function ad(e){if(e[Ha])return e[Ha];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[Ha]=n,n}var ln=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&&(!od||/^\\w+:\\/\\//.test(n.from)||Ba(n.from)?this.file=n.from:this.file=Ua(n.from)),od&&Qg){let r=new Jg(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 "+Kg(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,a,l,s,u;if(n&&typeof n=="object"){let m=n,f=r;if(typeof m.offset=="number"){s=m.offset;let h=this.fromOffset(s);n=h.line,r=h.col}else n=m.line,r=m.column,s=this.fromLineAndColumn(n,r);if(typeof f.offset=="number"){l=f.offset;let h=this.fromOffset(l);a=h.line,o=h.col}else a=f.line,o=f.column,l=this.fromLineAndColumn(f.line,f.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let m=this.fromOffset(s);n=m.line,r=m.col}let d=this.origin(n,r,a,o);return d?u=new id(t,d.endLine===void 0?d.line:{column:d.column,line:d.line},d.endLine===void 0?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,i.plugin):u=new id(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&&(Ti&&(u.input.url=Ti(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return ad(this)[t-1]+n-1}fromOffset(t){let n=ad(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:Ua(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;Ba(a.source)?s=Ti(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||Ti(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(rd)u.file=rd(s);else throw new Error("file: protocol is not available in this PostCSS build");let d=o.sourceContentFor(a.source);return d&&(u.source=d),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}};sd.exports=ln;ln.default=ln;Ga&&Ga.registerInput&&Ga.registerInput(ln)});var un=oe((aw,dd)=>{"use strict";var ld=Et(),ud,cd,wt=class extends ld{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 ud(new cd,this,t).stringify()}};wt.registerLazyResult=e=>{ud=e};wt.registerProcessor=e=>{cd=e};dd.exports=wt;wt.default=wt;ld.registerRoot(wt)});var Wa=oe((sw,fd)=>{"use strict";var ur={comma(e){return ur.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return ur.split(e,t)},split(e,t,n){let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let d of e)u?u=!1:d==="\\\\"?u=!0:l?d===s&&(l=!1):d===\'"\'||d==="\'"?(l=!0,s=d):d==="("?a+=1:d===")"?a>0&&(a-=1):a===0&&t.includes(d)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=d;return(n||i!=="")&&r.push(i.trim()),r}};fd.exports=ur;ur.default=ur});var ki=oe((lw,pd)=>{"use strict";var md=Et(),Zg=Wa(),cn=class extends md{get selectors(){return Zg.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=[])}};pd.exports=cn;cn.default=cn;md.registerRule(cn)});var gd=oe((uw,hd)=>{"use strict";var eb=wi(),tb=ir(),nb=ar(),rb=lr(),ib=Oa(),ob=un(),ab=ki();function cr(e,t){if(Array.isArray(e))return e.map(i=>cr(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:rb.prototype};o.map&&(o.map={...o.map,__proto__:ib.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>cr(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 ob(r);if(r.type==="decl")return new nb(r);if(r.type==="rule")return new ab(r);if(r.type==="comment")return new tb(r);if(r.type==="atrule")return new eb(r);throw new Error("Unknown node type: "+e.type)}hd.exports=cr;cr.default=cr});var za=oe((cw,Ad)=>{"use strict";var{dirname:Mi,relative:xd,resolve:yd,sep:vd}=Ci(),{SourceMapConsumer:Sd,SourceMapGenerator:Fi}=Ri(),{pathToFileURL:bd}=Ia(),sb=lr(),lb=!!(Sd&&Fi),ub=!!(Mi&&yd&&xd&&vd),Va=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||Mi(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Sd(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(),ub&&lb&&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=Fi.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Fi({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 Fi({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 d=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==d.last||d.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?Mi(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Mi(yd(r,this.mapOpts.annotation)));let i=xd(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 sb(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(bd){let r=bd(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;vd==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Ad.exports=Va});var _d=oe((dw,wd)=>{"use strict";var Ni=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Li=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,cb=/.[\\r\\n"\'(/\\\\]/,Ed=/[\\da-f]/i;wd.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,d,m,f,h,b,v=r.length,x=0,_=[],T=[],C=-1;function F(){return x}function D(w){throw t.error("Unclosed "+w,x)}function M(){return T.length===0&&x>=v}function S(w){if(T.length)return T.pop();if(x>=v)return;let R=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);d=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let I=String.fromCharCode(o);d=[I,I,x];break}case 40:{if(b=_.length?_.pop()[1]:"",h=r.charCodeAt(x+1),b==="url"&&h!==39&&h!==34&&h!==32&&h!==10&&h!==9&&h!==12&&h!==13){s=x;do{if(m=!1,s=r.indexOf(")",s+1),s===-1)if(i||R){s=x;break}else D("bracket");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);d=["brackets",r.slice(x,s+1),x,s],x=s}else x<=C?d=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||cb.test(a)?(C=s===-1?v:s,d=["(","(",x]):(d=["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||R){s=x+1;break}else D("string");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);d=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{Ni.lastIndex=x+1,Ni.test(r),Ni.lastIndex===0?s=r.length-1:s=Ni.lastIndex-2,d=["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,Ed.test(r.charAt(s)))){for(;Ed.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}d=["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||R?s=r.length:D("comment")),d=["comment",r.slice(x,s+1),x,s],x=s):(Li.lastIndex=x+1,Li.test(r),Li.lastIndex===0?s=r.length-1:s=Li.lastIndex-2,d=["word",r.slice(x,s+1),x,s],_.push(d),x=s);break}}return x++,d}function A(w){T.push(w)}return{back:A,endOfFile:M,nextToken:S,position:F}}});var kd=oe((fw,Td)=>{"use strict";var db=wi(),fb=ir(),mb=ar(),pb=un(),Cd=ki(),hb=_d(),Rd={empty:!0,space:!0};function gb(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var qa=class{constructor(t){this.input=t,this.root=new pb,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 db;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 fb;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=hb(this.input)}decl(t,n){let r=new mb;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]||gb(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 d=this.stringFrom(t,u);d=this.spacesFromEnd(t)+d,d!==" !important"&&(r.raws.important=d);break}else if(o[1].toLowerCase()==="important"){let d=t.slice(0),m="";for(let f=u;f>0;f--){let h=d[f][0];if(m.trim().startsWith("!")&&h!=="space")break;m=d.pop()[1]+m}m.trim().startsWith("!")&&(r.important=!0,r.raws.important=m,t=d)}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 Cd;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,d,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",d=r[f+1]?r[f+1][0]:"empty",!Rd[m]&&!Rd[d]?s.slice(-1)===","?u=!1:s+=o[1]:u=!1):s+=o[1];if(!u){let f=r.reduce((h,b)=>h+b[1],"");t.raws[n]={raw:f,value:s}}t[n]=s}rule(t){t.pop();let n=new Cd;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})}};Td.exports=qa});var Ii=oe((mw,Md)=>{"use strict";var bb=Et(),xb=lr(),yb=kd();function Di(e,t){let n=new xb(e,t),r=new yb(n);try{r.parse()}catch(i){throw i}return r.root}Md.exports=Di;Di.default=Di;bb.registerParse(Di)});var $a=oe((pw,Fd)=>{"use strict";var dr=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}};Fd.exports=dr;dr.default=dr});var Pi=oe((hw,Nd)=>{"use strict";var vb=$a(),fr=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 vb(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};Nd.exports=fr;fr.default=fr});var ja=oe((gw,Dd)=>{"use strict";var Ld={};Dd.exports=function(t){Ld[t]||(Ld[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var Xa=oe((xw,Gd)=>{"use strict";var Sb=Et(),Ab=_i(),Eb=za(),wb=Ii(),Id=Pi(),_b=un(),Cb=Zn(),{isClean:et,my:Rb}=Ei(),bw=ja(),Tb={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},kb={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},Mb={Once:!0,postcssPlugin:!0,prepare:!0},dn=0;function mr(e){return typeof e=="object"&&typeof e.then=="function"}function Od(e){let t=!1,n=Tb[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,dn,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,dn,n+"Exit"]:[n,n+"Exit"]}function Pd(e){let t;return e.type==="document"?t=["Document",dn,"DocumentExit"]:e.type==="root"?t=["Root",dn,"RootExit"]:t=Od(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Ka(e){return e[et]=!1,e.nodes&&e.nodes.forEach(t=>Ka(t)),e}var Ya={},_t=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=Ka(n);else if(n instanceof e||n instanceof Id)i=Ka(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=wb;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[Rb]&&Sb.rebuild(i)}this.result=new Id(t,i,r),this.helpers={...Ya,postcss:Ya,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(!kb[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Mb[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(mr(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];){t[et]=!0;let n=[Pd(t)];for(;n.length>0;){let r=this.visitTick(n);if(mr(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 mr(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=Cb;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 Eb(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(mr(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];)t[et]=!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(mr(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[et]){l[et]=!0,t.push(Pd(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===dn){r.nodes&&r.nodes.length&&(r[et]=!0,n.iterator=r.getIterator());return}else if(this.listeners[a]){n.visitors=this.listeners[a];return}}t.pop()}walkSync(t){t[et]=!0;let n=Od(t);for(let r of n)if(r===dn)t.nodes&&t.each(i=>{i[et]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}};_t.registerPostcss=e=>{Ya=e};Gd.exports=_t;_t.default=_t;_b.registerLazyResult(_t);Ab.registerLazyResult(_t)});var Bd=oe((vw,Hd)=>{"use strict";var Fb=za(),Nb=Ii(),Lb=Pi(),Db=Zn(),yw=ja(),pr=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=Nb;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=Db;this.result=new Lb(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 Fb(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[]}};Hd.exports=pr;pr.default=pr});var Wd=oe((Sw,Ud)=>{"use strict";var Ib=_i(),Pb=Xa(),Ob=Bd(),Gb=un(),Ht=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 Ob(this,t,n):new Pb(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};Ud.exports=Ht;Ht.default=Ht;Gb.registerProcessor(Ht);Ib.registerProcessor(Ht)});var Xd=oe((Aw,Yd)=>{"use strict";var Vd=wi(),zd=ir(),Hb=Et(),Bb=Ai(),qd=ar(),$d=_i(),Ub=gd(),Wb=lr(),Vb=Xa(),zb=Wa(),qb=nr(),$b=Ii(),Ja=Wd(),jb=Pi(),jd=un(),Kd=ki(),Kb=Zn(),Yb=$a();function le(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Ja(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 Ja().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=Kb;le.parse=$b;le.fromJSON=Ub;le.list=zb;le.comment=e=>new zd(e);le.atRule=e=>new Vd(e);le.decl=e=>new qd(e);le.rule=e=>new Kd(e);le.root=e=>new jd(e);le.document=e=>new $d(e);le.CssSyntaxError=Bb;le.Declaration=qd;le.Container=Hb;le.Processor=Ja;le.Document=$d;le.Comment=zd;le.Warning=Yb;le.AtRule=Vd;le.Result=jb;le.Input=Wb;le.Rule=Kd;le.Root=jd;le.Node=qb;Vb.registerPostcss(le);Yd.exports=le;le.default=le});function Kr(){return globalThis}function L(e,t){if(typeof window>"u")return;let n=Kr(),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 ch=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data"];function dh(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 fh(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=dh(r,n);return{numerator:r/i,denominator:n/i}}function To(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 Yr(e){return{protocolVersion:1,capabilities:ch,fps:fh(e)}}function mh(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function kl(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=To(n.fps);return r===null||!mh(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Ml=30;function Fl(e){Ml=Number.isFinite(e)&&e>0?e:30}function ve(e){try{window.parent.postMessage({...e,...Yr(Ml)},"*")}catch(t){L("bridge.postMessage",t)}}var ph=new Map(Object.entries({play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(hh(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=>bh(e),"set-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onSetRuntimeData?.(e.channel,e.payload,e.requestId)},"clear-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onClearRuntimeData?.(e.channel,e.requestId)}}));function hh(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=To(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function gh(e){let t=kl(e);return t.status!=="unsupported"?!1:(ve({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 bh(e){let t=e.selectors,n=e.duration||800;t&&xh(t,n)}function Nl(e){let t=n=>{if(n.source!==window.parent&&n.source!==window)return;let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||gh(r))return;let i=r.action;if(typeof i!="string")return;let o=ph.get(i);o&&o(r,e)};return window.addEventListener("message",t),ve({source:"hf-preview",type:"ready"}),t}function xh(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var ko=null;function Ll(e){ko=e}function Be(e,t){if(ko)try{ko({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function yh(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 Kt(e){return`--${yh(e)}`}function Dl(e){let t=new Map;for(let n of e){let r=Kt(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 Pl(){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,kn(i));let n=Jr(),r={...t,...n};for(let i of e)Fo(i,r);return r}var Il=new Set;function Ol(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 vh(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function Sh(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 Ah(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=Sh(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function Fo(e,t,n){if(!e)return;let r=Ol(e);if(r.length===0)return;let i=vh(e,n);for(let o of r){let a=Ah(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(Il.has(l))continue;Il.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 kn(e){let t={};for(let n of Ol(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Mo="data-hf-css-vars";function Xr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function No(e,t){if(!Xr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Kt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Mo,n.join(" "))}function Gl(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Kt(i);((Xr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Hl(e){if(!Xr(e))return;let t=e.getAttribute(Mo);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Mo)}}function Bl(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=Jr(),r=[];for(let i of t)r.push(...Eh(i,n,e.defaultView));for(let i of Dl(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Kt(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function Eh(e,t,n){if(!Xr(e))return[];let r=kn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Kt(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 No(e,i),Object.keys(r)}function Ul(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 Jr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}var Wl="http://www.w3.org/1999/xhtml";function Ne(e){return e!=null&&e.nodeType===1}function Se(e){return Ne(e)&&e.namespaceURI===Wl}function Mn(e,t){return Se(e)&&e.localName===t}function me(e){return Mn(e,"video")}function Lo(e){return Mn(e,"audio")}function ge(e){return me(e)||Lo(e)}function Oe(e){return Mn(e,"img")}function Vl(e){return Mn(e,"style")}function zl(e){return Mn(e,"link")}function Do(e){return Ne(e)&&(e.namespaceURI===Wl||e.namespaceURI==="http://www.w3.org/2000/svg")}function ql(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,d)=>{let m=null;try{m=u.effect?.getComputedTiming?.()??null}catch(h){L("runtime.adapters.css.site5",h)}if(!m)return{};let f=Number(m.endTime);return Number.isFinite(f)?{endSeconds:d+f/1e3}:{unbounded:!0}},o=(u,d)=>{for(let m of u){try{m.currentTime=d}catch(f){L("runtime.adapters.css.site1",f)}try{m.pause()}catch(f){L("runtime.adapters.css.site2",f)}}},a=u=>{for(let d of u)try{d.play()}catch(m){L("runtime.adapters.css.site3",m)}},l=u=>{for(let d of u)try{d.pause()}catch(m){L("runtime.adapters.css.site4",m)}},s=u=>{u.baseDelay?u.el.style.animationDelay=u.baseDelay:u.el.style.removeProperty("animation-delay"),u.basePlayState?u.el.style.animationPlayState=u.basePlayState:u.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let u=document.querySelectorAll("*");for(let d of u){if(!Se(d))continue;let m=window.getComputedStyle(d);!m.animationName||m.animationName==="none"||t.push({el:d,baseDelay:d.style.animationDelay||"",basePlayState:d.style.animationPlayState||"",animations:n(d)})}},getInferredDurationSeconds:()=>{let u=0;for(let d of t){if(!d.el.isConnected)continue;let m=r(d.el);for(let f of n(d.el)){let h=i(f,m);h.endSeconds!=null&&(u=Math.max(u,h.endSeconds))}}return u>0?u:null},seek:u=>{let d=Number(u.time)||0;for(let m of t){if(!m.el.isConnected)continue;let f=r(m.el),h=Math.max(0,d-f)*1e3,b=m.animations;if(b.length>0){o(b,h);continue}m.el.style.animationPlayState="paused",m.el.style.animationDelay=`-${(h/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let d=u.animations;d.length>0&&l(d),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function $l(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 jl(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function Yl(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(Io(r))r.goToAndStop(t*1e3,!1);else if(Po(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??0;if(Number.isFinite(i)&&i>0){let o=Math.min(100,t/i*100);r.seek(o)}}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(Io(t)||Po(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=wh(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function Kl(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function wh(e){return Io(e)?Kl(e.totalFrames,e.frameRate):Po(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:Kl(e.totalFrames,e.frameRate):null}function Io(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Po(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Oo=-1,Qr=new Set,Yt,Go=0;function Xl(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));Qr.add(i),i.then(o=>{Qr.delete(i)&&o.status==="rejected"&&Yt===void 0&&(Yt={reason:o.reason})})}function Zr(e){e!==Oo&&(Oo=e,Xl(e))}function ei(e){Oo=e,Xl(e)}function Jl(){return Go>0}async function Ho(){Go+=1;let e=Yt;try{for(await Promise.resolve();Qr.size>0;){let r=(await Promise.all([...Qr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Yt;if(e===void 0&&(e=t),Yt===t&&(Yt=void 0),e)throw e.reason}finally{Go-=1}}function Ql(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let d=window.THREE?.DefaultLoadingManager;return!d||typeof d!="object"||typeof d.itemsLoaded!="number"||typeof d.itemsTotal!="number"?null:d},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(d=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,d()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(d,m,f){try{r?.call(this,d,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,Zr(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 Je(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 Zl(){return Je({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 eu(){return Je({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 tu(){return Je({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 nu(){return Je({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 ru(){return Je({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var _h=250;function iu(){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&&(Jl()||(window.__hfTypegpuTime=e,ei(e)))},_h))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,Zr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var Fn="data-hf-render-id",ou="data-hf-group-render-id";function Ch(e){return e.getAttribute(Fn)||e.id||null}var Rh="__render_frame_",Th="__";function kh(e){return`${Rh}${e}${Th}`}function Mh(e){let t=Ch(e);return t?kh(t):null}function bt(e){let t=Mh(e);if(!t)return null;let n=document.getElementById(t);return Oe(n)?n:null}function au(e){let t=e.nextElementSibling;if(Oe(t)&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=bt(e);return n&&n.complete&&n.naturalWidth>0?n:null}function su(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(me(n?.source)){let o=au(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function lu(){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(me(u)){let d=au(u);d&&(l[s]=d)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function uu(){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},d=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,m=(x,_)=>{let T=l.get(x);if(T)return T;let C={compositionTimeMs:_,animationTimeMs:e?d(u(x),_):u(x)};return l.set(x,C),C},f=(x,_)=>{if(!a.has(x)){a.add(x);let T=()=>{a.delete(x)};try{x.addEventListener("finish",T,{once:!0}),x.addEventListener("cancel",T,{once:!0})}catch(C){L("runtime.adapters.waapi.site4",C)}}m(x,_)},h=(x,_)=>{for(let T of x)f(T,_)},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 T=function(...C){let F=_.apply(this,C);return f(F,t),F};x.animate=T,r=x,i=_,o=T,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(F){L("runtime.adapters.waapi.site4",F)}if(!_)return{};let T=Number(_.endTime);return Number.isFinite(T)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+T/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),h(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&h(s(),e?_:0);for(let T of a){let C=e?m(T,_):m(T,0),F=C.animationTimeMs+Math.max(0,_-C.compositionTimeMs);try{T.currentTime=F}catch(D){L("runtime.adapters.waapi.site1",D)}try{T.pause()}catch(D){L("runtime.adapters.waapi.site2",D)}}},pause:()=>{e||h(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let T=v(_);T.endSeconds!=null&&(x=Math.max(x,T.endSeconds))}return x>0?x:null}}}var Bo=3.981071705534972;function Ue(e){return Number.isFinite(e)?Math.max(0,Math.min(Bo,e)):1}function ti(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function cu(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,ti(o))}});try{return t()}finally{delete e.volume,i.call(e,ti(o))}}var Xt=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),BS=Object.freeze([Xt.start,Xt.duration,Xt.trackIndex]),US=Object.freeze([Xt.derivedEnd]),WS=Object.freeze([Xt.derivedEnd,Xt.legacyTrack]);function ni(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var fu=/^[A-Za-z0-9_.:-]+$/;function mu(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function du(e,t){let n=t;for(;n>=0&&mu(e,n);)n--;return n}function Fh(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function Nh(e){let t=e.length-1;if(!mu(e,t))return null;let n=du(e,t);return e[n]==="."&&(n=du(e,n-1)),n+1}function Lh(e){let t=Nh(e);if(t==null)return null;let n=Fh(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!fu.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function Uo(e){let t=(e??"").trim();if(!t)return null;let n=ni(t);if(n!=null)return{kind:"absolute",value:n};if(fu.test(t))return{kind:"reference",refId:t,offset:0};let r=Lh(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function pu(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function Ce(e){return ni(e)}function Le(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:ge(e)?e.defaultPlaybackRate:1;return pu(n)}function Nn(e){let t=n=>{let r=Ce(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 xt(e,t){return Dh(t,Nn(e),Le(e))}function ri(e){let t=Ce(e.getAttribute("data-duration"));return t!=null&&t>0?t:Number.isFinite(e.duration)?xt(e,e.duration):null}function Dh(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/pu(n):null}function Ln(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function Jt(e){let t=Ln(e.start);if(t==null)return null;let n=Math.max(0,t),r=Ln(e.duration),i=Ln(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=Ln(e.end),l=Ln(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var ii="data-hf-media-start-basis";function Ih(e){return e?.trim().toLowerCase()==="global"?"global":"local"}function hu(e){return Ih(e.basis)==="global"?e.authoredStart:e.hostStart+e.authoredStart}function st(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=f=>{let h=r.getElementById(f);return h||(r.querySelector(`[data-composition-id="${CSS.escape(f)}"]`)??null)},s=f=>{let h=o.get(f);if(h!==void 0)return h;let b=null,v=Jt({start:0,duration:f.getAttribute("data-duration"),authoredDuration:n?f.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=d(f,0),_=Jt({start:x,end:f.getAttribute("data-end"),authoredEnd:n?f.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&ge(f)){let x=Nn(f);Number.isFinite(f.duration)&&f.duration>x&&(b=(f.duration-x)/Le(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 T=Number(_.duration());Number.isFinite(T)&&T>0&&(b=T)}catch(T){L("runtime.startResolver.site1",T)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(f,b),b):(o.set(f,null),null)},u=(f,h)=>{if(f.hasAttribute("data-composition-id")){let v=f.parentElement?.closest("[data-composition-id]");return v?d(v,h):0}let b=f.closest("[data-composition-id]");return b?d(b,h):0},d=(f,h)=>{let b=i.get(f);if(b!==void 0)return b??h;if(a.has(f))return h;a.add(f);try{let v=Uo(f.getAttribute("data-start"));if(!v){if(f.hasAttribute("data-composition-id")){let F=f.parentElement;if(F&&(F.hasAttribute("data-composition-src")||F.hasAttribute("data-composition-id")||F.hasAttribute("data-composition-file"))){let D=d(F,h);return i.set(f,D),D}}return i.set(f,h),h}if(v.kind==="absolute"){let F=Math.max(0,v.value),D=Math.max(0,u(f,h)+F);return i.set(f,D),D}let x=l(v.refId);if(!x)return i.set(f,h),h;let _=d(x,0),T=s(x);if(T==null||T<=0){let F=Math.max(0,_+v.offset);return i.set(f,F),F}let C=Math.max(0,_+T+v.offset);return i.set(f,C),C}finally{a.delete(f)}};return{resolveStartForElement:(f,h=0)=>d(f,Math.max(0,h)),resolveDurationForElement:f=>s(f),resolveMediaStartForElement:f=>{let h=f.closest("[data-composition-id]"),b=h?d(h,0):0,v=Ce(f.getAttribute("data-start"));return f.hasAttribute("data-hf-auto-start")||v==null||b<=0?d(f,b):hu({authoredStart:v,hostStart:b,basis:f.getAttribute(ii)})}}}function Ph(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:Ue(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:Ue(n)}),i}function gu(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 Oh(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 Gh(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Hh(e,t){let n=st({timelineRegistry:window.__timelines,includeAuthoredTimingAttrs:!0}).resolveMediaStartForElement(e),r=Ce(e.dataset.end)??void 0,i=Ce(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=Gh(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Ue(a)}}function Bh(e,t,n,r,{start:i,end:o,staticVolume:a}){let l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),d=cu(e,()=>{e.volume=a;let f=[],h;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(Ue(v).toFixed(6))};Oh(f,h,x,b===u),h=x}if(b===u)break}return f});return d.some(f=>Math.abs(f.volume-a)>1e-4)?d:null}function bu(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!ge(e)||n<=0)return;let o=u=>{try{typeof t.totalTime=="function"?t.totalTime(u,!0):typeof t.seek=="function"&&t.seek(u,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Hh(e,n),s=Bh(e,o,n,60,l);if(Number.isFinite(a)&&o(a),s){let u=Ph(s,l.start,l.staticVolume);u.length>0&&r.set(e,u)}}var It="data-fx-chain",cA=It.slice(5),xu=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}),Wo=(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}),oi=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),yu={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."},Su=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[oi(-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),oi(-40,40,0),Wo(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),oi(-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),oi(-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),Wo(.707),yu],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),Wo(.707),yu],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],Vo=new Map(Su.map(e=>[e.id,e]));function In(e){return Vo.get(e)}var dA=Su.map(e=>e.id);function Pn(e,t){let n=Vo.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 yt=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Au(e){let t;try{t=JSON.parse(e)}catch(i){throw new yt(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new yt("Chain file must be a JSON object.");let n=t;if(n.version!==xu)throw new yt(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new yt("Chain file is missing a `nodes` array.");let r=n.nodes.map(Uh);return{version:xu,nodes:r}}function On(e){return e.nodes.filter(t=>t.enabled!==!1)}function Uh(e,t){if(typeof e!="object"||e===null)throw new yt(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!Vo.has(n.type))throw new yt(`Node ${t} has unknown effect type: ${String(n.type)}`);return Vh({type:n.type,id:ai(n.id),fromCarve:vu(n.fromCarve),fromPreset:ai(n.fromPreset),label:ai(n.label),fromEq:ai(n.fromEq),fromLeveller:vu(n.fromLeveller),presetAmount:Wh(n.presetAmount),enabled:n.enabled!==!1,params:Pn(n.type,n.params??void 0)})}function ai(e){return typeof e=="string"&&e?e:void 0}function vu(e){return e===!0?!0:void 0}function Wh(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function Vh(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var ut="data-automation",hA=ut.slice(5),si=1,zh=512,lt=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Qt="volume";function Hn(e){if(e===Qt)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===qh){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 qh="preset";var $h={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},li={min:0,max:Bo,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function zo(e,t){let n=Hn(e);if(!n)return null;if(n.kind==="volume")return li;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...$h,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=In(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 Gn(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 jh(e){let t=Gn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function Eu(e,t){let n=Gn(e),r=Gn(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 Kh(e){let t=jh(e?.curve),n=Eu(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Yh(e,t){let n=Gn(e?.t),r=Gn(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,...Kh(e)}}function wu(e,t){let n=e.map(i=>Yh(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,zh)}function Xh(e){let t=[];for(let n of e.lanes){if(!Hn(n.target))continue;let r=n.target===Qt?li:null,i=wu(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:si,lanes:t}}function _u(e,t){let n=[];for(let r of e.lanes){let i=zo(r.target,t);if(!i)continue;let o=wu(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:si,lanes:n}}function ui(e){let t;try{t=JSON.parse(e)}catch(i){throw new lt(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new lt("Automation must be a JSON object.");let n=t;if(n.version!==si)throw new lt(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new lt("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new lt(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!Hn(a.target))throw new lt(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new lt(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return Xh({version:si,lanes:r})}function Jh(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Qh(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 Zh(e,t,n){let{cx:r,cy:i,w:o}=Qh(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=e0(l,s,e),d=1-u,m=d*d+2*o*u*d+u*u;return m>0?(2*o*i*u*d+u*u)/m:e}function e0(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 t0(e,t){let n=Eu(t.viaX,t.viaY);return n?Zh(Math.min(1,Math.max(0,e)),n.x,n.y):Jh(e,t.curve)}function n0(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],d=u.t-s.t;return d<=0?u.v:n0(s.v,u.v,t0((t-s.t)/d,s),n)}function Cu(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Ru(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 ci=new Map,r0=64;function i0(e){let t=ci.get(e);if(t!==void 0)return t;let n=null;try{n=ui(e).lanes.find(r=>r.target===Qt)??null}catch{n=null}return ci.size>r0&&ci.clear(),ci.set(e,n),n}function Tu(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(ut):null)??"";if(!n)return null;let r=i0(n);return!r||r.points.length===0?null:Bn(r,t)}var Zt="hf-audio-group",di="data-audio-group";function qo(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function $o(e,t){let n=Array.from(e?.querySelectorAll?.(`${Zt}[${Fn}]`)??[]).find(i=>i.getAttribute(Fn)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Zt?r:null}function fi(e,t){let n=t?.getAttribute?.(ou)??t?.getAttribute?.(di);return n?$o(e,n)?.hasAttribute("data-hidden")??!1:!1}function ku(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(di)||null}function Mu(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Zt}{display:none!important}`,e.head.appendChild(n)}function Qe(e){return Nn(e)}function Fu(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 Nu(e){let t=e?.elements??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=Qe(a),u=Le(a),d=a.loop,m=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,f=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(f)||f<0)&&m!=null&&(f=Math.max(0,(m-s)/u));let h=Number.isFinite(f)&&f>=0,b=h?l+f:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:h?f:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:d,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 Ko=new WeakMap,mi=new WeakMap,Un=new WeakMap,Yo=new WeakSet,en=new WeakSet;function o0(e){if(en.has(e))return;en.add(e);let t=()=>en.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var a0=3;function s0(e){return e.error!=null||e.networkState===a0}var Xo=new WeakMap;function jo(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Jo(e){Ko.delete(e),mi.delete(e),Un.delete(e),Yo.delete(e),Xo.delete(e)}function Lu(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=mi.get(r),s=r.tagName==="AUDIO"&&(l===void 0||i<l-.04),u=!n.loop&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration&&(o||s);if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||u)){if(mi.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let G=n.sourceDuration-n.mediaStart;G>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%G)}let f=jo(e.userVolume??1),h=Ue(n.volume??1),b=Xo.get(r),v=jo(r.volume),x,_=Tu(r,e.timeSeconds-n.start);if(_!==null)x=Ue(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let G=e.timeSeconds-n.start;x=Ue(gu(n.volumeKeyframes,G))}else e.isWebAudioRouted?.(r)?x=h:b===void 0?x=h>1?h:v:Math.abs(v-b)>1e-4?x=v:x=h;let C=r.closest("[data-hidden]")!==null||fi(r.ownerDocument,r)?0:jo(x*f);r.volume=C,Xo.set(r,C),e.onElementVolume?.(r,C,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(G){L("runtime.media.site1",G)}let F=.04,D=2,M=r.currentTime||0,S=Math.abs(M-i),A=i-M,w=Ko.get(r);Ko.set(r,A);let R=w===void 0,I=!R&&Math.abs(A-w)>.5,H=S>3,j=r.tagName==="AUDIO"&&R&&M-i>F,X=a&&S>.001||r.ended&&u&&S>.001||j||S>.5&&(R||I||H),k=r.tagName==="VIDEO"&&!r.paused,U=w!==void 0&&Math.abs(A-w)<.004,te=!1;if(!k&&!X&&!R&&U&&S>F){let G=(Un.get(r)??0)+1;Un.set(r,G),G>=D&&(te=!0,Un.set(r,0))}else S<=F&&Un.set(r,0);let B=!k&&e.forceSync&&S>.02;if(X||te||B){if(!(r.tagName==="VIDEO"&&!!bt(r))){try{r.currentTime=i}catch(W){L("runtime.media.site2",W)}if(Math.abs(r.currentTime-i)>.5&&!Yo.has(r)){Yo.add(r),r.load();try{r.currentTime=i}catch(W){L("runtime.media.site3",W)}}}en.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!en.has(r)&&!s0(r)?(o0(r),r.play().catch(G=>{en.delete(r),(G&&typeof G=="object"&&"name"in G?String(G.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let m=e.timeSeconds>=n.start&&e.timeSeconds<n.end;Jo(r),m&&mi.set(r,i),r.paused||r.pause()}}var l0="hf-proxy",Du="runtime_media_proxy_fallback",Iu="runtime_media_proxy_unavailable",Wn=new WeakSet,Pu=new WeakSet;function pi(e){return e.currentSrc||e.src}function Qo(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:me(e)&&!!bt(e)}function Zo(e){let t=pi(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 u0(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 c0(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 ea(e,t){return t[e]??u0(e,t)??c0(e,t)}function d0(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(l0,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var f0={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 Pt(e,t,n){if(Pu.has(e))return;Pu.add(e);let r=f0[t];ve({source:"hf-preview",type:"diagnostic",code:Iu,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Iu}: "${n}" (${t}): ${r}`)}function ta(e,t=null,n="reactive"){if(Wn.has(e))return;let r=pi(e),i;try{i=d0(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Pt(e,"invalid_source_url",r);return}Wn.add(e),Jo(e),e.src=i,e.load();let o=t?.codecName??null;ve({source:"hf-preview",type:"diagnostic",code:Du,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] ${Du}: "${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 Ou(e){if(Qo(e)||!me(e)||Wn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=Zo(e);if(n===null)return;let r=ea(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||ta(e,r,"proactive")}function Gu(e){if(Qo(e)||!me(e)||e.videoWidth!==0)return;let t=pi(e);if(Wn.has(e)){Pt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=Zo(e);if(r===null){Pt(e,"cross_origin",t);return}let i=ea(r,n);if(i&&!i.browserHostile){Pt(e,"browser_safe_codec",t);return}ta(e,i,"reactive")}function Hu(e){if(Qo(e)||!me(e))return;let t=pi(e);if(Wn.has(e)){Pt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=Zo(e);if(r===null){Pt(e,"cross_origin",t);return}let i=ea(r,n);if(i&&!i.browserHostile){Pt(e,"browser_safe_codec",t);return}ta(e,i,"tertiary")}var Te=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ye(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},m0=[0,0,0],p0=[1,1,1],hi=64;function h0(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 vt(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Te(`Invalid number "${e}"`,t);return n}function Bu(e,t,n){if(e.length!==3)throw new Te(`${t} expects three numbers`,n);return[vt(e[0],n),vt(e[1],n),vt(e[2],n)]}function Uu(e,t,n){if(!e)throw new Te(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new Te(`${t} must be an integer greater than 1`,n);return r}function g0(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new Te("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function b0(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 x0(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function Wu(e,t={}){let n=t.maxSize??hi,r=null,i=m0,o=p0,a=null,l=null,s=[],u=e.replace(/^\\uFEFF/,"").split(/\\r?\\n/);for(let m=0;m<u.length;m++){let f=m+1,h=h0(u[m]??"").trim();if(!h)continue;let b=h.split(/\\s+/),v=(b[0]??"").toUpperCase(),x=b.slice(1);if(v==="TITLE"){r=b0(h);continue}if(v==="DOMAIN_MIN"){i=Bu(x,v,f);continue}if(v==="DOMAIN_MAX"){o=Bu(x,v,f);continue}if(v==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new Te(`${v} expects two numbers`,f);let _=vt(x[0],f),T=vt(x[1],f);if(T<=_)throw new Te("LUT_3D_INPUT_RANGE max must exceed min",f);i=[_,_,_],o=[T,T,T];continue}if(v==="LUT_1D_SIZE"){a=Uu(x[0],v,f);continue}if(v==="LUT_3D_SIZE"){if(l=Uu(x[0],v,f),l>n)throw new Te(`LUT_3D_SIZE ${l} exceeds max ${n}`,f);continue}if(!x0(v)){if(v.startsWith("LUT_"))throw new Te(`Unsupported cube keyword ${v}`,f);continue}if(!l)throw a?new Te("1D cube LUTs are not supported yet",f):new Te("LUT data appears before LUT_3D_SIZE",f);if(b.length!==3)throw new Te("LUT data rows must contain three numbers",f);s.push(vt(b[0],f),vt(b[1],f),vt(b[2],f))}if(a&&l)throw new Te("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Te("1D cube LUTs are not supported yet"):new Te("Missing LUT_3D_SIZE");g0(i,o);let d=l*l*l;if(s.length!==d*3)throw new Te(`Expected ${d} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function y0(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Vn(e){return Math.round(y0(e)*255)}function na(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]=Vn(e.data[s]??0),i[u+1]=Vn(e.data[s+1]??0),i[u+2]=Vn(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var Vu="rec709";var he={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 zu=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],qu=["shadows","midtones","highlights"],$u=["master","red","green","blue"],ju=["hueVsHue","hueVsSaturation","hueVsLuma"];var Ku=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],Yu=["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 BA=he.unit,UA=he.signedUnit,WA=he.effects;var Ze=1024,zn=16;function Xu(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 ke(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function v0(e){let t=[],n=[],r=ke(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=ke(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=Xu(ke(t,0),ke(t,1),i,ke(n,1)),o[o.length-1]=Xu(ke(t,t.length-1),ke(t,t.length-2),ke(n,n.length-1),ke(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=ke(n,a-1),s=ke(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=ke(t,a-1),d=ke(t,a),m=2*d+u,f=d+2*u;o[a]=(m+f)/(m/l+f/s)}return o}function Ju(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 S0(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 A0(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 Qu(e,t,n,r,i){S0(e,r,i);let o=v0(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>ke(e,l+1)[0];)l+=1;let d=ke(e,l),m=ke(e,l+1),f=A0(u,d,m,ke(o,l),ke(o,l+1));a[s]=Math.min(i,Math.max(r,f))}return a}function tn(e,t=Ze){if(Ju(e,t),e.length>zn)throw new RangeError(`A color curve supports at most ${zn} 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 Qu(e,t,n=>n/(t-1),0,1)}function ia(e,t,n,r=Ze){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>zn)throw new RangeError(`A hue curve supports at most ${zn} 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 Ju(l,r),Qu(l,r,s=>s/r*360,t,n)}var qn="data-color-grading",$n="data-hf-color-grading-source-hidden",xi="data-hf-authored-opacity",rc="__hf_color_grading_",w0=Vu,sa={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},la={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},ua={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 yi=zu,ic=qu,oc=$u,ac=ju,da=Ku,fa=Yu,Zu={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},ec={vignette:.18};function Me(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...sa,...n},details:{...la,...r},effects:{...ua,...i}}}var ma=[Me("neutral","Neutral"),Me("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Me("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Me("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Me("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Me("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Me("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Me("vintage-wash","Vintage Wash",Zu,ec),Me("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Me("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Me("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Me("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Me("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Me("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),Me("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}),Me("home-movie-8mm","8mm Home Movie",Zu,{...ec,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Me("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Me("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],_0=new Map(ma.map(e=>[e.id,e])),C0=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,R0={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}},nn={hue:0,amount:0,level:0},tc={amount:he.unit,level:he.signedUnit},St=[[0,0],[1,1]],rn=[],T0={hueVsHue:he.secondaryHueShift,hueVsSaturation:he.signedUnit,hueVsLuma:he.signedUnit},oa={center:0,range:180,softness:0},aa={min:0,max:1,softness:.05},k0={vignette:he.unit,vignetteMidpoint:he.unit,vignetteRoundness:he.signedUnit,vignetteFeather:he.unit,grain:he.unit,grainSize:he.unit,grainRoughness:he.unit},ca=he.unit,M0=he.effects,sc=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var F0=ma.filter(e=>sc.some(t=>e.effects[t]>1e-4)),XA=ma.filter(e=>!F0.includes(e)),JA={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}},lc=[{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 N0=/^#[0-9a-f]{6}$/i;function L0(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&N0.test(t))?null:e.map(t=>t.toLowerCase())}function De(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bi(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function uc(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Ie(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?bi(n,t.min,t.max):0}function pa(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function D0(e){let t=De(e)?e:{};return ic.reduce((n,r)=>{let i=De(t[r])?t[r]:{};return n[r]={hue:pa(i.hue,nn.hue),amount:Ie(i.amount??nn.amount,tc.amount),level:Ie(i.level??nn.level,tc.level)},n},{shadows:{...nn},midtones:{...nn},highlights:{...nn}})}function I0(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)?[bi(t,0,1),bi(n,0,1)]:null}function cc(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function P0(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function O0(e){if(!Array.isArray(e)||e.length<2)return St;let t=[];for(let n of e){let r=I0(n);if(!r)return St;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),cc(t)||(P0(t),t.length>16)?St:t}function G0(e){let t=De(e)?e:{};return oc.reduce((n,r)=>(n[r]=O0(t[r]),n),{master:St,red:St,green:St,blue:St})}function H0(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)?[pa(n),bi(r,t.min,t.max)]:null}function B0(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return rn;let n=[];for(let r of e){let i=H0(r,t);if(!i)return rn;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),cc(n)?rn:n}function U0(e){let t=De(e)?e:{};return ac.reduce((n,r)=>(n[r]=B0(t[r],T0[r]),n),{hueVsHue:rn,hueVsSaturation:rn,hueVsLuma:rn})}function nc(e){let t=De(e)?e:{},n=Ie(t.min??aa.min,ca),r=Ie(t.max??aa.max,ca);return{min:Math.min(n,r),max:Math.max(n,r),softness:Ie(t.softness??aa.softness,he.secondarySoftRangeSoftness)}}function W0(e){let t=De(e)?e:{},n=Ie(t.range??oa.range,he.secondaryHueRange);return{center:pa(t.center,oa.center),range:n,softness:Ie(t.softness??oa.softness,{min:he.secondaryHueSoftness.min,max:he.secondaryHueCombinedMax-n})}}function V0(e){return{hueShift:Ie(e.hueShift??0,he.secondaryHueShift),saturation:Ie(e.saturation??0,he.signedUnit),luma:Ie(e.luma??0,he.signedUnit),temperature:Ie(e.temperature??0,he.signedUnit),tint:Ie(e.tint??0,he.signedUnit)}}function z0(e){return!De(e)||!De(e.key)||!De(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:W0(e.key.hue),saturation:nc(e.key.saturation),luma:nc(e.key.luma)},correction:V0(e.correction)}}function q0(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=z0(n);r&&t.push(r)}return t}function $0(e){if(e==null)return null;let t=String(e).trim();return t||null}function j0(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!De(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:uc(e.intensity,1)}}function K0(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return De(n)?n:null}catch{return null}return{preset:t}}return De(e)?e:null}function Y0(e,t){let n=e.trim().match(C0);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function gi(e,t){if(typeof e=="string"){let r=Y0(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return gi(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>gi(r,t));if(!De(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=gi(i,t);return n}function X0(e){return e?_0.get(e)??null:null}function vi(e){let t=K0(e);if(!t||t.enabled===!1)return null;let n=$0(t.preset),r=X0(n),i=r?.adjust??sa,o=r?.details??la,a=r?.effects??ua,l=De(t.adjust)?t.adjust:{},s=De(t.details)?t.details:{},u=De(t.effects)?t.effects:{},d=yi.reduce((h,b)=>(h[b]=Ie(l[b]??i[b],R0[b]),h),{...sa}),m=da.reduce((h,b)=>(h[b]=Ie(s[b]??o[b],k0[b]),h),{...la}),f=fa.reduce((h,b)=>(h[b]=Ie(u[b]??a[b],M0[b]??ca),h),{...ua});return{enabled:!0,preset:n,intensity:uc(t.intensity,r?.intensity??1),adjust:d,wheels:D0(t.wheels),curves:G0(t.curves),hueCurves:U0(t.hueCurves),secondaries:q0(t.secondaries),details:m,effects:f,palette:L0(t.palette),lut:j0(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():w0}}function dc(e,t){return vi(gi(e,t))}function J0(e){return ic.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function ha(e){return oc.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function ga(e){return ac.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function ba(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function fc(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||sc.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:yi.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?J0(e.wheels):!1)||(e.curves?ha(e.curves):!1)||(e.hueCurves?ga(e.hueCurves):!1)||(e.secondaries?ba(e.secondaries):!1):!1}var Q0=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Z0=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function mc(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(w){L("runtime.picker.site1",w)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let w=S;for(;w&&w!==document.body&&w!==document.documentElement;){let R=A.getComputedStyle(w);if(R.display==="none"||R.visibility==="hidden"||R.pointerEvents==="none")return!0;let I=Number.parseFloat(R.opacity);if(Number.isFinite(I)&&I<=.01&&!w.hasAttribute($n))return!0;w=w.parentElement}return!1}function d(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(Q0)||u(S))}function m(S){return!!S?.closest(Z0)}function f(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let w=S.getAttribute("data-composition-id");if(w)return`[data-composition-id="${CSS.escape(w)}"]`;let R=S.getAttribute("data-composition-src");if(R)return`[data-composition-src="${CSS.escape(R)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let H=S.tagName.toLowerCase(),j=S.parentElement;if(!j)return H;let X=j.querySelectorAll(`:scope > ${H}`);if(X.length===1)return H;for(let k=0;k<X.length;k+=1)if(X[k]===S)return`${H}:nth-of-type(${k+1})`;return H}function h(S){let A=S.tagName.toLowerCase(),w=(S.textContent??"").trim().replace(/\\s+/g," "),R=(I,H)=>I.length>H?`${I.slice(0,H-1)}\\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?w.length>0?R(w,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,w){let R=typeof w=="number"&&w>0?w:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let X=document.elementFromPoint(S,A);I=X?[X]:[]}if(m(I[0]??null))return[];let H={},j=[];for(let[X,k]of I.entries()){if(!d(k))continue;let U=`${k.tagName}::${k.id||""}::${X}`;if(!H[U]&&(H[U]=!0,j.push(k),j.length>=R))break}return j}function v(S){let A=S.getBoundingClientRect(),w={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(w[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:f(S),label:h(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:w}}function x(S,A,w){return b(S,A,w).map(v)}function _(S){if(!t)return;let w=b(S.clientX,S.clientY,1)[0]??(Ne(S.target)?S.target:null);if(!d(w)||n===w)return;n&&n.classList.remove("__hf-pick-highlight"),n=w,w.classList.add("__hf-pick-highlight");let R=v(w);l(R),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:R})}function T(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function C(S){S.key==="Escape"&&(D(),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",T,!0),document.addEventListener("keydown",C,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function D(){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",T,!0),document.removeEventListener("keydown",C,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function M(){window.__HF_PICKER_API={enable:F,disable:D,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,w)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,w):[],pickAtPoint:(S,A,w)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let R=x(S,A,8);if(!R.length)return null;let I=Math.max(0,Math.min(R.length-1,Number(w??0))),H=R[I]??null;return H?(s(H),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:H}),D(),H):null},pickManyAtPoint:(S,A,w)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let R=x(S,A,8);if(!R.length)return[];let I=[],H=Array.isArray(w)?w:[0];for(let j of H){let X=Math.max(0,Math.min(R.length-1,Math.floor(Number(j)))),k=R[X];if(!k)continue;I.some(te=>te.selector===k.selector&&te.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),D(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:F,disablePickMode:D,installPickerApi:M}}var eg=["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 on(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 xa(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0,i=r*n,o=Math.round(i);return Math.abs(i-o)<=.001?o/n:r}function pc(e,t,n=eg){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function jn(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function $e(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Kn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function hc(e,t,n,r){let i=on(t,n),o=r?.suppressEvents===!0;return $e(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function tg(e,t,n,r,i){let o=[];Kn(e,t,a=>{$e(a,"play"),o.push(a)});try{return hc(t,n,r,i)}finally{for(let a of o)try{$e(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function ng(e,t){Kn(e,t,n=>{$e(n,"play")})}function gc(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?.()??jn(n,"duration",0))||0);r>0&&Math.max(0,jn(n,"time",0))>=r&&($e(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()),$e(n,"play"),Kn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),$e(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;$e(n,"pause"),Kn(e.getTimelineRegistry?.(),n,i=>{$e(i,"pause")});let r=Math.max(0,jn(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=tg(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),$e(i,"play"),Kn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),$e(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?(ng(e.getTimelineRegistry?.(),i),hc(i,n,o,r)):on(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:()=>jn(e.getTimeline(),"time",0),getDuration:()=>jn(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function bc(){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 rg=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function ya(e){return e.id||e.getAttribute("data-hf-id")||null}function ig(e){return Ce(e)}function og(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 ag(e){return!ge(e)||!Number.isFinite(e.duration)?null:xt(e,e.duration)}function sg(e,t,n,r){let i=ig(e.getAttribute("data-duration"));return i!=null&&i>0?i:og(e,t)??ag(e)??Math.max(0,n-r)}function lg(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 xc(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||rg.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(sg(l,n,r,s)<=0)continue;let u={id:ya(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return lg(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}var va="css:root",yc=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],ug=new Set([...yc,"contain","isolation","mask-border","mix-blend-mode","opacity"]),cg=new Set(["absolute","relative"]),dg=new Set(["flex","inline-flex","grid","inline-grid"]),fg=new Set(["layout","paint","strict","content"]),mg=new Set(["size","inline-size"]);function pg(e){return e.position==="fixed"||e.position==="sticky"}function hg(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(cg.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&dg.has(n)}function gg(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:yc.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function bg(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>fg.has(n))?!0:mg.has(e.getPropertyValue("container-type"))}function xg(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>ug.has(t))}function yg(e,t){return pg(t)||hg(e,t)||gg(t)||bg(t)?!0:xg(t)}function vg(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 Si(e){let t=e.ownerDocument.defaultView;if(!t)return va;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(yg(n,t.getComputedStyle(n)))return vg(n)}catch{return va}n=n.parentElement}return va}function Sa(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function Ot(e){return Ce(e)}function Aa(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=Jt({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(Ot).some(o=>o!=null&&o<=0)?0:null)}function vc(e){return Jt({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function Ea(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 wa(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function _a(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 Xn(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 Sc(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Xn(t);let n=e.getAttribute("data-composition-src");if(n)return Xn(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Xn(r.getAttribute("src")):null}function Ag(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 Eg(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 wg(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Yn(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function _g(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 Yn(i);let o=e.id;if(o)return Yn(o);let a=Ag(e);if(a)return Yn(a);let l=Eg(Sc(e));if(l)return Yn(l);let s=wg(e);return s||`${Yn(t)} ${n+1}`}function Ac(e){let n=window.__timelines??{},r=st({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=q=>{if(!q)return null;let O=n[q]??null;if(!O||typeof O.duration!="function")return null;try{let V=Number(O.duration());return Number.isFinite(V)&&V>0?V:null}catch{return null}},o=()=>{let q=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(q.length===0)return null;let O=0;for(let V of q){let Z=r.resolveMediaStartForElement(V);if(!Number.isFinite(Z))continue;let pe=ri(V);pe==null||pe<=0||(O=Math.max(O,Math.max(0,Z)+pe))}return O>0?O:null},a=(q,O)=>{let V=[],Z=null,pe=null,re=null,z=q.parentElement;for(;z;){let J=z.getAttribute("data-composition-id");J&&(V.push(J),!re&&z!==O&&(re=J),Z==null&&(Z=r.resolveStartForElement(z,0)),pe==null&&(pe=Ot(z.getAttribute("data-duration"))??i(J)??null)),z=z.parentElement}return{parentCompositionId:re,compositionAncestors:V.reverse(),inheritedStart:Z,inheritedDuration:pe}},l=document.querySelector("[data-composition-id]"),s=Array.from(document.querySelectorAll("[data-composition-id]")),u=l?.getAttribute("data-composition-id")??null,d=l?r.resolveStartForElement(l,0):0,m=o(),f=m!=null?Math.max(0,m-Math.max(0,d)):null,h=i(u),b=Aa(l??document.body),v=wa(...s.filter(q=>q!==l).map(q=>{let O=r.resolveStartForElement(q,0),V=r.resolveDurationForElement(q)??i(q.getAttribute("data-composition-id"))??null;return!Number.isFinite(O)||V==null||V<=0?null:Math.max(0,O)+V})),x=v!=null?Math.max(0,v-Math.max(0,d)):null,_=typeof h=="number"&&Number.isFinite(h)&&h>0?h:null,T=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,C=typeof f=="number"&&Number.isFinite(f)&&f>0?f:null,F=typeof x=="number"&&Number.isFinite(x)&&x>0?x:null,D=wa(C,F),M=_!=null&&D!=null&&_>D+1,A=T??(M?D:wa(_,C,F))??null,R=(A!=null?d+A:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),I=(q,O)=>!Number.isFinite(O)||O<=0?0:R==null||!Number.isFinite(R)?O:!Number.isFinite(q)||q>=R?0:Math.max(0,Math.min(O,R-q)),H=[],j=[],X=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),k=0;for(let[q,O]of X.entries()){if(O===l||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(O.tagName))continue;let V=a(O,l),Z=O.tagName.toLowerCase(),pe=Z==="video"||Z==="audio"?r.resolveMediaStartForElement(O):r.resolveStartForElement(O,V.inheritedStart??0),re=O.getAttribute("data-composition-id"),z=Aa(O);if(z==null&&re&&re!==u&&(z=i(re)),z==null&&ge(O)&&Number.isFinite(O.duration)&&(z=xt(O,O.duration)),z==null){let ce=V.inheritedDuration;if(ce!=null&&ce>0){let it=(V.inheritedStart??0)+ce;z=Math.max(0,it-pe)}}if(z==null||z<=0||(z=I(pe,z),z<=0))continue;let J=pe+z;k=Math.max(k,J);let Ae=re&&re!==u?"composition":Z==="video"?"video":Z==="audio"?"audio":Z==="img"?"image":"element";H.push({id:ya(O)??re??null,label:_g(O,Ae,H.length),start:pe,duration:z,track:_a(O,q),zIndex:Ea(O),stackingContextId:Si(O),kind:Ae,tagName:Z,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:V.compositionAncestors,parentCompositionId:V.parentCompositionId,nodePath:null,compositionSrc:Xn(O.getAttribute("data-composition-src")),playbackStart:Qe(O),playbackRate:Le(O),assetUrl:Sc(O),timelineRole:O.getAttribute("data-timeline-role"),timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:Ot(O.getAttribute("data-timeline-priority"))})}let U=new Set(H.map(q=>q.id)),te=l?.getAttribute("data-composition-id")??null,B=te?n[te]??null:null;if(B&&l){let q=B;if(typeof q.getChildren=="function")try{let O=q.getChildren(!0,!0,!1)??[],V=new Map;for(let re of l.children){let z=re;if(!z.id)continue;let J=z.tagName.toLowerCase();J==="script"||J==="style"||J==="link"||V.set(z,{id:z.id,start:1/0,end:-1/0})}let Z=re=>{let z=re;for(;z;){if(V.has(z))return z;if(z===l)return null;z=z.parentElement}return null};for(let re of O){if(typeof re.targets!="function"||typeof re.startTime!="function"||typeof re.duration!="function")continue;let z=re.startTime(),J=re.parent;for(;J&&J!==B&&typeof J.startTime=="function";)z+=J.startTime(),J=J.parent;let Ae=z+re.duration();if(!(!Number.isFinite(z)||!Number.isFinite(Ae)))for(let ce of re.targets()){if(!Ne(ce))continue;let Sn=Z(ce);if(!Sn)continue;let it=V.get(Sn);it&&(it.start=Math.min(it.start,z),it.end=Math.max(it.end,Ae))}}let pe=H.length>0?Math.max(...H.map(re=>re.track))+1:0;for(let[re,z]of V){if(z.start===1/0||z.end===-1/0)continue;let J=re;if(U.has(J.id))continue;let Ae=Math.max(0,z.end-z.start);if(Ae<=0)continue;let ce=I(z.start,Ae);ce<=0||(k=Math.max(k,z.start+ce),H.push({id:J.id,label:J.getAttribute("data-timeline-label")??J.getAttribute("data-label")??J.getAttribute("aria-label")??J.id,start:z.start,duration:ce,track:_a(J,pe),zIndex:Ea(J),stackingContextId:Si(J),kind:"element",tagName:J.tagName.toLowerCase(),compositionId:J.getAttribute("data-composition-id"),compositionAncestors:te?[te]:[],parentCompositionId:te,nodePath:null,compositionSrc:null,playbackStart:Qe(J),playbackRate:Le(J),assetUrl:null,timelineRole:J.getAttribute("data-timeline-role"),timelineLabel:J.getAttribute("data-timeline-label"),timelineGroup:J.getAttribute("data-timeline-group"),timelinePriority:Ot(J.getAttribute("data-timeline-priority"))}),U.add(J.id))}}catch(O){L("runtime.timeline.site1",O)}}if(l&&A!=null&&A>0){let q=H.length>0?Math.max(...H.map(O=>O.track))+1:0;for(let O of l.children){let V=O;if(!V.id||U.has(V.id))continue;let Z=V.getAttribute("data-timeline-role");if(Z!=="overlay"&&Z!=="persistent-overlay")continue;let pe=V.tagName.toLowerCase();if(pe==="script"||pe==="style"||pe==="link"||pe==="meta"||window.getComputedStyle(V).display==="none")continue;let z=I(0,A);z<=0||(k=Math.max(k,z),H.push({id:V.id,label:V.getAttribute("data-timeline-label")??V.getAttribute("data-label")??V.getAttribute("aria-label")??V.id,start:0,duration:z,track:_a(V,q),zIndex:Ea(V),stackingContextId:Si(V),kind:"element",tagName:pe,compositionId:V.getAttribute("data-composition-id"),compositionAncestors:te?[te]:[],parentCompositionId:te,nodePath:null,compositionSrc:null,playbackStart:Qe(V),playbackRate:Le(V),assetUrl:null,timelineRole:Z,timelineLabel:V.getAttribute("data-timeline-label"),timelineGroup:V.getAttribute("data-timeline-group"),timelinePriority:Ot(V.getAttribute("data-timeline-priority"))}),U.add(V.id))}}for(let q of s){if(q===l)continue;let O=q.getAttribute("data-composition-id");if(!O||!Sa(O))continue;let V=r.resolveStartForElement(q,0),Z=Aa(q);if((Z==null||Z<=0)&&vc(q)!=null){let J=vc(q);Z=Math.max(0,J-V)}let pe=i(O),re=Z&&Z>0?Z:pe;if(re==null||re<=0)continue;let z=I(V,re);z<=0||j.push({id:O,label:q.getAttribute("data-label")??O,start:V,duration:z,thumbnailUrl:Xn(q.getAttribute("data-thumbnail-url")),avatarName:null})}let G=Math.max(1,k||1,A??0),W=M&&T==null,Q=W?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(G*Math.max(1,e.canonicalFps)));return{...Yr(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:W?Number.POSITIVE_INFINITY:G,durationInFrames:Q,clips:H,scenes:j,compositionWidth:Ot(l?.getAttribute("data-width"))??1920,compositionHeight:Ot(l?.getAttribute("data-height"))??1080}}var Ca="data-composition-id",Cg="data-composition-src",Rg=`[${Ca}]`,DE=`[${Cg}]`,Ec="style",wc="script",Tg=\'link[rel="stylesheet"], link[rel="preconnect"]\';function an(e){return e?Array.from(e):[]}function _c(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=an(t.querySelectorAll(Rg)),l=o?a.find(d=>d.getAttribute(Ca)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(Ca)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...an(u?.querySelectorAll(Ec)),...an(t.querySelectorAll(Ec))],scriptSources:[...an(u?.querySelectorAll(wc)),...an(t.querySelectorAll(wc))],linkSources:an(n?.querySelectorAll(Tg)),variableDefaultCarriers:[r,l].filter(d=>d!=null)}}var be=uh(Xd(),1),Jd=be.default,Ew=be.default.stringify,ww=be.default.fromJSON,_w=be.default.plugin,Cw=be.default.parse,Rw=be.default.list,Tw=be.default.document,kw=be.default.comment,Mw=be.default.atRule,Fw=be.default.rule,Nw=be.default.decl,Lw=be.default.root,Dw=be.default.CssSyntaxError,Iw=be.default.Declaration,Pw=be.default.Container,Ow=be.default.Processor,Gw=be.default.Document,Hw=be.default.Comment,Bw=be.default.Warning,Uw=be.default.AtRule,Ww=be.default.Result,Vw=be.default.Input,zw=be.default.Rule,qw=be.default.Root,$w=be.default.Node;var Qa="data-hf-authored-id",Qd="data-hf-inner-root";function Za(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function es(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function Xb(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function ef(e){let t=e.trim();return t?Array.from(new Set([t,Xb(t)])).filter(Boolean):[]}function Jb(e){return!!e&&/[\\w-]/.test(e)}function Qb(e,t,n){let r=ef(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 d=r.find(m=>e.startsWith(m,l+1));if(d){let m=e[l+1+d.length];if(!Jb(m)){i+=n,l+=d.length;continue}}}i+=s}return i}function Zb(e,t){let n=t?.trim();return n?Qb(e,n,`[${Qa}="${es(n)}"]`):e}function Zd(e){return`${e}:not(:has([${Qd}])), ${e} > [${Qd}]`}function ex(e,t,n,r,i,o){let a=Zb(e,r),l=tx(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?Zd(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*[\\\\^\\\\*\\\\$]?=\\\\s*(["\'])${Za(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?Zd(t):l.replace(u,t);let d=l.match(/^\\s*/)?.[0]??"",m=l.match(/\\s*$/)?.[0]??"";if(i){let f=r?`[${Qa}="${es(r)}"]`:null;if(f&&s.startsWith(f)){let h=s.slice(f.length);return`${d}${t}${f}${h}${m}`}}return`${d}${t} ${s}${m}`}function tx(e,t,n){let r=Za(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 nx=new Set(["keyframes","-webkit-keyframes","font-face"]);function rx(e){return e?.type==="atrule"}function ix(e){let t=e.parent;for(;t;){if(rx(t)&&nx.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function ox(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function tf(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${es(o)}"]`,l;try{l=Jd.parse(e)}catch{return""}return l.walkRules(s=>{ix(s)||ox(s)||(s.selectors=s.selectors.map(u=>ex(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function dt(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}function nf(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=dt(t),l=dt(i),s=dt(n),u=Za(t),d=dt(o?.trim()||null),m=dt(r??null),f=dt(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${u}"|\'${u}\')\\s*\\]`),h=dt(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`),b=dt(ef(o?.trim()||""));return`(function(){\n var __hfCompId = ${a};\n var __hfTimelineCompId = ${l};\n var __hfErrorLabel = ${s};\n var __hfAuthoredRootId = ${d};\n var __hfAuthoredRootAttr = ${dt(Qa)};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = ${m} || (__hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "");\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${f};\n var __hfTimingSelectorPattern = ${h};\n var __hfAuthoredRootIdForms = ${b};\n var __hfAuthoredRootSelector = __hfAuthoredRootId\n ? "[" + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(__hfAuthoredRootId) + \'"]\'\n : "";\n var __hfIsSelectorNameChar = function(char) {\n return !!char && /[\\\\w-]/.test(char);\n };\n var __hfReplaceAuthoredRootIdSelectors = function(selector) {\n if (!__hfAuthoredRootSelector || !__hfAuthoredRootIdForms.length || typeof selector !== "string") {\n return selector;\n }\n var result = "";\n var bracketDepth = 0;\n var quote = null;\n for (var index = 0; index < selector.length; index += 1) {\n var char = selector[index];\n var previousChar = index > 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target !== "string") return target;\n return __hfQueryAll(target);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = !__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})();`}var ax=["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 rf(e){let t=e.getAttribute("id")?.trim();for(let n of ax)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var sx=8e3,lx=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,ux=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,cx=["src","href"];function dx(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function sf(e,t){if(!t)return e;let n=e.trim();if(dx(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function lf(e,t){return!t||!e?e:e.replace(ux,(n,r,i)=>{let o=sf(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function fx(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of cx){let i=n.getAttribute(r);if(i==null)continue;let o=sf(i,t);o!==i&&n.setAttribute(r,o)}}function mx(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=lf(r,t);i!==r&&n.setAttribute("style",i)}}function px(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=lf(r,t);i!==r&&(n.textContent=i)}}function uf(e,t){if(t){fx(e,t),mx(e,t),px(e,t);for(let n of Array.from(e.querySelectorAll("template")))uf(n.content,t)}}function hx(e,t){return`${e}__hf${t}`}var gx=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"),sx)});function ts(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function of(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function bx(e){let t=document.importNode(e,!0);rf(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 xx(e,t){let n=e.trim();if(!n)return e;try{return lx.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 af(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 Oi(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 yx(e){let t=new Map;for(let n of e){let r=Oi(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function cf(e){let t=Oi(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function vx(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function Sx(e){return e.hasAttribute("data-composition-src")?!0:cf(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:vx(e):!1}function rs(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:cf(t))}function df(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(rs().map(n=>Oi(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function ff(e,t=yx(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=Oi(i),l=Sx(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let d=s?(n.get(o)||0)+1:0;s&&n.set(o,d),u=s?hx(o,d):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 ns(e){let t=_c({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=Se(t.innerRoot)?t.innerRoot:null,r=n??e.sourceNode,i=t.authoredCompositionId,o=t.scriptCompositionId,a=e.runtimeCompositionId||null,l=t.authoredRootId,s=a?`[data-composition-id="${CSS.escape(a)}"]`:void 0;for(let f of t.linkSources){let h=(f.getAttribute("href")||"").trim();if(!h)continue;let b=e.compositionUrl?new URL(h,e.compositionUrl).href:h;if(e.compositionUrl&&af(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let v=f.cloneNode(!0);zl(v)&&(v.href=b,document.head.appendChild(v),e.injectedLinks.push(v))}(f=>{for(let h of f){let b=h.cloneNode(!0);Vl(b)&&(i&&(b.textContent=tf(b.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(b),e.injectedStyles.push(b))}})(t.styleSources);let d=f=>{let h=f.getAttribute("type")?.trim()??"",b=f.getAttribute("src")?.trim()??"";if(b){let x=xx(b,e.compositionUrl);return e.compositionUrl&&af(x,e.compositionUrl)?null:{kind:"external",src:x,type:h}}let v=f.textContent?.trim()??"";return v?{kind:"inline",content:v,type:h,scopeCompositionId:o}:null},m=t.scriptSources.map(d).filter(f=>f!==null);if(n){let f=n.getAttribute("data-width"),h=n.getAttribute("data-height"),b=e.parseDimensionPx(f),v=e.parseDimensionPx(h);f&&e.host.setAttribute("data-width",f),h&&e.host.setAttribute("data-height",h),b&&Se(e.host)&&(e.host.style.width=b),v&&Se(e.host)&&(e.host.style.height=v),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=bx(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),of(x),e.host.appendChild(x)}else if(e.hasTemplate){let f=document.importNode(r,!0);of(f),e.host.appendChild(f)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&Ax(e,r,a);for(let f of m){let h=document.createElement("script");if(f.type&&(h.type=f.type),h.async=!1,f.kind==="external"?h.src=f.src:f.type.toLowerCase()==="module"?h.textContent=f.content:f.scopeCompositionId?h.textContent=nf(f.content,f.scopeCompositionId,"[HyperFrames] composition script error:",s,a||f.scopeCompositionId,l):h.textContent=`(function(){${f.content}})();`,document.body.appendChild(h),e.injectedScripts.push(h),f.kind==="external"){let b=await gx(h);b.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:f.src,loadStatus:b.status,elapsedMs:b.elapsedMs}})}}}async function mf(e){let t=rs();if(df(),t.length===0)return;let n=ff(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`);ts(i),await ns({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 pf(e){let t=rs();if(df(),t.length===0)return;let n=ff(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}ts(i);try{let d=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(d){await ns({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:d.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");uf(b,u);let v=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=v?v.content:b.body;await ns({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!v,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:kn(b.documentElement),variableDeclarer:b.documentElement,onDiagnostic:e.onDiagnostic})}catch(d){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:d instanceof Error?d.message:"unknown_error"}}),ts(i)}}))}function Ax(e,t,n){let i={...e.declaredVariableDefaults??(Ne(t)?kn(t):{}),...Ul(e.host)};Fo(e.variableDeclarer??(Ne(t)?t:null),i,n),Hl(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,No(e.host,{...Gl(e.host,i,window),...Jr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function Ex(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wx(e){if(!Array.isArray(e))throw new Error("expected a JSON array");if(!e.every(Ex))throw new Error("every array entry must be an object");return e}function is(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function _x(e){return Se(e)?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function Cx(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!Se(r))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function Rx(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 os(){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===null)return;let n=wx(t);if(n.length===0)return;let r=Cx();for(let i of n){let o=null;if(i.wordId&&(o=_x(document.getElementById(i.wordId))),!o&&i.wordIndex!==void 0&&(o=r[i.wordIndex]??null),!o)continue;let a={},l={};if(i.x!==void 0&&(a.x=i.x),i.y!==void 0&&(a.y=i.y),i.scale!==void 0&&(a.scale=i.scale),i.rotation!==void 0&&(a.rotation=i.rotation),i.opacity!==void 0&&(l.opacity=i.opacity),i.fontSize!==void 0&&(l.fontSize=`${i.fontSize}px`),i.fontWeight!==void 0&&(l.fontWeight=i.fontWeight),i.fontFamily!==void 0&&(l.fontFamily=i.fontFamily),i.activeColor||i.dimColor){let u=e.getTweensOf(o).filter(f=>f.vars.color!==void 0).sort((f,h)=>f.startTime()-h.startTime()),d=u.find(f=>is(f)==="dim")??u.find(f=>is(f)===void 0),m=d?String(d.vars.color):"";for(let f of u)(is(f)??(String(f.vars.color)===m?"dim":"active"))==="dim"?i.dimColor&&(f.vars.color=i.dimColor):i.activeColor&&(f.vars.color=i.activeColor);i.dimColor&&e.set(o,{color:i.dimColor})}if(Object.keys(l).length>0&&e.set(o,l),Object.keys(a).length>0){let s=Rx(o);e.set(s,a)}}}).catch(t=>{let n=t instanceof Error?t.message:String(t);console.error(`[HyperFrames] Invalid caption-overrides.json: ${n}`)})}var ss="data-hf-edit-base-x",ls="data-hf-edit-base-y",fn="data-hf-edit-original-translate",Gi=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},Tx=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},hf=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,as=(e,t)=>hf.test(e)&&hf.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,kx=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=Tx(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${as(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${as(r,t)} ${as(i,n)}${a}`},Mx=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},Fx=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""}},us=new WeakMap;function Nx(e,t){let n=us.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Be("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=Gi(e.getAttribute("data-x"))-Gi(e.getAttribute(ss)),i=Gi(e.getAttribute("data-y"))-Gi(e.getAttribute(ls));e.hasAttribute(fn)||e.setAttribute(fn,Fx(e)),n===void 0&&Mx(e);let o=e.getAttribute(fn)??"",a=kx(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),us.set(e,e.style.getPropertyValue("translate"))}function Hi(e,t){let n=e.querySelectorAll(`[${fn}]:not([${ss}]):not([${ls}])`);for(let o=0;o<n.length;o++){let a=n[o];if(a===void 0||!Do(a))continue;let l=a.getAttribute(fn)??"";l===""?a.style.removeProperty("translate"):a.style.setProperty("translate",l),a.removeAttribute(fn),us.delete(a)}let r=e.querySelectorAll(`[${ss}], [${ls}]`),i=0;for(let o=0;o<r.length;o++){let a=r[o];a===void 0||!Do(a)||(Nx(a,t),i+=1)}return i}var gf="__hfPositionEditsSeekReapplyWrapped",bf=new WeakSet,xf=new WeakMap,yf=new WeakMap;function vf(e){let t=e,n=()=>{try{Hi(t.document)}catch{}},r=m=>typeof m=="function"&&(bf.has(m)||!!m[gf]),i=m=>{bf.add(m);try{Object.defineProperty(m,gf,{value:!0})}catch{}},o=m=>{if(typeof m!="function"||r(m))return m;let f=function(...h){let b=m.apply(this,h);return n(),b};return i(f),f},a=(m,f)=>{let h=xf.get(m);if(h?.has(f))return!0;let b=Object.getOwnPropertyDescriptor(m,f);if(b?.configurable===!1){let _=m[f];return typeof _=="function"&&(m[f]=o(_),n()),!1}let v=m[f],x=b?.set;return Object.defineProperty(m,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>v,set:_=>{v=o(_),x?.call(m,_)}}),v=o(v),h??(h=new Set),h.add(f),xf.set(m,h),n(),!0},l=(m,f)=>{let h=yf.get(t),b=Object.getOwnPropertyDescriptor(t,m);if(!h?.has(m)){if(b?.configurable===!1){let _=t[m];return _?a(_,f):!1}let x=t[m];Object.defineProperty(t,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>x,set:_=>{x=_,x&&a(x,f)}}),h??(h=new Set),h.add(m),yf.set(t,h)}let v=t[m];return v?a(v,f):!1},s=()=>{let m=l("__hf","seek"),f=l("__player","renderSeek");return m&&f};if(s())return;let u=120,d=t.setInterval(()=>{if(s()){t.clearInterval(d);return}u-=1,u<=0&&t.clearInterval(d)},50)}function Bi(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 Ui(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function cs(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var Sf=new Set(["img","video","audio","source"]);function Lx(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 Dx(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function Ix(e){if(Ui(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 ds(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=Bi(e);return t.set(n,i),i}function Px(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 Ox(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function Gx(e,t){let n=new Set,r=Ox(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=ds(i,t);for(let[a,l]of Object.entries(o)){let s=Ix(l);s!==null&&Se(i)&&i.style.setProperty(`--${a}`,Dx(s))}}}function fs(e){let t=new Map;Gx(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(!Sf.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(Sf).join("/")}.`);continue}let i=Lx(ds(n,t)[r]);if(i!==null){if(!cs(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=ds(n,t)[r];Ui(i)&&Px(n,String(i))}}var ft=new Map,Hx="data-hf-color-grading-canvas",Bx="__hf_color_grading_canvas__";function Nf(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{Se(r)&&(r.hasAttribute(xi)||r.setAttribute(xi,r.style.opacity))},n=r=>{if(Ne(r)){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 Ux=16,Wx=4,pn={enabled:!1,position:.5,softness:0,lineWidth:2},ms=["#000000","#ffffff"],Vx=["#1a1a1a","#f5f5dc"],vr=3,zx=vr-1,qx=5,ps=`${Ze}.0`,Af=`${Ze-1}.0`,$x=`${vr}.0`,jx=`${(zx+.5)/vr}`;function Wi(e){let t=e.getAttribute(qn);return t==null?null:dc(t,Bi(e))}var Kx=["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`),Yx=["#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) * ${Af};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Af});`,` float y = (row + 0.5) / ${$x};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${ps}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${ps}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${ps}, ${jx}));`,"}","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`),Xx=["#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`),Jx=["#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`),Qx=["#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 Ut(e){return me(e)||Oe(e)}function Ef(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function wf(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(L("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function ji(e,t=Yx){let n=wf(e,Kx,e.VERTEX_SHADER),r=wf(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(L("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function Vi(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 Zx(e,t){let n=ji(e,Xx);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 ey(e,t){let n=ji(e,Jx);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 ty(e,t){let n=ji(e,Qx);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 br(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=Vi(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 qi(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 hs(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 _f(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function ys(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=ji(t),r=Vi(t),i=Vi(t,t.NEAREST),o=Vi(t,t.NEAREST);if(!n||!r||!i||!o)return _f(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:hs(t,n,yi),detailUniforms:hs(t,n,da),effectUniforms:hs(t,n,fa),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")}}):(_f(t,n,[r,i,o]),null)}function ny(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ry(e){if(!ny(e))return{...pn};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,pn.position,0,1),softness:t(e.softness,pn.softness,0,.25),lineWidth:t(e.lineWidth,pn.lineWidth,0,12)}}function Lf(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 Ki(e){return e instanceof Error?e.message:"LUT failed to load"}function iy(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 Df(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return iy(t)}function vs(e){let t=Lf(e);if("error"in t)return{state:"error",message:t.error};let n=ft.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=>Wu(o,{maxSize:hi})),i={state:"pending",promise:r};for(;ft.size>=Ux;){let o=ft.keys().next().value;if(!o)break;ft.delete(o)}return ft.set(t.href,i),r.then(o=>{ft.get(t.href)===i&&ft.set(t.href,{state:"ready",lut:o})},o=>{ft.get(t.href)===i&&ft.set(t.href,{state:"error",message:Ki(o)})}),i}function Cf(e,t,n){if(e.lut?.src===t)return e.lut;let r=na(n),{gl:i,program:o}=e;try{return If(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=Ki(a),e.lutLoadingSrc=null,L("runtime.colorGrading.uploadLut",a),null}}async function oy(e){let t=vs(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function If(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 ay(e,t,n){let r=na(n),{gl:i,program:o}=e;return If(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function nt(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function Ss(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),nt(e.gl,t.scratch),nt(e.gl,t.blur),t.bloom&&nt(e.gl,t.bloom),e.effectTargets=null)}function As(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),nt(e.gl,t.moments),nt(e.gl,t.output),e.kuwaharaTargets=null)}function zi(e,t=!1){Ss(e),As(e),sy(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function sy(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function ly(e){let t=ys(e.canvas);return t?(zi(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function xs(e){if(!e.sourceHidden)return;e.element.removeAttribute($n);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function uy(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=Zx(t,e.program.quad),r=br(t),i=br(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&nt(t,r),i&&nt(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function cy(e,t){return t.bloom||(t.bloom=br(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Rf(e){let t=e.effectTargets;t?.bloom&&(nt(e.gl,t.bloom),t.bloom=null)}function dy(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=ey(t,e.program.quad),o=ty(t,e.program.quad),a=br(t,n.HALF_FLOAT_OES,t.NEAREST),l=br(t);return!i||!o||!a||!l?(fy(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 fy(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&nt(e,r),i&&nt(e,i)}function Pf(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return qi(e,t,o,a),qi(e,n,o,a),{width:o,height:a}}function $i(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),xr(e,t)}function my(e,t,n,r,i,o,a){let l=Pf(e,t.scratch,r,i/2,o/2),s=a/2;$i(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),$i(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function py(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)$i(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),$i(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function xr(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 hy(e,t,n,r,i,o,a,l){qi(e,t.moments,i.width,i.height),qi(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),xr(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),xr(e,u)}function gy(e,t,n,r){if(n<=0)return!1;let i=Pf(e.gl,t.scratch,t.blur,r.width,r.height);return py(e.gl,t,e.program.texture,t.blur,i,.75+Math.pow(n,1.35)*32,n>.55?3:2),!0}function by(e,t,n,r,i,o){if(n<=0)return Rf(e),null;o||Rf(e);let a=o?cy(e,t):t.blur;return a?(my(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function xy(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&&Ss(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=uy(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=gy(e,l,o,n),u=by(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function yy(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&As(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=dy(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(hy(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 Of(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=xy(e,t,n,o),l=yy(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function vy(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=Lf(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=vs(t);return i.state==="ready"?Cf(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||(Cf(e,r.href,o),We(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=Ki(o),e.lutLoadingSrc=null,We(e))})),null)}function hr(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&&Ut(n))return n;try{let r=document.querySelector(t);return r&&Ut(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Ut(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Ut(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&&Ut(r)?r:null}catch{return null}}function Gf(e){return me(e)?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:Oe(e)&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function Hf(e){return me(e)?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:Oe(e)?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function Bf(e){let t=bt(e);return t&&Hf(t)?t:null}function Tf(e){if(!me(e))return!1;let t=Bf(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function Sy(e){return Oe(e)&&e.classList.contains("__render_frame__")}function Ay(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function Uf(e){if(me(e)){let t=Bf(e);if(t)return t}return Hf(e)?e:null}function kf(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 Ey(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=kf(o,"x"),l=kf(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 Wf(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=Ey(o||"center"),d=(e-l)*u.x/e,m=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:d,offsetY:m}}function wy(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function Mf(e,t){return Math.max(0,Math.round(e>0?e:t))}function _y(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&wy(e,i);let o=window.getComputedStyle(t);pc(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=Mf(n.offsetWidth,a.width),s=Mf(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),d=Math.round(l*u),m=Math.round(s*u);return r.width!==d&&(r.width=d),r.height!==m&&(r.height=m),{width:d,height:m}}function mn(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 Wt(e,t,n,r){e.set(r,(t*Ze+n)*4)}function Ct(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function gs(e,t,n){return e.length>=3?ia(e,t,n):new Float32Array(Ze)}function Bt(e,t){return e[t]??0}function Cy(e,t,n){let r=tn(t.red),i=tn(t.green),o=tn(t.blue),a=tn(t.master),l=gs(n.hueVsHue,-180,180),s=gs(n.hueVsSaturation,-1,1),u=gs(n.hueVsLuma,-1,1);for(let d=0;d<Ze;d+=1)Wt(e,0,d,[Bt(r,d),Bt(i,d),Bt(o,d),Bt(a,d)]),Wt(e,1,d,[Ct(Bt(l,d),180),Ct(Bt(s,d),1),Ct(Bt(u,d),1),1])}function Ry(e,t,n){let r=n*qx;Wt(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),Wt(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),Wt(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),Wt(e,2,r+3,[Ct(t.correction.hueShift,180),Ct(t.correction.saturation,1),Ct(t.correction.luma,1),Ct(t.correction.temperature,1)]),Wt(e,2,r+4,[Ct(t.correction.tint,1),.5,.5,1])}function Ty(e,t,n){let r=new Float32Array(Ze*vr*4);Cy(r,e,t);let i=0;for(let o of n)o.enabled&&(Ry(r,o,i),i+=1);return r}var Ff=new WeakMap;function ky(e,t,n){let r=Ff.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return Ff.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function My(e,t,n,r){let{curves:i,hueCurves:o}=n,a=ky(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(Ty(i,o,r),Vn);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,Ze,vr,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function bs(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function Vf(e,t,n,r,i,o,a,l,s,u,d,m){e.uniform1i(t.source,0),e.uniform1i(t.blurSource,1),e.uniform1i(t.lut,2),e.uniform1i(t.kuwaharaSource,3),e.uniform1i(t.bloomSource,4),e.uniform1i(t.advanced,5),e.uniform2f(t.resolution,s.width,s.height),e.uniform2f(t.uvScale,u.scaleX,u.scaleY),e.uniform2f(t.uvOffset,u.offsetX,u.offsetY),e.uniform1f(t.blurReady,i?1:0),e.uniform1f(t.bloomReady,o?1:0),e.uniform1f(t.kuwaharaReady,a?1:0),e.uniform1f(t.lutEnabled,r?1:0),e.uniform1f(t.lutSize,r?.size??2),e.uniform2f(t.lutTextureSize,r?.textureWidth??1,r?.textureHeight??1),e.uniform3f(t.lutDomainMin,r?.domainMin[0]??0,r?.domainMin[1]??0,r?.domainMin[2]??0),e.uniform3f(t.lutDomainMax,r?.domainMax[0]??1,r?.domainMax[1]??1,r?.domainMax[2]??1),e.uniform1f(t.lutIntensity,n.lut?.intensity??0);let{curves:f,hueCurves:h,secondaries:b}=n,v=ha(f),x=ga(h),_=ba(b)?b.reduce((F,D)=>F+Number(D.enabled),0):0;(v||x||_>0)&&My(e,t,n,b),bs(e,t.shadowWheel,n.wheels.shadows),bs(e,t.midtoneWheel,n.wheels.midtones),bs(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,v?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,_);for(let[F,D]of t.adjustUniforms)e.uniform1f(D,n.adjust[F]);for(let[F,D]of t.detailUniforms)e.uniform1f(D,n.details[F]);e.uniform1f(t.grainSeed,d),e.uniform1f(t.effectTime,m);for(let[F,D]of t.effectUniforms)e.uniform1f(D,n.effects[F]);let T=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Vx:ms),C=T[T.length-1]??ms[1];e.uniform1f(t.paletteSize,T.length),mn(e,t.palette0,T[0]??ms[0]),mn(e,t.palette1,T[1]??C),mn(e,t.palette2,T[2]??C),mn(e,t.palette3,T[3]??C),mn(e,t.palette4,T[4]??C),mn(e,t.palette5,T[5]??C),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 Fy(e){if(!e.sourceHidden){let t=e.element.getAttribute(xi);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute($n,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function mt(e){let t=lc.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var zf=mt("intensity"),qf=mt("lut.intensity"),$f=mt("adjust.exposure"),jf=mt("effects.kuwahara"),Kf=[["blur",mt("effects.blur")],["bloom",mt("effects.bloom")],["kuwahara",jf],["pixelate",mt("effects.pixelate")],["ascii",mt("effects.ascii")],["dither",mt("effects.dither")]],Yf=[zf,qf,$f,...Kf.map(([,e])=>e)];function Vt(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 gr(e,t){return t!==null&&(fc(t)||Yf.some(n=>Vt(e,n)!==null))}function Ny(e,t){let n=null;for(let[r,i]of Kf){let o=Vt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function Ly(e){let{element:t,grading:n}=e,r=Vt(t,zf),i=Vt(t,qf),o=Vt(t,$f),a=Ny(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 Xf(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 Jf(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 We(e){if(e.destroyed||e.contextLost)return!1;let t=Uf(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=Gf(t);if(!n)return!1;let r=Se(t)?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=Sy(t);s&&Ay(e,t),a&&!s&&(e.sourceInlineOpacity!==null?e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority||""):e.element.style.removeProperty("opacity"));let u=window.getComputedStyle(s?t:e.element);e.sourceOpacityForCanvas=u.opacity||"1",a&&!s&&e.element.style.setProperty("opacity","0","important"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let d=_y(e,r);if(!d)return!1;let m=window.getComputedStyle(r),f=Wf(d.width,d.height,n.width,n.height,m.objectFit,m.objectPosition),{gl:h,program:b}=e;try{let v=Ly(e),x=vy(e);Xf(h,b.texture,t);let _=Vt(e.element,jf)!==null,T=Of(e,v,d,f,{preserveKuwahara:_});h.bindFramebuffer(h.FRAMEBUFFER,null),h.viewport(0,0,d.width,d.height),h.useProgram(b.program),Jf(h,b,T);let C=window.__player?.getTime?.(),F=typeof C=="number"&&Number.isFinite(C)?Math.max(0,C):me(e.element)?Math.max(0,e.element.currentTime):0,D=e.grainSeed+Math.floor(F*60);return Vf(h,b,v,x,T.blurReady,T.bloomReady,T.kuwaharaReady,e.compare,d,f,D,F),xr(h,b),Fy(e),e.hasDrawn=!0,e.drawError=null,!0}catch(v){return e.drawError=v instanceof Error?v.message:"Shader draw failed",L("runtime.colorGrading.drawEntry",v),!1}}function Dy(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 Iy(){let e=document.createElement("canvas"),t=ys(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function Py(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):me(e)?Math.max(0,e.currentTime):0}function Oy(e,t,n,r){let i=Uf(t);if(!i)return null;let o=Gf(i);if(!o)return null;let a=Dy(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=Se(i)?i:t,s=window.getComputedStyle(l),u=Wf(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return Xf(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:Py(t,r),grainSeed:Df(t)+(me(t)?Math.floor(t.currentTime*60):0)}}async function Gy(e,t,n,r,i=!1){let o=Oy(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,d=[];for(let m of n.slice(0,32)){let f=vi(m.grading);if(!f){d.push({id:m.id,dataUrl:null,error:"Invalid grading"});continue}let h=null;try{f.lut&&(e.lut?.src!==f.lut.src&&(e.lut=ay(e,f.lut.src,await oy(f.lut.src))),h=e.lut),d.push({id:m.id,dataUrl:Hy(e,f,h,a,l,s,u)})}catch(b){d.push({id:m.id,dataUrl:null,error:Ki(b)})}}return{...a,images:d}}function Hy(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,d=Of(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),Jf(s,u,d),n||(e.lut=null),Vf(s,u,t,n,d.blurReady,d.bloomReady,d.kuwaharaReady,pn,r,i,o,a),xr(s,u),l.toDataURL("image/png")}function tt(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function By(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&me(e.element)&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function yr(e){if(e.destroyed||!me(e.element)||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,We(e),!e.destroyed&&!t.paused&&!t.ended&&yr(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,We(e),!e.destroyed&&!t.paused&&!t.ended&&yr(e)})}function Uy(e){let t=()=>{We(e)};if(tt(e,e.element,"load",t),tt(e,e.element,"loadedmetadata",t),tt(e,e.element,"loadeddata",t),tt(e,e.element,"seeked",t),tt(e,e.element,"timeupdate",t),tt(e,window,"resize",t),me(e.element)&&(tt(e,e.element,"play",()=>yr(e)),tt(e,e.element,"pause",t)),tt(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",xs(e)}),tt(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!ly(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",xs(e);return}e.drawError=null,We(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(),We(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function Wy(e){if(e.destroyed)return null;e.destroyed=!0,By(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),Ss(e),As(e),xs(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 Qf(e,t){return e.removeAttribute("style"),t.id?e.id=`${rc}${t.id}`:e.removeAttribute("id"),e.className=Bx,e.setAttribute(Hx,"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 Vy(e){return Qf(document.createElement("canvas"),e)}function Zf(e){let t=new WeakMap,n=new Set,r=[],i=null,o=null,a=Promise.resolve(),l=!1,s=(S,A,w)=>{let R=t.get(S);if(R)return R.grading=A,R.source=w,We(R),me(S)&&!S.paused&&yr(R),!0;let I=r.pop();if(I)Qf(I.canvas,S);else{let j=Vy(S),X=ys(j);if(!X)return j.remove(),!1;I={canvas:j,gl:X.gl,program:X.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let H={element:S,...I,grading:A,compare:{...pn},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:w,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(S).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(S).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:Df(S),destroyed:!1};return t.set(S,H),n.add(S),Uy(H),We(H),me(S)&&!S.paused&&yr(H),!0},u=(S,A)=>{if(l)return!1;let w=hr(S);if(!w)return!1;let R=t.get(w);if(!R){let I=Wi(w);if(!gr(w,I)||!s(w,I,"attribute"))return!1;R=t.get(w)}return R?(R.compare=ry(A),We(R),!0):!1},d=S=>{let A=t.get(S);if(!A)return;let w=Wy(A);w&&(A.contextLost||r.length>=Wx?zi(w,!0):r.push(w)),t.delete(S),n.delete(S)},m=()=>{if(l)return 0;let S=new Set;document.querySelectorAll(`video[${qn}], img[${qn}]`).forEach(w=>{if(!Ut(w))return;S.add(w);let R=Wi(w);gr(w,R)&&(Ef(w)||Tf(w))?s(w,R,"attribute"):d(w)});for(let w of n){let R=t.get(w);R&&(!w.isConnected||R.source==="attribute"&&!S.has(w))&&d(w)}return n.size},f=()=>{if(l)return 0;let S=0;for(let A of n){let w=t.get(A);w&&We(w)&&(S+=1)}return S},h=async()=>{let S=new Set;for(let A of n){let w=t.get(A)?.grading.lut;if(!w?.src.trim()||(w.intensity??1)<=0)continue;let R=vs(w.src);R.state==="pending"&&S.add(R.promise)}return S.size>0&&await Promise.allSettled(S),f(),S.size},b=()=>{if(l)return 0;let S=0;for(let A of n){let w=t.get(A);!w||!Yf.some(I=>Vt(A,I)!==null)||me(A)&&!A.paused&&!A.ended||We(w)&&(S+=1)}return S},v=(S,A)=>{if(l)return!1;let w=hr(S);if(!w)return!1;let R=vi(A);return gr(w,R)?s(w,R,"live"):(d(w),!0)},x=(S,A)=>{if(!Ut(S))return!1;let w=t.get(S);if(!w){if(!A)return!1;let R=Wi(S);return gr(S,R)&&s(S,R,"attribute")}return w.sourceVisibleForCanvas=A,!A&&w.source==="attribute"&&d(S),!0},_=S=>{let A=hr(S);if(!A)return{state:"missing",message:"Media not found"};let w=t.get(A);if(w)return w.effectError?{state:"unavailable",message:w.effectError}:w.drawError?{state:"unavailable",message:w.drawError}:w.lutError?{state:"unavailable",message:`LUT error: ${w.lutError}`}:w.grading.lut&&w.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:w.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:w.lut?"Shader + LUT active":"Shader active"};let R=Wi(A);return gr(A,R)?!Ef(A)&&!Tf(A)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},T=async(S,A,w)=>{let R=async()=>{if(l||A.length===0)return null;let H=hr(S);return!H||(o??(o=Iy()),!o)?null:Gy(o,H,A,w?.maxDimension,w?.useMediaTime)},I=a.then(R,R);return a=I.then(()=>{},()=>{}),I},C=S=>{let A=hr(S);if(!me(A))return null;if(!A.paused)return()=>{};let w=A.currentTime,R=A.loop,I=A.muted;return A.loop=!0,A.muted=!0,(A.ended||Number.isFinite(A.duration)&&w>=A.duration)&&(A.currentTime=0),e?.lease(A),A.play().catch(()=>{}),()=>{e?.release(A),A.pause(),A.loop=R,A.muted=I,A.currentTime=w}},F=()=>{if(!l){l=!0,i?.disconnect(),i=null;for(let S of n)d(S);for(let S of r)zi(S,!0);r.length=0,o&&(zi(o,!0),o=null)}};document.body&&(i=new MutationObserver(()=>m()),i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[qn]}));let D={refresh:m,redraw:f,redrawAnimated:b,waitForActiveLuts:h,setGrading:v,setCompare:u,setSourceVisibility:x,getStatus:_,renderPreviews:T,startPreviewPlayback:C,destroy:F},M=window;return M.__hf=M.__hf||{},M.__hf.colorGrading=D,m(),D}var Yi=class{constructor(t){ye(this,"_baseTime",0);ye(this,"_playStartMs",null);ye(this,"_rate",1);ye(this,"_duration",1/0);ye(this,"_nowMs");ye(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 zy=100,qy=8,$y=4096,Es=e=>e;function jy(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Ky(e){let t=Math.ceil(e*zy);return Math.min($y,Math.max(qy,t))}function Yy(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??Es,u=T=>o+(T-a)/l,d=e.points[t],m=e.points[t+1],f=u(m.t);if(f<=o)return null;let h=Math.max(o,u(d.t)),b=f-h;if(b<=0)return null;if(jy(d,n,i))return{kind:"ramp",time:f,value:s(m.v)};let v=Ky(b),x=Ru(e,Math.max(d.t,a),m.t,v,n),_=new Float32Array(v);for(let T=0;T<v;T+=1)_[T]=s(x[T]??0);return{kind:"curve",time:h,duration:b,values:_}}function Xy(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=Yy(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??Es)(Bn(e,n.elapsed,t))}),i}function Jy(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 Sr(e){for(let t of e)t.param.cancelScheduledValues(0)}function hn(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function ws(e,t,n,r){if(t.points.length!==0)for(let i of e){if(Sr([i]),Cu(t)){let o=(i.map??Es)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}Jy(i.param,Xy(t,n,r,i.map))}}function em(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=Hn(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 d=zo(l.target,t);d&&(ws(u,l,d.scale,r),a.push(...u))}return a}function tm(e){return e.lanes.find(t=>t.target===Qt)??null}var Qy=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,_s=new WeakMap;function Cs(e){return nm.has(e)}var nm=new WeakSet;function Rs(e){let t=_s.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Qy)))}`;await e.audioWorklet.addModule(n),nm.add(e)})().catch(n=>{throw _s.delete(e),n}),_s.set(e,t)),t}function Zy(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,d=0;for(let f=0;f<i;f++){u+=s*(l()-u);let h=u*Math.pow(1-f/i,2.5);o[f]=h,d+=h*h}let m=Math.sqrt(d);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),Ts=e=>e/1e3;function am(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 d=u/i;a[u]=t==="sine"?Math.sin(2*Math.PI*d):4*Math.abs((d+.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 sm(e){try{e.stop()}catch{}e.disconnect()}function ks(e,t){return[{param:e},{param:t,map:n=>1-n}]}function lm(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ms(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var ev=new Set(["peaking","highpass","lowpass"]),rm=e=>Math.pow(10,e/20),tv=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=rm(ue(i.gain))};return r(t),Ms(n,r,{gain:[{param:n.gain,map:rm}]})};function Ar(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),Ms(i,o,{frequency:[{param:i.frequency}],...ev.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function nv(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 Ms(i,()=>{})}}function Er(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 rv={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))},iv=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=rv[String(a.type)]??Math.tanh,s=Math.pow(10,ue(a.threshold)/20),u=8192,d=new Float32Array(u);for(let m=0;m<u;m++){let f=m/(u-1)*2-1;d[m]=l(f/Math.max(1e-6,s))*s}n.curve=d,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()}}},ov=(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),lm(a,l,ue(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ts(u))}],feedback:[{param:o.gain}],mix:ks(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},av=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=am(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 d=m=>{o.delayTime.value=ue(m.delay)/1e3,l.gain.value=ue(m.depth)/1e3,a.playbackRate.value=ue(m.speed),lm(s,u,ue(m.mix))};return d(t),{input:r,output:i,update:d,automation:{delay:[{param:o.delayTime,map:Ts}],depth:[{param:l.gain,map:Ts}],speed:[{param:a.playbackRate}],mix:ks(s.gain,u.gain)},dispose:()=>{sm(a),[r,i,o,l,s,u].forEach(m=>m.disconnect())}}},sv=6,lv=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=am(e,String(t.type)==="1"?"sine":"triangle",ue(t.speed),n),s=e.createGain(),u=e.createGain(),d=e.createGain(),m=[];r.connect(o);let f=o;for(let b=0;b<sv;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),f.connect(v),f=v,m.push(v)}l.connect(s),f.connect(u).connect(a),o.connect(d).connect(a),a.connect(i);let h=b=>{let v=1e3/Math.max(.1,ue(b.delay));for(let x of m)x.frequency.value=v;s.gain.value=v*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,d.gain.value=1};return h(t),{input:r,output:i,update:h,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{sm(l),[r,i,o,a,s,u,d,...m].forEach(b=>b.disconnect())}}},uv=(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 d=`${ue(u.size)}:${ue(u.damping)}`;if(d!==l){let m=Zy(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=d}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())}},cv={"gain-node":tv,"biquad-peaking":Ar("peaking",!0),"biquad-lowshelf":Ar("lowshelf",!0),"biquad-highshelf":Ar("highshelf",!0),"biquad-highpass":Ar("highpass",!1),"biquad-lowpass":Ar("lowpass",!1),"worklet-compressor":Er("hf-compressor"),"worklet-limiter":Er("hf-limiter"),"worklet-gate":Er("hf-gate"),"worklet-bitcrush":Er("hf-bitcrush"),"worklet-pitchshift":Er("hf-pitchshift"),waveshaper:iv,"delay-feedback":ov,"chorus-lfo":av,"allpass-phaser":lv,convolver:uv};function um(e){return e.nodes.some(t=>In(t.type)?.web.startsWith("worklet-")??!1)}function dv(e,t,n,r=0){let i=In(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=Pn(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return nv(t)(e,o,r);let a=cv[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function im(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 om(e){return On(e).map(t=>{let n=Pn(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 cm(e,t,n=0){var m;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=im(On(t)),s=r;for(let f of l){let h=null;if(f.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=f.amount,v.gain.value=1-f.amount,s.connect(b),b.connect(v).connect(_),h={entry:b,wet:x,dry:v,join:_},s=b}for(let b of f.nodes){let v=dv(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}h&&f.preset&&(s.connect(h.wet).connect(h.join),a.push({id:f.preset,...h}),s=h.join)}s.connect(i);let u=om(t),d={};for(let f of a)(d[m=f.id]??(d[m]=[])).push(...ks(f.wet.gain,f.dry.gain));return{input:r,output:i,presets:d,nodes:o,update(f){if(om(f)!==u)return!1;On(f).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(Pn(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let h=0;for(let b of im(On(f))){if(!b.preset)continue;let v=a[h++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:f}of o)f.dispose();for(let{entry:f,wet:h,dry:b,join:v}of a)f.disconnect(),h.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var dm={version:1,nodes:[]},fm={version:1,lanes:[]};function mm(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(ut):null)??"";if(!n)return fm;try{return _u(ui(n),t)}catch{return fm}}function gn(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(It):null)??"";if(!t)return{chain:dm,raw:""};try{return{chain:Au(t),raw:t}}catch{return{chain:dm,raw:""}}}function pm(e){return mm(e,gn(e).chain)}function Xi(e,t,n,r,i){let{chain:o}=gn(t),a=null,l=[],s=!1,u=0,d=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},m=(C,F)=>{if(C.nodes.length===0){n.connect(r);return}if(um(C)&&!Cs(e)){n.connect(r);let D=++u;Rs(e).then(()=>{s||D!==u||x(gn(t).chain)}).catch(()=>{});return}try{let D=cm(e,C,F);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},f=(C,F)=>{l=F&&a?em(mm(t,C),C,a.nodes,F,a.presets):[]},h=i?{...i}:null;m(o,h?.elapsed??0),f(o,h);let b=()=>{if(!h)return null;let C=typeof e.currentTime=="number"?e.currentTime:h.scheduledAt;return{scheduledAt:C,elapsed:h.elapsed+(C-h.scheduledAt)*h.rate,rate:h.rate}},v=C=>{let F=b();F&&(hn(l,F.scheduledAt),f(C,F))},x=C=>{let F=b();hn(l,F?.scheduledAt??0),d(),m(C,F?.elapsed??0),f(C,F)},_=null,T=t;return typeof MutationObserver<"u"&&typeof T?.nodeType=="number"&&(_=new MutationObserver(()=>{let C=gn(t);l.length>0&&Sr(l),!a||!a.update(C.chain)?x(C.chain):v(C.chain)}),_.observe(T,{attributes:!0,attributeFilter:[It,ut]})),{reanchor:C=>{if(s)return;let F=b();F&&hn(l,F.scheduledAt),h={...C},f(gn(t).chain,h)},setRate:C=>{let F=b();s||!F||!Number.isFinite(C)||C<=0||C===F.rate||(h={...F,rate:C},hn(l,F.scheduledAt),f(gn(t).chain,h))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&hn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var hm="runtime_web_audio_bypass";function Fs(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function wr(e,t){return Fs(e,t)!==null}function fv(e){return wr(e,"crossorigin")?!0:e.crossOrigin!=null}function mv(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function pv(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Fs(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function hv(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,mv(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!fv(t)}function bm(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:wr(e,"src")}function bn(e){for(let t of pv(e))if(hv(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function gv(e){let t=[];wr(e,It)&&t.push("fx-chain"),wr(e,ut)&&t.push("automation"),wr(e,di)&&t.push("audio-group");let n=Number.parseFloat(Fs(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function bv(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var gm=new WeakSet;function xn(e,t){if(t.kind==="web-audio"||bv()||gm.has(e))return;let n=gv(e);gm.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};ve({source:"hf-preview",type:"diagnostic",code:hm,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \\u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${hm}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Ns(e){return!Number.isFinite(e)||e<=0?1:e}function xm(e){return Ue(e)}function xv(e,t){t||e.paused||!Kr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function yv(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 d=-n/o;return s?e.start(i+d,r,u):e.start(i+d,r),!0}function Ji(e,t,n){let r=tm(pm(e));r&&ws([{param:t.gain}],r,li.scale,n)}function _r(e){return e.sourceKind==="buffer"}var Qi=class{constructor(){ye(this,"_ctx",null);ye(this,"_bufferCache",new Map);ye(this,"_failedSrcs",new Set);ye(this,"_mediaElementSources",new WeakMap);ye(this,"_activeSources",[]);ye(this,"_masterGain",null);ye(this,"_masterVolume",1);ye(this,"_masterMuted",!1);ye(this,"_groups",new Map);ye(this,"_rateAnchorCtx",0);ye(this,"_rateAnchorComp",0);ye(this,"_rate",1);ye(this,"_paused",!0);ye(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=bn(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),xn(t,o),null}return n}if(!this._ctx)return null;let r=bn(t);if(r.kind!=="web-audio")return xn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}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.acquireMediaElementSource(t);if(!s)return null;let u=Ns(l),d=this._ctx.createGain();d.gain.value=o;let m=this._ctx.currentTime,f=i-n,h={scheduledAt:m,elapsed:f,rate:u},b=Xi(this._ctx,t,s,d,h);d.connect(this.resolveDestination(t,m,i,u)??this._masterGain),Ji(t,d,h),this._rate=u,this._rateAnchorCtx=m,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:d,compositionStart:n,mediaStart:r,scheduledAt:m,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:Le(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(f){L("webAudioTransport.groupReanchor",f)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>$o(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let d=this._ctx.createGain();d.gain.value=xm(qo(s)),d.connect(u);let m=Xi(this._ctx,s??{getAttribute:()=>null},o,d,r);return s&&Ji(s,d,r),this._groups.set(t,{input:o,fader:d,muteGain:u,fx:m,generation:this._playGeneration,reanchor:f=>{Sr([{param:d.gain}]);let h=l();d.gain.value=xm(qo(h)),u.gain.value=h?.hasAttribute("data-hidden")?0:1,m?.reanchor(f),h&&Ji(h,d,f)},dispose:()=>{try{m?.dispose(),o.disconnect(),d.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=ku(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let d=Ns(s),m=Le(t),f=d*m,h=this._ctx.createBufferSource();h.buffer=n,h.playbackRate.value=f;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:d},T=Xi(this._ctx,t,h,b,_);if(b.connect(this.resolveDestination(t,x,o,d)??this._masterGain),Ji(t,b,_),this._rate=d,this._rateAnchorCtx=x,this._rateAnchorComp=o,!yv(h,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:d,mediaRate:m,clipDuration:u}))return h.disconnect(),T?.dispose(),b.disconnect(),null;let C=t.muted;t.muted=!0,xv(t,C);let F={fx:T,el:t,sourceNode:h,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:C,priorVolume:t.volume,mediaPlaybackRate:m,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(F),this._paused=!1,h.addEventListener("ended",()=>this.handleSourceEnded(h,F,t,C)),F}catch(d){return L("webAudioTransport.schedule",d),null}}setRate(t){let n=Ns(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(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>_r(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{_r(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}_r(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=Ue(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&_r(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cr="data-hf-studio-manual-edit-gesture";var ym=`[${Cr}]`;function vm(e,t){let n=e.defaultView?.MutationObserver??globalThis.MutationObserver;if(!n||!e.documentElement)return{isActive:()=>e.querySelector(ym)!=null,observing:!1,disconnect:()=>{}};let r=new Set(e.querySelectorAll(ym)),i=l=>{for(let s of l){let u=s.target;Ne(u)&&(u.hasAttribute(Cr)?r.add(u):r.delete(u))}},o=l=>{l.length!==0&&(i(l),t())},a=new n(o);return a.observe(e.documentElement,{subtree:!0,attributes:!0,attributeFilter:[Cr]}),{observing:!0,isActive:()=>{o(a.takeRecords());for(let l of r){if(l.isConnected&&l.hasAttribute(Cr))return!0;r.delete(l)}return!1},disconnect:()=>{a.disconnect(),r.clear()}}}var Sm=333.3333333333333;function Am(e){return e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2?!1:e.compositionChanged===!0?!0:Number.isInteger(e.tick)&&e.tick>0&&e.tick%60===0}var vv=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Em(e){return Math.max(0,Math.min(1,e))}function wm(e){let t=vv.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Em(n):null}function _m(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Em(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 Sv=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,Av=Math.PI*2;function Ev(e){let t=Sv.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 wv(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(Av*t*e)}function Cm(e,t){let n=Ev(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=>wv(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var _v=24,Rm=e=>e>=1?1:0,Cv=e=>e,Zi=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,Rv=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${Zi}\\s*,\\s*${Zi}\\s+${Zi}\\s*,\\s*${Zi}\\s+1\\s*,\\s*1\\s*$`,"i");function Tm(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function Tv(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<_v;l+=1){let s=(o+a)/2;Tm(s,t,r)<e?o=s:a=s}return Tm((o+a)/2,n,i)}function kv(e){let t=Rv.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=>Tv(a,n,r,i,o)}function Mv(e,t){if(!e.startsWith("spring("))return null;let n=wm(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>_m(o,n);return t.set(n,i),i}function Fv(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=kv(n);return i&&t.set(n,i),i}function km(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"?Rm:Cm(s,i)??Mv(s,r)??Fv(s,n),a=(s,u,d=[])=>{let m=o(s);return m||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Be("custom_ease_parse_failed",{ease:s}),t.call(u,s,...d)??Cv)};e.parseEase=function(u,...d){return a(u,this,d)};let l=e.registerEase;if(typeof l=="function"){l("hold",Rm);let s=u=>{let d=m=>m;d.config=(...m)=>a(`${u}(${m.join(",")})`,e),l(u,d)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var Is=new Map,Rr=new Map,Ls=new Map,Ds=()=>{},Fm=()=>{},Mm=0;function Ps(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Nm(e){let t=(Ls.get(e)??0)+1;return Ls.set(e,t),t}function Lm(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Mm-=1,Mm)}function Os(e,t){let n=Rr.get(e);if(!n)return;let r=()=>Ls.get(e)===t.generation&&Rr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&Fm(e,t.requestId)},i=>{r()&&Ds(e,t.requestId,i)})}catch(i){r()&&Ds(e,t.requestId,i)}}function Dm(e){Ds=e}function Im(e){Fm=e}function eo(e,t,n){if(!Ps(e))return;let r={payload:t,requestId:Lm(n),generation:Nm(e)};Is.set(e,r),Os(e,r)}function to(e,t){Ps(e)&&(Is.delete(e),Os(e,{payload:void 0,requestId:Lm(t),generation:Nm(e)}))}function Pm(e,t){if(!Ps(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);Rr.set(e,t);let n=Is.get(e);return n&&Os(e,n),()=>{Rr.get(e)===t&&Rr.delete(e)}}var Gs="data-hf-authored-duration",Hs="data-hf-authored-end",Om=!1;function rt(e){if(e){if(typeof e.pause!="function"){Om||(Om=!0,Be("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function Dv(){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 Gm(){let e=bc(),t=()=>{};Ll(ve),Dm((c,p,g)=>{ve({source:"hf-preview",type:"runtime-data-error",channel:c,requestId:p,message:g instanceof Error?g.message:String(g)})}),Im((c,p)=>{try{t()}catch(g){ve({source:"hf-preview",type:"runtime-data-error",channel:c,requestId:p,message:g instanceof Error?g.message:String(g)});return}ve({source:"hf-preview",type:"runtime-data-applied",channel:c,requestId:p})}),Hi(document),fs(document),Mu(document);let n=Dv();e.canonicalFps=n.fps??e.canonicalFps,Fl(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,d=(c,p,g)=>{u.has(c)||(u.add(c),Be(p,g))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(c){L("runtime.init.site1",c)}let m=new Yi;e.transportClock=m;let f=new Qi,h=!1;f.init().then(c=>{h=c}),window.__hf=window.__hf||{};let b=c=>c.closest("[data-hidden]")!==null||fi(c.ownerDocument,c),v=()=>{let c=window.gsap,p=window;if(!(!c?.registerPlugin||p.__hfAutoNoopRegistered))try{c.registerPlugin({name:"_auto",init:()=>!1}),p.__hfAutoNoopRegistered=!0}catch(g){d("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",g)}},x=()=>{let c=window.gsap;if(!c){d("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{km(c)||d("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(p){d("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",p)}};v(),x(),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{Bl(document)}catch(c){L("runtime.init.cssVariables",c)}window.__timelines=window.__timelines||{};let _=()=>{let c=document.querySelector(\'[data-composition-id][data-root="true"]\');if(Se(c))return c;let p=Array.from(document.querySelectorAll("[data-composition-id]"));return p.find(g=>!g.parentElement?.closest("[data-composition-id]"))??p[0]??null};if(Array.isArray(window.__timelines)){let c=window.__timelines,p=_()?.getAttribute("data-composition-id")??"root",g={};if(c.length===1)g[p]=c[0];else for(let y=0;y<c.length;y++)g[`tl-${y}`]=c[y];window.__timelines=g}let T=_();T&&!T.hasAttribute("data-start")&&T.setAttribute("data-start","0");let C=c=>{a.push(c)},F=(c,p,g)=>{let y=g??`${c}:${JSON.stringify(p)}`;l.has(y)||(l.add(y),ve({source:"hf-preview",type:"diagnostic",code:c,details:p}))},D=c=>{let p={scale:1,focusX:960,focusY:540},g=[],y=[],E={time:c.getTime(),duration:c.getDuration(),isPlaying:c.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:c.play,pause:c.pause,seek:c.seek,getTime:c.getTime,getDuration:c.getDuration,isPlaying:c.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>p,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>g,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:c.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...E,time:c.getTime(),duration:c.getDuration(),isPlaying:c.isPlaying()})}},M=1/60,S=.75,A=.05,w=100,R=240,I=c=>{if(c instanceof Error)return c.message||String(c);if(typeof c=="string")return c;try{return JSON.stringify(c)}catch{return String(c??"")}},H=c=>{let p=c.toLowerCase();return p.includes("cannot read properties of null")||p.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:p.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:p.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},j=c=>{if(c==null||c.trim()==="")return null;let p=Number.parseFloat(c);return!Number.isFinite(p)||p<=0?null:`${p}px`},X=()=>_(),k=()=>{let c=X();if(!c)return;let p=j(c.getAttribute("data-width")),g=j(c.getAttribute("data-height"));p&&(c.style.width=p),g&&(c.style.height=g),p&&c.style.setProperty("--comp-width",p),g&&c.style.setProperty("--comp-height",g)},U=()=>{let c=X(),p=Array.from(document.querySelectorAll("[data-composition-id]")).filter(g=>g.hasAttribute("data-duration")||g.hasAttribute("data-end"));for(let g of p){if(c&&g===c)continue;let y=g.getAttribute("data-duration"),E=g.getAttribute("data-end");y!=null&&!g.hasAttribute(Gs)&&g.setAttribute(Gs,y),E!=null&&!g.hasAttribute(Hs)&&g.setAttribute(Hs,E),g.removeAttribute("data-duration"),g.removeAttribute("data-end")}},te=()=>{let c=X();if(!c)return;c.style.position||(c.style.position="relative"),c.style.overflow="hidden";let p=j(c.getAttribute("data-width")),g=j(c.getAttribute("data-height"));p&&(c.style.width=p),g&&(c.style.height=g);let y=Array.from(c.children);for(let E of y){let N=E.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!E.hasAttribute("data-start")||E.hasAttribute("data-hf-autostamped"))continue;let P=(E.style.top==="0px"||E.style.top==="0")&&(E.style.left==="0px"||E.style.left==="0")&&E.style.width==="100%"&&E.style.height==="100%",K=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(E.style.transform);if(P&&K&&!E.hasAttribute("data-width")&&!E.hasAttribute("data-height")){let Y=E.style.top,Re=E.style.left,Dt=E.style.width,Fe=E.style.height;E.style.top="",E.style.left="",E.style.width="",E.style.height="";let Xe=window.getComputedStyle(E);Xe.top!=="auto"||Xe.bottom!=="auto"||Xe.left!=="auto"||Xe.right!=="auto"||Xe.width!=="0px"||Xe.height!=="0px"||(E.style.top=Y,E.style.left=Re,E.style.width=Dt,E.style.height=Fe)}let $=window.getComputedStyle(E),ne=$.position;if(ne!=="absolute"&&ne!=="fixed"&&(E.style.position="absolute"),!!E.style.top||!!E.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(E.style.top="0"),!!E.style.left||!!E.style.right||$.left!=="auto"||$.right!=="auto"||(E.style.left="0"),N!=="audio"){let Y=j(E.getAttribute("data-width")),Re=j(E.getAttribute("data-height")),Dt=$.width!=="0px"&&$.width!=="auto",Fe=$.height!=="0px"&&$.height!=="auto";Y?!E.style.width&&!Dt&&(E.style.width=Y):!E.style.width&&$.width==="0px"&&(E.style.width="100%"),Re?!E.style.height&&!Fe&&(E.style.height=Re):!E.style.height&&$.height==="0px"&&(E.style.height="100%")}}},B=c=>st({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:c}),G=null,W=c=>{let p=G;G=B(!0);try{return c()}finally{G=p}},Q=c=>c&&G?G:B(c),q=(c,p=0,g)=>Q(g?.includeAuthoredTimingAttrs??!0).resolveStartForElement(c,p),O=(c,p)=>Q(p?.includeAuthoredTimingAttrs??!0).resolveDurationForElement(c),V=c=>{let p=c.closest("[data-composition-id]"),g=p?q(p,0):null,y=p?O(p,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:p,inheritedStart:g,inheritedDuration:y}},Z=c=>Q(!0).resolveMediaStartForElement(c);window.__hfResolveMediaStartSeconds=Z,a.push(()=>{window.__hfResolveMediaStartSeconds===Z&&delete window.__hfResolveMediaStartSeconds});let pe=(c,p)=>{let g=c.tagName.toLowerCase();if(g==="script"||g==="style"||g==="link"||g==="meta")return!1;let E=g==="video"||g==="audio"?Z(c):q(c,0),N=O(c),P=c.getAttribute("data-composition-id");if(P){let Ee=(window.__timelines??{})[P],He=null;if(Ee&&typeof Ee.duration=="function"){let Y=Number(Ee.duration());Number.isFinite(Y)&&Y>0&&(He=Y)}!(c.hasAttribute("data-duration")||c.hasAttribute("data-end")||c.hasAttribute(Gs)||c.hasAttribute(Hs))&&(N==null||N<=0)&&He!=null&&(N=He)}let K=N!=null&&N>0?E+N:Number.POSITIVE_INFINITY,$=window.__HF_EXPORT_RENDER_SEEK_CONFIG?xa(E,e.canonicalFps):E,ne=window.__HF_EXPORT_RENDER_SEEK_CONFIG&&Number.isFinite(K)?xa(K,e.canonicalFps):K;return p>=$&&(Number.isFinite(ne)?p<ne:!0)},re=!!document.querySelector("[data-composition-src]"),z=!1;{let c=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let p of c){let g=p.getAttribute("data-composition-id");if(g&&p.children.length===0&&document.querySelector(`template#${CSS.escape(g)}-template`)){z=!0;break}}}let J=!re&&!z,Ae=c=>{if(!c||typeof c.duration!="function")return null;try{let p=Number(c.duration());return Number.isFinite(p)?Math.max(0,p):null}catch{return null}},ce=c=>typeof c=="number"&&Number.isFinite(c)&&c>M,Sn=()=>{let c=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));return c.length===0?null:W(()=>{let p=0;for(let g of c){let y=Z(g);if(!Number.isFinite(y))continue;let E=ri(g);E==null||E<=M||(p=Math.max(p,Math.max(0,y)+E))}return p>M?p:null})},it=()=>{let c=X();if(!c)return null;let p=window.__timelines??{},g=st({timelineRegistry:p,includeAuthoredTimingAttrs:!0}),y=0,E=Ce(c.getAttribute("data-duration"));E!=null&&E>0&&(y=E);let N=Array.from(c.querySelectorAll("[data-composition-id][data-start]"));for(let P of N){if(!Ne(P)||P.parentElement?.closest("[data-composition-id]")!==c)continue;let $=g.resolveStartForElement(P,0),ne=g.resolveDurationForElement(P);!Number.isFinite($)||ne==null||ne<=0||(y=Math.max(y,Math.max(0,$)+ne))}return y>M?y:null},yp=()=>{let c=Sn();return typeof c!="number"||!Number.isFinite(c)||c<=M?null:c},vp=c=>ce(c)?Math.max(M,c*S):M,Ys=()=>{let c=0;for(let p of e.deterministicAdapters){let g=p.getInferredDurationSeconds;if(typeof g!="function")continue;let y=null;try{y=g()}catch(E){L("runtime.init.adapterDuration",E)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(c=Math.max(c,y))}return c>M?c:null},Mr=!1,Xs=()=>Mr&&window.__HF_EXPORT_RENDER_SEEK_CONFIG!=null,Sp=["data-start","data-duration","data-end","data-composition-id","data-composition-src","data-composition-file","data-root","data-hf-authored-duration","data-hf-authored-end","data-hf-auto-start",ii,"data-playback-rate","data-playback-start","data-media-start","id","src"],Js=["loadedmetadata","durationchange","emptied"],Fr=null,Qs=-1,Zs=null,Mt=null,el=0,zt=()=>{},qt=()=>{el+=1,zt()},tl=()=>({media:yp(),authoredComposition:it()}),Ap=()=>{let c=window.__timelines??{},p="";for(let g of Object.keys(c)){let y=c[g];y&&(p+=`${g}=${Ae(y)??"?"};`)}return p},Ep=()=>{if(!(Mt||typeof MutationObserver>"u")){Mt=new MutationObserver(qt),Mt.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:Sp});for(let c of Js)document.addEventListener(c,qt,!0);a.push(()=>{Mt?.disconnect(),Mt=null,qt();for(let c of Js)document.removeEventListener(c,qt,!0)})}},Nr=()=>{Ep(),Mt&&Mt.takeRecords().length>0&&qt();let c=Ap();return c!==Zs&&(Zs=c,qt()),el},nl=c=>Mr?tl():(c??(c=Nr()),Fr&&Qs===c||(Qs=c,Fr=tl()),Fr),ot=(c,p=0,g)=>{let y=Ae(c),{media:E,authoredComposition:N}=nl(g),P=Ys(),K=Math.max(E??0,N??0,P??0),$=Number.isFinite(p)&&p>M?p:0,ne=0;return ce(y)?ne=Math.max(y,K,$):ce(K)?ne=Math.max(K,$):ne=$,ne>0?Math.max(0,ne):0},uo=()=>{let c=window.__timelines??{},p=de=>{let se=Object.entries(c).filter(fe=>!!fe[1]&&typeof fe[1].play=="function"&&typeof fe[1].pause=="function");if(se.length!==1)return{timeline:null};let ie=se[0];if(!ie)return{timeline:null};let[xe,we]=ie;return{timeline:we,selectedTimelineIds:[xe],selectedDurationSeconds:Ae(we),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:de,soleTimelineId:xe}}}},g=st({timelineRegistry:c,includeAuthoredTimingAttrs:!0}),{media:y,authoredComposition:E}=nl(),N=Math.max(y??0,E??0)||null,P=vp(N),K=de=>{let se=document.querySelector(`[data-composition-id="${CSS.escape(de)}"]`);return se?g.resolveStartForElement(se,0):0},$=de=>{let se=window.gsap;if(!se||typeof se.timeline!="function")return null;let ie=se.timeline({paused:!0});for(let xe of de)ie.add(xe.timeline,K(xe.compositionId));return ie},ne=(de,se)=>{if(!ce(de))return null;let ie=window.gsap;if(!ie||typeof ie.timeline!="function")return null;let xe=ie.timeline({paused:!0});if(se)try{xe.add(se,0)}catch(fe){L("runtime.init.site2",fe)}let we=xe;if(typeof we.to=="function")try{we.to({},{duration:de})}catch(fe){L("runtime.init.site3",fe)}return xe},Ee=(de,se)=>{if(!de||typeof de.getChildren!="function")return[];try{let ie=de.getChildren(!0,!0,!0);return Array.isArray(ie)?se.filter(xe=>ie.includes(xe.timeline)):[]}catch{return[]}},He=(de,se)=>{let ie=de,xe={addedIds:[],nested:[]};if(typeof ie.getChildren!="function")return xe;try{let we=ie.getChildren(!0,!0,!0)??[];if(!Array.isArray(we))return xe;let fe=[];for(let _e of se)if(!we.some(at=>at===_e.timeline))try{let at=K(_e.compositionId);de.add(_e.timeline,at),fe.push(_e.compositionId)}catch(at){L("runtime.init.site4",at)}return{addedIds:fe,nested:Ee(de,se)}}catch{return xe}},ae=X(),Y=ae?.getAttribute("data-composition-id")??null;if(!Y)return p("root_missing_composition_id");let Re=c[Y]??null,Fe=(()=>{if(!ae)return[];let de=new Set,se=Array.from(ae.querySelectorAll("[data-composition-id]")),ie=[];for(let xe of se){let we=xe.getAttribute("data-composition-id");if(!we||we===Y||de.has(we))continue;de.add(we);let fe=c[we]??null;if(!fe||typeof fe.play!="function"||typeof fe.pause!="function")continue;let _e=Ae(fe);ie.push({compositionId:we,timeline:fe,durationSeconds:_e??0})}return ie})(),Xe=de=>{for(let se of de){let ie=se.timeline;if(typeof ie.paused=="function")try{ie.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(Re){let de=Fe.length>0?He(Re,Fe):{addedIds:[],nested:[]},se=de.addedIds;if(Xe(de.nested),(Fe.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+Y+"\'])"))&&(Lr=!0),se.length>0)try{let fe=Re.time();Re.seek(fe,!1)}catch{}let ie=Ae(Re);if(!ce(ie)&&Fe.length>0){let fe=Fe.map(th=>th.compositionId),_e=$(Fe),jt=Ae(_e);if(_e&&ce(jt))return Xe(Ee(_e,Fe)),{timeline:_e,selectedTimelineIds:fe,selectedDurationSeconds:jt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Y,rootDurationSeconds:ie,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:P,selectedDurationSeconds:jt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:E,selectedTimelineIds:fe,autoNestedChildren:se}}};let at=ne(N??0,Re),Co=Ae(at);if(at&&ce(Co))return{timeline:at,selectedTimelineIds:[Y],selectedDurationSeconds:Co,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Y,rootDurationSeconds:ie,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:E,selectedDurationSeconds:Co,selectedTimelineIds:[Y],autoNestedChildren:se}}}}if(!ce(ie)&&Fe.length===0){let fe=ne(N??0,Re),_e=Ae(fe);if(fe&&ce(_e))return{timeline:fe,selectedTimelineIds:[Y],selectedDurationSeconds:_e,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Y,rootDurationSeconds:ie,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:E,selectedDurationSeconds:_e,selectedTimelineIds:[Y]}}}}let xe=Ce(ae?.getAttribute("data-duration")),we=Math.max(ce(xe)?xe:0,E??0);if(we>0&&ce(we)&&ce(ie)&&we>=ie+.5){let fe=Re;if(typeof fe.to=="function")try{fe.to({},{duration:0},we)}catch(jt){L("runtime.init.site6",jt)}let _e=Ae(Re);if(ce(_e))return{timeline:Re,selectedTimelineIds:[Y],selectedDurationSeconds:_e,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Y,rootDurationSeconds:ie,rootDeclaredDur:xe,authoredCompositionDurationFloorSeconds:E,newDur:_e}}}}return{timeline:Re,selectedTimelineIds:[Y],selectedDurationSeconds:ie,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Y,selectedDurationSeconds:ie,autoNestedChildren:se}}:void 0}}if(Fe.length>0){let de=Fe.map(xe=>xe.compositionId),se=$(Fe),ie=Ae(se);if(se)return Xe(Ee(se,Fe)),{timeline:se,selectedTimelineIds:de,selectedDurationSeconds:ie,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Y,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:P,selectedDurationSeconds:ie,mediaDurationFloorSeconds:y,selectedTimelineIds:de}}}}return p("root_composition_id_unmatched_in_registry")},Lr=!1,wp=c=>{let p=window.gsap,g=c;if(!(!g||typeof g.getChildren!="function"||!p||typeof p.parseEase!="function"))for(let y of g.getChildren(!0,!0,!0)){let E=y,N=E.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let P=E.vars?.keyframes,$=(P&&!Array.isArray(P)?P.ease:void 0)??E.vars?.ease??"none";try{let ne=p.parseEase($);typeof ne=="function"&&(N._ease=ne)}catch(ne){Be("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",ne)}}},An=()=>{if(x(),!J)return!1;let c=e.capturedTimeline,p=Ae(c),g=ce(p);if(c&&g&&Lr)return!1;let y=uo();if(!y.timeline)return!1;if(c&&c===y.timeline)return typeof c.timeScale=="function"&&c.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),wp(e.capturedTimeline);let E=ot(e.capturedTimeline,0);if(E<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),rt(e.capturedTimeline)),E>0){try{m.setDuration(E)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let P=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(P,!1),rt(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),Hi(document)}if(y.diagnostics&&ve({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),ve({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=X(),P=E>0?E:0,K=String(P>0?P:1),$=new Set,ne=ae=>ae.tagName.toLowerCase()===Zt,Ee=new Set(document.querySelectorAll("[data-start]")),He=ae=>{let Y=ae.parentElement;for(;Y&&Y!==N;){if(Ee.has(Y))return!0;Y=Y.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let ae of e.capturedTimeline.getChildren(!0))if(typeof ae.targets=="function")for(let Y of ae.targets())Se(Y)&&Y!==N&&(ne(Y)||Y.hasAttribute("data-start")||He(Y)||$.has(Y)||($.add(Y),Y.setAttribute("data-start","0"),Y.setAttribute("data-duration",K),Y.setAttribute("data-hf-autostamped","1")))}catch{}if(Se(N))for(let ae of N.querySelectorAll("[id]"))Se(ae)&&ae!==N&&(ae.hasAttribute("data-start")||He(ae)||$.has(ae)||ae.tagName==="SCRIPT"||ae.tagName==="STYLE"||ae.tagName==="LINK"||ne(ae)||($.add(ae),ae.setAttribute("data-start","0"),ae.setAttribute("data-duration",K),ae.setAttribute("data-hf-autostamped","1")))}for(let N of En)Dr.delete(N),ul(N);return!0},rl=()=>{if(e.tornDown)return;let c=uo();if(!c.timeline){e.capturedTimeline=null,Lr=!1,m.setDuration(0),Hr(e.currentTime);return}e.capturedTimeline!==c.timeline&&(Lr=!1,An()),Hr(e.currentTime)};t=()=>{rl(),ht()},window.__hfForceTimelineRebind=rl;let _p=()=>{let c=X();if(!Se(c))return;let p=c.getBoundingClientRect(),g=Number(c.getAttribute("data-width")),y=Number(c.getAttribute("data-height")),E=window.getComputedStyle(c),N=Number.isFinite(g)&&g>0&&Number.isFinite(y)&&y>0,P=p.width<=0||p.height<=0||c.clientWidth<=0||c.clientHeight<=0;!N||!P||F("root_stage_layout_zero",{compositionId:c.getAttribute("data-composition-id")??null,declaredWidth:g,declaredHeight:y,rectWidth:Math.round(p.width),rectHeight:Math.round(p.height),clientWidth:c.clientWidth,clientHeight:c.clientHeight,display:E.display,visibility:E.visibility,overflow:E.overflow},`root-stage-layout-zero:${c.getAttribute("data-composition-id")??"unknown"}`)},Cp=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,_p()}))},Rp=()=>{i=c=>{let p=I(c.error??c.message).slice(0,R);if(!p)return;let g=H(p);ve({source:"hf-preview",type:"diagnostic",code:g.code,details:{category:g.category,message:p,filename:c.filename||null,line:Number.isFinite(c.lineno)?c.lineno:null,column:Number.isFinite(c.colno)?c.colno:null}})},o=c=>{let p=I(c.reason).slice(0,R);if(!p)return;let g=H(p);ve({source:"hf-preview",type:"diagnostic",code:`${g.code}_unhandled_rejection`,details:{category:`${g.category}-unhandled-rejection`,message:p}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tp=()=>{let c=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let g of c){let y=()=>{if(!Ne(g))return;let E=g.tagName.toLowerCase(),N=g.getAttribute("src")??g.getAttribute("href")??g.getAttribute("poster")??null,P=E==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";F(P,{tagName:E,assetUrl:N,currentSrc:(Oe(g)||ge(g))&&g.currentSrc||null,readyState:ge(g)?g.readyState:null,networkState:ge(g)?g.networkState:null},`${P}:${E}:${N??"unknown"}`)};g.addEventListener("error",y),C(()=>{g.removeEventListener("error",y)})}let p=document.fonts;p&&p.ready.then(()=>{if(e.tornDown)return;let g=Array.from(p).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);g.length!==0&&F("runtime_font_load_issue",{failedFamilies:g,totalFaces:Array.from(p).length},`runtime-font-load-issue:${g.join("|")}`)}).catch(()=>{})},kp=(c,p)=>{if(!c.timeline)return!1;let g=e.capturedTimeline;if(g&&g===c.timeline)return!1;let y=Math.max(0,e.currentTime||0),E=e.isPlaying;e.capturedTimeline=c.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{rt(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),E&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return ve({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:p,previousTime:y,selectedTimelineIds:c.selectedTimelineIds??[],selectedDurationSeconds:c.selectedDurationSeconds??null,mediaDurationFloorSeconds:c.mediaDurationFloorSeconds??null}}),!0},Ft=null,il=!1,En=new Set,Dr=new WeakMap,Ir=()=>{e.tornDown||(Ft!=null&&window.clearTimeout(Ft),Ft=window.setTimeout(()=>{if(e.tornDown||(Ft=null,Xs()))return;let c=uo();if(!c.timeline||!ce(c.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){An()&&(ht(),Pe(!0));return}if(il)return;let g=Ae(e.capturedTimeline),y=c.selectedDurationSeconds??Ae(c.timeline);ce(y)&&(!ce(g)||y>=g+A)&&kp(c,"manual")&&(il=!0,ve({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:g??null,selectedDurationSeconds:y??null,selectedTimelineIds:c.selectedTimelineIds??[],mediaDurationFloorSeconds:c.mediaDurationFloorSeconds??null}}),ht(),Pe(!0))},w))},ol=c=>{ge(c.currentTarget)&&Gu(c.currentTarget)},al=c=>{ge(c.currentTarget)&&Hu(c.currentTarget)},sl=c=>{Lo(c)&&bm(c)&&xn(c,bn(c))},ll=c=>{let p=c.currentTarget;ge(p)&&sl(p)},Mp=()=>{for(let c of En)c.removeEventListener("loadedmetadata",Ir),c.removeEventListener("durationchange",Ir),c.removeEventListener("loadedmetadata",ol),c.removeEventListener("loadedmetadata",ll),c.removeEventListener("error",al);En.clear()},co=()=>{if(e.tornDown)return;let c=Array.from(document.querySelectorAll("video, audio"));for(let p of c){if(En.has(p))continue;En.add(p);let g=Number.parseFloat(p.dataset.volume??"");Number.isFinite(g)&&(p.volume=Math.max(0,Math.min(1,g))),p.addEventListener("loadedmetadata",Ir),p.addEventListener("durationchange",Ir),p.addEventListener("loadedmetadata",ll),sl(p),p.addEventListener("loadedmetadata",ol),p.addEventListener("error",al),Ou(p),p.preload!=="auto"&&(p.preload="auto"),p.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&p.load(),ul(p)}},ul=c=>{Dr.has(c)||bu(c,e.capturedTimeline,ot(e.capturedTimeline,0),Dr,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},fo=new WeakMap,Fp=c=>{let p=fo.get(c);if(p!==void 0)return p;let g=window.getComputedStyle(c).position,y=g==="static"||g==="relative"||g==="sticky";return fo.set(c,y),y},mo=new WeakMap,Np=c=>{let p=mo.get(c);if(p!==void 0)return p;let g=c.querySelector("[data-start]")===null;return mo.set(c,g),g},Lp=()=>{fo=new WeakMap,mo=new WeakMap},po=new WeakSet,ho=new WeakMap,Pr=new WeakSet,Or=!1,cl=c=>c.matches("audio[data-start]")||c.querySelector("audio[data-start]")!==null,dl=new WeakMap,Gr=!0,Dp=()=>{if(Gr){Gr=!1;for(let c of document.querySelectorAll(Zt)){let p=c.hasAttribute("data-hidden");dl.get(c)!==p&&(dl.set(c,p),c.id&&f.setGroupMuted(c.id,p))}}},Ip=(c,p)=>{let g=X();for(let y of p){if(!Se(y))continue;if(y.hasAttribute("data-hidden")){Pr.has(y)||(ho.set(y,y.style.getPropertyValue("display")),Pr.add(y),cl(y)&&(Or=!0),Gr=!0),y.style.display="none",(me(y)||Oe(y))&&r?.setSourceVisibility(y,!1);continue}if(Pr.has(y)){let N=ho.get(y);N?y.style.display=N:y.style.removeProperty("display"),ho.delete(y),Pr.delete(y),cl(y)&&(Or=!0),Gr=!0}let E=pe(y,c);if(E){let N=y.parentElement;for(;N&&N!==g;){if(Se(N)&&N.hasAttribute("data-start")&&!pe(N,c)){E=!1;break}N=N.parentElement}}y.style.visibility=E?"visible":"hidden",(me(y)||Oe(y))&&r?.setSourceVisibility(y,E),E?po.has(y)&&(y.style.removeProperty("display"),po.delete(y)):Fp(y)&&Np(y)&&(y.style.display="none",po.add(y))}Or&&m.isPlaying()&&(f.stopAll(),wo()),Or=!1,Dp()},Hr=(c,p=Array.from(document.querySelectorAll("[data-start]")))=>W(()=>Ip(c,p)),wn=null,_n=null,Br=[],fl=c=>c.hasAttribute("data-start")||!!V(c).compositionRoot,go=c=>Nu({elements:c,shouldIncludeElement:fl,resolveStartSeconds:p=>Z(p),resolveDurationSeconds:p=>{let g=V(p),y=Z(p),E=g.inheritedStart!=null&&g.inheritedDuration!=null&&g.inheritedDuration>0?Math.max(0,g.inheritedStart+g.inheritedDuration-y):null,N=Number.isFinite(p.duration)?xt(p,p.duration):null,P=Ce(p.dataset.duration),K=P!=null&&P>0?P:null;return Fu({isVideo:p.tagName==="VIDEO",sourceDuration:N,hostRemaining:E,explicitDuration:K})}}),Pp=()=>{let c=Nr();if(wn&&wn.revision===c)return wn;let p=go().mediaClips;return wn={revision:c,clips:p,byStart:[...p].sort((g,y)=>g.start-y.start),byEnd:[...p].sort((g,y)=>g.end-y.end)},_n=null,Br=[],wn},ml=(c,p,g,y)=>{let E=0,N=c.length;for(;E<N;){let K=E+N>>1;p(c[K])<g?E=K+1:N=K}let P=[];for(let K=E;K<c.length&&p(c[K])<=y;K+=1)P.push(c[K]);return P},Op=(c,p)=>{let g=_n;if(g===null)return c.clips.map(P=>P.el);let y=Math.min(g,p),E=Math.max(g,p),N=new Set;for(let P of Br)N.add(P.el);for(let P of ml(c.byStart,K=>K.start,y,E))N.add(P.el);for(let P of ml(c.byEnd,K=>K.end,y,E))N.add(P.el);return[...N]},Ur=new WeakSet,pl=c=>{Ur.add(c)},hl=c=>{Ur.delete(c)};window.__hf.leasePausedMedia=pl,window.__hf.releasePausedMedia=hl;let Gp=()=>{for(let c of document.querySelectorAll("video, audio"))if(ge(c)&&!c.paused&&fl(c)&&!Ur.has(c))return!0;return!1},gl=()=>zt();document.addEventListener("play",gl,!0),a.push(()=>{document.removeEventListener("play",gl,!0)});let Ge=()=>{let c=!Mr,p=W(()=>{if(!c)return go().mediaClips;let E=Pp();return go(Op(E,e.currentTime)).mediaClips});for(let E of p){let N=Dr.get(E.el);N&&(E.volumeKeyframes=N)}let g=e.isPlaying?p:p.filter(E=>!Ur.has(E.el)),y=e.mediaForceSyncNextTick;y&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||(Lu({clips:g,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:y,onElementVolume:(E,N,P)=>f.setElementVolume(E,P),isWebAudioOwned:E=>f.ownsElement(E),isWebAudioRouted:E=>f.routesElement(E),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,ve({source:"hf-preview",type:"media-autoplay-blocked"}))}}),c?(_n=e.currentTime,Br=p.filter(E=>e.currentTime>=E.start&&e.currentTime<E.end)):(_n=null,Br=[])),Hr(e.currentTime)},Pe=c=>{c&&zt();let p=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),g=Date.now();(c||p!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||g-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=p,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=g,ve({source:"hf-preview",type:"state",frame:p,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},bo="",bl=0,Hp=()=>{let c="";for(let p of document.querySelectorAll("[data-start]"))c+=`${p.id}:${p.tagName}|`;return c},ht=()=>{U(),k(),te();let c=X();if(c){let y=j(c.getAttribute("data-width")),E=j(c.getAttribute("data-height")),N=y?parseInt(y,10):0,P=E?parseInt(E,10):0;N>0&&P>0&&ve({source:"hf-preview",type:"stage-size",width:N,height:P})}An();let p=Ac({canonicalFps:e.canonicalFps});window.__clipManifest=p;let g=Hp();if(bo!==g&&Lp(),!window.__clipTree||bo!==g){let y=window;window.__clipTree=xc({startResolver:st({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:p.durationInFrames/e.canonicalFps}),bo=g}ve(p),Cp()},xo=c=>typeof c=="number"&&Number.isFinite(c)&&c>0?c:0,Bp=c=>{let p=xo(Number(c));if(p<=0)return;let g=X(),y=xo(Ce(g?.getAttribute("data-duration"))),E=Math.max(bl,xo(m.getDuration()),y);p<=E||(bl=p,g?.setAttribute("data-duration",String(p)),m.setDuration(p),ht(),Pe(!0))},ze=(c,p=0)=>{for(let g of e.deterministicAdapters){try{c==="discover"&&g.discover(),c==="pause"&&g.pause(),c==="play"&&g.play&&g.play()}catch(y){L("runtime.init.site8",y)}if(c==="discover")try{g.seek({time:p,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},Nt=()=>{window.__renderReady=!1},Cn=null,Rn=!0,Up=()=>{let c=[];for(let p of e.deterministicAdapters){let g=p.getReadyPromise;if(typeof g=="function")try{let y=g();y&&c.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return c},Wp=()=>{let c=Up();if(c.length===0)return Cn=null,Rn=!0,!0;let p=c[0];if(!p)return!0;let g=c.length===1?p:Promise.all(c);return g!==Cn&&(Cn=g,Rn=!1,Promise.resolve(g).then(()=>{Cn===g&&(Rn=!0,Nt())},y=>{Cn===g&&(Rn=!0,L("runtime.init.adapterReady",y),Nt())})),Rn};if(J)os();else{let c={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:j,onDiagnostic:({code:p,details:g})=>{ve({source:"hf-preview",type:"diagnostic",code:p,details:g})}};pf(c).then(()=>mf(c)).finally(()=>{J=!0,co(),Tp(),os(),fs(document),Nt()})}let Wr=mc({postMessage:c=>ve(c)});Wr.installPickerApi(),Hr(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let Ye=Zf({lease:pl,release:hl});r=Ye,C(()=>{Ye.destroy(),r=null});let yo=c=>{let p=Number(c);!Number.isFinite(p)||p<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,p)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let g=document.querySelectorAll("video, audio");for(let y of g)if(ge(y))try{y.playbackRate=e.playbackRate}catch(E){L("runtime.init.site10",E)}},xl={play:()=>{let c=e.capturedTimeline;if(m.isPlaying())return;let p=ot(c,0);if(p>0)m.setDuration(p),m.reachedEnd()&&(m.seek(0),e.currentTime=0,Lt(0));else{let g=X(),y=Number(g?.getAttribute("data-duration")??0);y>0&&m.setDuration(y)}rt(c),m.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Rl(m.now()),h&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&wo(),ze("play"),Ge(),Ye.redraw(),Pe(!0))},pause:()=>{if(!m.isPlaying())return;f.stopAll(),m.detachAudioSource(),m.pause(),e.isPlaying=!1,e.currentTime=m.now(),e.mediaForceSyncNextTick=!0,Rl(e.currentTime);let c=e.capturedTimeline;rt(c),ze("pause"),Ge(),Ye.redraw(),Pe(!0)},seek:(c,p)=>{let g=on(Math.max(0,Number(c)||0),e.canonicalFps);f.stopAll(),m.detachAudioSource();let y=m.isPlaying();y&&m.pause(),m.seek(g),e.currentTime=m.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let E=e.capturedTimeline;if(rt(E),Lt(e.currentTime),ze("pause"),p?.keepPlaying&&y){xl.play();return}Ge(),Ye.redraw(),Pe(!0)},renderSeek:(c,p)=>{Mr=!0;let g=on(Math.max(0,Number(c)||0),e.canonicalFps);f.stopAll(),m.detachAudioSource(),m.isPlaying()&&m.pause(),m.seek(g),e.currentTime=m.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Lt(e.currentTime,{activateChildren:!0,suppressEvents:p?.suppressEvents}),ze("pause"),Ge(),Ye.redraw(),Pe(!0)},getTime:()=>m.now(),getDuration:()=>{let c=m.getDuration();return Number.isFinite(c)?c:0},isPlaying:()=>m.isPlaying(),setPlaybackRate:c=>{yo(c),m.setRate(e.playbackRate),Tl()},getPlaybackRate:()=>e.playbackRate},yl=ot(e.capturedTimeline,0);yl>0&&m.setDuration(yl);let qe=gc({getTimeline:()=>e.capturedTimeline,setTimeline:c=>{e.capturedTimeline=c},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:c=>{e.isPlaying!==c&&(e.mediaForceSyncNextTick=!0),e.isPlaying=c},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:yo,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(c,p)=>{e.currentTime=Math.max(0,Number(c)||0),e.isPlaying!==p&&(e.mediaForceSyncNextTick=!0),e.isPlaying=p,Ge()},onStatePost:Pe,onDeterministicSeek:(c,p)=>{for(let g of e.deterministicAdapters)if(!(g.name==="gsap"&&e.capturedTimeline))try{g.seek({time:Number(c)||0,suppressEvents:p?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>ze("pause"),onDeterministicPlay:()=>ze("play"),onRenderFrameSeek:()=>{Ye.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>ot(e.capturedTimeline,0),transport:xl});window.__player=D(qe),window.__playerReady=!0,Be("composition_loaded",{duration:qe.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[uu(),ql({resolveStartSeconds:c=>q(c,0)}),jl(),Yl(),Ql(),Zl(),eu(),tu(),nu(),ru(),iu(),$l({getTimeline:()=>e.capturedTimeline})],su(),lu(),window.__hfReseekGpu=c=>{let p=Math.max(0,Number(c)||0);window.__hfThreeTime=p,window.__hfTypegpuTime=p,ei(p)},window.__hfWaitForSeekCompletion=Ho,a.push(()=>{window.__hfWaitForSeekCompletion===Ho&&delete window.__hfWaitForSeekCompletion}),Rp(),co(),ze("discover");let Vp=()=>{let c=e.capturedTimeline,p=An();e.capturedTimeline&&(p||e.capturedTimeline!==c||!qe._timeline)&&(qe._timeline=e.capturedTimeline);let g=ot(e.capturedTimeline,0);if(g>0&&m.setDuration(g),ze("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},E=Object.keys(y).filter(N=>y[N]);if(E.length>0){let P=X()?.getAttribute("data-composition-id")??null;F("root_timeline_unbound_registry_present",{reason:P?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:P,registeredTimelineKeys:E},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(P?`Root data-composition-id is "${P}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${E.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${P??"<root-id>"}"] = tl).`)}}window.__renderReady=!0,ht(),Pe(!0)},$t=null,zp=()=>{if($t)return;let c=()=>{window.removeEventListener("hf-timelines-built",c),$t=null,Nt()};$t=c,window.addEventListener("hf-timelines-built",c)};C(()=>{$t&&(window.removeEventListener("hf-timelines-built",$t),$t=null)}),Nt=()=>{if(!J){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,zp();return}if(ze("discover",e.currentTime),!Wp()){window.__renderReady=!1;return}Vp()},Nt(),J&&setTimeout(()=>{Nt()},0);let Vr=0,zr=!1,vo=Number.NaN,So=null,qr=!1,gt=null,$r=!1,vl="",Sl=-1,jr=!1,Al=Number.NEGATIVE_INFINITY,qp=(c,p,g,y)=>{try{let E=y?.suppressEvents===!0;rt(c),typeof c.totalTime=="function"?c.totalTime(p,E):c.seek(p,E)}catch(E){L(g,E)}},$p=(c,p)=>{let g=window.__timelines??{},y=X()?.getAttribute("data-composition-id")??null;for(let[E,N]of Object.entries(g)){if(!N||E===y)continue;let P=document.querySelector(`[data-composition-id="${CSS.escape(E)}"]`);if(!P)continue;let K=q(P,0);if(!Number.isFinite(K))continue;let $=Ae(N),ne=Qe(P)+Math.max(0,c-K)*Le(P),Ee=Math.max(0,$!=null&&$>0?Math.min($,ne):ne);qp(N,Ee,"runtime.init.transport.childTimeline",p)}},jp=c=>{let p=window.__timelines??{},g=[];for(let y of Object.values(p))if(!(!y||y===c)){g.push(y);try{y.play()}catch(E){L("runtime.init.activateSiblings",E)}}return g},El=c=>typeof c=="object"&&c!==null,Tn=new WeakMap,Kp=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],wl=(c,p)=>{let g=c[p];if(typeof g!="function")return null;try{let y=Number(g.call(c));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Yp=c=>{let p=Tn.get(c);if(p!=null)return p;if(!("getChildren"in c)||typeof c.getChildren!="function")return!1;let g;try{g=c.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),Tn.set(c,!1),!1}if(!Array.isArray(g))return Tn.set(c,!1),!1;for(let y of g){if(!El(y))continue;let E=y.vars;if(!El(E)||!Kp.some($=>typeof E[$]=="function"))continue;let K=wl(y,"totalDuration")??wl(y,"duration");if(K!=null&&K<=1e-6)return Tn.set(c,!0),!0}return Tn.set(c,!1),!1};function Lt(c,p){let g=e.capturedTimeline,y=g&&p?.activateChildren?jp(g):[];try{Xp(g,c,p)}finally{for(let E of y)rt(E)}}function Xp(c,p,g){let y=g?.suppressEvents===!0;if(c){let E=c,N=p;if(typeof E.totalDuration=="function")try{let P=Number(E.totalDuration());Number.isFinite(P)&&P>0&&p>P&&(N=P)}catch(P){L("runtime.init.transport.clampDuration",P)}try{typeof c.totalTime=="function"?(c.totalTime(N,y),!y&&!Yp(c)&&(c.totalTime(N+.001,!0),c.totalTime(N,!0))):c.seek(N,y)}catch(P){L("runtime.init.transport.seek",P)}}$p(p,g);for(let E of e.deterministicAdapters)if(!(E.name==="gsap"&&c))try{E.seek({time:p,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Ao=vm(document,()=>{zt()});a.push(()=>Ao.disconnect());let Jp=()=>{try{return Ao.isActive()}catch{return!1}},Qp=()=>!m.isPlaying()&&!Xs()&&Ao.observing&&!qr&&!jr&&e.currentTime===vo&&e.capturedTimeline===So,_l=()=>`${Nr()}|${Ys()??""}`,Cl=()=>{gt=window.setTimeout(Zp,e.bridgeMaxPostIntervalMs)},Zp=()=>{if(gt=null,!e.tornDown&&!(typeof window>"u"||typeof document>"u")){if(_l()!==vl){zt();return}Pe(!1),Cl()}},eh=()=>{if(e.transportRafId=null,e.tornDown)return;let c=$r;if($r=!1,c||!Qp()){e.transportRafId=window.requestAnimationFrame(Eo);return}vl=_l(),Cl()};zt=()=>{e.tornDown||($r=!0,!(zr||e.transportRafId!=null)&&(gt!=null&&(window.clearTimeout(gt),gt=null),$r=!1,e.transportRafId=window.requestAnimationFrame(Eo)))};let Eo=()=>{if(!(e.tornDown||zr)){zr=!0;try{Vr+=1;let c=Nr();c!==Sl&&(Sl=c,jr=!0);let p=Date.now(),g=jr&&!m.isPlaying()&&p-Al>=Sm;if(g&&(Al=p),Am({tick:Vr,isPlaying:m.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:m.now(),compositionChanged:g})){let P=e.capturedTimeline;if(An()){e.capturedTimeline&&!qe._timeline&&(qe._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==P&&rt(e.capturedTimeline);let K=ot(e.capturedTimeline,0,c);K>0&&m.setDuration(K),ht()}}if((g||Vr%20===0)&&(ht(),jr=!1),(g||Vr%30===0)&&co(),e.capturedTimeline){let P=ot(e.capturedTimeline,0,c);P>0&&(!m.isPlaying()||P>=m.getDuration())&&m.setDuration(P)}if(m.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&f.isActive()&&f.context){let P=f.getTime();P>=0&&m.attachAudioSource({currentTimeSeconds:P})}else{let P=document.querySelectorAll("audio[data-start]"),K=!1;for(let $ of P){if(!ge($)||!$.isConnected||b($))continue;let ne=Z($),Ee=Ce($.dataset.duration),He=Ee!=null&&Ee>0?ne+Ee:1/0,ae=Qe($);if(Number.isFinite(ne)&&e.currentTime>=ne&&e.currentTime<He){$.paused?!$.error&&$.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(m.attachAudioSource({currentTimeSeconds:e.currentTime}),K=!0):(m.attachAudioSource({el:$,compositionStart:ne,mediaStart:ae}),K=!0);break}}!K&&m.hasAudioSource()&&m.detachAudioSource()}else m.hasAudioSource()&&m.detachAudioSource();let y=m.now();e.currentTime=y;let E=m.isPlaying();if(!E&&Jp()?qr=!0:(E||qr||y!==vo||e.capturedTimeline!==So)&&(Lt(y),vo=y,So=e.capturedTimeline,E||(qr=!1)),E&&Ye.redrawAnimated(),m.isPlaying()&&m.reachedEnd()){f.stopAll(),m.detachAudioSource(),m.pause(),e.isPlaying=!1;let P=m.getDuration();Number.isFinite(P)&&(m.seek(P),e.currentTime=P,Lt(P)),ze("pause"),Ge(),Pe(!0);return}m.isPlaying()?Ge():Gp()&&(_n=null,Ge()),Pe(!1)}finally{zr=!1,eh()}}},Rl=c=>{let p=document.querySelectorAll("video, audio");for(let g of p){if(!ge(g)||!g.isConnected||!g.hasAttribute("data-start"))continue;let y=Z(g);if(!Number.isFinite(y))continue;let E=Ce(g.dataset.duration),N=E!=null&&E>0?y+E:1/0;if(c<y||c>=N)continue;let P=Qe(g),K=c-y+P;if(K>=0)try{g.currentTime=K}catch{}}},wo=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let c=f.startGeneration(),p=document.querySelectorAll("audio[data-start]");for(let g of p){if(!ge(g)||!g.isConnected||b(g))continue;let y=Z(g);if(!Number.isFinite(y))continue;let E=Qe(g),N=Number.parseFloat(g.dataset.volume??""),P=Number.isFinite(N)?N:1,K=Ce(g.dataset.duration),$=K!=null&&K>0?K:Number.POSITIVE_INFINITY,ne=g.closest("[data-composition-id]");if(ne){let ae=q(ne,0),Y=O(ne,{includeAuthoredTimingAttrs:!0});Y!=null&&Y>0&&($=Math.min($,Math.max(0,ae+Y-y)))}let Ee=bn(g);xn(g,Ee),(Ee.kind==="web-audio"?f.scheduleMediaElementPlayback(g,y,E,m.now(),P,c,e.playbackRate):Promise.resolve(null)).then(ae=>{if(ae||!m.isPlaying())return;let Y=e.playbackRate*Le(g),Re=g.hasAttribute("data-fx-chain")||g.hasAttribute("data-automation");if(Math.abs(Y-1)>1e-9){Ee.kind==="web-audio"&&Re&&(g.muted=!0);return}f.decodeAudioElement(g).then(Dt=>{!Dt||!m.isPlaying()||f.schedulePlayback(g,Dt,y,E,m.now(),P,c,e.playbackRate,$)})})}};function Tl(){f.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&h&&m.isPlaying()&&f.hasBoundedActiveSources()&&(f.stopAll(),wo())}if(e.capturedTimeline){let c=ot(e.capturedTimeline,0);c>0&&m.setDuration(c),rt(e.capturedTimeline)}vf(window),e.transportRafId=window.requestAnimationFrame(Eo),ht(),Pe(!0),e.controlBridgeHandler=Nl({onPlay:()=>{qe.play(),Be("composition_played",{time:qe.getTime()})},onPause:()=>{qe.pause(),Be("composition_paused",{time:qe.getTime()})},onStopMedia:()=>{f.stopAll();let c=document.querySelectorAll("video, audio");for(let p of c)ge(p)&&!p.paused&&p.pause()},onSeek:(c,p)=>{qe.seek(c),Be("composition_seeked",{time:c})},onSetMuted:c=>{e.bridgeMuted=c;let p=c||e.mediaOutputMuted;f.setMuted(p);let g=document.querySelectorAll("video, audio");for(let y of g)ge(y)&&(y.muted=p||y.defaultMuted)},onSetVolume:c=>{e.bridgeVolume=c,f.setVolume(c);let p=document.querySelectorAll("video, audio");for(let g of p){if(!ge(g))continue;let y=parseFloat(g.dataset.volume??""),E=Number.isFinite(y)?y:1;g.volume=ti(E*c)}},onSetMediaOutputMuted:c=>{e.mediaOutputMuted=c;let p=c||e.bridgeMuted;f.setMuted(p);let g=document.querySelectorAll("video, audio");for(let y of g)ge(y)&&(y.muted=p||y.defaultMuted)},onSetNativeMediaSyncDisabled:c=>{e.nativeMediaSyncDisabled!==c&&(e.nativeMediaSyncDisabled=c,e.mediaForceSyncNextTick=!0,c?(f.stopAll(),m.detachAudioSource()):Ge())},onSetWebAudioMediaDisabled:c=>{e.webAudioMediaDisabled!==c&&(e.webAudioMediaDisabled=c,e.mediaForceSyncNextTick=!0,c&&(f.stopAll(),m.detachAudioSource()),Ge())},onSetPlaybackRate:c=>{yo(c),e.transportClock&&e.transportClock.setRate(e.playbackRate),Tl()},onSetRootDuration:Bp,onSetColorGrading:(c,p)=>{Ye.setGrading(c,p)},onSetColorGradingCompare:(c,p)=>{Ye.setCompare(c,p)},onTick:()=>{if(e.tornDown||!m.isPlaying())return;let c=m.now();if(e.currentTime=c,Lt(c),m.reachedEnd()){f.stopAll(),m.detachAudioSource(),m.pause(),e.isPlaying=!1;let p=m.getDuration();Number.isFinite(p)&&(m.seek(p),e.currentTime=p,Lt(p)),ze("pause"),Ge(),Pe(!0)}},onEnablePickMode:()=>Wr.enablePickMode(),onDisablePickMode:()=>Wr.disablePickMode(),onSetRuntimeData:eo,onClearRuntimeData:to,getCanonicalFps:()=>e.canonicalFps});let _o=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),gt!=null&&(window.clearTimeout(gt),gt=null),e.transportClock=null,f.destroy(),Ft!=null&&(window.clearTimeout(Ft),Ft=null),s!=null&&(window.cancelAnimationFrame(s),s=null),Mp(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Wr.disablePickMode();for(let c of e.deterministicAdapters)if(!(!c||typeof c.revert!="function"))try{c.revert()}catch(p){L("runtime.init.site12",p)}e.deterministicAdapters=[];for(let c of a.splice(0))try{c()}catch(p){L("runtime.init.site13",p)}for(let c of e.injectedCompStyles)try{c.remove()}catch(p){L("runtime.init.site14",p)}e.injectedCompStyles=[];for(let c of e.injectedCompLinks)try{c.remove()}catch(p){L("runtime.init.site15",p)}e.injectedCompLinks=[];for(let c of e.injectedCompScripts)try{c.remove()}catch(p){L("runtime.init.site16",p)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===_o&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=_o,e.beforeUnloadHandler=_o,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Hm=["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"],Bs=[[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 Iv(e){if(e<=255)return Hm[e];let t=0,n=Bs.length-1;for(;t<=n;){let r=t+n>>1,i=Bs[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function Pv(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u<t;){let d=e.charCodeAt(u),m=d,f=1;if(d>=55296&&d<=56319&&u+1<t){let b=e.charCodeAt(u+1);b>=56320&&b<=57343&&(m=(d-55296<<10)+(b-56320)+65536,f=2)}let h=Iv(m);(h==="R"||h==="AL"||h==="AN")&&(r=!0);for(let b=0;b<f;b++)n[u+b]=h;u+=f}if(!r)return null;let i=0;for(let u=0;u<t;u++){let d=n[u];if(d==="L"){i=0;break}if(d==="R"||d==="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 d=n[u];d==="EN"?n[u]=s==="AL"?"AN":"EN":(d==="R"||d==="L"||d==="AL")&&(s=d)}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 d;for(d=u-1;d>=0&&n[d]==="ET";d--)n[d]="EN";for(d=u+1;d<t&&n[d]==="ET";d++)n[d]="EN"}for(let u=0;u<t;u++){let d=n[u];(d==="WS"||d==="ES"||d==="ET"||d==="CS")&&(n[u]="ON")}s=l;for(let u=0;u<t;u++){let d=n[u];d==="EN"?n[u]=s==="L"?"L":"EN":(d==="R"||d==="L")&&(s=d)}for(let u=0;u<t;u++){if(n[u]!=="ON")continue;let d=u+1;for(;d<t&&n[d]==="ON";)d++;let m=u>0?n[u-1]:l,f=d<t?n[d]:l,h=m!=="L"?"R":"L";if(h===(f!=="L"?"R":"L"))for(let v=u;v<d;v++)n[v]=h;u=d-1}for(let u=0;u<t;u++)n[u]==="ON"&&(n[u]=a);for(let u=0;u<t;u++){let d=n[u];(o[u]&1)===0?d==="R"?o[u]++:(d==="AN"||d==="EN")&&(o[u]+=2):(d==="L"||d==="AN"||d==="EN")&&o[u]++}return o}function Bm(e,t){let n=Pv(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 Ov=/[ \\t\\n\\r\\f]+/g,Gv=/[\\t\\n\\r\\f]| {2,}|^ | $/;function Hv(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function Bv(e){if(!Gv.test(e))return e;let t=e.replace(Ov," ");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 Uv(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var Us=null,Wv;function Vv(){return Us===null&&(Us=new Intl.Segmenter(Wv,{granularity:"word"})),Us}var zv=/\\p{Script=Arabic}/u,no=/\\p{M}/u,Km=/\\p{Nd}/u;function Um(e){return zv.test(e)}function Wm(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 Ke(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(Wm(i))return!0;t++;continue}}if(Wm(n))return!0}}return!1}function qv(e){let t=oo(e);return t!==null&&(io.has(t)||Rt.has(t))}var $v=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function jv(e){return Ke(e)}function Kv(e){let t=oo(e);return t!==null&&$v.has(t)}function ro(e){return!qv(e)&&!Kv(e)}var io=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"]),kr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Vs=new Set(["\'","\\u2019"]),Rt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Yv=new Set([":",".","\\u060C","\\u061B"]),Xv=new Set(["\\u104F"]),Jv=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function Qv(e){if(zs(e))return!0;let t=!1;for(let n of e){if(Rt.has(n)){t=!0;continue}if(!(t&&no.test(n)))return!1}return t}function Zv(e){for(let t of e)if(!io.has(t)&&!Rt.has(t))return!1;return e.length>0}function e1(e){if(zs(e))return!0;for(let t of e)if(!kr.has(t)&&!Vs.has(t)&&!no.test(t))return!1;return e.length>0}function zs(e){let t=!1;for(let n of e)if(!(n==="\\\\"||no.test(n))){if(kr.has(n)||Rt.has(n)||Vs.has(n)){t=!0;continue}return!1}return t}function Ym(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 oo(e){if(e.length===0)return null;let t=Ym(e,e.length);return e.slice(t)}function t1(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(no.test(r)){n--;continue}if(kr.has(r)||Vs.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function n1(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function Vm(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 zm(e,t){return e&&t!==null&&Yv.has(t)}function r1(e){let t=oo(e);return t!==null&&Xv.has(t)}function i1(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 ao(e){let t=e.length;for(;t>0;){let n=Ym(e,t),r=e.slice(n,t);if(Jv.has(r))return!0;if(!Rt.has(r))return!1;t=n}return!1}function o1(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 a1=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ve(e){return e.length===1?e[0]:e.join("")}function s1(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ve(n)}function l1(e,t,n,r){if(!a1.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let d of e){let m=o1(d,r),f=m==="text"&&t;if(o!==null&&m===o&&f===s){a.push(d),u+=d.length;continue}o!==null&&i.push({text:Ve(a),isWordLike:s,kind:o,start:l}),o=m,a=[d],l=n+u,s=f,u+=d.length}return o!==null&&i.push({text:Ve(a),isWordLike:s,kind:o,start:l}),i}function Ws(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var u1=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function c1(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:u1.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function d1(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function f1(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"||!c1(e,a))continue;let l=[t[a]],s=a+1;for(;s<e.len&&!Ws(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]=Ve(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 m1(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]),!d1(a))continue;let l=o+1;if(l>=e.len||Ws(e.kinds[l]))continue;let s=[],u=e.starts[l],d=l;for(;d<e.len&&!Ws(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(t.push(Ve(s)),n.push(!0),r.push("text"),i.push(u),o=d-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var p1=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),qm=/^[A-Za-z0-9_]+[,:;]*$/,$m=/[,:;]+$/;function Xm(e){for(let t of e)if(Km.test(t))return!0;return!1}function Tr(e){if(e.length===0)return!1;for(let t of e)if(!(Km.test(t)||p1.has(t)))return!1;return!0}function h1(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"&&Tr(a)&&Xm(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&Tr(e.texts[u]);)s.push(e.texts[u]),u++;t.push(Ve(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 g1(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&&qm.test(a)){let u=[a],d=$m.test(a),m=o+1;for(;d&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&qm.test(e.texts[m]);){let f=e.texts[m];u.push(f),d=$m.test(f),m++}t.push(Ve(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 b1(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 d=l[u];if(!s)break;(d.length===0||!Xm(d)||!Tr(d))&&(s=!1)}if(s){let u=0;for(let d=0;d<l.length;d++){let m=l[d],f=d<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 x1(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 d=[a[0]],m=u;for(o++;o<e.len&&e.kinds[o]==="glue";)d.push(e.texts[o]),o++;let f=Ve(d);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 d=[];for(;o<e.len&&e.kinds[o]==="glue";)d.push(e.texts[o]),o++;let m=Ve(d);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(Ve(a)),n.push(l),r.push(s),i.push(u)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function y1(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"||!Ke(t[o])||!Ke(t[o+1]))continue;let a=t1(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 jm(e,t,n){let r=Vv(),i=0,o=[],a=[],l=[],s=[],u=[],d=[],m=[],f=[],h=[],b=[],v=[],x=[];for(let M of r.segment(e))for(let S of l1(M.segment,M.isWordLike??!1,M.index,n)){let U=function(){d[k]!==null&&(a[k]=[Vm(o,d,m,k)],d[k]=null),a[k].push(S.text),l[k]=l[k]||S.isWordLike,f[k]=f[k]||R,h[k]=h[k]||I,b[k]=j,v[k]=X,x[k]=zm(h[k],H)},A=S.kind==="text",w=n1(S.text,S.isWordLike,S.kind),R=Ke(S.text),I=Um(S.text),H=oo(S.text),j=ao(S.text),X=r1(S.text),k=i-1;t.carryCJKAfterClosingQuote&&A&&i>0&&s[k]==="text"&&R&&f[k]&&b[k]||A&&i>0&&s[k]==="text"&&Zv(S.text)&&f[k]||A&&i>0&&s[k]==="text"&&v[k]?U():A&&i>0&&s[k]==="text"&&S.isWordLike&&I&&x[k]?(U(),l[k]=!0):w!==null&&i>0&&s[k]==="text"&&d[k]===w?m[k]=(m[k]??1)+1:A&&!S.isWordLike&&i>0&&s[k]==="text"&&(Qv(S.text)||S.text==="-"&&l[k])?U():(o[i]=S.text,a[i]=[S.text],l[i]=S.isWordLike,s[i]=S.kind,u[i]=S.start,d[i]=w,m[i]=w===null?0:1,f[i]=R,h[i]=I,b[i]=j,v[i]=X,x[i]=zm(I,H),i++)}for(let M=0;M<i;M++){if(d[M]!==null){o[M]=Vm(o,d,m,M);continue}o[M]=Ve(a[M])}for(let M=1;M<i;M++)s[M]==="text"&&!l[M]&&zs(o[M])&&s[M-1]==="text"&&(o[M-1]+=o[M],l[M-1]=l[M-1]||l[M],o[M]="");let _=Array.from({length:i},()=>null),T=-1;for(let M=i-1;M>=0;M--){let S=o[M];if(S.length!==0){if(s[M]==="text"&&!l[M]&&e1(S)&&T>=0&&s[T]==="text"){let A=_[T]??[];A.push(S),_[T]=A,u[T]=u[M],o[M]="";continue}T=M}}for(let M=0;M<i;M++){let S=_[M];S!=null&&(o[M]=s1(S,o[M]))}let C=0;for(let M=0;M<i;M++){let S=o[M];S.length!==0&&(C!==M&&(o[C]=S,l[C]=l[M],s[C]=s[M],u[C]=u[M]),C++)}o.length=C,l.length=C,s.length=C,u.length=C;let F=x1({len:C,texts:o,isWordLike:l,kinds:s,starts:u}),D=y1(g1(b1(h1(m1(f1(F))))));for(let M=0;M<D.len-1;M++){let S=i1(D.texts[M]);S!==null&&(D.kinds[M]!=="space"&&D.kinds[M]!=="preserved-space"||D.kinds[M+1]!=="text"||!Um(D.texts[M+1])||(D.texts[M]=S.space,D.isWordLike[M]=!1,D.kinds[M]=D.kinds[M]==="preserved-space"?"preserved-space":"space",D.texts[M+1]=S.marks+D.texts[M+1],D.starts[M+1]=D.starts[M]+S.space.length))}return D}function v1(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 S1(e){if(e.len<=1)return e;let t=[],n=[],r=[],i=[],o=null,a=!1,l=0,s=!1,u=!1;function d(){o!==null&&(t.push(Ve(o)),n.push(a),r.push("text"),i.push(l),o=null)}for(let m=0;m<e.len;m++){let f=e.texts[m],h=e.kinds[m],b=e.isWordLike[m],v=e.starts[m];if(h==="text"){let x=jv(f),_=ro(f);if(o!==null&&s&&u){o.push(f),a=a||b,s=s||x,u=_;continue}d(),o=[f],a=b,l=v,s=x,u=_;continue}d(),t.push(f),n.push(b),r.push(h),i.push(v)}return d(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Jm(e,t,n="normal",r="normal"){let i=Hv(n),o=i.mode==="pre-wrap"?Uv(e):Bv(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?S1(jm(o,t,i)):jm(o,t,i);return{normalized:o,chunks:v1(a,i),...a}}var yn=null,Qm=new Map,vn=null,A1=96,E1=/\\p{Emoji_Presentation}/u,w1=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,qs=null,Zm=new Map;function $s(){if(yn!==null)return yn;if(typeof OffscreenCanvas<"u")return yn=new OffscreenCanvas(1,1).getContext("2d"),yn;if(typeof document<"u")return yn=document.createElement("canvas").getContext("2d"),yn;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function _1(e){let t=Qm.get(e);return t||(t=new Map,Qm.set(e,t)),t}function pt(e,t){let n=t.get(e);return n===void 0&&(n={width:$s().measureText(e).width,containsCJK:Ke(e)},t.set(e,n)),n}function kt(){if(vn!==null)return vn;if(typeof navigator>"u")return vn={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},vn;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 vn={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},vn}function C1(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function ep(){return qs===null&&(qs=new Intl.Segmenter(void 0,{granularity:"grapheme"})),qs}function R1(e){return E1.test(e)||e.includes("\\uFE0F")}function tp(e){return w1.test(e)}function T1(e,t){let n=Zm.get(e);if(n!==void 0)return n;let r=$s();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 Zm.set(e,n),n}function k1(e){let t=0,n=ep();for(let r of n.segment(e))R1(r.segment)&&t++;return t}function M1(e,t){return t.emojiCount===void 0&&(t.emojiCount=k1(e)),t.emojiCount}function Tt(e,t,n){return n===0?t.width:t.width-M1(e,t)*n}function np(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=ep(),a=[];for(let d of o.segment(e))a.push(d.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let d=[];for(let m of a){let f=pt(m,n);d.push(Tt(m,f,r))}return t.breakableFitAdvances=d,t.breakableFitAdvances}if(i==="pair-context"||a.length>A1){let d=[],m=null,f=0;for(let h of a){let b=pt(h,n),v=Tt(h,b,r);if(m===null)d.push(v);else{let x=m+h,_=pt(x,n);d.push(Tt(x,_,r)-f)}m=h,f=v}return t.breakableFitAdvances=d,t.breakableFitAdvances}let l=[],s="",u=0;for(let d of a){s+=d;let m=pt(s,n),f=Tt(s,m,r);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function rp(e,t){let n=$s();n.font=e;let r=_1(e),i=C1(e),o=t?T1(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function F1(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 ip(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function op(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 N1(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 ap(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 sp(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=N1(e,t.segmentIndex);return n<0?-1:ap(e,n,t)}function L1(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:ap(e,r,n)}function lp(e,t){return e.simpleLineWalkFastPath?up(e,t):js(e,t)}function up(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=kt().lineFitEpsilon,s=t+l,u=0,d=0,m=!1,f=0,h=0,b=0,v=0,x=-1,_=0;function T(){x=-1,_=0}function C(w=b,R=v,I=d){u++,n?.({startSegmentIndex:f,startGraphemeIndex:h,endSegmentIndex:w,endGraphemeIndex:R,width:I}),d=0,m=!1,T()}function F(w,R){m=!0,f=w,h=0,b=w+1,v=0,d=R}function D(w,R,I){m=!0,f=w,h=R,b=w,v=R+1,d=I}function M(w,R){if(!m){F(w,R);return}d+=R,b=w+1,v=0}function S(w,R){let I=o[w];for(let H=R;H<I.length;H++){let j=I[H];m?d+j>s?(C(),D(w,H,j)):(d+=j,b=w,v=H+1):D(w,H,j)}m&&b===w&&v===I.length&&(b=w+1,v=0)}let A=0;for(;A<r.length&&!(!m&&(A=F1(e,A),A>=r.length));){let w=r[A],R=i[A],I=R==="space"||R==="preserved-space"||R==="tab"||R==="zero-width-break"||R==="soft-hyphen";if(!m){w>t&&o[A]!==null?S(A,0):F(A,w),I&&(x=A+1,_=d-w),A++;continue}if(d+w>s){if(I){M(A,w),C(A+1,0,d-w),A++;continue}if(x>=0){if(b>x||b===x&&v>0){C();continue}C(x,0,_);continue}if(w>t&&o[A]!==null){C(),S(A,0),A++;continue}C();continue}M(A,w),I&&(x=A+1,_=d-w),A++}return m&&C(),u}function js(e,t,n){if(e.simpleLineWalkFastPath)return up(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:d}=e;if(r.length===0||d.length===0)return 0;let m=kt(),f=m.lineFitEpsilon,h=t+f,b=0,v=0,x=!1,_=0,T=0,C=0,F=0,D=-1,M=0,S=0,A=null;function w(){D=-1,M=0,S=0,A=null}function R(B=C,G=F,W=v){b++,n?.({startSegmentIndex:_,startGraphemeIndex:T,endSegmentIndex:B,endGraphemeIndex:G,width:W}),v=0,x=!1,w()}function I(B,G){x=!0,_=B,T=0,C=B+1,F=0,v=G}function H(B,G,W){x=!0,_=B,T=G,C=B,F=G+1,v=W}function j(B,G){if(!x){I(B,G);return}v+=G,C=B+1,F=0}function X(B,G,W,Q){if(!G)return;let q=B==="tab"?0:i[W],O=B==="tab"?Q:o[W];D=W+1,M=v-Q+q,S=v-Q+O,A=B}function k(B,G){let W=l[B];for(let Q=G;Q<W.length;Q++){let q=W[Q];x?v+q>h?(R(),H(B,Q,q)):(v+=q,C=B,F=Q+1):H(B,Q,q)}x&&C===B&&F===W.length&&(C=B+1,F=0)}function U(B){if(A!=="soft-hyphen")return!1;let G=l[B];if(G==null)return!1;let{fitCount:W,fittedWidth:Q}=op(G,v,t,f,s);return W===0?!1:(v=Q,C=B,F=W,w(),W===G.length?(C=B+1,F=0,!0):(R(B,W,Q+s),k(B,W),!0))}function te(B){b++,n?.({startSegmentIndex:B.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:B.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),w()}for(let B=0;B<d.length;B++){let G=d[B];if(G.startSegmentIndex===G.endSegmentIndex){te(G);continue}x=!1,v=0,_=G.startSegmentIndex,T=0,C=G.startSegmentIndex,F=0,w();let W=G.startSegmentIndex;for(;W<G.endSegmentIndex;){let Q=a[W],q=Q==="space"||Q==="preserved-space"||Q==="tab"||Q==="zero-width-break"||Q==="soft-hyphen",O=Q==="tab"?ip(v,u):r[W];if(Q==="soft-hyphen"){x&&(C=W+1,F=0,D=W+1,M=v+s,S=v+s,A=Q),W++;continue}if(!x){O>t&&l[W]!==null?k(W,0):I(W,O),X(Q,q,W,O),W++;continue}if(v+O>h){let Z=v+(Q==="tab"?0:i[W]),pe=v+(Q==="tab"?O:o[W]);if(A==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&M<=h){R(D,0,S);continue}if(A==="soft-hyphen"&&U(W)){W++;continue}if(q&&Z<=h){j(W,O),R(W+1,0,pe),W++;continue}if(D>=0&&M<=h){if(C>D||C===D&&F>0){R();continue}let re=D;R(re,0,S),W=re;continue}if(O>t&&l[W]!==null){R(),k(W,0),W++;continue}R();continue}j(W,O),X(Q,q,W,O),W++}if(x){let Q=D===G.consumedEndSegmentIndex?S:v;R(G.consumedEndSegmentIndex,0,Q)}}return b}function cp(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:d,tabStopAdvance:m}=e,f=kt(),h=f.lineFitEpsilon,b=r+h,v=0,x=!1,_=t.segmentIndex,T=t.graphemeIndex,C=-1,F=0,D=0,M=null;function S(){C=-1,F=0,D=0,M=null}function A(k=_,U=T,te=v){return x?(t.segmentIndex=k,t.graphemeIndex=U,te):null}function w(k,U){x=!0,_=k+1,T=0,v=U}function R(k,U,te){x=!0,_=k,T=U+1,v=te}function I(k,U){if(!x){w(k,U);return}v+=U,_=k+1,T=0}function H(k,U,te,B){if(!U)return;let G=k==="tab"?0:a[te],W=k==="tab"?B:l[te];C=te+1,F=v-B+G,D=v-B+W,M=k}function j(k,U){let te=u[k];for(let B=U;B<te.length;B++){let G=te[B];if(!x)R(k,B,G);else{if(v+G>b)return A();v+=G,_=k,T=B+1}}return x&&_===k&&T===te.length&&(_=k+1,T=0),null}function X(k){if(M!=="soft-hyphen"||C<0)return null;let U=u[k]??null;if(U!==null){let{fitCount:te,fittedWidth:B}=op(U,v,r,h,d);if(te===U.length)return v=B,_=k+1,T=0,S(),null;if(te>0)return A(k,te,B+d)}return F<=b?A(C,0,D):null}for(let k=t.segmentIndex;k<i.endSegmentIndex;k++){let U=s[k],te=U==="space"||U==="preserved-space"||U==="tab"||U==="zero-width-break"||U==="soft-hyphen",B=k===t.segmentIndex?t.graphemeIndex:0,G=U==="tab"?ip(v,m):o[k];if(U==="soft-hyphen"&&B===0){x&&(_=k+1,T=0,C=k+1,F=v+d,D=v+d,M=U);continue}if(!x){if(B>0){let Q=j(k,B);if(Q!==null)return Q}else if(G>r&&u[k]!==null){let Q=j(k,0);if(Q!==null)return Q}else w(k,G);H(U,te,k,G);continue}if(v+G>b){let Q=v+(U==="tab"?0:a[k]),q=v+(U==="tab"?G:l[k]);if(M==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&F<=b)return A(C,0,D);let O=X(k);if(O!==null)return O;if(te&&Q<=b)return I(k,G),A(k+1,0,q);if(C>=0&&F<=b)return _>C||_===C&&T>0?A():A(C,0,D);if(G>r&&u[k]!==null){let V=A();if(V!==null)return V;let Z=j(k,0);if(Z!==null)return Z}return A()}I(k,G),H(U,te,k,G)}return C===i.consumedEndSegmentIndex&&T===0?A(i.consumedEndSegmentIndex,0,D):A(i.consumedEndSegmentIndex,0,v)}function D1(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=kt().lineFitEpsilon,s=n+l,u=0,d=!1,m=t.segmentIndex,f=t.graphemeIndex,h=-1,b=0;for(let v=t.segmentIndex;v<r.length;v++){let x=r[v],_=i[v],T=_==="space"||_==="preserved-space"||_==="tab"||_==="zero-width-break"||_==="soft-hyphen",C=v===t.segmentIndex?t.graphemeIndex:0,F=o[v];if(!d){if(C>0||x>n&&F!==null){let D=F,M=D[C];d=!0,u=M,m=v,f=C+1;for(let S=C+1;S<D.length;S++){let A=D[S];if(u+A>s)return t.segmentIndex=m,t.graphemeIndex=f,u;u+=A,m=v,f=S+1}m===v&&f===D.length&&(m=v+1,f=0)}else d=!0,u=x,m=v+1,f=0;T&&(h=v+1,b=u-x);continue}if(u+x>s)return T?(t.segmentIndex=v+1,t.graphemeIndex=0,u):h>=0?m>h||m===h&&f>0?(t.segmentIndex=m,t.graphemeIndex=f,u):(t.segmentIndex=h,t.graphemeIndex=0,b):(t.segmentIndex=m,t.graphemeIndex=f,u);u+=x,m=v+1,f=0,T&&(h=v+1,b=u-x)}return d?(t.segmentIndex=m,t.graphemeIndex=f,u):null}function I1(e,t,n){let r=sp(e,t);return r<0?null:e.simpleLineWalkFastPath?D1(e,t,n):cp(e,t,r,n)}function dp(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=sp(e,n);for(;o>=0;){let a=cp(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=L1(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=I1(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var Ks=null;function P1(){return Ks===null&&(Ks=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ks}function O1(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 G1(e,t){let n=[],r=[],i=0,o=!1,a=!1,l=!1;function s(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(""),start:i}),r=[],o=!1,a=!1,l=!1)}function u(m,f,h){r=[m],i=f,o=h,a=ao(m),l=kr.has(m)}function d(m,f){r.push(m),o=o||f;let h=ao(m);m.length===1&&Rt.has(m)?a=a||h:a=h,l=!1}for(let m of P1().segment(e)){let f=m.segment,h=Ke(f);if(r.length===0){u(f,m.index,h);continue}if(l||io.has(f)||Rt.has(f)||t.carryCJKAfterClosingQuote&&h&&a){d(f,h);continue}if(!o&&!h){d(f,h);continue}s(),u(f,m.index,h)}return s(),n}function H1(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=Ke(e[0].text),o=ro(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=Ke(s.text),d=ro(s.text);if(i&&o){n.push(s.text),i=i||u,o=d;continue}a(),n=[s.text],r=s.start,i=u,o=d}return a(),t}function B1(e,t,n,r){let i=kt(),{cache:o,emojiCorrection:a}=rp(t,tp(e.normalized)),l=Tt("-",pt("-",o),a),u=Tt(" ",pt(" ",o),a)*8;if(e.len===0)return O1(n);let d=[],m=[],f=[],h=[],b=e.chunks.length<=1,v=n?[]:null,x=[],_=n?[]:null,T=Array.from({length:e.len});function C(S,A,w,R,I,H,j){I!=="text"&&I!=="space"&&I!=="zero-width-break"&&(b=!1),d.push(A),m.push(w),f.push(R),h.push(I),v?.push(H),x.push(j),_!==null&&_.push(S)}function F(S,A,w,R,I){let H=pt(S,o),j=Tt(S,H,a),X=A==="space"||A==="preserved-space"||A==="zero-width-break"?0:j,k=A==="space"||A==="zero-width-break"?0:j;if(I&&R&&S.length>1){let U="sum-graphemes";Tr(S)?U="pair-context":i.preferPrefixWidthsForBreakableRuns&&(U="segment-prefixes");let te=np(S,H,o,a,U);C(S,j,X,k,A,w,te);return}C(S,j,X,k,A,w,null)}for(let S=0;S<e.len;S++){T[S]=d.length;let A=e.texts[S],w=e.isWordLike[S],R=e.kinds[S],I=e.starts[S];if(R==="soft-hyphen"){C(A,0,l,l,R,I,null);continue}if(R==="hard-break"){C(A,0,0,0,R,I,null);continue}if(R==="tab"){C(A,0,0,0,R,I,null);continue}let H=pt(A,o);if(R==="text"&&H.containsCJK){let j=G1(A,i),X=r==="keep-all"?H1(j):j;for(let k=0;k<X.length;k++){let U=X[k];F(U.text,"text",I+U.start,w,r==="keep-all"||!Ke(U.text))}continue}F(A,R,I,w,!0)}let D=U1(e.chunks,T,d.length),M=v===null?null:Bm(e.normalized,v);return _!==null?{widths:d,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:h,simpleLineWalkFastPath:b,segLevels:M,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:D,segments:_}:{widths:d,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:h,simpleLineWalkFastPath:b,segLevels:M,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:D}}function U1(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 fp(e,t,n,r){let i=r?.wordBreak??"normal",o=Jm(e,kt(),r?.whiteSpace,i);return B1(o,t,n,i)}function so(e,t,n){return fp(e,t,!1,n)}function mp(e,t,n){return fp(e,t,!0,n)}function lo(e,t,n){let r=lp(e,t);return{lineCount:r,height:r*n}}function W1(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function V1(e,t,n){return e.widths.length===0?0:js(e,t,r=>{n(W1(r))})}function pp(e,t){return dp(e,t)}function hp(e){let t=0;return V1(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var z1={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function gp(e,t){let n={...z1,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=so(e,o),{lineCount:l}=lo(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var bp={prepare:so,layout:lo,prepareWithSegments:mp,measureLineStats:pp,measureNaturalWidth:hp};window.__timelines=window.__timelines||{};Nf();window.__hyperframes={fitTextFontSize:gp,getVariables:Pl,pretext:bp,registerRuntimeDataHandler:Pm,setRuntimeData:eo,clearRuntimeData:to};function xp(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Gm())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",xp,{once:!0}):xp();})();\n';
|
|
59267
|
+
RUNTIME_IIFE = '"use strict";(()=>{var nh=Object.create;var Ro=Object.defineProperty;var rh=Object.getOwnPropertyDescriptor;var ih=Object.getOwnPropertyNames;var oh=Object.getPrototypeOf,ah=Object.prototype.hasOwnProperty;var sh=(e,t,n)=>t in e?Ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var lh=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ih(t))!ah.call(e,i)&&i!==n&&Ro(e,i,{get:()=>t[i],enumerable:!(r=rh(t,i))||r.enumerable});return e};var uh=(e,t,n)=>(n=e!=null?nh(oh(e)):{},lh(t||!e||!e.__esModule?Ro(n,"default",{value:e,enumerable:!0}):n,e));var ye=(e,t,n)=>sh(e,typeof t!="symbol"?t+"":t,n);var Rc=oe((BE,Ra)=>{var ee=String,Cc=function(){return{isColorSupported:!1,reset:ee,bold:ee,dim:ee,italic:ee,underline:ee,inverse:ee,hidden:ee,strikethrough:ee,black:ee,red:ee,green:ee,yellow:ee,blue:ee,magenta:ee,cyan:ee,white:ee,gray:ee,bgBlack:ee,bgRed:ee,bgGreen:ee,bgYellow:ee,bgBlue:ee,bgMagenta:ee,bgCyan:ee,bgWhite:ee,blackBright:ee,redBright:ee,greenBright:ee,yellowBright:ee,blueBright:ee,magentaBright:ee,cyanBright:ee,whiteBright:ee,bgBlackBright:ee,bgRedBright:ee,bgGreenBright:ee,bgYellowBright:ee,bgBlueBright:ee,bgMagentaBright:ee,bgCyanBright:ee,bgWhiteBright:ee}};Ra.exports=Cc();Ra.exports.createColors=Cc});var Ta=oe(()=>{});var Ai=oe((VE,Mc)=>{"use strict";var Tc=Rc(),kc=Ta(),Jn=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=Tc.isColorSupported);let r=d=>d,i=d=>d,o=d=>d;if(t){let{bold:d,gray:f,red:m}=Tc.createColors(!0);i=h=>d(m(h)),r=h=>f(h),kc&&(o=h=>kc(h))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((d,f)=>{let m=l+1+f,h=" "+(" "+m).slice(-u)+" | ";if(m===this.line){if(d.length>160){let v=20,x=Math.max(0,this.column-v),_=Math.max(this.column+v,this.endColumn+v),T=d.slice(x,_),C=r(h.replace(/\\d/g," "))+d.slice(0,Math.min(this.column-1,v-1)).replace(/[^\\t]/g," ");return i(">")+r(h)+o(T)+`\n `+C+i("^")}let b=r(h.replace(/\\d/g," "))+d.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(h)+o(d)+`\n `+b+i("^")}return" "+r(h)+o(d)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};Mc.exports=Jn;Jn.default=Jn});var ka=oe((zE,Nc)=>{"use strict";var kg=/(<)(\\/?style\\b)/gi,Mg=/(<)(!--)/g;function At(e){return typeof e!="string"||!e.includes("<")?e:e.replace(kg,"\\\\3c $2").replace(Mg,"\\\\3c $2")}var Fc={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Fg(e){return e[0].toUpperCase()+e.slice(1)}var Qn=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(At(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(At(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(At(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:At(s)),this.stringify(l,r!==a||i)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(At("/*"+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(At(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 Fc[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"+Fg(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=Fc[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:At(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(At(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)}};Nc.exports=Qn;Qn.default=Qn});var Zn=oe((qE,Lc)=>{"use strict";var Ng=ka();function Ma(e,t){new Ng(t).stringify(e)}Lc.exports=Ma;Ma.default=Ma});var Ei=oe(($E,Fa)=>{"use strict";Fa.exports.isClean=Symbol("isClean");Fa.exports.my=Symbol("my")});var nr=oe((jE,Dc)=>{"use strict";var Lg=Ai(),Dg=ka(),Ig=Zn(),{isClean:er,my:Pg}=Ei();function Na(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=>Na(a,n)):(o==="object"&&i!==null&&(i=Na(i)),n[r]=i)}return n}function ct(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 tr=class{get proxyOf(){return this}constructor(t={}){this.raws={},this[er]=!1,this[Pg]=!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=Na(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 Lg(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[er]=!0}markDirty(){if(this[er]){this[er]=!1;let t=this;for(;t=t.parent;)t[er]=!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(ct(r,this.source.start),ct(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=ct(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:ct(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:ct(n,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let a=n.slice(ct(n,this.source.start),ct(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:ct(n,t.start)}:t.index&&(r=this.positionInside(t.index)),t.end?i={column:t.end.column,line:t.end.line,offset:ct(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 Dg().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=Ig){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)}};Dc.exports=tr;tr.default=tr});var ir=oe((KE,Ic)=>{"use strict";var Og=nr(),rr=class extends Og{constructor(t){super(t),this.type="comment"}};Ic.exports=rr;rr.default=rr});var ar=oe((YE,Pc)=>{"use strict";var Gg=nr(),or=class extends Gg{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"}};Pc.exports=or;or.default=or});var Et=oe((XE,qc)=>{"use strict";var Oc=ir(),Gc=ar(),Hg=nr(),{isClean:Hc,my:Bc}=Ei(),La,Uc,Wc,Da;function Vc(e){return e.map(t=>(t.nodes&&(t.nodes=Vc(t.nodes)),delete t.source,t))}function zc(e){if(e[Hc]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)zc(t)}var je=class e extends Hg{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=Vc(Uc(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 Gc(t)]}else if(t.selector||t.selectors)t=[new Da(t)];else if(t.name)t=[new La(t)];else if(t.text)t=[new Oc(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Bc]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Hc]&&zc(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)}))}};je.registerParse=e=>{Uc=e};je.registerRule=e=>{Da=e};je.registerAtRule=e=>{La=e};je.registerRoot=e=>{Wc=e};qc.exports=je;je.default=je;je.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,La.prototype):e.type==="rule"?Object.setPrototypeOf(e,Da.prototype):e.type==="decl"?Object.setPrototypeOf(e,Gc.prototype):e.type==="comment"?Object.setPrototypeOf(e,Oc.prototype):e.type==="root"&&Object.setPrototypeOf(e,Wc.prototype),e[Bc]=!0,e.nodes&&e.nodes.forEach(t=>{je.rebuild(t)})}});var wi=oe((JE,jc)=>{"use strict";var $c=Et(),sn=class extends $c{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)}};jc.exports=sn;sn.default=sn;$c.registerAtRule(sn)});var _i=oe((QE,Xc)=>{"use strict";var Bg=Et(),Kc,Yc,Gt=class extends Bg{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Kc(new Yc,this,t).stringify()}};Gt.registerLazyResult=e=>{Kc=e};Gt.registerProcessor=e=>{Yc=e};Xc.exports=Gt;Gt.default=Gt});var Qc=oe((ZE,Jc)=>{var Ug="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Wg=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},Vg=(e=21)=>{let t="",n=e|0;for(;n--;)t+=Ug[Math.random()*64|0];return t};Jc.exports={nanoid:Vg,customAlphabet:Wg}});var Ci=oe(()=>{});var Ri=oe(()=>{});var Ia=oe(()=>{});var Zc=oe(()=>{});var Oa=oe((lw,nd)=>{"use strict";var{existsSync:zg,readFileSync:qg}=Zc(),{dirname:Pa,join:$g}=Ci(),{SourceMapConsumer:ed,SourceMapGenerator:td}=Ri();function jg(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var sr=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=Pa(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ed(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 jg(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=Pa(t),zg(t)))return this.mapFile=t,qg(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 ed)return td.fromSourceMap(n).toString();if(n instanceof td)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=$g(Pa(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)}};nd.exports=sr;sr.default=sr});var lr=oe((uw,sd)=>{"use strict";var{nanoid:Kg}=Qc(),{isAbsolute:Ba,resolve:Ua}=Ci(),{SourceMapConsumer:Yg,SourceMapGenerator:Xg}=Ri(),{fileURLToPath:rd,pathToFileURL:Ti}=Ia(),id=Ai(),Jg=Oa(),Ga=Ta(),Ha=Symbol("lineToIndexCache"),Qg=!!(Yg&&Xg),od=!!(Ua&&Ba);function ad(e){if(e[Ha])return e[Ha];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[Ha]=n,n}var ln=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&&(!od||/^\\w+:\\/\\//.test(n.from)||Ba(n.from)?this.file=n.from:this.file=Ua(n.from)),od&&Qg){let r=new Jg(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 "+Kg(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 f=n,m=r;if(typeof f.offset=="number"){s=f.offset;let h=this.fromOffset(s);n=h.line,r=h.col}else n=f.line,r=f.column,s=this.fromLineAndColumn(n,r);if(typeof m.offset=="number"){l=m.offset;let h=this.fromOffset(l);a=h.line,o=h.col}else a=m.line,o=m.column,l=this.fromLineAndColumn(m.line,m.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let f=this.fromOffset(s);n=f.line,r=f.col}let d=this.origin(n,r,a,o);return d?u=new id(t,d.endLine===void 0?d.line:{column:d.column,line:d.line},d.endLine===void 0?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,i.plugin):u=new id(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&&(Ti&&(u.input.url=Ti(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return ad(this)[t-1]+n-1}fromOffset(t){let n=ad(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:Ua(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;Ba(a.source)?s=Ti(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||Ti(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(rd)u.file=rd(s);else throw new Error("file: protocol is not available in this PostCSS build");let d=o.sourceContentFor(a.source);return d&&(u.source=d),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}};sd.exports=ln;ln.default=ln;Ga&&Ga.registerInput&&Ga.registerInput(ln)});var un=oe((cw,dd)=>{"use strict";var ld=Et(),ud,cd,wt=class extends ld{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 ud(new cd,this,t).stringify()}};wt.registerLazyResult=e=>{ud=e};wt.registerProcessor=e=>{cd=e};dd.exports=wt;wt.default=wt;ld.registerRoot(wt)});var Wa=oe((dw,md)=>{"use strict";var ur={comma(e){return ur.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return ur.split(e,t)},split(e,t,n){let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let d of e)u?u=!1:d==="\\\\"?u=!0:l?d===s&&(l=!1):d===\'"\'||d==="\'"?(l=!0,s=d):d==="("?a+=1:d===")"?a>0&&(a-=1):a===0&&t.includes(d)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=d;return(n||i!=="")&&r.push(i.trim()),r}};md.exports=ur;ur.default=ur});var ki=oe((mw,pd)=>{"use strict";var fd=Et(),Zg=Wa(),cn=class extends fd{get selectors(){return Zg.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=[])}};pd.exports=cn;cn.default=cn;fd.registerRule(cn)});var gd=oe((fw,hd)=>{"use strict";var eb=wi(),tb=ir(),nb=ar(),rb=lr(),ib=Oa(),ob=un(),ab=ki();function cr(e,t){if(Array.isArray(e))return e.map(i=>cr(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:rb.prototype};o.map&&(o.map={...o.map,__proto__:ib.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>cr(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 ob(r);if(r.type==="decl")return new nb(r);if(r.type==="rule")return new ab(r);if(r.type==="comment")return new tb(r);if(r.type==="atrule")return new eb(r);throw new Error("Unknown node type: "+e.type)}hd.exports=cr;cr.default=cr});var za=oe((pw,Ad)=>{"use strict";var{dirname:Mi,relative:xd,resolve:yd,sep:vd}=Ci(),{SourceMapConsumer:Sd,SourceMapGenerator:Fi}=Ri(),{pathToFileURL:bd}=Ia(),sb=lr(),lb=!!(Sd&&Fi),ub=!!(Mi&&yd&&xd&&vd),Va=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||Mi(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Sd(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(),ub&&lb&&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=Fi.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Fi({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 Fi({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 d=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==d.last||d.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?Mi(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Mi(yd(r,this.mapOpts.annotation)));let i=xd(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 sb(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(bd){let r=bd(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;vd==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Ad.exports=Va});var _d=oe((hw,wd)=>{"use strict";var Ni=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Li=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,cb=/.[\\r\\n"\'(/\\\\]/,Ed=/[\\da-f]/i;wd.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,d,f,m,h,b,v=r.length,x=0,_=[],T=[],C=-1;function F(){return x}function D(w){throw t.error("Unclosed "+w,x)}function M(){return T.length===0&&x>=v}function S(w){if(T.length)return T.pop();if(x>=v)return;let R=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);d=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let I=String.fromCharCode(o);d=[I,I,x];break}case 40:{if(b=_.length?_.pop()[1]:"",h=r.charCodeAt(x+1),b==="url"&&h!==39&&h!==34&&h!==32&&h!==10&&h!==9&&h!==12&&h!==13){s=x;do{if(f=!1,s=r.indexOf(")",s+1),s===-1)if(i||R){s=x;break}else D("bracket");for(m=s;r.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);d=["brackets",r.slice(x,s+1),x,s],x=s}else x<=C?d=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||cb.test(a)?(C=s===-1?v:s,d=["(","(",x]):(d=["brackets",a,x,s],x=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=x;do{if(f=!1,s=r.indexOf(u,s+1),s===-1)if(i||R){s=x+1;break}else D("string");for(m=s;r.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);d=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{Ni.lastIndex=x+1,Ni.test(r),Ni.lastIndex===0?s=r.length-1:s=Ni.lastIndex-2,d=["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,Ed.test(r.charAt(s)))){for(;Ed.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}d=["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||R?s=r.length:D("comment")),d=["comment",r.slice(x,s+1),x,s],x=s):(Li.lastIndex=x+1,Li.test(r),Li.lastIndex===0?s=r.length-1:s=Li.lastIndex-2,d=["word",r.slice(x,s+1),x,s],_.push(d),x=s);break}}return x++,d}function A(w){T.push(w)}return{back:A,endOfFile:M,nextToken:S,position:F}}});var kd=oe((gw,Td)=>{"use strict";var db=wi(),mb=ir(),fb=ar(),pb=un(),Cd=ki(),hb=_d(),Rd={empty:!0,space:!0};function gb(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var qa=class{constructor(t){this.input=t,this.root=new pb,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 db;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 mb;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=hb(this.input)}decl(t,n){let r=new fb;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]||gb(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 d=this.stringFrom(t,u);d=this.spacesFromEnd(t)+d,d!==" !important"&&(r.raws.important=d);break}else if(o[1].toLowerCase()==="important"){let d=t.slice(0),f="";for(let m=u;m>0;m--){let h=d[m][0];if(f.trim().startsWith("!")&&h!=="space")break;f=d.pop()[1]+f}f.trim().startsWith("!")&&(r.important=!0,r.raws.important=f,t=d)}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 Cd;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,d,f;for(let m=0;m<l;m+=1)o=r[m],a=o[0],a==="space"&&m===l-1&&!i?u=!1:a==="comment"?(f=r[m-1]?r[m-1][0]:"empty",d=r[m+1]?r[m+1][0]:"empty",!Rd[f]&&!Rd[d]?s.slice(-1)===","?u=!1:s+=o[1]:u=!1):s+=o[1];if(!u){let m=r.reduce((h,b)=>h+b[1],"");t.raws[n]={raw:m,value:s}}t[n]=s}rule(t){t.pop();let n=new Cd;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})}};Td.exports=qa});var Ii=oe((bw,Md)=>{"use strict";var bb=Et(),xb=lr(),yb=kd();function Di(e,t){let n=new xb(e,t),r=new yb(n);try{r.parse()}catch(i){throw i}return r.root}Md.exports=Di;Di.default=Di;bb.registerParse(Di)});var $a=oe((xw,Fd)=>{"use strict";var dr=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}};Fd.exports=dr;dr.default=dr});var Pi=oe((yw,Nd)=>{"use strict";var vb=$a(),mr=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 vb(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};Nd.exports=mr;mr.default=mr});var ja=oe((vw,Dd)=>{"use strict";var Ld={};Dd.exports=function(t){Ld[t]||(Ld[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var Xa=oe((Aw,Gd)=>{"use strict";var Sb=Et(),Ab=_i(),Eb=za(),wb=Ii(),Id=Pi(),_b=un(),Cb=Zn(),{isClean:et,my:Rb}=Ei(),Sw=ja(),Tb={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},kb={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},Mb={Once:!0,postcssPlugin:!0,prepare:!0},dn=0;function fr(e){return typeof e=="object"&&typeof e.then=="function"}function Od(e){let t=!1,n=Tb[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,dn,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,dn,n+"Exit"]:[n,n+"Exit"]}function Pd(e){let t;return e.type==="document"?t=["Document",dn,"DocumentExit"]:e.type==="root"?t=["Root",dn,"RootExit"]:t=Od(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Ka(e){return e[et]=!1,e.nodes&&e.nodes.forEach(t=>Ka(t)),e}var Ya={},_t=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=Ka(n);else if(n instanceof e||n instanceof Id)i=Ka(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=wb;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[Rb]&&Sb.rebuild(i)}this.result=new Id(t,i,r),this.helpers={...Ya,postcss:Ya,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(!kb[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Mb[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(fr(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];){t[et]=!0;let n=[Pd(t)];for(;n.length>0;){let r=this.visitTick(n);if(fr(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 fr(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=Cb;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 Eb(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(fr(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];)t[et]=!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(fr(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[et]){l[et]=!0,t.push(Pd(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===dn){r.nodes&&r.nodes.length&&(r[et]=!0,n.iterator=r.getIterator());return}else if(this.listeners[a]){n.visitors=this.listeners[a];return}}t.pop()}walkSync(t){t[et]=!0;let n=Od(t);for(let r of n)if(r===dn)t.nodes&&t.each(i=>{i[et]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}};_t.registerPostcss=e=>{Ya=e};Gd.exports=_t;_t.default=_t;_b.registerLazyResult(_t);Ab.registerLazyResult(_t)});var Bd=oe((ww,Hd)=>{"use strict";var Fb=za(),Nb=Ii(),Lb=Pi(),Db=Zn(),Ew=ja(),pr=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=Nb;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=Db;this.result=new Lb(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 Fb(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[]}};Hd.exports=pr;pr.default=pr});var Wd=oe((_w,Ud)=>{"use strict";var Ib=_i(),Pb=Xa(),Ob=Bd(),Gb=un(),Ht=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 Ob(this,t,n):new Pb(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};Ud.exports=Ht;Ht.default=Ht;Gb.registerProcessor(Ht);Ib.registerProcessor(Ht)});var Xd=oe((Cw,Yd)=>{"use strict";var Vd=wi(),zd=ir(),Hb=Et(),Bb=Ai(),qd=ar(),$d=_i(),Ub=gd(),Wb=lr(),Vb=Xa(),zb=Wa(),qb=nr(),$b=Ii(),Ja=Wd(),jb=Pi(),jd=un(),Kd=ki(),Kb=Zn(),Yb=$a();function le(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Ja(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 Ja().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=Kb;le.parse=$b;le.fromJSON=Ub;le.list=zb;le.comment=e=>new zd(e);le.atRule=e=>new Vd(e);le.decl=e=>new qd(e);le.rule=e=>new Kd(e);le.root=e=>new jd(e);le.document=e=>new $d(e);le.CssSyntaxError=Bb;le.Declaration=qd;le.Container=Hb;le.Processor=Ja;le.Document=$d;le.Comment=zd;le.Warning=Yb;le.AtRule=Vd;le.Result=jb;le.Input=Wb;le.Rule=Kd;le.Root=jd;le.Node=qb;Vb.registerPostcss(le);Yd.exports=le;le.default=le});function Kr(){return globalThis}function L(e,t){if(typeof window>"u")return;let n=Kr(),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 ch=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data"];function dh(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 mh(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=dh(r,n);return{numerator:r/i,denominator:n/i}}function To(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 Yr(e){return{protocolVersion:1,capabilities:ch,fps:mh(e)}}function fh(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function kl(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=To(n.fps);return r===null||!fh(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Ml=30;function Fl(e){Ml=Number.isFinite(e)&&e>0?e:30}function ve(e){try{window.parent.postMessage({...e,...Yr(Ml)},"*")}catch(t){L("bridge.postMessage",t)}}var ph=new Map(Object.entries({play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(hh(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=>bh(e),"set-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onSetRuntimeData?.(e.channel,e.payload,e.requestId)},"clear-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onClearRuntimeData?.(e.channel,e.requestId)}}));function hh(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=To(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function gh(e){let t=kl(e);return t.status!=="unsupported"?!1:(ve({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 bh(e){let t=e.selectors,n=e.duration||800;t&&xh(t,n)}function Nl(e){let t=n=>{if(n.source!==window.parent&&n.source!==window)return;let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||gh(r))return;let i=r.action;if(typeof i!="string")return;let o=ph.get(i);o&&o(r,e)};return window.addEventListener("message",t),ve({source:"hf-preview",type:"ready"}),t}function xh(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var ko=null;function Ll(e){ko=e}function Be(e,t){if(ko)try{ko({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function yh(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 Kt(e){return`--${yh(e)}`}function Dl(e){let t=new Map;for(let n of e){let r=Kt(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 Pl(){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,kn(i));let n=Jr(),r={...t,...n};for(let i of e)Fo(i,r);return r}var Il=new Set;function Ol(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 vh(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function Sh(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 Ah(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=Sh(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function Fo(e,t,n){if(!e)return;let r=Ol(e);if(r.length===0)return;let i=vh(e,n);for(let o of r){let a=Ah(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(Il.has(l))continue;Il.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 kn(e){let t={};for(let n of Ol(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Mo="data-hf-css-vars";function Xr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function No(e,t){if(!Xr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Kt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Mo,n.join(" "))}function Gl(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Kt(i);((Xr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Hl(e){if(!Xr(e))return;let t=e.getAttribute(Mo);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Mo)}}function Bl(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=Jr(),r=[];for(let i of t)r.push(...Eh(i,n,e.defaultView));for(let i of Dl(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Kt(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function Eh(e,t,n){if(!Xr(e))return[];let r=kn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Kt(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 No(e,i),Object.keys(r)}function Ul(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 Jr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}var Wl="http://www.w3.org/1999/xhtml";function Ne(e){return e!=null&&e.nodeType===1}function Se(e){return Ne(e)&&e.namespaceURI===Wl}function Mn(e,t){return Se(e)&&e.localName===t}function fe(e){return Mn(e,"video")}function Lo(e){return Mn(e,"audio")}function ge(e){return fe(e)||Lo(e)}function Oe(e){return Mn(e,"img")}function Vl(e){return Mn(e,"style")}function zl(e){return Mn(e,"link")}function Do(e){return Ne(e)&&(e.namespaceURI===Wl||e.namespaceURI==="http://www.w3.org/2000/svg")}function ql(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,d)=>{let f=null;try{f=u.effect?.getComputedTiming?.()??null}catch(h){L("runtime.adapters.css.site5",h)}if(!f)return{};let m=Number(f.endTime);return Number.isFinite(m)?{endSeconds:d+m/1e3}:{unbounded:!0}},o=(u,d)=>{for(let f of u){try{f.currentTime=d}catch(m){L("runtime.adapters.css.site1",m)}try{f.pause()}catch(m){L("runtime.adapters.css.site2",m)}}},a=u=>{for(let d of u)try{d.play()}catch(f){L("runtime.adapters.css.site3",f)}},l=u=>{for(let d of u)try{d.pause()}catch(f){L("runtime.adapters.css.site4",f)}},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 d of u){if(!Se(d))continue;let f=window.getComputedStyle(d);!f.animationName||f.animationName==="none"||t.push({el:d,baseDelay:d.style.animationDelay||"",basePlayState:d.style.animationPlayState||"",animations:n(d)})}},getInferredDurationSeconds:()=>{let u=0;for(let d of t){if(!d.el.isConnected)continue;let f=r(d.el);for(let m of n(d.el)){let h=i(m,f);h.endSeconds!=null&&(u=Math.max(u,h.endSeconds))}}return u>0?u:null},seek:u=>{let d=Number(u.time)||0;for(let f of t){if(!f.el.isConnected)continue;let m=r(f.el),h=Math.max(0,d-m)*1e3,b=f.animations;if(b.length>0){o(b,h);continue}f.el.style.animationPlayState="paused",f.el.style.animationDelay=`-${(h/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let d=u.animations;d.length>0&&l(d),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function $l(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 jl(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function Yl(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(Io(r))r.goToAndStop(t*1e3,!1);else if(Po(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??0;if(Number.isFinite(i)&&i>0){let o=Math.min(100,t/i*100);r.seek(o)}}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(Io(t)||Po(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=wh(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function Kl(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function wh(e){return Io(e)?Kl(e.totalFrames,e.frameRate):Po(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:Kl(e.totalFrames,e.frameRate):null}function Io(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Po(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Oo=-1,Qr=new Set,Yt,Go=0;function Xl(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));Qr.add(i),i.then(o=>{Qr.delete(i)&&o.status==="rejected"&&Yt===void 0&&(Yt={reason:o.reason})})}function Zr(e){e!==Oo&&(Oo=e,Xl(e))}function ei(e){Oo=e,Xl(e)}function Jl(){return Go>0}async function Ho(){Go+=1;let e=Yt;try{for(await Promise.resolve();Qr.size>0;){let r=(await Promise.all([...Qr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Yt;if(e===void 0&&(e=t),Yt===t&&(Yt=void 0),e)throw e.reason}finally{Go-=1}}function Ql(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let d=window.THREE?.DefaultLoadingManager;return!d||typeof d!="object"||typeof d.itemsLoaded!="number"||typeof d.itemsTotal!="number"?null:d},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(d=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,d()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(d,f,m){try{r?.call(this,d,f,m)}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,Zr(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 Je(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 Zl(){return Je({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 eu(){return Je({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 tu(){return Je({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 nu(){return Je({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 ru(){return Je({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var _h=250;function iu(){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&&(Jl()||(window.__hfTypegpuTime=e,ei(e)))},_h))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,Zr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var Fn="data-hf-render-id",ou="data-hf-group-render-id";function Ch(e){return e.getAttribute(Fn)||e.id||null}var Rh="__render_frame_",Th="__";function kh(e){return`${Rh}${e}${Th}`}function Mh(e){let t=Ch(e);return t?kh(t):null}function bt(e){let t=Mh(e);if(!t)return null;let n=document.getElementById(t);return Oe(n)?n:null}function au(e){let t=e.nextElementSibling;if(Oe(t)&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=bt(e);return n&&n.complete&&n.naturalWidth>0?n:null}function su(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(fe(n?.source)){let o=au(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function lu(){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(fe(u)){let d=au(u);d&&(l[s]=d)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function uu(){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},d=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,f=(x,_)=>{let T=l.get(x);if(T)return T;let C={compositionTimeMs:_,animationTimeMs:e?d(u(x),_):u(x)};return l.set(x,C),C},m=(x,_)=>{if(!a.has(x)){a.add(x);let T=()=>{a.delete(x)};try{x.addEventListener("finish",T,{once:!0}),x.addEventListener("cancel",T,{once:!0})}catch(C){L("runtime.adapters.waapi.site4",C)}}f(x,_)},h=(x,_)=>{for(let T of x)m(T,_)},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 T=function(...C){let F=_.apply(this,C);return m(F,t),F};x.animate=T,r=x,i=_,o=T,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(F){L("runtime.adapters.waapi.site4",F)}if(!_)return{};let T=Number(_.endTime);return Number.isFinite(T)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+T/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),h(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&h(s(),e?_:0);for(let T of a){let C=e?f(T,_):f(T,0),F=C.animationTimeMs+Math.max(0,_-C.compositionTimeMs);try{T.currentTime=F}catch(D){L("runtime.adapters.waapi.site1",D)}try{T.pause()}catch(D){L("runtime.adapters.waapi.site2",D)}}},pause:()=>{e||h(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let T=v(_);T.endSeconds!=null&&(x=Math.max(x,T.endSeconds))}return x>0?x:null}}}var Bo=3.981071705534972;function Ue(e){return Number.isFinite(e)?Math.max(0,Math.min(Bo,e)):1}function ti(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function cu(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,ti(o))}});try{return t()}finally{delete e.volume,i.call(e,ti(o))}}var Xt=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),zS=Object.freeze([Xt.start,Xt.duration,Xt.trackIndex]),qS=Object.freeze([Xt.derivedEnd]),$S=Object.freeze([Xt.derivedEnd,Xt.legacyTrack]);function ni(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var mu=/^[A-Za-z0-9_.:-]+$/;function fu(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function du(e,t){let n=t;for(;n>=0&&fu(e,n);)n--;return n}function Fh(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function Nh(e){let t=e.length-1;if(!fu(e,t))return null;let n=du(e,t);return e[n]==="."&&(n=du(e,n-1)),n+1}function Lh(e){let t=Nh(e);if(t==null)return null;let n=Fh(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!mu.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function Uo(e){let t=(e??"").trim();if(!t)return null;let n=ni(t);if(n!=null)return{kind:"absolute",value:n};if(mu.test(t))return{kind:"reference",refId:t,offset:0};let r=Lh(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function pu(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function Ce(e){return ni(e)}function Le(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:ge(e)?e.defaultPlaybackRate:1;return pu(n)}function Nn(e){let t=n=>{let r=Ce(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 xt(e,t){return Dh(t,Nn(e),Le(e))}function ri(e){let t=Ce(e.getAttribute("data-duration"));return t!=null&&t>0?t:Number.isFinite(e.duration)?xt(e,e.duration):null}function Dh(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/pu(n):null}function Ln(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function Jt(e){let t=Ln(e.start);if(t==null)return null;let n=Math.max(0,t),r=Ln(e.duration),i=Ln(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=Ln(e.end),l=Ln(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var ii="data-hf-media-start-basis";function Ih(e){return e?.trim().toLowerCase()==="global"?"global":"local"}function hu(e){return Ih(e.basis)==="global"?e.authoredStart:e.hostStart+e.authoredStart}function st(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=m=>{let h=r.getElementById(m);return h||(r.querySelector(`[data-composition-id="${CSS.escape(m)}"]`)??null)},s=m=>{let h=o.get(m);if(h!==void 0)return h;let b=null,v=Jt({start:0,duration:m.getAttribute("data-duration"),authoredDuration:n?m.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=d(m,0),_=Jt({start:x,end:m.getAttribute("data-end"),authoredEnd:n?m.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&ge(m)){let x=Nn(m);Number.isFinite(m.duration)&&m.duration>x&&(b=(m.duration-x)/Le(m))}if(b==null||b<=0){let x=m.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let T=Number(_.duration());Number.isFinite(T)&&T>0&&(b=T)}catch(T){L("runtime.startResolver.site1",T)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(m,b),b):(o.set(m,null),null)},u=(m,h)=>{if(m.hasAttribute("data-composition-id")){let v=m.parentElement?.closest("[data-composition-id]");return v?d(v,h):0}let b=m.closest("[data-composition-id]");return b?d(b,h):0},d=(m,h)=>{let b=i.get(m);if(b!==void 0)return b??h;if(a.has(m))return h;a.add(m);try{let v=Uo(m.getAttribute("data-start"));if(!v){if(m.hasAttribute("data-composition-id")){let F=m.parentElement;if(F&&(F.hasAttribute("data-composition-src")||F.hasAttribute("data-composition-id")||F.hasAttribute("data-composition-file"))){let D=d(F,h);return i.set(m,D),D}}return i.set(m,h),h}if(v.kind==="absolute"){let F=Math.max(0,v.value),D=Math.max(0,u(m,h)+F);return i.set(m,D),D}let x=l(v.refId);if(!x)return i.set(m,h),h;let _=d(x,0),T=s(x);if(T==null||T<=0){let F=Math.max(0,_+v.offset);return i.set(m,F),F}let C=Math.max(0,_+T+v.offset);return i.set(m,C),C}finally{a.delete(m)}};return{resolveStartForElement:(m,h=0)=>d(m,Math.max(0,h)),resolveDurationForElement:m=>s(m),resolveMediaStartForElement:m=>{let h=m.closest("[data-composition-id]"),b=h?d(h,0):0,v=Ce(m.getAttribute("data-start"));return m.hasAttribute("data-hf-auto-start")||v==null||b<=0?d(m,b):hu({authoredStart:v,hostStart:b,basis:m.getAttribute(ii)})}}}function Ph(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:Ue(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:Ue(n)}),i}function gu(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 Oh(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 Gh(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Hh(e,t){let n=st({timelineRegistry:window.__timelines,includeAuthoredTimingAttrs:!0}).resolveMediaStartForElement(e),r=Ce(e.dataset.end)??void 0,i=Ce(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=Gh(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Ue(a)}}function Bh(e,t,n,r,{start:i,end:o,staticVolume:a}){let l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),d=cu(e,()=>{e.volume=a;let m=[],h;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(Ue(v).toFixed(6))};Oh(m,h,x,b===u),h=x}if(b===u)break}return m});return d.some(m=>Math.abs(m.volume-a)>1e-4)?d:null}function bu(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!ge(e)||n<=0)return;let o=u=>{try{typeof t.totalTime=="function"?t.totalTime(u,!0):typeof t.seek=="function"&&t.seek(u,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Hh(e,n),s=Bh(e,o,n,60,l);if(Number.isFinite(a)&&o(a),s){let u=Ph(s,l.start,l.staticVolume);u.length>0&&r.set(e,u)}}var It="data-fx-chain",pA=It.slice(5),xu=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}),Wo=(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}),oi=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),yu={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."},Su=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[oi(-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),oi(-40,40,0),Wo(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),oi(-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),oi(-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),Wo(.707),yu],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),Wo(.707),yu],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],Vo=new Map(Su.map(e=>[e.id,e]));function In(e){return Vo.get(e)}var hA=Su.map(e=>e.id);function Pn(e,t){let n=Vo.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 yt=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Au(e){let t;try{t=JSON.parse(e)}catch(i){throw new yt(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new yt("Chain file must be a JSON object.");let n=t;if(n.version!==xu)throw new yt(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new yt("Chain file is missing a `nodes` array.");let r=n.nodes.map(Uh);return{version:xu,nodes:r}}function On(e){return e.nodes.filter(t=>t.enabled!==!1)}function Uh(e,t){if(typeof e!="object"||e===null)throw new yt(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!Vo.has(n.type))throw new yt(`Node ${t} has unknown effect type: ${String(n.type)}`);return Vh({type:n.type,id:ai(n.id),fromCarve:vu(n.fromCarve),fromPreset:ai(n.fromPreset),label:ai(n.label),fromEq:ai(n.fromEq),fromLeveller:vu(n.fromLeveller),presetAmount:Wh(n.presetAmount),enabled:n.enabled!==!1,params:Pn(n.type,n.params??void 0)})}function ai(e){return typeof e=="string"&&e?e:void 0}function vu(e){return e===!0?!0:void 0}function Wh(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function Vh(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var ut="data-automation",yA=ut.slice(5),si=1,zh=512,lt=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Qt="volume";function Hn(e){if(e===Qt)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===qh){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 qh="preset";var $h={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},li={min:0,max:Bo,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function zo(e,t){let n=Hn(e);if(!n)return null;if(n.kind==="volume")return li;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...$h,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=In(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 Gn(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 jh(e){let t=Gn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function Eu(e,t){let n=Gn(e),r=Gn(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 Kh(e){let t=jh(e?.curve),n=Eu(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Yh(e,t){let n=Gn(e?.t),r=Gn(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,...Kh(e)}}function wu(e,t){let n=e.map(i=>Yh(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,zh)}function Xh(e){let t=[];for(let n of e.lanes){if(!Hn(n.target))continue;let r=n.target===Qt?li:null,i=wu(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:si,lanes:t}}function _u(e,t){let n=[];for(let r of e.lanes){let i=zo(r.target,t);if(!i)continue;let o=wu(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:si,lanes:n}}function ui(e){let t;try{t=JSON.parse(e)}catch(i){throw new lt(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new lt("Automation must be a JSON object.");let n=t;if(n.version!==si)throw new lt(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new lt("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new lt(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!Hn(a.target))throw new lt(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new lt(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return Xh({version:si,lanes:r})}function Jh(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Qh(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 Zh(e,t,n){let{cx:r,cy:i,w:o}=Qh(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=e0(l,s,e),d=1-u,f=d*d+2*o*u*d+u*u;return f>0?(2*o*i*u*d+u*u)/f:e}function e0(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 t0(e,t){let n=Eu(t.viaX,t.viaY);return n?Zh(Math.min(1,Math.max(0,e)),n.x,n.y):Jh(e,t.curve)}function n0(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 f=a+l>>1;r[f].t<=t?a=f:l=f}let s=r[a],u=r[l],d=u.t-s.t;return d<=0?u.v:n0(s.v,u.v,t0((t-s.t)/d,s),n)}function Cu(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Ru(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 ci=new Map,r0=64;function i0(e){let t=ci.get(e);if(t!==void 0)return t;let n=null;try{n=ui(e).lanes.find(r=>r.target===Qt)??null}catch{n=null}return ci.size>r0&&ci.clear(),ci.set(e,n),n}function Tu(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(ut):null)??"";if(!n)return null;let r=i0(n);return!r||r.points.length===0?null:Bn(r,t)}var Zt="hf-audio-group",di="data-audio-group";function qo(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function $o(e,t){let n=Array.from(e?.querySelectorAll?.(`${Zt}[${Fn}]`)??[]).find(i=>i.getAttribute(Fn)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Zt?r:null}function mi(e,t){let n=t?.getAttribute?.(ou)??t?.getAttribute?.(di);return n?$o(e,n)?.hasAttribute("data-hidden")??!1:!1}function ku(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(di)||null}function Mu(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Zt}{display:none!important}`,e.head.appendChild(n)}function Qe(e){return Nn(e)}function Fu(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 Nu(e){let t=e?.elements??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=Qe(a),u=Le(a),d=a.loop,f=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,m=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(m)||m<0)&&f!=null&&(m=Math.max(0,(f-s)/u));let h=Number.isFinite(m)&&m>=0,b=h?l+m:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:h?m:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:d,sourceDuration:f};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 Ko=new WeakMap,fi=new WeakMap,Un=new WeakMap,Yo=new WeakSet,en=new WeakSet;function o0(e){if(en.has(e))return;en.add(e);let t=()=>en.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var a0=3;function s0(e){return e.error!=null||e.networkState===a0}var Xo=new WeakMap;function jo(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Jo(e){Ko.delete(e),fi.delete(e),Un.delete(e),Yo.delete(e),Xo.delete(e)}function Lu(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=fi.get(r),s=r.tagName==="AUDIO"&&(l===void 0||i<l-.04),u=!n.loop&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration&&(o||s);if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||u)){if(fi.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let G=n.sourceDuration-n.mediaStart;G>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%G)}let m=jo(e.userVolume??1),h=Ue(n.volume??1),b=Xo.get(r),v=jo(r.volume),x,_=Tu(r,e.timeSeconds-n.start);if(_!==null)x=Ue(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let G=e.timeSeconds-n.start;x=Ue(gu(n.volumeKeyframes,G))}else e.isWebAudioRouted?.(r)?x=h:b===void 0?x=h>1?h:v:Math.abs(v-b)>1e-4?x=v:x=h;let C=r.closest("[data-hidden]")!==null||mi(r.ownerDocument,r)?0:jo(x*m);r.volume=C,Xo.set(r,C),e.onElementVolume?.(r,C,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(G){L("runtime.media.site1",G)}let F=.04,D=2,M=r.currentTime||0,S=Math.abs(M-i),A=i-M,w=Ko.get(r);Ko.set(r,A);let R=w===void 0,I=!R&&Math.abs(A-w)>.5,H=S>3,j=r.tagName==="AUDIO"&&R&&M-i>F,X=a&&S>.001||r.ended&&u&&S>.001||j||S>.5&&(R||I||H),k=r.tagName==="VIDEO"&&!r.paused,U=w!==void 0&&Math.abs(A-w)<.004,te=!1;if(!k&&!X&&!R&&U&&S>F){let G=(Un.get(r)??0)+1;Un.set(r,G),G>=D&&(te=!0,Un.set(r,0))}else S<=F&&Un.set(r,0);let B=!k&&e.forceSync&&S>.02;if(X||te||B){if(!(r.tagName==="VIDEO"&&!!bt(r))){try{r.currentTime=i}catch(W){L("runtime.media.site2",W)}if(Math.abs(r.currentTime-i)>.5&&!Yo.has(r)){Yo.add(r),r.load();try{r.currentTime=i}catch(W){L("runtime.media.site3",W)}}}en.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!en.has(r)&&!s0(r)?(o0(r),r.play().catch(G=>{en.delete(r),(G&&typeof G=="object"&&"name"in G?String(G.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let f=e.timeSeconds>=n.start&&e.timeSeconds<n.end;Jo(r),f&&fi.set(r,i),r.paused||r.pause()}}var l0="hf-proxy",Du="runtime_media_proxy_fallback",Iu="runtime_media_proxy_unavailable",Wn=new WeakSet,Pu=new WeakSet;function pi(e){return e.currentSrc||e.src}function Qo(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:fe(e)&&!!bt(e)}function Zo(e){let t=pi(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 u0(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 c0(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 ea(e,t){return t[e]??u0(e,t)??c0(e,t)}function d0(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(l0,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var m0={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 Pt(e,t,n){if(Pu.has(e))return;Pu.add(e);let r=m0[t];ve({source:"hf-preview",type:"diagnostic",code:Iu,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Iu}: "${n}" (${t}): ${r}`)}function ta(e,t=null,n="reactive"){if(Wn.has(e))return;let r=pi(e),i;try{i=d0(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Pt(e,"invalid_source_url",r);return}Wn.add(e),Jo(e),e.src=i,e.load();let o=t?.codecName??null;ve({source:"hf-preview",type:"diagnostic",code:Du,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] ${Du}: "${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 Ou(e){if(Qo(e)||!fe(e)||Wn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=Zo(e);if(n===null)return;let r=ea(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||ta(e,r,"proactive")}function Gu(e){if(Qo(e)||!fe(e)||e.videoWidth!==0)return;let t=pi(e);if(Wn.has(e)){Pt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=Zo(e);if(r===null){Pt(e,"cross_origin",t);return}let i=ea(r,n);if(i&&!i.browserHostile){Pt(e,"browser_safe_codec",t);return}ta(e,i,"reactive")}function Hu(e){if(Qo(e)||!fe(e))return;let t=pi(e);if(Wn.has(e)){Pt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=Zo(e);if(r===null){Pt(e,"cross_origin",t);return}let i=ea(r,n);if(i&&!i.browserHostile){Pt(e,"browser_safe_codec",t);return}ta(e,i,"tertiary")}var Te=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ye(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},f0=[0,0,0],p0=[1,1,1],hi=64;function h0(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 vt(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Te(`Invalid number "${e}"`,t);return n}function Bu(e,t,n){if(e.length!==3)throw new Te(`${t} expects three numbers`,n);return[vt(e[0],n),vt(e[1],n),vt(e[2],n)]}function Uu(e,t,n){if(!e)throw new Te(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new Te(`${t} must be an integer greater than 1`,n);return r}function g0(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new Te("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function b0(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 x0(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function Wu(e,t={}){let n=t.maxSize??hi,r=null,i=f0,o=p0,a=null,l=null,s=[],u=e.replace(/^\\uFEFF/,"").split(/\\r?\\n/);for(let f=0;f<u.length;f++){let m=f+1,h=h0(u[f]??"").trim();if(!h)continue;let b=h.split(/\\s+/),v=(b[0]??"").toUpperCase(),x=b.slice(1);if(v==="TITLE"){r=b0(h);continue}if(v==="DOMAIN_MIN"){i=Bu(x,v,m);continue}if(v==="DOMAIN_MAX"){o=Bu(x,v,m);continue}if(v==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new Te(`${v} expects two numbers`,m);let _=vt(x[0],m),T=vt(x[1],m);if(T<=_)throw new Te("LUT_3D_INPUT_RANGE max must exceed min",m);i=[_,_,_],o=[T,T,T];continue}if(v==="LUT_1D_SIZE"){a=Uu(x[0],v,m);continue}if(v==="LUT_3D_SIZE"){if(l=Uu(x[0],v,m),l>n)throw new Te(`LUT_3D_SIZE ${l} exceeds max ${n}`,m);continue}if(!x0(v)){if(v.startsWith("LUT_"))throw new Te(`Unsupported cube keyword ${v}`,m);continue}if(!l)throw a?new Te("1D cube LUTs are not supported yet",m):new Te("LUT data appears before LUT_3D_SIZE",m);if(b.length!==3)throw new Te("LUT data rows must contain three numbers",m);s.push(vt(b[0],m),vt(b[1],m),vt(b[2],m))}if(a&&l)throw new Te("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Te("1D cube LUTs are not supported yet"):new Te("Missing LUT_3D_SIZE");g0(i,o);let d=l*l*l;if(s.length!==d*3)throw new Te(`Expected ${d} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function y0(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Vn(e){return Math.round(y0(e)*255)}function na(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]=Vn(e.data[s]??0),i[u+1]=Vn(e.data[s+1]??0),i[u+2]=Vn(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var Vu="rec709";var he={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 zu=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],qu=["shadows","midtones","highlights"],$u=["master","red","green","blue"],ju=["hueVsHue","hueVsSaturation","hueVsLuma"];var Ku=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],Yu=["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 zA=he.unit,qA=he.signedUnit,$A=he.effects;var Ze=1024,zn=16;function Xu(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 ke(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function v0(e){let t=[],n=[],r=ke(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=ke(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=Xu(ke(t,0),ke(t,1),i,ke(n,1)),o[o.length-1]=Xu(ke(t,t.length-1),ke(t,t.length-2),ke(n,n.length-1),ke(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=ke(n,a-1),s=ke(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=ke(t,a-1),d=ke(t,a),f=2*d+u,m=d+2*u;o[a]=(f+m)/(f/l+m/s)}return o}function Ju(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 S0(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 A0(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 Qu(e,t,n,r,i){S0(e,r,i);let o=v0(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>ke(e,l+1)[0];)l+=1;let d=ke(e,l),f=ke(e,l+1),m=A0(u,d,f,ke(o,l),ke(o,l+1));a[s]=Math.min(i,Math.max(r,m))}return a}function tn(e,t=Ze){if(Ju(e,t),e.length>zn)throw new RangeError(`A color curve supports at most ${zn} 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 Qu(e,t,n=>n/(t-1),0,1)}function ia(e,t,n,r=Ze){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>zn)throw new RangeError(`A hue curve supports at most ${zn} 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 Ju(l,r),Qu(l,r,s=>s/r*360,t,n)}var qn="data-color-grading",$n="data-hf-color-grading-source-hidden",xi="data-hf-authored-opacity",rc="__hf_color_grading_",w0=Vu,sa={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},la={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},ua={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 yi=zu,ic=qu,oc=$u,ac=ju,da=Ku,ma=Yu,Zu={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},ec={vignette:.18};function Me(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...sa,...n},details:{...la,...r},effects:{...ua,...i}}}var fa=[Me("neutral","Neutral"),Me("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Me("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Me("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Me("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Me("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Me("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Me("vintage-wash","Vintage Wash",Zu,ec),Me("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Me("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Me("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Me("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Me("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Me("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),Me("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}),Me("home-movie-8mm","8mm Home Movie",Zu,{...ec,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Me("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Me("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],_0=new Map(fa.map(e=>[e.id,e])),C0=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,R0={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}},nn={hue:0,amount:0,level:0},tc={amount:he.unit,level:he.signedUnit},St=[[0,0],[1,1]],rn=[],T0={hueVsHue:he.secondaryHueShift,hueVsSaturation:he.signedUnit,hueVsLuma:he.signedUnit},oa={center:0,range:180,softness:0},aa={min:0,max:1,softness:.05},k0={vignette:he.unit,vignetteMidpoint:he.unit,vignetteRoundness:he.signedUnit,vignetteFeather:he.unit,grain:he.unit,grainSize:he.unit,grainRoughness:he.unit},ca=he.unit,M0=he.effects,sc=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var F0=fa.filter(e=>sc.some(t=>e.effects[t]>1e-4)),eE=fa.filter(e=>!F0.includes(e)),tE={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}},lc=[{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 N0=/^#[0-9a-f]{6}$/i;function L0(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&N0.test(t))?null:e.map(t=>t.toLowerCase())}function De(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bi(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function uc(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Ie(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?bi(n,t.min,t.max):0}function pa(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function D0(e){let t=De(e)?e:{};return ic.reduce((n,r)=>{let i=De(t[r])?t[r]:{};return n[r]={hue:pa(i.hue,nn.hue),amount:Ie(i.amount??nn.amount,tc.amount),level:Ie(i.level??nn.level,tc.level)},n},{shadows:{...nn},midtones:{...nn},highlights:{...nn}})}function I0(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)?[bi(t,0,1),bi(n,0,1)]:null}function cc(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function P0(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function O0(e){if(!Array.isArray(e)||e.length<2)return St;let t=[];for(let n of e){let r=I0(n);if(!r)return St;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),cc(t)||(P0(t),t.length>16)?St:t}function G0(e){let t=De(e)?e:{};return oc.reduce((n,r)=>(n[r]=O0(t[r]),n),{master:St,red:St,green:St,blue:St})}function H0(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)?[pa(n),bi(r,t.min,t.max)]:null}function B0(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return rn;let n=[];for(let r of e){let i=H0(r,t);if(!i)return rn;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),cc(n)?rn:n}function U0(e){let t=De(e)?e:{};return ac.reduce((n,r)=>(n[r]=B0(t[r],T0[r]),n),{hueVsHue:rn,hueVsSaturation:rn,hueVsLuma:rn})}function nc(e){let t=De(e)?e:{},n=Ie(t.min??aa.min,ca),r=Ie(t.max??aa.max,ca);return{min:Math.min(n,r),max:Math.max(n,r),softness:Ie(t.softness??aa.softness,he.secondarySoftRangeSoftness)}}function W0(e){let t=De(e)?e:{},n=Ie(t.range??oa.range,he.secondaryHueRange);return{center:pa(t.center,oa.center),range:n,softness:Ie(t.softness??oa.softness,{min:he.secondaryHueSoftness.min,max:he.secondaryHueCombinedMax-n})}}function V0(e){return{hueShift:Ie(e.hueShift??0,he.secondaryHueShift),saturation:Ie(e.saturation??0,he.signedUnit),luma:Ie(e.luma??0,he.signedUnit),temperature:Ie(e.temperature??0,he.signedUnit),tint:Ie(e.tint??0,he.signedUnit)}}function z0(e){return!De(e)||!De(e.key)||!De(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:W0(e.key.hue),saturation:nc(e.key.saturation),luma:nc(e.key.luma)},correction:V0(e.correction)}}function q0(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=z0(n);r&&t.push(r)}return t}function $0(e){if(e==null)return null;let t=String(e).trim();return t||null}function j0(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!De(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:uc(e.intensity,1)}}function K0(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return De(n)?n:null}catch{return null}return{preset:t}}return De(e)?e:null}function Y0(e,t){let n=e.trim().match(C0);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function gi(e,t){if(typeof e=="string"){let r=Y0(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return gi(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>gi(r,t));if(!De(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=gi(i,t);return n}function X0(e){return e?_0.get(e)??null:null}function vi(e){let t=K0(e);if(!t||t.enabled===!1)return null;let n=$0(t.preset),r=X0(n),i=r?.adjust??sa,o=r?.details??la,a=r?.effects??ua,l=De(t.adjust)?t.adjust:{},s=De(t.details)?t.details:{},u=De(t.effects)?t.effects:{},d=yi.reduce((h,b)=>(h[b]=Ie(l[b]??i[b],R0[b]),h),{...sa}),f=da.reduce((h,b)=>(h[b]=Ie(s[b]??o[b],k0[b]),h),{...la}),m=ma.reduce((h,b)=>(h[b]=Ie(u[b]??a[b],M0[b]??ca),h),{...ua});return{enabled:!0,preset:n,intensity:uc(t.intensity,r?.intensity??1),adjust:d,wheels:D0(t.wheels),curves:G0(t.curves),hueCurves:U0(t.hueCurves),secondaries:q0(t.secondaries),details:f,effects:m,palette:L0(t.palette),lut:j0(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():w0}}function dc(e,t){return vi(gi(e,t))}function J0(e){return ic.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function ha(e){return oc.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function ga(e){return ac.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function ba(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function mc(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||sc.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:yi.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?J0(e.wheels):!1)||(e.curves?ha(e.curves):!1)||(e.hueCurves?ga(e.hueCurves):!1)||(e.secondaries?ba(e.secondaries):!1):!1}var Q0=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Z0=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function fc(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(w){L("runtime.picker.site1",w)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let w=S;for(;w&&w!==document.body&&w!==document.documentElement;){let R=A.getComputedStyle(w);if(R.display==="none"||R.visibility==="hidden"||R.pointerEvents==="none")return!0;let I=Number.parseFloat(R.opacity);if(Number.isFinite(I)&&I<=.01&&!w.hasAttribute($n))return!0;w=w.parentElement}return!1}function d(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(Q0)||u(S))}function f(S){return!!S?.closest(Z0)}function m(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let w=S.getAttribute("data-composition-id");if(w)return`[data-composition-id="${CSS.escape(w)}"]`;let R=S.getAttribute("data-composition-src");if(R)return`[data-composition-src="${CSS.escape(R)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let H=S.tagName.toLowerCase(),j=S.parentElement;if(!j)return H;let X=j.querySelectorAll(`:scope > ${H}`);if(X.length===1)return H;for(let k=0;k<X.length;k+=1)if(X[k]===S)return`${H}:nth-of-type(${k+1})`;return H}function h(S){let A=S.tagName.toLowerCase(),w=(S.textContent??"").trim().replace(/\\s+/g," "),R=(I,H)=>I.length>H?`${I.slice(0,H-1)}\\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?w.length>0?R(w,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,w){let R=typeof w=="number"&&w>0?w:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let X=document.elementFromPoint(S,A);I=X?[X]:[]}if(f(I[0]??null))return[];let H={},j=[];for(let[X,k]of I.entries()){if(!d(k))continue;let U=`${k.tagName}::${k.id||""}::${X}`;if(!H[U]&&(H[U]=!0,j.push(k),j.length>=R))break}return j}function v(S){let A=S.getBoundingClientRect(),w={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(w[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:m(S),label:h(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:w}}function x(S,A,w){return b(S,A,w).map(v)}function _(S){if(!t)return;let w=b(S.clientX,S.clientY,1)[0]??(Ne(S.target)?S.target:null);if(!d(w)||n===w)return;n&&n.classList.remove("__hf-pick-highlight"),n=w,w.classList.add("__hf-pick-highlight");let R=v(w);l(R),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:R})}function T(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function C(S){S.key==="Escape"&&(D(),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",T,!0),document.addEventListener("keydown",C,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function D(){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",T,!0),document.removeEventListener("keydown",C,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function M(){window.__HF_PICKER_API={enable:F,disable:D,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,w)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,w):[],pickAtPoint:(S,A,w)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let R=x(S,A,8);if(!R.length)return null;let I=Math.max(0,Math.min(R.length-1,Number(w??0))),H=R[I]??null;return H?(s(H),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:H}),D(),H):null},pickManyAtPoint:(S,A,w)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let R=x(S,A,8);if(!R.length)return[];let I=[],H=Array.isArray(w)?w:[0];for(let j of H){let X=Math.max(0,Math.min(R.length-1,Math.floor(Number(j)))),k=R[X];if(!k)continue;I.some(te=>te.selector===k.selector&&te.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),D(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:F,disablePickMode:D,installPickerApi:M}}var eg=["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 on(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 xa(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0,i=r*n,o=Math.round(i);return Math.abs(i-o)<=.001?o/n:r}function pc(e,t,n=eg){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function jn(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function $e(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Kn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function hc(e,t,n,r){let i=on(t,n),o=r?.suppressEvents===!0;return $e(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function tg(e,t,n,r,i){let o=[];Kn(e,t,a=>{$e(a,"play"),o.push(a)});try{return hc(t,n,r,i)}finally{for(let a of o)try{$e(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function ng(e,t){Kn(e,t,n=>{$e(n,"play")})}function gc(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?.()??jn(n,"duration",0))||0);r>0&&Math.max(0,jn(n,"time",0))>=r&&($e(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()),$e(n,"play"),Kn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),$e(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;$e(n,"pause"),Kn(e.getTimelineRegistry?.(),n,i=>{$e(i,"pause")});let r=Math.max(0,jn(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=tg(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),$e(i,"play"),Kn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),$e(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?(ng(e.getTimelineRegistry?.(),i),hc(i,n,o,r)):on(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:()=>jn(e.getTimeline(),"time",0),getDuration:()=>jn(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function bc(){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 rg=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function ya(e){return e.id||e.getAttribute("data-hf-id")||null}function ig(e){return Ce(e)}function og(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 ag(e){return!ge(e)||!Number.isFinite(e.duration)?null:xt(e,e.duration)}function sg(e,t,n,r){let i=ig(e.getAttribute("data-duration"));return i!=null&&i>0?i:og(e,t)??ag(e)??Math.max(0,n-r)}function lg(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 xc(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||rg.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(sg(l,n,r,s)<=0)continue;let u={id:ya(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return lg(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}var va="css:root",yc=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],ug=new Set([...yc,"contain","isolation","mask-border","mix-blend-mode","opacity"]),cg=new Set(["absolute","relative"]),dg=new Set(["flex","inline-flex","grid","inline-grid"]),mg=new Set(["layout","paint","strict","content"]),fg=new Set(["size","inline-size"]);function pg(e){return e.position==="fixed"||e.position==="sticky"}function hg(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(cg.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&dg.has(n)}function gg(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:yc.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function bg(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>mg.has(n))?!0:fg.has(e.getPropertyValue("container-type"))}function xg(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>ug.has(t))}function yg(e,t){return pg(t)||hg(e,t)||gg(t)||bg(t)?!0:xg(t)}function vg(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 Si(e){let t=e.ownerDocument.defaultView;if(!t)return va;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(yg(n,t.getComputedStyle(n)))return vg(n)}catch{return va}n=n.parentElement}return va}function Sa(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function Ot(e){return Ce(e)}function Aa(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=Jt({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(Ot).some(o=>o!=null&&o<=0)?0:null)}function vc(e){return Jt({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function Ea(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 wa(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function _a(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 Xn(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 Sc(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Xn(t);let n=e.getAttribute("data-composition-src");if(n)return Xn(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Xn(r.getAttribute("src")):null}function Ag(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 Eg(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 wg(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Yn(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function _g(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 Yn(i);let o=e.id;if(o)return Yn(o);let a=Ag(e);if(a)return Yn(a);let l=Eg(Sc(e));if(l)return Yn(l);let s=wg(e);return s||`${Yn(t)} ${n+1}`}function Ac(e){let n=window.__timelines??{},r=st({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=q=>{if(!q)return null;let O=n[q]??null;if(!O||typeof O.duration!="function")return null;try{let V=Number(O.duration());return Number.isFinite(V)&&V>0?V:null}catch{return null}},o=()=>{let q=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(q.length===0)return null;let O=0;for(let V of q){let Z=r.resolveMediaStartForElement(V);if(!Number.isFinite(Z))continue;let pe=ri(V);pe==null||pe<=0||(O=Math.max(O,Math.max(0,Z)+pe))}return O>0?O:null},a=(q,O)=>{let V=[],Z=null,pe=null,re=null,z=q.parentElement;for(;z;){let J=z.getAttribute("data-composition-id");J&&(V.push(J),!re&&z!==O&&(re=J),Z==null&&(Z=r.resolveStartForElement(z,0)),pe==null&&(pe=Ot(z.getAttribute("data-duration"))??i(J)??null)),z=z.parentElement}return{parentCompositionId:re,compositionAncestors:V.reverse(),inheritedStart:Z,inheritedDuration:pe}},l=document.querySelector("[data-composition-id]"),s=Array.from(document.querySelectorAll("[data-composition-id]")),u=l?.getAttribute("data-composition-id")??null,d=l?r.resolveStartForElement(l,0):0,f=o(),m=f!=null?Math.max(0,f-Math.max(0,d)):null,h=i(u),b=Aa(l??document.body),v=wa(...s.filter(q=>q!==l).map(q=>{let O=r.resolveStartForElement(q,0),V=r.resolveDurationForElement(q)??i(q.getAttribute("data-composition-id"))??null;return!Number.isFinite(O)||V==null||V<=0?null:Math.max(0,O)+V})),x=v!=null?Math.max(0,v-Math.max(0,d)):null,_=typeof h=="number"&&Number.isFinite(h)&&h>0?h:null,T=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,C=typeof m=="number"&&Number.isFinite(m)&&m>0?m:null,F=typeof x=="number"&&Number.isFinite(x)&&x>0?x:null,D=wa(C,F),M=_!=null&&D!=null&&_>D+1,A=T??(M?D:wa(_,C,F))??null,R=(A!=null?d+A:null)??(typeof f=="number"&&Number.isFinite(f)&&f>0?f:null),I=(q,O)=>!Number.isFinite(O)||O<=0?0:R==null||!Number.isFinite(R)?O:!Number.isFinite(q)||q>=R?0:Math.max(0,Math.min(O,R-q)),H=[],j=[],X=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),k=0;for(let[q,O]of X.entries()){if(O===l||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(O.tagName))continue;let V=a(O,l),Z=O.tagName.toLowerCase(),pe=Z==="video"||Z==="audio"?r.resolveMediaStartForElement(O):r.resolveStartForElement(O,V.inheritedStart??0),re=O.getAttribute("data-composition-id"),z=Aa(O);if(z==null&&re&&re!==u&&(z=i(re)),z==null&&ge(O)&&Number.isFinite(O.duration)&&(z=xt(O,O.duration)),z==null){let ce=V.inheritedDuration;if(ce!=null&&ce>0){let it=(V.inheritedStart??0)+ce;z=Math.max(0,it-pe)}}if(z==null||z<=0||(z=I(pe,z),z<=0))continue;let J=pe+z;k=Math.max(k,J);let Ae=re&&re!==u?"composition":Z==="video"?"video":Z==="audio"?"audio":Z==="img"?"image":"element";H.push({id:ya(O)??re??null,label:_g(O,Ae,H.length),start:pe,duration:z,track:_a(O,q),zIndex:Ea(O),stackingContextId:Si(O),kind:Ae,tagName:Z,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:V.compositionAncestors,parentCompositionId:V.parentCompositionId,nodePath:null,compositionSrc:Xn(O.getAttribute("data-composition-src")),playbackStart:Qe(O),playbackRate:Le(O),assetUrl:Sc(O),timelineRole:O.getAttribute("data-timeline-role"),timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:Ot(O.getAttribute("data-timeline-priority"))})}let U=new Set(H.map(q=>q.id)),te=l?.getAttribute("data-composition-id")??null,B=te?n[te]??null:null;if(B&&l){let q=B;if(typeof q.getChildren=="function")try{let O=q.getChildren(!0,!0,!1)??[],V=new Map;for(let re of l.children){let z=re;if(!z.id)continue;let J=z.tagName.toLowerCase();J==="script"||J==="style"||J==="link"||V.set(z,{id:z.id,start:1/0,end:-1/0})}let Z=re=>{let z=re;for(;z;){if(V.has(z))return z;if(z===l)return null;z=z.parentElement}return null};for(let re of O){if(typeof re.targets!="function"||typeof re.startTime!="function"||typeof re.duration!="function")continue;let z=re.startTime(),J=re.parent;for(;J&&J!==B&&typeof J.startTime=="function";)z+=J.startTime(),J=J.parent;let Ae=z+re.duration();if(!(!Number.isFinite(z)||!Number.isFinite(Ae)))for(let ce of re.targets()){if(!Ne(ce))continue;let Sn=Z(ce);if(!Sn)continue;let it=V.get(Sn);it&&(it.start=Math.min(it.start,z),it.end=Math.max(it.end,Ae))}}let pe=H.length>0?Math.max(...H.map(re=>re.track))+1:0;for(let[re,z]of V){if(z.start===1/0||z.end===-1/0)continue;let J=re;if(U.has(J.id))continue;let Ae=Math.max(0,z.end-z.start);if(Ae<=0)continue;let ce=I(z.start,Ae);ce<=0||(k=Math.max(k,z.start+ce),H.push({id:J.id,label:J.getAttribute("data-timeline-label")??J.getAttribute("data-label")??J.getAttribute("aria-label")??J.id,start:z.start,duration:ce,track:_a(J,pe),zIndex:Ea(J),stackingContextId:Si(J),kind:"element",tagName:J.tagName.toLowerCase(),compositionId:J.getAttribute("data-composition-id"),compositionAncestors:te?[te]:[],parentCompositionId:te,nodePath:null,compositionSrc:null,playbackStart:Qe(J),playbackRate:Le(J),assetUrl:null,timelineRole:J.getAttribute("data-timeline-role"),timelineLabel:J.getAttribute("data-timeline-label"),timelineGroup:J.getAttribute("data-timeline-group"),timelinePriority:Ot(J.getAttribute("data-timeline-priority"))}),U.add(J.id))}}catch(O){L("runtime.timeline.site1",O)}}if(l&&A!=null&&A>0){let q=H.length>0?Math.max(...H.map(O=>O.track))+1:0;for(let O of l.children){let V=O;if(!V.id||U.has(V.id))continue;let Z=V.getAttribute("data-timeline-role");if(Z!=="overlay"&&Z!=="persistent-overlay")continue;let pe=V.tagName.toLowerCase();if(pe==="script"||pe==="style"||pe==="link"||pe==="meta"||window.getComputedStyle(V).display==="none")continue;let z=I(0,A);z<=0||(k=Math.max(k,z),H.push({id:V.id,label:V.getAttribute("data-timeline-label")??V.getAttribute("data-label")??V.getAttribute("aria-label")??V.id,start:0,duration:z,track:_a(V,q),zIndex:Ea(V),stackingContextId:Si(V),kind:"element",tagName:pe,compositionId:V.getAttribute("data-composition-id"),compositionAncestors:te?[te]:[],parentCompositionId:te,nodePath:null,compositionSrc:null,playbackStart:Qe(V),playbackRate:Le(V),assetUrl:null,timelineRole:Z,timelineLabel:V.getAttribute("data-timeline-label"),timelineGroup:V.getAttribute("data-timeline-group"),timelinePriority:Ot(V.getAttribute("data-timeline-priority"))}),U.add(V.id))}}for(let q of s){if(q===l)continue;let O=q.getAttribute("data-composition-id");if(!O||!Sa(O))continue;let V=r.resolveStartForElement(q,0),Z=Aa(q);if((Z==null||Z<=0)&&vc(q)!=null){let J=vc(q);Z=Math.max(0,J-V)}let pe=i(O),re=Z&&Z>0?Z:pe;if(re==null||re<=0)continue;let z=I(V,re);z<=0||j.push({id:O,label:q.getAttribute("data-label")??O,start:V,duration:z,thumbnailUrl:Xn(q.getAttribute("data-thumbnail-url")),avatarName:null})}let G=Math.max(1,k||1,A??0),W=M&&T==null,Q=W?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(G*Math.max(1,e.canonicalFps)));return{...Yr(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:W?Number.POSITIVE_INFINITY:G,durationInFrames:Q,clips:H,scenes:j,compositionWidth:Ot(l?.getAttribute("data-width"))??1920,compositionHeight:Ot(l?.getAttribute("data-height"))??1080}}var Ca="data-composition-id",Cg="data-composition-src",Rg=`[${Ca}]`,GE=`[${Cg}]`,Ec="style",wc="script",Tg=\'link[rel="stylesheet"], link[rel="preconnect"]\';function an(e){return e?Array.from(e):[]}function _c(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=an(t.querySelectorAll(Rg)),l=o?a.find(d=>d.getAttribute(Ca)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(Ca)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...an(u?.querySelectorAll(Ec)),...an(t.querySelectorAll(Ec))],scriptSources:[...an(u?.querySelectorAll(wc)),...an(t.querySelectorAll(wc))],linkSources:an(n?.querySelectorAll(Tg)),variableDefaultCarriers:[r,l].filter(d=>d!=null)}}var be=uh(Xd(),1),Jd=be.default,Rw=be.default.stringify,Tw=be.default.fromJSON,kw=be.default.plugin,Mw=be.default.parse,Fw=be.default.list,Nw=be.default.document,Lw=be.default.comment,Dw=be.default.atRule,Iw=be.default.rule,Pw=be.default.decl,Ow=be.default.root,Gw=be.default.CssSyntaxError,Hw=be.default.Declaration,Bw=be.default.Container,Uw=be.default.Processor,Ww=be.default.Document,Vw=be.default.Comment,zw=be.default.Warning,qw=be.default.AtRule,$w=be.default.Result,jw=be.default.Input,Kw=be.default.Rule,Yw=be.default.Root,Xw=be.default.Node;var Qa="data-hf-authored-id",Qd="data-hf-inner-root";function Za(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function es(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function Xb(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function em(e){let t=e.trim();return t?Array.from(new Set([t,Xb(t)])).filter(Boolean):[]}function Jb(e){return!!e&&/[\\w-]/.test(e)}function Qb(e,t,n){let r=em(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 d=r.find(f=>e.startsWith(f,l+1));if(d){let f=e[l+1+d.length];if(!Jb(f)){i+=n,l+=d.length;continue}}}i+=s}return i}function Zb(e,t){let n=t?.trim();return n?Qb(e,n,`[${Qa}="${es(n)}"]`):e}function Zd(e){return`${e}:not(:has([${Qd}])), ${e} > [${Qd}]`}function ex(e,t,n,r,i,o){let a=Zb(e,r),l=tx(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?Zd(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*[\\\\^\\\\*\\\\$]?=\\\\s*(["\'])${Za(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?Zd(t):l.replace(u,t);let d=l.match(/^\\s*/)?.[0]??"",f=l.match(/\\s*$/)?.[0]??"";if(i){let m=r?`[${Qa}="${es(r)}"]`:null;if(m&&s.startsWith(m)){let h=s.slice(m.length);return`${d}${t}${m}${h}${f}`}}return`${d}${t} ${s}${f}`}function tx(e,t,n){let r=Za(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 nx=new Set(["keyframes","-webkit-keyframes","font-face"]);function rx(e){return e?.type==="atrule"}function ix(e){let t=e.parent;for(;t;){if(rx(t)&&nx.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function ox(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function tm(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${es(o)}"]`,l;try{l=Jd.parse(e)}catch{return""}return l.walkRules(s=>{ix(s)||ox(s)||(s.selectors=s.selectors.map(u=>ex(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function dt(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}function nm(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=dt(t),l=dt(i),s=dt(n),u=Za(t),d=dt(o?.trim()||null),f=dt(r??null),m=dt(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${u}"|\'${u}\')\\s*\\]`),h=dt(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`),b=dt(em(o?.trim()||""));return`(function(){\n var __hfCompId = ${a};\n var __hfTimelineCompId = ${l};\n var __hfErrorLabel = ${s};\n var __hfAuthoredRootId = ${d};\n var __hfAuthoredRootAttr = ${dt(Qa)};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = ${f} || (__hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "");\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${m};\n var __hfTimingSelectorPattern = ${h};\n var __hfAuthoredRootIdForms = ${b};\n var __hfAuthoredRootSelector = __hfAuthoredRootId\n ? "[" + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(__hfAuthoredRootId) + \'"]\'\n : "";\n var __hfIsSelectorNameChar = function(char) {\n return !!char && /[\\\\w-]/.test(char);\n };\n var __hfReplaceAuthoredRootIdSelectors = function(selector) {\n if (!__hfAuthoredRootSelector || !__hfAuthoredRootIdForms.length || typeof selector !== "string") {\n return selector;\n }\n var result = "";\n var bracketDepth = 0;\n var quote = null;\n for (var index = 0; index < selector.length; index += 1) {\n var char = selector[index];\n var previousChar = index > 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target !== "string") return target;\n return __hfQueryAll(target);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = !__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})();`}var ax=["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 rm(e){let t=e.getAttribute("id")?.trim();for(let n of ax)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var sx=8e3,lx=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,ux=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,cx=["src","href"];function dx(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function am(e,t){if(!t)return e;let n=e.trim();if(dx(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function sm(e,t){return!t||!e?e:e.replace(ux,(n,r,i)=>{let o=am(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function mx(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of cx){let i=n.getAttribute(r);if(i==null)continue;let o=am(i,t);o!==i&&n.setAttribute(r,o)}}function fx(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=sm(r,t);i!==r&&n.setAttribute("style",i)}}function px(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=sm(r,t);i!==r&&(n.textContent=i)}}function lm(e,t){if(t){mx(e,t),fx(e,t),px(e,t);for(let n of Array.from(e.querySelectorAll("template")))lm(n.content,t)}}function hx(e,t){return`${e}__hf${t}`}var gx=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"),sx)});function ts(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function im(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function bx(e){let t=document.importNode(e,!0);rm(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 xx(e,t){let n=e.trim();if(!n)return e;try{return lx.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 om(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 Oi(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 yx(e){let t=new Map;for(let n of e){let r=Oi(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function um(e){let t=Oi(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function vx(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function Sx(e){return e.hasAttribute("data-composition-src")?!0:um(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:vx(e):!1}function rs(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:um(t))}function cm(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(rs().map(n=>Oi(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function dm(e,t=yx(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=Oi(i),l=Sx(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let d=s?(n.get(o)||0)+1:0;s&&n.set(o,d),u=s?hx(o,d):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 ns(e){let t=_c({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=Se(t.innerRoot)?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 m of t.linkSources){let h=(m.getAttribute("href")||"").trim();if(!h)continue;let b=e.compositionUrl?new URL(h,e.compositionUrl).href:h;if(e.compositionUrl&&om(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let v=m.cloneNode(!0);zl(v)&&(v.href=b,document.head.appendChild(v),e.injectedLinks.push(v))}(m=>{for(let h of m){let b=h.cloneNode(!0);Vl(b)&&(i&&(b.textContent=tm(b.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(b),e.injectedStyles.push(b))}})(t.styleSources);let d=m=>{let h=m.getAttribute("type")?.trim()??"",b=m.getAttribute("src")?.trim()??"";if(b){let x=xx(b,e.compositionUrl);return e.compositionUrl&&om(x,e.compositionUrl)?null:{kind:"external",src:x,type:h}}let v=m.textContent?.trim()??"";return v?{kind:"inline",content:v,type:h,scopeCompositionId:o}:null},f=t.scriptSources.map(d).filter(m=>m!==null);if(n){let m=n.getAttribute("data-width"),h=n.getAttribute("data-height"),b=e.parseDimensionPx(m),v=e.parseDimensionPx(h);m&&e.host.setAttribute("data-width",m),h&&e.host.setAttribute("data-height",h),b&&Se(e.host)&&(e.host.style.width=b),v&&Se(e.host)&&(e.host.style.height=v),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=bx(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),im(x),e.host.appendChild(x)}else if(e.hasTemplate){let m=document.importNode(r,!0);im(m),e.host.appendChild(m)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&Ax(e,r,a);for(let m of f){let h=document.createElement("script");if(m.type&&(h.type=m.type),h.async=!1,m.kind==="external"?h.src=m.src:m.type.toLowerCase()==="module"?h.textContent=m.content:m.scopeCompositionId?h.textContent=nm(m.content,m.scopeCompositionId,"[HyperFrames] composition script error:",s,a||m.scopeCompositionId,l):h.textContent=`(function(){${m.content}})();`,document.body.appendChild(h),e.injectedScripts.push(h),m.kind==="external"){let b=await gx(h);b.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:m.src,loadStatus:b.status,elapsedMs:b.elapsedMs}})}}}async function mm(e){let t=rs();if(cm(),t.length===0)return;let n=dm(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`);ts(i),await ns({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 fm(e){let t=rs();if(cm(),t.length===0)return;let n=dm(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}ts(i);try{let d=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(d){await ns({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:d.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let f=await fetch(o);if(!f.ok)throw new Error(`HTTP ${f.status}`);let m=await f.text(),b=new DOMParser().parseFromString(m,"text/html");lm(b,u);let v=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=v?v.content:b.body;await ns({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!v,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:kn(b.documentElement),variableDeclarer:b.documentElement,onDiagnostic:e.onDiagnostic})}catch(d){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:d instanceof Error?d.message:"unknown_error"}}),ts(i)}}))}function Ax(e,t,n){let i={...e.declaredVariableDefaults??(Ne(t)?kn(t):{}),...Ul(e.host)};Fo(e.variableDeclarer??(Ne(t)?t:null),i,n),Hl(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,No(e.host,{...Gl(e.host,i,window),...Jr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function Ex(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wx(e){if(!Array.isArray(e))throw new Error("expected a JSON array");if(!e.every(Ex))throw new Error("every array entry must be an object");return e}function is(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function _x(e){return Se(e)?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function Cx(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!Se(r))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function Rx(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 os(){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===null)return;let n=wx(t);if(n.length===0)return;let r=Cx();for(let i of n){let o=null;if(i.wordId&&(o=_x(document.getElementById(i.wordId))),!o&&i.wordIndex!==void 0&&(o=r[i.wordIndex]??null),!o)continue;let a={},l={};if(i.x!==void 0&&(a.x=i.x),i.y!==void 0&&(a.y=i.y),i.scale!==void 0&&(a.scale=i.scale),i.rotation!==void 0&&(a.rotation=i.rotation),i.opacity!==void 0&&(l.opacity=i.opacity),i.fontSize!==void 0&&(l.fontSize=`${i.fontSize}px`),i.fontWeight!==void 0&&(l.fontWeight=i.fontWeight),i.fontFamily!==void 0&&(l.fontFamily=i.fontFamily),i.activeColor||i.dimColor){let u=e.getTweensOf(o).filter(m=>m.vars.color!==void 0).sort((m,h)=>m.startTime()-h.startTime()),d=u.find(m=>is(m)==="dim")??u.find(m=>is(m)===void 0),f=d?String(d.vars.color):"";for(let m of u)(is(m)??(String(m.vars.color)===f?"dim":"active"))==="dim"?i.dimColor&&(m.vars.color=i.dimColor):i.activeColor&&(m.vars.color=i.activeColor);i.dimColor&&e.set(o,{color:i.dimColor})}if(Object.keys(l).length>0&&e.set(o,l),Object.keys(a).length>0){let s=Rx(o);e.set(s,a)}}}).catch(t=>{let n=t instanceof Error?t.message:String(t);console.error(`[HyperFrames] Invalid caption-overrides.json: ${n}`)})}var ss="data-hf-edit-base-x",ls="data-hf-edit-base-y",mn="data-hf-edit-original-translate",Gi=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},Tx=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},pm=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,as=(e,t)=>pm.test(e)&&pm.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,kx=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=Tx(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${as(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${as(r,t)} ${as(i,n)}${a}`},Mx=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},Fx=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""}},us=new WeakMap;function Nx(e,t){let n=us.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Be("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=Gi(e.getAttribute("data-x"))-Gi(e.getAttribute(ss)),i=Gi(e.getAttribute("data-y"))-Gi(e.getAttribute(ls));e.hasAttribute(mn)||e.setAttribute(mn,Fx(e)),n===void 0&&Mx(e);let o=e.getAttribute(mn)??"",a=kx(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),us.set(e,e.style.getPropertyValue("translate"))}function Hi(e,t){let n=e.querySelectorAll(`[${mn}]:not([${ss}]):not([${ls}])`);for(let o=0;o<n.length;o++){let a=n[o];if(a===void 0||!Do(a))continue;let l=a.getAttribute(mn)??"";l===""?a.style.removeProperty("translate"):a.style.setProperty("translate",l),a.removeAttribute(mn),us.delete(a)}let r=e.querySelectorAll(`[${ss}], [${ls}]`),i=0;for(let o=0;o<r.length;o++){let a=r[o];a===void 0||!Do(a)||(Nx(a,t),i+=1)}return i}var hm="__hfPositionEditsSeekReapplyWrapped",gm=new WeakSet,bm=new WeakMap,xm=new WeakMap;function ym(e){let t=e,n=()=>{try{Hi(t.document)}catch{}},r=f=>typeof f=="function"&&(gm.has(f)||!!f[hm]),i=f=>{gm.add(f);try{Object.defineProperty(f,hm,{value:!0})}catch{}},o=f=>{if(typeof f!="function"||r(f))return f;let m=function(...h){let b=f.apply(this,h);return n(),b};return i(m),m},a=(f,m)=>{let h=bm.get(f);if(h?.has(m))return!0;let b=Object.getOwnPropertyDescriptor(f,m);if(b?.configurable===!1){let _=f[m];return typeof _=="function"&&(f[m]=o(_),n()),!1}let v=f[m],x=b?.set;return Object.defineProperty(f,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>v,set:_=>{v=o(_),x?.call(f,_)}}),v=o(v),h??(h=new Set),h.add(m),bm.set(f,h),n(),!0},l=(f,m)=>{let h=xm.get(t),b=Object.getOwnPropertyDescriptor(t,f);if(!h?.has(f)){if(b?.configurable===!1){let _=t[f];return _?a(_,m):!1}let x=t[f];Object.defineProperty(t,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>x,set:_=>{x=_,x&&a(x,m)}}),h??(h=new Set),h.add(f),xm.set(t,h)}let v=t[f];return v?a(v,m):!1},s=()=>{let f=l("__hf","seek"),m=l("__player","renderSeek");return f&&m};if(s())return;let u=120,d=t.setInterval(()=>{if(s()){t.clearInterval(d);return}u-=1,u<=0&&t.clearInterval(d)},50)}function Bi(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 Ui(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function cs(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var vm=new Set(["img","video","audio","source"]);function Lx(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 Dx(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function Ix(e){if(Ui(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 ds(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=Bi(e);return t.set(n,i),i}function Px(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 Ox(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function Gx(e,t){let n=new Set,r=Ox(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=ds(i,t);for(let[a,l]of Object.entries(o)){let s=Ix(l);s!==null&&Se(i)&&i.style.setProperty(`--${a}`,Dx(s))}}}function ms(e){let t=new Map;Gx(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(!vm.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(vm).join("/")}.`);continue}let i=Lx(ds(n,t)[r]);if(i!==null){if(!cs(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=ds(n,t)[r];Ui(i)&&Px(n,String(i))}}var mt=new Map,Hx="data-hf-color-grading-canvas",Bx="__hf_color_grading_canvas__";function Fm(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{Se(r)&&(r.hasAttribute(xi)||r.setAttribute(xi,r.style.opacity))},n=r=>{if(Ne(r)){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 Ux=16,Wx=4,pn={enabled:!1,position:.5,softness:0,lineWidth:2},fs=["#000000","#ffffff"],Vx=["#1a1a1a","#f5f5dc"],vr=3,zx=vr-1,qx=5,ps=`${Ze}.0`,Sm=`${Ze-1}.0`,$x=`${vr}.0`,jx=`${(zx+.5)/vr}`;function Wi(e){let t=e.getAttribute(qn);return t==null?null:dc(t,Bi(e))}var Kx=["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`),Yx=["#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) * ${Sm};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Sm});`,` float y = (row + 0.5) / ${$x};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${ps}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${ps}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${ps}, ${jx}));`,"}","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`),Xx=["#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`),Jx=["#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`),Qx=["#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 Ut(e){return fe(e)||Oe(e)}function Am(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Em(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(L("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function ji(e,t=Yx){let n=Em(e,Kx,e.VERTEX_SHADER),r=Em(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(L("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function Vi(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 Zx(e,t){let n=ji(e,Xx);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 ey(e,t){let n=ji(e,Jx);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 ty(e,t){let n=ji(e,Qx);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 br(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=Vi(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 qi(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 hs(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 wm(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function ys(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=ji(t),r=Vi(t),i=Vi(t,t.NEAREST),o=Vi(t,t.NEAREST);if(!n||!r||!i||!o)return wm(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:hs(t,n,yi),detailUniforms:hs(t,n,da),effectUniforms:hs(t,n,ma),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")}}):(wm(t,n,[r,i,o]),null)}function ny(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ry(e){if(!ny(e))return{...pn};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,pn.position,0,1),softness:t(e.softness,pn.softness,0,.25),lineWidth:t(e.lineWidth,pn.lineWidth,0,12)}}function Nm(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 Ki(e){return e instanceof Error?e.message:"LUT failed to load"}function iy(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 Lm(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return iy(t)}function vs(e){let t=Nm(e);if("error"in t)return{state:"error",message:t.error};let n=mt.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=>Wu(o,{maxSize:hi})),i={state:"pending",promise:r};for(;mt.size>=Ux;){let o=mt.keys().next().value;if(!o)break;mt.delete(o)}return mt.set(t.href,i),r.then(o=>{mt.get(t.href)===i&&mt.set(t.href,{state:"ready",lut:o})},o=>{mt.get(t.href)===i&&mt.set(t.href,{state:"error",message:Ki(o)})}),i}function _m(e,t,n){if(e.lut?.src===t)return e.lut;let r=na(n),{gl:i,program:o}=e;try{return Dm(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=Ki(a),e.lutLoadingSrc=null,L("runtime.colorGrading.uploadLut",a),null}}async function oy(e){let t=vs(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function Dm(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 ay(e,t,n){let r=na(n),{gl:i,program:o}=e;return Dm(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function nt(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function Ss(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),nt(e.gl,t.scratch),nt(e.gl,t.blur),t.bloom&&nt(e.gl,t.bloom),e.effectTargets=null)}function As(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),nt(e.gl,t.moments),nt(e.gl,t.output),e.kuwaharaTargets=null)}function zi(e,t=!1){Ss(e),As(e),sy(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function sy(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function ly(e){let t=ys(e.canvas);return t?(zi(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function xs(e){if(!e.sourceHidden)return;e.element.removeAttribute($n);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function uy(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=Zx(t,e.program.quad),r=br(t),i=br(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&nt(t,r),i&&nt(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function cy(e,t){return t.bloom||(t.bloom=br(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Cm(e){let t=e.effectTargets;t?.bloom&&(nt(e.gl,t.bloom),t.bloom=null)}function dy(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=ey(t,e.program.quad),o=ty(t,e.program.quad),a=br(t,n.HALF_FLOAT_OES,t.NEAREST),l=br(t);return!i||!o||!a||!l?(my(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 my(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&nt(e,r),i&&nt(e,i)}function Im(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return qi(e,t,o,a),qi(e,n,o,a),{width:o,height:a}}function $i(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),xr(e,t)}function fy(e,t,n,r,i,o,a){let l=Im(e,t.scratch,r,i/2,o/2),s=a/2;$i(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),$i(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function py(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)$i(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),$i(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function xr(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 hy(e,t,n,r,i,o,a,l){qi(e,t.moments,i.width,i.height),qi(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),xr(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),xr(e,u)}function gy(e,t,n,r){if(n<=0)return!1;let i=Im(e.gl,t.scratch,t.blur,r.width,r.height);return py(e.gl,t,e.program.texture,t.blur,i,.75+Math.pow(n,1.35)*32,n>.55?3:2),!0}function by(e,t,n,r,i,o){if(n<=0)return Cm(e),null;o||Cm(e);let a=o?cy(e,t):t.blur;return a?(fy(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function xy(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&&Ss(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=uy(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=gy(e,l,o,n),u=by(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function yy(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&As(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=dy(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(hy(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 Pm(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=xy(e,t,n,o),l=yy(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function vy(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=Nm(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=vs(t);return i.state==="ready"?_m(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||(_m(e,r.href,o),We(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=Ki(o),e.lutLoadingSrc=null,We(e))})),null)}function hr(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&&Ut(n))return n;try{let r=document.querySelector(t);return r&&Ut(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Ut(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Ut(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&&Ut(r)?r:null}catch{return null}}function Om(e){return fe(e)?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:Oe(e)&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function Gm(e){return fe(e)?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:Oe(e)?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function Hm(e){let t=bt(e);return t&&Gm(t)?t:null}function Rm(e){if(!fe(e))return!1;let t=Hm(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function Sy(e){return Oe(e)&&e.classList.contains("__render_frame__")}function Ay(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function Bm(e){if(fe(e)){let t=Hm(e);if(t)return t}return Gm(e)?e:null}function Tm(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 Ey(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=Tm(o,"x"),l=Tm(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 Um(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 m=a==="cover"?Math.max(e/n,t/r):Math.min(e/n,t/r);l=n*m,s=r*m,a==="scale-down"&&l>n&&s>r&&(l=n,s=r)}else a==="none"&&(l=n,s=r);let u=Ey(o||"center"),d=(e-l)*u.x/e,f=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:d,offsetY:f}}function wy(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function km(e,t){return Math.max(0,Math.round(e>0?e:t))}function _y(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&wy(e,i);let o=window.getComputedStyle(t);pc(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=km(n.offsetWidth,a.width),s=km(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),d=Math.round(l*u),f=Math.round(s*u);return r.width!==d&&(r.width=d),r.height!==f&&(r.height=f),{width:d,height:f}}function fn(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 Wt(e,t,n,r){e.set(r,(t*Ze+n)*4)}function Ct(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function gs(e,t,n){return e.length>=3?ia(e,t,n):new Float32Array(Ze)}function Bt(e,t){return e[t]??0}function Cy(e,t,n){let r=tn(t.red),i=tn(t.green),o=tn(t.blue),a=tn(t.master),l=gs(n.hueVsHue,-180,180),s=gs(n.hueVsSaturation,-1,1),u=gs(n.hueVsLuma,-1,1);for(let d=0;d<Ze;d+=1)Wt(e,0,d,[Bt(r,d),Bt(i,d),Bt(o,d),Bt(a,d)]),Wt(e,1,d,[Ct(Bt(l,d),180),Ct(Bt(s,d),1),Ct(Bt(u,d),1),1])}function Ry(e,t,n){let r=n*qx;Wt(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),Wt(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),Wt(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),Wt(e,2,r+3,[Ct(t.correction.hueShift,180),Ct(t.correction.saturation,1),Ct(t.correction.luma,1),Ct(t.correction.temperature,1)]),Wt(e,2,r+4,[Ct(t.correction.tint,1),.5,.5,1])}function Ty(e,t,n){let r=new Float32Array(Ze*vr*4);Cy(r,e,t);let i=0;for(let o of n)o.enabled&&(Ry(r,o,i),i+=1);return r}var Mm=new WeakMap;function ky(e,t,n){let r=Mm.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return Mm.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function My(e,t,n,r){let{curves:i,hueCurves:o}=n,a=ky(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(Ty(i,o,r),Vn);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,Ze,vr,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function bs(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function Wm(e,t,n,r,i,o,a,l,s,u,d,f){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:m,hueCurves:h,secondaries:b}=n,v=ha(m),x=ga(h),_=ba(b)?b.reduce((F,D)=>F+Number(D.enabled),0):0;(v||x||_>0)&&My(e,t,n,b),bs(e,t.shadowWheel,n.wheels.shadows),bs(e,t.midtoneWheel,n.wheels.midtones),bs(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,v?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,_);for(let[F,D]of t.adjustUniforms)e.uniform1f(D,n.adjust[F]);for(let[F,D]of t.detailUniforms)e.uniform1f(D,n.details[F]);e.uniform1f(t.grainSeed,d),e.uniform1f(t.effectTime,f);for(let[F,D]of t.effectUniforms)e.uniform1f(D,n.effects[F]);let T=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Vx:fs),C=T[T.length-1]??fs[1];e.uniform1f(t.paletteSize,T.length),fn(e,t.palette0,T[0]??fs[0]),fn(e,t.palette1,T[1]??C),fn(e,t.palette2,T[2]??C),fn(e,t.palette3,T[3]??C),fn(e,t.palette4,T[4]??C),fn(e,t.palette5,T[5]??C),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 Fy(e){if(!e.sourceHidden){let t=e.element.getAttribute(xi);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute($n,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function ft(e){let t=lc.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var Vm=ft("intensity"),zm=ft("lut.intensity"),qm=ft("adjust.exposure"),$m=ft("effects.kuwahara"),jm=[["blur",ft("effects.blur")],["bloom",ft("effects.bloom")],["kuwahara",$m],["pixelate",ft("effects.pixelate")],["ascii",ft("effects.ascii")],["dither",ft("effects.dither")]],Km=[Vm,zm,qm,...jm.map(([,e])=>e)];function Vt(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 gr(e,t){return t!==null&&(mc(t)||Km.some(n=>Vt(e,n)!==null))}function Ny(e,t){let n=null;for(let[r,i]of jm){let o=Vt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function Ly(e){let{element:t,grading:n}=e,r=Vt(t,Vm),i=Vt(t,zm),o=Vt(t,qm),a=Ny(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 Ym(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 Xm(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 We(e){if(e.destroyed||e.contextLost)return!1;let t=Bm(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=Om(t);if(!n)return!1;let r=Se(t)?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=Sy(t);s&&Ay(e,t),a&&!s&&(e.sourceInlineOpacity!==null?e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority||""):e.element.style.removeProperty("opacity"));let u=window.getComputedStyle(s?t:e.element);e.sourceOpacityForCanvas=u.opacity||"1",a&&!s&&e.element.style.setProperty("opacity","0","important"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let d=_y(e,r);if(!d)return!1;let f=window.getComputedStyle(r),m=Um(d.width,d.height,n.width,n.height,f.objectFit,f.objectPosition),{gl:h,program:b}=e;try{let v=Ly(e),x=vy(e);Ym(h,b.texture,t);let _=Vt(e.element,$m)!==null,T=Pm(e,v,d,m,{preserveKuwahara:_});h.bindFramebuffer(h.FRAMEBUFFER,null),h.viewport(0,0,d.width,d.height),h.useProgram(b.program),Xm(h,b,T);let C=window.__player?.getTime?.(),F=typeof C=="number"&&Number.isFinite(C)?Math.max(0,C):fe(e.element)?Math.max(0,e.element.currentTime):0,D=e.grainSeed+Math.floor(F*60);return Wm(h,b,v,x,T.blurReady,T.bloomReady,T.kuwaharaReady,e.compare,d,m,D,F),xr(h,b),Fy(e),e.hasDrawn=!0,e.drawError=null,!0}catch(v){return e.drawError=v instanceof Error?v.message:"Shader draw failed",L("runtime.colorGrading.drawEntry",v),!1}}function Dy(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 Iy(){let e=document.createElement("canvas"),t=ys(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function Py(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):fe(e)?Math.max(0,e.currentTime):0}function Oy(e,t,n,r){let i=Bm(t);if(!i)return null;let o=Om(i);if(!o)return null;let a=Dy(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=Se(i)?i:t,s=window.getComputedStyle(l),u=Um(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return Ym(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:Py(t,r),grainSeed:Lm(t)+(fe(t)?Math.floor(t.currentTime*60):0)}}async function Gy(e,t,n,r,i=!1){let o=Oy(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,d=[];for(let f of n.slice(0,32)){let m=vi(f.grading);if(!m){d.push({id:f.id,dataUrl:null,error:"Invalid grading"});continue}let h=null;try{m.lut&&(e.lut?.src!==m.lut.src&&(e.lut=ay(e,m.lut.src,await oy(m.lut.src))),h=e.lut),d.push({id:f.id,dataUrl:Hy(e,m,h,a,l,s,u)})}catch(b){d.push({id:f.id,dataUrl:null,error:Ki(b)})}}return{...a,images:d}}function Hy(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,d=Pm(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),Xm(s,u,d),n||(e.lut=null),Wm(s,u,t,n,d.blurReady,d.bloomReady,d.kuwaharaReady,pn,r,i,o,a),xr(s,u),l.toDataURL("image/png")}function tt(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function By(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&fe(e.element)&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function yr(e){if(e.destroyed||!fe(e.element)||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,We(e),!e.destroyed&&!t.paused&&!t.ended&&yr(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,We(e),!e.destroyed&&!t.paused&&!t.ended&&yr(e)})}function Uy(e){let t=()=>{We(e)};if(tt(e,e.element,"load",t),tt(e,e.element,"loadedmetadata",t),tt(e,e.element,"loadeddata",t),tt(e,e.element,"seeked",t),tt(e,e.element,"timeupdate",t),tt(e,window,"resize",t),fe(e.element)&&(tt(e,e.element,"play",()=>yr(e)),tt(e,e.element,"pause",t)),tt(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",xs(e)}),tt(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!ly(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",xs(e);return}e.drawError=null,We(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(),We(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function Wy(e){if(e.destroyed)return null;e.destroyed=!0,By(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),Ss(e),As(e),xs(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 Jm(e,t){return e.removeAttribute("style"),t.id?e.id=`${rc}${t.id}`:e.removeAttribute("id"),e.className=Bx,e.setAttribute(Hx,"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 Vy(e){return Jm(document.createElement("canvas"),e)}function Qm(e){let t=new WeakMap,n=new Set,r=[],i=null,o=null,a=Promise.resolve(),l=!1,s=(S,A,w)=>{let R=t.get(S);if(R)return R.grading=A,R.source=w,We(R),fe(S)&&!S.paused&&yr(R),!0;let I=r.pop();if(I)Jm(I.canvas,S);else{let j=Vy(S),X=ys(j);if(!X)return j.remove(),!1;I={canvas:j,gl:X.gl,program:X.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let H={element:S,...I,grading:A,compare:{...pn},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:w,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(S).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(S).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:Lm(S),destroyed:!1};return t.set(S,H),n.add(S),Uy(H),We(H),fe(S)&&!S.paused&&yr(H),!0},u=(S,A)=>{if(l)return!1;let w=hr(S);if(!w)return!1;let R=t.get(w);if(!R){let I=Wi(w);if(!gr(w,I)||!s(w,I,"attribute"))return!1;R=t.get(w)}return R?(R.compare=ry(A),We(R),!0):!1},d=S=>{let A=t.get(S);if(!A)return;let w=Wy(A);w&&(A.contextLost||r.length>=Wx?zi(w,!0):r.push(w)),t.delete(S),n.delete(S)},f=()=>{if(l)return 0;let S=new Set;document.querySelectorAll(`video[${qn}], img[${qn}]`).forEach(w=>{if(!Ut(w))return;S.add(w);let R=Wi(w);gr(w,R)&&(Am(w)||Rm(w))?s(w,R,"attribute"):d(w)});for(let w of n){let R=t.get(w);R&&(!w.isConnected||R.source==="attribute"&&!S.has(w))&&d(w)}return n.size},m=()=>{if(l)return 0;let S=0;for(let A of n){let w=t.get(A);w&&We(w)&&(S+=1)}return S},h=async()=>{let S=new Set;for(let A of n){let w=t.get(A)?.grading.lut;if(!w?.src.trim()||(w.intensity??1)<=0)continue;let R=vs(w.src);R.state==="pending"&&S.add(R.promise)}return S.size>0&&await Promise.allSettled(S),m(),S.size},b=()=>{if(l)return 0;let S=0;for(let A of n){let w=t.get(A);!w||!Km.some(I=>Vt(A,I)!==null)||fe(A)&&!A.paused&&!A.ended||We(w)&&(S+=1)}return S},v=(S,A)=>{if(l)return!1;let w=hr(S);if(!w)return!1;let R=vi(A);return gr(w,R)?s(w,R,"live"):(d(w),!0)},x=(S,A)=>{if(!Ut(S))return!1;let w=t.get(S);if(!w){if(!A)return!1;let R=Wi(S);return gr(S,R)&&s(S,R,"attribute")}return w.sourceVisibleForCanvas=A,!A&&w.source==="attribute"&&d(S),!0},_=S=>{let A=hr(S);if(!A)return{state:"missing",message:"Media not found"};let w=t.get(A);if(w)return w.effectError?{state:"unavailable",message:w.effectError}:w.drawError?{state:"unavailable",message:w.drawError}:w.lutError?{state:"unavailable",message:`LUT error: ${w.lutError}`}:w.grading.lut&&w.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:w.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:w.lut?"Shader + LUT active":"Shader active"};let R=Wi(A);return gr(A,R)?!Am(A)&&!Rm(A)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},T=async(S,A,w)=>{let R=async()=>{if(l||A.length===0)return null;let H=hr(S);return!H||(o??(o=Iy()),!o)?null:Gy(o,H,A,w?.maxDimension,w?.useMediaTime)},I=a.then(R,R);return a=I.then(()=>{},()=>{}),I},C=S=>{let A=hr(S);if(!fe(A))return null;if(!A.paused)return()=>{};let w=A.currentTime,R=A.loop,I=A.muted;return A.loop=!0,A.muted=!0,(A.ended||Number.isFinite(A.duration)&&w>=A.duration)&&(A.currentTime=0),e?.lease(A),A.play().catch(()=>{}),()=>{e?.release(A),A.pause(),A.loop=R,A.muted=I,A.currentTime=w}},F=()=>{if(!l){l=!0,i?.disconnect(),i=null;for(let S of n)d(S);for(let S of r)zi(S,!0);r.length=0,o&&(zi(o,!0),o=null)}};document.body&&(i=new MutationObserver(()=>f()),i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[qn]}));let D={refresh:f,redraw:m,redrawAnimated:b,waitForActiveLuts:h,setGrading:v,setCompare:u,setSourceVisibility:x,getStatus:_,renderPreviews:T,startPreviewPlayback:C,destroy:F},M=window;return M.__hf=M.__hf||{},M.__hf.colorGrading=D,f(),D}var Yi=class{constructor(t){ye(this,"_baseTime",0);ye(this,"_playStartMs",null);ye(this,"_rate",1);ye(this,"_duration",1/0);ye(this,"_nowMs");ye(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 zy=100,qy=8,$y=4096,Es=e=>e;function jy(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Ky(e){let t=Math.ceil(e*zy);return Math.min($y,Math.max(qy,t))}function Yy(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??Es,u=T=>o+(T-a)/l,d=e.points[t],f=e.points[t+1],m=u(f.t);if(m<=o)return null;let h=Math.max(o,u(d.t)),b=m-h;if(b<=0)return null;if(jy(d,n,i))return{kind:"ramp",time:m,value:s(f.v)};let v=Ky(b),x=Ru(e,Math.max(d.t,a),f.t,v,n),_=new Float32Array(v);for(let T=0;T<v;T+=1)_[T]=s(x[T]??0);return{kind:"curve",time:h,duration:b,values:_}}function Xy(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=Yy(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??Es)(Bn(e,n.elapsed,t))}),i}function Jy(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 Sr(e){for(let t of e)t.param.cancelScheduledValues(0)}function hn(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function ws(e,t,n,r){if(t.points.length!==0)for(let i of e){if(Sr([i]),Cu(t)){let o=(i.map??Es)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}Jy(i.param,Xy(t,n,r,i.map))}}function Zm(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=Hn(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 d=zo(l.target,t);d&&(ws(u,l,d.scale,r),a.push(...u))}return a}function ef(e){return e.lanes.find(t=>t.target===Qt)??null}var Qy=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,_s=new WeakMap;function Cs(e){return tf.has(e)}var tf=new WeakSet;function Rs(e){let t=_s.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Qy)))}`;await e.audioWorklet.addModule(n),tf.add(e)})().catch(n=>{throw _s.delete(e),n}),_s.set(e,t)),t}function Zy(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,d=0;for(let m=0;m<i;m++){u+=s*(l()-u);let h=u*Math.pow(1-m/i,2.5);o[m]=h,d+=h*h}let f=Math.sqrt(d);if(f>0)for(let m=0;m<i;m++)o[m]=(o[m]??0)/f;return o}var ue=e=>typeof e=="number"?e:Number(e??0),Ts=e=>e/1e3;function af(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 d=u/i;a[u]=t==="sine"?Math.sin(2*Math.PI*d):4*Math.abs((d+.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 sf(e){try{e.stop()}catch{}e.disconnect()}function ks(e,t){return[{param:e},{param:t,map:n=>1-n}]}function lf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ms(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var ev=new Set(["peaking","highpass","lowpass"]),nf=e=>Math.pow(10,e/20),tv=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=nf(ue(i.gain))};return r(t),Ms(n,r,{gain:[{param:n.gain,map:nf}]})};function Ar(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),Ms(i,o,{frequency:[{param:i.frequency}],...ev.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function nv(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 Ms(i,()=>{})}}function Er(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 rv={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))},iv=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=rv[String(a.type)]??Math.tanh,s=Math.pow(10,ue(a.threshold)/20),u=8192,d=new Float32Array(u);for(let f=0;f<u;f++){let m=f/(u-1)*2-1;d[f]=l(m/Math.max(1e-6,s))*s}n.curve=d,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()}}},ov=(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),lf(a,l,ue(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ts(u))}],feedback:[{param:o.gain}],mix:ks(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},av=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=af(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 d=f=>{o.delayTime.value=ue(f.delay)/1e3,l.gain.value=ue(f.depth)/1e3,a.playbackRate.value=ue(f.speed),lf(s,u,ue(f.mix))};return d(t),{input:r,output:i,update:d,automation:{delay:[{param:o.delayTime,map:Ts}],depth:[{param:l.gain,map:Ts}],speed:[{param:a.playbackRate}],mix:ks(s.gain,u.gain)},dispose:()=>{sf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},sv=6,lv=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=af(e,String(t.type)==="1"?"sine":"triangle",ue(t.speed),n),s=e.createGain(),u=e.createGain(),d=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<sv;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(d).connect(a),a.connect(i);let h=b=>{let v=1e3/Math.max(.1,ue(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*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,d.gain.value=1};return h(t),{input:r,output:i,update:h,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{sf(l),[r,i,o,a,s,u,d,...f].forEach(b=>b.disconnect())}}},uv=(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 d=`${ue(u.size)}:${ue(u.damping)}`;if(d!==l){let f=Zy(e.sampleRate,ue(u.size),ue(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=d}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())}},cv={"gain-node":tv,"biquad-peaking":Ar("peaking",!0),"biquad-lowshelf":Ar("lowshelf",!0),"biquad-highshelf":Ar("highshelf",!0),"biquad-highpass":Ar("highpass",!1),"biquad-lowpass":Ar("lowpass",!1),"worklet-compressor":Er("hf-compressor"),"worklet-limiter":Er("hf-limiter"),"worklet-gate":Er("hf-gate"),"worklet-bitcrush":Er("hf-bitcrush"),"worklet-pitchshift":Er("hf-pitchshift"),waveshaper:iv,"delay-feedback":ov,"chorus-lfo":av,"allpass-phaser":lv,convolver:uv};function uf(e){return e.nodes.some(t=>In(t.type)?.web.startsWith("worklet-")??!1)}function dv(e,t,n,r=0){let i=In(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=Pn(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return nv(t)(e,o,r);let a=cv[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function rf(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 of(e){return On(e).map(t=>{let n=Pn(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 cf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=rf(On(t)),s=r;for(let m of l){let h=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),h={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=dv(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}h&&m.preset&&(s.connect(h.wet).connect(h.join),a.push({id:m.preset,...h}),s=h.join)}s.connect(i);let u=of(t),d={};for(let m of a)(d[f=m.id]??(d[f]=[])).push(...ks(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:d,nodes:o,update(m){if(of(m)!==u)return!1;On(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(Pn(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let h=0;for(let b of rf(On(m))){if(!b.preset)continue;let v=a[h++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:h,dry:b,join:v}of a)m.disconnect(),h.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var df={version:1,nodes:[]},mf={version:1,lanes:[]};function ff(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(ut):null)??"";if(!n)return mf;try{return _u(ui(n),t)}catch{return mf}}function gn(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(It):null)??"";if(!t)return{chain:df,raw:""};try{return{chain:Au(t),raw:t}}catch{return{chain:df,raw:""}}}function pf(e){return ff(e,gn(e).chain)}function Xi(e,t,n,r,i){let{chain:o}=gn(t),a=null,l=[],s=!1,u=0,d=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(C,F)=>{if(C.nodes.length===0){n.connect(r);return}if(uf(C)&&!Cs(e)){n.connect(r);let D=++u;Rs(e).then(()=>{s||D!==u||x(gn(t).chain)}).catch(()=>{});return}try{let D=cf(e,C,F);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(C,F)=>{l=F&&a?Zm(ff(t,C),C,a.nodes,F,a.presets):[]},h=i?{...i}:null;f(o,h?.elapsed??0),m(o,h);let b=()=>{if(!h)return null;let C=typeof e.currentTime=="number"?e.currentTime:h.scheduledAt;return{scheduledAt:C,elapsed:h.elapsed+(C-h.scheduledAt)*h.rate,rate:h.rate}},v=C=>{let F=b();F&&(hn(l,F.scheduledAt),m(C,F))},x=C=>{let F=b();hn(l,F?.scheduledAt??0),d(),f(C,F?.elapsed??0),m(C,F)},_=null,T=t;return typeof MutationObserver<"u"&&typeof T?.nodeType=="number"&&(_=new MutationObserver(()=>{let C=gn(t);l.length>0&&Sr(l),!a||!a.update(C.chain)?x(C.chain):v(C.chain)}),_.observe(T,{attributes:!0,attributeFilter:[It,ut]})),{reanchor:C=>{if(s)return;let F=b();F&&hn(l,F.scheduledAt),h={...C},m(gn(t).chain,h)},setRate:C=>{let F=b();s||!F||!Number.isFinite(C)||C<=0||C===F.rate||(h={...F,rate:C},hn(l,F.scheduledAt),m(gn(t).chain,h))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&hn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var hf="runtime_web_audio_bypass";function Fs(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function wr(e,t){return Fs(e,t)!==null}function mv(e){return wr(e,"crossorigin")?!0:e.crossOrigin!=null}function fv(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function pv(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Fs(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function hv(e,t){let n;try{n=new URL(e,fv(t))}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:n}function gv(){return typeof window.origin=="string"?window.origin:window.location.origin}function bv(e,t){if(typeof window>"u")return null;let n=hv(e,t);if(!n)return null;let r=gv(),i=r==="null";return!i&&n.origin===r||mv(t)?null:i?"opaque_document_origin":"cross_origin_no_cors"}function bf(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:wr(e,"src")}function bn(e){for(let t of pv(e)){let n=bv(t,e);if(n)return{kind:"decode-only",reason:n,asset:t}}return{kind:"web-audio"}}function xv(e){let t=[];wr(e,It)&&t.push("fx-chain"),wr(e,ut)&&t.push("automation"),wr(e,di)&&t.push("audio-group");let n=Number.parseFloat(Fs(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function yv(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var gf=new WeakSet,vv={cross_origin_no_cors:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead",opaque_document_origin:"this document\'s security origin is opaque (a sandbox without `allow-same-origin`), so no media is same-origin with it and createMediaElementSource would be silent (Web Audio spec); using native playback instead"},Sv={cross_origin_no_cors:"proxy or download the asset to a same-origin URL to keep it.",opaque_document_origin:"add `allow-same-origin` to the sandbox, or serve the asset with a `crossorigin` attribute and an `Access-Control-Allow-Origin` of `null` or `*`, to keep it."};function xn(e,t){if(t.kind==="web-audio"||yv()||gf.has(e))return;let n=xv(e);gf.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:vv[t.reason]};ve({source:"hf-preview",type:"diagnostic",code:hf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \\u2014 ${Sv[t.reason]}`:"";console.info(`[hyperframes] ${hf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Ns(e){return!Number.isFinite(e)||e<=0?1:e}function xf(e){return Ue(e)}function Av(e,t){t||e.paused||!Kr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function Ev(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 f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let d=-n/o;return s?e.start(i+d,r,u):e.start(i+d,r),!0}function Ji(e,t,n){let r=ef(pf(e));r&&ws([{param:t.gain}],r,li.scale,n)}function _r(e){return e.sourceKind==="buffer"}var Qi=class{constructor(){ye(this,"_ctx",null);ye(this,"_bufferCache",new Map);ye(this,"_failedSrcs",new Set);ye(this,"_mediaElementSources",new WeakMap);ye(this,"_activeSources",[]);ye(this,"_masterGain",null);ye(this,"_masterVolume",1);ye(this,"_masterMuted",!1);ye(this,"_groups",new Map);ye(this,"_rateAnchorCtx",0);ye(this,"_rateAnchorComp",0);ye(this,"_rate",1);ye(this,"_paused",!0);ye(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=bn(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),xn(t,o),null}return n}if(!this._ctx)return null;let r=bn(t);if(r.kind!=="web-audio")return xn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}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.acquireMediaElementSource(t);if(!s)return null;let u=Ns(l),d=this._ctx.createGain();d.gain.value=o;let f=this._ctx.currentTime,m=i-n,h={scheduledAt:f,elapsed:m,rate:u},b=Xi(this._ctx,t,s,d,h);d.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ji(t,d,h),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:d,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:Le(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>$o(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let d=this._ctx.createGain();d.gain.value=xf(qo(s)),d.connect(u);let f=Xi(this._ctx,s??{getAttribute:()=>null},o,d,r);return s&&Ji(s,d,r),this._groups.set(t,{input:o,fader:d,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{Sr([{param:d.gain}]);let h=l();d.gain.value=xf(qo(h)),u.gain.value=h?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),h&&Ji(h,d,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),d.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=ku(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let d=Ns(s),f=Le(t),m=d*f,h=this._ctx.createBufferSource();h.buffer=n,h.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:d},T=Xi(this._ctx,t,h,b,_);if(b.connect(this.resolveDestination(t,x,o,d)??this._masterGain),Ji(t,b,_),this._rate=d,this._rateAnchorCtx=x,this._rateAnchorComp=o,!Ev(h,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:d,mediaRate:f,clipDuration:u}))return h.disconnect(),T?.dispose(),b.disconnect(),null;let C=t.muted;t.muted=!0,Av(t,C);let F={fx:T,el:t,sourceNode:h,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:C,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(F),this._paused=!1,h.addEventListener("ended",()=>this.handleSourceEnded(h,F,t,C)),F}catch(d){return L("webAudioTransport.schedule",d),null}}setRate(t){let n=Ns(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(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>_r(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{_r(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}_r(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=Ue(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&_r(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cr="data-hf-studio-manual-edit-gesture";var yf=`[${Cr}]`;function vf(e,t){let n=e.defaultView?.MutationObserver??globalThis.MutationObserver;if(!n||!e.documentElement)return{isActive:()=>e.querySelector(yf)!=null,observing:!1,disconnect:()=>{}};let r=new Set(e.querySelectorAll(yf)),i=l=>{for(let s of l){let u=s.target;Ne(u)&&(u.hasAttribute(Cr)?r.add(u):r.delete(u))}},o=l=>{l.length!==0&&(i(l),t())},a=new n(o);return a.observe(e.documentElement,{subtree:!0,attributes:!0,attributeFilter:[Cr]}),{observing:!0,isActive:()=>{o(a.takeRecords());for(let l of r){if(l.isConnected&&l.hasAttribute(Cr))return!0;r.delete(l)}return!1},disconnect:()=>{a.disconnect(),r.clear()}}}var Sf=333.3333333333333;function Af(e){return e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2?!1:e.compositionChanged===!0?!0:Number.isInteger(e.tick)&&e.tick>0&&e.tick%60===0}var wv=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Ef(e){return Math.max(0,Math.min(1,e))}function wf(e){let t=wv.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Ef(n):null}function _f(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Ef(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 _v=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,Cv=Math.PI*2;function Rv(e){let t=_v.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 Tv(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(Cv*t*e)}function Cf(e,t){let n=Rv(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=>Tv(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var kv=24,Rf=e=>e>=1?1:0,Mv=e=>e,Zi=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,Fv=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${Zi}\\s*,\\s*${Zi}\\s+${Zi}\\s*,\\s*${Zi}\\s+1\\s*,\\s*1\\s*$`,"i");function Tf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function Nv(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<kv;l+=1){let s=(o+a)/2;Tf(s,t,r)<e?o=s:a=s}return Tf((o+a)/2,n,i)}function Lv(e){let t=Fv.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=>Nv(a,n,r,i,o)}function Dv(e,t){if(!e.startsWith("spring("))return null;let n=wf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>_f(o,n);return t.set(n,i),i}function Iv(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=Lv(n);return i&&t.set(n,i),i}function kf(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"?Rf:Cf(s,i)??Dv(s,r)??Iv(s,n),a=(s,u,d=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Be("custom_ease_parse_failed",{ease:s}),t.call(u,s,...d)??Mv)};e.parseEase=function(u,...d){return a(u,this,d)};let l=e.registerEase;if(typeof l=="function"){l("hold",Rf);let s=u=>{let d=f=>f;d.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,d)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var Is=new Map,Rr=new Map,Ls=new Map,Ds=()=>{},Ff=()=>{},Mf=0;function Ps(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Nf(e){let t=(Ls.get(e)??0)+1;return Ls.set(e,t),t}function Lf(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Mf-=1,Mf)}function Os(e,t){let n=Rr.get(e);if(!n)return;let r=()=>Ls.get(e)===t.generation&&Rr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&Ff(e,t.requestId)},i=>{r()&&Ds(e,t.requestId,i)})}catch(i){r()&&Ds(e,t.requestId,i)}}function Df(e){Ds=e}function If(e){Ff=e}function eo(e,t,n){if(!Ps(e))return;let r={payload:t,requestId:Lf(n),generation:Nf(e)};Is.set(e,r),Os(e,r)}function to(e,t){Ps(e)&&(Is.delete(e),Os(e,{payload:void 0,requestId:Lf(t),generation:Nf(e)}))}function Pf(e,t){if(!Ps(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);Rr.set(e,t);let n=Is.get(e);return n&&Os(e,n),()=>{Rr.get(e)===t&&Rr.delete(e)}}var Gs="data-hf-authored-duration",Hs="data-hf-authored-end",Of=!1;function rt(e){if(e){if(typeof e.pause!="function"){Of||(Of=!0,Be("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function Gv(){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 Gf(){let e=bc(),t=()=>{};Ll(ve),Df((c,p,g)=>{ve({source:"hf-preview",type:"runtime-data-error",channel:c,requestId:p,message:g instanceof Error?g.message:String(g)})}),If((c,p)=>{try{t()}catch(g){ve({source:"hf-preview",type:"runtime-data-error",channel:c,requestId:p,message:g instanceof Error?g.message:String(g)});return}ve({source:"hf-preview",type:"runtime-data-applied",channel:c,requestId:p})}),Hi(document),ms(document),Mu(document);let n=Gv();e.canonicalFps=n.fps??e.canonicalFps,Fl(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,d=(c,p,g)=>{u.has(c)||(u.add(c),Be(p,g))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(c){L("runtime.init.site1",c)}let f=new Yi;e.transportClock=f;let m=new Qi,h=!1;m.init().then(c=>{h=c}),window.__hf=window.__hf||{};let b=c=>c.closest("[data-hidden]")!==null||mi(c.ownerDocument,c),v=()=>{let c=window.gsap,p=window;if(!(!c?.registerPlugin||p.__hfAutoNoopRegistered))try{c.registerPlugin({name:"_auto",init:()=>!1}),p.__hfAutoNoopRegistered=!0}catch(g){d("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",g)}},x=()=>{let c=window.gsap;if(!c){d("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{kf(c)||d("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(p){d("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",p)}};v(),x(),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{Bl(document)}catch(c){L("runtime.init.cssVariables",c)}window.__timelines=window.__timelines||{};let _=()=>{let c=document.querySelector(\'[data-composition-id][data-root="true"]\');if(Se(c))return c;let p=Array.from(document.querySelectorAll("[data-composition-id]"));return p.find(g=>!g.parentElement?.closest("[data-composition-id]"))??p[0]??null};if(Array.isArray(window.__timelines)){let c=window.__timelines,p=_()?.getAttribute("data-composition-id")??"root",g={};if(c.length===1)g[p]=c[0];else for(let y=0;y<c.length;y++)g[`tl-${y}`]=c[y];window.__timelines=g}let T=_();T&&!T.hasAttribute("data-start")&&T.setAttribute("data-start","0");let C=c=>{a.push(c)},F=(c,p,g)=>{let y=g??`${c}:${JSON.stringify(p)}`;l.has(y)||(l.add(y),ve({source:"hf-preview",type:"diagnostic",code:c,details:p}))},D=c=>{let p={scale:1,focusX:960,focusY:540},g=[],y=[],E={time:c.getTime(),duration:c.getDuration(),isPlaying:c.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:c.play,pause:c.pause,seek:c.seek,getTime:c.getTime,getDuration:c.getDuration,isPlaying:c.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>p,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>g,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:c.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...E,time:c.getTime(),duration:c.getDuration(),isPlaying:c.isPlaying()})}},M=1/60,S=.75,A=.05,w=100,R=240,I=c=>{if(c instanceof Error)return c.message||String(c);if(typeof c=="string")return c;try{return JSON.stringify(c)}catch{return String(c??"")}},H=c=>{let p=c.toLowerCase();return p.includes("cannot read properties of null")||p.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:p.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:p.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},j=c=>{if(c==null||c.trim()==="")return null;let p=Number.parseFloat(c);return!Number.isFinite(p)||p<=0?null:`${p}px`},X=()=>_(),k=()=>{let c=X();if(!c)return;let p=j(c.getAttribute("data-width")),g=j(c.getAttribute("data-height"));p&&(c.style.width=p),g&&(c.style.height=g),p&&c.style.setProperty("--comp-width",p),g&&c.style.setProperty("--comp-height",g)},U=()=>{let c=X(),p=Array.from(document.querySelectorAll("[data-composition-id]")).filter(g=>g.hasAttribute("data-duration")||g.hasAttribute("data-end"));for(let g of p){if(c&&g===c)continue;let y=g.getAttribute("data-duration"),E=g.getAttribute("data-end");y!=null&&!g.hasAttribute(Gs)&&g.setAttribute(Gs,y),E!=null&&!g.hasAttribute(Hs)&&g.setAttribute(Hs,E),g.removeAttribute("data-duration"),g.removeAttribute("data-end")}},te=()=>{let c=X();if(!c)return;c.style.position||(c.style.position="relative"),c.style.overflow="hidden";let p=j(c.getAttribute("data-width")),g=j(c.getAttribute("data-height"));p&&(c.style.width=p),g&&(c.style.height=g);let y=Array.from(c.children);for(let E of y){let N=E.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!E.hasAttribute("data-start")||E.hasAttribute("data-hf-autostamped"))continue;let P=(E.style.top==="0px"||E.style.top==="0")&&(E.style.left==="0px"||E.style.left==="0")&&E.style.width==="100%"&&E.style.height==="100%",K=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(E.style.transform);if(P&&K&&!E.hasAttribute("data-width")&&!E.hasAttribute("data-height")){let Y=E.style.top,Re=E.style.left,Dt=E.style.width,Fe=E.style.height;E.style.top="",E.style.left="",E.style.width="",E.style.height="";let Xe=window.getComputedStyle(E);Xe.top!=="auto"||Xe.bottom!=="auto"||Xe.left!=="auto"||Xe.right!=="auto"||Xe.width!=="0px"||Xe.height!=="0px"||(E.style.top=Y,E.style.left=Re,E.style.width=Dt,E.style.height=Fe)}let $=window.getComputedStyle(E),ne=$.position;if(ne!=="absolute"&&ne!=="fixed"&&(E.style.position="absolute"),!!E.style.top||!!E.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(E.style.top="0"),!!E.style.left||!!E.style.right||$.left!=="auto"||$.right!=="auto"||(E.style.left="0"),N!=="audio"){let Y=j(E.getAttribute("data-width")),Re=j(E.getAttribute("data-height")),Dt=$.width!=="0px"&&$.width!=="auto",Fe=$.height!=="0px"&&$.height!=="auto";Y?!E.style.width&&!Dt&&(E.style.width=Y):!E.style.width&&$.width==="0px"&&(E.style.width="100%"),Re?!E.style.height&&!Fe&&(E.style.height=Re):!E.style.height&&$.height==="0px"&&(E.style.height="100%")}}},B=c=>st({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:c}),G=null,W=c=>{let p=G;G=B(!0);try{return c()}finally{G=p}},Q=c=>c&&G?G:B(c),q=(c,p=0,g)=>Q(g?.includeAuthoredTimingAttrs??!0).resolveStartForElement(c,p),O=(c,p)=>Q(p?.includeAuthoredTimingAttrs??!0).resolveDurationForElement(c),V=c=>{let p=c.closest("[data-composition-id]"),g=p?q(p,0):null,y=p?O(p,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:p,inheritedStart:g,inheritedDuration:y}},Z=c=>Q(!0).resolveMediaStartForElement(c);window.__hfResolveMediaStartSeconds=Z,a.push(()=>{window.__hfResolveMediaStartSeconds===Z&&delete window.__hfResolveMediaStartSeconds});let pe=(c,p)=>{let g=c.tagName.toLowerCase();if(g==="script"||g==="style"||g==="link"||g==="meta")return!1;let E=g==="video"||g==="audio"?Z(c):q(c,0),N=O(c),P=c.getAttribute("data-composition-id");if(P){let Ee=(window.__timelines??{})[P],He=null;if(Ee&&typeof Ee.duration=="function"){let Y=Number(Ee.duration());Number.isFinite(Y)&&Y>0&&(He=Y)}!(c.hasAttribute("data-duration")||c.hasAttribute("data-end")||c.hasAttribute(Gs)||c.hasAttribute(Hs))&&(N==null||N<=0)&&He!=null&&(N=He)}let K=N!=null&&N>0?E+N:Number.POSITIVE_INFINITY,$=window.__HF_EXPORT_RENDER_SEEK_CONFIG?xa(E,e.canonicalFps):E,ne=window.__HF_EXPORT_RENDER_SEEK_CONFIG&&Number.isFinite(K)?xa(K,e.canonicalFps):K;return p>=$&&(Number.isFinite(ne)?p<ne:!0)},re=!!document.querySelector("[data-composition-src]"),z=!1;{let c=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let p of c){let g=p.getAttribute("data-composition-id");if(g&&p.children.length===0&&document.querySelector(`template#${CSS.escape(g)}-template`)){z=!0;break}}}let J=!re&&!z,Ae=c=>{if(!c||typeof c.duration!="function")return null;try{let p=Number(c.duration());return Number.isFinite(p)?Math.max(0,p):null}catch{return null}},ce=c=>typeof c=="number"&&Number.isFinite(c)&&c>M,Sn=()=>{let c=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));return c.length===0?null:W(()=>{let p=0;for(let g of c){let y=Z(g);if(!Number.isFinite(y))continue;let E=ri(g);E==null||E<=M||(p=Math.max(p,Math.max(0,y)+E))}return p>M?p:null})},it=()=>{let c=X();if(!c)return null;let p=window.__timelines??{},g=st({timelineRegistry:p,includeAuthoredTimingAttrs:!0}),y=0,E=Ce(c.getAttribute("data-duration"));E!=null&&E>0&&(y=E);let N=Array.from(c.querySelectorAll("[data-composition-id][data-start]"));for(let P of N){if(!Ne(P)||P.parentElement?.closest("[data-composition-id]")!==c)continue;let $=g.resolveStartForElement(P,0),ne=g.resolveDurationForElement(P);!Number.isFinite($)||ne==null||ne<=0||(y=Math.max(y,Math.max(0,$)+ne))}return y>M?y:null},yp=()=>{let c=Sn();return typeof c!="number"||!Number.isFinite(c)||c<=M?null:c},vp=c=>ce(c)?Math.max(M,c*S):M,Ys=()=>{let c=0;for(let p of e.deterministicAdapters){let g=p.getInferredDurationSeconds;if(typeof g!="function")continue;let y=null;try{y=g()}catch(E){L("runtime.init.adapterDuration",E)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(c=Math.max(c,y))}return c>M?c:null},Mr=!1,Xs=()=>Mr&&window.__HF_EXPORT_RENDER_SEEK_CONFIG!=null,Sp=["data-start","data-duration","data-end","data-composition-id","data-composition-src","data-composition-file","data-root","data-hf-authored-duration","data-hf-authored-end","data-hf-auto-start",ii,"data-playback-rate","data-playback-start","data-media-start","id","src"],Js=["loadedmetadata","durationchange","emptied"],Fr=null,Qs=-1,Zs=null,Mt=null,el=0,zt=()=>{},qt=()=>{el+=1,zt()},tl=()=>({media:yp(),authoredComposition:it()}),Ap=()=>{let c=window.__timelines??{},p="";for(let g of Object.keys(c)){let y=c[g];y&&(p+=`${g}=${Ae(y)??"?"};`)}return p},Ep=()=>{if(!(Mt||typeof MutationObserver>"u")){Mt=new MutationObserver(qt),Mt.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:Sp});for(let c of Js)document.addEventListener(c,qt,!0);a.push(()=>{Mt?.disconnect(),Mt=null,qt();for(let c of Js)document.removeEventListener(c,qt,!0)})}},Nr=()=>{Ep(),Mt&&Mt.takeRecords().length>0&&qt();let c=Ap();return c!==Zs&&(Zs=c,qt()),el},nl=c=>Mr?tl():(c??(c=Nr()),Fr&&Qs===c||(Qs=c,Fr=tl()),Fr),ot=(c,p=0,g)=>{let y=Ae(c),{media:E,authoredComposition:N}=nl(g),P=Ys(),K=Math.max(E??0,N??0,P??0),$=Number.isFinite(p)&&p>M?p:0,ne=0;return ce(y)?ne=Math.max(y,K,$):ce(K)?ne=Math.max(K,$):ne=$,ne>0?Math.max(0,ne):0},uo=()=>{let c=window.__timelines??{},p=de=>{let se=Object.entries(c).filter(me=>!!me[1]&&typeof me[1].play=="function"&&typeof me[1].pause=="function");if(se.length!==1)return{timeline:null};let ie=se[0];if(!ie)return{timeline:null};let[xe,we]=ie;return{timeline:we,selectedTimelineIds:[xe],selectedDurationSeconds:Ae(we),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:de,soleTimelineId:xe}}}},g=st({timelineRegistry:c,includeAuthoredTimingAttrs:!0}),{media:y,authoredComposition:E}=nl(),N=Math.max(y??0,E??0)||null,P=vp(N),K=de=>{let se=document.querySelector(`[data-composition-id="${CSS.escape(de)}"]`);return se?g.resolveStartForElement(se,0):0},$=de=>{let se=window.gsap;if(!se||typeof se.timeline!="function")return null;let ie=se.timeline({paused:!0});for(let xe of de)ie.add(xe.timeline,K(xe.compositionId));return ie},ne=(de,se)=>{if(!ce(de))return null;let ie=window.gsap;if(!ie||typeof ie.timeline!="function")return null;let xe=ie.timeline({paused:!0});if(se)try{xe.add(se,0)}catch(me){L("runtime.init.site2",me)}let we=xe;if(typeof we.to=="function")try{we.to({},{duration:de})}catch(me){L("runtime.init.site3",me)}return xe},Ee=(de,se)=>{if(!de||typeof de.getChildren!="function")return[];try{let ie=de.getChildren(!0,!0,!0);return Array.isArray(ie)?se.filter(xe=>ie.includes(xe.timeline)):[]}catch{return[]}},He=(de,se)=>{let ie=de,xe={addedIds:[],nested:[]};if(typeof ie.getChildren!="function")return xe;try{let we=ie.getChildren(!0,!0,!0)??[];if(!Array.isArray(we))return xe;let me=[];for(let _e of se)if(!we.some(at=>at===_e.timeline))try{let at=K(_e.compositionId);de.add(_e.timeline,at),me.push(_e.compositionId)}catch(at){L("runtime.init.site4",at)}return{addedIds:me,nested:Ee(de,se)}}catch{return xe}},ae=X(),Y=ae?.getAttribute("data-composition-id")??null;if(!Y)return p("root_missing_composition_id");let Re=c[Y]??null,Fe=(()=>{if(!ae)return[];let de=new Set,se=Array.from(ae.querySelectorAll("[data-composition-id]")),ie=[];for(let xe of se){let we=xe.getAttribute("data-composition-id");if(!we||we===Y||de.has(we))continue;de.add(we);let me=c[we]??null;if(!me||typeof me.play!="function"||typeof me.pause!="function")continue;let _e=Ae(me);ie.push({compositionId:we,timeline:me,durationSeconds:_e??0})}return ie})(),Xe=de=>{for(let se of de){let ie=se.timeline;if(typeof ie.paused=="function")try{ie.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(Re){let de=Fe.length>0?He(Re,Fe):{addedIds:[],nested:[]},se=de.addedIds;if(Xe(de.nested),(Fe.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+Y+"\'])"))&&(Lr=!0),se.length>0)try{let me=Re.time();Re.seek(me,!1)}catch{}let ie=Ae(Re);if(!ce(ie)&&Fe.length>0){let me=Fe.map(th=>th.compositionId),_e=$(Fe),jt=Ae(_e);if(_e&&ce(jt))return Xe(Ee(_e,Fe)),{timeline:_e,selectedTimelineIds:me,selectedDurationSeconds:jt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Y,rootDurationSeconds:ie,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:P,selectedDurationSeconds:jt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:E,selectedTimelineIds:me,autoNestedChildren:se}}};let at=ne(N??0,Re),Co=Ae(at);if(at&&ce(Co))return{timeline:at,selectedTimelineIds:[Y],selectedDurationSeconds:Co,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Y,rootDurationSeconds:ie,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:E,selectedDurationSeconds:Co,selectedTimelineIds:[Y],autoNestedChildren:se}}}}if(!ce(ie)&&Fe.length===0){let me=ne(N??0,Re),_e=Ae(me);if(me&&ce(_e))return{timeline:me,selectedTimelineIds:[Y],selectedDurationSeconds:_e,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Y,rootDurationSeconds:ie,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:E,selectedDurationSeconds:_e,selectedTimelineIds:[Y]}}}}let xe=Ce(ae?.getAttribute("data-duration")),we=Math.max(ce(xe)?xe:0,E??0);if(we>0&&ce(we)&&ce(ie)&&we>=ie+.5){let me=Re;if(typeof me.to=="function")try{me.to({},{duration:0},we)}catch(jt){L("runtime.init.site6",jt)}let _e=Ae(Re);if(ce(_e))return{timeline:Re,selectedTimelineIds:[Y],selectedDurationSeconds:_e,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Y,rootDurationSeconds:ie,rootDeclaredDur:xe,authoredCompositionDurationFloorSeconds:E,newDur:_e}}}}return{timeline:Re,selectedTimelineIds:[Y],selectedDurationSeconds:ie,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Y,selectedDurationSeconds:ie,autoNestedChildren:se}}:void 0}}if(Fe.length>0){let de=Fe.map(xe=>xe.compositionId),se=$(Fe),ie=Ae(se);if(se)return Xe(Ee(se,Fe)),{timeline:se,selectedTimelineIds:de,selectedDurationSeconds:ie,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Y,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:P,selectedDurationSeconds:ie,mediaDurationFloorSeconds:y,selectedTimelineIds:de}}}}return p("root_composition_id_unmatched_in_registry")},Lr=!1,wp=c=>{let p=window.gsap,g=c;if(!(!g||typeof g.getChildren!="function"||!p||typeof p.parseEase!="function"))for(let y of g.getChildren(!0,!0,!0)){let E=y,N=E.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let P=E.vars?.keyframes,$=(P&&!Array.isArray(P)?P.ease:void 0)??E.vars?.ease??"none";try{let ne=p.parseEase($);typeof ne=="function"&&(N._ease=ne)}catch(ne){Be("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",ne)}}},An=()=>{if(x(),!J)return!1;let c=e.capturedTimeline,p=Ae(c),g=ce(p);if(c&&g&&Lr)return!1;let y=uo();if(!y.timeline)return!1;if(c&&c===y.timeline)return typeof c.timeScale=="function"&&c.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),wp(e.capturedTimeline);let E=ot(e.capturedTimeline,0);if(E<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),rt(e.capturedTimeline)),E>0){try{f.setDuration(E)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let P=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(P,!1),rt(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),Hi(document)}if(y.diagnostics&&ve({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),ve({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=X(),P=E>0?E:0,K=String(P>0?P:1),$=new Set,ne=ae=>ae.tagName.toLowerCase()===Zt,Ee=new Set(document.querySelectorAll("[data-start]")),He=ae=>{let Y=ae.parentElement;for(;Y&&Y!==N;){if(Ee.has(Y))return!0;Y=Y.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let ae of e.capturedTimeline.getChildren(!0))if(typeof ae.targets=="function")for(let Y of ae.targets())Se(Y)&&Y!==N&&(ne(Y)||Y.hasAttribute("data-start")||He(Y)||$.has(Y)||($.add(Y),Y.setAttribute("data-start","0"),Y.setAttribute("data-duration",K),Y.setAttribute("data-hf-autostamped","1")))}catch{}if(Se(N))for(let ae of N.querySelectorAll("[id]"))Se(ae)&&ae!==N&&(ae.hasAttribute("data-start")||He(ae)||$.has(ae)||ae.tagName==="SCRIPT"||ae.tagName==="STYLE"||ae.tagName==="LINK"||ne(ae)||($.add(ae),ae.setAttribute("data-start","0"),ae.setAttribute("data-duration",K),ae.setAttribute("data-hf-autostamped","1")))}for(let N of En)Dr.delete(N),ul(N);return!0},rl=()=>{if(e.tornDown)return;let c=uo();if(!c.timeline){e.capturedTimeline=null,Lr=!1,f.setDuration(0),Hr(e.currentTime);return}e.capturedTimeline!==c.timeline&&(Lr=!1,An()),Hr(e.currentTime)};t=()=>{rl(),ht()},window.__hfForceTimelineRebind=rl;let _p=()=>{let c=X();if(!Se(c))return;let p=c.getBoundingClientRect(),g=Number(c.getAttribute("data-width")),y=Number(c.getAttribute("data-height")),E=window.getComputedStyle(c),N=Number.isFinite(g)&&g>0&&Number.isFinite(y)&&y>0,P=p.width<=0||p.height<=0||c.clientWidth<=0||c.clientHeight<=0;!N||!P||F("root_stage_layout_zero",{compositionId:c.getAttribute("data-composition-id")??null,declaredWidth:g,declaredHeight:y,rectWidth:Math.round(p.width),rectHeight:Math.round(p.height),clientWidth:c.clientWidth,clientHeight:c.clientHeight,display:E.display,visibility:E.visibility,overflow:E.overflow},`root-stage-layout-zero:${c.getAttribute("data-composition-id")??"unknown"}`)},Cp=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,_p()}))},Rp=()=>{i=c=>{let p=I(c.error??c.message).slice(0,R);if(!p)return;let g=H(p);ve({source:"hf-preview",type:"diagnostic",code:g.code,details:{category:g.category,message:p,filename:c.filename||null,line:Number.isFinite(c.lineno)?c.lineno:null,column:Number.isFinite(c.colno)?c.colno:null}})},o=c=>{let p=I(c.reason).slice(0,R);if(!p)return;let g=H(p);ve({source:"hf-preview",type:"diagnostic",code:`${g.code}_unhandled_rejection`,details:{category:`${g.category}-unhandled-rejection`,message:p}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tp=()=>{let c=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let g of c){let y=()=>{if(!Ne(g))return;let E=g.tagName.toLowerCase(),N=g.getAttribute("src")??g.getAttribute("href")??g.getAttribute("poster")??null,P=E==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";F(P,{tagName:E,assetUrl:N,currentSrc:(Oe(g)||ge(g))&&g.currentSrc||null,readyState:ge(g)?g.readyState:null,networkState:ge(g)?g.networkState:null},`${P}:${E}:${N??"unknown"}`)};g.addEventListener("error",y),C(()=>{g.removeEventListener("error",y)})}let p=document.fonts;p&&p.ready.then(()=>{if(e.tornDown)return;let g=Array.from(p).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);g.length!==0&&F("runtime_font_load_issue",{failedFamilies:g,totalFaces:Array.from(p).length},`runtime-font-load-issue:${g.join("|")}`)}).catch(()=>{})},kp=(c,p)=>{if(!c.timeline)return!1;let g=e.capturedTimeline;if(g&&g===c.timeline)return!1;let y=Math.max(0,e.currentTime||0),E=e.isPlaying;e.capturedTimeline=c.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{rt(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),E&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return ve({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:p,previousTime:y,selectedTimelineIds:c.selectedTimelineIds??[],selectedDurationSeconds:c.selectedDurationSeconds??null,mediaDurationFloorSeconds:c.mediaDurationFloorSeconds??null}}),!0},Ft=null,il=!1,En=new Set,Dr=new WeakMap,Ir=()=>{e.tornDown||(Ft!=null&&window.clearTimeout(Ft),Ft=window.setTimeout(()=>{if(e.tornDown||(Ft=null,Xs()))return;let c=uo();if(!c.timeline||!ce(c.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){An()&&(ht(),Pe(!0));return}if(il)return;let g=Ae(e.capturedTimeline),y=c.selectedDurationSeconds??Ae(c.timeline);ce(y)&&(!ce(g)||y>=g+A)&&kp(c,"manual")&&(il=!0,ve({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:g??null,selectedDurationSeconds:y??null,selectedTimelineIds:c.selectedTimelineIds??[],mediaDurationFloorSeconds:c.mediaDurationFloorSeconds??null}}),ht(),Pe(!0))},w))},ol=c=>{ge(c.currentTarget)&&Gu(c.currentTarget)},al=c=>{ge(c.currentTarget)&&Hu(c.currentTarget)},sl=c=>{Lo(c)&&bf(c)&&xn(c,bn(c))},ll=c=>{let p=c.currentTarget;ge(p)&&sl(p)},Mp=()=>{for(let c of En)c.removeEventListener("loadedmetadata",Ir),c.removeEventListener("durationchange",Ir),c.removeEventListener("loadedmetadata",ol),c.removeEventListener("loadedmetadata",ll),c.removeEventListener("error",al);En.clear()},co=()=>{if(e.tornDown)return;let c=Array.from(document.querySelectorAll("video, audio"));for(let p of c){if(En.has(p))continue;En.add(p);let g=Number.parseFloat(p.dataset.volume??"");Number.isFinite(g)&&(p.volume=Math.max(0,Math.min(1,g))),p.addEventListener("loadedmetadata",Ir),p.addEventListener("durationchange",Ir),p.addEventListener("loadedmetadata",ll),sl(p),p.addEventListener("loadedmetadata",ol),p.addEventListener("error",al),Ou(p),p.preload!=="auto"&&(p.preload="auto"),p.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&p.load(),ul(p)}},ul=c=>{Dr.has(c)||bu(c,e.capturedTimeline,ot(e.capturedTimeline,0),Dr,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},mo=new WeakMap,Fp=c=>{let p=mo.get(c);if(p!==void 0)return p;let g=window.getComputedStyle(c).position,y=g==="static"||g==="relative"||g==="sticky";return mo.set(c,y),y},fo=new WeakMap,Np=c=>{let p=fo.get(c);if(p!==void 0)return p;let g=c.querySelector("[data-start]")===null;return fo.set(c,g),g},Lp=()=>{mo=new WeakMap,fo=new WeakMap},po=new WeakSet,ho=new WeakMap,Pr=new WeakSet,Or=!1,cl=c=>c.matches("audio[data-start]")||c.querySelector("audio[data-start]")!==null,dl=new WeakMap,Gr=!0,Dp=()=>{if(Gr){Gr=!1;for(let c of document.querySelectorAll(Zt)){let p=c.hasAttribute("data-hidden");dl.get(c)!==p&&(dl.set(c,p),c.id&&m.setGroupMuted(c.id,p))}}},Ip=(c,p)=>{let g=X();for(let y of p){if(!Se(y))continue;if(y.hasAttribute("data-hidden")){Pr.has(y)||(ho.set(y,y.style.getPropertyValue("display")),Pr.add(y),cl(y)&&(Or=!0),Gr=!0),y.style.display="none",(fe(y)||Oe(y))&&r?.setSourceVisibility(y,!1);continue}if(Pr.has(y)){let N=ho.get(y);N?y.style.display=N:y.style.removeProperty("display"),ho.delete(y),Pr.delete(y),cl(y)&&(Or=!0),Gr=!0}let E=pe(y,c);if(E){let N=y.parentElement;for(;N&&N!==g;){if(Se(N)&&N.hasAttribute("data-start")&&!pe(N,c)){E=!1;break}N=N.parentElement}}y.style.visibility=E?"visible":"hidden",(fe(y)||Oe(y))&&r?.setSourceVisibility(y,E),E?po.has(y)&&(y.style.removeProperty("display"),po.delete(y)):Fp(y)&&Np(y)&&(y.style.display="none",po.add(y))}Or&&f.isPlaying()&&(m.stopAll(),wo()),Or=!1,Dp()},Hr=(c,p=Array.from(document.querySelectorAll("[data-start]")))=>W(()=>Ip(c,p)),wn=null,_n=null,Br=[],ml=c=>c.hasAttribute("data-start")||!!V(c).compositionRoot,go=c=>Nu({elements:c,shouldIncludeElement:ml,resolveStartSeconds:p=>Z(p),resolveDurationSeconds:p=>{let g=V(p),y=Z(p),E=g.inheritedStart!=null&&g.inheritedDuration!=null&&g.inheritedDuration>0?Math.max(0,g.inheritedStart+g.inheritedDuration-y):null,N=Number.isFinite(p.duration)?xt(p,p.duration):null,P=Ce(p.dataset.duration),K=P!=null&&P>0?P:null;return Fu({isVideo:p.tagName==="VIDEO",sourceDuration:N,hostRemaining:E,explicitDuration:K})}}),Pp=()=>{let c=Nr();if(wn&&wn.revision===c)return wn;let p=go().mediaClips;return wn={revision:c,clips:p,byStart:[...p].sort((g,y)=>g.start-y.start),byEnd:[...p].sort((g,y)=>g.end-y.end)},_n=null,Br=[],wn},fl=(c,p,g,y)=>{let E=0,N=c.length;for(;E<N;){let K=E+N>>1;p(c[K])<g?E=K+1:N=K}let P=[];for(let K=E;K<c.length&&p(c[K])<=y;K+=1)P.push(c[K]);return P},Op=(c,p)=>{let g=_n;if(g===null)return c.clips.map(P=>P.el);let y=Math.min(g,p),E=Math.max(g,p),N=new Set;for(let P of Br)N.add(P.el);for(let P of fl(c.byStart,K=>K.start,y,E))N.add(P.el);for(let P of fl(c.byEnd,K=>K.end,y,E))N.add(P.el);return[...N]},Ur=new WeakSet,pl=c=>{Ur.add(c)},hl=c=>{Ur.delete(c)};window.__hf.leasePausedMedia=pl,window.__hf.releasePausedMedia=hl;let Gp=()=>{for(let c of document.querySelectorAll("video, audio"))if(ge(c)&&!c.paused&&ml(c)&&!Ur.has(c))return!0;return!1},gl=()=>zt();document.addEventListener("play",gl,!0),a.push(()=>{document.removeEventListener("play",gl,!0)});let Ge=()=>{let c=!Mr,p=W(()=>{if(!c)return go().mediaClips;let E=Pp();return go(Op(E,e.currentTime)).mediaClips});for(let E of p){let N=Dr.get(E.el);N&&(E.volumeKeyframes=N)}let g=e.isPlaying?p:p.filter(E=>!Ur.has(E.el)),y=e.mediaForceSyncNextTick;y&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||(Lu({clips:g,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:y,onElementVolume:(E,N,P)=>m.setElementVolume(E,P),isWebAudioOwned:E=>m.ownsElement(E),isWebAudioRouted:E=>m.routesElement(E),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,ve({source:"hf-preview",type:"media-autoplay-blocked"}))}}),c?(_n=e.currentTime,Br=p.filter(E=>e.currentTime>=E.start&&e.currentTime<E.end)):(_n=null,Br=[])),Hr(e.currentTime)},Pe=c=>{c&&zt();let p=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),g=Date.now();(c||p!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||g-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=p,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=g,ve({source:"hf-preview",type:"state",frame:p,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},bo="",bl=0,Hp=()=>{let c="";for(let p of document.querySelectorAll("[data-start]"))c+=`${p.id}:${p.tagName}|`;return c},ht=()=>{U(),k(),te();let c=X();if(c){let y=j(c.getAttribute("data-width")),E=j(c.getAttribute("data-height")),N=y?parseInt(y,10):0,P=E?parseInt(E,10):0;N>0&&P>0&&ve({source:"hf-preview",type:"stage-size",width:N,height:P})}An();let p=Ac({canonicalFps:e.canonicalFps});window.__clipManifest=p;let g=Hp();if(bo!==g&&Lp(),!window.__clipTree||bo!==g){let y=window;window.__clipTree=xc({startResolver:st({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:p.durationInFrames/e.canonicalFps}),bo=g}ve(p),Cp()},xo=c=>typeof c=="number"&&Number.isFinite(c)&&c>0?c:0,Bp=c=>{let p=xo(Number(c));if(p<=0)return;let g=X(),y=xo(Ce(g?.getAttribute("data-duration"))),E=Math.max(bl,xo(f.getDuration()),y);p<=E||(bl=p,g?.setAttribute("data-duration",String(p)),f.setDuration(p),ht(),Pe(!0))},ze=(c,p=0)=>{for(let g of e.deterministicAdapters){try{c==="discover"&&g.discover(),c==="pause"&&g.pause(),c==="play"&&g.play&&g.play()}catch(y){L("runtime.init.site8",y)}if(c==="discover")try{g.seek({time:p,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},Nt=()=>{window.__renderReady=!1},Cn=null,Rn=!0,Up=()=>{let c=[];for(let p of e.deterministicAdapters){let g=p.getReadyPromise;if(typeof g=="function")try{let y=g();y&&c.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return c},Wp=()=>{let c=Up();if(c.length===0)return Cn=null,Rn=!0,!0;let p=c[0];if(!p)return!0;let g=c.length===1?p:Promise.all(c);return g!==Cn&&(Cn=g,Rn=!1,Promise.resolve(g).then(()=>{Cn===g&&(Rn=!0,Nt())},y=>{Cn===g&&(Rn=!0,L("runtime.init.adapterReady",y),Nt())})),Rn};if(J)os();else{let c={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:j,onDiagnostic:({code:p,details:g})=>{ve({source:"hf-preview",type:"diagnostic",code:p,details:g})}};fm(c).then(()=>mm(c)).finally(()=>{J=!0,co(),Tp(),os(),ms(document),Nt()})}let Wr=fc({postMessage:c=>ve(c)});Wr.installPickerApi(),Hr(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let Ye=Qm({lease:pl,release:hl});r=Ye,C(()=>{Ye.destroy(),r=null});let yo=c=>{let p=Number(c);!Number.isFinite(p)||p<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,p)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let g=document.querySelectorAll("video, audio");for(let y of g)if(ge(y))try{y.playbackRate=e.playbackRate}catch(E){L("runtime.init.site10",E)}},xl={play:()=>{let c=e.capturedTimeline;if(f.isPlaying())return;let p=ot(c,0);if(p>0)f.setDuration(p),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Lt(0));else{let g=X(),y=Number(g?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}rt(c),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Rl(f.now()),h&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&wo(),ze("play"),Ge(),Ye.redraw(),Pe(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Rl(e.currentTime);let c=e.capturedTimeline;rt(c),ze("pause"),Ge(),Ye.redraw(),Pe(!0)},seek:(c,p)=>{let g=on(Math.max(0,Number(c)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(g),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let E=e.capturedTimeline;if(rt(E),Lt(e.currentTime),ze("pause"),p?.keepPlaying&&y){xl.play();return}Ge(),Ye.redraw(),Pe(!0)},renderSeek:(c,p)=>{Mr=!0;let g=on(Math.max(0,Number(c)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(g),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Lt(e.currentTime,{activateChildren:!0,suppressEvents:p?.suppressEvents}),ze("pause"),Ge(),Ye.redraw(),Pe(!0)},getTime:()=>f.now(),getDuration:()=>{let c=f.getDuration();return Number.isFinite(c)?c:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:c=>{yo(c),f.setRate(e.playbackRate),Tl()},getPlaybackRate:()=>e.playbackRate},yl=ot(e.capturedTimeline,0);yl>0&&f.setDuration(yl);let qe=gc({getTimeline:()=>e.capturedTimeline,setTimeline:c=>{e.capturedTimeline=c},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:c=>{e.isPlaying!==c&&(e.mediaForceSyncNextTick=!0),e.isPlaying=c},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:yo,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(c,p)=>{e.currentTime=Math.max(0,Number(c)||0),e.isPlaying!==p&&(e.mediaForceSyncNextTick=!0),e.isPlaying=p,Ge()},onStatePost:Pe,onDeterministicSeek:(c,p)=>{for(let g of e.deterministicAdapters)if(!(g.name==="gsap"&&e.capturedTimeline))try{g.seek({time:Number(c)||0,suppressEvents:p?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>ze("pause"),onDeterministicPlay:()=>ze("play"),onRenderFrameSeek:()=>{Ye.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>ot(e.capturedTimeline,0),transport:xl});window.__player=D(qe),window.__playerReady=!0,Be("composition_loaded",{duration:qe.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[uu(),ql({resolveStartSeconds:c=>q(c,0)}),jl(),Yl(),Ql(),Zl(),eu(),tu(),nu(),ru(),iu(),$l({getTimeline:()=>e.capturedTimeline})],su(),lu(),window.__hfReseekGpu=c=>{let p=Math.max(0,Number(c)||0);window.__hfThreeTime=p,window.__hfTypegpuTime=p,ei(p)},window.__hfWaitForSeekCompletion=Ho,a.push(()=>{window.__hfWaitForSeekCompletion===Ho&&delete window.__hfWaitForSeekCompletion}),Rp(),co(),ze("discover");let Vp=()=>{let c=e.capturedTimeline,p=An();e.capturedTimeline&&(p||e.capturedTimeline!==c||!qe._timeline)&&(qe._timeline=e.capturedTimeline);let g=ot(e.capturedTimeline,0);if(g>0&&f.setDuration(g),ze("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},E=Object.keys(y).filter(N=>y[N]);if(E.length>0){let P=X()?.getAttribute("data-composition-id")??null;F("root_timeline_unbound_registry_present",{reason:P?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:P,registeredTimelineKeys:E},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(P?`Root data-composition-id is "${P}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${E.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${P??"<root-id>"}"] = tl).`)}}window.__renderReady=!0,ht(),Pe(!0)},$t=null,zp=()=>{if($t)return;let c=()=>{window.removeEventListener("hf-timelines-built",c),$t=null,Nt()};$t=c,window.addEventListener("hf-timelines-built",c)};C(()=>{$t&&(window.removeEventListener("hf-timelines-built",$t),$t=null)}),Nt=()=>{if(!J){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,zp();return}if(ze("discover",e.currentTime),!Wp()){window.__renderReady=!1;return}Vp()},Nt(),J&&setTimeout(()=>{Nt()},0);let Vr=0,zr=!1,vo=Number.NaN,So=null,qr=!1,gt=null,$r=!1,vl="",Sl=-1,jr=!1,Al=Number.NEGATIVE_INFINITY,qp=(c,p,g,y)=>{try{let E=y?.suppressEvents===!0;rt(c),typeof c.totalTime=="function"?c.totalTime(p,E):c.seek(p,E)}catch(E){L(g,E)}},$p=(c,p)=>{let g=window.__timelines??{},y=X()?.getAttribute("data-composition-id")??null;for(let[E,N]of Object.entries(g)){if(!N||E===y)continue;let P=document.querySelector(`[data-composition-id="${CSS.escape(E)}"]`);if(!P)continue;let K=q(P,0);if(!Number.isFinite(K))continue;let $=Ae(N),ne=Qe(P)+Math.max(0,c-K)*Le(P),Ee=Math.max(0,$!=null&&$>0?Math.min($,ne):ne);qp(N,Ee,"runtime.init.transport.childTimeline",p)}},jp=c=>{let p=window.__timelines??{},g=[];for(let y of Object.values(p))if(!(!y||y===c)){g.push(y);try{y.play()}catch(E){L("runtime.init.activateSiblings",E)}}return g},El=c=>typeof c=="object"&&c!==null,Tn=new WeakMap,Kp=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],wl=(c,p)=>{let g=c[p];if(typeof g!="function")return null;try{let y=Number(g.call(c));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Yp=c=>{let p=Tn.get(c);if(p!=null)return p;if(!("getChildren"in c)||typeof c.getChildren!="function")return!1;let g;try{g=c.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),Tn.set(c,!1),!1}if(!Array.isArray(g))return Tn.set(c,!1),!1;for(let y of g){if(!El(y))continue;let E=y.vars;if(!El(E)||!Kp.some($=>typeof E[$]=="function"))continue;let K=wl(y,"totalDuration")??wl(y,"duration");if(K!=null&&K<=1e-6)return Tn.set(c,!0),!0}return Tn.set(c,!1),!1};function Lt(c,p){let g=e.capturedTimeline,y=g&&p?.activateChildren?jp(g):[];try{Xp(g,c,p)}finally{for(let E of y)rt(E)}}function Xp(c,p,g){let y=g?.suppressEvents===!0;if(c){let E=c,N=p;if(typeof E.totalDuration=="function")try{let P=Number(E.totalDuration());Number.isFinite(P)&&P>0&&p>P&&(N=P)}catch(P){L("runtime.init.transport.clampDuration",P)}try{typeof c.totalTime=="function"?(c.totalTime(N,y),!y&&!Yp(c)&&(c.totalTime(N+.001,!0),c.totalTime(N,!0))):c.seek(N,y)}catch(P){L("runtime.init.transport.seek",P)}}$p(p,g);for(let E of e.deterministicAdapters)if(!(E.name==="gsap"&&c))try{E.seek({time:p,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Ao=vf(document,()=>{zt()});a.push(()=>Ao.disconnect());let Jp=()=>{try{return Ao.isActive()}catch{return!1}},Qp=()=>!f.isPlaying()&&!Xs()&&Ao.observing&&!qr&&!jr&&e.currentTime===vo&&e.capturedTimeline===So,_l=()=>`${Nr()}|${Ys()??""}`,Cl=()=>{gt=window.setTimeout(Zp,e.bridgeMaxPostIntervalMs)},Zp=()=>{if(gt=null,!e.tornDown&&!(typeof window>"u"||typeof document>"u")){if(_l()!==vl){zt();return}Pe(!1),Cl()}},eh=()=>{if(e.transportRafId=null,e.tornDown)return;let c=$r;if($r=!1,c||!Qp()){e.transportRafId=window.requestAnimationFrame(Eo);return}vl=_l(),Cl()};zt=()=>{e.tornDown||($r=!0,!(zr||e.transportRafId!=null)&&(gt!=null&&(window.clearTimeout(gt),gt=null),$r=!1,e.transportRafId=window.requestAnimationFrame(Eo)))};let Eo=()=>{if(!(e.tornDown||zr)){zr=!0;try{Vr+=1;let c=Nr();c!==Sl&&(Sl=c,jr=!0);let p=Date.now(),g=jr&&!f.isPlaying()&&p-Al>=Sf;if(g&&(Al=p),Af({tick:Vr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now(),compositionChanged:g})){let P=e.capturedTimeline;if(An()){e.capturedTimeline&&!qe._timeline&&(qe._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==P&&rt(e.capturedTimeline);let K=ot(e.capturedTimeline,0,c);K>0&&f.setDuration(K),ht()}}if((g||Vr%20===0)&&(ht(),jr=!1),(g||Vr%30===0)&&co(),e.capturedTimeline){let P=ot(e.capturedTimeline,0,c);P>0&&(!f.isPlaying()||P>=f.getDuration())&&f.setDuration(P)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let P=m.getTime();P>=0&&f.attachAudioSource({currentTimeSeconds:P})}else{let P=document.querySelectorAll("audio[data-start]"),K=!1;for(let $ of P){if(!ge($)||!$.isConnected||b($))continue;let ne=Z($),Ee=Ce($.dataset.duration),He=Ee!=null&&Ee>0?ne+Ee:1/0,ae=Qe($);if(Number.isFinite(ne)&&e.currentTime>=ne&&e.currentTime<He){$.paused?!$.error&&$.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(f.attachAudioSource({currentTimeSeconds:e.currentTime}),K=!0):(f.attachAudioSource({el:$,compositionStart:ne,mediaStart:ae}),K=!0);break}}!K&&f.hasAudioSource()&&f.detachAudioSource()}else f.hasAudioSource()&&f.detachAudioSource();let y=f.now();e.currentTime=y;let E=f.isPlaying();if(!E&&Jp()?qr=!0:(E||qr||y!==vo||e.capturedTimeline!==So)&&(Lt(y),vo=y,So=e.capturedTimeline,E||(qr=!1)),E&&Ye.redrawAnimated(),f.isPlaying()&&f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let P=f.getDuration();Number.isFinite(P)&&(f.seek(P),e.currentTime=P,Lt(P)),ze("pause"),Ge(),Pe(!0);return}f.isPlaying()?Ge():Gp()&&(_n=null,Ge()),Pe(!1)}finally{zr=!1,eh()}}},Rl=c=>{let p=document.querySelectorAll("video, audio");for(let g of p){if(!ge(g)||!g.isConnected||!g.hasAttribute("data-start"))continue;let y=Z(g);if(!Number.isFinite(y))continue;let E=Ce(g.dataset.duration),N=E!=null&&E>0?y+E:1/0;if(c<y||c>=N)continue;let P=Qe(g),K=c-y+P;if(K>=0)try{g.currentTime=K}catch{}}},wo=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let c=m.startGeneration(),p=document.querySelectorAll("audio[data-start]");for(let g of p){if(!ge(g)||!g.isConnected||b(g))continue;let y=Z(g);if(!Number.isFinite(y))continue;let E=Qe(g),N=Number.parseFloat(g.dataset.volume??""),P=Number.isFinite(N)?N:1,K=Ce(g.dataset.duration),$=K!=null&&K>0?K:Number.POSITIVE_INFINITY,ne=g.closest("[data-composition-id]");if(ne){let ae=q(ne,0),Y=O(ne,{includeAuthoredTimingAttrs:!0});Y!=null&&Y>0&&($=Math.min($,Math.max(0,ae+Y-y)))}let Ee=bn(g);xn(g,Ee),(Ee.kind==="web-audio"?m.scheduleMediaElementPlayback(g,y,E,f.now(),P,c,e.playbackRate):Promise.resolve(null)).then(ae=>{if(ae||!f.isPlaying())return;let Y=e.playbackRate*Le(g),Re=g.hasAttribute("data-fx-chain")||g.hasAttribute("data-automation");if(Math.abs(Y-1)>1e-9){Ee.kind==="web-audio"&&Re&&(g.muted=!0);return}m.decodeAudioElement(g).then(Dt=>{!Dt||!f.isPlaying()||m.schedulePlayback(g,Dt,y,E,f.now(),P,c,e.playbackRate,$)})})}};function Tl(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&h&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),wo())}if(e.capturedTimeline){let c=ot(e.capturedTimeline,0);c>0&&f.setDuration(c),rt(e.capturedTimeline)}ym(window),e.transportRafId=window.requestAnimationFrame(Eo),ht(),Pe(!0),e.controlBridgeHandler=Nl({onPlay:()=>{qe.play(),Be("composition_played",{time:qe.getTime()})},onPause:()=>{qe.pause(),Be("composition_paused",{time:qe.getTime()})},onStopMedia:()=>{m.stopAll();let c=document.querySelectorAll("video, audio");for(let p of c)ge(p)&&!p.paused&&p.pause()},onSeek:(c,p)=>{qe.seek(c),Be("composition_seeked",{time:c})},onSetMuted:c=>{e.bridgeMuted=c;let p=c||e.mediaOutputMuted;m.setMuted(p);let g=document.querySelectorAll("video, audio");for(let y of g)ge(y)&&(y.muted=p||y.defaultMuted)},onSetVolume:c=>{e.bridgeVolume=c,m.setVolume(c);let p=document.querySelectorAll("video, audio");for(let g of p){if(!ge(g))continue;let y=parseFloat(g.dataset.volume??""),E=Number.isFinite(y)?y:1;g.volume=ti(E*c)}},onSetMediaOutputMuted:c=>{e.mediaOutputMuted=c;let p=c||e.bridgeMuted;m.setMuted(p);let g=document.querySelectorAll("video, audio");for(let y of g)ge(y)&&(y.muted=p||y.defaultMuted)},onSetNativeMediaSyncDisabled:c=>{e.nativeMediaSyncDisabled!==c&&(e.nativeMediaSyncDisabled=c,e.mediaForceSyncNextTick=!0,c?(m.stopAll(),f.detachAudioSource()):Ge())},onSetWebAudioMediaDisabled:c=>{e.webAudioMediaDisabled!==c&&(e.webAudioMediaDisabled=c,e.mediaForceSyncNextTick=!0,c&&(m.stopAll(),f.detachAudioSource()),Ge())},onSetPlaybackRate:c=>{yo(c),e.transportClock&&e.transportClock.setRate(e.playbackRate),Tl()},onSetRootDuration:Bp,onSetColorGrading:(c,p)=>{Ye.setGrading(c,p)},onSetColorGradingCompare:(c,p)=>{Ye.setCompare(c,p)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let c=f.now();if(e.currentTime=c,Lt(c),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let p=f.getDuration();Number.isFinite(p)&&(f.seek(p),e.currentTime=p,Lt(p)),ze("pause"),Ge(),Pe(!0)}},onEnablePickMode:()=>Wr.enablePickMode(),onDisablePickMode:()=>Wr.disablePickMode(),onSetRuntimeData:eo,onClearRuntimeData:to,getCanonicalFps:()=>e.canonicalFps});let _o=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),gt!=null&&(window.clearTimeout(gt),gt=null),e.transportClock=null,m.destroy(),Ft!=null&&(window.clearTimeout(Ft),Ft=null),s!=null&&(window.cancelAnimationFrame(s),s=null),Mp(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Wr.disablePickMode();for(let c of e.deterministicAdapters)if(!(!c||typeof c.revert!="function"))try{c.revert()}catch(p){L("runtime.init.site12",p)}e.deterministicAdapters=[];for(let c of a.splice(0))try{c()}catch(p){L("runtime.init.site13",p)}for(let c of e.injectedCompStyles)try{c.remove()}catch(p){L("runtime.init.site14",p)}e.injectedCompStyles=[];for(let c of e.injectedCompLinks)try{c.remove()}catch(p){L("runtime.init.site15",p)}e.injectedCompLinks=[];for(let c of e.injectedCompScripts)try{c.remove()}catch(p){L("runtime.init.site16",p)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===_o&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=_o,e.beforeUnloadHandler=_o,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Hf=["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"],Bs=[[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 Hv(e){if(e<=255)return Hf[e];let t=0,n=Bs.length-1;for(;t<=n;){let r=t+n>>1,i=Bs[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function Bv(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u<t;){let d=e.charCodeAt(u),f=d,m=1;if(d>=55296&&d<=56319&&u+1<t){let b=e.charCodeAt(u+1);b>=56320&&b<=57343&&(f=(d-55296<<10)+(b-56320)+65536,m=2)}let h=Hv(f);(h==="R"||h==="AL"||h==="AN")&&(r=!0);for(let b=0;b<m;b++)n[u+b]=h;u+=m}if(!r)return null;let i=0;for(let u=0;u<t;u++){let d=n[u];if(d==="L"){i=0;break}if(d==="R"||d==="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 d=n[u];d==="EN"?n[u]=s==="AL"?"AN":"EN":(d==="R"||d==="L"||d==="AL")&&(s=d)}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 d;for(d=u-1;d>=0&&n[d]==="ET";d--)n[d]="EN";for(d=u+1;d<t&&n[d]==="ET";d++)n[d]="EN"}for(let u=0;u<t;u++){let d=n[u];(d==="WS"||d==="ES"||d==="ET"||d==="CS")&&(n[u]="ON")}s=l;for(let u=0;u<t;u++){let d=n[u];d==="EN"?n[u]=s==="L"?"L":"EN":(d==="R"||d==="L")&&(s=d)}for(let u=0;u<t;u++){if(n[u]!=="ON")continue;let d=u+1;for(;d<t&&n[d]==="ON";)d++;let f=u>0?n[u-1]:l,m=d<t?n[d]:l,h=f!=="L"?"R":"L";if(h===(m!=="L"?"R":"L"))for(let v=u;v<d;v++)n[v]=h;u=d-1}for(let u=0;u<t;u++)n[u]==="ON"&&(n[u]=a);for(let u=0;u<t;u++){let d=n[u];(o[u]&1)===0?d==="R"?o[u]++:(d==="AN"||d==="EN")&&(o[u]+=2):(d==="L"||d==="AN"||d==="EN")&&o[u]++}return o}function Bf(e,t){let n=Bv(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 Uv=/[ \\t\\n\\r\\f]+/g,Wv=/[\\t\\n\\r\\f]| {2,}|^ | $/;function Vv(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function zv(e){if(!Wv.test(e))return e;let t=e.replace(Uv," ");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 qv(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var Us=null,$v;function jv(){return Us===null&&(Us=new Intl.Segmenter($v,{granularity:"word"})),Us}var Kv=/\\p{Script=Arabic}/u,no=/\\p{M}/u,Kf=/\\p{Nd}/u;function Uf(e){return Kv.test(e)}function Wf(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 Ke(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(Wf(i))return!0;t++;continue}}if(Wf(n))return!0}}return!1}function Yv(e){let t=oo(e);return t!==null&&(io.has(t)||Rt.has(t))}var Xv=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Jv(e){return Ke(e)}function Qv(e){let t=oo(e);return t!==null&&Xv.has(t)}function ro(e){return!Yv(e)&&!Qv(e)}var io=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"]),kr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Vs=new Set(["\'","\\u2019"]),Rt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Zv=new Set([":",".","\\u060C","\\u061B"]),e1=new Set(["\\u104F"]),t1=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function n1(e){if(zs(e))return!0;let t=!1;for(let n of e){if(Rt.has(n)){t=!0;continue}if(!(t&&no.test(n)))return!1}return t}function r1(e){for(let t of e)if(!io.has(t)&&!Rt.has(t))return!1;return e.length>0}function i1(e){if(zs(e))return!0;for(let t of e)if(!kr.has(t)&&!Vs.has(t)&&!no.test(t))return!1;return e.length>0}function zs(e){let t=!1;for(let n of e)if(!(n==="\\\\"||no.test(n))){if(kr.has(n)||Rt.has(n)||Vs.has(n)){t=!0;continue}return!1}return t}function Yf(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 oo(e){if(e.length===0)return null;let t=Yf(e,e.length);return e.slice(t)}function o1(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(no.test(r)){n--;continue}if(kr.has(r)||Vs.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function a1(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function Vf(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 zf(e,t){return e&&t!==null&&Zv.has(t)}function s1(e){let t=oo(e);return t!==null&&e1.has(t)}function l1(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 ao(e){let t=e.length;for(;t>0;){let n=Yf(e,t),r=e.slice(n,t);if(t1.has(r))return!0;if(!Rt.has(r))return!1;t=n}return!1}function u1(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 c1=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ve(e){return e.length===1?e[0]:e.join("")}function d1(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ve(n)}function m1(e,t,n,r){if(!c1.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let d of e){let f=u1(d,r),m=f==="text"&&t;if(o!==null&&f===o&&m===s){a.push(d),u+=d.length;continue}o!==null&&i.push({text:Ve(a),isWordLike:s,kind:o,start:l}),o=f,a=[d],l=n+u,s=m,u+=d.length}return o!==null&&i.push({text:Ve(a),isWordLike:s,kind:o,start:l}),i}function Ws(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var f1=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function p1(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:f1.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function h1(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function g1(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"||!p1(e,a))continue;let l=[t[a]],s=a+1;for(;s<e.len&&!Ws(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]=Ve(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 b1(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]),!h1(a))continue;let l=o+1;if(l>=e.len||Ws(e.kinds[l]))continue;let s=[],u=e.starts[l],d=l;for(;d<e.len&&!Ws(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(t.push(Ve(s)),n.push(!0),r.push("text"),i.push(u),o=d-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var x1=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),qf=/^[A-Za-z0-9_]+[,:;]*$/,$f=/[,:;]+$/;function Xf(e){for(let t of e)if(Kf.test(t))return!0;return!1}function Tr(e){if(e.length===0)return!1;for(let t of e)if(!(Kf.test(t)||x1.has(t)))return!1;return!0}function y1(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"&&Tr(a)&&Xf(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&Tr(e.texts[u]);)s.push(e.texts[u]),u++;t.push(Ve(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 v1(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&&qf.test(a)){let u=[a],d=$f.test(a),f=o+1;for(;d&&f<e.len&&e.kinds[f]==="text"&&e.isWordLike[f]&&qf.test(e.texts[f]);){let m=e.texts[f];u.push(m),d=$f.test(m),f++}t.push(Ve(u)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=f-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 S1(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 d=l[u];if(!s)break;(d.length===0||!Xf(d)||!Tr(d))&&(s=!1)}if(s){let u=0;for(let d=0;d<l.length;d++){let f=l[d],m=d<l.length-1?`${f}-`:f;t.push(m),n.push(!0),r.push("text"),i.push(e.starts[o]+u),u+=m.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 A1(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 d=[a[0]],f=u;for(o++;o<e.len&&e.kinds[o]==="glue";)d.push(e.texts[o]),o++;let m=Ve(d);if(o<e.len&&e.kinds[o]==="text")a[0]=m,a.push(e.texts[o]),l=e.isWordLike[o],s="text",u=f,o++;else{t.push(m),n.push(!1),r.push("glue"),i.push(f);continue}}else o++;if(s==="text")for(;o<e.len&&e.kinds[o]==="glue";){let d=[];for(;o<e.len&&e.kinds[o]==="glue";)d.push(e.texts[o]),o++;let f=Ve(d);if(o<e.len&&e.kinds[o]==="text"){a.push(f,e.texts[o]),l=l||e.isWordLike[o],o++;continue}a.push(f)}t.push(Ve(a)),n.push(l),r.push(s),i.push(u)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function E1(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"||!Ke(t[o])||!Ke(t[o+1]))continue;let a=o1(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 jf(e,t,n){let r=jv(),i=0,o=[],a=[],l=[],s=[],u=[],d=[],f=[],m=[],h=[],b=[],v=[],x=[];for(let M of r.segment(e))for(let S of m1(M.segment,M.isWordLike??!1,M.index,n)){let U=function(){d[k]!==null&&(a[k]=[Vf(o,d,f,k)],d[k]=null),a[k].push(S.text),l[k]=l[k]||S.isWordLike,m[k]=m[k]||R,h[k]=h[k]||I,b[k]=j,v[k]=X,x[k]=zf(h[k],H)},A=S.kind==="text",w=a1(S.text,S.isWordLike,S.kind),R=Ke(S.text),I=Uf(S.text),H=oo(S.text),j=ao(S.text),X=s1(S.text),k=i-1;t.carryCJKAfterClosingQuote&&A&&i>0&&s[k]==="text"&&R&&m[k]&&b[k]||A&&i>0&&s[k]==="text"&&r1(S.text)&&m[k]||A&&i>0&&s[k]==="text"&&v[k]?U():A&&i>0&&s[k]==="text"&&S.isWordLike&&I&&x[k]?(U(),l[k]=!0):w!==null&&i>0&&s[k]==="text"&&d[k]===w?f[k]=(f[k]??1)+1:A&&!S.isWordLike&&i>0&&s[k]==="text"&&(n1(S.text)||S.text==="-"&&l[k])?U():(o[i]=S.text,a[i]=[S.text],l[i]=S.isWordLike,s[i]=S.kind,u[i]=S.start,d[i]=w,f[i]=w===null?0:1,m[i]=R,h[i]=I,b[i]=j,v[i]=X,x[i]=zf(I,H),i++)}for(let M=0;M<i;M++){if(d[M]!==null){o[M]=Vf(o,d,f,M);continue}o[M]=Ve(a[M])}for(let M=1;M<i;M++)s[M]==="text"&&!l[M]&&zs(o[M])&&s[M-1]==="text"&&(o[M-1]+=o[M],l[M-1]=l[M-1]||l[M],o[M]="");let _=Array.from({length:i},()=>null),T=-1;for(let M=i-1;M>=0;M--){let S=o[M];if(S.length!==0){if(s[M]==="text"&&!l[M]&&i1(S)&&T>=0&&s[T]==="text"){let A=_[T]??[];A.push(S),_[T]=A,u[T]=u[M],o[M]="";continue}T=M}}for(let M=0;M<i;M++){let S=_[M];S!=null&&(o[M]=d1(S,o[M]))}let C=0;for(let M=0;M<i;M++){let S=o[M];S.length!==0&&(C!==M&&(o[C]=S,l[C]=l[M],s[C]=s[M],u[C]=u[M]),C++)}o.length=C,l.length=C,s.length=C,u.length=C;let F=A1({len:C,texts:o,isWordLike:l,kinds:s,starts:u}),D=E1(v1(S1(y1(b1(g1(F))))));for(let M=0;M<D.len-1;M++){let S=l1(D.texts[M]);S!==null&&(D.kinds[M]!=="space"&&D.kinds[M]!=="preserved-space"||D.kinds[M+1]!=="text"||!Uf(D.texts[M+1])||(D.texts[M]=S.space,D.isWordLike[M]=!1,D.kinds[M]=D.kinds[M]==="preserved-space"?"preserved-space":"space",D.texts[M+1]=S.marks+D.texts[M+1],D.starts[M+1]=D.starts[M]+S.space.length))}return D}function w1(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 _1(e){if(e.len<=1)return e;let t=[],n=[],r=[],i=[],o=null,a=!1,l=0,s=!1,u=!1;function d(){o!==null&&(t.push(Ve(o)),n.push(a),r.push("text"),i.push(l),o=null)}for(let f=0;f<e.len;f++){let m=e.texts[f],h=e.kinds[f],b=e.isWordLike[f],v=e.starts[f];if(h==="text"){let x=Jv(m),_=ro(m);if(o!==null&&s&&u){o.push(m),a=a||b,s=s||x,u=_;continue}d(),o=[m],a=b,l=v,s=x,u=_;continue}d(),t.push(m),n.push(b),r.push(h),i.push(v)}return d(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Jf(e,t,n="normal",r="normal"){let i=Vv(n),o=i.mode==="pre-wrap"?qv(e):zv(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?_1(jf(o,t,i)):jf(o,t,i);return{normalized:o,chunks:w1(a,i),...a}}var yn=null,Qf=new Map,vn=null,C1=96,R1=/\\p{Emoji_Presentation}/u,T1=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,qs=null,Zf=new Map;function $s(){if(yn!==null)return yn;if(typeof OffscreenCanvas<"u")return yn=new OffscreenCanvas(1,1).getContext("2d"),yn;if(typeof document<"u")return yn=document.createElement("canvas").getContext("2d"),yn;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function k1(e){let t=Qf.get(e);return t||(t=new Map,Qf.set(e,t)),t}function pt(e,t){let n=t.get(e);return n===void 0&&(n={width:$s().measureText(e).width,containsCJK:Ke(e)},t.set(e,n)),n}function kt(){if(vn!==null)return vn;if(typeof navigator>"u")return vn={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},vn;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 vn={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},vn}function M1(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function ep(){return qs===null&&(qs=new Intl.Segmenter(void 0,{granularity:"grapheme"})),qs}function F1(e){return R1.test(e)||e.includes("\\uFE0F")}function tp(e){return T1.test(e)}function N1(e,t){let n=Zf.get(e);if(n!==void 0)return n;let r=$s();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 Zf.set(e,n),n}function L1(e){let t=0,n=ep();for(let r of n.segment(e))F1(r.segment)&&t++;return t}function D1(e,t){return t.emojiCount===void 0&&(t.emojiCount=L1(e)),t.emojiCount}function Tt(e,t,n){return n===0?t.width:t.width-D1(e,t)*n}function np(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=ep(),a=[];for(let d of o.segment(e))a.push(d.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let d=[];for(let f of a){let m=pt(f,n);d.push(Tt(f,m,r))}return t.breakableFitAdvances=d,t.breakableFitAdvances}if(i==="pair-context"||a.length>C1){let d=[],f=null,m=0;for(let h of a){let b=pt(h,n),v=Tt(h,b,r);if(f===null)d.push(v);else{let x=f+h,_=pt(x,n);d.push(Tt(x,_,r)-m)}f=h,m=v}return t.breakableFitAdvances=d,t.breakableFitAdvances}let l=[],s="",u=0;for(let d of a){s+=d;let f=pt(s,n),m=Tt(s,f,r);l.push(m-u),u=m}return t.breakableFitAdvances=l,t.breakableFitAdvances}function rp(e,t){let n=$s();n.font=e;let r=k1(e),i=M1(e),o=t?N1(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function I1(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 ip(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function op(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 P1(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 ap(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 sp(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=P1(e,t.segmentIndex);return n<0?-1:ap(e,n,t)}function O1(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:ap(e,r,n)}function lp(e,t){return e.simpleLineWalkFastPath?up(e,t):js(e,t)}function up(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=kt().lineFitEpsilon,s=t+l,u=0,d=0,f=!1,m=0,h=0,b=0,v=0,x=-1,_=0;function T(){x=-1,_=0}function C(w=b,R=v,I=d){u++,n?.({startSegmentIndex:m,startGraphemeIndex:h,endSegmentIndex:w,endGraphemeIndex:R,width:I}),d=0,f=!1,T()}function F(w,R){f=!0,m=w,h=0,b=w+1,v=0,d=R}function D(w,R,I){f=!0,m=w,h=R,b=w,v=R+1,d=I}function M(w,R){if(!f){F(w,R);return}d+=R,b=w+1,v=0}function S(w,R){let I=o[w];for(let H=R;H<I.length;H++){let j=I[H];f?d+j>s?(C(),D(w,H,j)):(d+=j,b=w,v=H+1):D(w,H,j)}f&&b===w&&v===I.length&&(b=w+1,v=0)}let A=0;for(;A<r.length&&!(!f&&(A=I1(e,A),A>=r.length));){let w=r[A],R=i[A],I=R==="space"||R==="preserved-space"||R==="tab"||R==="zero-width-break"||R==="soft-hyphen";if(!f){w>t&&o[A]!==null?S(A,0):F(A,w),I&&(x=A+1,_=d-w),A++;continue}if(d+w>s){if(I){M(A,w),C(A+1,0,d-w),A++;continue}if(x>=0){if(b>x||b===x&&v>0){C();continue}C(x,0,_);continue}if(w>t&&o[A]!==null){C(),S(A,0),A++;continue}C();continue}M(A,w),I&&(x=A+1,_=d-w),A++}return f&&C(),u}function js(e,t,n){if(e.simpleLineWalkFastPath)return up(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:d}=e;if(r.length===0||d.length===0)return 0;let f=kt(),m=f.lineFitEpsilon,h=t+m,b=0,v=0,x=!1,_=0,T=0,C=0,F=0,D=-1,M=0,S=0,A=null;function w(){D=-1,M=0,S=0,A=null}function R(B=C,G=F,W=v){b++,n?.({startSegmentIndex:_,startGraphemeIndex:T,endSegmentIndex:B,endGraphemeIndex:G,width:W}),v=0,x=!1,w()}function I(B,G){x=!0,_=B,T=0,C=B+1,F=0,v=G}function H(B,G,W){x=!0,_=B,T=G,C=B,F=G+1,v=W}function j(B,G){if(!x){I(B,G);return}v+=G,C=B+1,F=0}function X(B,G,W,Q){if(!G)return;let q=B==="tab"?0:i[W],O=B==="tab"?Q:o[W];D=W+1,M=v-Q+q,S=v-Q+O,A=B}function k(B,G){let W=l[B];for(let Q=G;Q<W.length;Q++){let q=W[Q];x?v+q>h?(R(),H(B,Q,q)):(v+=q,C=B,F=Q+1):H(B,Q,q)}x&&C===B&&F===W.length&&(C=B+1,F=0)}function U(B){if(A!=="soft-hyphen")return!1;let G=l[B];if(G==null)return!1;let{fitCount:W,fittedWidth:Q}=op(G,v,t,m,s);return W===0?!1:(v=Q,C=B,F=W,w(),W===G.length?(C=B+1,F=0,!0):(R(B,W,Q+s),k(B,W),!0))}function te(B){b++,n?.({startSegmentIndex:B.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:B.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),w()}for(let B=0;B<d.length;B++){let G=d[B];if(G.startSegmentIndex===G.endSegmentIndex){te(G);continue}x=!1,v=0,_=G.startSegmentIndex,T=0,C=G.startSegmentIndex,F=0,w();let W=G.startSegmentIndex;for(;W<G.endSegmentIndex;){let Q=a[W],q=Q==="space"||Q==="preserved-space"||Q==="tab"||Q==="zero-width-break"||Q==="soft-hyphen",O=Q==="tab"?ip(v,u):r[W];if(Q==="soft-hyphen"){x&&(C=W+1,F=0,D=W+1,M=v+s,S=v+s,A=Q),W++;continue}if(!x){O>t&&l[W]!==null?k(W,0):I(W,O),X(Q,q,W,O),W++;continue}if(v+O>h){let Z=v+(Q==="tab"?0:i[W]),pe=v+(Q==="tab"?O:o[W]);if(A==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&M<=h){R(D,0,S);continue}if(A==="soft-hyphen"&&U(W)){W++;continue}if(q&&Z<=h){j(W,O),R(W+1,0,pe),W++;continue}if(D>=0&&M<=h){if(C>D||C===D&&F>0){R();continue}let re=D;R(re,0,S),W=re;continue}if(O>t&&l[W]!==null){R(),k(W,0),W++;continue}R();continue}j(W,O),X(Q,q,W,O),W++}if(x){let Q=D===G.consumedEndSegmentIndex?S:v;R(G.consumedEndSegmentIndex,0,Q)}}return b}function cp(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:d,tabStopAdvance:f}=e,m=kt(),h=m.lineFitEpsilon,b=r+h,v=0,x=!1,_=t.segmentIndex,T=t.graphemeIndex,C=-1,F=0,D=0,M=null;function S(){C=-1,F=0,D=0,M=null}function A(k=_,U=T,te=v){return x?(t.segmentIndex=k,t.graphemeIndex=U,te):null}function w(k,U){x=!0,_=k+1,T=0,v=U}function R(k,U,te){x=!0,_=k,T=U+1,v=te}function I(k,U){if(!x){w(k,U);return}v+=U,_=k+1,T=0}function H(k,U,te,B){if(!U)return;let G=k==="tab"?0:a[te],W=k==="tab"?B:l[te];C=te+1,F=v-B+G,D=v-B+W,M=k}function j(k,U){let te=u[k];for(let B=U;B<te.length;B++){let G=te[B];if(!x)R(k,B,G);else{if(v+G>b)return A();v+=G,_=k,T=B+1}}return x&&_===k&&T===te.length&&(_=k+1,T=0),null}function X(k){if(M!=="soft-hyphen"||C<0)return null;let U=u[k]??null;if(U!==null){let{fitCount:te,fittedWidth:B}=op(U,v,r,h,d);if(te===U.length)return v=B,_=k+1,T=0,S(),null;if(te>0)return A(k,te,B+d)}return F<=b?A(C,0,D):null}for(let k=t.segmentIndex;k<i.endSegmentIndex;k++){let U=s[k],te=U==="space"||U==="preserved-space"||U==="tab"||U==="zero-width-break"||U==="soft-hyphen",B=k===t.segmentIndex?t.graphemeIndex:0,G=U==="tab"?ip(v,f):o[k];if(U==="soft-hyphen"&&B===0){x&&(_=k+1,T=0,C=k+1,F=v+d,D=v+d,M=U);continue}if(!x){if(B>0){let Q=j(k,B);if(Q!==null)return Q}else if(G>r&&u[k]!==null){let Q=j(k,0);if(Q!==null)return Q}else w(k,G);H(U,te,k,G);continue}if(v+G>b){let Q=v+(U==="tab"?0:a[k]),q=v+(U==="tab"?G:l[k]);if(M==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&F<=b)return A(C,0,D);let O=X(k);if(O!==null)return O;if(te&&Q<=b)return I(k,G),A(k+1,0,q);if(C>=0&&F<=b)return _>C||_===C&&T>0?A():A(C,0,D);if(G>r&&u[k]!==null){let V=A();if(V!==null)return V;let Z=j(k,0);if(Z!==null)return Z}return A()}I(k,G),H(U,te,k,G)}return C===i.consumedEndSegmentIndex&&T===0?A(i.consumedEndSegmentIndex,0,D):A(i.consumedEndSegmentIndex,0,v)}function G1(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=kt().lineFitEpsilon,s=n+l,u=0,d=!1,f=t.segmentIndex,m=t.graphemeIndex,h=-1,b=0;for(let v=t.segmentIndex;v<r.length;v++){let x=r[v],_=i[v],T=_==="space"||_==="preserved-space"||_==="tab"||_==="zero-width-break"||_==="soft-hyphen",C=v===t.segmentIndex?t.graphemeIndex:0,F=o[v];if(!d){if(C>0||x>n&&F!==null){let D=F,M=D[C];d=!0,u=M,f=v,m=C+1;for(let S=C+1;S<D.length;S++){let A=D[S];if(u+A>s)return t.segmentIndex=f,t.graphemeIndex=m,u;u+=A,f=v,m=S+1}f===v&&m===D.length&&(f=v+1,m=0)}else d=!0,u=x,f=v+1,m=0;T&&(h=v+1,b=u-x);continue}if(u+x>s)return T?(t.segmentIndex=v+1,t.graphemeIndex=0,u):h>=0?f>h||f===h&&m>0?(t.segmentIndex=f,t.graphemeIndex=m,u):(t.segmentIndex=h,t.graphemeIndex=0,b):(t.segmentIndex=f,t.graphemeIndex=m,u);u+=x,f=v+1,m=0,T&&(h=v+1,b=u-x)}return d?(t.segmentIndex=f,t.graphemeIndex=m,u):null}function H1(e,t,n){let r=sp(e,t);return r<0?null:e.simpleLineWalkFastPath?G1(e,t,n):cp(e,t,r,n)}function dp(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=sp(e,n);for(;o>=0;){let a=cp(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=O1(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=H1(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var Ks=null;function B1(){return Ks===null&&(Ks=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ks}function U1(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 W1(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(f,m,h){r=[f],i=m,o=h,a=ao(f),l=kr.has(f)}function d(f,m){r.push(f),o=o||m;let h=ao(f);f.length===1&&Rt.has(f)?a=a||h:a=h,l=!1}for(let f of B1().segment(e)){let m=f.segment,h=Ke(m);if(r.length===0){u(m,f.index,h);continue}if(l||io.has(m)||Rt.has(m)||t.carryCJKAfterClosingQuote&&h&&a){d(m,h);continue}if(!o&&!h){d(m,h);continue}s(),u(m,f.index,h)}return s(),n}function V1(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=Ke(e[0].text),o=ro(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=Ke(s.text),d=ro(s.text);if(i&&o){n.push(s.text),i=i||u,o=d;continue}a(),n=[s.text],r=s.start,i=u,o=d}return a(),t}function z1(e,t,n,r){let i=kt(),{cache:o,emojiCorrection:a}=rp(t,tp(e.normalized)),l=Tt("-",pt("-",o),a),u=Tt(" ",pt(" ",o),a)*8;if(e.len===0)return U1(n);let d=[],f=[],m=[],h=[],b=e.chunks.length<=1,v=n?[]:null,x=[],_=n?[]:null,T=Array.from({length:e.len});function C(S,A,w,R,I,H,j){I!=="text"&&I!=="space"&&I!=="zero-width-break"&&(b=!1),d.push(A),f.push(w),m.push(R),h.push(I),v?.push(H),x.push(j),_!==null&&_.push(S)}function F(S,A,w,R,I){let H=pt(S,o),j=Tt(S,H,a),X=A==="space"||A==="preserved-space"||A==="zero-width-break"?0:j,k=A==="space"||A==="zero-width-break"?0:j;if(I&&R&&S.length>1){let U="sum-graphemes";Tr(S)?U="pair-context":i.preferPrefixWidthsForBreakableRuns&&(U="segment-prefixes");let te=np(S,H,o,a,U);C(S,j,X,k,A,w,te);return}C(S,j,X,k,A,w,null)}for(let S=0;S<e.len;S++){T[S]=d.length;let A=e.texts[S],w=e.isWordLike[S],R=e.kinds[S],I=e.starts[S];if(R==="soft-hyphen"){C(A,0,l,l,R,I,null);continue}if(R==="hard-break"){C(A,0,0,0,R,I,null);continue}if(R==="tab"){C(A,0,0,0,R,I,null);continue}let H=pt(A,o);if(R==="text"&&H.containsCJK){let j=W1(A,i),X=r==="keep-all"?V1(j):j;for(let k=0;k<X.length;k++){let U=X[k];F(U.text,"text",I+U.start,w,r==="keep-all"||!Ke(U.text))}continue}F(A,R,I,w,!0)}let D=q1(e.chunks,T,d.length),M=v===null?null:Bf(e.normalized,v);return _!==null?{widths:d,lineEndFitAdvances:f,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:b,segLevels:M,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:D,segments:_}:{widths:d,lineEndFitAdvances:f,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:b,segLevels:M,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:D}}function q1(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 mp(e,t,n,r){let i=r?.wordBreak??"normal",o=Jf(e,kt(),r?.whiteSpace,i);return z1(o,t,n,i)}function so(e,t,n){return mp(e,t,!1,n)}function fp(e,t,n){return mp(e,t,!0,n)}function lo(e,t,n){let r=lp(e,t);return{lineCount:r,height:r*n}}function $1(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function j1(e,t,n){return e.widths.length===0?0:js(e,t,r=>{n($1(r))})}function pp(e,t){return dp(e,t)}function hp(e){let t=0;return j1(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var K1={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function gp(e,t){let n={...K1,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=so(e,o),{lineCount:l}=lo(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var bp={prepare:so,layout:lo,prepareWithSegments:fp,measureLineStats:pp,measureNaturalWidth:hp};window.__timelines=window.__timelines||{};Fm();window.__hyperframes={fitTextFontSize:gp,getVariables:Pl,pretext:bp,registerRuntimeDataHandler:Pf,setRuntimeData:eo,clearRuntimeData:to};function xp(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Gf())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",xp,{once:!0}):xp();})();\n';
|
|
59268
59268
|
}
|
|
59269
59269
|
});
|
|
59270
59270
|
|
|
@@ -67549,7 +67549,12 @@ var init_captureFailure = __esm({
|
|
|
67549
67549
|
/Navigation timeout of \d+ ms exceeded/i,
|
|
67550
67550
|
/ECONNREFUSED/i,
|
|
67551
67551
|
/net::ERR_NETWORK_CHANGED/i,
|
|
67552
|
-
/Composition has zero duration[\s\S]*Runtime ready: false
|
|
67552
|
+
/Composition has zero duration[\s\S]*Runtime ready: false/,
|
|
67553
|
+
// CDP can refuse a capture call outright with this exact wording; timed-out
|
|
67554
|
+
// variants of the same call hit PROTOCOL_TIMEOUT_PATTERNS, checked first.
|
|
67555
|
+
// Anchored to this literal reason (not just the CDP method) so an unrelated,
|
|
67556
|
+
// genuinely deterministic Page.captureScreenshot error isn't swept in too.
|
|
67557
|
+
/Protocol error \(Page\.captureScreenshot\): Unable to capture screenshot/i
|
|
67553
67558
|
];
|
|
67554
67559
|
PROTOCOL_TIMEOUT_PATTERNS = [
|
|
67555
67560
|
/Network\.enable timed out/i,
|
|
@@ -81973,6 +81978,29 @@ function execFileAsync(file, args) {
|
|
|
81973
81978
|
});
|
|
81974
81979
|
});
|
|
81975
81980
|
}
|
|
81981
|
+
async function mapWithProbeConcurrency(entries2, probe2) {
|
|
81982
|
+
const results = new Array(entries2.length);
|
|
81983
|
+
let nextIndex2 = 0;
|
|
81984
|
+
const workerCount = Math.min(PROBE_CONCURRENCY, entries2.length);
|
|
81985
|
+
const runWorker = async () => {
|
|
81986
|
+
for (; ; ) {
|
|
81987
|
+
const index = nextIndex2++;
|
|
81988
|
+
if (index >= entries2.length) return;
|
|
81989
|
+
const entry = entries2[index];
|
|
81990
|
+
if (entry !== void 0) results[index] = await probe2(entry);
|
|
81991
|
+
}
|
|
81992
|
+
};
|
|
81993
|
+
await Promise.all(Array.from({ length: workerCount }, runWorker));
|
|
81994
|
+
return results;
|
|
81995
|
+
}
|
|
81996
|
+
function resolveLocalVideoReference(projectDir, rawSrc, compSrcPath) {
|
|
81997
|
+
if (isUnresolvedAssetPlaceholder(rawSrc)) return null;
|
|
81998
|
+
const src = cleanAssetUrl(rawSrc);
|
|
81999
|
+
if (!src || isRemoteOrInlineUrl(src)) return null;
|
|
82000
|
+
const rootRelative = compSrcPath ? rewriteAssetPath(compSrcPath, src, (path2) => existsSync11(join10(projectDir, path2))) : src;
|
|
82001
|
+
const asset = resolveExistingLocalAsset(projectDir, rootRelative);
|
|
82002
|
+
return asset ? { resolved: asset.resolved, src } : null;
|
|
82003
|
+
}
|
|
81976
82004
|
function hasHevcStream(json) {
|
|
81977
82005
|
if (typeof json !== "object" || json === null) return false;
|
|
81978
82006
|
const streams = Reflect.get(json, "streams");
|
|
@@ -82010,35 +82038,143 @@ function collectLocalVideoCandidates(projectDir, htmlSources) {
|
|
|
82010
82038
|
let match;
|
|
82011
82039
|
while ((match = re2.exec(scannable)) !== null) {
|
|
82012
82040
|
const rawSrc = match[2] ?? "";
|
|
82013
|
-
|
|
82014
|
-
|
|
82015
|
-
|
|
82016
|
-
if (isRemoteOrInlineUrl(src)) continue;
|
|
82017
|
-
const rootRelative = compSrcPath ? rewriteAssetPath(compSrcPath, src, (path2) => existsSync11(join10(projectDir, path2))) : src;
|
|
82018
|
-
const resolvedAsset = resolveExistingLocalAsset(projectDir, rootRelative);
|
|
82019
|
-
if (!resolvedAsset) continue;
|
|
82020
|
-
if (!candidates.has(resolvedAsset.resolved)) candidates.set(resolvedAsset.resolved, src);
|
|
82041
|
+
const reference = resolveLocalVideoReference(projectDir, rawSrc, compSrcPath);
|
|
82042
|
+
if (!reference || candidates.has(reference.resolved)) continue;
|
|
82043
|
+
candidates.set(reference.resolved, reference.src);
|
|
82021
82044
|
}
|
|
82022
82045
|
}
|
|
82023
82046
|
return candidates;
|
|
82024
82047
|
}
|
|
82048
|
+
function collectVideoElements(html) {
|
|
82049
|
+
const { document: document2 } = parseHTML(html);
|
|
82050
|
+
const roots = [document2];
|
|
82051
|
+
const videos = [];
|
|
82052
|
+
for (let index = 0; index < roots.length; index++) {
|
|
82053
|
+
const root = roots[index];
|
|
82054
|
+
if (!root) continue;
|
|
82055
|
+
videos.push(...root.querySelectorAll("video"));
|
|
82056
|
+
for (const template of root.querySelectorAll("template")) {
|
|
82057
|
+
roots.push(template.content);
|
|
82058
|
+
}
|
|
82059
|
+
}
|
|
82060
|
+
return videos;
|
|
82061
|
+
}
|
|
82062
|
+
function readPositiveNumber(raw) {
|
|
82063
|
+
const value = parseNumeric2(raw);
|
|
82064
|
+
return value !== null && value > 0 ? value : null;
|
|
82065
|
+
}
|
|
82066
|
+
function readNonNegativeNumber(raw) {
|
|
82067
|
+
const value = parseNumeric2(raw);
|
|
82068
|
+
return value !== null && value >= 0 ? value : null;
|
|
82069
|
+
}
|
|
82070
|
+
function readFiniteVideoSlot(video, file) {
|
|
82071
|
+
if (video.hasAttribute("loop")) return null;
|
|
82072
|
+
if (video.hasAttribute("data-var-src")) return null;
|
|
82073
|
+
if (video.hasAttribute("data-playback-start")) return null;
|
|
82074
|
+
if (readPositiveNumber(video.getAttribute("data-duration")) === null) return null;
|
|
82075
|
+
const mediaStart = readNonNegativeNumber(video.getAttribute("data-media-start"));
|
|
82076
|
+
if (mediaStart === null) return null;
|
|
82077
|
+
return {
|
|
82078
|
+
rawSrc: video.getAttribute("src") ?? "",
|
|
82079
|
+
file,
|
|
82080
|
+
...video.id ? { elementId: video.id } : {},
|
|
82081
|
+
mediaStart
|
|
82082
|
+
};
|
|
82083
|
+
}
|
|
82084
|
+
function collectLocalFiniteVideoSlots(projectDir, htmlSources) {
|
|
82085
|
+
const slotsByPath = /* @__PURE__ */ new Map();
|
|
82086
|
+
for (const { html, compSrcPath } of htmlSources) {
|
|
82087
|
+
for (const video of collectVideoElements(html)) {
|
|
82088
|
+
const slot = readFiniteVideoSlot(video, compSrcPath ?? "index.html");
|
|
82089
|
+
if (!slot) continue;
|
|
82090
|
+
const reference = resolveLocalVideoReference(projectDir, slot.rawSrc, compSrcPath);
|
|
82091
|
+
if (!reference) continue;
|
|
82092
|
+
const slots = slotsByPath.get(reference.resolved) ?? [];
|
|
82093
|
+
slots.push({
|
|
82094
|
+
src: reference.src,
|
|
82095
|
+
file: slot.file,
|
|
82096
|
+
...slot.elementId ? { elementId: slot.elementId } : {},
|
|
82097
|
+
mediaStart: slot.mediaStart
|
|
82098
|
+
});
|
|
82099
|
+
slotsByPath.set(reference.resolved, slots);
|
|
82100
|
+
}
|
|
82101
|
+
}
|
|
82102
|
+
return slotsByPath;
|
|
82103
|
+
}
|
|
82104
|
+
function parsePositiveDuration(value) {
|
|
82105
|
+
const duration = typeof value === "number" || typeof value === "string" ? Number(value) : NaN;
|
|
82106
|
+
return Number.isFinite(duration) && duration > 0 ? duration : null;
|
|
82107
|
+
}
|
|
82108
|
+
function readPlayableVideoDuration(stdout2) {
|
|
82109
|
+
try {
|
|
82110
|
+
const metadata = JSON.parse(stdout2);
|
|
82111
|
+
if (typeof metadata !== "object" || metadata === null) return null;
|
|
82112
|
+
const streams = Reflect.get(metadata, "streams");
|
|
82113
|
+
const stream = Array.isArray(streams) ? streams.find((candidate) => typeof candidate === "object" && candidate !== null) : null;
|
|
82114
|
+
const streamDuration = stream ? parsePositiveDuration(Reflect.get(stream, "duration")) : null;
|
|
82115
|
+
if (streamDuration !== null) return streamDuration;
|
|
82116
|
+
const format = Reflect.get(metadata, "format");
|
|
82117
|
+
return typeof format === "object" && format !== null ? parsePositiveDuration(Reflect.get(format, "duration")) : null;
|
|
82118
|
+
} catch {
|
|
82119
|
+
return null;
|
|
82120
|
+
}
|
|
82121
|
+
}
|
|
82122
|
+
async function probePlayableVideoDuration(ffprobePath, filePath) {
|
|
82123
|
+
try {
|
|
82124
|
+
return readPlayableVideoDuration(
|
|
82125
|
+
await execFileAsync(ffprobePath, [
|
|
82126
|
+
"-v",
|
|
82127
|
+
"error",
|
|
82128
|
+
"-select_streams",
|
|
82129
|
+
"v:0",
|
|
82130
|
+
"-show_entries",
|
|
82131
|
+
"stream=duration:format=duration",
|
|
82132
|
+
"-of",
|
|
82133
|
+
"json",
|
|
82134
|
+
"--",
|
|
82135
|
+
filePath
|
|
82136
|
+
])
|
|
82137
|
+
);
|
|
82138
|
+
} catch {
|
|
82139
|
+
return null;
|
|
82140
|
+
}
|
|
82141
|
+
}
|
|
82142
|
+
async function lintVideoMediaStartPastEof(projectDir, htmlSources) {
|
|
82143
|
+
const slotsByPath = collectLocalFiniteVideoSlots(projectDir, htmlSources);
|
|
82144
|
+
if (slotsByPath.size === 0) return [];
|
|
82145
|
+
const ffprobePath = findFfBinary("ffprobe", { configuredMustExist: true });
|
|
82146
|
+
if (!ffprobePath) return [];
|
|
82147
|
+
const entries2 = [...slotsByPath.entries()];
|
|
82148
|
+
const durations = await mapWithProbeConcurrency(
|
|
82149
|
+
entries2,
|
|
82150
|
+
(entry) => probePlayableVideoDuration(ffprobePath, entry[0])
|
|
82151
|
+
);
|
|
82152
|
+
const findings = [];
|
|
82153
|
+
for (const [index, [, slots]] of entries2.entries()) {
|
|
82154
|
+
const sourceDuration = durations[index];
|
|
82155
|
+
if (sourceDuration == null) continue;
|
|
82156
|
+
for (const slot of slots) {
|
|
82157
|
+
if (slot.mediaStart < sourceDuration) continue;
|
|
82158
|
+
findings.push({
|
|
82159
|
+
code: "video_media_start_at_or_past_eof",
|
|
82160
|
+
severity: "warning",
|
|
82161
|
+
message: `Video "${slot.src}" starts at ${slot.mediaStart}s, at or past its ${sourceDuration}s playable source duration. The video will hold its final frame for the explicit slot.`,
|
|
82162
|
+
file: slot.file,
|
|
82163
|
+
...slot.elementId ? { elementId: slot.elementId } : {},
|
|
82164
|
+
fixHint: `Trim data-media-start below ${sourceDuration}s if this final-frame hold is unintended.`
|
|
82165
|
+
});
|
|
82166
|
+
}
|
|
82167
|
+
}
|
|
82168
|
+
return findings;
|
|
82169
|
+
}
|
|
82025
82170
|
async function lintHevcPreviewCodec(candidates) {
|
|
82026
82171
|
if (candidates.size === 0) return [];
|
|
82027
82172
|
const ffprobePath = findFfBinary("ffprobe", { configuredMustExist: true });
|
|
82028
82173
|
if (!ffprobePath) return [];
|
|
82029
82174
|
const entries2 = [...candidates.entries()];
|
|
82030
|
-
const isHevc =
|
|
82031
|
-
|
|
82032
|
-
|
|
82033
|
-
await Promise.all(
|
|
82034
|
-
Array.from({ length: workerCount }, async () => {
|
|
82035
|
-
while (nextIndex2 < entries2.length) {
|
|
82036
|
-
const index = nextIndex2++;
|
|
82037
|
-
const entry = entries2[index];
|
|
82038
|
-
if (!entry) break;
|
|
82039
|
-
isHevc[index] = await probeIsHevc(ffprobePath, entry[0]);
|
|
82040
|
-
}
|
|
82041
|
-
})
|
|
82175
|
+
const isHevc = await mapWithProbeConcurrency(
|
|
82176
|
+
entries2,
|
|
82177
|
+
(entry) => probeIsHevc(ffprobePath, entry[0])
|
|
82042
82178
|
);
|
|
82043
82179
|
const hevcSrcs = entries2.filter((_, i2) => isHevc[i2]).map(([, src]) => src);
|
|
82044
82180
|
if (hevcSrcs.length === 0) return [];
|
|
@@ -82195,6 +82331,7 @@ async function lintProject(projectDir, entryFile) {
|
|
|
82195
82331
|
...!entryFile ? lintBlankRootWithStandaloneComposition(rootHtml, allHtmlSources) : [],
|
|
82196
82332
|
...lintDuplicateAudioTracks(allHtmlSources),
|
|
82197
82333
|
...lintMissingOrEmptySubComposition(projectDir, rootHtml),
|
|
82334
|
+
...await lintVideoMediaStartPastEof(projectDir, allHtmlSources),
|
|
82198
82335
|
...await lintHevcPreviewCodec(collectLocalVideoCandidates(projectDir, allHtmlSources))
|
|
82199
82336
|
];
|
|
82200
82337
|
if (projectFindings.length > 0) {
|
|
@@ -82499,8 +82636,10 @@ var init_dist4 = __esm({
|
|
|
82499
82636
|
init_esm10();
|
|
82500
82637
|
init_assetResolution();
|
|
82501
82638
|
init_assets();
|
|
82639
|
+
init_compositionContract();
|
|
82502
82640
|
init_ffBinaries();
|
|
82503
82641
|
init_assetResolution();
|
|
82642
|
+
init_esm10();
|
|
82504
82643
|
COMPOSITION_ID_IN_CSS_PATTERN = /\[data-composition-id=["']([^"']+)["']\]/g;
|
|
82505
82644
|
TIMELINE_REGISTRY_INIT_PATTERN = /window\.__timelines\s*=\s*window\.__timelines\s*\|\|\s*\{\}|window\.__timelines\s*=\s*\{\}|window\.__timelines\s*\?\?=\s*\{\}/i;
|
|
82506
82645
|
TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN = /window\.__timelines\s*=\s*\{\s*(?:["'][^"']+["']|[A-Za-z_$][\w$]*)\s*:/i;
|
|
@@ -87255,13 +87394,20 @@ function publishCacheEntry(entry, partialDir) {
|
|
|
87255
87394
|
return adoptPublishedWinner(entry, partialDir) ?? { dir: partialDir, published: false };
|
|
87256
87395
|
}
|
|
87257
87396
|
}
|
|
87258
|
-
function
|
|
87397
|
+
function touchCacheDir(dir) {
|
|
87398
|
+
const now = /* @__PURE__ */ new Date();
|
|
87259
87399
|
try {
|
|
87260
|
-
|
|
87261
|
-
|
|
87400
|
+
utimesSync(dir, now, now);
|
|
87401
|
+
} catch {
|
|
87402
|
+
}
|
|
87403
|
+
try {
|
|
87404
|
+
utimesSync(join12(dir, COMPLETE_SENTINEL), now, now);
|
|
87262
87405
|
} catch {
|
|
87263
87406
|
}
|
|
87264
87407
|
}
|
|
87408
|
+
function touchCacheEntry(entry) {
|
|
87409
|
+
touchCacheDir(entry.dir);
|
|
87410
|
+
}
|
|
87265
87411
|
function isCacheLikeChild(name) {
|
|
87266
87412
|
return name.startsWith(CACHE_GENERATION_PREFIX) || name.includes(".partial-");
|
|
87267
87413
|
}
|
|
@@ -87885,6 +88031,10 @@ function resolveSegmentDuration(requested, mediaStart, sourceDuration) {
|
|
|
87885
88031
|
function resolvePlayableVideoDuration(metadata) {
|
|
87886
88032
|
return Number.isFinite(metadata.videoStreamDurationSeconds) && metadata.videoStreamDurationSeconds > 0 ? metadata.videoStreamDurationSeconds : metadata.durationSeconds;
|
|
87887
88033
|
}
|
|
88034
|
+
function canHoldFinalFramePastEof(video) {
|
|
88035
|
+
const timelineDuration2 = video.end - video.start;
|
|
88036
|
+
return !video.loop && Number.isFinite(timelineDuration2) && timelineDuration2 > 0;
|
|
88037
|
+
}
|
|
87888
88038
|
function resolveTimelineExtractionWindow(video, resolvedDuration, timelineEnd, sourceDuration) {
|
|
87889
88039
|
const playbackRate = normalizePlaybackRate(video.playbackRate ?? 1);
|
|
87890
88040
|
const withTimelineDuration = (window3, timelineDurationSeconds) => playbackRate === 1 ? window3 : { ...window3, timelineDurationSeconds };
|
|
@@ -87953,6 +88103,18 @@ function resolveTimelineExtractionWindow(video, resolvedDuration, timelineEnd, s
|
|
|
87953
88103
|
},
|
|
87954
88104
|
visibleDuration
|
|
87955
88105
|
);
|
|
88106
|
+
} else if (canHoldFinalFramePastEof(video)) {
|
|
88107
|
+
const logicalDuration = Math.min(sourceDuration, FINAL_FRAME_LOGICAL_DURATION_SECONDS);
|
|
88108
|
+
return withTimelineDuration(
|
|
88109
|
+
{
|
|
88110
|
+
compositionStart: video.start,
|
|
88111
|
+
mediaStart: sourceDuration - logicalDuration,
|
|
88112
|
+
durationSeconds: logicalDuration,
|
|
88113
|
+
preserveTimelineEnd: true,
|
|
88114
|
+
ensureFinalFrame: true
|
|
88115
|
+
},
|
|
88116
|
+
visibleDuration
|
|
88117
|
+
);
|
|
87956
88118
|
}
|
|
87957
88119
|
}
|
|
87958
88120
|
return withTimelineDuration(
|
|
@@ -87977,7 +88139,10 @@ async function resolveFinalFrameExtractionWindow(videoPath, video, metadata, win
|
|
|
87977
88139
|
);
|
|
87978
88140
|
if (window3.mediaStart < finalFrameTimestamp - 1e-9) return window3;
|
|
87979
88141
|
const sourceRemaining = playableDuration - video.mediaStart;
|
|
87980
|
-
const logicalDuration = Math.min(
|
|
88142
|
+
const logicalDuration = Math.min(
|
|
88143
|
+
Math.max(sourceRemaining, window3.durationSeconds),
|
|
88144
|
+
FINAL_FRAME_LOGICAL_DURATION_SECONDS
|
|
88145
|
+
);
|
|
87981
88146
|
return {
|
|
87982
88147
|
compositionStart: Math.max(0, video.start),
|
|
87983
88148
|
mediaStart: playableDuration - logicalDuration,
|
|
@@ -87998,7 +88163,9 @@ function resolveVideoExtractionWindow(video, metadata, timelineEnd) {
|
|
|
87998
88163
|
`Playable video stream duration is ${playableDuration}s`
|
|
87999
88164
|
);
|
|
88000
88165
|
}
|
|
88001
|
-
|
|
88166
|
+
const requestedTimelineDuration = video.end - video.start;
|
|
88167
|
+
const heldPastEof = video.mediaStart >= playableDuration && canHoldFinalFramePastEof(video);
|
|
88168
|
+
if (video.mediaStart >= playableDuration && !heldPastEof) {
|
|
88002
88169
|
throw new VideoSourceExtractionError(
|
|
88003
88170
|
"media_start_out_of_range",
|
|
88004
88171
|
false,
|
|
@@ -88007,9 +88174,13 @@ function resolveVideoExtractionWindow(video, metadata, timelineEnd) {
|
|
|
88007
88174
|
);
|
|
88008
88175
|
}
|
|
88009
88176
|
const playbackRate = normalizePlaybackRate(video.playbackRate ?? 1);
|
|
88010
|
-
const requestedTimelineDuration = video.end - video.start;
|
|
88011
88177
|
const resolvedDuration = Number.isFinite(requestedTimelineDuration) && requestedTimelineDuration > 0 ? requestedTimelineDuration : resolveSegmentDuration(requestedTimelineDuration, video.mediaStart, playableDuration) / playbackRate;
|
|
88012
|
-
return resolveTimelineExtractionWindow(
|
|
88178
|
+
return resolveTimelineExtractionWindow(
|
|
88179
|
+
video,
|
|
88180
|
+
resolvedDuration,
|
|
88181
|
+
timelineEnd ?? (heldPastEof ? video.end : void 0),
|
|
88182
|
+
playableDuration
|
|
88183
|
+
);
|
|
88013
88184
|
}
|
|
88014
88185
|
function resolveVideoExtractionDuration(video, metadata, timelineEnd) {
|
|
88015
88186
|
return resolveVideoExtractionWindow(video, metadata, timelineEnd).durationSeconds;
|
|
@@ -88325,7 +88496,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
88325
88496
|
const metadata = videoMetadata[i2];
|
|
88326
88497
|
if (!entry || !metadata) continue;
|
|
88327
88498
|
const playableDuration = resolvePlayableVideoDuration(metadata);
|
|
88328
|
-
if (entry.video.mediaStart >= playableDuration) {
|
|
88499
|
+
if (entry.video.mediaStart >= playableDuration && !canHoldFinalFramePastEof(entry.video)) {
|
|
88329
88500
|
errors.push({
|
|
88330
88501
|
videoId: entry.video.id,
|
|
88331
88502
|
kind: "media_start_out_of_range",
|
|
@@ -88892,6 +89063,7 @@ var init_videoFrameExtractor = __esm({
|
|
|
88892
89063
|
|
|
88893
89064
|
// ../engine/src/services/videoFrameInjector.ts
|
|
88894
89065
|
import { promises as fs } from "fs";
|
|
89066
|
+
import { dirname as dirname9 } from "path";
|
|
88895
89067
|
function createFrameSourceCache(entryLimit, bytesLimit, frameSrcResolver) {
|
|
88896
89068
|
const cache2 = /* @__PURE__ */ new Map();
|
|
88897
89069
|
const inFlight2 = /* @__PURE__ */ new Map();
|
|
@@ -88971,6 +89143,15 @@ function createVideoFrameInjector(frameLookup, config) {
|
|
|
88971
89143
|
const bytesLimit = bytesLimitMb * 1024 * 1024;
|
|
88972
89144
|
const frameCache = createFrameSourceCache(entryLimit, bytesLimit, config?.frameSrcResolver);
|
|
88973
89145
|
const lastInjectedFrameByVideo = /* @__PURE__ */ new Map();
|
|
89146
|
+
const lastCacheTouchByDir = /* @__PURE__ */ new Map();
|
|
89147
|
+
function renewCacheLease(framePath) {
|
|
89148
|
+
const cacheDir = dirname9(framePath);
|
|
89149
|
+
const now = Date.now();
|
|
89150
|
+
const lastTouch = lastCacheTouchByDir.get(cacheDir);
|
|
89151
|
+
if (lastTouch !== void 0 && now - lastTouch < CACHE_TOUCH_THROTTLE_MS) return;
|
|
89152
|
+
touchCacheDir(cacheDir);
|
|
89153
|
+
lastCacheTouchByDir.set(cacheDir, now);
|
|
89154
|
+
}
|
|
88974
89155
|
return async (page, time) => {
|
|
88975
89156
|
const activePayloads = frameLookup.getActiveFramePayloads(time);
|
|
88976
89157
|
const updates = [];
|
|
@@ -88979,6 +89160,7 @@ function createVideoFrameInjector(frameLookup, config) {
|
|
|
88979
89160
|
const pendingReads = [];
|
|
88980
89161
|
for (const [videoId, payload] of activePayloads) {
|
|
88981
89162
|
activeIds.add(videoId);
|
|
89163
|
+
renewCacheLease(payload.framePath);
|
|
88982
89164
|
const lastFrameIndex = lastInjectedFrameByVideo.get(videoId);
|
|
88983
89165
|
if (lastFrameIndex === payload.frameIndex) continue;
|
|
88984
89166
|
pendingReads.push(
|
|
@@ -89304,12 +89486,15 @@ async function queryElementStacking(page, nativeHdrIds) {
|
|
|
89304
89486
|
RENDER_FRAME_ID_SUFFIX
|
|
89305
89487
|
);
|
|
89306
89488
|
}
|
|
89489
|
+
var CACHE_TOUCH_THROTTLE_MS;
|
|
89307
89490
|
var init_videoFrameInjector = __esm({
|
|
89308
89491
|
"../engine/src/services/videoFrameInjector.ts"() {
|
|
89309
89492
|
"use strict";
|
|
89493
|
+
init_extractionCache();
|
|
89310
89494
|
init_screenshotService();
|
|
89311
89495
|
init_config2();
|
|
89312
89496
|
init_dist3();
|
|
89497
|
+
CACHE_TOUCH_THROTTLE_MS = 5 * 60 * 1e3;
|
|
89313
89498
|
}
|
|
89314
89499
|
});
|
|
89315
89500
|
|
|
@@ -89467,7 +89652,7 @@ var init_wavChunks = __esm({
|
|
|
89467
89652
|
|
|
89468
89653
|
// ../engine/src/services/audioVolumeEnvelope.ts
|
|
89469
89654
|
import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync6, renameSync as renameSync3, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
89470
|
-
import { dirname as
|
|
89655
|
+
import { dirname as dirname10, join as join14 } from "path";
|
|
89471
89656
|
function readFmtChunk(buffer, body) {
|
|
89472
89657
|
const format = buffer.readUInt16LE(body);
|
|
89473
89658
|
const bits = buffer.readUInt16LE(body + 14);
|
|
@@ -89539,7 +89724,7 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
89539
89724
|
const layout2 = parseWavLayout(buffer);
|
|
89540
89725
|
if (!layout2) return false;
|
|
89541
89726
|
scaleSamples(buffer, layout2, gainAt);
|
|
89542
|
-
stagingDir = mkdtempSync3(join14(
|
|
89727
|
+
stagingDir = mkdtempSync3(join14(dirname10(wavPath), ".hf-volume-"));
|
|
89543
89728
|
const tempPath = join14(stagingDir, "audio.wav");
|
|
89544
89729
|
writeFileSync5(tempPath, buffer, { flag: "wx" });
|
|
89545
89730
|
renameSync3(tempPath, wavPath);
|
|
@@ -91012,7 +91197,7 @@ var init_audioFxRender = __esm({
|
|
|
91012
91197
|
|
|
91013
91198
|
// ../engine/src/services/audioMixer.ts
|
|
91014
91199
|
import { closeSync as closeSync2, existsSync as existsSync16, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync5, openSync as openSync2, rmSync as rmSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
91015
|
-
import { join as join16, dirname as
|
|
91200
|
+
import { join as join16, dirname as dirname11 } from "path";
|
|
91016
91201
|
function memberGroupKey(el) {
|
|
91017
91202
|
return el.getAttribute(AUDIO_GROUP_RENDER_ID_ATTR) ?? el.getAttribute(HF_AUDIO_GROUP_ATTR);
|
|
91018
91203
|
}
|
|
@@ -91315,7 +91500,7 @@ function parseAudioElements(html) {
|
|
|
91315
91500
|
}
|
|
91316
91501
|
async function extractAudioFromVideo(videoPath, outputPath, options, signal, config) {
|
|
91317
91502
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
91318
|
-
const outputDir =
|
|
91503
|
+
const outputDir = dirname11(outputPath);
|
|
91319
91504
|
if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
91320
91505
|
const playbackRate = normalizePlaybackRate(options?.playbackRate ?? 1);
|
|
91321
91506
|
const args = [];
|
|
@@ -91359,7 +91544,7 @@ async function extractAudioFromVideo(videoPath, outputPath, options, signal, con
|
|
|
91359
91544
|
}
|
|
91360
91545
|
async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, playbackRate = 1, signal, config) {
|
|
91361
91546
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
91362
|
-
const outputDir =
|
|
91547
|
+
const outputDir = dirname11(outputPath);
|
|
91363
91548
|
if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
91364
91549
|
const normalizedPlaybackRate = normalizePlaybackRate(playbackRate);
|
|
91365
91550
|
const outputArgs = await preparedAudioOutputArgs(srcPath, normalizedPlaybackRate);
|
|
@@ -91406,7 +91591,7 @@ async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, play
|
|
|
91406
91591
|
}
|
|
91407
91592
|
async function generateSilence(outputPath, duration, signal, config) {
|
|
91408
91593
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
91409
|
-
const outputDir =
|
|
91594
|
+
const outputDir = dirname11(outputPath);
|
|
91410
91595
|
if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
91411
91596
|
const args = [
|
|
91412
91597
|
"-f",
|
|
@@ -91460,7 +91645,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
91460
91645
|
failures: result2.failure ? [result2.failure] : void 0
|
|
91461
91646
|
};
|
|
91462
91647
|
}
|
|
91463
|
-
const outputDir =
|
|
91648
|
+
const outputDir = dirname11(outputPath);
|
|
91464
91649
|
if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
91465
91650
|
const buildFilterComplex = (ignoreAutomation) => {
|
|
91466
91651
|
const filterParts = [];
|
|
@@ -91568,7 +91753,7 @@ function groupNormalizeOptionUnsupported(stderr) {
|
|
|
91568
91753
|
}
|
|
91569
91754
|
async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal, config) {
|
|
91570
91755
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
91571
|
-
const outputDir =
|
|
91756
|
+
const outputDir = dirname11(outputPath);
|
|
91572
91757
|
if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
91573
91758
|
const buildInputFilters = (ignoreKeyframes) => memberTracks.map((track, i2) => {
|
|
91574
91759
|
const delayMs = Math.round(track.start * 1e3);
|
|
@@ -95985,9 +96170,9 @@ var init_render_success_state = __esm({
|
|
|
95985
96170
|
|
|
95986
96171
|
// src/utils/writeNewFile.ts
|
|
95987
96172
|
import { linkSync as linkSync3, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync8 } from "fs";
|
|
95988
|
-
import { dirname as
|
|
96173
|
+
import { dirname as dirname12, join as join21 } from "path";
|
|
95989
96174
|
function writeNewFileSync(filePath, content) {
|
|
95990
|
-
const stagingDir = mkdtempSync6(join21(
|
|
96175
|
+
const stagingDir = mkdtempSync6(join21(dirname12(filePath), ".hf-create-"));
|
|
95991
96176
|
try {
|
|
95992
96177
|
const stagedPath = join21(stagingDir, "content");
|
|
95993
96178
|
writeFileSync8(stagedPath, content, { encoding: "utf-8", flag: "wx" });
|
|
@@ -98193,7 +98378,7 @@ import {
|
|
|
98193
98378
|
rmSync as rmSync9,
|
|
98194
98379
|
writeFileSync as writeFileSync9
|
|
98195
98380
|
} from "fs";
|
|
98196
|
-
import { basename as basename3, dirname as
|
|
98381
|
+
import { basename as basename3, dirname as dirname13, isAbsolute as isAbsolute5, join as join23, relative as relative5, resolve as resolve11, sep as sep4 } from "path";
|
|
98197
98382
|
function registryRoot(directory) {
|
|
98198
98383
|
mkdirSync10(directory, { recursive: true });
|
|
98199
98384
|
return realpathSync2(directory);
|
|
@@ -98220,8 +98405,8 @@ function assertContained(root, path2) {
|
|
|
98220
98405
|
}
|
|
98221
98406
|
function publishRegistryFile(root, target, bytes) {
|
|
98222
98407
|
const path2 = registryTargetPath(root, target);
|
|
98223
|
-
mkdirSync10(
|
|
98224
|
-
const parent = realpathSync2(
|
|
98408
|
+
mkdirSync10(dirname13(path2), { recursive: true });
|
|
98409
|
+
const parent = realpathSync2(dirname13(path2));
|
|
98225
98410
|
assertContained(root, parent);
|
|
98226
98411
|
const destination = resolve11(parent, basename3(path2));
|
|
98227
98412
|
const stage = mkdtempSync7(join23(parent, ".hf-install-"));
|
|
@@ -108602,7 +108787,7 @@ import {
|
|
|
108602
108787
|
symlinkSync
|
|
108603
108788
|
} from "fs";
|
|
108604
108789
|
import { homedir as homedir7 } from "os";
|
|
108605
|
-
import { basename as basename5, dirname as
|
|
108790
|
+
import { basename as basename5, dirname as dirname14, isAbsolute as isAbsolute8, join as join32, relative as relative8, resolve as resolve15, sep as sep6 } from "path";
|
|
108606
108791
|
function canonicalCandidate(input2) {
|
|
108607
108792
|
let current2 = resolve15(input2);
|
|
108608
108793
|
const missing = [];
|
|
@@ -108613,7 +108798,7 @@ function canonicalCandidate(input2) {
|
|
|
108613
108798
|
} catch (error) {
|
|
108614
108799
|
const code = error.code;
|
|
108615
108800
|
if (code !== "ENOENT" && code !== "ENOTDIR") return null;
|
|
108616
|
-
const parent =
|
|
108801
|
+
const parent = dirname14(current2);
|
|
108617
108802
|
if (parent === current2) return null;
|
|
108618
108803
|
missing.unshift(basename5(current2));
|
|
108619
108804
|
current2 = parent;
|
|
@@ -108691,7 +108876,7 @@ function linkOrCopy(sourceSkill, targetSkill, platform11, safety) {
|
|
|
108691
108876
|
if (platform11 === "win32") {
|
|
108692
108877
|
cpSync(sourceSkill, targetSkill, { recursive: true });
|
|
108693
108878
|
} else {
|
|
108694
|
-
symlinkSync(relative8(
|
|
108879
|
+
symlinkSync(relative8(dirname14(targetSkill), sourceSkill), targetSkill);
|
|
108695
108880
|
}
|
|
108696
108881
|
return null;
|
|
108697
108882
|
}
|
|
@@ -108747,7 +108932,7 @@ function mirrorGlobalSkills(opts) {
|
|
|
108747
108932
|
const targetDir = join32(bases[base2], ...sub.split("/").filter(Boolean));
|
|
108748
108933
|
if (targetDir === source || targetDir === universalStore) continue;
|
|
108749
108934
|
if (UNIVERSAL_STORE_READERS.has(agent)) continue;
|
|
108750
|
-
if (!existsSync29(
|
|
108935
|
+
if (!existsSync29(dirname14(targetDir))) continue;
|
|
108751
108936
|
const attempt = mirrorInto(
|
|
108752
108937
|
targetDir,
|
|
108753
108938
|
source,
|
|
@@ -110343,7 +110528,7 @@ import {
|
|
|
110343
110528
|
writeFileSync as writeFileSync13
|
|
110344
110529
|
} from "fs";
|
|
110345
110530
|
import { homedir as homedir8 } from "os";
|
|
110346
|
-
import { dirname as
|
|
110531
|
+
import { dirname as dirname15, join as join33, resolve as resolve18 } from "path";
|
|
110347
110532
|
function defaultStateHome() {
|
|
110348
110533
|
return process.env.XDG_STATE_HOME || join33(homedir8(), ".local", "state");
|
|
110349
110534
|
}
|
|
@@ -110363,7 +110548,7 @@ function previewLogPath(projectDir, stateHome = defaultStateHome()) {
|
|
|
110363
110548
|
}
|
|
110364
110549
|
function writePreviewSession(session, stateHome = defaultStateHome()) {
|
|
110365
110550
|
const path2 = previewSessionPath(session.projectDir, stateHome);
|
|
110366
|
-
mkdirSync14(
|
|
110551
|
+
mkdirSync14(dirname15(path2), { recursive: true });
|
|
110367
110552
|
const temporary = `${path2}.${process.pid}.tmp`;
|
|
110368
110553
|
try {
|
|
110369
110554
|
writeFileSync13(temporary, `${JSON.stringify(session, null, 2)}
|
|
@@ -110439,7 +110624,7 @@ function stopProcess(pid) {
|
|
|
110439
110624
|
}
|
|
110440
110625
|
function spawnDetachedPreview(projectDir, stateHome, dependencies) {
|
|
110441
110626
|
const logPath = previewLogPath(projectDir, stateHome);
|
|
110442
|
-
mkdirSync14(
|
|
110627
|
+
mkdirSync14(dirname15(logPath), { recursive: true });
|
|
110443
110628
|
const logFd = openSync5(logPath, "a", 384);
|
|
110444
110629
|
const spawn17 = dependencies.spawn ?? nodeSpawn;
|
|
110445
110630
|
let child;
|
|
@@ -111794,7 +111979,7 @@ import {
|
|
|
111794
111979
|
unlinkSync as unlinkSync22,
|
|
111795
111980
|
utimesSync as utimesSync2
|
|
111796
111981
|
} from "fs";
|
|
111797
|
-
import { basename as basename7, dirname as
|
|
111982
|
+
import { basename as basename7, dirname as dirname16, isAbsolute as isAbsolute9, join as join210, relative as relative10, resolve as resolve21, sep as sep8 } from "path";
|
|
111798
111983
|
import { existsSync as existsSync34, readdirSync as readdirSync13, statSync as statSync14, unlinkSync as unlinkSync4 } from "fs";
|
|
111799
111984
|
import { extname as extname8, join as join34 } from "path";
|
|
111800
111985
|
function positiveEnvNumber(name, fallback) {
|
|
@@ -112108,7 +112293,7 @@ async function transcodeToCache(absoluteSourcePath, cachePath2, variant) {
|
|
|
112108
112293
|
await acquireSlot();
|
|
112109
112294
|
try {
|
|
112110
112295
|
if (existsSync210(cachePath2)) return cachePath2;
|
|
112111
|
-
const cacheDir =
|
|
112296
|
+
const cacheDir = dirname16(cachePath2);
|
|
112112
112297
|
mkdirSync15(cacheDir, { recursive: true });
|
|
112113
112298
|
const tempPath = join210(cacheDir, `.tmp-${randomUUID8()}-${basename7(cachePath2)}`);
|
|
112114
112299
|
try {
|
|
@@ -112128,7 +112313,7 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264") {
|
|
|
112128
112313
|
const cachePath2 = getCanonicalProxyCachePath(source, variant);
|
|
112129
112314
|
if (existsSync210(cachePath2)) {
|
|
112130
112315
|
markCacheEntryUsed(cachePath2);
|
|
112131
|
-
maintainProxyCache(
|
|
112316
|
+
maintainProxyCache(dirname16(cachePath2));
|
|
112132
112317
|
return cachePath2;
|
|
112133
112318
|
}
|
|
112134
112319
|
const rememberedFailure = failedTranscodes.get(cachePath2);
|
|
@@ -119093,7 +119278,7 @@ import {
|
|
|
119093
119278
|
rmSync as rmSync13,
|
|
119094
119279
|
statSync as statSync15
|
|
119095
119280
|
} from "fs";
|
|
119096
|
-
import { dirname as
|
|
119281
|
+
import { dirname as dirname17, join as join37 } from "path";
|
|
119097
119282
|
import { spawnSync } from "child_process";
|
|
119098
119283
|
import { mkdtempSync as mkdtempSync22, rmSync as rmSync22, writeFileSync as writeFileSync22 } from "fs";
|
|
119099
119284
|
import { tmpdir as tmpdir5 } from "os";
|
|
@@ -119470,7 +119655,7 @@ function isWaveformCacheDirectory(cacheDir) {
|
|
|
119470
119655
|
return lstatSync22(cacheDir, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
119471
119656
|
}
|
|
119472
119657
|
function writeWaveformCache(cachePath2, peaks) {
|
|
119473
|
-
const cacheDir =
|
|
119658
|
+
const cacheDir = dirname17(cachePath2);
|
|
119474
119659
|
try {
|
|
119475
119660
|
mkdirSync16(cacheDir, { mode: 448 });
|
|
119476
119661
|
} catch (error) {
|
|
@@ -119983,7 +120168,7 @@ function writeFileWithReceipt(c3, filePath, absPath, html) {
|
|
|
119983
120168
|
}
|
|
119984
120169
|
function writeMutationResult(c3, projectDir, filePath, absPath, html) {
|
|
119985
120170
|
const backup = snapshotBeforeWrite(projectDir, absPath);
|
|
119986
|
-
if (backup.error)
|
|
120171
|
+
if (backup.error) return c3.json({ error: `backup failed: ${backup.error}` }, 500);
|
|
119987
120172
|
const { version: version2 } = writeFileWithReceipt(c3, filePath, absPath, html);
|
|
119988
120173
|
return { backupPath: backupPathForResponse(projectDir, backup.backupPath), version: version2 };
|
|
119989
120174
|
}
|
|
@@ -119991,7 +120176,9 @@ function writeIfChanged(c3, projectDir, filePath, absPath, original, next) {
|
|
|
119991
120176
|
if (next === original) {
|
|
119992
120177
|
return c3.json({ ok: true, changed: false, content: original, path: filePath });
|
|
119993
120178
|
}
|
|
119994
|
-
const
|
|
120179
|
+
const mutationResult = writeMutationResult(c3, projectDir, filePath, absPath, next);
|
|
120180
|
+
if (mutationResult instanceof Response) return mutationResult;
|
|
120181
|
+
const { backupPath } = mutationResult;
|
|
119995
120182
|
return c3.json({
|
|
119996
120183
|
ok: true,
|
|
119997
120184
|
changed: true,
|
|
@@ -120375,13 +120562,15 @@ async function applyGsapMutations(c3, res, mutations) {
|
|
|
120375
120562
|
return c3.json({ error: "file changed during GSAP mutation", conflict: true }, 409);
|
|
120376
120563
|
}
|
|
120377
120564
|
if (changed) {
|
|
120378
|
-
|
|
120565
|
+
const mutationResult = writeMutationResult(
|
|
120379
120566
|
c3,
|
|
120380
120567
|
res.project.dir,
|
|
120381
120568
|
res.filePath,
|
|
120382
120569
|
res.absPath,
|
|
120383
120570
|
newHtml
|
|
120384
|
-
)
|
|
120571
|
+
);
|
|
120572
|
+
if (mutationResult instanceof Response) return mutationResult;
|
|
120573
|
+
backupPath = mutationResult.backupPath;
|
|
120385
120574
|
}
|
|
120386
120575
|
const responsePayload = {
|
|
120387
120576
|
ok: true,
|
|
@@ -121278,8 +121467,7 @@ function registerFileRoutes(api, adapter2) {
|
|
|
121278
121467
|
);
|
|
121279
121468
|
}
|
|
121280
121469
|
backup = snapshotBeforeWrite(res.project.dir, res.absPath);
|
|
121281
|
-
if (backup.error)
|
|
121282
|
-
console.warn(`Failed to create backup for ${res.filePath}: ${backup.error}`);
|
|
121470
|
+
if (backup.error) return c3.json({ error: `backup failed: ${backup.error}` }, 500);
|
|
121283
121471
|
ftruncateSync(fd, 0);
|
|
121284
121472
|
writeSync(fd, body, 0, body.length, 0);
|
|
121285
121473
|
} finally {
|
|
@@ -121318,7 +121506,7 @@ function registerFileRoutes(api, adapter2) {
|
|
|
121318
121506
|
if ("error" in res) return res.error;
|
|
121319
121507
|
const stat3 = statSync23(res.absPath);
|
|
121320
121508
|
const backup = snapshotBeforeWrite(res.project.dir, res.absPath);
|
|
121321
|
-
if (backup.error)
|
|
121509
|
+
if (backup.error) return c3.json({ error: `backup failed: ${backup.error}` }, 500);
|
|
121322
121510
|
if (stat3.isDirectory()) {
|
|
121323
121511
|
rmSync32(res.absPath, { recursive: true });
|
|
121324
121512
|
} else {
|
|
@@ -121588,13 +121776,15 @@ function registerFileRoutes(api, adapter2) {
|
|
|
121588
121776
|
version: version22
|
|
121589
121777
|
});
|
|
121590
121778
|
}
|
|
121591
|
-
const
|
|
121779
|
+
const mutationResult = writeMutationResult(
|
|
121592
121780
|
c3,
|
|
121593
121781
|
ctx.project.dir,
|
|
121594
121782
|
ctx.filePath,
|
|
121595
121783
|
ctx.absPath,
|
|
121596
121784
|
result.html
|
|
121597
121785
|
);
|
|
121786
|
+
if (mutationResult instanceof Response) return mutationResult;
|
|
121787
|
+
const { version: version2, backupPath } = mutationResult;
|
|
121598
121788
|
c3.header("ETag", version2);
|
|
121599
121789
|
return c3.json({
|
|
121600
121790
|
ok: true,
|
|
@@ -121641,13 +121831,15 @@ function registerFileRoutes(api, adapter2) {
|
|
|
121641
121831
|
version: version22
|
|
121642
121832
|
});
|
|
121643
121833
|
}
|
|
121644
|
-
const
|
|
121834
|
+
const mutationResult = writeMutationResult(
|
|
121645
121835
|
c3,
|
|
121646
121836
|
ctx.project.dir,
|
|
121647
121837
|
ctx.filePath,
|
|
121648
121838
|
ctx.absPath,
|
|
121649
121839
|
patched
|
|
121650
121840
|
);
|
|
121841
|
+
if (mutationResult instanceof Response) return mutationResult;
|
|
121842
|
+
const { backupPath, version: version2 } = mutationResult;
|
|
121651
121843
|
c3.header("ETag", version2);
|
|
121652
121844
|
return c3.json({
|
|
121653
121845
|
ok: true,
|
|
@@ -121742,13 +121934,15 @@ function registerFileRoutes(api, adapter2) {
|
|
|
121742
121934
|
result.error === "grouped elements must share a single parent" ? 422 : 400
|
|
121743
121935
|
);
|
|
121744
121936
|
}
|
|
121745
|
-
const
|
|
121937
|
+
const mutationResult = writeMutationResult(
|
|
121746
121938
|
c3,
|
|
121747
121939
|
ctx.project.dir,
|
|
121748
121940
|
ctx.filePath,
|
|
121749
121941
|
ctx.absPath,
|
|
121750
121942
|
result.html
|
|
121751
121943
|
);
|
|
121944
|
+
if (mutationResult instanceof Response) return mutationResult;
|
|
121945
|
+
const { backupPath } = mutationResult;
|
|
121752
121946
|
return c3.json({
|
|
121753
121947
|
ok: true,
|
|
121754
121948
|
changed: true,
|
|
@@ -124014,7 +124208,7 @@ var init_fileWatcher = __esm({
|
|
|
124014
124208
|
// src/server/runtimeSource.ts
|
|
124015
124209
|
import { createHash as createHash10 } from "crypto";
|
|
124016
124210
|
import { existsSync as existsSync38 } from "fs";
|
|
124017
|
-
import { resolve as resolve26, dirname as
|
|
124211
|
+
import { resolve as resolve26, dirname as dirname18 } from "path";
|
|
124018
124212
|
async function loadRuntimeSource() {
|
|
124019
124213
|
return await buildFromSource2() ?? await getInlinedRuntime() ?? readPrebuiltArtifact();
|
|
124020
124214
|
}
|
|
@@ -124075,7 +124269,7 @@ function readFromNodeModules() {
|
|
|
124075
124269
|
const result = readFromDir(resolve26(dir, sub));
|
|
124076
124270
|
if (result) return result;
|
|
124077
124271
|
}
|
|
124078
|
-
const parent =
|
|
124272
|
+
const parent = dirname18(dir);
|
|
124079
124273
|
if (parent === dir) break;
|
|
124080
124274
|
dir = parent;
|
|
124081
124275
|
}
|
|
@@ -125483,7 +125677,7 @@ var init_captureCompositionFrame = __esm({
|
|
|
125483
125677
|
// ../producer/src/services/hyperframeRuntimeLoader.ts
|
|
125484
125678
|
import { createHash as createHash11 } from "crypto";
|
|
125485
125679
|
import { existsSync as existsSync40, readFileSync as readFileSync26 } from "fs";
|
|
125486
|
-
import { dirname as
|
|
125680
|
+
import { dirname as dirname19, resolve as resolve28 } from "path";
|
|
125487
125681
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
125488
125682
|
function resolveHyperframeManifestPath() {
|
|
125489
125683
|
const envOverride = process.env.PRODUCER_HYPERFRAME_MANIFEST_PATH;
|
|
@@ -125515,7 +125709,7 @@ function resolveVerifiedHyperframeRuntime() {
|
|
|
125515
125709
|
`[HyperframeRuntimeLoader] Invalid manifest at ${manifestPath2}; missing iife artifact or sha256.`
|
|
125516
125710
|
);
|
|
125517
125711
|
}
|
|
125518
|
-
const runtimePath = resolve28(
|
|
125712
|
+
const runtimePath = resolve28(dirname19(manifestPath2), runtimeFileName);
|
|
125519
125713
|
if (!existsSync40(runtimePath)) {
|
|
125520
125714
|
throw new Error(`[HyperframeRuntimeLoader] Missing runtime artifact at ${runtimePath}.`);
|
|
125521
125715
|
}
|
|
@@ -125538,7 +125732,7 @@ var PRODUCER_DIR, SIBLING_MANIFEST_PATH, MODULE_RELATIVE_MANIFEST_PATH, MANIFEST
|
|
|
125538
125732
|
var init_hyperframeRuntimeLoader = __esm({
|
|
125539
125733
|
"../producer/src/services/hyperframeRuntimeLoader.ts"() {
|
|
125540
125734
|
"use strict";
|
|
125541
|
-
PRODUCER_DIR =
|
|
125735
|
+
PRODUCER_DIR = dirname19(fileURLToPath2(import.meta.url));
|
|
125542
125736
|
SIBLING_MANIFEST_PATH = resolve28(PRODUCER_DIR, "hyperframe.manifest.json");
|
|
125543
125737
|
MODULE_RELATIVE_MANIFEST_PATH = resolve28(
|
|
125544
125738
|
PRODUCER_DIR,
|
|
@@ -126303,7 +126497,7 @@ import {
|
|
|
126303
126497
|
symlinkSync as symlinkSync2,
|
|
126304
126498
|
writeFileSync as writeFileSync15
|
|
126305
126499
|
} from "fs";
|
|
126306
|
-
import { basename as basename11, dirname as
|
|
126500
|
+
import { basename as basename11, dirname as dirname20, isAbsolute as isAbsolute11, join as join44, relative as relative12, resolve as resolve30 } from "path";
|
|
126307
126501
|
function resolveBrowserMediaEnd(start, end, duration) {
|
|
126308
126502
|
return Number.isFinite(duration) && duration > 0 ? start + duration : end;
|
|
126309
126503
|
}
|
|
@@ -126339,7 +126533,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
126339
126533
|
writeFileSync15(join44(compileDir, "index.html"), compiled.html, "utf-8");
|
|
126340
126534
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
126341
126535
|
const outPath = join44(compileDir, srcPath);
|
|
126342
|
-
mkdirSync18(
|
|
126536
|
+
mkdirSync18(dirname20(outPath), { recursive: true });
|
|
126343
126537
|
writeFileSync15(outPath, html, "utf-8");
|
|
126344
126538
|
}
|
|
126345
126539
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
@@ -126348,7 +126542,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
126348
126542
|
console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
|
|
126349
126543
|
continue;
|
|
126350
126544
|
}
|
|
126351
|
-
mkdirSync18(
|
|
126545
|
+
mkdirSync18(dirname20(outPath), { recursive: true });
|
|
126352
126546
|
copyFileSync3(absolutePath, outPath);
|
|
126353
126547
|
}
|
|
126354
126548
|
if (includeSummary) {
|
|
@@ -126519,7 +126713,7 @@ var init_shared = __esm({
|
|
|
126519
126713
|
materializePathModule = {
|
|
126520
126714
|
resolve: resolve30,
|
|
126521
126715
|
join: join44,
|
|
126522
|
-
dirname:
|
|
126716
|
+
dirname: dirname20,
|
|
126523
126717
|
basename: basename11,
|
|
126524
126718
|
relative: relative12,
|
|
126525
126719
|
isAbsolute: isAbsolute11
|
|
@@ -126751,7 +126945,7 @@ import {
|
|
|
126751
126945
|
renameSync as renameSync10,
|
|
126752
126946
|
rmSync as rmSync16
|
|
126753
126947
|
} from "fs";
|
|
126754
|
-
import { basename as basename12, dirname as
|
|
126948
|
+
import { basename as basename12, dirname as dirname21, extname as extname11, join as join45, resolve as resolve31 } from "path";
|
|
126755
126949
|
async function defaultArtifactDurationProbe(path2) {
|
|
126756
126950
|
const meta = await extractMediaMetadata(path2);
|
|
126757
126951
|
return {
|
|
@@ -126760,7 +126954,7 @@ async function defaultArtifactDurationProbe(path2) {
|
|
|
126760
126954
|
};
|
|
126761
126955
|
}
|
|
126762
126956
|
function createSiblingTransactionDirectory(destination) {
|
|
126763
|
-
const parent =
|
|
126957
|
+
const parent = dirname21(destination);
|
|
126764
126958
|
const extension2 = extname11(destination);
|
|
126765
126959
|
const stem = extension2 ? basename12(destination, extension2) : basename12(destination);
|
|
126766
126960
|
return mkdtempSync9(join45(parent, `.${stem}.hf-transaction-`));
|
|
@@ -131464,7 +131658,7 @@ import {
|
|
|
131464
131658
|
writeFileSync as writeFileSync16
|
|
131465
131659
|
} from "fs";
|
|
131466
131660
|
import { homedir as homedir12, tmpdir as tmpdir6 } from "os";
|
|
131467
|
-
import { dirname as
|
|
131661
|
+
import { dirname as dirname23, join as join47 } from "path";
|
|
131468
131662
|
async function compressToWoff2(input2) {
|
|
131469
131663
|
return Buffer.from(await compress(input2));
|
|
131470
131664
|
}
|
|
@@ -131491,8 +131685,8 @@ function readCachedCompression(path2) {
|
|
|
131491
131685
|
function cacheCompression(path2, compressed) {
|
|
131492
131686
|
let tempDir;
|
|
131493
131687
|
try {
|
|
131494
|
-
mkdirSync19(
|
|
131495
|
-
tempDir = mkdtempSync10(join47(
|
|
131688
|
+
mkdirSync19(dirname23(path2), { recursive: true });
|
|
131689
|
+
tempDir = mkdtempSync10(join47(dirname23(path2), ".compression-"));
|
|
131496
131690
|
const tmpPath = join47(tempDir, "font.woff2");
|
|
131497
131691
|
writeFileSync16(tmpPath, compressed, { flag: "wx", mode: 420 });
|
|
131498
131692
|
renameSync11(tmpPath, path2);
|
|
@@ -132549,7 +132743,7 @@ import {
|
|
|
132549
132743
|
rmSync as rmSync18,
|
|
132550
132744
|
statSync as statSync18
|
|
132551
132745
|
} from "fs";
|
|
132552
|
-
import { dirname as
|
|
132746
|
+
import { dirname as dirname24, isAbsolute as isAbsolute12, join as join49, resolve as resolve33 } from "path";
|
|
132553
132747
|
function splitUrlSuffix2(src) {
|
|
132554
132748
|
const queryIdx = src.indexOf("?");
|
|
132555
132749
|
const hashIdx = src.indexOf("#");
|
|
@@ -132698,11 +132892,11 @@ async function runAnimatedGifTranscode(request) {
|
|
|
132698
132892
|
throw result.error ?? new Error(`Animated GIF transcode failed (${result.exitCode}): ${result.stderr.slice(-500)}`);
|
|
132699
132893
|
}
|
|
132700
132894
|
async function ensurePreparedWebm(input2) {
|
|
132701
|
-
if (!existsSync47(
|
|
132702
|
-
mkdirSync21(
|
|
132895
|
+
if (!existsSync47(dirname24(input2.cachePath))) {
|
|
132896
|
+
mkdirSync21(dirname24(input2.cachePath), { recursive: true });
|
|
132703
132897
|
}
|
|
132704
|
-
if (!existsSync47(
|
|
132705
|
-
mkdirSync21(
|
|
132898
|
+
if (!existsSync47(dirname24(input2.outputPath))) {
|
|
132899
|
+
mkdirSync21(dirname24(input2.outputPath), { recursive: true });
|
|
132706
132900
|
}
|
|
132707
132901
|
if (!isUsableFile(input2.cachePath)) {
|
|
132708
132902
|
const tmpPath = `${input2.cachePath}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -133051,7 +133245,7 @@ var init_assetMediaType = __esm({
|
|
|
133051
133245
|
// ../producer/src/services/htmlCompiler.ts
|
|
133052
133246
|
import { createHash as createHash16 } from "crypto";
|
|
133053
133247
|
import { createReadStream as createReadStream5, existsSync as existsSync49, mkdirSync as mkdirSync23, readFileSync as readFileSync30 } from "fs";
|
|
133054
|
-
import { join as join50, dirname as
|
|
133248
|
+
import { join as join50, dirname as dirname25, resolve as resolve34, basename as basename13, relative as relative13 } from "path";
|
|
133055
133249
|
function logRemoteDownloadTelemetry(event) {
|
|
133056
133250
|
defaultLogger.info("[Compiler] Remote asset download integrity", { ...event });
|
|
133057
133251
|
}
|
|
@@ -133361,7 +133555,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
133361
133555
|
workItems.map(async (item) => {
|
|
133362
133556
|
const { html: compiledSub } = await compileHtmlFile(
|
|
133363
133557
|
item.rawSubHtml,
|
|
133364
|
-
|
|
133558
|
+
dirname25(item.filePath),
|
|
133365
133559
|
downloadDir
|
|
133366
133560
|
);
|
|
133367
133561
|
const nested = await parseSubCompositions(
|
|
@@ -137975,7 +138169,7 @@ var init_captureHdrSequentialLoop = __esm({
|
|
|
137975
138169
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
137976
138170
|
import { Worker as Worker2 } from "worker_threads";
|
|
137977
138171
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "url";
|
|
137978
|
-
import { dirname as
|
|
138172
|
+
import { dirname as dirname26, join as join60 } from "path";
|
|
137979
138173
|
import { createRequire as createRequire2 } from "module";
|
|
137980
138174
|
import { existsSync as existsSync51 } from "fs";
|
|
137981
138175
|
import { cpus as cpus4 } from "os";
|
|
@@ -137988,7 +138182,7 @@ function resolveWorkerEntry(explicit) {
|
|
|
137988
138182
|
const isTs = override.endsWith(".ts");
|
|
137989
138183
|
return { path: override, isTs };
|
|
137990
138184
|
}
|
|
137991
|
-
const moduleDir =
|
|
138185
|
+
const moduleDir = dirname26(fileURLToPath4(import.meta.url));
|
|
137992
138186
|
const jsPath = join60(moduleDir, "shaderTransitionWorker.js");
|
|
137993
138187
|
if (existsSync51(jsPath)) return { path: jsPath, isTs: false };
|
|
137994
138188
|
const tsPath = join60(moduleDir, "shaderTransitionWorker.ts");
|
|
@@ -138777,7 +138971,7 @@ var init_gifEncodeArgs = __esm({
|
|
|
138777
138971
|
|
|
138778
138972
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
138779
138973
|
import { copyFileSync as copyFileSync5, existsSync as existsSync54, mkdirSync as mkdirSync26, readdirSync as readdirSync18, rmSync as rmSync20, statSync as statSync19 } from "fs";
|
|
138780
|
-
import { dirname as
|
|
138974
|
+
import { dirname as dirname27, join as join65 } from "path";
|
|
138781
138975
|
function resolveGifLoop(loop) {
|
|
138782
138976
|
const resolved2 = loop ?? 0;
|
|
138783
138977
|
if (!Number.isInteger(resolved2) || resolved2 < 0 || resolved2 > 65535) {
|
|
@@ -138908,7 +139102,7 @@ async function runEncodeStage(input2) {
|
|
|
138908
139102
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
138909
139103
|
fps: job.config.fps,
|
|
138910
139104
|
loop,
|
|
138911
|
-
palettePath: join65(
|
|
139105
|
+
palettePath: join65(dirname27(videoOnlyPath), "gif-palette.png"),
|
|
138912
139106
|
preserveAlpha: needsAlpha,
|
|
138913
139107
|
signal: abortSignal,
|
|
138914
139108
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -138979,7 +139173,7 @@ var init_encodeStage = __esm({
|
|
|
138979
139173
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
138980
139174
|
import { spawn as spawn11 } from "child_process";
|
|
138981
139175
|
import { mkdtempSync as mkdtempSync13, renameSync as renameSync13, rmSync as rmSync21 } from "fs";
|
|
138982
|
-
import { dirname as
|
|
139176
|
+
import { dirname as dirname28, join as join66 } from "path";
|
|
138983
139177
|
function buildAacTruePeakCorrectionArgs(inputPath, outputPath, targetDurationSeconds, attenuationDb) {
|
|
138984
139178
|
return [
|
|
138985
139179
|
"-i",
|
|
@@ -139176,7 +139370,7 @@ async function padOrTrimAudioToVideoFrameCount(input2) {
|
|
|
139176
139370
|
async function enforceAacTruePeak(input2) {
|
|
139177
139371
|
let scratchDir;
|
|
139178
139372
|
try {
|
|
139179
|
-
scratchDir = mkdtempSync13(join66(
|
|
139373
|
+
scratchDir = mkdtempSync13(join66(dirname28(input2.audioPath), ".true-peak-"));
|
|
139180
139374
|
const correctedPath = join66(scratchDir, "audio.m4a");
|
|
139181
139375
|
const correctionTargetDbfs = AAC_DELIVERY_TRUE_PEAK_DBFS - AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB;
|
|
139182
139376
|
const measurements = [];
|
|
@@ -139457,7 +139651,7 @@ import {
|
|
|
139457
139651
|
appendFileSync
|
|
139458
139652
|
} from "fs";
|
|
139459
139653
|
import { tmpdir as tmpdir9 } from "os";
|
|
139460
|
-
import { join as join67, dirname as
|
|
139654
|
+
import { join as join67, dirname as dirname29, resolve as resolve35 } from "path";
|
|
139461
139655
|
import { totalmem as totalmem3 } from "os";
|
|
139462
139656
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
139463
139657
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -139651,7 +139845,7 @@ function getNextRetryWorkerCount(currentWorkers) {
|
|
|
139651
139845
|
}
|
|
139652
139846
|
function resolveRenderWorkDirPrefix(outputPath, jobId, platform11 = process.platform, systemTempDir = tmpdir9()) {
|
|
139653
139847
|
if (platform11 === "win32") return join67(systemTempDir, "hf-render-");
|
|
139654
|
-
return join67(
|
|
139848
|
+
return join67(dirname29(outputPath), `work-${jobId}-`);
|
|
139655
139849
|
}
|
|
139656
139850
|
function captureAttemptMadeProgress(attemptTargetFrameCount, remainingFrameCount) {
|
|
139657
139851
|
return remainingFrameCount < attemptTargetFrameCount;
|
|
@@ -140010,6 +140204,7 @@ function shouldRetryViaPinnedFallback(args) {
|
|
|
140010
140204
|
if (args.isCancellation || args.isEncoderInterrupted) return false;
|
|
140011
140205
|
if (args.isVerifyError || args.isDeCaptureError) return true;
|
|
140012
140206
|
if (args.isDeRendererStall === true || args.isSequentialCaptureStall === true) return true;
|
|
140207
|
+
if (args.isTransientCaptureError === true) return true;
|
|
140013
140208
|
return args.deWorkerInversion === "inverted" || args.deParallelRouter === "routed";
|
|
140014
140209
|
}
|
|
140015
140210
|
function isDeRendererStallError(err) {
|
|
@@ -140072,10 +140267,10 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
140072
140267
|
};
|
|
140073
140268
|
}
|
|
140074
140269
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal) {
|
|
140075
|
-
const moduleDir =
|
|
140270
|
+
const moduleDir = dirname29(fileURLToPath5(import.meta.url));
|
|
140076
140271
|
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve35(process.env.PRODUCER_RENDERS_DIR, "..") : resolve35(moduleDir, "../..");
|
|
140077
140272
|
const debugDir = join67(producerRoot, ".debug");
|
|
140078
|
-
const outputDir =
|
|
140273
|
+
const outputDir = dirname29(outputPath);
|
|
140079
140274
|
if (!existsSync55(outputDir)) mkdirSync27(outputDir, { recursive: true });
|
|
140080
140275
|
const workDir = job.config.debug ? join67(debugDir, job.id) : mkdtempSync14(resolveRenderWorkDirPrefix(outputPath, job.id));
|
|
140081
140276
|
const pipelineStart = Date.now();
|
|
@@ -141123,7 +141318,8 @@ async function executeRenderPipeline(input2) {
|
|
|
141123
141318
|
deWorkerInversion,
|
|
141124
141319
|
deParallelRouter,
|
|
141125
141320
|
isDeRendererStall: isDeStall,
|
|
141126
|
-
isSequentialCaptureStall: isSequentialStall
|
|
141321
|
+
isSequentialCaptureStall: isSequentialStall,
|
|
141322
|
+
isTransientCaptureError: isTransientBrowserError(err)
|
|
141127
141323
|
}))
|
|
141128
141324
|
throw err;
|
|
141129
141325
|
const isMemoryExhaustion = !isVerifyError && isMemoryExhaustionError(err);
|
|
@@ -142242,7 +142438,7 @@ var init_hyperframeLint = __esm({
|
|
|
142242
142438
|
// ../producer/src/services/healthWorker.ts
|
|
142243
142439
|
import { Worker as Worker3 } from "worker_threads";
|
|
142244
142440
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
142245
|
-
import { dirname as
|
|
142441
|
+
import { dirname as dirname30, join as join69 } from "path";
|
|
142246
142442
|
import { existsSync as existsSync57 } from "fs";
|
|
142247
142443
|
async function startHealthWorker(options = {}) {
|
|
142248
142444
|
const log2 = options.logger ?? defaultLogger2();
|
|
@@ -142316,7 +142512,7 @@ function defaultLogger2() {
|
|
|
142316
142512
|
};
|
|
142317
142513
|
}
|
|
142318
142514
|
function resolveWorkerEntry2() {
|
|
142319
|
-
const here =
|
|
142515
|
+
const here = dirname30(fileURLToPath6(import.meta.url));
|
|
142320
142516
|
const candidates = [join69(here, "healthWorkerThread.js"), join69(here, "healthWorkerThread.ts")];
|
|
142321
142517
|
for (const candidate of candidates) {
|
|
142322
142518
|
if (existsSync57(candidate)) return candidate;
|
|
@@ -142341,7 +142537,7 @@ import {
|
|
|
142341
142537
|
rmSync as rmSync24,
|
|
142342
142538
|
createReadStream as createReadStream6
|
|
142343
142539
|
} from "fs";
|
|
142344
|
-
import { resolve as resolve37, dirname as
|
|
142540
|
+
import { resolve as resolve37, dirname as dirname31, join as join70 } from "path";
|
|
142345
142541
|
import { tmpdir as tmpdir10 } from "os";
|
|
142346
142542
|
import { parseArgs as parseArgs2 } from "util";
|
|
142347
142543
|
import crypto2 from "crypto";
|
|
@@ -142466,7 +142662,7 @@ function buildRenderJobConfig(input2, outputPath, log2) {
|
|
|
142466
142662
|
function resolvePreparedRenderOutput(prepared, rendersDir, log2) {
|
|
142467
142663
|
const { input: input2, cleanupProjectDir } = prepared;
|
|
142468
142664
|
const absoluteOutputPath = resolveOutputPath(input2.projectDir, input2.outputPath, rendersDir, log2);
|
|
142469
|
-
const outputDir =
|
|
142665
|
+
const outputDir = dirname31(absoluteOutputPath);
|
|
142470
142666
|
if (!existsSync58(outputDir)) mkdirSync28(outputDir, { recursive: true });
|
|
142471
142667
|
return { input: input2, cleanupProjectDir, absoluteOutputPath };
|
|
142472
142668
|
}
|
|
@@ -143368,7 +143564,7 @@ var init_runtimeEnvSnapshot = __esm({
|
|
|
143368
143564
|
|
|
143369
143565
|
// ../producer/src/services/distributed/shared.ts
|
|
143370
143566
|
import { execFile as execFileCallback } from "child_process";
|
|
143371
|
-
import { dirname as
|
|
143567
|
+
import { dirname as dirname33, join as join73 } from "path";
|
|
143372
143568
|
import { existsSync as existsSync60, readFileSync as readFileSync36 } from "fs";
|
|
143373
143569
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
143374
143570
|
import { promisify as promisify6 } from "util";
|
|
@@ -143566,7 +143762,7 @@ function buildSyntheticRenderJob(input2) {
|
|
|
143566
143762
|
}
|
|
143567
143763
|
function readProducerVersion() {
|
|
143568
143764
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
143569
|
-
const startDir =
|
|
143765
|
+
const startDir = dirname33(fileURLToPath7(import.meta.url));
|
|
143570
143766
|
let current2 = startDir;
|
|
143571
143767
|
for (let i2 = 0; i2 < 10; i2++) {
|
|
143572
143768
|
const candidate = join73(current2, "package.json");
|
|
@@ -143580,7 +143776,7 @@ function readProducerVersion() {
|
|
|
143580
143776
|
} catch {
|
|
143581
143777
|
}
|
|
143582
143778
|
}
|
|
143583
|
-
const parent =
|
|
143779
|
+
const parent = dirname33(current2);
|
|
143584
143780
|
if (parent === current2) break;
|
|
143585
143781
|
current2 = parent;
|
|
143586
143782
|
}
|
|
@@ -144367,7 +144563,7 @@ import {
|
|
|
144367
144563
|
statSync as statSync25,
|
|
144368
144564
|
writeFileSync as writeFileSync23
|
|
144369
144565
|
} from "fs";
|
|
144370
|
-
import { dirname as
|
|
144566
|
+
import { dirname as dirname34, join as join77 } from "path";
|
|
144371
144567
|
function canFallbackToCopy(error) {
|
|
144372
144568
|
if (!(error instanceof Error) || !("code" in error)) return false;
|
|
144373
144569
|
const code = error.code;
|
|
@@ -144410,8 +144606,8 @@ var init_planV2Publisher = __esm({
|
|
|
144410
144606
|
}
|
|
144411
144607
|
this.destinationDir = destinationDir;
|
|
144412
144608
|
this.#linkFile = options.linkFile ?? linkSync4;
|
|
144413
|
-
mkdirSync31(
|
|
144414
|
-
this.temporaryDir = mkdtempSync16(join77(
|
|
144609
|
+
mkdirSync31(dirname34(destinationDir), { recursive: true });
|
|
144610
|
+
this.temporaryDir = mkdtempSync16(join77(dirname34(destinationDir), ".plan-v2-publish-"));
|
|
144415
144611
|
}
|
|
144416
144612
|
async putBlob(blob) {
|
|
144417
144613
|
const digest2 = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
@@ -144423,8 +144619,8 @@ var init_planV2Publisher = __esm({
|
|
|
144423
144619
|
}
|
|
144424
144620
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest2);
|
|
144425
144621
|
if (existsSync63(destinationPath)) return;
|
|
144426
|
-
mkdirSync31(
|
|
144427
|
-
const stagingDir = mkdtempSync16(join77(
|
|
144622
|
+
mkdirSync31(dirname34(destinationPath), { recursive: true });
|
|
144623
|
+
const stagingDir = mkdtempSync16(join77(dirname34(destinationPath), ".plan-v2-blob-"));
|
|
144428
144624
|
const temporaryPath = join77(stagingDir, "blob");
|
|
144429
144625
|
try {
|
|
144430
144626
|
try {
|
|
@@ -144478,7 +144674,7 @@ import {
|
|
|
144478
144674
|
} from "fs";
|
|
144479
144675
|
import { createHash as createHash19 } from "crypto";
|
|
144480
144676
|
import { tmpdir as tmpdir11 } from "os";
|
|
144481
|
-
import { dirname as
|
|
144677
|
+
import { dirname as dirname35, isAbsolute as isAbsolute14, join as join78, relative as relative18, resolve as resolve39, sep as sep14 } from "path";
|
|
144482
144678
|
function isRecord8(value) {
|
|
144483
144679
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
144484
144680
|
}
|
|
@@ -144709,8 +144905,8 @@ function computeManifestHash(manifest) {
|
|
|
144709
144905
|
}
|
|
144710
144906
|
function writeBlob(sourcePath, destinationPath) {
|
|
144711
144907
|
if (existsSync64(destinationPath)) return;
|
|
144712
|
-
mkdirSync33(
|
|
144713
|
-
const temporaryDir = mkdtempSync17(join78(
|
|
144908
|
+
mkdirSync33(dirname35(destinationPath), { recursive: true });
|
|
144909
|
+
const temporaryDir = mkdtempSync17(join78(dirname35(destinationPath), ".plan-v2-blob-"));
|
|
144714
144910
|
const temporaryPath = join78(temporaryDir, "blob");
|
|
144715
144911
|
try {
|
|
144716
144912
|
copyFileSync8(sourcePath, temporaryPath);
|
|
@@ -144795,8 +144991,8 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
144795
144991
|
throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
|
|
144796
144992
|
}
|
|
144797
144993
|
const publication = buildPlanV2Publication(executionPlanDir);
|
|
144798
|
-
mkdirSync33(
|
|
144799
|
-
const tempDir = mkdtempSync17(join78(
|
|
144994
|
+
mkdirSync33(dirname35(planV2Dir), { recursive: true });
|
|
144995
|
+
const tempDir = mkdtempSync17(join78(dirname35(planV2Dir), ".plan-v2-build-"));
|
|
144800
144996
|
try {
|
|
144801
144997
|
for (const blob of publication.blobs) {
|
|
144802
144998
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
@@ -144863,7 +145059,7 @@ async function planV2(projectDir, config, planV2Dir) {
|
|
|
144863
145059
|
}
|
|
144864
145060
|
const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
|
|
144865
145061
|
const manifest = await planV2WithPublisher(projectDir, config, publisher, {
|
|
144866
|
-
stagingParentDir:
|
|
145062
|
+
stagingParentDir: dirname35(planV2Dir)
|
|
144867
145063
|
});
|
|
144868
145064
|
return resultFromManifest(planV2Dir, manifest);
|
|
144869
145065
|
}
|
|
@@ -145047,12 +145243,12 @@ function materializePlanV2Target(planV2Dir, target, destinationDir) {
|
|
|
145047
145243
|
artifact,
|
|
145048
145244
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
145049
145245
|
}));
|
|
145050
|
-
mkdirSync33(
|
|
145051
|
-
const tempDir = mkdtempSync17(join78(
|
|
145246
|
+
mkdirSync33(dirname35(destinationDir), { recursive: true });
|
|
145247
|
+
const tempDir = mkdtempSync17(join78(dirname35(destinationDir), ".plan-v2-materialize-"));
|
|
145052
145248
|
try {
|
|
145053
145249
|
for (const { artifact, sourcePath } of verified) {
|
|
145054
145250
|
const destinationPath = join78(tempDir, ...artifact.path.split("/"));
|
|
145055
|
-
mkdirSync33(
|
|
145251
|
+
mkdirSync33(dirname35(destinationPath), { recursive: true });
|
|
145056
145252
|
copyFileSync8(sourcePath, destinationPath);
|
|
145057
145253
|
}
|
|
145058
145254
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
@@ -145138,7 +145334,7 @@ import {
|
|
|
145138
145334
|
statSync as statSync27,
|
|
145139
145335
|
writeFileSync as writeFileSync25
|
|
145140
145336
|
} from "fs";
|
|
145141
|
-
import { dirname as
|
|
145337
|
+
import { dirname as dirname36, join as join79 } from "path";
|
|
145142
145338
|
async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
145143
145339
|
const start = Date.now();
|
|
145144
145340
|
const log2 = options?.logger ?? defaultLogger;
|
|
@@ -145169,8 +145365,8 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
145169
145365
|
if (plan2.dimensions.format === "png-sequence") {
|
|
145170
145366
|
return mergePngFrameDirs(chunkPaths, outputPath, plan2.totalFrames, audioPath, start);
|
|
145171
145367
|
}
|
|
145172
|
-
if (!existsSync65(
|
|
145173
|
-
mkdirSync34(
|
|
145368
|
+
if (!existsSync65(dirname36(outputPath))) {
|
|
145369
|
+
mkdirSync34(dirname36(outputPath), { recursive: true });
|
|
145174
145370
|
}
|
|
145175
145371
|
const workDir = mkdtempSync18(`${outputPath}.assemble-work-`);
|
|
145176
145372
|
try {
|
|
@@ -147746,7 +147942,7 @@ import {
|
|
|
147746
147942
|
symlinkSync as symlinkSync3,
|
|
147747
147943
|
unlinkSync as unlinkSync7
|
|
147748
147944
|
} from "fs";
|
|
147749
|
-
import { resolve as resolve41, dirname as
|
|
147945
|
+
import { resolve as resolve41, dirname as dirname37, basename as basename15, join as join86 } from "path";
|
|
147750
147946
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
147751
147947
|
import { createRequire as createRequire3 } from "module";
|
|
147752
147948
|
function previewLaunchMode(options) {
|
|
@@ -148361,7 +148557,7 @@ function reportPreviewShutdown(json) {
|
|
|
148361
148557
|
}
|
|
148362
148558
|
async function runDevMode(dir, options) {
|
|
148363
148559
|
const thisFile = fileURLToPath8(import.meta.url);
|
|
148364
|
-
const repoRoot2 = resolve41(
|
|
148560
|
+
const repoRoot2 = resolve41(dirname37(thisFile), "..", "..", "..", "..");
|
|
148365
148561
|
const projectsDir = join86(repoRoot2, "packages", "studio", "data", "projects");
|
|
148366
148562
|
const pName = options?.projectName ?? basename15(dir);
|
|
148367
148563
|
const { symlinkPath, createdSymlink } = linkProjectIntoStudioData(dir, projectsDir, pName);
|
|
@@ -148385,7 +148581,7 @@ async function runDevMode(dir, options) {
|
|
|
148385
148581
|
function hasLocalStudio(dir) {
|
|
148386
148582
|
try {
|
|
148387
148583
|
const req = createRequire3(join86(dir, "package.json"));
|
|
148388
|
-
const studioPkgPath =
|
|
148584
|
+
const studioPkgPath = dirname37(req.resolve("@hyperframes/studio/package.json"));
|
|
148389
148585
|
return existsSync70(join86(studioPkgPath, "vite.config.ts"));
|
|
148390
148586
|
} catch {
|
|
148391
148587
|
return false;
|
|
@@ -148393,7 +148589,7 @@ function hasLocalStudio(dir) {
|
|
|
148393
148589
|
}
|
|
148394
148590
|
async function runLocalStudioMode(dir, options) {
|
|
148395
148591
|
const req = createRequire3(join86(dir, "package.json"));
|
|
148396
|
-
const studioPkgPath =
|
|
148592
|
+
const studioPkgPath = dirname37(req.resolve("@hyperframes/studio/package.json"));
|
|
148397
148593
|
const pName = options?.projectName ?? basename15(dir);
|
|
148398
148594
|
const projectsDir = join86(studioPkgPath, "data", "projects");
|
|
148399
148595
|
const { symlinkPath, createdSymlink } = linkProjectIntoStudioData(dir, projectsDir, pName);
|
|
@@ -149050,7 +149246,7 @@ import {
|
|
|
149050
149246
|
readFileSync as readFileSync44,
|
|
149051
149247
|
readdirSync as readdirSync27
|
|
149052
149248
|
} from "fs";
|
|
149053
|
-
import { resolve as resolve43, basename as basename16, join as join87, dirname as
|
|
149249
|
+
import { resolve as resolve43, basename as basename16, join as join87, dirname as dirname38 } from "path";
|
|
149054
149250
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
149055
149251
|
import { execFileSync as execFileSync10, spawn as spawn14 } from "child_process";
|
|
149056
149252
|
function resolveScaffoldTemplateId(exampleFlag, hasMediaFile) {
|
|
@@ -149148,13 +149344,13 @@ function transcodeToMp4(inputPath, outputPath) {
|
|
|
149148
149344
|
});
|
|
149149
149345
|
}
|
|
149150
149346
|
function resolveAssetDir(devSegments, builtSegments) {
|
|
149151
|
-
const base2 =
|
|
149347
|
+
const base2 = dirname38(fileURLToPath9(import.meta.url));
|
|
149152
149348
|
const devPath = resolve43(base2, ...devSegments);
|
|
149153
149349
|
const builtPath = resolve43(base2, ...builtSegments);
|
|
149154
149350
|
return existsSync71(devPath) ? devPath : builtPath;
|
|
149155
149351
|
}
|
|
149156
149352
|
function getStaticTemplateDir(templateId) {
|
|
149157
|
-
const base2 =
|
|
149353
|
+
const base2 = dirname38(fileURLToPath9(import.meta.url));
|
|
149158
149354
|
const devPath = resolve43(base2, "..", "templates", templateId);
|
|
149159
149355
|
if (existsSync71(devPath)) return devPath;
|
|
149160
149356
|
const registryPath = resolve43(base2, "..", "..", "..", "..", "registry", "examples", templateId);
|
|
@@ -151280,11 +151476,11 @@ var init_mediaProxyPreview = __esm({
|
|
|
151280
151476
|
|
|
151281
151477
|
// src/utils/compositionServer.ts
|
|
151282
151478
|
import { createReadStream as createReadStream7, existsSync as existsSync76, statSync as statSync28 } from "fs";
|
|
151283
|
-
import { resolve as resolve46, dirname as
|
|
151479
|
+
import { resolve as resolve46, dirname as dirname39 } from "path";
|
|
151284
151480
|
import { Readable as Readable4 } from "stream";
|
|
151285
151481
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
151286
151482
|
function helperDir() {
|
|
151287
|
-
return
|
|
151483
|
+
return dirname39(fileURLToPath10(import.meta.url));
|
|
151288
151484
|
}
|
|
151289
151485
|
function resolveRuntimePath2() {
|
|
151290
151486
|
const d2 = helperDir();
|
|
@@ -152186,7 +152382,7 @@ var init_paths2 = __esm({
|
|
|
152186
152382
|
|
|
152187
152383
|
// src/auth/store.ts
|
|
152188
152384
|
import { promises as fs2 } from "fs";
|
|
152189
|
-
import { dirname as
|
|
152385
|
+
import { dirname as dirname40 } from "path";
|
|
152190
152386
|
async function readStore(path2 = credentialPath()) {
|
|
152191
152387
|
let raw;
|
|
152192
152388
|
try {
|
|
@@ -152208,7 +152404,7 @@ async function readStore(path2 = credentialPath()) {
|
|
|
152208
152404
|
throw ErrInvalidStore("file is not JSON and does not look like a plain API key");
|
|
152209
152405
|
}
|
|
152210
152406
|
async function writeStore(credentials, path2 = credentialPath()) {
|
|
152211
|
-
await ensureDir2(
|
|
152407
|
+
await ensureDir2(dirname40(path2));
|
|
152212
152408
|
const body = JSON.stringify(serializeCredentials(credentials), null, 2);
|
|
152213
152409
|
const tmp = `${path2}.${process.pid}.${Date.now()}.tmp`;
|
|
152214
152410
|
await fs2.writeFile(tmp, `${body}
|
|
@@ -153347,7 +153543,7 @@ var init_projectLink = __esm({
|
|
|
153347
153543
|
});
|
|
153348
153544
|
|
|
153349
153545
|
// src/utils/publishProject.ts
|
|
153350
|
-
import { basename as basename17, dirname as
|
|
153546
|
+
import { basename as basename17, dirname as dirname41, join as join93, posix as posix5, relative as relative21, resolve as resolve50 } from "path";
|
|
153351
153547
|
import { existsSync as existsSync80, readdirSync as readdirSync28, readFileSync as readFileSync51, statSync as statSync29 } from "fs";
|
|
153352
153548
|
import AdmZip from "adm-zip";
|
|
153353
153549
|
import ignore2 from "ignore";
|
|
@@ -153610,7 +153806,7 @@ function rewriteStyleBlocks(ctx, document2, referrerAbsDir, entryPath) {
|
|
|
153610
153806
|
return modified;
|
|
153611
153807
|
}
|
|
153612
153808
|
function localizeHtmlEntry(ctx, entryPath, content) {
|
|
153613
|
-
const referrerAbsDir = resolve50(ctx.absProjectDir,
|
|
153809
|
+
const referrerAbsDir = resolve50(ctx.absProjectDir, dirname41(entryPath));
|
|
153614
153810
|
const { document: document2 } = parseHTML(content.toString("utf-8"));
|
|
153615
153811
|
const attrsChanged = rewriteHtmlAttributes(
|
|
153616
153812
|
document2,
|
|
@@ -153624,7 +153820,7 @@ function localizeHtmlEntry(ctx, entryPath, content) {
|
|
|
153624
153820
|
}
|
|
153625
153821
|
}
|
|
153626
153822
|
function localizeCssEntry(ctx, entryPath, content) {
|
|
153627
|
-
const referrerAbsDir = resolve50(ctx.absProjectDir,
|
|
153823
|
+
const referrerAbsDir = resolve50(ctx.absProjectDir, dirname41(entryPath));
|
|
153628
153824
|
const css = content.toString("utf-8");
|
|
153629
153825
|
if (!css.includes("url(")) return;
|
|
153630
153826
|
const result = rewriteCssUrls(ctx, css, referrerAbsDir, entryPath);
|
|
@@ -153847,7 +154043,7 @@ var init_publishProject = __esm({
|
|
|
153847
154043
|
// src/utils/publishProxyBake.ts
|
|
153848
154044
|
import { existsSync as existsSync81 } from "fs";
|
|
153849
154045
|
import { readFile as readFile4 } from "fs/promises";
|
|
153850
|
-
import { basename as basename18, dirname as
|
|
154046
|
+
import { basename as basename18, dirname as dirname43, resolve as resolve51 } from "path";
|
|
153851
154047
|
function emptyManifest() {
|
|
153852
154048
|
return { proxied: [], skippedAlpha: [], failed: [] };
|
|
153853
154049
|
}
|
|
@@ -153892,7 +154088,7 @@ async function bakeMediaProxies(projectDir, fileContents) {
|
|
|
153892
154088
|
if (proxyByAbsolutePath.size === 0) return manifest;
|
|
153893
154089
|
for (const [entryPath, content] of htmlEntries) {
|
|
153894
154090
|
const { document: document2 } = parseHTML(content.toString("utf-8"));
|
|
153895
|
-
const referrerAbsDir = resolve51(absProjectDir,
|
|
154091
|
+
const referrerAbsDir = resolve51(absProjectDir, dirname43(entryPath));
|
|
153896
154092
|
const modified = rewriteHtmlAttributes(
|
|
153897
154093
|
document2,
|
|
153898
154094
|
referrerAbsDir,
|
|
@@ -154266,7 +154462,7 @@ var init_catalogUsage = __esm({
|
|
|
154266
154462
|
|
|
154267
154463
|
// src/commands/render/plan.ts
|
|
154268
154464
|
import { statSync as statSync30 } from "fs";
|
|
154269
|
-
import { dirname as
|
|
154465
|
+
import { dirname as dirname44, join as join95, resolve as resolve54 } from "path";
|
|
154270
154466
|
function formatFpsParseError(input2, reason) {
|
|
154271
154467
|
switch (reason) {
|
|
154272
154468
|
case "empty":
|
|
@@ -154546,7 +154742,7 @@ function applyRenderEnvironment(plan2) {
|
|
|
154546
154742
|
for (const [key2, value] of Object.entries(plan2.environment)) process.env[key2] = value;
|
|
154547
154743
|
}
|
|
154548
154744
|
function renderOutputDirectory(plan2) {
|
|
154549
|
-
return
|
|
154745
|
+
return dirname44(plan2.outputPath);
|
|
154550
154746
|
}
|
|
154551
154747
|
function resolveBrowserGpuForCli(useDocker, browserGpuArg, envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
|
|
154552
154748
|
if (useDocker) return "software";
|
|
@@ -154791,7 +154987,7 @@ __export(batchRender_exports, {
|
|
|
154791
154987
|
runBatchRender: () => runBatchRender
|
|
154792
154988
|
});
|
|
154793
154989
|
import { mkdirSync as mkdirSync43, readFileSync as readFileSync56, writeFileSync as writeFileSync31 } from "fs";
|
|
154794
|
-
import { dirname as
|
|
154990
|
+
import { dirname as dirname45, join as join96, resolve as resolve56, sep as sep15 } from "path";
|
|
154795
154991
|
function isRecord10(value) {
|
|
154796
154992
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
154797
154993
|
}
|
|
@@ -154853,11 +155049,11 @@ function isSameOrChildPath(path2, parent) {
|
|
|
154853
155049
|
function commonOutputDirectory(outputPaths) {
|
|
154854
155050
|
const firstPath = outputPaths[0];
|
|
154855
155051
|
if (!firstPath) return resolve56("renders");
|
|
154856
|
-
let common =
|
|
155052
|
+
let common = dirname45(firstPath);
|
|
154857
155053
|
for (const outputPath of outputPaths.slice(1)) {
|
|
154858
|
-
const dir =
|
|
155054
|
+
const dir = dirname45(outputPath);
|
|
154859
155055
|
while (!isSameOrChildPath(dir, common)) {
|
|
154860
|
-
const parent =
|
|
155056
|
+
const parent = dirname45(common);
|
|
154861
155057
|
if (parent === common) return common;
|
|
154862
155058
|
common = parent;
|
|
154863
155059
|
}
|
|
@@ -154980,7 +155176,7 @@ function summarizeManifest(manifest) {
|
|
|
154980
155176
|
}
|
|
154981
155177
|
function writeManifest(manifest) {
|
|
154982
155178
|
summarizeManifest(manifest);
|
|
154983
|
-
mkdirSync43(
|
|
155179
|
+
mkdirSync43(dirname45(manifest.manifestPath), { recursive: true });
|
|
154984
155180
|
writeFileSync31(manifest.manifestPath, JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
154985
155181
|
}
|
|
154986
155182
|
async function renderBatchRow(row, manifest, options) {
|
|
@@ -154995,7 +155191,7 @@ async function renderBatchRow(row, manifest, options) {
|
|
|
154995
155191
|
console.log(c.dim(`Batch row ${row.index}: ${row.outputPath}`));
|
|
154996
155192
|
}
|
|
154997
155193
|
try {
|
|
154998
|
-
mkdirSync43(
|
|
155194
|
+
mkdirSync43(dirname45(row.outputPath), { recursive: true });
|
|
154999
155195
|
const result = await options.renderOne(row);
|
|
155000
155196
|
manifestRow.status = "completed";
|
|
155001
155197
|
manifestRow.durationMs = result.durationMs ?? null;
|
|
@@ -155709,7 +155905,7 @@ __export(render_exports, {
|
|
|
155709
155905
|
});
|
|
155710
155906
|
import { mkdtempSync as mkdtempSync20, readdirSync as readdirSync29, readFileSync as readFileSync58, statSync as statSync31, writeFileSync as writeFileSync33, rmSync as rmSync31 } from "fs";
|
|
155711
155907
|
import { freemem as freemem5, tmpdir as tmpdir13 } from "os";
|
|
155712
|
-
import { resolve as resolve57, dirname as
|
|
155908
|
+
import { resolve as resolve57, dirname as dirname46, join as join97, basename as basename19 } from "path";
|
|
155713
155909
|
import { execFileSync as execFileSync12, spawn as spawn15 } from "child_process";
|
|
155714
155910
|
async function readCompositionDimensions(compositionHtml) {
|
|
155715
155911
|
try {
|
|
@@ -155843,7 +156039,7 @@ async function renderDocker(projectDir, outputPath, options) {
|
|
|
155843
156039
|
);
|
|
155844
156040
|
failCommand();
|
|
155845
156041
|
}
|
|
155846
|
-
const outputDir =
|
|
156042
|
+
const outputDir = dirname46(outputPath);
|
|
155847
156043
|
const outputFilename = basename19(outputPath);
|
|
155848
156044
|
const dockerArgs = buildDockerRunArgs({
|
|
155849
156045
|
imageTag,
|
|
@@ -155934,7 +156130,7 @@ async function renderLocal(projectDir, outputPath, options) {
|
|
|
155934
156130
|
}
|
|
155935
156131
|
const preflight = await runEnvironmentChecks({
|
|
155936
156132
|
projectDir,
|
|
155937
|
-
diskPaths: [tmpdir13(),
|
|
156133
|
+
diskPaths: [tmpdir13(), dirname46(outputPath)],
|
|
155938
156134
|
browserPath: options.browserPath,
|
|
155939
156135
|
includeBrowser: true,
|
|
155940
156136
|
includeDisk: true,
|
|
@@ -157745,7 +157941,7 @@ __export(layout_exports, {
|
|
|
157745
157941
|
parseAt: () => parseAt
|
|
157746
157942
|
});
|
|
157747
157943
|
import { existsSync as existsSync86, readFileSync as readFileSync61 } from "fs";
|
|
157748
|
-
import { dirname as
|
|
157944
|
+
import { dirname as dirname47, join as join100 } from "path";
|
|
157749
157945
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
157750
157946
|
function buildMotionSampleTimes(duration) {
|
|
157751
157947
|
if (!Number.isFinite(duration) || duration <= 0) return [];
|
|
@@ -158209,7 +158405,7 @@ var init_layout2 = __esm({
|
|
|
158209
158405
|
init_motionSpec();
|
|
158210
158406
|
init_captureCompositionFrame();
|
|
158211
158407
|
__filename = fileURLToPath11(import.meta.url);
|
|
158212
|
-
__dirname2 =
|
|
158408
|
+
__dirname2 = dirname47(__filename);
|
|
158213
158409
|
LAYOUT_SEEK_OPTIONS = AUDIT_SEEK_OPTIONS;
|
|
158214
158410
|
INSPECT_SCHEMA_VERSION = 1;
|
|
158215
158411
|
MOTION_FPS = 20;
|
|
@@ -158305,7 +158501,7 @@ __export(validate_exports, {
|
|
|
158305
158501
|
});
|
|
158306
158502
|
import { existsSync as existsSync87, mkdtempSync as mkdtempSync21, readFileSync as readFileSync63, rmSync as rmSync33 } from "fs";
|
|
158307
158503
|
import { tmpdir as tmpdir14 } from "os";
|
|
158308
|
-
import { join as join101, dirname as
|
|
158504
|
+
import { join as join101, dirname as dirname48 } from "path";
|
|
158309
158505
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
158310
158506
|
function resolveNavigationTimeoutMs(optTimeout) {
|
|
158311
158507
|
return Math.max(NAV_TIMEOUT_FLOOR_MS, optTimeout ?? 0);
|
|
@@ -158689,7 +158885,7 @@ var init_validate = __esm({
|
|
|
158689
158885
|
init_updateCheck();
|
|
158690
158886
|
init_captureCompositionFrame();
|
|
158691
158887
|
__filename2 = fileURLToPath12(import.meta.url);
|
|
158692
|
-
__dirname3 =
|
|
158888
|
+
__dirname3 = dirname48(__filename2);
|
|
158693
158889
|
CONTRAST_SAMPLES = 5;
|
|
158694
158890
|
SEEK_SETTLE_MS = 150;
|
|
158695
158891
|
PREFERRED_SEEK_TARGET_WAIT_MS2 = 500;
|
|
@@ -161309,10 +161505,10 @@ var init_beats = __esm({
|
|
|
161309
161505
|
// src/beats/headlessAnalyzer.ts
|
|
161310
161506
|
import { existsSync as existsSync88, readFileSync as readFileSync64 } from "fs";
|
|
161311
161507
|
import { createRequire as createRequire4 } from "module";
|
|
161312
|
-
import { dirname as
|
|
161508
|
+
import { dirname as dirname49, join as join105 } from "path";
|
|
161313
161509
|
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
161314
161510
|
function findPrebuiltBundle() {
|
|
161315
|
-
const here =
|
|
161511
|
+
const here = dirname49(fileURLToPath13(import.meta.url));
|
|
161316
161512
|
const candidates = [
|
|
161317
161513
|
join105(here, "beat-analyzer.global.js"),
|
|
161318
161514
|
// dist root (tsup-bundled cli)
|
|
@@ -161327,7 +161523,7 @@ function findPrebuiltBundle() {
|
|
|
161327
161523
|
}
|
|
161328
161524
|
async function buildFromCoreSource() {
|
|
161329
161525
|
const esbuild = await import("esbuild");
|
|
161330
|
-
const coreRoot =
|
|
161526
|
+
const coreRoot = dirname49(require2.resolve("@hyperframes/core/package.json"));
|
|
161331
161527
|
const entry = join105(coreRoot, "src/beats/beatDetection.ts");
|
|
161332
161528
|
const result = await esbuild.build({
|
|
161333
161529
|
stdin: {
|
|
@@ -161429,7 +161625,7 @@ __export(beats_exports, {
|
|
|
161429
161625
|
examples: () => examples13
|
|
161430
161626
|
});
|
|
161431
161627
|
import { existsSync as existsSync89, readFileSync as readFileSync65, mkdirSync as mkdirSync48, writeFileSync as writeFileSync37 } from "fs";
|
|
161432
|
-
import { resolve as resolve60, join as join106, dirname as
|
|
161628
|
+
import { resolve as resolve60, join as join106, dirname as dirname50 } from "path";
|
|
161433
161629
|
function fail(message) {
|
|
161434
161630
|
console.error(c.error(message));
|
|
161435
161631
|
failCommand();
|
|
@@ -161501,7 +161697,7 @@ var init_beats2 = __esm({
|
|
|
161501
161697
|
fail(`No beats detected in ${rel} \u2014 nothing written. (Track may be silent/ambient.)`);
|
|
161502
161698
|
}
|
|
161503
161699
|
const outPath = join106(project.dir, "beats", `${rel}.json`);
|
|
161504
|
-
mkdirSync48(
|
|
161700
|
+
mkdirSync48(dirname50(outPath), { recursive: true });
|
|
161505
161701
|
writeFileSync37(outPath, serializeBeats(result.beatTimes, result.beatStrengths, rel));
|
|
161506
161702
|
report(`beats/${rel}.json`, result, Boolean(args.json));
|
|
161507
161703
|
}
|
|
@@ -163926,7 +164122,7 @@ __export(motionShot_exports, {
|
|
|
163926
164122
|
seekAllAdaptersInBrowser: () => seekAllAdaptersInBrowser
|
|
163927
164123
|
});
|
|
163928
164124
|
import { mkdirSync as mkdirSync49, statSync as statSync34, writeFileSync as writeFileSync39 } from "fs";
|
|
163929
|
-
import { dirname as
|
|
164125
|
+
import { dirname as dirname51, resolve as resolve62 } from "path";
|
|
163930
164126
|
function pathsReferToSameFile(firstPath, secondPath) {
|
|
163931
164127
|
const first = resolve62(firstPath);
|
|
163932
164128
|
const second = resolve62(secondPath);
|
|
@@ -163945,7 +164141,7 @@ function ensureShotOutputDir(outPath, sourcePath) {
|
|
|
163945
164141
|
`--shot output must not overwrite the composition source: ${sourcePath}. Choose a separate .png path.`
|
|
163946
164142
|
);
|
|
163947
164143
|
}
|
|
163948
|
-
mkdirSync49(
|
|
164144
|
+
mkdirSync49(dirname51(outPath), { recursive: true });
|
|
163949
164145
|
}
|
|
163950
164146
|
async function sampleMarkerOnionElements(selectors, ts) {
|
|
163951
164147
|
const seek = window.__hfSeekAllAdapters;
|
|
@@ -164494,7 +164690,7 @@ __export(keyframes_exports, {
|
|
|
164494
164690
|
surfaceComposition: () => surfaceComposition
|
|
164495
164691
|
});
|
|
164496
164692
|
import { existsSync as existsSync91, readFileSync as readFileSync67, statSync as statSync35 } from "fs";
|
|
164497
|
-
import { resolve as resolve63, dirname as
|
|
164693
|
+
import { resolve as resolve63, dirname as dirname52, basename as basename21, join as join107, relative as relative28, sep as sep16 } from "path";
|
|
164498
164694
|
function queryIncludingTemplates(html, selector) {
|
|
164499
164695
|
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
164500
164696
|
const roots = [doc];
|
|
@@ -164856,7 +165052,7 @@ function groupTraces(tweens) {
|
|
|
164856
165052
|
}
|
|
164857
165053
|
function collectCompositions(indexPath2) {
|
|
164858
165054
|
const html = readFileSync67(indexPath2, "utf-8");
|
|
164859
|
-
const baseDir =
|
|
165055
|
+
const baseDir = dirname52(indexPath2);
|
|
164860
165056
|
const out = [
|
|
164861
165057
|
surfaceComposition(html, basename21(indexPath2), basename21(indexPath2))
|
|
164862
165058
|
];
|
|
@@ -165013,12 +165209,12 @@ function resolveScope(args) {
|
|
|
165013
165209
|
return { comps, allComps, projectName, projectDir, entryFile };
|
|
165014
165210
|
}
|
|
165015
165211
|
function findProjectRoot(entryPath) {
|
|
165016
|
-
const entryDir =
|
|
165212
|
+
const entryDir = dirname52(entryPath);
|
|
165017
165213
|
let candidate = entryDir;
|
|
165018
165214
|
for (; ; ) {
|
|
165019
165215
|
if (existsSync91(join107(candidate, "index.html"))) return candidate;
|
|
165020
165216
|
if (existsSync91(join107(candidate, ".git"))) return entryDir;
|
|
165021
|
-
const parent =
|
|
165217
|
+
const parent = dirname52(candidate);
|
|
165022
165218
|
if (parent === candidate) return entryDir;
|
|
165023
165219
|
candidate = parent;
|
|
165024
165220
|
}
|
|
@@ -165315,7 +165511,7 @@ __export(compositions_exports, {
|
|
|
165315
165511
|
parseSubComposition: () => parseSubComposition
|
|
165316
165512
|
});
|
|
165317
165513
|
import { existsSync as existsSync93, readFileSync as readFileSync69 } from "fs";
|
|
165318
|
-
import { resolve as resolve64, dirname as
|
|
165514
|
+
import { resolve as resolve64, dirname as dirname53 } from "path";
|
|
165319
165515
|
function countRenderableDescendants(root) {
|
|
165320
165516
|
return Array.from(root.querySelectorAll("*")).filter(
|
|
165321
165517
|
(el) => !NON_RENDERED_TAGS2.has(el.tagName.toLowerCase())
|
|
@@ -165503,7 +165699,7 @@ var init_compositions = __esm({
|
|
|
165503
165699
|
const project = resolveProject(args.dir);
|
|
165504
165700
|
const html = readFileSync69(project.indexPath, "utf-8");
|
|
165505
165701
|
ensureDOMParser();
|
|
165506
|
-
const compositions = parseCompositions(html,
|
|
165702
|
+
const compositions = parseCompositions(html, dirname53(project.indexPath));
|
|
165507
165703
|
if (args.json) {
|
|
165508
165704
|
console.log(JSON.stringify(withMeta({ compositions }), null, 2));
|
|
165509
165705
|
return;
|
|
@@ -166221,7 +166417,7 @@ __export(transcribe_exports2, {
|
|
|
166221
166417
|
examples: () => examples22
|
|
166222
166418
|
});
|
|
166223
166419
|
import { existsSync as existsSync97, writeFileSync as writeFileSync41 } from "fs";
|
|
166224
|
-
import { resolve as resolve67, join as join111, extname as extname17, dirname as
|
|
166420
|
+
import { resolve as resolve67, join as join111, extname as extname17, dirname as dirname54 } from "path";
|
|
166225
166421
|
function parseTimeoutMs(raw, json) {
|
|
166226
166422
|
const source = raw ?? process.env["HYPERFRAMES_TRANSCRIBE_TIMEOUT_MS"];
|
|
166227
166423
|
if (source == null || source === "") return void 0;
|
|
@@ -166465,7 +166661,7 @@ var init_transcribe2 = __esm({
|
|
|
166465
166661
|
console.error(c.error(message));
|
|
166466
166662
|
failCommand();
|
|
166467
166663
|
}
|
|
166468
|
-
const dir = resolve67(args.dir ??
|
|
166664
|
+
const dir = resolve67(args.dir ?? dirname54(inputPath));
|
|
166469
166665
|
const ext = extname17(inputPath).toLowerCase();
|
|
166470
166666
|
const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
|
|
166471
166667
|
const to = parseExportFormat(args.to, args.json);
|
|
@@ -166684,7 +166880,7 @@ __export(synthesize_exports, {
|
|
|
166684
166880
|
});
|
|
166685
166881
|
import { execFileSync as execFileSync15 } from "child_process";
|
|
166686
166882
|
import { existsSync as existsSync99, mkdirSync as mkdirSync51, readdirSync as readdirSync33, unlinkSync as unlinkSync9 } from "fs";
|
|
166687
|
-
import { join as join114, dirname as
|
|
166883
|
+
import { join as join114, dirname as dirname55, basename as basename24 } from "path";
|
|
166688
166884
|
import { homedir as homedir22 } from "os";
|
|
166689
166885
|
function ensureSynthScript() {
|
|
166690
166886
|
if (!existsSync99(SCRIPT_PATH)) {
|
|
@@ -166729,7 +166925,7 @@ async function synthesize(text2, outputPath, options) {
|
|
|
166729
166925
|
ensureVoices({ onProgress: options?.onProgress })
|
|
166730
166926
|
]);
|
|
166731
166927
|
const scriptPath = ensureSynthScript();
|
|
166732
|
-
mkdirSync51(
|
|
166928
|
+
mkdirSync51(dirname55(outputPath), { recursive: true });
|
|
166733
166929
|
options?.onProgress?.(`Generating speech with voice ${voice} (${lang})...`);
|
|
166734
166930
|
try {
|
|
166735
166931
|
const espeakLang = ESPEAK_LANG_OVERRIDES[lang] ?? lang;
|
|
@@ -167065,11 +167261,11 @@ __export(docs_exports, {
|
|
|
167065
167261
|
examples: () => examples24
|
|
167066
167262
|
});
|
|
167067
167263
|
import { readFileSync as readFileSync73, existsSync as existsSync101 } from "fs";
|
|
167068
|
-
import { resolve as resolve69, dirname as
|
|
167264
|
+
import { resolve as resolve69, dirname as dirname56, join as join115 } from "path";
|
|
167069
167265
|
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
167070
167266
|
function docsDir() {
|
|
167071
167267
|
const thisFile = fileURLToPath14(import.meta.url);
|
|
167072
|
-
const dir =
|
|
167268
|
+
const dir = dirname56(thisFile);
|
|
167073
167269
|
const devPath = resolve69(dir, "..", "docs");
|
|
167074
167270
|
const builtPath = resolve69(dir, "docs");
|
|
167075
167271
|
return existsSync101(devPath) ? devPath : builtPath;
|
|
@@ -167251,7 +167447,7 @@ __export(doctor_exports, {
|
|
|
167251
167447
|
import { execFileSync as execFileSync16, execSync as execSync5 } from "child_process";
|
|
167252
167448
|
import { existsSync as existsSync103 } from "fs";
|
|
167253
167449
|
import { platform as platform10 } from "os";
|
|
167254
|
-
import { dirname as
|
|
167450
|
+
import { dirname as dirname57 } from "path";
|
|
167255
167451
|
function checkDocker() {
|
|
167256
167452
|
try {
|
|
167257
167453
|
const version2 = execSync5("docker --version", { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
@@ -167371,7 +167567,7 @@ function firstExistingAncestor(path2, fileExists) {
|
|
|
167371
167567
|
let current2 = path2;
|
|
167372
167568
|
for (let i2 = 0; i2 < 64; i2 += 1) {
|
|
167373
167569
|
if (fileExists(current2)) return current2;
|
|
167374
|
-
const parent =
|
|
167570
|
+
const parent = dirname57(current2);
|
|
167375
167571
|
if (parent === current2) return null;
|
|
167376
167572
|
current2 = parent;
|
|
167377
167573
|
}
|
|
@@ -168362,7 +168558,7 @@ __export(contactSheet_exports, {
|
|
|
168362
168558
|
});
|
|
168363
168559
|
import sharp from "sharp";
|
|
168364
168560
|
import { readdirSync as readdirSync35, readFileSync as readFileSync75, writeFileSync as writeFileSync44, unlinkSync as unlinkSync10, existsSync as existsSync105 } from "fs";
|
|
168365
|
-
import { join as join116, extname as extname19, basename as basename25, dirname as
|
|
168561
|
+
import { join as join116, extname as extname19, basename as basename25, dirname as dirname58 } from "path";
|
|
168366
168562
|
async function createContactSheet(imagePaths, outputPath, opts = {}) {
|
|
168367
168563
|
const {
|
|
168368
168564
|
cols = 3,
|
|
@@ -168513,7 +168709,7 @@ async function createSvgContactSheet(svgsDir, outputPath, assetsRootDir, budget
|
|
|
168513
168709
|
if (svgPaths.length === 0) return [];
|
|
168514
168710
|
const svgFileNames = svgPaths.map((p2) => p2.split("/").pop());
|
|
168515
168711
|
const thumbSize = 200;
|
|
168516
|
-
const tmpDir =
|
|
168712
|
+
const tmpDir = dirname58(outputPath);
|
|
168517
168713
|
const tmpPaths = [];
|
|
168518
168714
|
const labels = [];
|
|
168519
168715
|
for (let i2 = 0; i2 < svgPaths.length; i2++) {
|
|
@@ -209911,7 +210107,7 @@ import {
|
|
|
209911
210107
|
writeFileSync as writeFileSync47
|
|
209912
210108
|
} from "fs";
|
|
209913
210109
|
import { tmpdir as tmpdir17 } from "os";
|
|
209914
|
-
import { basename as basename30, dirname as
|
|
210110
|
+
import { basename as basename30, dirname as dirname59, extname as extname21, join as join119, resolve as resolve75 } from "path";
|
|
209915
210111
|
import sharp2 from "sharp";
|
|
209916
210112
|
function isRecord14(value) {
|
|
209917
210113
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -210411,7 +210607,7 @@ var init_grade_compare = __esm({
|
|
|
210411
210607
|
prepared.tempDir,
|
|
210412
210608
|
parsed.timeoutMs
|
|
210413
210609
|
);
|
|
210414
|
-
mkdirSync54(
|
|
210610
|
+
mkdirSync54(dirname59(parsed.outPath), { recursive: true });
|
|
210415
210611
|
copyFileSync10(tempSheet, parsed.outPath);
|
|
210416
210612
|
trackCompareSheet({
|
|
210417
210613
|
command: "grade-compare",
|
|
@@ -210458,7 +210654,7 @@ __export(compare_exports, {
|
|
|
210458
210654
|
});
|
|
210459
210655
|
import { cpSync as cpSync6, existsSync as existsSync109, mkdirSync as mkdirSync55, mkdtempSync as mkdtempSync26, renameSync as renameSync19, rmSync as rmSync37, statSync as statSync39 } from "fs";
|
|
210460
210656
|
import { tmpdir as tmpdir18 } from "os";
|
|
210461
|
-
import { basename as basename31, dirname as
|
|
210657
|
+
import { basename as basename31, dirname as dirname60, extname as extname23, join as join120 } from "path";
|
|
210462
210658
|
function defaultLabelForPath(input2) {
|
|
210463
210659
|
const name = basename31(input2);
|
|
210464
210660
|
return extname23(name).toLowerCase() === ".html" ? basename31(name, extname23(name)) : name;
|
|
@@ -210559,7 +210755,7 @@ function inputError(variant) {
|
|
|
210559
210755
|
function stageHtmlVariant(variant) {
|
|
210560
210756
|
const stagedDir = mkdtempSync26(join120(tmpdir18(), "hf-compare-variant-"));
|
|
210561
210757
|
try {
|
|
210562
|
-
cpSync6(
|
|
210758
|
+
cpSync6(dirname60(variant.inputPath), stagedDir, {
|
|
210563
210759
|
recursive: true,
|
|
210564
210760
|
filter: (src) => {
|
|
210565
210761
|
const base2 = basename31(src);
|
|
@@ -210669,7 +210865,7 @@ async function renderCompareSheet(parsed) {
|
|
|
210669
210865
|
framePaths.push(rendered.framePath);
|
|
210670
210866
|
renderReadyTimedOut = renderReadyTimedOut || rendered.renderReadyTimedOut;
|
|
210671
210867
|
}
|
|
210672
|
-
mkdirSync55(
|
|
210868
|
+
mkdirSync55(dirname60(parsed.outPath), { recursive: true });
|
|
210673
210869
|
await createContactSheet(framePaths, parsed.outPath, {
|
|
210674
210870
|
cols: parsed.cols ?? defaultCompareCols(framePaths.length),
|
|
210675
210871
|
maxImages: framePaths.length,
|
|
@@ -216596,13 +216792,13 @@ __export(state_exports, {
|
|
|
216596
216792
|
writeStackOutputs: () => writeStackOutputs
|
|
216597
216793
|
});
|
|
216598
216794
|
import { existsSync as existsSync117, mkdirSync as mkdirSync61, readdirSync as readdirSync40, readFileSync as readFileSync85, rmSync as rmSync38, writeFileSync as writeFileSync56 } from "fs";
|
|
216599
|
-
import { dirname as
|
|
216795
|
+
import { dirname as dirname61, join as join133 } from "path";
|
|
216600
216796
|
function stateFilePath(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
216601
216797
|
return join133(cwd, STATE_DIR_NAME, `${STATE_FILE_PREFIX}${stackName}.json`);
|
|
216602
216798
|
}
|
|
216603
216799
|
function writeStackOutputs(outputs, cwd = process.cwd()) {
|
|
216604
216800
|
const path2 = stateFilePath(outputs.stackName, cwd);
|
|
216605
|
-
mkdirSync61(
|
|
216801
|
+
mkdirSync61(dirname61(path2), { recursive: true });
|
|
216606
216802
|
writeFileSync56(path2, JSON.stringify(outputs, null, 2) + "\n");
|
|
216607
216803
|
return path2;
|
|
216608
216804
|
}
|
|
@@ -216776,19 +216972,19 @@ var init_sam = __esm({
|
|
|
216776
216972
|
|
|
216777
216973
|
// src/commands/lambda/repoRoot.ts
|
|
216778
216974
|
import { existsSync as existsSync119 } from "fs";
|
|
216779
|
-
import { dirname as
|
|
216975
|
+
import { dirname as dirname62, resolve as resolve79 } from "path";
|
|
216780
216976
|
import { fileURLToPath as fileURLToPath15 } from "url";
|
|
216781
216977
|
function repoRoot() {
|
|
216782
216978
|
const override = process.env.HYPERFRAMES_REPO_ROOT;
|
|
216783
216979
|
if (override && existsSync119(resolve79(override, "packages", "aws-lambda", "package.json"))) {
|
|
216784
216980
|
return override;
|
|
216785
216981
|
}
|
|
216786
|
-
let dir =
|
|
216982
|
+
let dir = dirname62(fileURLToPath15(import.meta.url));
|
|
216787
216983
|
for (let depth = 0; depth < 12; depth++) {
|
|
216788
216984
|
if (existsSync119(resolve79(dir, "packages", "aws-lambda", "package.json"))) {
|
|
216789
216985
|
return dir;
|
|
216790
216986
|
}
|
|
216791
|
-
const parent =
|
|
216987
|
+
const parent = dirname62(dir);
|
|
216792
216988
|
if (parent === dir) break;
|
|
216793
216989
|
dir = parent;
|
|
216794
216990
|
}
|
|
@@ -219047,7 +219243,7 @@ import {
|
|
|
219047
219243
|
rmSync as rmSync39,
|
|
219048
219244
|
statSync as statSync43
|
|
219049
219245
|
} from "fs";
|
|
219050
|
-
import { dirname as
|
|
219246
|
+
import { dirname as dirname63, join as join140, resolve as resolve82 } from "path";
|
|
219051
219247
|
import { pipeline as pipeline4 } from "stream/promises";
|
|
219052
219248
|
async function downloadToFile(url, destPath, options = {}) {
|
|
219053
219249
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
@@ -219058,13 +219254,13 @@ async function downloadToFile(url, destPath, options = {}) {
|
|
|
219058
219254
|
if (!res.body) {
|
|
219059
219255
|
throw new Error(`Failed to download ${url}: empty response body`);
|
|
219060
219256
|
}
|
|
219061
|
-
mkdirSync64(
|
|
219257
|
+
mkdirSync64(dirname63(destPath), { recursive: true });
|
|
219062
219258
|
const totalHeader = res.headers.get("content-length");
|
|
219063
219259
|
const total = totalHeader ? Number.parseInt(totalHeader, 10) : void 0;
|
|
219064
219260
|
const totalOpt = total !== void 0 && Number.isFinite(total) ? total : void 0;
|
|
219065
219261
|
const destination = resolveDownloadDestination(destPath);
|
|
219066
219262
|
const previous = statSync43(destination, { throwIfNoEntry: false });
|
|
219067
|
-
const stage = mkdtempSync27(join140(
|
|
219263
|
+
const stage = mkdtempSync27(join140(dirname63(destination), ".hf-download-"));
|
|
219068
219264
|
const stagedFile = join140(stage, "download");
|
|
219069
219265
|
let bytes = 0;
|
|
219070
219266
|
try {
|
|
@@ -219100,7 +219296,7 @@ function resolveDownloadDestination(destPath) {
|
|
|
219100
219296
|
let destination = resolve82(destPath);
|
|
219101
219297
|
for (let hops = 0; hops < 40; hops++) {
|
|
219102
219298
|
if (!lstatSync11(destination, { throwIfNoEntry: false })?.isSymbolicLink()) return destination;
|
|
219103
|
-
destination = resolve82(
|
|
219299
|
+
destination = resolve82(dirname63(destination), readlinkSync2(destination));
|
|
219104
219300
|
}
|
|
219105
219301
|
throw new Error(`Too many symbolic links in download destination: ${destPath}`);
|
|
219106
219302
|
}
|
|
@@ -221702,7 +221898,7 @@ var init_parseFigmaRef = __esm({
|
|
|
221702
221898
|
|
|
221703
221899
|
// ../core/dist/figma/freeze.js
|
|
221704
221900
|
import { copyFileSync as copyFileSync11, mkdirSync as mkdirSync65, rmSync as rmSync40, statSync as statSync44, writeFileSync as writeFileSync58 } from "fs";
|
|
221705
|
-
import { dirname as
|
|
221901
|
+
import { dirname as dirname64 } from "path";
|
|
221706
221902
|
function exceedsFreezeCap(byteLength) {
|
|
221707
221903
|
return byteLength > MAX_FREEZE_BYTES;
|
|
221708
221904
|
}
|
|
@@ -221711,7 +221907,7 @@ function freezeBytes(bytes, destPath) {
|
|
|
221711
221907
|
throw new Error("freeze failed: empty bytes");
|
|
221712
221908
|
if (exceedsFreezeCap(bytes.length))
|
|
221713
221909
|
throw new Error(`freeze failed: ${bytes.length} bytes exceeds ${MAX_FREEZE_BYTES} cap`);
|
|
221714
|
-
mkdirSync65(
|
|
221910
|
+
mkdirSync65(dirname64(destPath), { recursive: true });
|
|
221715
221911
|
try {
|
|
221716
221912
|
writeFileSync58(destPath, bytes, { flag: "wx" });
|
|
221717
221913
|
} catch (err) {
|
|
@@ -221851,7 +222047,7 @@ var init_manifest = __esm({
|
|
|
221851
222047
|
|
|
221852
222048
|
// ../core/dist/figma/mediaIndex.js
|
|
221853
222049
|
import { mkdirSync as mkdirSync67, writeFileSync as writeFileSync60 } from "fs";
|
|
221854
|
-
import { dirname as
|
|
222050
|
+
import { dirname as dirname65, join as join143 } from "path";
|
|
221855
222051
|
function isRow(value) {
|
|
221856
222052
|
return typeof value === "object" && value !== null;
|
|
221857
222053
|
}
|
|
@@ -221901,7 +222097,7 @@ function regenerateIndex(projectDir) {
|
|
|
221901
222097
|
const records = readJsonlValues(manifestPath(projectDir)).filter(isRow);
|
|
221902
222098
|
const content = generateIndexContent(records);
|
|
221903
222099
|
const p2 = indexPath(projectDir);
|
|
221904
|
-
mkdirSync67(
|
|
222100
|
+
mkdirSync67(dirname65(p2), { recursive: true });
|
|
221905
222101
|
writeFileSync60(p2, content);
|
|
221906
222102
|
return content;
|
|
221907
222103
|
}
|
|
@@ -223416,7 +223612,7 @@ var init_help = __esm({
|
|
|
223416
223612
|
init_version();
|
|
223417
223613
|
init_dist();
|
|
223418
223614
|
init_runId();
|
|
223419
|
-
import { dirname as
|
|
223615
|
+
import { dirname as dirname66, join as join149 } from "path";
|
|
223420
223616
|
import { fileURLToPath as fileURLToPath16 } from "url";
|
|
223421
223617
|
import { existsSync as existsSync129 } from "fs";
|
|
223422
223618
|
|
|
@@ -223534,7 +223730,7 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
223534
223730
|
});
|
|
223535
223731
|
}
|
|
223536
223732
|
(() => {
|
|
223537
|
-
const here =
|
|
223733
|
+
const here = dirname66(fileURLToPath16(import.meta.url));
|
|
223538
223734
|
const shader = join149(here, "shaderTransitionWorker.js");
|
|
223539
223735
|
if (!process.env.HF_SHADER_WORKER_ENTRY && existsSync129(shader)) {
|
|
223540
223736
|
process.env.HF_SHADER_WORKER_ENTRY = shader;
|