hyperframes 0.5.0-alpha.6 → 0.5.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -54,7 +54,7 @@ var VERSION;
54
54
  var init_version = __esm({
55
55
  "src/version.ts"() {
56
56
  "use strict";
57
- VERSION = true ? "0.5.0-alpha.6" : "0.0.0-dev";
57
+ VERSION = true ? "0.5.0-alpha.8" : "0.0.0-dev";
58
58
  }
59
59
  });
60
60
 
@@ -5611,12 +5611,64 @@ var init_captions = __esm({
5611
5611
  });
5612
5612
 
5613
5613
  // ../core/src/lint/rules/composition.ts
5614
- var compositionRules;
5614
+ function countPhysicalLines(source) {
5615
+ if (source.length === 0) return 0;
5616
+ const normalized = source.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
5617
+ const withoutFinalNewline = normalized.endsWith("\n") ? normalized.slice(0, -1) : normalized;
5618
+ return withoutFinalNewline.split("\n").length;
5619
+ }
5620
+ function isCompositionRootOrMount(rawTag) {
5621
+ return Boolean(
5622
+ readAttr(rawTag, "data-composition-id") || readAttr(rawTag, "data-composition-src")
5623
+ );
5624
+ }
5625
+ var MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, compositionRules;
5615
5626
  var init_composition = __esm({
5616
5627
  "../core/src/lint/rules/composition.ts"() {
5617
5628
  "use strict";
5618
5629
  init_utils();
5630
+ MAX_COMPOSITION_LINES = 300;
5631
+ MAX_TIMED_ELEMENTS_PER_TRACK = 3;
5632
+ TRACK_DENSITY_EXEMPT_TAGS = /* @__PURE__ */ new Set(["audio", "script", "style", "video"]);
5619
5633
  compositionRules = [
5634
+ // composition_file_too_large
5635
+ ({ rawSource, options }) => {
5636
+ const lineCount = countPhysicalLines(rawSource);
5637
+ if (lineCount <= MAX_COMPOSITION_LINES) return [];
5638
+ const splitTarget = options.isSubComposition ? "Split this sub-composition further into smaller .html files" : "Split coherent scenes or layers into separate .html files under compositions/";
5639
+ return [
5640
+ {
5641
+ code: "composition_file_too_large",
5642
+ severity: "warning",
5643
+ message: `This HTML composition file has ${lineCount} lines. Agents produce better results when large scenes are split into smaller sub-compositions.`,
5644
+ fixHint: `${splitTarget}, then mount them from the parent with data-composition-src so each file stays small enough to inspect, revise, and validate independently.`
5645
+ }
5646
+ ];
5647
+ },
5648
+ // timeline_track_too_dense
5649
+ ({ tags, options }) => {
5650
+ const trackCounts = /* @__PURE__ */ new Map();
5651
+ for (const tag of tags) {
5652
+ if (TRACK_DENSITY_EXEMPT_TAGS.has(tag.name)) continue;
5653
+ if (isCompositionRootOrMount(tag.raw)) continue;
5654
+ if (!readAttr(tag.raw, "data-start")) continue;
5655
+ const track = readAttr(tag.raw, "data-track-index");
5656
+ if (!track) continue;
5657
+ trackCounts.set(track, (trackCounts.get(track) ?? 0) + 1);
5658
+ }
5659
+ const findings = [];
5660
+ for (const [track, count] of trackCounts) {
5661
+ if (count <= MAX_TIMED_ELEMENTS_PER_TRACK) continue;
5662
+ const splitTarget = options.isSubComposition ? "Move coherent scene groups into smaller .html files" : "Move coherent scene groups into separate .html files under compositions/";
5663
+ findings.push({
5664
+ code: "timeline_track_too_dense",
5665
+ severity: "warning",
5666
+ message: `Track ${track} has ${count} timed elements in this HTML file. Agents produce better timelines when dense tracks are split into smaller sub-compositions.`,
5667
+ fixHint: `${splitTarget} and mount them from the parent with data-composition-src so the timeline stays easier to inspect, revise, and validate.`
5668
+ });
5669
+ }
5670
+ return findings;
5671
+ },
5620
5672
  // timed_element_missing_visibility_hidden
5621
5673
  ({ tags }) => {
5622
5674
  const findings = [];
@@ -6204,7 +6256,7 @@ var RUNTIME_IIFE;
6204
6256
  var init_runtime_inline = __esm({
6205
6257
  "../core/src/generated/runtime-inline.ts"() {
6206
6258
  "use strict";
6207
- RUNTIME_IIFE = '"use strict";(()=>{var No=Object.create;var Jn=Object.defineProperty;var wo=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var Mo=Object.getPrototypeOf,Do=Object.prototype.hasOwnProperty;var K=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ko=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Co(e))!Do.call(n,r)&&r!==t&&Jn(n,r,{get:()=>e[r],enumerable:!(i=wo(e,r))||i.enumerable});return n};var Lo=(n,e,t)=>(t=n!=null?No(Mo(n)):{},ko(e||!n||!n.__esModule?Jn(t,"default",{value:n,enumerable:!0}):t,n));var hi=K((ja,ln)=>{var q=String,pi=function(){return{isColorSupported:!1,reset:q,bold:q,dim:q,italic:q,underline:q,inverse:q,hidden:q,strikethrough:q,black:q,red:q,green:q,yellow:q,blue:q,magenta:q,cyan:q,white:q,gray:q,bgBlack:q,bgRed:q,bgGreen:q,bgYellow:q,bgBlue:q,bgMagenta:q,bgCyan:q,bgWhite:q,blackBright:q,redBright:q,greenBright:q,yellowBright:q,blueBright:q,magentaBright:q,cyanBright:q,whiteBright:q,bgBlackBright:q,bgRedBright:q,bgGreenBright:q,bgYellowBright:q,bgBlueBright:q,bgMagentaBright:q,bgCyanBright:q,bgWhiteBright:q}};ln.exports=pi();ln.exports.createColors=pi});var an=K(()=>{});var kt=K((Va,Si)=>{"use strict";var xi=hi(),gi=an(),ot=class n extends Error{constructor(e,t,i,r,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),r&&(this.source=r),s&&(this.plugin=s),typeof t<"u"&&typeof i<"u"&&(typeof t=="number"?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(e){if(!this.source)return"";let t=this.source;e==null&&(e=xi.isColorSupported);let i=l=>l,r=l=>l,o=l=>l;if(e){let{bold:l,gray:f,red:m}=xi.createColors(!0);r=h=>l(m(h)),i=h=>f(h),gi&&(o=h=>gi(h))}let s=t.split(/\\r?\\n/),c=Math.max(this.line-3,0),u=Math.min(this.line+2,s.length),a=String(u).length;return s.slice(c,u).map((l,f)=>{let m=c+1+f,h=" "+(" "+m).slice(-a)+" | ";if(m===this.line){if(l.length>160){let C=20,A=Math.max(0,this.column-C),z=Math.max(this.column+C,this.endColumn+C),P=l.slice(A,z),k=i(h.replace(/\\d/g," "))+l.slice(0,Math.min(this.column-1,C-1)).replace(/[^\\t]/g," ");return r(">")+i(h)+o(P)+`\n `+k+r("^")}let M=i(h.replace(/\\d/g," "))+l.slice(0,this.column-1).replace(/[^\\t]/g," ");return r(">")+i(h)+o(l)+`\n `+M+r("^")}return" "+i(h)+o(l)}).join(`\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\n\n`+e+`\n`),this.name+": "+this.message+e}};Si.exports=ot;ot.default=ot});var un=K((Ka,Ai)=>{"use strict";var yi={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function $o(n){return n[0].toUpperCase()+n.slice(1)}var st=class{constructor(e){this.builder=e}atrule(e,t){let i="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?i+=e.raws.afterName:r&&(i+=" "),e.nodes)this.block(e,i+r);else{let o=(e.raws.between||"")+(t?";":"");this.builder(i+r+o,e)}}beforeAfter(e,t){let i;e.type==="decl"?i=this.raw(e,null,"beforeDecl"):e.type==="comment"?i=this.raw(e,null,"beforeComment"):t==="before"?i=this.raw(e,null,"beforeRule"):i=this.raw(e,null,"beforeClose");let r=e.parent,o=0;for(;r&&r.type!=="root";)o+=1,r=r.parent;if(i.includes(`\n`)){let s=this.raw(e,null,"indent");if(s.length)for(let c=0;c<o;c++)i+=s}return i}block(e,t){let i=this.raw(e,"between","beforeOpen");this.builder(t+i+"{",e,"start");let r;e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let i=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let o=e.nodes[r],s=this.raw(o,"before");s&&this.builder(s),this.stringify(o,t!==r||i)}}comment(e){let t=this.raw(e,"left","commentLeft"),i=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+i+"*/",e)}decl(e,t){let i=this.raw(e,"between","colon"),r=e.prop+i+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,i){let r;if(i||(i=t),t&&(r=e.raws[t],typeof r<"u"))return r;let o=e.parent;if(i==="before"&&(!o||o.type==="root"&&o.first===e||o&&o.type==="document"))return"";if(!o)return yi[i];let s=e.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[i]<"u")return s.rawCache[i];if(i==="before"||i==="after")return this.beforeAfter(e,i);{let c="raw"+$o(i);this[c]?r=this[c](s,e):s.walk(u=>{if(r=u.raws[t],typeof r<"u")return!1})}return typeof r>"u"&&(r=yi[i]),s.rawCache[i]=r,r}rawBeforeClose(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length>0&&typeof i.raws.after<"u")return t=i.raws.after,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawBeforeComment(e,t){let i;return e.walkComments(r=>{if(typeof r.raws.before<"u")return i=r.raws.before,i.includes(`\n`)&&(i=i.replace(/[^\\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeDecl"):i&&(i=i.replace(/\\S/g,"")),i}rawBeforeDecl(e,t){let i;return e.walkDecls(r=>{if(typeof r.raws.before<"u")return i=r.raws.before,i.includes(`\n`)&&(i=i.replace(/[^\\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeRule"):i&&(i=i.replace(/\\S/g,"")),i}rawBeforeOpen(e){let t;return e.walk(i=>{if(i.type!=="decl"&&(t=i.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(i=>{if(i.nodes&&(i.parent!==e||e.first!==i)&&typeof i.raws.before<"u")return t=i.raws.before,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawColon(e){let t;return e.walkDecls(i=>{if(typeof i.raws.between<"u")return t=i.raws.between.replace(/[^\\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length===0&&(t=i.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(i=>{let r=i.parent;if(r&&r!==e&&r.parent&&r.parent===e&&typeof i.raws.before<"u"){let o=i.raws.before.split(`\n`);return t=o[o.length-1],t=t.replace(/\\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(t=i.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let i=e[t],r=e.raws[t];return r&&r.value===i?r.raw:i}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};Ai.exports=st;st.default=st});var lt=K((Ja,Ei)=>{"use strict";var Vo=un();function cn(n,e){new Vo(e).stringify(n)}Ei.exports=cn;cn.default=cn});var Lt=K((Qa,dn)=>{"use strict";dn.exports.isClean=Symbol("isClean");dn.exports.my=Symbol("my")});var ct=K((Ya,Fi)=>{"use strict";var Ko=kt(),Jo=un(),Qo=lt(),{isClean:at,my:Yo}=Lt();function fn(n,e){let t=new n.constructor;for(let i in n){if(!Object.prototype.hasOwnProperty.call(n,i)||i==="proxyCache")continue;let r=n[i],o=typeof r;i==="parent"&&o==="object"?e&&(t[i]=e):i==="source"?t[i]=r:Array.isArray(r)?t[i]=r.map(s=>fn(s,t)):(o==="object"&&r!==null&&(r=fn(r)),t[i]=r)}return t}function ke(n,e){if(e&&typeof e.offset<"u")return e.offset;let t=1,i=1,r=0;for(let o=0;o<n.length;o++){if(i===e.line&&t===e.column){r=o;break}n[o]===`\n`?(t=1,i+=1):t+=1}return r}var ut=class{get proxyOf(){return this}constructor(e={}){this.raws={},this[at]=!1,this[Yo]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let i of e[t])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\n\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\n\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=fn(this);for(let i in e)t[i]=e[i];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:i,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:i.column,line:i.line},t)}return new Ko(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markClean(){this[at]=!0}markDirty(){if(this[at]){this[at]=!1;let e=this;for(;e=e.parent;)e[at]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let i="document"in this.source.input?this.source.input.document:this.source.input.css,o=i.slice(ke(i,this.source.start),ke(i,this.source.end)).indexOf(e.word);o!==-1&&(t=this.positionInside(o))}return t}positionInside(e){let t=this.source.start.column,i=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,o=ke(r,this.source.start),s=o+e;for(let c=o;c<s;c++)r[c]===`\n`?(t=1,i+=1):t+=1;return{column:t,line:i,offset:s}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,i={column:this.source.start.column,line:this.source.start.line,offset:ke(t,this.source.start)},r=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:ke(t,this.source.end)+1}:{column:i.column+1,line:i.line,offset:i.offset+1};if(e.word){let s=t.slice(ke(t,this.source.start),ke(t,this.source.end)).indexOf(e.word);s!==-1&&(i=this.positionInside(s),r=this.positionInside(s+e.word.length))}else e.start?i={column:e.start.column,line:e.start.line,offset:ke(t,e.start)}:e.index&&(i=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line,offset:ke(t,e.end)}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<i.line||r.line===i.line&&r.column<=i.column)&&(r={column:i.column+1,line:i.line,offset:i.offset+1}),{end:r,start:i}}raw(e,t){return new Jo().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,i=!1;for(let r of e)r===this?i=!0:i?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);i||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let i={},r=t==null;t=t||new Map;let o=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let c=this[s];if(Array.isArray(c))i[s]=c.map(u=>typeof u=="object"&&u.toJSON?u.toJSON(null,t):u);else if(typeof c=="object"&&c.toJSON)i[s]=c.toJSON(null,t);else if(s==="source"){if(c==null)continue;let u=t.get(c.input);u==null&&(u=o,t.set(c.input,o),o++),i[s]={end:c.end,inputId:u,start:c.start}}else i[s]=c}return r&&(i.inputs=[...t.keys()].map(s=>s.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Qo){e.stringify&&(e=e.stringify);let t="";return e(this,i=>{t+=i}),t}warn(e,t,i={}){let r={node:this};for(let o in i)r[o]=i[o];return e.warn(t,r)}};Fi.exports=ut;ut.default=ut});var ft=K((Za,bi)=>{"use strict";var Zo=ct(),dt=class extends Zo{constructor(e){super(e),this.type="comment"}};bi.exports=dt;dt.default=dt});var pt=K((Xa,Ni)=>{"use strict";var Xo=ct(),mt=class extends Xo{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}};Ni.exports=mt;mt.default=mt});var ve=K((eu,vi)=>{"use strict";var wi=ft(),Ci=pt(),es=ct(),{isClean:Mi,my:Di}=Lt(),mn,ki,Li,pn;function Ti(n){return n.map(e=>(e.nodes&&(e.nodes=Ti(e.nodes)),delete e.source,e))}function Ri(n){if(n[Mi]=!1,n.proxyOf.nodes)for(let e of n.proxyOf.nodes)Ri(e)}var Ce=class n extends es{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(...e){for(let t of e){let i=this.normalize(t,this.last);for(let r of i)this.proxyOf.nodes.push(r)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),i,r;for(;this.indexes[t]<this.proxyOf.nodes.length&&(i=this.indexes[t],r=e(this.proxyOf.nodes[i],i),r!==!1);)this.indexes[t]+=1;return delete this.indexes[t],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...i)=>e[t](...i.map(r=>typeof r=="function"?(o,s)=>r(o.toProxy(),s):r)):t==="every"||t==="some"?i=>e[t]((r,...o)=>i(r.toProxy(),...o)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(i=>i.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let i=this.index(e),r=this.normalize(t,this.proxyOf.nodes[i]).reverse();i=this.index(e);for(let s of r)this.proxyOf.nodes.splice(i+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],i<o&&(this.indexes[s]=o+r.length);return this.markDirty(),this}insertBefore(e,t){let i=this.index(e),r=i===0?"prepend":!1,o=this.normalize(t,this.proxyOf.nodes[i],r).reverse();i=this.index(e);for(let c of o)this.proxyOf.nodes.splice(i,0,c);let s;for(let c in this.indexes)s=this.indexes[c],i<=s&&(this.indexes[c]=s+o.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Ti(ki(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let r of e)r.parent&&r.parent.removeChild(r,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let r of e)r.parent&&r.parent.removeChild(r,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Ci(e)]}else if(e.selector||e.selectors)e=[new pn(e)];else if(e.name)e=[new mn(e)];else if(e.text)e=[new wi(e)];else throw new Error("Unknown node type in node creation");return e.map(r=>(r[Di]||n.rebuild(r),r=r.proxyOf,r.parent&&r.parent.removeChild(r),r[Mi]&&Ri(r),r.raws||(r.raws={}),typeof r.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(r.raws.before=t.raws.before.replace(/\\S/g,"")),r.parent=this.proxyOf,r))}prepend(...e){e=e.reverse();for(let t of e){let i=this.normalize(t,this.first,"prepend").reverse();for(let r of i)this.proxyOf.nodes.unshift(r);for(let r in this.indexes)this.indexes[r]=this.indexes[r]+i.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let i in this.indexes)t=this.indexes[i],t>=e&&(this.indexes[i]=t-1);return this.markDirty(),this}replaceValues(e,t,i){return i||(i=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,i))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,i)=>{let r;try{r=e(t,i)}catch(o){throw t.addToError(o)}return r!==!1&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((i,r)=>{if(i.type==="atrule"&&e.test(i.name))return t(i,r)}):this.walk((i,r)=>{if(i.type==="atrule"&&i.name===e)return t(i,r)}):(t=e,this.walk((i,r)=>{if(i.type==="atrule")return t(i,r)}))}walkComments(e){return this.walk((t,i)=>{if(t.type==="comment")return e(t,i)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((i,r)=>{if(i.type==="decl"&&e.test(i.prop))return t(i,r)}):this.walk((i,r)=>{if(i.type==="decl"&&i.prop===e)return t(i,r)}):(t=e,this.walk((i,r)=>{if(i.type==="decl")return t(i,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((i,r)=>{if(i.type==="rule"&&e.test(i.selector))return t(i,r)}):this.walk((i,r)=>{if(i.type==="rule"&&i.selector===e)return t(i,r)}):(t=e,this.walk((i,r)=>{if(i.type==="rule")return t(i,r)}))}};Ce.registerParse=n=>{ki=n};Ce.registerRule=n=>{pn=n};Ce.registerAtRule=n=>{mn=n};Ce.registerRoot=n=>{Li=n};vi.exports=Ce;Ce.default=Ce;Ce.rebuild=n=>{n.type==="atrule"?Object.setPrototypeOf(n,mn.prototype):n.type==="rule"?Object.setPrototypeOf(n,pn.prototype):n.type==="decl"?Object.setPrototypeOf(n,Ci.prototype):n.type==="comment"?Object.setPrototypeOf(n,wi.prototype):n.type==="root"&&Object.setPrototypeOf(n,Li.prototype),n[Di]=!0,n.nodes&&n.nodes.forEach(e=>{Ce.rebuild(e)})}});var Tt=K((tu,Oi)=>{"use strict";var Bi=ve(),$e=class extends Bi{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};Oi.exports=$e;$e.default=$e;Bi.registerAtRule($e)});var Rt=K((nu,Ii)=>{"use strict";var ts=ve(),Pi,_i,Ue=class extends ts{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Pi(new _i,this,e).stringify()}};Ue.registerLazyResult=n=>{Pi=n};Ue.registerProcessor=n=>{_i=n};Ii.exports=Ue;Ue.default=Ue});var Hi=K((iu,Wi)=>{var ns="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",is=(n,e=21)=>(t=e)=>{let i="",r=t|0;for(;r--;)i+=n[Math.random()*n.length|0];return i},rs=(n=21)=>{let e="",t=n|0;for(;t--;)e+=ns[Math.random()*64|0];return e};Wi.exports={nanoid:rs,customAlphabet:is}});var vt=K(()=>{});var Bt=K(()=>{});var hn=K(()=>{});var Ui=K(()=>{});var gn=K((fu,ji)=>{"use strict";var{existsSync:os,readFileSync:ss}=Ui(),{dirname:xn,join:ls}=vt(),{SourceMapConsumer:qi,SourceMapGenerator:zi}=Bt();function as(n){return Buffer?Buffer.from(n,"base64").toString():window.atob(n)}var ht=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let i=t.map?t.map.prev:void 0,r=this.loadMap(t.from,i);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=xn(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new qi(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\/json;charset=utf-?8;base64,/,i=/^data:application\\/json;base64,/,r=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,s=e.match(r)||e.match(o);if(s)return decodeURIComponent(e.substr(s[0].length));let c=e.match(t)||e.match(i);if(c)return as(e.substr(c[0].length));let u=e.match(/data:application\\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+u)}getAnnotationURL(e){return e.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!t)return;let i=e.lastIndexOf(t.pop()),r=e.indexOf("*/",i);i>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(i,r)))}loadFile(e){if(this.root=xn(e),os(e))return this.mapFile=e,ss(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let i=t(e);if(i){let r=this.loadFile(i);if(!r)throw new Error("Unable to load previous source map: "+i.toString());return r}}else{if(t instanceof qi)return zi.fromSourceMap(t).toString();if(t instanceof zi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return e&&(i=ls(xn(e),i)),this.loadFile(i)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};ji.exports=ht;ht.default=ht});var xt=K((mu,Ji)=>{"use strict";var{nanoid:us}=Hi(),{isAbsolute:An,resolve:En}=vt(),{SourceMapConsumer:cs,SourceMapGenerator:ds}=Bt(),{fileURLToPath:Gi,pathToFileURL:Ot}=hn(),$i=kt(),fs=gn(),Sn=an(),yn=Symbol("lineToIndexCache"),ms=!!(cs&&ds),Vi=!!(En&&An);function Ki(n){if(n[yn])return n[yn];let e=n.css.split(`\n`),t=new Array(e.length),i=0;for(let r=0,o=e.length;r<o;r++)t[r]=i,i+=e[r].length+1;return n[yn]=t,t}var Ve=class{get from(){return this.file||this.id}constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.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,t.document&&(this.document=t.document.toString()),t.from&&(!Vi||/^\\w+:\\/\\//.test(t.from)||An(t.from)?this.file=t.from:this.file=En(t.from)),Vi&&ms){let i=new fs(this.css,t);if(i.text){this.map=i;let r=i.consumer().file;!this.file&&r&&(this.file=this.mapResolve(r))}}this.file||(this.id="<input css "+us(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,i,r={}){let o,s,c,u,a;if(t&&typeof t=="object"){let f=t,m=i;if(typeof f.offset=="number"){u=f.offset;let h=this.fromOffset(u);t=h.line,i=h.col}else t=f.line,i=f.column,u=this.fromLineAndColumn(t,i);if(typeof m.offset=="number"){c=m.offset;let h=this.fromOffset(c);s=h.line,o=h.col}else s=m.line,o=m.column,c=this.fromLineAndColumn(m.line,m.column)}else if(i)u=this.fromLineAndColumn(t,i);else{u=t;let f=this.fromOffset(u);t=f.line,i=f.col}let l=this.origin(t,i,s,o);return l?a=new $i(e,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,r.plugin):a=new $i(e,s===void 0?t:{column:i,line:t},s===void 0?i:{column:o,line:s},this.css,this.file,r.plugin),a.input={column:i,endColumn:o,endLine:s,endOffset:c,line:t,offset:u,source:this.css},this.file&&(Ot&&(a.input.url=Ot(this.file).toString()),a.input.file=this.file),a}fromLineAndColumn(e,t){return Ki(this)[e-1]+t-1}fromOffset(e){let t=Ki(this),i=t[t.length-1],r=0;if(e>=i)r=t.length-1;else{let o=t.length-2,s;for(;r<o;)if(s=r+(o-r>>1),e<t[s])o=s-1;else if(e>=t[s+1])r=s+1;else{r=s;break}}return{col:e-t[r]+1,line:r+1}}mapResolve(e){return/^\\w+:\\/\\//.test(e)?e:En(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,i,r){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:t,line:e});if(!s.source)return!1;let c;typeof i=="number"&&(c=o.originalPositionFor({column:r,line:i}));let u;An(s.source)?u=Ot(s.source):u=new URL(s.source,this.map.consumer().sourceRoot||Ot(this.map.mapFile));let a={column:s.column,endColumn:c&&c.column,endLine:c&&c.line,line:s.line,url:u.toString()};if(u.protocol==="file:")if(Gi)a.file=Gi(u);else throw new Error("file: protocol is not available in this PostCSS build");let l=o.sourceContentFor(s.source);return l&&(a.source=l),a}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}};Ji.exports=Ve;Ve.default=Ve;Sn&&Sn.registerInput&&Sn.registerInput(Ve)});var Ke=K((pu,Xi)=>{"use strict";var Qi=ve(),Yi,Zi,Be=class extends Qi{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,i){let r=super.normalize(e);if(t){if(i==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of r)o.raws.before=t.raws.before}return r}removeChild(e,t){let i=this.index(e);return!t&&i===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[i].raws.before),super.removeChild(e)}toResult(e={}){return new Yi(new Zi,this,e).stringify()}};Be.registerLazyResult=n=>{Yi=n};Be.registerProcessor=n=>{Zi=n};Xi.exports=Be;Be.default=Be;Qi.registerRoot(Be)});var Fn=K((hu,er)=>{"use strict";var gt={comma(n){return gt.split(n,[","],!0)},space(n){let e=[" ",`\n`," "];return gt.split(n,e)},split(n,e,t){let i=[],r="",o=!1,s=0,c=!1,u="",a=!1;for(let l of n)a?a=!1:l==="\\\\"?a=!0:c?l===u&&(c=!1):l===\'"\'||l==="\'"?(c=!0,u=l):l==="("?s+=1:l===")"?s>0&&(s-=1):s===0&&e.includes(l)&&(o=!0),o?(r!==""&&i.push(r.trim()),r="",o=!1):r+=l;return(t||r!=="")&&i.push(r.trim()),i}};er.exports=gt;gt.default=gt});var Pt=K((xu,nr)=>{"use strict";var tr=ve(),ps=Fn(),Je=class extends tr{get selectors(){return ps.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\s*/):null,i=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(i)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}};nr.exports=Je;Je.default=Je;tr.registerRule(Je)});var rr=K((gu,ir)=>{"use strict";var hs=Tt(),xs=ft(),gs=pt(),Ss=xt(),ys=gn(),As=Ke(),Es=Pt();function St(n,e){if(Array.isArray(n))return n.map(r=>St(r));let{inputs:t,...i}=n;if(t){e=[];for(let r of t){let o={...r,__proto__:Ss.prototype};o.map&&(o.map={...o.map,__proto__:ys.prototype}),e.push(o)}}if(i.nodes&&(i.nodes=n.nodes.map(r=>St(r,e))),i.source){let{inputId:r,...o}=i.source;i.source=o,r!=null&&(i.source.input=e[r])}if(i.type==="root")return new As(i);if(i.type==="decl")return new gs(i);if(i.type==="rule")return new Es(i);if(i.type==="comment")return new xs(i);if(i.type==="atrule")return new hs(i);throw new Error("Unknown node type: "+n.type)}ir.exports=St;St.default=St});var Nn=K((Su,cr)=>{"use strict";var{dirname:_t,relative:sr,resolve:lr,sep:ar}=vt(),{SourceMapConsumer:ur,SourceMapGenerator:It}=Bt(),{pathToFileURL:or}=hn(),Fs=xt(),bs=!!(ur&&It),Ns=!!(_t&&lr&&sr&&ar),bn=class{constructor(e,t,i,r){this.stringify=e,this.mapOpts=i.map||{},this.root=t,this.opts=i,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`\n`;this.css.includes(`\\r\n`)&&(t=`\\r\n`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),i=e.root||_t(e.file),r;this.mapOpts.sourcesContent===!1?(r=new ur(e.text),r.sourcesContent&&(r.sourcesContent=null)):r=e.consumer(),this.map.applySourceMap(r,t,this.toUrl(this.path(i)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(t)}else if(this.css){let e;for(;(e=this.css.lastIndexOf("/*#"))!==-1;){let t=this.css.indexOf("*/",e+3);if(t===-1)break;for(;e>0&&this.css[e-1]===`\n`;)e--;this.css=this.css.slice(0,e)+this.css.slice(t+2)}}}}generate(){if(this.clearAnnotation(),Ns&&bs&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=It.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new It({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 It({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,i="<no source>",r={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(c,u,a)=>{if(this.css+=c,u&&a!=="end"&&(r.generated.line=e,r.generated.column=t-1,u.source&&u.source.start?(r.source=this.sourcePath(u),r.original.line=u.source.start.line,r.original.column=u.source.start.column-1,this.map.addMapping(r)):(r.source=i,r.original.line=1,r.original.column=0,this.map.addMapping(r))),s=c.match(/\\n/g),s?(e+=s.length,o=c.lastIndexOf(`\n`),t=c.length-o):t+=c.length,u&&a!=="start"){let l=u.parent||{raws:{}};(!(u.type==="decl"||u.type==="atrule"&&!u.nodes)||u!==l.last||l.raws.semicolon)&&(u.source&&u.source.end?(r.source=this.sourcePath(u),r.original.line=u.source.end.line,r.original.column=u.source.end.column-1,r.generated.line=e,r.generated.column=t-2,this.map.addMapping(r)):(r.source=i,r.original.line=1,r.original.column=0,r.generated.line=e,r.generated.column=t-1,this.map.addMapping(r)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.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(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\w+:\\/\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let i=this.opts.to?_t(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=_t(lr(i,this.mapOpts.annotation)));let r=sr(i,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Fs(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let i=t.source.input.from;if(i&&!e[i]){e[i]=!0;let r=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(or){let i=or(e).toString();return this.memoizedFileURLs.set(e,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;ar==="\\\\"&&(e=e.replace(/\\\\/g,"/"));let i=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,i),i}};cr.exports=bn});var mr=K((yu,fr)=>{"use strict";var Wt=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Ht=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,ws=/.[\\r\\n"\'(/\\\\]/,dr=/[\\da-f]/i;fr.exports=function(e,t={}){let i=e.css.valueOf(),r=t.ignoreErrors,o,s,c,u,a,l,f,m,h,M,C=i.length,A=0,z=[],P=[];function k(){return A}function Y(F){throw e.error("Unclosed "+F,A)}function y(){return P.length===0&&A>=C}function p(F){if(P.length)return P.pop();if(A>=C)return;let b=F?F.ignoreUnclosed:!1;switch(o=i.charCodeAt(A),o){case 10:case 32:case 9:case 13:case 12:{u=A;do u+=1,o=i.charCodeAt(u);while(o===32||o===10||o===9||o===13||o===12);l=["space",i.slice(A,u)],A=u-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let N=String.fromCharCode(o);l=[N,N,A];break}case 40:{if(M=z.length?z.pop()[1]:"",h=i.charCodeAt(A+1),M==="url"&&h!==39&&h!==34&&h!==32&&h!==10&&h!==9&&h!==12&&h!==13){u=A;do{if(f=!1,u=i.indexOf(")",u+1),u===-1)if(r||b){u=A;break}else Y("bracket");for(m=u;i.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);l=["brackets",i.slice(A,u+1),A,u],A=u}else u=i.indexOf(")",A+1),s=i.slice(A,u+1),u===-1||ws.test(s)?l=["(","(",A]:(l=["brackets",s,A,u],A=u);break}case 39:case 34:{a=o===39?"\'":\'"\',u=A;do{if(f=!1,u=i.indexOf(a,u+1),u===-1)if(r||b){u=A+1;break}else Y("string");for(m=u;i.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);l=["string",i.slice(A,u+1),A,u],A=u;break}case 64:{Wt.lastIndex=A+1,Wt.test(i),Wt.lastIndex===0?u=i.length-1:u=Wt.lastIndex-2,l=["at-word",i.slice(A,u+1),A,u],A=u;break}case 92:{for(u=A,c=!0;i.charCodeAt(u+1)===92;)u+=1,c=!c;if(o=i.charCodeAt(u+1),c&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(u+=1,dr.test(i.charAt(u)))){for(;dr.test(i.charAt(u+1));)u+=1;i.charCodeAt(u+1)===32&&(u+=1)}l=["word",i.slice(A,u+1),A,u],A=u;break}default:{o===47&&i.charCodeAt(A+1)===42?(u=i.indexOf("*/",A+2)+1,u===0&&(r||b?u=i.length:Y("comment")),l=["comment",i.slice(A,u+1),A,u],A=u):(Ht.lastIndex=A+1,Ht.test(i),Ht.lastIndex===0?u=i.length-1:u=Ht.lastIndex-2,l=["word",i.slice(A,u+1),A,u],z.push(l),A=u);break}}return A++,l}function S(F){P.push(F)}return{back:S,endOfFile:y,nextToken:p,position:k}}});var gr=K((Au,xr)=>{"use strict";var Cs=Tt(),Ms=ft(),Ds=pt(),ks=Ke(),pr=Pt(),Ls=mr(),hr={empty:!0,space:!0};function Ts(n){for(let e=n.length-1;e>=0;e--){let t=n[e],i=t[3]||t[2];if(i)return i}}var wn=class{constructor(e){this.input=e,this.root=new ks,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Cs;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let i,r,o,s=!1,c=!1,u=[],a=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),i=e[0],i==="("||i==="["?a.push(i==="("?")":"]"):i==="{"&&a.length>0?a.push("}"):i===a[a.length-1]&&a.pop(),a.length===0)if(i===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){c=!0;break}else if(i==="}"){if(u.length>0){for(o=u.length-1,r=u[o];r&&r[0]==="space";)r=u[--o];r&&(t.source.end=this.getPosition(r[3]||r[2]),t.source.end.offset++)}this.end(e);break}else u.push(e);else u.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(u),u.length?(t.raws.afterName=this.spacesAndCommentsFromStart(u),this.raw(t,"params",u),s&&(e=u[u.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),c&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let i=0,r;for(let o=t-1;o>=0&&(r=e[o],!(r[0]!=="space"&&(i+=1,i===2)));o--);throw this.input.error("Missed semicolon",r[0]==="word"?r[3]+1:r[2])}colon(e){let t=0,i,r,o;for(let[s,c]of e.entries()){if(r=c,o=r[0],o==="("&&(t+=1),o===")"&&(t-=1),t===0&&o===":")if(!i)this.doubleColon(r);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=r}return!1}comment(e){let t=new Ms;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let i=e[1].slice(2,-2);if(!i.trim())t.text="",t.raws.left=i,t.raws.right="";else{let r=i.match(/^(\\s*)([^]*\\S)(\\s*)$/);t.text=r[2],t.raws.left=r[1],t.raws.right=r[3]}}createTokenizer(){this.tokenizer=Ls(this.input)}decl(e,t){let i=new Ds;this.init(i,e[0][2]);let r=e[e.length-1];for(r[0]===";"&&(this.semicolon=!0,e.pop()),i.source.end=this.getPosition(r[3]||r[2]||Ts(e)),i.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),i.raws.before+=e.shift()[1];for(i.source.start=this.getPosition(e[0][2]),i.prop="";e.length;){let a=e[0][0];if(a===":"||a==="space"||a==="comment")break;i.prop+=e.shift()[1]}i.raws.between="";let o;for(;e.length;)if(o=e.shift(),o[0]===":"){i.raws.between+=o[1];break}else o[0]==="word"&&/\\w/.test(o[1])&&this.unknownWord([o]),i.raws.between+=o[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let s=[],c;for(;e.length&&(c=e[0][0],!(c!=="space"&&c!=="comment"));)s.push(e.shift());this.precheckMissedSemicolon(e);for(let a=e.length-1;a>=0;a--){if(o=e[a],o[1].toLowerCase()==="!important"){i.important=!0;let l=this.stringFrom(e,a);l=this.spacesFromEnd(e)+l,l!==" !important"&&(i.raws.important=l);break}else if(o[1].toLowerCase()==="important"){let l=e.slice(0),f="";for(let m=a;m>0;m--){let h=l[m][0];if(f.trim().startsWith("!")&&h!=="space")break;f=l.pop()[1]+f}f.trim().startsWith("!")&&(i.important=!0,i.raws.important=f,e=l)}if(o[0]!=="space"&&o[0]!=="comment")break}e.some(a=>a[0]!=="space"&&a[0]!=="comment")&&(i.raws.between+=s.map(a=>a[1]).join(""),s=[]),this.raw(i,"value",s.concat(e),t),i.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new pr;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){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(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}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(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,i=null,r=!1,o=null,s=[],c=e[1].startsWith("--"),u=[],a=e;for(;a;){if(i=a[0],u.push(a),i==="("||i==="[")o||(o=a),s.push(i==="("?")":"]");else if(c&&r&&i==="{")o||(o=a),s.push("}");else if(s.length===0)if(i===";")if(r){this.decl(u,c);return}else break;else if(i==="{"){this.rule(u);return}else if(i==="}"){this.tokenizer.back(u.pop()),t=!0;break}else i===":"&&(r=!0);else i===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));a=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),s.length>0&&this.unclosedBracket(o),t&&r){if(!c)for(;u.length&&(a=u[u.length-1][0],!(a!=="space"&&a!=="comment"));)this.tokenizer.back(u.pop());this.decl(u,c)}else this.unknownWord(u)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,i,r){let o,s,c=i.length,u="",a=!0,l,f;for(let m=0;m<c;m+=1)o=i[m],s=o[0],s==="space"&&m===c-1&&!r?a=!1:s==="comment"?(f=i[m-1]?i[m-1][0]:"empty",l=i[m+1]?i[m+1][0]:"empty",!hr[f]&&!hr[l]?u.slice(-1)===","?a=!1:u+=o[1]:a=!1):u+=o[1];if(!a){let m=i.reduce((h,M)=>h+M[1],"");e.raws[t]={raw:m,value:u}}e[t]=u}rule(e){e.pop();let t=new pr;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)i=e.pop()[1]+i;return i}spacesAndCommentsFromStart(e){let t,i="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)i+=e.shift()[1];return i}spacesFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],t==="space");)i=e.pop()[1]+i;return i}stringFrom(e,t){let i="";for(let r=t;r<e.length;r++)i+=e[r][1];return e.splice(t,e.length-t),i}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word "+e[0][1],{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};xr.exports=wn});var qt=K((Eu,Sr)=>{"use strict";var Rs=ve(),vs=xt(),Bs=gr();function Ut(n,e){let t=new vs(n,e),i=new Bs(t);try{i.parse()}catch(r){throw r}return i.root}Sr.exports=Ut;Ut.default=Ut;Rs.registerParse(Ut)});var Cn=K((Fu,yr)=>{"use strict";var yt=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let i=t.node.rangeBy(t);this.line=i.start.line,this.column=i.start.column,this.endLine=i.end.line,this.endColumn=i.end.column}for(let i in t)this[i]=t[i]}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}};yr.exports=yt;yt.default=yt});var zt=K((bu,Ar)=>{"use strict";var Os=Cn(),At=class{get content(){return this.css}constructor(e,t,i){this.processor=e,this.messages=[],this.root=t,this.opts=i,this.css="",this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let i=new Os(e,t);return this.messages.push(i),i}warnings(){return this.messages.filter(e=>e.type==="warning")}};Ar.exports=At;At.default=At});var Mn=K((Nu,Fr)=>{"use strict";var Er={};Fr.exports=function(e){Er[e]||(Er[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))}});var Ln=K((Cu,Cr)=>{"use strict";var Ps=ve(),_s=Rt(),Is=Nn(),Ws=qt(),br=zt(),Hs=Ke(),Us=lt(),{isClean:De,my:qs}=Lt(),wu=Mn(),zs={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},js={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},Gs={Once:!0,postcssPlugin:!0,prepare:!0},Qe=0;function Et(n){return typeof n=="object"&&typeof n.then=="function"}function wr(n){let e=!1,t=zs[n.type];return n.type==="decl"?e=n.prop.toLowerCase():n.type==="atrule"&&(e=n.name.toLowerCase()),e&&n.append?[t,t+"-"+e,Qe,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:n.append?[t,Qe,t+"Exit"]:[t,t+"Exit"]}function Nr(n){let e;return n.type==="document"?e=["Document",Qe,"DocumentExit"]:n.type==="root"?e=["Root",Qe,"RootExit"]:e=wr(n),{eventIndex:0,events:e,iterator:0,node:n,visitorIndex:0,visitors:[]}}function Dn(n){return n[De]=!1,n.nodes&&n.nodes.forEach(e=>Dn(e)),n}var kn={},Oe=class n{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(e,t,i){this.stringified=!1,this.processed=!1;let r;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))r=Dn(t);else if(t instanceof n||t instanceof br)r=Dn(t.root),t.map&&(typeof i.map>"u"&&(i.map={}),i.map.inline||(i.map.inline=!1),i.map.prev=t.map);else{let o=Ws;i.syntax&&(o=i.syntax.parse),i.parser&&(o=i.parser),o.parse&&(o=o.parse);try{r=o(t,i)}catch(s){this.processed=!0,this.error=s}r&&!r[qs]&&Ps.rebuild(r)}this.result=new br(e,r,i),this.helpers={...kn,postcss:kn,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(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let i=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=i.postcssPlugin,e.setMessage()):i.postcssVersion}catch(r){console&&console.error&&console.error(r)}return e}prepareVisitors(){this.listeners={};let e=(t,i,r)=>{this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push([t,r])};for(let t of this.plugins)if(typeof t=="object")for(let i in t){if(!js[i]&&/^[A-Z]/.test(i))throw new Error(`Unknown event ${i} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Gs[i])if(typeof t[i]=="object")for(let r in t[i])r==="*"?e(t,i,t[i][r]):e(t,i+"-"+r.toLowerCase(),t[i][r]);else typeof t[i]=="function"&&e(t,i,t[i])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],i=this.runOnRoot(t);if(Et(i))try{await i}catch(r){throw this.handleError(r)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[De];){e[De]=!0;let t=[Nr(e)];for(;t.length>0;){let i=this.visitTick(t);if(Et(i))try{await i}catch(r){let o=t[t.length-1].node;throw this.handleError(r,o)}}}if(this.listeners.OnceExit)for(let[t,i]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let r=e.nodes.map(o=>i(o,this.helpers));await Promise.all(r)}else await i(e,this.helpers)}catch(r){throw this.handleError(r)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(i=>e.Once(i,this.helpers));return Et(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Us;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new Is(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[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 e of this.plugins){let t=this.runOnRoot(e);if(Et(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[De];)e[De]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[i,r]of e){this.result.lastPlugin=i;let o;try{o=r(t,this.helpers)}catch(s){throw this.handleError(s,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(Et(o))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:i,visitors:r}=t;if(i.type!=="root"&&i.type!=="document"&&!i.parent){e.pop();return}if(r.length>0&&t.visitorIndex<r.length){let[s,c]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=s;try{return c(i.toProxy(),this.helpers)}catch(u){throw this.handleError(u,i)}}if(t.iterator!==0){let s=t.iterator,c;for(;c=i.nodes[i.indexes[s]];)if(i.indexes[s]+=1,!c[De]){c[De]=!0,e.push(Nr(c));return}t.iterator=0,delete i.indexes[s]}let o=t.events;for(;t.eventIndex<o.length;){let s=o[t.eventIndex];if(t.eventIndex+=1,s===Qe){i.nodes&&i.nodes.length&&(i[De]=!0,t.iterator=i.getIterator());return}else if(this.listeners[s]){t.visitors=this.listeners[s];return}}e.pop()}walkSync(e){e[De]=!0;let t=wr(e);for(let i of t)if(i===Qe)e.nodes&&e.each(r=>{r[De]||this.walkSync(r)});else{let r=this.listeners[i];if(r&&this.visitSync(r,e.toProxy()))return}}warnings(){return this.sync().warnings()}};Oe.registerPostcss=n=>{kn=n};Cr.exports=Oe;Oe.default=Oe;Hs.registerLazyResult(Oe);_s.registerLazyResult(Oe)});var Dr=K((Du,Mr)=>{"use strict";var $s=Nn(),Vs=qt(),Ks=zt(),Js=lt(),Mu=Mn(),Ft=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 e,t=Vs;try{e=t(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(e,t,i){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=i,this._map=void 0;let r=Js;this.result=new Ks(this._processor,void 0,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let s=new $s(r,void 0,this._opts,t);if(s.isMap()){let[c,u]=s.generate();c&&(this.result.css=c),u&&(this.result.map=u)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}};Mr.exports=Ft;Ft.default=Ft});var Lr=K((ku,kr)=>{"use strict";var Qs=Rt(),Ys=Ln(),Zs=Dr(),Xs=Ke(),qe=class{constructor(e=[]){this.version="8.5.8",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let i of e)if(i.postcss===!0?i=i():i.postcss&&(i=i.postcss),typeof i=="object"&&Array.isArray(i.plugins))t=t.concat(i.plugins);else if(typeof i=="object"&&i.postcssPlugin)t.push(i);else if(typeof i=="function")t.push(i);else if(!(typeof i=="object"&&(i.parse||i.stringify)))throw new Error(i+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Zs(this,e,t):new Ys(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};kr.exports=qe;qe.default=qe;Xs.registerProcessor(qe);Qs.registerProcessor(qe)});var Ir=K((Lu,_r)=>{"use strict";var Tr=Tt(),Rr=ft(),el=ve(),tl=kt(),vr=pt(),Br=Rt(),nl=rr(),il=xt(),rl=Ln(),ol=Fn(),sl=ct(),ll=qt(),Tn=Lr(),al=zt(),Or=Ke(),Pr=Pt(),ul=lt(),cl=Cn();function te(...n){return n.length===1&&Array.isArray(n[0])&&(n=n[0]),new Tn(n)}te.plugin=function(e,t){let i=!1;function r(...s){console&&console.warn&&!i&&(i=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let c=t(...s);return c.postcssPlugin=e,c.postcssVersion=new Tn().version,c}let o;return Object.defineProperty(r,"postcss",{get(){return o||(o=r()),o}}),r.process=function(s,c,u){return te([r(u)]).process(s,c)},r};te.stringify=ul;te.parse=ll;te.fromJSON=nl;te.list=ol;te.comment=n=>new Rr(n);te.atRule=n=>new Tr(n);te.decl=n=>new vr(n);te.rule=n=>new Pr(n);te.root=n=>new Or(n);te.document=n=>new Br(n);te.CssSyntaxError=tl;te.Declaration=vr;te.Container=el;te.Processor=Tn;te.Document=Br;te.Comment=Rr;te.Warning=cl;te.AtRule=Tr;te.Result=al;te.Input=il;te.Rule=Pr;te.Root=Or;te.Node=sl;rl.registerPostcss(te);_r.exports=te;te.default=te});function ge(n){try{window.parent.postMessage(n,"*")}catch{}}function Qn(n){let e=t=>{let i=t.data;if(!i||i.source!=="hf-parent"||i.type!=="control")return;let r=i.action;if(r==="play"){n.onPlay();return}if(r==="pause"){n.onPause();return}if(r==="seek"){n.onSeek(Number(i.frame??0),i.seekMode??"commit");return}if(r==="set-muted"){n.onSetMuted(!!i.muted);return}if(r==="set-media-output-muted"){n.onSetMediaOutputMuted(!!i.muted);return}if(r==="set-playback-rate"){n.onSetPlaybackRate(Number(i.playbackRate??1));return}if(r==="enable-pick-mode"){n.onEnablePickMode();return}if(r==="disable-pick-mode"){n.onDisablePickMode();return}if(r==="flash-elements"){let o=i.selectors,s=i.duration||800;o&&To(o,s)}};return window.addEventListener("message",e),e}function To(n,e){if(!document.getElementById("__hf-flash-styles")){let t=document.createElement("style");t.id="__hf-flash-styles",t.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 ${e}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(t)}for(let t of n)try{document.querySelectorAll(t).forEach(r=>{r.classList.add("__hf-flash"),setTimeout(()=>r.classList.remove("__hf-flash"),e)})}catch{}}var tn=null;function Yn(n){tn=n}function nt(n,e){if(tn)try{tn({source:"hf-preview",type:"analytics",event:n,properties:e??{}})}catch{}}function Zn(n){let e=[],t=c=>{if(typeof c.getAnimations!="function")return[];try{return c.getAnimations()}catch{return[]}},i=(c,u)=>{for(let a of c){try{a.currentTime=u}catch{}try{a.pause()}catch{}}},r=c=>{for(let u of c)try{u.play()}catch{}},o=c=>{for(let u of c)try{u.pause()}catch{}},s=c=>{c.baseDelay?c.el.style.animationDelay=c.baseDelay:c.el.style.removeProperty("animation-delay"),c.basePlayState?c.el.style.animationPlayState=c.basePlayState:c.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{e=[];let c=document.querySelectorAll("*");for(let u of c){if(!(u instanceof HTMLElement))continue;let a=window.getComputedStyle(u);!a.animationName||a.animationName==="none"||e.push({el:u,baseDelay:u.style.animationDelay||"",basePlayState:u.style.animationPlayState||""})}},seek:c=>{let u=Number(c.time)||0;for(let a of e){if(!a.el.isConnected)continue;let l=n?.resolveStartSeconds?n.resolveStartSeconds(a.el):Number.parseFloat(a.el.getAttribute("data-start")??"0")||0,f=Math.max(0,u-l)*1e3,m=t(a.el);if(m.length>0){i(m,f);continue}a.el.style.animationPlayState="paused",a.el.style.animationDelay=`-${(f/1e3).toFixed(3)}s`}},pause:()=>{for(let c of e){if(!c.el.isConnected)continue;let u=t(c.el);u.length>0&&o(u),s(c)}},play:()=>{for(let c of e)c.el.isConnected&&(s(c),r(t(c.el)))},revert:()=>{e=[]}}}function Xn(n){return{name:"gsap",discover:()=>{},seek:e=>{let t=n.getTimeline();if(!t)return;t.pause();let i=Math.max(0,Number(e.time)||0);typeof t.totalTime=="function"?t.totalTime(i,!1):t.seek(i,!1)},pause:()=>{let e=n.getTimeline();e&&e.pause()}}}function ni(){return{name:"lottie",discover:()=>{try{let n=window.lottie;if(n&&typeof n.getRegisteredAnimations=="function"){let e=n.getRegisteredAnimations();if(Array.isArray(e)&&e.length>0){let t=window.__hfLottie??[],i=new Set(t);for(let r of e)i.has(r)||t.push(r);window.__hfLottie=t}}}catch{}},seek:n=>{let e=Math.max(0,Number(n.time)||0),t=window.__hfLottie;if(!(!t||t.length===0))for(let i of t)try{if(ei(i))i.goToAndStop(e*1e3,!1);else if(ti(i)){if(typeof i.setCurrentRawFrameValue=="function"){let r=i.totalFrames??0,o=i.frameRate??30,s=e*o;r>0&&i.setCurrentRawFrameValue(Math.min(s,r-1))}else if(typeof i.seek=="function"){let r=i.duration??1,o=Math.min(100,e/r*100);i.seek(o)}}}catch{}},pause:()=>{let n=window.__hfLottie;if(!(!n||n.length===0))for(let e of n)try{(ei(e)||ti(e))&&e.pause()}catch{}},revert:()=>{}}}function ei(n){return typeof n=="object"&&n!==null&&typeof n.goToAndStop=="function"}function ti(n){return typeof n=="object"&&n!==null&&typeof n.pause=="function"&&("totalFrames"in n||"duration"in n)}function ii(){let n=null,e=0;return{name:"three",discover:()=>{},seek:t=>{n=Math.max(0,Number(t.time)||0),e=n,window.__hfThreeTime=n;try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:{time:n}}))}catch{}},pause:()=>{n==null&&(n=Math.max(0,e))},play:()=>{n=null},revert:()=>{n=null,e=0}}}function ri(){return{name:"waapi",discover:()=>{},seek:n=>{if(!document.getAnimations)return;let e=Math.max(0,(Number(n.time)||0)*1e3);for(let t of document.getAnimations()){try{t.currentTime=e}catch{}try{t.pause()}catch{}}},pause:()=>{if(document.getAnimations)for(let n of document.getAnimations())try{n.pause()}catch{}}}}function oi(n){let e=Array.from(document.querySelectorAll("video, audio")),t=n?.shouldIncludeElement?e.filter(s=>n.shouldIncludeElement?.(s)):e.filter(s=>s.hasAttribute("data-start")),i=[],r=[],o=0;for(let s of t){let c=n?.resolveStartSeconds?n.resolveStartSeconds(s):Number.parseFloat(s.dataset.start??"0");if(!Number.isFinite(c))continue;let u=Number.parseFloat(s.dataset.playbackStart??s.dataset.mediaStart??"0")||0,a=s.defaultPlaybackRate,l=Number.isFinite(a)&&a>0?Math.max(.1,Math.min(5,a)):1,f=s.loop,m=Number.isFinite(s.duration)&&s.duration>0?s.duration:null,h=n?.resolveDurationSeconds?.(s)??Number.parseFloat(s.dataset.duration??"");(!Number.isFinite(h)||h<=0)&&m!=null&&(h=Math.max(0,(m-u)/l));let M=Number.isFinite(h)&&h>0?c+h:Number.POSITIVE_INFINITY,C=Number.parseFloat(s.dataset.volume??""),A={el:s,start:c,mediaStart:u,duration:Number.isFinite(h)&&h>0?h:Number.POSITIVE_INFINITY,end:M,volume:Number.isFinite(C)?C:null,playbackRate:l,loop:f,sourceDuration:m};i.push(A),s.tagName==="VIDEO"&&r.push(A),Number.isFinite(M)&&(o=Math.max(o,M))}return{timedMediaEls:t,mediaClips:i,videoClips:r,maxMediaEnd:o}}var nn=new WeakMap,it=new WeakSet;function Ro(n){if(it.has(n))return;it.add(n);let e=()=>it.delete(n);n.addEventListener("playing",e,{once:!0}),n.addEventListener("pause",e,{once:!0}),n.addEventListener("error",e,{once:!0})}function si(n){let e=!!(n.outputMuted||n.userMuted);for(let t of n.clips){let{el:i}=t;if(!i.isConnected)continue;let r=(n.timeSeconds-t.start)*t.playbackRate+t.mediaStart;if(n.timeSeconds>=t.start&&n.timeSeconds<t.end&&r>=0){if(t.loop&&t.sourceDuration!=null&&t.sourceDuration>0){let h=t.sourceDuration-t.mediaStart;h>0&&r>=t.sourceDuration&&(r=t.mediaStart+(r-t.mediaStart)%h)}t.volume!=null&&(i.volume=t.volume),e&&(i.muted=!0);try{i.playbackRate=t.playbackRate*n.playbackRate}catch{}let s=i.currentTime||0,c=Math.abs(s-r),u=r-s,a=nn.get(i);nn.set(i,u);let l=a===void 0,f=!l&&Math.abs(u-a)>.5,m=c>3;if(c>.5&&(l||f||m))try{i.currentTime=r}catch{}n.playing&&i.paused&&!it.has(i)?(i.preload!=="auto"&&(i.preload="auto"),Ro(i),i.play().catch(h=>{it.delete(i),(h&&typeof h=="object"&&"name"in h?String(h.name??""):"")==="NotAllowedError"&&n.onAutoplayBlocked?.()})):!n.playing&&!i.paused&&i.pause();continue}nn.delete(i),i.paused||i.pause()}}function li(n){let e=!1,t=null,i=null,r=null,o=null;function s(y,p){try{window.dispatchEvent(new CustomEvent(y,{detail:p}))}catch{}}function c(y){r=y,s("hyperframe:picker:hovered",{elementInfo:r,isPickMode:e,timestamp:Date.now()})}function u(y){o=y,s("hyperframe:picker:selected",{elementInfo:o,isPickMode:e,timestamp:Date.now()})}function a(y){if(!y||y===document.body||y===document.documentElement)return!1;let p=y.tagName.toLowerCase();return!(p==="script"||p==="style"||p==="link"||p==="meta"||y.classList.contains("__hf-pick-highlight"))}function l(y){let p=y;if(p.id)return`#${p.id}`;let S=y.getAttribute("data-composition-id");if(S)return`[data-composition-id="${S}"]`;let F=y.getAttribute("data-composition-src");if(F)return`[data-composition-src="${F}"]`;let b=y.getAttribute("data-track-index");if(b)return`[data-track-index="${b}"]`;let N=y.tagName.toLowerCase(),v=y.parentElement;if(!v)return N;let W=v.querySelectorAll(`:scope > ${N}`);if(W.length===1)return N;for(let H=0;H<W.length;H+=1)if(W[H]===y)return`${N}:nth-of-type(${H+1})`;return N}function f(y){let p=y.tagName.toLowerCase(),S=(y.textContent??"").trim().replace(/\\s+/g," "),F=(b,N)=>b.length>N?`${b.slice(0,N-1)}\\u2026`:b;return p==="h1"||p==="h2"||p==="h3"?"Heading":p==="p"||p==="span"||p==="div"?S.length>0?F(S,56):"Text":p==="img"?"Image":p==="video"?"Video":p==="audio"?"Audio":p==="svg"?"Shape":y.getAttribute("data-composition-src")?"Composition":p==="section"?"Section":`${p.charAt(0).toUpperCase()}${p.slice(1)}`}function m(y,p,S){let F=typeof S=="number"&&S>0?S:8,b=[];if(document.elementsFromPoint)b=document.elementsFromPoint(y,p);else if(document.elementFromPoint){let W=document.elementFromPoint(y,p);b=W?[W]:[]}let N={},v=[];for(let W=0;W<b.length;W+=1){let H=b[W];if(!a(H))continue;let X=`${H.tagName}::${H.id||""}::${W}`;if(!N[X]&&(N[X]=!0,v.push(H),v.length>=F))break}return v}function h(y){let p=y.getBoundingClientRect(),S={};for(let b=0;b<y.attributes.length;b+=1){let N=y.attributes[b];N.name.startsWith("data-")&&(S[N.name]=N.value)}return{id:y.id||null,tagName:y.tagName.toLowerCase(),selector:l(y),label:f(y),boundingBox:{x:p.left,y:p.top,width:p.width,height:p.height},textContent:y.textContent?y.textContent.trim().slice(0,200):null,src:y.getAttribute("src")||y.getAttribute("data-composition-src")||null,dataAttributes:S}}function M(y,p,S){return m(y,p,S).map(h)}function C(y){if(!e)return;let S=m(y.clientX,y.clientY,1)[0]??(y.target instanceof Element?y.target:null);if(!a(S)||t===S)return;t&&t.classList.remove("__hf-pick-highlight"),t=S,S.classList.add("__hf-pick-highlight");let F=h(S);c(F),n.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:F})}function A(y){if(!e)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();let p=M(y.clientX,y.clientY,8);p.length!==0&&(c(p[0]??null),n.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:p,selectedIndex:0,point:{x:y.clientX,y:y.clientY}}))}function z(y){y.key==="Escape"&&(k(),n.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function P(){e||(e=!0,i=document.createElement("style"),i.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(i),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",C,!0),document.addEventListener("click",A,!0),document.addEventListener("keydown",z,!0),s("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function k(){e&&(e=!1,t&&(t.classList.remove("__hf-pick-highlight"),t=null),i&&(i.remove(),i=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",C,!0),document.removeEventListener("click",A,!0),document.removeEventListener("keydown",z,!0),s("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function Y(){window.__HF_PICKER_API={enable:P,disable:k,isActive:()=>e,getHovered:()=>r,getSelected:()=>o,getCandidatesAtPoint:(y,p,S)=>Number.isFinite(y)&&Number.isFinite(p)?M(y,p,S):[],pickAtPoint:(y,p,S)=>{if(!Number.isFinite(y)||!Number.isFinite(p))return null;let F=M(y,p,8);if(!F.length)return null;let b=Math.max(0,Math.min(F.length-1,Number(S??0))),N=F[b]??null;return N?(u(N),n.postMessage({source:"hf-preview",type:"element-picked",elementInfo:N}),k(),N):null},pickManyAtPoint:(y,p,S)=>{if(!Number.isFinite(y)||!Number.isFinite(p))return[];let F=M(y,p,8);if(!F.length)return[];let b=[],N=Array.isArray(S)?S:[0];for(let v of N){let W=Math.max(0,Math.min(F.length-1,Math.floor(Number(v)))),H=F[W];if(!H)continue;b.some(T=>T.selector===H.selector&&T.tagName===H.tagName)||b.push(H)}return b.length?(u(b[0]??null),n.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:b}),k(),b):[]}},s("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:P,disablePickMode:k,installPickerApi:Y}}function rn(n,e){let t=Number.isFinite(e)&&e>0?e:30,i=Number.isFinite(n)&&n>0?n:0;return Math.floor(i*t+1e-9)/t}function Dt(n,e,t){if(n){for(let i of Object.values(n))if(!(!i||i===e))try{t(i)}catch{}}}function ai(n,e,t){let i=rn(e,t);return n.pause(),typeof n.totalTime=="function"?n.totalTime(i,!1):n.seek(i,!1),i}function vo(n,e,t,i){let r=[];Dt(n,e,o=>{o.play(),r.push(o)});try{return ai(e,t,i)}finally{for(let o of r)try{o.pause()}catch{}}}function Bo(n,e){Dt(n,e,t=>{t.play()})}function ui(n){return{_timeline:null,play:()=>{let e=n.getTimeline();if(!e||n.getIsPlaying())return;let t=Math.max(0,Number(n.getSafeDuration?.()??e.duration()??0)||0);t>0&&Math.max(0,Number(e.time())||0)>=t&&(e.pause(),e.seek(0,!1),n.onDeterministicSeek(0),n.setIsPlaying(!1),n.onSyncMedia(0,!1),n.onRenderFrameSeek(0)),typeof e.timeScale=="function"&&e.timeScale(n.getPlaybackRate()),e.play(),Dt(n.getTimelineRegistry?.(),e,i=>{typeof i.timeScale=="function"&&i.timeScale(n.getPlaybackRate()),i.play()}),n.onDeterministicPlay(),n.setIsPlaying(!0),n.onShowNativeVideos(),n.onStatePost(!0)},pause:()=>{let e=n.getTimeline();if(!e)return;e.pause(),Dt(n.getTimelineRegistry?.(),e,i=>{i.pause()});let t=Math.max(0,Number(e.time())||0);n.onDeterministicSeek(t),n.onDeterministicPause(),n.setIsPlaying(!1),n.onSyncMedia(t,!1),n.onRenderFrameSeek(t),n.onStatePost(!0)},seek:e=>{let t=n.getTimeline();if(!t)return;let i=Math.max(0,Number(e)||0),r=vo(n.getTimelineRegistry?.(),t,i,n.getCanonicalFps());n.onDeterministicSeek(r),n.setIsPlaying(!1),n.onSyncMedia(r,!1),n.onRenderFrameSeek(r),n.onStatePost(!0)},renderSeek:e=>{let t=n.getTimeline(),i=n.getCanonicalFps(),r=t?(Bo(n.getTimelineRegistry?.(),t),ai(t,e,i)):rn(Math.max(0,Number(e)||0),i);n.onDeterministicSeek(r),n.setIsPlaying(!1),n.onSyncMedia(r,!1),n.onRenderFrameSeek(r),n.onStatePost(!0)},getTime:()=>Number(n.getTimeline()?.time()??0),getDuration:()=>Number(n.getTimeline()?.duration()??0),isPlaying:()=>n.getIsPlaying(),setPlaybackRate:e=>n.setPlaybackRate(e),getPlaybackRate:()=>n.getPlaybackRate()}}function ci(){return{capturedTimeline:null,isPlaying:!1,rafId:null,currentTime:0,deterministicAdapters:[],parityModeEnabled:!0,canonicalFps:30,bridgeMuted:!1,mediaOutputMuted:!1,mediaAutoplayBlockedPosted:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,timelinePollIntervalId:null,controlBridgeHandler:null,clampDurationLoggedRaw:null,beforeUnloadHandler:null,domReadyHandler:null,injectedCompStyles:[],injectedCompScripts:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,maxTimelineDurationSeconds:1800,nativeVisualWatchdogTick:0}}var Oo="data-hf-authored-duration",Po="data-hf-authored-end";function We(n){if(n==null||n==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}function _o(n){return We(n.getAttribute("data-duration"))}function Io(n){return We(n.getAttribute("data-end"))}function Wo(n){return We(n.getAttribute(Oo))}function Ho(n){return We(n.getAttribute(Po))}function Uo(n){let e=(n??"").trim();if(!e)return null;let t=We(e);if(t!=null)return{kind:"absolute",value:t};let i=e.match(/^([A-Za-z0-9_.:-]+)(?:\\s*([+-])\\s*([0-9]*\\.?[0-9]+))?$/);if(!i)return null;let r=(i[1]??"").trim();if(!r)return null;let o=i[2]??"+",s=i[3]??"0",c=Number.parseFloat(s),u=Number.isFinite(c)?Math.max(0,c):0,a=o==="-"?-u:u;return{kind:"reference",refId:r,offset:a}}function He(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=new WeakMap,r=new WeakMap,o=new Set,s=l=>{let f=document.getElementById(l);return f||(document.querySelector(`[data-composition-id="${CSS.escape(l)}"]`)??null)},c=l=>{let f=r.get(l);if(f!==void 0)return f;let m=null,h=_o(l)??(t?Wo(l):null);if(h!=null&&h>0&&(m=h),m==null||m<=0){let M=Io(l)??(t?Ho(l):null);if(M!=null){let C=a(l,0),A=M-C;Number.isFinite(A)&&A>0&&(m=A)}}if((m==null||m<=0)&&l instanceof HTMLMediaElement){let M=We(l.getAttribute("data-playback-start"))??We(l.getAttribute("data-media-start"))??0;Number.isFinite(l.duration)&&l.duration>M&&(m=l.duration-M)}if(m==null||m<=0){let M=l.getAttribute("data-composition-id");if(M){let C=e[M]??null;if(C&&typeof C.duration=="function")try{let A=Number(C.duration());Number.isFinite(A)&&A>0&&(m=A)}catch{}}}return m!=null&&Number.isFinite(m)&&m>0?(r.set(l,m),m):(r.set(l,null),null)},u=(l,f)=>{if(l.hasAttribute("data-composition-id")){let h=l.parentElement?.closest("[data-composition-id]");return h?a(h,f):0}let m=l.closest("[data-composition-id]");return m?a(m,f):0},a=(l,f)=>{let m=i.get(l);if(m!==void 0)return m??f;if(o.has(l))return f;o.add(l);try{let h=Uo(l.getAttribute("data-start"));if(!h){if(l.hasAttribute("data-composition-id")){let P=l.parentElement;if(P&&(P.hasAttribute("data-composition-src")||P.hasAttribute("data-composition-id"))){let k=a(P,f);return i.set(l,k),k}}return i.set(l,f),f}if(h.kind==="absolute"){let P=Math.max(0,h.value),k=Math.max(0,u(l,f)+P);return i.set(l,k),k}let M=s(h.refId);if(!M)return i.set(l,f),f;let C=a(M,0),A=c(M);if(A==null||A<=0){let P=Math.max(0,C+h.offset);return i.set(l,P),P}let z=Math.max(0,C+A+h.offset);return i.set(l,z),z}finally{o.delete(l)}};return{resolveStartForElement:(l,f=0)=>a(l,Math.max(0,f)),resolveDurationForElement:l=>c(l)}}var qo="data-hf-authored-duration",zo="data-hf-authored-end";function Se(n){if(n==null||n==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}function on(n){return Se(n.getAttribute("data-duration"))??Se(n.getAttribute(qo))}function di(n){return Se(n.getAttribute("data-end"))??Se(n.getAttribute(zo))}function sn(...n){let e=n.filter(t=>Number.isFinite(t??null));return e.length===0?null:Math.max(...e)}var fi={composition:0,video:1,image:2,element:3,audio:4};function jo(n){if(n.length===0)return;let e=new Map;for(let s of n){let c=e.get(s.track)??new Set;c.add(s.kind),e.set(s.track,c)}if(!Array.from(e.values()).some(s=>s.size>1))return;let i=0,r=new Map,o=[...e.keys()].sort((s,c)=>s-c);for(let s of o){let c=e.get(s);if(c.size===1)r.set(`${s}:${[...c][0]}`,i++);else{let u=[...c].sort((a,l)=>(fi[a]??99)-(fi[l]??99));for(let a of u)r.set(`${s}:${a}`,i++)}}for(let s of n){let c=`${s.track}:${s.kind}`,u=r.get(c);u!=null&&(s.track=u)}}function rt(n){let e=String(n??"").trim();if(!e)return null;let t=e.toLowerCase();if(t.startsWith("data:")||t.startsWith("javascript:"))return null;try{return new URL(e,document.baseURI).toString()}catch{return e}}function Go(n){let e=n.getAttribute("src")??n.getAttribute("data-src");if(e)return rt(e);let t=n.getAttribute("data-composition-src");if(t)return rt(t);let i=n.querySelector("img[src], video[src], audio[src], source[src]");return i?rt(i.getAttribute("src")):null}function mi(n){let t=window.__timelines??{},i=He({timelineRegistry:t,includeAuthoredTimingAttrs:!0}),r=R=>{if(!R)return null;let D=t[R]??null;if(!D||typeof D.duration!="function")return null;try{let L=Number(D.duration());return Number.isFinite(L)&&L>0?L:null}catch{return null}},o=R=>{let D=Se(R.getAttribute("data-duration"));if(D!=null&&D>0)return D;let L=Se(R.getAttribute("data-playback-start"))??Se(R.getAttribute("data-media-start"))??0;return Number.isFinite(R.duration)&&R.duration>L?Math.max(0,R.duration-L):null},s=()=>{let R=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(R.length===0)return null;let D=0;for(let L of R){let Q=i.resolveStartForElement(L,0);if(!Number.isFinite(Q))continue;let ne=o(L);ne==null||ne<=0||(D=Math.max(D,Math.max(0,Q)+ne))}return D>0?D:null},c=R=>{let D=R.trim().toLowerCase();return!(!D||D==="main"||D.includes("caption")||D.includes("ambient"))},u=(R,D)=>{let L=[],Q=null,ne=null,_=null,I=R.parentElement;for(;I;){let j=I.getAttribute("data-composition-id");j&&(L.push(j),!_&&I!==D&&(_=j),Q==null&&(Q=i.resolveStartForElement(I,0)),ne==null&&(ne=Se(I.getAttribute("data-duration"))??r(j)??null)),I=I.parentElement}return{parentCompositionId:_,compositionAncestors:L.reverse(),inheritedStart:Q,inheritedDuration:ne}},a=document.querySelector("[data-composition-id]"),l=Array.from(document.querySelectorAll("[data-composition-id]")),f=a?.getAttribute("data-composition-id")??null,m=a?i.resolveStartForElement(a,0):0,h=s(),M=h!=null?Math.max(0,h-Math.max(0,m)):null,C=r(f),A=on(a??document.body),z=sn(...l.filter(R=>R!==a).map(R=>{let D=i.resolveStartForElement(R,0),L=i.resolveDurationForElement(R)??r(R.getAttribute("data-composition-id"))??null;return!Number.isFinite(D)||L==null||L<=0?null:Math.max(0,D)+L})),P=z!=null?Math.max(0,z-Math.max(0,m)):null,k=typeof C=="number"&&Number.isFinite(C)&&C>0?C:null,Y=typeof A=="number"&&Number.isFinite(A)&&A>0?A:null,y=typeof M=="number"&&Number.isFinite(M)&&M>0?M:null,p=typeof P=="number"&&Number.isFinite(P)&&P>0?P:null,S=sn(y,p),F=k!=null&&S!=null&&k>S+1,b=Y??(F?S:sn(k,y,p)),N=b!=null?Math.min(b,n.maxTimelineDurationSeconds):null,W=(N!=null?m+N:null)??(typeof h=="number"&&Number.isFinite(h)&&h>0?h:null),H=(R,D)=>!Number.isFinite(D)||D<=0?0:W==null||!Number.isFinite(W)?D:!Number.isFinite(R)||R>=W?0:Math.max(0,Math.min(D,W-R)),X=[],T=[],Z=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),ee=0;for(let R=0;R<Z.length;R+=1){let D=Z[R];if(D===a||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(D.tagName))continue;let L=u(D,a),Q=i.resolveStartForElement(D,L.inheritedStart??0),ne=D.getAttribute("data-composition-id"),_=on(D);if((_==null||_<=0)&&ne&&ne!==f&&(_=r(ne)),(_==null||_<=0)&&D instanceof HTMLMediaElement){let ce=Se(D.getAttribute("data-playback-start"))??Se(D.getAttribute("data-media-start"))??0;Number.isFinite(D.duration)&&D.duration>0&&(_=Math.max(0,D.duration-ce))}if(_==null||_<=0){let ce=L.inheritedDuration;if(ce!=null&&ce>0){let Fe=(L.inheritedStart??0)+ce;_=Math.max(0,Fe-Q)}}if(_==null||_<=0||(_=H(Q,_),_<=0))continue;let I=Q+_;ee=Math.max(ee,I);let j=D.tagName.toLowerCase(),Ne=ne&&ne!==f?"composition":j==="video"?"video":j==="audio"?"audio":j==="img"?"image":"element";X.push({id:D.id||ne||`__node__index_${R}`,label:D.getAttribute("data-timeline-label")??D.getAttribute("data-label")??D.getAttribute("aria-label")??ne??D.id??D.className?.split(" ")[0]??Ne,start:Q,duration:_,track:Number.parseInt(D.getAttribute("data-track-index")??D.getAttribute("data-track")??String(R),10)||0,kind:Ne,tagName:j,compositionId:D.getAttribute("data-composition-id"),compositionAncestors:L.compositionAncestors,parentCompositionId:L.parentCompositionId,nodePath:null,compositionSrc:rt(D.getAttribute("data-composition-src")),assetUrl:Go(D),timelineRole:D.getAttribute("data-timeline-role"),timelineLabel:D.getAttribute("data-timeline-label"),timelineGroup:D.getAttribute("data-timeline-group"),timelinePriority:Se(D.getAttribute("data-timeline-priority"))})}let U=new Set(X.map(R=>R.id)),G=a?.getAttribute("data-composition-id")??null,B=G?t[G]??null:null;if(B&&a){let R=B;if(typeof R.getChildren=="function")try{let D=R.getChildren(!0,!0,!1)??[],L=new Map;for(let _ of a.children){let I=_;if(!I.id)continue;let j=I.tagName.toLowerCase();j==="script"||j==="style"||j==="link"||L.set(I,{id:I.id,start:1/0,end:-1/0})}let Q=_=>{let I=_;for(;I;){if(L.has(I))return I;if(I===a)return null;I=I.parentElement}return null};for(let _ of D){if(typeof _.targets!="function"||typeof _.startTime!="function"||typeof _.duration!="function")continue;let I=_.startTime(),j=_.parent;for(;j&&typeof j.startTime=="function";)I+=j.startTime(),j=j.parent;let Ne=I+_.duration();if(!(!Number.isFinite(I)||!Number.isFinite(Ne)))for(let ce of _.targets()){if(!(ce instanceof Element))continue;let ze=Q(ce);if(!ze)continue;let Fe=L.get(ze);Fe&&(Fe.start=Math.min(Fe.start,I),Fe.end=Math.max(Fe.end,Ne))}}let ne=X.length>0?Math.max(...X.map(_=>_.track))+1:0;for(let[_,I]of L){if(I.start===1/0||I.end===-1/0)continue;let j=_;if(U.has(j.id))continue;let Ne=Math.max(0,I.end-I.start);if(Ne<=0)continue;let ce=H(I.start,Ne);ce<=0||(ee=Math.max(ee,I.start+ce),X.push({id:j.id,label:j.getAttribute("data-timeline-label")??j.getAttribute("data-label")??j.getAttribute("aria-label")??j.id,start:I.start,duration:ce,track:Number.parseInt(j.getAttribute("data-track-index")??j.getAttribute("data-track")??"",10)||ne,kind:"element",tagName:j.tagName.toLowerCase(),compositionId:j.getAttribute("data-composition-id"),compositionAncestors:G?[G]:[],parentCompositionId:G,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:j.getAttribute("data-timeline-role"),timelineLabel:j.getAttribute("data-timeline-label"),timelineGroup:j.getAttribute("data-timeline-group"),timelinePriority:Se(j.getAttribute("data-timeline-priority"))}),U.add(j.id))}}catch{}}if(a&&N!=null&&N>0){let R=X.length>0?Math.max(...X.map(D=>D.track))+1:0;for(let D of a.children){let L=D;if(!L.id||U.has(L.id))continue;let Q=L.getAttribute("data-timeline-role");if(Q!=="overlay"&&Q!=="persistent-overlay")continue;let ne=L.tagName.toLowerCase();if(ne==="script"||ne==="style"||ne==="link"||ne==="meta"||window.getComputedStyle(L).display==="none")continue;let I=H(0,N);I<=0||(ee=Math.max(ee,I),X.push({id:L.id,label:L.getAttribute("data-timeline-label")??L.getAttribute("data-label")??L.getAttribute("aria-label")??L.id,start:0,duration:I,track:Number.parseInt(L.getAttribute("data-track-index")??L.getAttribute("data-track")??"",10)||R,kind:"element",tagName:ne,compositionId:L.getAttribute("data-composition-id"),compositionAncestors:G?[G]:[],parentCompositionId:G,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:Q,timelineLabel:L.getAttribute("data-timeline-label"),timelineGroup:L.getAttribute("data-timeline-group"),timelinePriority:Se(L.getAttribute("data-timeline-priority"))}),U.add(L.id))}}jo(X);for(let R of l){if(R===a)continue;let D=R.getAttribute("data-composition-id");if(!D||!c(D))continue;let L=i.resolveStartForElement(R,0),Q=on(R);if((Q==null||Q<=0)&&di(R)!=null){let j=di(R);Q=Math.max(0,j-L)}let ne=r(D),_=Q&&Q>0?Q:ne;if(_==null||_<=0)continue;let I=H(L,_);I<=0||T.push({id:D,label:R.getAttribute("data-label")??D,start:L,duration:I,thumbnailUrl:rt(R.getAttribute("data-thumbnail-url")),avatarName:null})}let J=Math.max(1,Math.min(Math.max(ee||1,N??0),n.maxTimelineDurationSeconds));return{source:"hf-preview",type:"timeline",durationInFrames:F&&Y==null?Number.POSITIVE_INFINITY:Math.max(1,Math.round(J*Math.max(1,n.canonicalFps))),clips:X,scenes:T,compositionWidth:Se(a?.getAttribute("data-width"))??1920,compositionHeight:Se(a?.getAttribute("data-height"))??1080}}var re=Lo(Ir(),1),Wr=re.default,Tu=re.default.stringify,Ru=re.default.fromJSON,vu=re.default.plugin,Bu=re.default.parse,Ou=re.default.list,Pu=re.default.document,_u=re.default.comment,Iu=re.default.atRule,Wu=re.default.rule,Hu=re.default.decl,Uu=re.default.root,qu=re.default.CssSyntaxError,zu=re.default.Declaration,ju=re.default.Container,Gu=re.default.Processor,$u=re.default.Document,Vu=re.default.Comment,Ku=re.default.Warning,Ju=re.default.AtRule,Qu=re.default.Result,Yu=re.default.Input,Zu=re.default.Rule,Xu=re.default.Root,ec=re.default.Node;function Rn(n){return n.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function dl(n){return n.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function fl(n,e,t){let i=ml(n,e,t),r=i.trim();if(!r||/^(html|body|:root|\\*)$/i.test(r))return n;if(new RegExp(`data-composition-id\\\\s*=\\\\s*(["\'])${Rn(t)}\\\\1`).test(r))return i;let s=i.match(/^\\s*/)?.[0]??"",c=i.match(/\\s*$/)?.[0]??"";return`${s}${e} ${r}${c}`}function ml(n,e,t){let i=Rn(t),r=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${i}"|\'${i}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return n.replace(new RegExp(`${r}(?:${o})+`,"g"),e).replace(new RegExp(`(?:${o})+${r}`,"g"),e)}var pl=new Set(["keyframes","-webkit-keyframes","font-face"]);function hl(n){return n?.type==="atrule"}function xl(n){let e=n.parent;for(;e;){if(hl(e)&&pl.has(e.name.toLowerCase()))return!0;e=e.parent}return!1}function vn(n,e){let t=e.trim();if(!n||!t)return n;let i=`[data-composition-id="${dl(t)}"]`,r=Wr.parse(n);return r.walkRules(o=>{xl(o)||(o.selectors=o.selectors.map(s=>fl(s,i,t)))}),r.toResult({map:!1}).css}function Hr(n,e,t="[HyperFrames] composition script error:"){let i=JSON.stringify(e),r=JSON.stringify(t),o=Rn(e),s=JSON.stringify(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${o}"|\'${o}\')\\s*\\]`),c=JSON.stringify(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`);return`(function(){\n var __hfCompId = ${i};\n var __hfErrorLabel = ${r};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = __hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "";\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${s};\n var __hfTimingSelectorPattern = ${c};\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n return selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\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 __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") {\n return function(id) {\n var found = target.getElementById(id);\n return found && __hfContains(found) ? found : null;\n };\n }\n var value = Reflect.get(target, prop, receiver);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\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 (_err) {}\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.slice.call(root.querySelectorAll(selector));\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsReceiver);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, receiver);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap) {\n${n}\n }).call(window, __hfScopedDocument, __hfScopedGsap);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})()`}var gl=8e3,Sl=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,yl=n=>new Promise(e=>{let t=!1,i=Date.now(),r=null,o=s=>{t||(t=!0,r!=null&&window.clearTimeout(r),e({status:s,elapsedMs:Math.max(0,Date.now()-i)}))};n.addEventListener("load",()=>o("load"),{once:!0}),n.addEventListener("error",()=>o("error"),{once:!0}),r=window.setTimeout(()=>o("timeout"),gl)});function Bn(n){for(;n.firstChild;)n.removeChild(n.firstChild);n.textContent=""}function Ur(n,e){let t=n.trim();if(!t)return n;try{return Sl.test(t)?new URL(t,document.baseURI).toString():e?new URL(t,e).toString():new URL(t,document.baseURI).toString()}catch{return n}}async function On(n){let e=null;n.hostCompositionId&&(e=Array.from(n.sourceNode.querySelectorAll("[data-composition-id]")).find(l=>l.getAttribute("data-composition-id")===n.hostCompositionId)??null);let t=e??n.sourceNode,i=e?.getAttribute("data-composition-id")?.trim()||n.hostCompositionId||null;if(n.headStyles)for(let a of n.headStyles){let l=a.cloneNode(!0);l instanceof HTMLStyleElement&&(i&&(l.textContent=vn(l.textContent||"",i)),document.head.appendChild(l),n.injectedStyles.push(l))}let r=Array.from(t.querySelectorAll("style"));for(let a of r){let l=a.cloneNode(!0);l instanceof HTMLStyleElement&&(i&&(l.textContent=vn(l.textContent||"",i)),document.head.appendChild(l),n.injectedStyles.push(l))}let o=[];if(n.headScripts)for(let a of n.headScripts){let l=a.getAttribute("type")?.trim()??"",f=a.getAttribute("src")?.trim()??"";if(f){let m=Ur(f,n.compositionUrl);o.push({kind:"external",src:m,type:l})}else{let m=a.textContent?.trim()??"";m&&o.push({kind:"inline",content:m,type:l,scopeCompositionId:i})}}let s=Array.from(t.querySelectorAll("script")),c=[...o];for(let a of s){let l=a.getAttribute("type")?.trim()??"",f=a.getAttribute("src")?.trim()??"";if(f){let m=Ur(f,n.compositionUrl);c.push({kind:"external",src:m,type:l})}else{let m=a.textContent?.trim()??"";m&&c.push({kind:"inline",content:m,type:l,scopeCompositionId:i})}a.parentNode?.removeChild(a)}let u=Array.from(t.querySelectorAll("style"));for(let a of u)a.parentNode?.removeChild(a);if(e){let a=document.importNode(e,!0),l=e.getAttribute("data-width"),f=e.getAttribute("data-height"),m=n.parseDimensionPx(l),h=n.parseDimensionPx(f);for(l&&n.host.setAttribute("data-width",l),f&&n.host.setAttribute("data-height",f),m&&n.host instanceof HTMLElement&&(n.host.style.width=m),h&&n.host instanceof HTMLElement&&(n.host.style.height=h);a.firstChild;)n.host.appendChild(a.firstChild)}else n.hasTemplate?n.host.appendChild(document.importNode(t,!0)):n.host.innerHTML=n.fallbackBodyInnerHtml;for(let a of c){let l=document.createElement("script");if(a.type&&(l.type=a.type),l.async=!1,a.kind==="external"?l.src=a.src:a.type.toLowerCase()==="module"?l.textContent=a.content:a.scopeCompositionId?l.textContent=Hr(a.content,a.scopeCompositionId):l.textContent=`(function(){${a.content}})();`,document.body.appendChild(l),n.injectedScripts.push(l),a.kind==="external"){let f=await yl(l);f.status!=="load"&&n.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:n.hostCompositionId,hostCompositionSrc:n.hostCompositionSrc,resolvedScriptSrc:a.src,loadStatus:f.status,elapsedMs:f.elapsedMs}})}}}async function qr(n){let e=Array.from(document.querySelectorAll("[data-composition-id]:not([data-composition-src])")).filter(t=>{if(t.children.length>0)return!1;let i=t.getAttribute("data-composition-id");return i?!!document.querySelector(`template#${CSS.escape(i)}-template`):!1});if(e.length!==0)for(let t of e){let i=t.getAttribute("data-composition-id"),r=document.querySelector(`template#${CSS.escape(i)}-template`);Bn(t),await On({host:t,hostCompositionId:i,hostCompositionSrc:`template#${i}-template`,sourceNode:r.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:n.injectedStyles,injectedScripts:n.injectedScripts,parseDimensionPx:n.parseDimensionPx,onDiagnostic:n.onDiagnostic})}}async function zr(n){let e=Array.from(document.querySelectorAll("[data-composition-src]"));e.length!==0&&await Promise.all(e.map(async t=>{let i=t.getAttribute("data-composition-src");if(!i)return;let r=null;try{r=new URL(i,document.baseURI)}catch{r=null}Bn(t);try{let o=t.getAttribute("data-composition-id"),s=o!=null?document.querySelector(`template#${CSS.escape(o)}-template`):null;if(s){await On({host:t,hostCompositionId:o,hostCompositionSrc:i,sourceNode:s.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:r,injectedStyles:n.injectedStyles,injectedScripts:n.injectedScripts,parseDimensionPx:n.parseDimensionPx,onDiagnostic:n.onDiagnostic});return}let c=await fetch(i);if(!c.ok)throw new Error(`HTTP ${c.status}`);let u=await c.text(),l=new DOMParser().parseFromString(u,"text/html"),f=(o?l.querySelector(`template#${CSS.escape(o)}-template`):null)??l.querySelector("template"),m=f?f.content:l.body,h=f?void 0:Array.from(l.head.querySelectorAll("style")),M=f?void 0:Array.from(l.head.querySelectorAll("script"));await On({host:t,hostCompositionId:o,hostCompositionSrc:i,sourceNode:m,hasTemplate:!!f,fallbackBodyInnerHtml:l.body.innerHTML,compositionUrl:r,injectedStyles:n.injectedStyles,injectedScripts:n.injectedScripts,parseDimensionPx:n.parseDimensionPx,headStyles:h,headScripts:M,onDiagnostic:n.onDiagnostic})}catch(o){n.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:t.getAttribute("data-composition-id"),hostCompositionSrc:i,errorMessage:o instanceof Error?o.message:"unknown_error"}}),Bn(t)}}))}function Pn(){let n=window.gsap;n&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(e=>e.ok?e.json():null).then(e=>{if(!e||!Array.isArray(e)||e.length===0)return;let t=[],i=document.querySelectorAll(".caption-group");for(let r of i){let o=r.querySelectorAll(":scope > span");for(let s of o)t.push(s)}for(let r of e){let o=null;if(r.wordId&&(o=document.getElementById(r.wordId)),!o&&r.wordIndex!==void 0&&(o=t[r.wordIndex]??null),!o||!(o instanceof HTMLElement))continue;let s={},c={};if(r.x!==void 0&&(s.x=r.x),r.y!==void 0&&(s.y=r.y),r.scale!==void 0&&(s.scale=r.scale),r.rotation!==void 0&&(s.rotation=r.rotation),r.opacity!==void 0&&(c.opacity=r.opacity),r.fontSize!==void 0&&(c.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(c.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(c.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let a=n.getTweensOf(o).filter(f=>f.vars.color!==void 0).sort((f,m)=>f.startTime()-m.startTime()),l=a.length>0?String(a[0].vars.color):"";for(let f of a)String(f.vars.color)===l?r.dimColor&&(f.vars.color=r.dimColor):r.activeColor&&(f.vars.color=r.activeColor);r.dimColor&&n.set(o,{color:r.dimColor})}if(Object.keys(c).length>0&&n.set(o,c),Object.keys(s).length>0){let u=document.createElement("span");u.style.display="inline-block",u.dataset.captionWrapper="true",o.parentNode?.insertBefore(u,o),u.appendChild(o),n.set(u,s)}}}).catch(()=>{})}var jr="data-hf-authored-duration",Gr="data-hf-authored-end";function $r(){let n=ci(),e=window,t=null,i=null,r=[],o=new Set,s=null;if(typeof e.__hfRuntimeTeardown=="function")try{e.__hfRuntimeTeardown()}catch{}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"),window.__timelines=window.__timelines||{};let c=d=>{r.push(d)},u=(d,g,x)=>{let w=x??`${d}:${JSON.stringify(g)}`;o.has(w)||(o.add(w),ge({source:"hf-preview",type:"diagnostic",code:d,details:g}))},a=d=>{let g={scale:1,focusX:960,focusY:540},x=[],w=[],E={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>x,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>w,getRenderState:()=>({...E,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},l=1/60,f=.75,m=.75,h=.35,M=900,C=3,A=2,z=.05,P=100,k=240,Y=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},y=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},p=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},S=()=>{let d=document.querySelector(\'[data-composition-id][data-root="true"]\');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.length===0?null:g.find(x=>!x.parentElement?.closest("[data-composition-id]"))??g[0]??null},F=()=>{let d=S();if(!d)return;let g=p(d.getAttribute("data-width")),x=p(d.getAttribute("data-height"));g&&(d.style.width=g),x&&(d.style.height=x),g&&d.style.setProperty("--comp-width",g),x&&d.style.setProperty("--comp-height",x)},b=()=>{let d=S(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(x=>x.hasAttribute("data-duration")||x.hasAttribute("data-end"));for(let x of g){if(d&&x===d)continue;let w=x.getAttribute("data-duration"),E=x.getAttribute("data-end");w!=null&&!x.hasAttribute(jr)&&x.setAttribute(jr,w),E!=null&&!x.hasAttribute(Gr)&&x.setAttribute(Gr,E),x.removeAttribute("data-duration"),x.removeAttribute("data-end")}},N=()=>{let d=S();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=p(d.getAttribute("data-width")),x=p(d.getAttribute("data-height"));g&&(d.style.width=g),x&&(d.style.height=x);let w=Array.from(d.children);for(let E of w){let O=E.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta"||!E.hasAttribute("data-start"))continue;let le=(E.style.top==="0px"||E.style.top==="0")&&(E.style.left==="0px"||E.style.left==="0")&&E.style.width==="100%"&&E.style.height==="100%",ae=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(E.style.transform);if(le&&ae&&!E.hasAttribute("data-width")&&!E.hasAttribute("data-height")){let ye=E.style.top,ue=E.style.left,tt=E.style.width,ie=E.style.height;E.style.top="",E.style.left="",E.style.width="",E.style.height="";let $=window.getComputedStyle(E);$.top!=="auto"||$.bottom!=="auto"||$.left!=="auto"||$.right!=="auto"||$.width!=="0px"||$.height!=="0px"||(E.style.top=ye,E.style.left=ue,E.style.width=tt,E.style.height=ie)}let V=window.getComputedStyle(E),we=V.position;if(we!=="absolute"&&we!=="fixed"&&(E.style.position="absolute"),!!E.style.top||!!E.style.bottom||V.top!=="auto"||V.bottom!=="auto"||(E.style.top="0"),!!E.style.left||!!E.style.right||V.left!=="auto"||V.right!=="auto"||(E.style.left="0"),O!=="audio"){let ye=p(E.getAttribute("data-width")),ue=p(E.getAttribute("data-height")),tt=V.width!=="0px"&&V.width!=="auto",ie=V.height!=="0px"&&V.height!=="auto";ye?!E.style.width&&!tt&&(E.style.width=ye):!E.style.width&&V.width==="0px"&&(E.style.width="100%"),ue?!E.style.height&&!ie&&(E.style.height=ue):!E.style.height&&V.height==="0px"&&(E.style.height="100%")}}},v=(d,g=0,x)=>He({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:x?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),W=(d,g)=>He({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),H=!!document.querySelector("[data-composition-src]"),X=!1;{let d=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let g of d){let x=g.getAttribute("data-composition-id");if(x&&g.children.length===0&&document.querySelector(`template#${CSS.escape(x)}-template`)){X=!0;break}}}let T=!H&&!X,Z=d=>{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},ee=d=>typeof d=="number"&&Number.isFinite(d)&&d>l,U=d=>{let g=Number(d.getAttribute("data-duration"));if(Number.isFinite(g)&&g>0)return g;let x=Number(d.getAttribute("data-playback-start")??d.getAttribute("data-media-start")??"0"),w=Number.isFinite(x)?Math.max(0,x):0;return Number.isFinite(d.duration)&&d.duration>w?Math.max(0,d.duration-w):null},G=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let x of d){let w=v(x,0);if(!Number.isFinite(w))continue;let E=U(x);E==null||E<=l||(g=Math.max(g,Math.max(0,w)+E))}return g>l?g:null},B=()=>{let d=S();if(!d)return null;let g=window.__timelines??{},x=He({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),w=0,E=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let O of E){if(!(O instanceof Element)||O.parentElement?.closest("[data-composition-id]")!==d)continue;let ae=x.resolveStartForElement(O,0),V=x.resolveDurationForElement(O);!Number.isFinite(ae)||V==null||V<=0||(w=Math.max(w,Math.max(0,ae)+V))}return w>l?w:null},J=()=>{let d=G();return typeof d!="number"||!Number.isFinite(d)||d<=l?null:d},Ee=d=>ee(d)?Math.max(l,d*f):l,xe=(d,g=0)=>{let x=Z(d),w=J(),E=B(),O=Math.max(w??0,E??0),le=Number.isFinite(g)&&g>l?g:0,ae=0;ee(x)?ae=Math.max(x,O,le):ee(O)?ae=Math.max(O,le):ae=le;let V=Math.max(1,Number(n.maxTimelineDurationSeconds)||1800);return ae>0?Math.max(0,Math.min(ae,V)):0},R=()=>{let d=window.__timelines??{},g=He({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),x=J(),w=B(),E=Math.max(x??0,w??0)||null,O=Ee(E),le=ie=>{let $=document.querySelector(`[data-composition-id="${CSS.escape(ie)}"]`);return $?g.resolveStartForElement($,0):0},ae=ie=>{let $=window.gsap;if(!$||typeof $.timeline!="function")return null;let oe=$.timeline({paused:!0});for(let pe of ie)oe.add(pe.timeline,le(pe.compositionId));return oe},V=(ie,$)=>{if(!ee(ie))return null;let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let pe=oe.timeline({paused:!0});if($)try{pe.add($,0)}catch{}let he=pe;if(typeof he.to=="function")try{he.to({},{duration:ie})}catch{}return pe},we=(ie,$)=>{let oe=ie;if(typeof oe.getChildren!="function")return[];try{let pe=oe.getChildren(!0,!0,!0)??[];if(!Array.isArray(pe))return[];let he=[];for(let se of $)if(!pe.some(Ie=>Ie===se.timeline))try{let Ie=le(se.compositionId);ie.add(se.timeline,Ie),he.push(se.compositionId)}catch{}return he}catch{return[]}},Re=S(),de=Re?.getAttribute("data-composition-id")??null;if(!de)return{timeline:null};let me=d[de]??null,ue=(()=>{if(!Re)return[];let ie=new Set,$=Array.from(Re.querySelectorAll("[data-composition-id]")),oe=[];for(let pe of $){let he=pe.getAttribute("data-composition-id");if(!he||he===de||ie.has(he))continue;ie.add(he);let se=d[he]??null;if(!se||typeof se.play!="function"||typeof se.pause!="function")continue;let Ae=Z(se);oe.push({compositionId:he,timeline:se,durationSeconds:Ae??0})}return oe})(),tt=ie=>{for(let $ of ie){let oe=$.timeline;if(typeof oe.paused=="function")try{oe.paused(!1)}catch{}}};if(ue.length>0&&tt(ue),me){let ie=ue.length>0?we(me,ue):[];if((ue.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+de+"\'])"))&&(L=!0),ie.length>0)try{let se=me.time();me.seek(se,!1)}catch{}let $=Z(me);if(!ee($)&&ue.length>0){let se=ue.map(bo=>bo.compositionId),Ae=ae(ue),Ie=Z(Ae);if(Ae&&ee(Ie))return{timeline:Ae,selectedTimelineIds:se,selectedDurationSeconds:Ie,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:de,rootDurationSeconds:$,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:O,selectedDurationSeconds:Ie,mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:se,autoNestedChildren:ie}}};let Xt=V(E??0,me),en=Z(Xt);if(Xt&&ee(en))return{timeline:Xt,selectedTimelineIds:[de],selectedDurationSeconds:en,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:de,rootDurationSeconds:$,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:en,selectedTimelineIds:[de],autoNestedChildren:ie}}}}if(!ee($)&&ue.length===0){let se=V(E??0,me),Ae=Z(se);if(se&&ee(Ae))return{timeline:se,selectedTimelineIds:[de],selectedDurationSeconds:Ae,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:de,rootDurationSeconds:$,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Ae,selectedTimelineIds:[de]}}}}let oe=Re?.getAttribute("data-duration"),pe=oe?parseFloat(oe):null,he=Math.max(ee(pe)?pe:0,w??0);if(he>0&&ee(he)&&ee($)&&he>=$+.5){let se=me;if(typeof se.to=="function")try{se.to({},{duration:0},he)}catch{}let Ae=Z(me);if(ee(Ae))return{timeline:me,selectedTimelineIds:[de],selectedDurationSeconds:Ae,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:de,rootDurationSeconds:$,rootDeclaredDur:pe,authoredCompositionDurationFloorSeconds:w,newDur:Ae}}}}return{timeline:me,selectedTimelineIds:[de],selectedDurationSeconds:$,mediaDurationFloorSeconds:x,diagnostics:ie.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:de,selectedDurationSeconds:$,autoNestedChildren:ie}}:void 0}}if(ue.length>0){let ie=ue.map(pe=>pe.compositionId),$=ae(ue),oe=Z($);if($)return{timeline:$,selectedTimelineIds:ie,selectedDurationSeconds:oe,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:de,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:O,selectedDurationSeconds:oe,mediaDurationFloorSeconds:x,selectedTimelineIds:ie}}}}return{timeline:null}},D=()=>{let d=n.capturedTimeline;if(!d||typeof d.time!="function")return;let g=Number(d.time());Number.isFinite(g)&&(n.currentTime=Math.max(0,g))},L=!1,Q=()=>{if(!T)return!1;let d=n.capturedTimeline,g=Z(d),x=ee(g);if(d&&x&&L)return!1;let w=R();return w.timeline?d&&d===w.timeline?(typeof d.timeScale=="function"&&d.timeScale(n.playbackRate),!1):(n.capturedTimeline=w.timeline,typeof n.capturedTimeline.timeScale=="function"&&n.capturedTimeline.timeScale(n.playbackRate),w.diagnostics&&ge({source:"hf-preview",type:"diagnostic",code:w.diagnostics.code,details:w.diagnostics.details}),ge({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:w.selectedTimelineIds??[],selectedDurationSeconds:w.selectedDurationSeconds??null,mediaDurationFloorSeconds:w.mediaDurationFloorSeconds??null}}),!0):!1},ne=()=>{let d=S();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),x=Number(d.getAttribute("data-width")),w=Number(d.getAttribute("data-height")),E=window.getComputedStyle(d),O=Number.isFinite(x)&&x>0&&Number.isFinite(w)&&w>0,le=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!O||!le||u("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:x,declaredHeight:w,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:E.display,visibility:E.visibility,overflow:E.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},_=()=>{n.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,ne()}))},I=()=>{t=d=>{let g=Y(d.error??d.message).slice(0,k);if(!g)return;let x=y(g);ge({source:"hf-preview",type:"diagnostic",code:x.code,details:{category:x.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},i=d=>{let g=Y(d.reason).slice(0,k);if(!g)return;let x=y(g);ge({source:"hf-preview",type:"diagnostic",code:`${x.code}_unhandled_rejection`,details:{category:`${x.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",t),window.addEventListener("unhandledrejection",i)},j=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let x of d){let w=()=>{if(!(x instanceof Element))return;let E=x.tagName.toLowerCase(),O=x.getAttribute("src")??x.getAttribute("href")??x.getAttribute("poster")??null,le=E==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";u(le,{tagName:E,assetUrl:O,currentSrc:(x instanceof HTMLImageElement||x instanceof HTMLMediaElement)&&x.currentSrc||null,readyState:x instanceof HTMLMediaElement?x.readyState:null,networkState:x instanceof HTMLMediaElement?x.networkState:null},`${le}:${E}:${O??"unknown"}`)};x.addEventListener("error",w),c(()=>{x.removeEventListener("error",w)})}let g=document.fonts;g&&g.ready.then(()=>{if(n.tornDown)return;let x=Array.from(g).filter(w=>w.status==="error").map(w=>w.family).filter(w=>!!w).slice(0,10);x.length!==0&&u("runtime_font_load_issue",{failedFamilies:x,totalFaces:Array.from(g).length},`runtime-font-load-issue:${x.join("|")}`)}).catch(()=>{})},Ne=(d,g)=>{if(!d.timeline)return!1;let x=n.capturedTimeline;if(x&&x===d.timeline)return!1;let w=Math.max(0,n.currentTime||0),E=n.isPlaying;n.capturedTimeline=d.timeline,typeof n.capturedTimeline.timeScale=="function"&&n.capturedTimeline.timeScale(n.playbackRate);try{n.capturedTimeline.pause(),n.capturedTimeline.seek(w,!1),E&&n.capturedTimeline.play()}catch{}return ge({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:w,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},ce=null,ze=!1,Fe=new Set,wt=()=>{n.tornDown||(ce!=null&&window.clearTimeout(ce),ce=window.setTimeout(()=>{if(n.tornDown)return;ce=null;let d=R();if(!d.timeline||!ee(d.mediaDurationFloorSeconds??null))return;if(!n.capturedTimeline){Q()&&(je(),Te(!0));return}if(ze)return;let x=Z(n.capturedTimeline),w=d.selectedDurationSeconds??Z(d.timeline);ee(w)&&(!ee(x)||w>=x+z)&&Ne(d,"manual")&&(ze=!0,ge({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:x??null,selectedDurationSeconds:w??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),je(),Te(!0))},P))},Ao=()=>{for(let d of Fe)d.removeEventListener("loadedmetadata",wt),d.removeEventListener("durationchange",wt);Fe.clear()},Jt=()=>{if(n.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d)Fe.has(g)||(Fe.add(g),g.addEventListener("loadedmetadata",wt),g.addEventListener("durationchange",wt),g.preload!=="auto"&&(g.preload="auto"),g.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&g.load())},Gn=()=>{let d=E=>{let O=E.closest("[data-composition-id]"),le=O?v(O,0):null,ae=O?W(O,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:O,inheritedStart:le,inheritedDuration:ae}},g=oi({shouldIncludeElement:E=>E.hasAttribute("data-start")||!!d(E).compositionRoot,resolveStartSeconds:E=>{let O=d(E);return v(E,O.inheritedStart??0)},resolveDurationSeconds:E=>{let O=d(E),le=v(E,O.inheritedStart??0),ae=Number.parseFloat(E.dataset.playbackStart??E.dataset.mediaStart??"0")||0,V=O.inheritedStart!=null&&O.inheritedDuration!=null&&O.inheritedDuration>0?Math.max(0,O.inheritedStart+O.inheritedDuration-le):null,we=Number.isFinite(E.duration)&&E.duration>ae?Math.max(0,E.duration-ae):null;return we!=null&&V!=null?Math.min(we,V):we??V}});si({clips:g.mediaClips,timeSeconds:n.currentTime,playing:n.isPlaying,playbackRate:n.playbackRate,outputMuted:n.mediaOutputMuted,userMuted:n.bridgeMuted,onAutoplayBlocked:()=>{n.mediaAutoplayBlockedPosted||(n.mediaAutoplayBlockedPosted=!0,ge({source:"hf-preview",type:"media-autoplay-blocked"}))}});let x=document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null,w=Array.from(document.querySelectorAll("[data-start]"));for(let E of w){if(!(E instanceof HTMLElement))continue;let O=E.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta")continue;if(!E.getAttribute("data-composition-id")){let ye=E.closest("[data-composition-id]")?.getAttribute("data-composition-id")??null;if(ye&&ye!==x)continue}let ae=v(E,0),V=W(E),we=E.getAttribute("data-composition-id");if(we){let me=(window.__timelines??{})[we],ye=null;if(me&&typeof me.duration=="function"){let ue=Number(me.duration());Number.isFinite(ue)&&ue>0&&(ye=ue)}V!=null&&V>0&&ye!=null?V=Math.min(V,ye):(V==null||V<=0)&&ye!=null&&(V=ye)}let Re=V!=null&&V>0?ae+V:Number.POSITIVE_INFINITY,de=n.currentTime>=ae&&(Number.isFinite(Re)?n.currentTime<Re:!0);E.style.visibility=de?"visible":"hidden"}},Te=d=>{D();let g=Math.max(0,Math.round((n.currentTime||0)*n.canonicalFps)),x=Date.now();(d||g!==n.bridgeLastPostedFrame||n.isPlaying!==n.bridgeLastPostedPlaying||n.bridgeMuted!==n.bridgeLastPostedMuted||x-n.bridgeLastPostedAt>=n.bridgeMaxPostIntervalMs)&&(n.bridgeLastPostedFrame=g,n.bridgeLastPostedPlaying=n.isPlaying,n.bridgeLastPostedMuted=n.bridgeMuted,n.bridgeLastPostedAt=x,ge({source:"hf-preview",type:"state",frame:g,isPlaying:n.isPlaying,muted:n.bridgeMuted,playbackRate:n.playbackRate}))},je=()=>{b(),F(),N();let d=S();if(d){let x=p(d.getAttribute("data-width")),w=p(d.getAttribute("data-height")),E=x?parseInt(x,10):0,O=w?parseInt(w,10):0;E>0&&O>0&&ge({source:"hf-preview",type:"stage-size",width:E,height:O})}Q();let g=mi({canonicalFps:n.canonicalFps,maxTimelineDurationSeconds:n.maxTimelineDurationSeconds});window.__clipManifest=g,ge(g),_()},et=(d,g=0)=>{for(let x of n.deterministicAdapters){try{d==="discover"&&x.discover(),d==="pause"&&x.pause(),d==="play"&&x.play&&x.play()}catch{}if(d==="discover")try{x.seek({time:g})}catch{}}};if(T)Pn();else{let d={injectedStyles:n.injectedCompStyles,injectedScripts:n.injectedCompScripts,parseDimensionPx:p,onDiagnostic:({code:g,details:x})=>{ge({source:"hf-preview",type:"diagnostic",code:g,details:x})}};zr(d).then(()=>qr(d)).finally(()=>{T=!0,et("discover",n.currentTime),Jt(),j(),Pn(),je(),Te(!0)})}let Ct=li({postMessage:d=>ge(d)});Ct.installPickerApi();let $n=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?n.playbackRate=1:n.playbackRate=Math.max(.1,Math.min(5,g)),n.capturedTimeline&&typeof n.capturedTimeline.timeScale=="function"&&n.capturedTimeline.timeScale(n.playbackRate);let x=document.querySelectorAll("video, audio");for(let w of x)if(w instanceof HTMLMediaElement)try{w.playbackRate=n.playbackRate}catch{}},fe=ui({getTimeline:()=>n.capturedTimeline,setTimeline:d=>{n.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>n.isPlaying,setIsPlaying:d=>{n.isPlaying=d},getPlaybackRate:()=>n.playbackRate,setPlaybackRate:$n,getCanonicalFps:()=>n.canonicalFps,onSyncMedia:(d,g)=>{n.currentTime=Math.max(0,Number(d)||0),n.isPlaying=g,Gn()},onStatePost:Te,onDeterministicSeek:d=>{for(let g of n.deterministicAdapters)try{g.seek({time:Number(d)||0})}catch{}},onDeterministicPause:()=>et("pause"),onDeterministicPlay:()=>et("play"),onRenderFrameSeek:()=>{},onShowNativeVideos:()=>{},getSafeDuration:()=>xe(n.capturedTimeline,0)});window.__player=a(fe),window.__playerReady=!0,window.__renderReady=!0,Yn(ge),nt("composition_loaded",{duration:fe.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),n.controlBridgeHandler=Qn({onPlay:()=>{fe.play(),nt("composition_played",{time:fe.getTime()})},onPause:()=>{fe.pause(),nt("composition_paused",{time:fe.getTime()})},onSeek:(d,g)=>{let x=Math.max(0,d)/n.canonicalFps;fe.seek(x),nt("composition_seeked",{time:x})},onSetMuted:d=>{n.bridgeMuted=d;let g=d||n.mediaOutputMuted,x=document.querySelectorAll("video, audio");for(let w of x)w instanceof HTMLMediaElement&&(w.muted=g)},onSetMediaOutputMuted:d=>{n.mediaOutputMuted=d;let g=d||n.bridgeMuted,x=document.querySelectorAll("video, audio");for(let w of x)w instanceof HTMLMediaElement&&(w.muted=g)},onSetPlaybackRate:d=>$n(d),onEnablePickMode:()=>Ct.enablePickMode(),onDisablePickMode:()=>Ct.disablePickMode()}),Q(),n.capturedTimeline&&(fe._timeline=n.capturedTimeline),T&&setTimeout(()=>{let d=n.capturedTimeline;Q()&&n.capturedTimeline!==d&&(fe._timeline=n.capturedTimeline),et("discover",n.currentTime),je(),Te(!0)},0),n.deterministicAdapters=[ri(),Zn({resolveStartSeconds:d=>v(d,0)}),ni(),ii(),Xn({getTimeline:()=>n.capturedTimeline})],I(),et("discover"),Jt(),n.timelinePollIntervalId&&clearInterval(n.timelinePollIntervalId);let Qt=0,Mt=null,Vn=0,Yt=!1,Ge=0,Kn=()=>{Vn=Date.now(),Yt=!1,Ge=0};n.timelinePollIntervalId=setInterval(()=>{Qt+=1;let g=n.isPlaying&&n.capturedTimeline!=null&&Math.max(0,n.currentTime||0)<A?!1:Q();if(n.capturedTimeline&&!fe._timeline&&(fe._timeline=n.capturedTimeline),(g||Qt%20===0)&&je(),Qt%10===0&&Jt(),D(),n.isPlaying&&n.capturedTimeline){let x=Math.max(0,n.currentTime||0),w=Mt,E=xe(n.capturedTimeline,0);if(E>0&&x>=E){fe.pause(),fe.seek(E),Mt=E,Ge=0,Te(!0);return}if(w!=null&&w>=m&&x<=h?Ge+=1:Ge=0,!Yt&&Ge>=C&&Date.now()-Vn>M){let le=R();Ne(le,"loop_guard")&&(Yt=!0,Ge=0)}Mt=Math.max(0,n.currentTime||0)}else Mt=Math.max(0,n.currentTime||0);n.isPlaying&&Gn(),Te(!1)},50),je(),Te(!0);let Eo=fe.seek;fe.seek=d=>{Kn(),Eo(d)};let Fo=fe.renderSeek;fe.renderSeek=d=>{Kn(),Fo(d)};let Zt=()=>{if(!n.tornDown){n.tornDown=!0,n.timelinePollIntervalId&&(clearInterval(n.timelinePollIntervalId),n.timelinePollIntervalId=null),ce!=null&&(window.clearTimeout(ce),ce=null),s!=null&&(window.cancelAnimationFrame(s),s=null),Ao(),n.controlBridgeHandler&&(window.removeEventListener("message",n.controlBridgeHandler),n.controlBridgeHandler=null),t&&(window.removeEventListener("error",t),t=null),i&&(window.removeEventListener("unhandledrejection",i),i=null),n.beforeUnloadHandler&&(window.removeEventListener("beforeunload",n.beforeUnloadHandler),n.beforeUnloadHandler=null),Ct.disablePickMode();for(let d of n.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch{}n.deterministicAdapters=[];for(let d of r.splice(0))try{d()}catch{}for(let d of n.injectedCompStyles)try{d.remove()}catch{}n.injectedCompStyles=[];for(let d of n.injectedCompScripts)try{d.remove()}catch{}n.injectedCompScripts=[],n.capturedTimeline=null,e.__hfRuntimeTeardown===Zt&&(e.__hfRuntimeTeardown=null)}};e.__hfRuntimeTeardown=Zt,n.beforeUnloadHandler=Zt,window.addEventListener("beforeunload",n.beforeUnloadHandler)}var Vr=["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"],_n=[[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 Al(n){if(n<=255)return Vr[n];let e=0,t=_n.length-1;for(;e<=t;){let i=e+t>>1,r=_n[i];if(n<r[0]){t=i-1;continue}if(n>r[1]){e=i+1;continue}return r[2]}return"L"}function El(n){let e=n.length;if(e===0)return null;let t=new Array(e),i=!1;for(let a=0;a<e;){let l=n.charCodeAt(a),f=l,m=1;if(l>=55296&&l<=56319&&a+1<e){let M=n.charCodeAt(a+1);M>=56320&&M<=57343&&(f=(l-55296<<10)+(M-56320)+65536,m=2)}let h=Al(f);(h==="R"||h==="AL"||h==="AN")&&(i=!0);for(let M=0;M<m;M++)t[a+M]=h;a+=m}if(!i)return null;let r=0;for(let a=0;a<e;a++){let l=t[a];if(l==="L"){r=0;break}if(l==="R"||l==="AL"){r=1;break}}let o=new Int8Array(e);for(let a=0;a<e;a++)o[a]=r;let s=r&1?"R":"L",c=s,u=c;for(let a=0;a<e;a++)t[a]==="NSM"?t[a]=u:u=t[a];u=c;for(let a=0;a<e;a++){let l=t[a];l==="EN"?t[a]=u==="AL"?"AN":"EN":(l==="R"||l==="L"||l==="AL")&&(u=l)}for(let a=0;a<e;a++)t[a]==="AL"&&(t[a]="R");for(let a=1;a<e-1;a++)t[a]==="ES"&&t[a-1]==="EN"&&t[a+1]==="EN"&&(t[a]="EN"),t[a]==="CS"&&(t[a-1]==="EN"||t[a-1]==="AN")&&t[a+1]===t[a-1]&&(t[a]=t[a-1]);for(let a=0;a<e;a++){if(t[a]!=="EN")continue;let l;for(l=a-1;l>=0&&t[l]==="ET";l--)t[l]="EN";for(l=a+1;l<e&&t[l]==="ET";l++)t[l]="EN"}for(let a=0;a<e;a++){let l=t[a];(l==="WS"||l==="ES"||l==="ET"||l==="CS")&&(t[a]="ON")}u=c;for(let a=0;a<e;a++){let l=t[a];l==="EN"?t[a]=u==="L"?"L":"EN":(l==="R"||l==="L")&&(u=l)}for(let a=0;a<e;a++){if(t[a]!=="ON")continue;let l=a+1;for(;l<e&&t[l]==="ON";)l++;let f=a>0?t[a-1]:c,m=l<e?t[l]:c,h=f!=="L"?"R":"L";if(h===(m!=="L"?"R":"L"))for(let C=a;C<l;C++)t[C]=h;a=l-1}for(let a=0;a<e;a++)t[a]==="ON"&&(t[a]=s);for(let a=0;a<e;a++){let l=t[a];(o[a]&1)===0?l==="R"?o[a]++:(l==="AN"||l==="EN")&&(o[a]+=2):(l==="L"||l==="AN"||l==="EN")&&o[a]++}return o}function Kr(n,e){let t=El(n);if(t===null)return null;let i=new Int8Array(e.length);for(let r=0;r<e.length;r++)i[r]=t[e[r]];return i}var Fl=/[ \\t\\n\\r\\f]+/g,bl=/[\\t\\n\\r\\f]| {2,}|^ | $/;function Nl(n){let e=n??"normal";return e==="pre-wrap"?{mode:e,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:e,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function wl(n){if(!bl.test(n))return n;let e=n.replace(Fl," ");return e.charCodeAt(0)===32&&(e=e.slice(1)),e.length>0&&e.charCodeAt(e.length-1)===32&&(e=e.slice(0,-1)),e}function Cl(n){return/[\\r\\f]/.test(n)?n.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):n.replace(/\\r\\n/g,`\n`)}var In=null,Ml;function Dl(){return In===null&&(In=new Intl.Segmenter(Ml,{granularity:"word"})),In}var kl=/\\p{Script=Arabic}/u,jt=/\\p{M}/u,no=/\\p{Nd}/u;function Jr(n){return kl.test(n)}function Qr(n){return n>=19968&&n<=40959||n>=13312&&n<=19903||n>=131072&&n<=173791||n>=173824&&n<=177983||n>=177984&&n<=178207||n>=178208&&n<=183983||n>=183984&&n<=191471||n>=191472&&n<=192093||n>=194560&&n<=195103||n>=196608&&n<=201551||n>=201552&&n<=205743||n>=205744&&n<=210041||n>=63744&&n<=64255||n>=12288&&n<=12351||n>=12352&&n<=12447||n>=12448&&n<=12543||n>=44032&&n<=55215||n>=65280&&n<=65519}function Me(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(!(t<12288)){if(t>=55296&&t<=56319&&e+1<n.length){let i=n.charCodeAt(e+1);if(i>=56320&&i<=57343){let r=(t-55296<<10)+(i-56320)+65536;if(Qr(r))return!0;e++;continue}}if(Qr(t))return!0}}return!1}function Ll(n){let e=Vt(n);return e!==null&&($t.has(e)||Pe.has(e))}var Tl=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Rl(n){return Me(n)}function vl(n){let e=Vt(n);return e!==null&&Tl.has(e)}function Gt(n){return!Ll(n)&&!vl(n)}var $t=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"]),Nt=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Hn=new Set(["\'","\\u2019"]),Pe=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Bl=new Set([":",".","\\u060C","\\u061B"]),Ol=new Set(["\\u104F"]),Pl=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function _l(n){if(Un(n))return!0;let e=!1;for(let t of n){if(Pe.has(t)){e=!0;continue}if(!(e&&jt.test(t)))return!1}return e}function Il(n){for(let e of n)if(!$t.has(e)&&!Pe.has(e))return!1;return n.length>0}function Wl(n){if(Un(n))return!0;for(let e of n)if(!Nt.has(e)&&!Hn.has(e)&&!jt.test(e))return!1;return n.length>0}function Un(n){let e=!1;for(let t of n)if(!(t==="\\\\"||jt.test(t))){if(Nt.has(t)||Pe.has(t)||Hn.has(t)){e=!0;continue}return!1}return e}function io(n,e){let t=e-1;if(t<=0)return Math.max(t,0);let i=n.charCodeAt(t);if(i<56320||i>57343)return t;let r=t-1;if(r<0)return t;let o=n.charCodeAt(r);return o>=55296&&o<=56319?r:t}function Vt(n){if(n.length===0)return null;let e=io(n,n.length);return n.slice(e)}function Hl(n){let e=Array.from(n),t=e.length;for(;t>0;){let i=e[t-1];if(jt.test(i)){t--;continue}if(Nt.has(i)||Hn.has(i)){t--;continue}break}return t<=0||t===e.length?null:{head:e.slice(0,t).join(""),tail:e.slice(t).join("")}}function Ul(n,e,t){return t==="text"&&!e&&n.length===1&&n!=="-"&&n!=="\\u2014"?n:null}function Yr(n,e,t,i){let r=e[i],o=n[i];if(r==null)return o;let s=t[i];if(o.length===s)return o;let c=r.repeat(s);return n[i]=c,c}function Zr(n,e){return n&&e!==null&&Bl.has(e)}function ql(n){let e=Vt(n);return e!==null&&Ol.has(e)}function zl(n){if(n.length<2||n[0]!==" ")return null;let e=n.slice(1);return/^\\p{M}+$/u.test(e)?{space:" ",marks:e}:null}function Kt(n){let e=n.length;for(;e>0;){let t=io(n,e),i=n.slice(t,e);if(Pl.has(i))return!0;if(!Pe.has(i))return!1;e=t}return!1}function jl(n,e){if(e.preserveOrdinarySpaces||e.preserveHardBreaks){if(n===" ")return"preserved-space";if(n===" ")return"tab";if(e.preserveHardBreaks&&n===`\n`)return"hard-break"}return n===" "?"space":n==="\\xA0"||n==="\\u202F"||n==="\\u2060"||n==="\\uFEFF"?"glue":n==="\\u200B"?"zero-width-break":n==="\\xAD"?"soft-hyphen":"text"}var Gl=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function be(n){return n.length===1?n[0]:n.join("")}function $l(n,e){let t=[];for(let i=n.length-1;i>=0;i--)t.push(n[i]);return t.push(e),be(t)}function Vl(n,e,t,i){if(!Gl.test(n))return[{text:n,isWordLike:e,kind:"text",start:t}];let r=[],o=null,s=[],c=t,u=!1,a=0;for(let l of n){let f=jl(l,i),m=f==="text"&&e;if(o!==null&&f===o&&m===u){s.push(l),a+=l.length;continue}o!==null&&r.push({text:be(s),isWordLike:u,kind:o,start:c}),o=f,s=[l],c=t+a,u=m,a+=l.length}return o!==null&&r.push({text:be(s),isWordLike:u,kind:o,start:c}),r}function Wn(n){return n==="space"||n==="preserved-space"||n==="zero-width-break"||n==="hard-break"}var Kl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Jl(n,e){let t=n.texts[e];return t.startsWith("www.")?!0:Kl.test(t)&&e+1<n.len&&n.kinds[e+1]==="text"&&n.texts[e+1]==="//"}function Ql(n){return n.includes("?")&&(n.includes("://")||n.startsWith("www."))}function Yl(n){let e=n.texts.slice(),t=n.isWordLike.slice(),i=n.kinds.slice(),r=n.starts.slice();for(let s=0;s<n.len;s++){if(i[s]!=="text"||!Jl(n,s))continue;let c=[e[s]],u=s+1;for(;u<n.len&&!Wn(i[u]);){c.push(e[u]),t[s]=!0;let a=e[u].includes("?");if(i[u]="text",e[u]="",u++,a)break}e[s]=be(c)}let o=0;for(let s=0;s<e.length;s++){let c=e[s];c.length!==0&&(o!==s&&(e[o]=c,t[o]=t[s],i[o]=i[s],r[o]=r[s]),o++)}return e.length=o,t.length=o,i.length=o,r.length=o,{len:o,texts:e,isWordLike:t,kinds:i,starts:r}}function Zl(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o];if(e.push(s),t.push(n.isWordLike[o]),i.push(n.kinds[o]),r.push(n.starts[o]),!Ql(s))continue;let c=o+1;if(c>=n.len||Wn(n.kinds[c]))continue;let u=[],a=n.starts[c],l=c;for(;l<n.len&&!Wn(n.kinds[l]);)u.push(n.texts[l]),l++;u.length>0&&(e.push(be(u)),t.push(!0),i.push("text"),r.push(a),o=l-1)}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}var Xl=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),Xr=/^[A-Za-z0-9_]+[,:;]*$/,eo=/[,:;]+$/;function ro(n){for(let e of n)if(no.test(e))return!0;return!1}function bt(n){if(n.length===0)return!1;for(let e of n)if(!(no.test(e)||Xl.has(e)))return!1;return!0}function ea(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o],c=n.kinds[o];if(c==="text"&&bt(s)&&ro(s)){let u=[s],a=o+1;for(;a<n.len&&n.kinds[a]==="text"&&bt(n.texts[a]);)u.push(n.texts[a]),a++;e.push(be(u)),t.push(!0),i.push("text"),r.push(n.starts[o]),o=a-1;continue}e.push(s),t.push(n.isWordLike[o]),i.push(c),r.push(n.starts[o])}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function ta(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o],c=n.kinds[o],u=n.isWordLike[o];if(c==="text"&&u&&Xr.test(s)){let a=[s],l=eo.test(s),f=o+1;for(;l&&f<n.len&&n.kinds[f]==="text"&&n.isWordLike[f]&&Xr.test(n.texts[f]);){let m=n.texts[f];a.push(m),l=eo.test(m),f++}e.push(be(a)),t.push(!0),i.push("text"),r.push(n.starts[o]),o=f-1;continue}e.push(s),t.push(u),i.push(c),r.push(n.starts[o])}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function na(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o];if(n.kinds[o]==="text"&&s.includes("-")){let c=s.split("-"),u=c.length>1;for(let a=0;a<c.length;a++){let l=c[a];if(!u)break;(l.length===0||!ro(l)||!bt(l))&&(u=!1)}if(u){let a=0;for(let l=0;l<c.length;l++){let f=c[l],m=l<c.length-1?`${f}-`:f;e.push(m),t.push(!0),i.push("text"),r.push(n.starts[o]+a),a+=m.length}continue}}e.push(s),t.push(n.isWordLike[o]),i.push(n.kinds[o]),r.push(n.starts[o])}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function ia(n){let e=[],t=[],i=[],r=[],o=0;for(;o<n.len;){let s=[n.texts[o]],c=n.isWordLike[o],u=n.kinds[o],a=n.starts[o];if(u==="glue"){let l=[s[0]],f=a;for(o++;o<n.len&&n.kinds[o]==="glue";)l.push(n.texts[o]),o++;let m=be(l);if(o<n.len&&n.kinds[o]==="text")s[0]=m,s.push(n.texts[o]),c=n.isWordLike[o],u="text",a=f,o++;else{e.push(m),t.push(!1),i.push("glue"),r.push(f);continue}}else o++;if(u==="text")for(;o<n.len&&n.kinds[o]==="glue";){let l=[];for(;o<n.len&&n.kinds[o]==="glue";)l.push(n.texts[o]),o++;let f=be(l);if(o<n.len&&n.kinds[o]==="text"){s.push(f,n.texts[o]),c=c||n.isWordLike[o],o++;continue}s.push(f)}e.push(be(s)),t.push(c),i.push(u),r.push(a)}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function ra(n){let e=n.texts.slice(),t=n.isWordLike.slice(),i=n.kinds.slice(),r=n.starts.slice();for(let o=0;o<e.length-1;o++){if(i[o]!=="text"||i[o+1]!=="text"||!Me(e[o])||!Me(e[o+1]))continue;let s=Hl(e[o]);s!==null&&(e[o]=s.head,e[o+1]=s.tail+e[o+1],r[o+1]=r[o]+s.head.length)}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function to(n,e,t){let i=Dl(),r=0,o=[],s=[],c=[],u=[],a=[],l=[],f=[],m=[],h=[],M=[],C=[],A=[];for(let p of i.segment(n))for(let S of Vl(p.segment,p.isWordLike??!1,p.index,t)){let Z=function(){l[T]!==null&&(s[T]=[Yr(o,l,f,T)],l[T]=null),s[T].push(S.text),c[T]=c[T]||S.isWordLike,m[T]=m[T]||N,h[T]=h[T]||v,M[T]=H,C[T]=X,A[T]=Zr(h[T],W)},F=S.kind==="text",b=Ul(S.text,S.isWordLike,S.kind),N=Me(S.text),v=Jr(S.text),W=Vt(S.text),H=Kt(S.text),X=ql(S.text),T=r-1;e.carryCJKAfterClosingQuote&&F&&r>0&&u[T]==="text"&&N&&m[T]&&M[T]||F&&r>0&&u[T]==="text"&&Il(S.text)&&m[T]||F&&r>0&&u[T]==="text"&&C[T]?Z():F&&r>0&&u[T]==="text"&&S.isWordLike&&v&&A[T]?(Z(),c[T]=!0):b!==null&&r>0&&u[T]==="text"&&l[T]===b?f[T]=(f[T]??1)+1:F&&!S.isWordLike&&r>0&&u[T]==="text"&&(_l(S.text)||S.text==="-"&&c[T])?Z():(o[r]=S.text,s[r]=[S.text],c[r]=S.isWordLike,u[r]=S.kind,a[r]=S.start,l[r]=b,f[r]=b===null?0:1,m[r]=N,h[r]=v,M[r]=H,C[r]=X,A[r]=Zr(v,W),r++)}for(let p=0;p<r;p++){if(l[p]!==null){o[p]=Yr(o,l,f,p);continue}o[p]=be(s[p])}for(let p=1;p<r;p++)u[p]==="text"&&!c[p]&&Un(o[p])&&u[p-1]==="text"&&(o[p-1]+=o[p],c[p-1]=c[p-1]||c[p],o[p]="");let z=Array.from({length:r},()=>null),P=-1;for(let p=r-1;p>=0;p--){let S=o[p];if(S.length!==0){if(u[p]==="text"&&!c[p]&&Wl(S)&&P>=0&&u[P]==="text"){let F=z[P]??[];F.push(S),z[P]=F,a[P]=a[p],o[p]="";continue}P=p}}for(let p=0;p<r;p++){let S=z[p];S!=null&&(o[p]=$l(S,o[p]))}let k=0;for(let p=0;p<r;p++){let S=o[p];S.length!==0&&(k!==p&&(o[k]=S,c[k]=c[p],u[k]=u[p],a[k]=a[p]),k++)}o.length=k,c.length=k,u.length=k,a.length=k;let Y=ia({len:k,texts:o,isWordLike:c,kinds:u,starts:a}),y=ra(ta(na(ea(Zl(Yl(Y))))));for(let p=0;p<y.len-1;p++){let S=zl(y.texts[p]);S!==null&&(y.kinds[p]!=="space"&&y.kinds[p]!=="preserved-space"||y.kinds[p+1]!=="text"||!Jr(y.texts[p+1])||(y.texts[p]=S.space,y.isWordLike[p]=!1,y.kinds[p]=y.kinds[p]==="preserved-space"?"preserved-space":"space",y.texts[p+1]=S.marks+y.texts[p+1],y.starts[p+1]=y.starts[p]+S.space.length))}return y}function oa(n,e){if(n.len===0)return[];if(!e.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:n.len,consumedEndSegmentIndex:n.len}];let t=[],i=0;for(let r=0;r<n.len;r++)n.kinds[r]==="hard-break"&&(t.push({startSegmentIndex:i,endSegmentIndex:r,consumedEndSegmentIndex:r+1}),i=r+1);return i<n.len&&t.push({startSegmentIndex:i,endSegmentIndex:n.len,consumedEndSegmentIndex:n.len}),t}function sa(n){if(n.len<=1)return n;let e=[],t=[],i=[],r=[],o=null,s=!1,c=0,u=!1,a=!1;function l(){o!==null&&(e.push(be(o)),t.push(s),i.push("text"),r.push(c),o=null)}for(let f=0;f<n.len;f++){let m=n.texts[f],h=n.kinds[f],M=n.isWordLike[f],C=n.starts[f];if(h==="text"){let A=Rl(m),z=Gt(m);if(o!==null&&u&&a){o.push(m),s=s||M,u=u||A,a=z;continue}l(),o=[m],s=M,c=C,u=A,a=z;continue}l(),e.push(m),t.push(M),i.push(h),r.push(C)}return l(),{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function oo(n,e,t="normal",i="normal"){let r=Nl(t),o=r.mode==="pre-wrap"?Cl(n):wl(n);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let s=i==="keep-all"?sa(to(o,e,r)):to(o,e,r);return{normalized:o,chunks:oa(s,r),...s}}var Ye=null,so=new Map,Ze=null,la=96,aa=/\\p{Emoji_Presentation}/u,ua=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,qn=null,lo=new Map;function zn(){if(Ye!==null)return Ye;if(typeof OffscreenCanvas<"u")return Ye=new OffscreenCanvas(1,1).getContext("2d"),Ye;if(typeof document<"u")return Ye=document.createElement("canvas").getContext("2d"),Ye;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function ca(n){let e=so.get(n);return e||(e=new Map,so.set(n,e)),e}function Le(n,e){let t=e.get(n);return t===void 0&&(t={width:zn().measureText(n).width,containsCJK:Me(n)},e.set(n,t)),t}function Xe(){if(Ze!==null)return Ze;if(typeof navigator>"u")return Ze={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ze;let n=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&n.includes("Safari/")&&!n.includes("Chrome/")&&!n.includes("Chromium/")&&!n.includes("CriOS/")&&!n.includes("FxiOS/")&&!n.includes("EdgiOS/"),i=n.includes("Chrome/")||n.includes("Chromium/")||n.includes("CriOS/")||n.includes("Edg/");return Ze={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:i,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Ze}function da(n){let e=n.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return e?parseFloat(e[1]):16}function ao(){return qn===null&&(qn=new Intl.Segmenter(void 0,{granularity:"grapheme"})),qn}function fa(n){return aa.test(n)||n.includes("\\uFE0F")}function uo(n){return ua.test(n)}function ma(n,e){let t=lo.get(n);if(t!==void 0)return t;let i=zn();i.font=n;let r=i.measureText("\\u{1F600}").width;if(t=0,r>e+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=n,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let s=o.getBoundingClientRect().width;document.body.removeChild(o),r-s>.5&&(t=r-s)}return lo.set(n,t),t}function pa(n){let e=0,t=ao();for(let i of t.segment(n))fa(i.segment)&&e++;return e}function ha(n,e){return e.emojiCount===void 0&&(e.emojiCount=pa(n)),e.emojiCount}function _e(n,e,t){return t===0?e.width:e.width-ha(n,e)*t}function co(n,e,t,i,r){if(e.breakableFitAdvances!==void 0)return e.breakableFitAdvances;let o=ao(),s=[];for(let l of o.segment(n))s.push(l.segment);if(s.length<=1)return e.breakableFitAdvances=null,e.breakableFitAdvances;if(r==="sum-graphemes"){let l=[];for(let f of s){let m=Le(f,t);l.push(_e(f,m,i))}return e.breakableFitAdvances=l,e.breakableFitAdvances}if(r==="pair-context"||s.length>la){let l=[],f=null,m=0;for(let h of s){let M=Le(h,t),C=_e(h,M,i);if(f===null)l.push(C);else{let A=f+h,z=Le(A,t);l.push(_e(A,z,i)-m)}f=h,m=C}return e.breakableFitAdvances=l,e.breakableFitAdvances}let c=[],u="",a=0;for(let l of s){u+=l;let f=Le(u,t),m=_e(u,f,i);c.push(m-a),a=m}return e.breakableFitAdvances=c,e.breakableFitAdvances}function fo(n,e){let t=zn();t.font=n;let i=ca(n),r=da(n),o=e?ma(n,r):0;return{cache:i,fontSize:r,emojiCorrection:o}}function xa(n,e){for(;e<n.widths.length;){let t=n.kinds[e];if(t!=="space"&&t!=="zero-width-break"&&t!=="soft-hyphen")break;e++}return e}function ga(n,e){if(e<=0)return 0;let t=n%e;return Math.abs(t)<=1e-6?e:e-t}function Sa(n,e,t,i,r){let o=0,s=e;for(;o<n.length;){let c=s+n[o];if((o+1<n.length?c+r:c)>t+i)break;s=c,o++}return{fitCount:o,fittedWidth:s}}function mo(n,e){return n.simpleLineWalkFastPath?po(n,e):ho(n,e)}function po(n,e,t){let{widths:i,kinds:r,breakableFitAdvances:o}=n;if(i.length===0)return 0;let c=Xe().lineFitEpsilon,u=e+c,a=0,l=0,f=!1,m=0,h=0,M=0,C=0,A=-1,z=0;function P(){A=-1,z=0}function k(b=M,N=C,v=l){a++,t?.({startSegmentIndex:m,startGraphemeIndex:h,endSegmentIndex:b,endGraphemeIndex:N,width:v}),l=0,f=!1,P()}function Y(b,N){f=!0,m=b,h=0,M=b+1,C=0,l=N}function y(b,N,v){f=!0,m=b,h=N,M=b,C=N+1,l=v}function p(b,N){if(!f){Y(b,N);return}l+=N,M=b+1,C=0}function S(b,N){let v=o[b];for(let W=N;W<v.length;W++){let H=v[W];f?l+H>u?(k(),y(b,W,H)):(l+=H,M=b,C=W+1):y(b,W,H)}f&&M===b&&C===v.length&&(M=b+1,C=0)}let F=0;for(;F<i.length&&!(!f&&(F=xa(n,F),F>=i.length));){let b=i[F],N=r[F],v=N==="space"||N==="preserved-space"||N==="tab"||N==="zero-width-break"||N==="soft-hyphen";if(!f){b>e&&o[F]!==null?S(F,0):Y(F,b),v&&(A=F+1,z=l-b),F++;continue}if(l+b>u){if(v){p(F,b),k(F+1,0,l-b),F++;continue}if(A>=0){if(M>A||M===A&&C>0){k();continue}k(A,0,z);continue}if(b>e&&o[F]!==null){k(),S(F,0),F++;continue}k();continue}p(F,b),v&&(A=F+1,z=l-b),F++}return f&&k(),a}function ho(n,e,t){if(n.simpleLineWalkFastPath)return po(n,e,t);let{widths:i,lineEndFitAdvances:r,lineEndPaintAdvances:o,kinds:s,breakableFitAdvances:c,discretionaryHyphenWidth:u,tabStopAdvance:a,chunks:l}=n;if(i.length===0||l.length===0)return 0;let f=Xe(),m=f.lineFitEpsilon,h=e+m,M=0,C=0,A=!1,z=0,P=0,k=0,Y=0,y=-1,p=0,S=0,F=null;function b(){y=-1,p=0,S=0,F=null}function N(U=k,G=Y,B=C){M++,t?.({startSegmentIndex:z,startGraphemeIndex:P,endSegmentIndex:U,endGraphemeIndex:G,width:B}),C=0,A=!1,b()}function v(U,G){A=!0,z=U,P=0,k=U+1,Y=0,C=G}function W(U,G,B){A=!0,z=U,P=G,k=U,Y=G+1,C=B}function H(U,G){if(!A){v(U,G);return}C+=G,k=U+1,Y=0}function X(U,G,B,J){if(!G)return;let Ee=U==="tab"?0:r[B],xe=U==="tab"?J:o[B];y=B+1,p=C-J+Ee,S=C-J+xe,F=U}function T(U,G){let B=c[U];for(let J=G;J<B.length;J++){let Ee=B[J];A?C+Ee>h?(N(),W(U,J,Ee)):(C+=Ee,k=U,Y=J+1):W(U,J,Ee)}A&&k===U&&Y===B.length&&(k=U+1,Y=0)}function Z(U){if(F!=="soft-hyphen")return!1;let G=c[U];if(G==null)return!1;let{fitCount:B,fittedWidth:J}=Sa(G,C,e,m,u);return B===0?!1:(C=J,k=U,Y=B,b(),B===G.length?(k=U+1,Y=0,!0):(N(U,B,J+u),T(U,B),!0))}function ee(U){M++,t?.({startSegmentIndex:U.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:U.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),b()}for(let U=0;U<l.length;U++){let G=l[U];if(G.startSegmentIndex===G.endSegmentIndex){ee(G);continue}A=!1,C=0,z=G.startSegmentIndex,P=0,k=G.startSegmentIndex,Y=0,b();let B=G.startSegmentIndex;for(;B<G.endSegmentIndex;){let J=s[B],Ee=J==="space"||J==="preserved-space"||J==="tab"||J==="zero-width-break"||J==="soft-hyphen",xe=J==="tab"?ga(C,a):i[B];if(J==="soft-hyphen"){A&&(k=B+1,Y=0,y=B+1,p=C+u,S=C+u,F=J),B++;continue}if(!A){xe>e&&c[B]!==null?T(B,0):v(B,xe),X(J,Ee,B,xe),B++;continue}if(C+xe>h){let D=C+(J==="tab"?0:r[B]),L=C+(J==="tab"?xe:o[B]);if(F==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&p<=h){N(y,0,S);continue}if(F==="soft-hyphen"&&Z(B)){B++;continue}if(Ee&&D<=h){H(B,xe),N(B+1,0,L),B++;continue}if(y>=0&&p<=h){if(k>y||k===y&&Y>0){N();continue}let Q=y;N(Q,0,S),B=Q;continue}if(xe>e&&c[B]!==null){N(),T(B,0),B++;continue}N();continue}H(B,xe),X(J,Ee,B,xe),B++}if(A){let J=y===G.consumedEndSegmentIndex?S:C;N(G.consumedEndSegmentIndex,0,J)}}return M}var jn=null;function ya(){return jn===null&&(jn=new Intl.Segmenter(void 0,{granularity:"grapheme"})),jn}function Aa(n){return n?{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 Ea(n,e){let t=[],i=[],r=0,o=!1,s=!1,c=!1;function u(){i.length!==0&&(t.push({text:i.length===1?i[0]:i.join(""),start:r}),i=[],o=!1,s=!1,c=!1)}function a(f,m,h){i=[f],r=m,o=h,s=Kt(f),c=Nt.has(f)}function l(f,m){i.push(f),o=o||m;let h=Kt(f);f.length===1&&Pe.has(f)?s=s||h:s=h,c=!1}for(let f of ya().segment(n)){let m=f.segment,h=Me(m);if(i.length===0){a(m,f.index,h);continue}if(c||$t.has(m)||Pe.has(m)||e.carryCJKAfterClosingQuote&&h&&s){l(m,h);continue}if(!o&&!h){l(m,h);continue}u(),a(m,f.index,h)}return u(),t}function Fa(n){if(n.length<=1)return n;let e=[],t=[n[0].text],i=n[0].start,r=Me(n[0].text),o=Gt(n[0].text);function s(){e.push({text:t.length===1?t[0]:t.join(""),start:i})}for(let c=1;c<n.length;c++){let u=n[c],a=Me(u.text),l=Gt(u.text);if(r&&o){t.push(u.text),r=r||a,o=l;continue}s(),t=[u.text],i=u.start,r=a,o=l}return s(),e}function ba(n,e,t,i){let r=Xe(),{cache:o,emojiCorrection:s}=fo(e,uo(n.normalized)),c=_e("-",Le("-",o),s),a=_e(" ",Le(" ",o),s)*8;if(n.len===0)return Aa(t);let l=[],f=[],m=[],h=[],M=n.chunks.length<=1,C=t?[]:null,A=[],z=t?[]:null,P=Array.from({length:n.len});function k(S,F,b,N,v,W,H){v!=="text"&&v!=="space"&&v!=="zero-width-break"&&(M=!1),l.push(F),f.push(b),m.push(N),h.push(v),C?.push(W),A.push(H),z!==null&&z.push(S)}function Y(S,F,b,N,v){let W=Le(S,o),H=_e(S,W,s),X=F==="space"||F==="preserved-space"||F==="zero-width-break"?0:H,T=F==="space"||F==="zero-width-break"?0:H;if(v&&N&&S.length>1){let Z="sum-graphemes";bt(S)?Z="pair-context":r.preferPrefixWidthsForBreakableRuns&&(Z="segment-prefixes");let ee=co(S,W,o,s,Z);k(S,H,X,T,F,b,ee);return}k(S,H,X,T,F,b,null)}for(let S=0;S<n.len;S++){P[S]=l.length;let F=n.texts[S],b=n.isWordLike[S],N=n.kinds[S],v=n.starts[S];if(N==="soft-hyphen"){k(F,0,c,c,N,v,null);continue}if(N==="hard-break"){k(F,0,0,0,N,v,null);continue}if(N==="tab"){k(F,0,0,0,N,v,null);continue}let W=Le(F,o);if(N==="text"&&W.containsCJK){let H=Ea(F,r),X=i==="keep-all"?Fa(H):H;for(let T=0;T<X.length;T++){let Z=X[T];Y(Z.text,"text",v+Z.start,b,i==="keep-all"||!Me(Z.text))}continue}Y(F,N,v,b,!0)}let y=Na(n.chunks,P,l.length),p=C===null?null:Kr(n.normalized,C);return z!==null?{widths:l,lineEndFitAdvances:f,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:M,segLevels:p,breakableFitAdvances:A,discretionaryHyphenWidth:c,tabStopAdvance:a,chunks:y,segments:z}:{widths:l,lineEndFitAdvances:f,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:M,segLevels:p,breakableFitAdvances:A,discretionaryHyphenWidth:c,tabStopAdvance:a,chunks:y}}function Na(n,e,t){let i=[];for(let r=0;r<n.length;r++){let o=n[r],s=o.startSegmentIndex<e.length?e[o.startSegmentIndex]:t,c=o.endSegmentIndex<e.length?e[o.endSegmentIndex]:t,u=o.consumedEndSegmentIndex<e.length?e[o.consumedEndSegmentIndex]:t;i.push({startSegmentIndex:s,endSegmentIndex:c,consumedEndSegmentIndex:u})}return i}function wa(n,e,t,i){let r=i?.wordBreak??"normal",o=oo(n,Xe(),i?.whiteSpace,r);return ba(o,e,t,r)}function xo(n,e,t){return wa(n,e,!1,t)}function go(n,e,t){let i=mo(n,e);return{lineCount:i,height:i*t}}var Ca={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function So(n,e){let t={...Ca,...e},i=1.2;for(let r=t.baseFontSize;r>=t.minFontSize;r-=t.step){let o=`${t.fontWeight} ${r}px ${t.fontFamily}`,s=xo(n,o),{lineCount:c}=go(s,t.maxWidth,r*i);if(c<=1)return{fontSize:r,fits:!0}}return{fontSize:t.minFontSize,fits:!1}}window.__timelines=window.__timelines||{};window.__hyperframes={fitTextFontSize:So};function yo(){let n=window;n.__hyperframeRuntimeBootstrapped||(n.__hyperframeRuntimeBootstrapped=!0,$r())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",yo,{once:!0}):yo();})();\n';
6259
+ RUNTIME_IIFE = '"use strict";(()=>{var No=Object.create;var Jn=Object.defineProperty;var wo=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var Mo=Object.getPrototypeOf,Do=Object.prototype.hasOwnProperty;var K=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ko=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Co(e))!Do.call(n,r)&&r!==t&&Jn(n,r,{get:()=>e[r],enumerable:!(i=wo(e,r))||i.enumerable});return n};var Lo=(n,e,t)=>(t=n!=null?No(Mo(n)):{},ko(e||!n||!n.__esModule?Jn(t,"default",{value:n,enumerable:!0}):t,n));var hi=K((ja,ln)=>{var q=String,pi=function(){return{isColorSupported:!1,reset:q,bold:q,dim:q,italic:q,underline:q,inverse:q,hidden:q,strikethrough:q,black:q,red:q,green:q,yellow:q,blue:q,magenta:q,cyan:q,white:q,gray:q,bgBlack:q,bgRed:q,bgGreen:q,bgYellow:q,bgBlue:q,bgMagenta:q,bgCyan:q,bgWhite:q,blackBright:q,redBright:q,greenBright:q,yellowBright:q,blueBright:q,magentaBright:q,cyanBright:q,whiteBright:q,bgBlackBright:q,bgRedBright:q,bgGreenBright:q,bgYellowBright:q,bgBlueBright:q,bgMagentaBright:q,bgCyanBright:q,bgWhiteBright:q}};ln.exports=pi();ln.exports.createColors=pi});var an=K(()=>{});var kt=K((Va,Si)=>{"use strict";var xi=hi(),gi=an(),ot=class n extends Error{constructor(e,t,i,r,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),r&&(this.source=r),s&&(this.plugin=s),typeof t<"u"&&typeof i<"u"&&(typeof t=="number"?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(e){if(!this.source)return"";let t=this.source;e==null&&(e=xi.isColorSupported);let i=l=>l,r=l=>l,o=l=>l;if(e){let{bold:l,gray:f,red:m}=xi.createColors(!0);r=h=>l(m(h)),i=h=>f(h),gi&&(o=h=>gi(h))}let s=t.split(/\\r?\\n/),c=Math.max(this.line-3,0),u=Math.min(this.line+2,s.length),a=String(u).length;return s.slice(c,u).map((l,f)=>{let m=c+1+f,h=" "+(" "+m).slice(-a)+" | ";if(m===this.line){if(l.length>160){let C=20,A=Math.max(0,this.column-C),z=Math.max(this.column+C,this.endColumn+C),P=l.slice(A,z),k=i(h.replace(/\\d/g," "))+l.slice(0,Math.min(this.column-1,C-1)).replace(/[^\\t]/g," ");return r(">")+i(h)+o(P)+`\n `+k+r("^")}let M=i(h.replace(/\\d/g," "))+l.slice(0,this.column-1).replace(/[^\\t]/g," ");return r(">")+i(h)+o(l)+`\n `+M+r("^")}return" "+i(h)+o(l)}).join(`\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\n\n`+e+`\n`),this.name+": "+this.message+e}};Si.exports=ot;ot.default=ot});var un=K((Ka,Ai)=>{"use strict";var yi={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function $o(n){return n[0].toUpperCase()+n.slice(1)}var st=class{constructor(e){this.builder=e}atrule(e,t){let i="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?i+=e.raws.afterName:r&&(i+=" "),e.nodes)this.block(e,i+r);else{let o=(e.raws.between||"")+(t?";":"");this.builder(i+r+o,e)}}beforeAfter(e,t){let i;e.type==="decl"?i=this.raw(e,null,"beforeDecl"):e.type==="comment"?i=this.raw(e,null,"beforeComment"):t==="before"?i=this.raw(e,null,"beforeRule"):i=this.raw(e,null,"beforeClose");let r=e.parent,o=0;for(;r&&r.type!=="root";)o+=1,r=r.parent;if(i.includes(`\n`)){let s=this.raw(e,null,"indent");if(s.length)for(let c=0;c<o;c++)i+=s}return i}block(e,t){let i=this.raw(e,"between","beforeOpen");this.builder(t+i+"{",e,"start");let r;e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let i=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let o=e.nodes[r],s=this.raw(o,"before");s&&this.builder(s),this.stringify(o,t!==r||i)}}comment(e){let t=this.raw(e,"left","commentLeft"),i=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+i+"*/",e)}decl(e,t){let i=this.raw(e,"between","colon"),r=e.prop+i+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,i){let r;if(i||(i=t),t&&(r=e.raws[t],typeof r<"u"))return r;let o=e.parent;if(i==="before"&&(!o||o.type==="root"&&o.first===e||o&&o.type==="document"))return"";if(!o)return yi[i];let s=e.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[i]<"u")return s.rawCache[i];if(i==="before"||i==="after")return this.beforeAfter(e,i);{let c="raw"+$o(i);this[c]?r=this[c](s,e):s.walk(u=>{if(r=u.raws[t],typeof r<"u")return!1})}return typeof r>"u"&&(r=yi[i]),s.rawCache[i]=r,r}rawBeforeClose(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length>0&&typeof i.raws.after<"u")return t=i.raws.after,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawBeforeComment(e,t){let i;return e.walkComments(r=>{if(typeof r.raws.before<"u")return i=r.raws.before,i.includes(`\n`)&&(i=i.replace(/[^\\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeDecl"):i&&(i=i.replace(/\\S/g,"")),i}rawBeforeDecl(e,t){let i;return e.walkDecls(r=>{if(typeof r.raws.before<"u")return i=r.raws.before,i.includes(`\n`)&&(i=i.replace(/[^\\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeRule"):i&&(i=i.replace(/\\S/g,"")),i}rawBeforeOpen(e){let t;return e.walk(i=>{if(i.type!=="decl"&&(t=i.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(i=>{if(i.nodes&&(i.parent!==e||e.first!==i)&&typeof i.raws.before<"u")return t=i.raws.before,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawColon(e){let t;return e.walkDecls(i=>{if(typeof i.raws.between<"u")return t=i.raws.between.replace(/[^\\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length===0&&(t=i.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(i=>{let r=i.parent;if(r&&r!==e&&r.parent&&r.parent===e&&typeof i.raws.before<"u"){let o=i.raws.before.split(`\n`);return t=o[o.length-1],t=t.replace(/\\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(t=i.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let i=e[t],r=e.raws[t];return r&&r.value===i?r.raw:i}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};Ai.exports=st;st.default=st});var lt=K((Ja,Ei)=>{"use strict";var Vo=un();function cn(n,e){new Vo(e).stringify(n)}Ei.exports=cn;cn.default=cn});var Lt=K((Qa,dn)=>{"use strict";dn.exports.isClean=Symbol("isClean");dn.exports.my=Symbol("my")});var ct=K((Ya,Fi)=>{"use strict";var Ko=kt(),Jo=un(),Qo=lt(),{isClean:at,my:Yo}=Lt();function fn(n,e){let t=new n.constructor;for(let i in n){if(!Object.prototype.hasOwnProperty.call(n,i)||i==="proxyCache")continue;let r=n[i],o=typeof r;i==="parent"&&o==="object"?e&&(t[i]=e):i==="source"?t[i]=r:Array.isArray(r)?t[i]=r.map(s=>fn(s,t)):(o==="object"&&r!==null&&(r=fn(r)),t[i]=r)}return t}function ke(n,e){if(e&&typeof e.offset<"u")return e.offset;let t=1,i=1,r=0;for(let o=0;o<n.length;o++){if(i===e.line&&t===e.column){r=o;break}n[o]===`\n`?(t=1,i+=1):t+=1}return r}var ut=class{get proxyOf(){return this}constructor(e={}){this.raws={},this[at]=!1,this[Yo]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let i of e[t])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\n\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\n\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=fn(this);for(let i in e)t[i]=e[i];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:i,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:i.column,line:i.line},t)}return new Ko(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markClean(){this[at]=!0}markDirty(){if(this[at]){this[at]=!1;let e=this;for(;e=e.parent;)e[at]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let i="document"in this.source.input?this.source.input.document:this.source.input.css,o=i.slice(ke(i,this.source.start),ke(i,this.source.end)).indexOf(e.word);o!==-1&&(t=this.positionInside(o))}return t}positionInside(e){let t=this.source.start.column,i=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,o=ke(r,this.source.start),s=o+e;for(let c=o;c<s;c++)r[c]===`\n`?(t=1,i+=1):t+=1;return{column:t,line:i,offset:s}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,i={column:this.source.start.column,line:this.source.start.line,offset:ke(t,this.source.start)},r=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:ke(t,this.source.end)+1}:{column:i.column+1,line:i.line,offset:i.offset+1};if(e.word){let s=t.slice(ke(t,this.source.start),ke(t,this.source.end)).indexOf(e.word);s!==-1&&(i=this.positionInside(s),r=this.positionInside(s+e.word.length))}else e.start?i={column:e.start.column,line:e.start.line,offset:ke(t,e.start)}:e.index&&(i=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line,offset:ke(t,e.end)}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<i.line||r.line===i.line&&r.column<=i.column)&&(r={column:i.column+1,line:i.line,offset:i.offset+1}),{end:r,start:i}}raw(e,t){return new Jo().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,i=!1;for(let r of e)r===this?i=!0:i?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);i||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let i={},r=t==null;t=t||new Map;let o=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let c=this[s];if(Array.isArray(c))i[s]=c.map(u=>typeof u=="object"&&u.toJSON?u.toJSON(null,t):u);else if(typeof c=="object"&&c.toJSON)i[s]=c.toJSON(null,t);else if(s==="source"){if(c==null)continue;let u=t.get(c.input);u==null&&(u=o,t.set(c.input,o),o++),i[s]={end:c.end,inputId:u,start:c.start}}else i[s]=c}return r&&(i.inputs=[...t.keys()].map(s=>s.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Qo){e.stringify&&(e=e.stringify);let t="";return e(this,i=>{t+=i}),t}warn(e,t,i={}){let r={node:this};for(let o in i)r[o]=i[o];return e.warn(t,r)}};Fi.exports=ut;ut.default=ut});var ft=K((Za,bi)=>{"use strict";var Zo=ct(),dt=class extends Zo{constructor(e){super(e),this.type="comment"}};bi.exports=dt;dt.default=dt});var pt=K((Xa,Ni)=>{"use strict";var Xo=ct(),mt=class extends Xo{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}};Ni.exports=mt;mt.default=mt});var ve=K((eu,vi)=>{"use strict";var wi=ft(),Ci=pt(),es=ct(),{isClean:Mi,my:Di}=Lt(),mn,ki,Li,pn;function Ri(n){return n.map(e=>(e.nodes&&(e.nodes=Ri(e.nodes)),delete e.source,e))}function Ti(n){if(n[Mi]=!1,n.proxyOf.nodes)for(let e of n.proxyOf.nodes)Ti(e)}var Ce=class n extends es{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(...e){for(let t of e){let i=this.normalize(t,this.last);for(let r of i)this.proxyOf.nodes.push(r)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),i,r;for(;this.indexes[t]<this.proxyOf.nodes.length&&(i=this.indexes[t],r=e(this.proxyOf.nodes[i],i),r!==!1);)this.indexes[t]+=1;return delete this.indexes[t],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...i)=>e[t](...i.map(r=>typeof r=="function"?(o,s)=>r(o.toProxy(),s):r)):t==="every"||t==="some"?i=>e[t]((r,...o)=>i(r.toProxy(),...o)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(i=>i.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let i=this.index(e),r=this.normalize(t,this.proxyOf.nodes[i]).reverse();i=this.index(e);for(let s of r)this.proxyOf.nodes.splice(i+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],i<o&&(this.indexes[s]=o+r.length);return this.markDirty(),this}insertBefore(e,t){let i=this.index(e),r=i===0?"prepend":!1,o=this.normalize(t,this.proxyOf.nodes[i],r).reverse();i=this.index(e);for(let c of o)this.proxyOf.nodes.splice(i,0,c);let s;for(let c in this.indexes)s=this.indexes[c],i<=s&&(this.indexes[c]=s+o.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Ri(ki(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let r of e)r.parent&&r.parent.removeChild(r,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let r of e)r.parent&&r.parent.removeChild(r,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Ci(e)]}else if(e.selector||e.selectors)e=[new pn(e)];else if(e.name)e=[new mn(e)];else if(e.text)e=[new wi(e)];else throw new Error("Unknown node type in node creation");return e.map(r=>(r[Di]||n.rebuild(r),r=r.proxyOf,r.parent&&r.parent.removeChild(r),r[Mi]&&Ti(r),r.raws||(r.raws={}),typeof r.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(r.raws.before=t.raws.before.replace(/\\S/g,"")),r.parent=this.proxyOf,r))}prepend(...e){e=e.reverse();for(let t of e){let i=this.normalize(t,this.first,"prepend").reverse();for(let r of i)this.proxyOf.nodes.unshift(r);for(let r in this.indexes)this.indexes[r]=this.indexes[r]+i.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let i in this.indexes)t=this.indexes[i],t>=e&&(this.indexes[i]=t-1);return this.markDirty(),this}replaceValues(e,t,i){return i||(i=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,i))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,i)=>{let r;try{r=e(t,i)}catch(o){throw t.addToError(o)}return r!==!1&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((i,r)=>{if(i.type==="atrule"&&e.test(i.name))return t(i,r)}):this.walk((i,r)=>{if(i.type==="atrule"&&i.name===e)return t(i,r)}):(t=e,this.walk((i,r)=>{if(i.type==="atrule")return t(i,r)}))}walkComments(e){return this.walk((t,i)=>{if(t.type==="comment")return e(t,i)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((i,r)=>{if(i.type==="decl"&&e.test(i.prop))return t(i,r)}):this.walk((i,r)=>{if(i.type==="decl"&&i.prop===e)return t(i,r)}):(t=e,this.walk((i,r)=>{if(i.type==="decl")return t(i,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((i,r)=>{if(i.type==="rule"&&e.test(i.selector))return t(i,r)}):this.walk((i,r)=>{if(i.type==="rule"&&i.selector===e)return t(i,r)}):(t=e,this.walk((i,r)=>{if(i.type==="rule")return t(i,r)}))}};Ce.registerParse=n=>{ki=n};Ce.registerRule=n=>{pn=n};Ce.registerAtRule=n=>{mn=n};Ce.registerRoot=n=>{Li=n};vi.exports=Ce;Ce.default=Ce;Ce.rebuild=n=>{n.type==="atrule"?Object.setPrototypeOf(n,mn.prototype):n.type==="rule"?Object.setPrototypeOf(n,pn.prototype):n.type==="decl"?Object.setPrototypeOf(n,Ci.prototype):n.type==="comment"?Object.setPrototypeOf(n,wi.prototype):n.type==="root"&&Object.setPrototypeOf(n,Li.prototype),n[Di]=!0,n.nodes&&n.nodes.forEach(e=>{Ce.rebuild(e)})}});var Rt=K((tu,Oi)=>{"use strict";var Bi=ve(),$e=class extends Bi{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};Oi.exports=$e;$e.default=$e;Bi.registerAtRule($e)});var Tt=K((nu,Ii)=>{"use strict";var ts=ve(),Pi,_i,Ue=class extends ts{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Pi(new _i,this,e).stringify()}};Ue.registerLazyResult=n=>{Pi=n};Ue.registerProcessor=n=>{_i=n};Ii.exports=Ue;Ue.default=Ue});var Hi=K((iu,Wi)=>{var ns="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",is=(n,e=21)=>(t=e)=>{let i="",r=t|0;for(;r--;)i+=n[Math.random()*n.length|0];return i},rs=(n=21)=>{let e="",t=n|0;for(;t--;)e+=ns[Math.random()*64|0];return e};Wi.exports={nanoid:rs,customAlphabet:is}});var vt=K(()=>{});var Bt=K(()=>{});var hn=K(()=>{});var Ui=K(()=>{});var gn=K((fu,ji)=>{"use strict";var{existsSync:os,readFileSync:ss}=Ui(),{dirname:xn,join:ls}=vt(),{SourceMapConsumer:qi,SourceMapGenerator:zi}=Bt();function as(n){return Buffer?Buffer.from(n,"base64").toString():window.atob(n)}var ht=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let i=t.map?t.map.prev:void 0,r=this.loadMap(t.from,i);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=xn(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new qi(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\/json;charset=utf-?8;base64,/,i=/^data:application\\/json;base64,/,r=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,s=e.match(r)||e.match(o);if(s)return decodeURIComponent(e.substr(s[0].length));let c=e.match(t)||e.match(i);if(c)return as(e.substr(c[0].length));let u=e.match(/data:application\\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+u)}getAnnotationURL(e){return e.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!t)return;let i=e.lastIndexOf(t.pop()),r=e.indexOf("*/",i);i>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(i,r)))}loadFile(e){if(this.root=xn(e),os(e))return this.mapFile=e,ss(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let i=t(e);if(i){let r=this.loadFile(i);if(!r)throw new Error("Unable to load previous source map: "+i.toString());return r}}else{if(t instanceof qi)return zi.fromSourceMap(t).toString();if(t instanceof zi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return e&&(i=ls(xn(e),i)),this.loadFile(i)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};ji.exports=ht;ht.default=ht});var xt=K((mu,Ji)=>{"use strict";var{nanoid:us}=Hi(),{isAbsolute:An,resolve:En}=vt(),{SourceMapConsumer:cs,SourceMapGenerator:ds}=Bt(),{fileURLToPath:Gi,pathToFileURL:Ot}=hn(),$i=kt(),fs=gn(),Sn=an(),yn=Symbol("lineToIndexCache"),ms=!!(cs&&ds),Vi=!!(En&&An);function Ki(n){if(n[yn])return n[yn];let e=n.css.split(`\n`),t=new Array(e.length),i=0;for(let r=0,o=e.length;r<o;r++)t[r]=i,i+=e[r].length+1;return n[yn]=t,t}var Ve=class{get from(){return this.file||this.id}constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.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,t.document&&(this.document=t.document.toString()),t.from&&(!Vi||/^\\w+:\\/\\//.test(t.from)||An(t.from)?this.file=t.from:this.file=En(t.from)),Vi&&ms){let i=new fs(this.css,t);if(i.text){this.map=i;let r=i.consumer().file;!this.file&&r&&(this.file=this.mapResolve(r))}}this.file||(this.id="<input css "+us(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,i,r={}){let o,s,c,u,a;if(t&&typeof t=="object"){let f=t,m=i;if(typeof f.offset=="number"){u=f.offset;let h=this.fromOffset(u);t=h.line,i=h.col}else t=f.line,i=f.column,u=this.fromLineAndColumn(t,i);if(typeof m.offset=="number"){c=m.offset;let h=this.fromOffset(c);s=h.line,o=h.col}else s=m.line,o=m.column,c=this.fromLineAndColumn(m.line,m.column)}else if(i)u=this.fromLineAndColumn(t,i);else{u=t;let f=this.fromOffset(u);t=f.line,i=f.col}let l=this.origin(t,i,s,o);return l?a=new $i(e,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,r.plugin):a=new $i(e,s===void 0?t:{column:i,line:t},s===void 0?i:{column:o,line:s},this.css,this.file,r.plugin),a.input={column:i,endColumn:o,endLine:s,endOffset:c,line:t,offset:u,source:this.css},this.file&&(Ot&&(a.input.url=Ot(this.file).toString()),a.input.file=this.file),a}fromLineAndColumn(e,t){return Ki(this)[e-1]+t-1}fromOffset(e){let t=Ki(this),i=t[t.length-1],r=0;if(e>=i)r=t.length-1;else{let o=t.length-2,s;for(;r<o;)if(s=r+(o-r>>1),e<t[s])o=s-1;else if(e>=t[s+1])r=s+1;else{r=s;break}}return{col:e-t[r]+1,line:r+1}}mapResolve(e){return/^\\w+:\\/\\//.test(e)?e:En(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,i,r){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:t,line:e});if(!s.source)return!1;let c;typeof i=="number"&&(c=o.originalPositionFor({column:r,line:i}));let u;An(s.source)?u=Ot(s.source):u=new URL(s.source,this.map.consumer().sourceRoot||Ot(this.map.mapFile));let a={column:s.column,endColumn:c&&c.column,endLine:c&&c.line,line:s.line,url:u.toString()};if(u.protocol==="file:")if(Gi)a.file=Gi(u);else throw new Error("file: protocol is not available in this PostCSS build");let l=o.sourceContentFor(s.source);return l&&(a.source=l),a}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}};Ji.exports=Ve;Ve.default=Ve;Sn&&Sn.registerInput&&Sn.registerInput(Ve)});var Ke=K((pu,Xi)=>{"use strict";var Qi=ve(),Yi,Zi,Be=class extends Qi{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,i){let r=super.normalize(e);if(t){if(i==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of r)o.raws.before=t.raws.before}return r}removeChild(e,t){let i=this.index(e);return!t&&i===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[i].raws.before),super.removeChild(e)}toResult(e={}){return new Yi(new Zi,this,e).stringify()}};Be.registerLazyResult=n=>{Yi=n};Be.registerProcessor=n=>{Zi=n};Xi.exports=Be;Be.default=Be;Qi.registerRoot(Be)});var Fn=K((hu,er)=>{"use strict";var gt={comma(n){return gt.split(n,[","],!0)},space(n){let e=[" ",`\n`," "];return gt.split(n,e)},split(n,e,t){let i=[],r="",o=!1,s=0,c=!1,u="",a=!1;for(let l of n)a?a=!1:l==="\\\\"?a=!0:c?l===u&&(c=!1):l===\'"\'||l==="\'"?(c=!0,u=l):l==="("?s+=1:l===")"?s>0&&(s-=1):s===0&&e.includes(l)&&(o=!0),o?(r!==""&&i.push(r.trim()),r="",o=!1):r+=l;return(t||r!=="")&&i.push(r.trim()),i}};er.exports=gt;gt.default=gt});var Pt=K((xu,nr)=>{"use strict";var tr=ve(),ps=Fn(),Je=class extends tr{get selectors(){return ps.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\s*/):null,i=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(i)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}};nr.exports=Je;Je.default=Je;tr.registerRule(Je)});var rr=K((gu,ir)=>{"use strict";var hs=Rt(),xs=ft(),gs=pt(),Ss=xt(),ys=gn(),As=Ke(),Es=Pt();function St(n,e){if(Array.isArray(n))return n.map(r=>St(r));let{inputs:t,...i}=n;if(t){e=[];for(let r of t){let o={...r,__proto__:Ss.prototype};o.map&&(o.map={...o.map,__proto__:ys.prototype}),e.push(o)}}if(i.nodes&&(i.nodes=n.nodes.map(r=>St(r,e))),i.source){let{inputId:r,...o}=i.source;i.source=o,r!=null&&(i.source.input=e[r])}if(i.type==="root")return new As(i);if(i.type==="decl")return new gs(i);if(i.type==="rule")return new Es(i);if(i.type==="comment")return new xs(i);if(i.type==="atrule")return new hs(i);throw new Error("Unknown node type: "+n.type)}ir.exports=St;St.default=St});var Nn=K((Su,cr)=>{"use strict";var{dirname:_t,relative:sr,resolve:lr,sep:ar}=vt(),{SourceMapConsumer:ur,SourceMapGenerator:It}=Bt(),{pathToFileURL:or}=hn(),Fs=xt(),bs=!!(ur&&It),Ns=!!(_t&&lr&&sr&&ar),bn=class{constructor(e,t,i,r){this.stringify=e,this.mapOpts=i.map||{},this.root=t,this.opts=i,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`\n`;this.css.includes(`\\r\n`)&&(t=`\\r\n`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),i=e.root||_t(e.file),r;this.mapOpts.sourcesContent===!1?(r=new ur(e.text),r.sourcesContent&&(r.sourcesContent=null)):r=e.consumer(),this.map.applySourceMap(r,t,this.toUrl(this.path(i)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(t)}else if(this.css){let e;for(;(e=this.css.lastIndexOf("/*#"))!==-1;){let t=this.css.indexOf("*/",e+3);if(t===-1)break;for(;e>0&&this.css[e-1]===`\n`;)e--;this.css=this.css.slice(0,e)+this.css.slice(t+2)}}}}generate(){if(this.clearAnnotation(),Ns&&bs&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=It.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new It({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 It({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,i="<no source>",r={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(c,u,a)=>{if(this.css+=c,u&&a!=="end"&&(r.generated.line=e,r.generated.column=t-1,u.source&&u.source.start?(r.source=this.sourcePath(u),r.original.line=u.source.start.line,r.original.column=u.source.start.column-1,this.map.addMapping(r)):(r.source=i,r.original.line=1,r.original.column=0,this.map.addMapping(r))),s=c.match(/\\n/g),s?(e+=s.length,o=c.lastIndexOf(`\n`),t=c.length-o):t+=c.length,u&&a!=="start"){let l=u.parent||{raws:{}};(!(u.type==="decl"||u.type==="atrule"&&!u.nodes)||u!==l.last||l.raws.semicolon)&&(u.source&&u.source.end?(r.source=this.sourcePath(u),r.original.line=u.source.end.line,r.original.column=u.source.end.column-1,r.generated.line=e,r.generated.column=t-2,this.map.addMapping(r)):(r.source=i,r.original.line=1,r.original.column=0,r.generated.line=e,r.generated.column=t-1,this.map.addMapping(r)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.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(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\w+:\\/\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let i=this.opts.to?_t(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=_t(lr(i,this.mapOpts.annotation)));let r=sr(i,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Fs(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let i=t.source.input.from;if(i&&!e[i]){e[i]=!0;let r=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(or){let i=or(e).toString();return this.memoizedFileURLs.set(e,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;ar==="\\\\"&&(e=e.replace(/\\\\/g,"/"));let i=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,i),i}};cr.exports=bn});var mr=K((yu,fr)=>{"use strict";var Wt=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Ht=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,ws=/.[\\r\\n"\'(/\\\\]/,dr=/[\\da-f]/i;fr.exports=function(e,t={}){let i=e.css.valueOf(),r=t.ignoreErrors,o,s,c,u,a,l,f,m,h,M,C=i.length,A=0,z=[],P=[];function k(){return A}function Y(F){throw e.error("Unclosed "+F,A)}function y(){return P.length===0&&A>=C}function p(F){if(P.length)return P.pop();if(A>=C)return;let b=F?F.ignoreUnclosed:!1;switch(o=i.charCodeAt(A),o){case 10:case 32:case 9:case 13:case 12:{u=A;do u+=1,o=i.charCodeAt(u);while(o===32||o===10||o===9||o===13||o===12);l=["space",i.slice(A,u)],A=u-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let N=String.fromCharCode(o);l=[N,N,A];break}case 40:{if(M=z.length?z.pop()[1]:"",h=i.charCodeAt(A+1),M==="url"&&h!==39&&h!==34&&h!==32&&h!==10&&h!==9&&h!==12&&h!==13){u=A;do{if(f=!1,u=i.indexOf(")",u+1),u===-1)if(r||b){u=A;break}else Y("bracket");for(m=u;i.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);l=["brackets",i.slice(A,u+1),A,u],A=u}else u=i.indexOf(")",A+1),s=i.slice(A,u+1),u===-1||ws.test(s)?l=["(","(",A]:(l=["brackets",s,A,u],A=u);break}case 39:case 34:{a=o===39?"\'":\'"\',u=A;do{if(f=!1,u=i.indexOf(a,u+1),u===-1)if(r||b){u=A+1;break}else Y("string");for(m=u;i.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);l=["string",i.slice(A,u+1),A,u],A=u;break}case 64:{Wt.lastIndex=A+1,Wt.test(i),Wt.lastIndex===0?u=i.length-1:u=Wt.lastIndex-2,l=["at-word",i.slice(A,u+1),A,u],A=u;break}case 92:{for(u=A,c=!0;i.charCodeAt(u+1)===92;)u+=1,c=!c;if(o=i.charCodeAt(u+1),c&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(u+=1,dr.test(i.charAt(u)))){for(;dr.test(i.charAt(u+1));)u+=1;i.charCodeAt(u+1)===32&&(u+=1)}l=["word",i.slice(A,u+1),A,u],A=u;break}default:{o===47&&i.charCodeAt(A+1)===42?(u=i.indexOf("*/",A+2)+1,u===0&&(r||b?u=i.length:Y("comment")),l=["comment",i.slice(A,u+1),A,u],A=u):(Ht.lastIndex=A+1,Ht.test(i),Ht.lastIndex===0?u=i.length-1:u=Ht.lastIndex-2,l=["word",i.slice(A,u+1),A,u],z.push(l),A=u);break}}return A++,l}function S(F){P.push(F)}return{back:S,endOfFile:y,nextToken:p,position:k}}});var gr=K((Au,xr)=>{"use strict";var Cs=Rt(),Ms=ft(),Ds=pt(),ks=Ke(),pr=Pt(),Ls=mr(),hr={empty:!0,space:!0};function Rs(n){for(let e=n.length-1;e>=0;e--){let t=n[e],i=t[3]||t[2];if(i)return i}}var wn=class{constructor(e){this.input=e,this.root=new ks,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Cs;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let i,r,o,s=!1,c=!1,u=[],a=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),i=e[0],i==="("||i==="["?a.push(i==="("?")":"]"):i==="{"&&a.length>0?a.push("}"):i===a[a.length-1]&&a.pop(),a.length===0)if(i===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){c=!0;break}else if(i==="}"){if(u.length>0){for(o=u.length-1,r=u[o];r&&r[0]==="space";)r=u[--o];r&&(t.source.end=this.getPosition(r[3]||r[2]),t.source.end.offset++)}this.end(e);break}else u.push(e);else u.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(u),u.length?(t.raws.afterName=this.spacesAndCommentsFromStart(u),this.raw(t,"params",u),s&&(e=u[u.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),c&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let i=0,r;for(let o=t-1;o>=0&&(r=e[o],!(r[0]!=="space"&&(i+=1,i===2)));o--);throw this.input.error("Missed semicolon",r[0]==="word"?r[3]+1:r[2])}colon(e){let t=0,i,r,o;for(let[s,c]of e.entries()){if(r=c,o=r[0],o==="("&&(t+=1),o===")"&&(t-=1),t===0&&o===":")if(!i)this.doubleColon(r);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=r}return!1}comment(e){let t=new Ms;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let i=e[1].slice(2,-2);if(!i.trim())t.text="",t.raws.left=i,t.raws.right="";else{let r=i.match(/^(\\s*)([^]*\\S)(\\s*)$/);t.text=r[2],t.raws.left=r[1],t.raws.right=r[3]}}createTokenizer(){this.tokenizer=Ls(this.input)}decl(e,t){let i=new Ds;this.init(i,e[0][2]);let r=e[e.length-1];for(r[0]===";"&&(this.semicolon=!0,e.pop()),i.source.end=this.getPosition(r[3]||r[2]||Rs(e)),i.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),i.raws.before+=e.shift()[1];for(i.source.start=this.getPosition(e[0][2]),i.prop="";e.length;){let a=e[0][0];if(a===":"||a==="space"||a==="comment")break;i.prop+=e.shift()[1]}i.raws.between="";let o;for(;e.length;)if(o=e.shift(),o[0]===":"){i.raws.between+=o[1];break}else o[0]==="word"&&/\\w/.test(o[1])&&this.unknownWord([o]),i.raws.between+=o[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let s=[],c;for(;e.length&&(c=e[0][0],!(c!=="space"&&c!=="comment"));)s.push(e.shift());this.precheckMissedSemicolon(e);for(let a=e.length-1;a>=0;a--){if(o=e[a],o[1].toLowerCase()==="!important"){i.important=!0;let l=this.stringFrom(e,a);l=this.spacesFromEnd(e)+l,l!==" !important"&&(i.raws.important=l);break}else if(o[1].toLowerCase()==="important"){let l=e.slice(0),f="";for(let m=a;m>0;m--){let h=l[m][0];if(f.trim().startsWith("!")&&h!=="space")break;f=l.pop()[1]+f}f.trim().startsWith("!")&&(i.important=!0,i.raws.important=f,e=l)}if(o[0]!=="space"&&o[0]!=="comment")break}e.some(a=>a[0]!=="space"&&a[0]!=="comment")&&(i.raws.between+=s.map(a=>a[1]).join(""),s=[]),this.raw(i,"value",s.concat(e),t),i.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new pr;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){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(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}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(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,i=null,r=!1,o=null,s=[],c=e[1].startsWith("--"),u=[],a=e;for(;a;){if(i=a[0],u.push(a),i==="("||i==="[")o||(o=a),s.push(i==="("?")":"]");else if(c&&r&&i==="{")o||(o=a),s.push("}");else if(s.length===0)if(i===";")if(r){this.decl(u,c);return}else break;else if(i==="{"){this.rule(u);return}else if(i==="}"){this.tokenizer.back(u.pop()),t=!0;break}else i===":"&&(r=!0);else i===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));a=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),s.length>0&&this.unclosedBracket(o),t&&r){if(!c)for(;u.length&&(a=u[u.length-1][0],!(a!=="space"&&a!=="comment"));)this.tokenizer.back(u.pop());this.decl(u,c)}else this.unknownWord(u)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,i,r){let o,s,c=i.length,u="",a=!0,l,f;for(let m=0;m<c;m+=1)o=i[m],s=o[0],s==="space"&&m===c-1&&!r?a=!1:s==="comment"?(f=i[m-1]?i[m-1][0]:"empty",l=i[m+1]?i[m+1][0]:"empty",!hr[f]&&!hr[l]?u.slice(-1)===","?a=!1:u+=o[1]:a=!1):u+=o[1];if(!a){let m=i.reduce((h,M)=>h+M[1],"");e.raws[t]={raw:m,value:u}}e[t]=u}rule(e){e.pop();let t=new pr;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)i=e.pop()[1]+i;return i}spacesAndCommentsFromStart(e){let t,i="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)i+=e.shift()[1];return i}spacesFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],t==="space");)i=e.pop()[1]+i;return i}stringFrom(e,t){let i="";for(let r=t;r<e.length;r++)i+=e[r][1];return e.splice(t,e.length-t),i}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word "+e[0][1],{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};xr.exports=wn});var qt=K((Eu,Sr)=>{"use strict";var Ts=ve(),vs=xt(),Bs=gr();function Ut(n,e){let t=new vs(n,e),i=new Bs(t);try{i.parse()}catch(r){throw r}return i.root}Sr.exports=Ut;Ut.default=Ut;Ts.registerParse(Ut)});var Cn=K((Fu,yr)=>{"use strict";var yt=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let i=t.node.rangeBy(t);this.line=i.start.line,this.column=i.start.column,this.endLine=i.end.line,this.endColumn=i.end.column}for(let i in t)this[i]=t[i]}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}};yr.exports=yt;yt.default=yt});var zt=K((bu,Ar)=>{"use strict";var Os=Cn(),At=class{get content(){return this.css}constructor(e,t,i){this.processor=e,this.messages=[],this.root=t,this.opts=i,this.css="",this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let i=new Os(e,t);return this.messages.push(i),i}warnings(){return this.messages.filter(e=>e.type==="warning")}};Ar.exports=At;At.default=At});var Mn=K((Nu,Fr)=>{"use strict";var Er={};Fr.exports=function(e){Er[e]||(Er[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))}});var Ln=K((Cu,Cr)=>{"use strict";var Ps=ve(),_s=Tt(),Is=Nn(),Ws=qt(),br=zt(),Hs=Ke(),Us=lt(),{isClean:De,my:qs}=Lt(),wu=Mn(),zs={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},js={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},Gs={Once:!0,postcssPlugin:!0,prepare:!0},Qe=0;function Et(n){return typeof n=="object"&&typeof n.then=="function"}function wr(n){let e=!1,t=zs[n.type];return n.type==="decl"?e=n.prop.toLowerCase():n.type==="atrule"&&(e=n.name.toLowerCase()),e&&n.append?[t,t+"-"+e,Qe,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:n.append?[t,Qe,t+"Exit"]:[t,t+"Exit"]}function Nr(n){let e;return n.type==="document"?e=["Document",Qe,"DocumentExit"]:n.type==="root"?e=["Root",Qe,"RootExit"]:e=wr(n),{eventIndex:0,events:e,iterator:0,node:n,visitorIndex:0,visitors:[]}}function Dn(n){return n[De]=!1,n.nodes&&n.nodes.forEach(e=>Dn(e)),n}var kn={},Oe=class n{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(e,t,i){this.stringified=!1,this.processed=!1;let r;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))r=Dn(t);else if(t instanceof n||t instanceof br)r=Dn(t.root),t.map&&(typeof i.map>"u"&&(i.map={}),i.map.inline||(i.map.inline=!1),i.map.prev=t.map);else{let o=Ws;i.syntax&&(o=i.syntax.parse),i.parser&&(o=i.parser),o.parse&&(o=o.parse);try{r=o(t,i)}catch(s){this.processed=!0,this.error=s}r&&!r[qs]&&Ps.rebuild(r)}this.result=new br(e,r,i),this.helpers={...kn,postcss:kn,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(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let i=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=i.postcssPlugin,e.setMessage()):i.postcssVersion}catch(r){console&&console.error&&console.error(r)}return e}prepareVisitors(){this.listeners={};let e=(t,i,r)=>{this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push([t,r])};for(let t of this.plugins)if(typeof t=="object")for(let i in t){if(!js[i]&&/^[A-Z]/.test(i))throw new Error(`Unknown event ${i} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Gs[i])if(typeof t[i]=="object")for(let r in t[i])r==="*"?e(t,i,t[i][r]):e(t,i+"-"+r.toLowerCase(),t[i][r]);else typeof t[i]=="function"&&e(t,i,t[i])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],i=this.runOnRoot(t);if(Et(i))try{await i}catch(r){throw this.handleError(r)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[De];){e[De]=!0;let t=[Nr(e)];for(;t.length>0;){let i=this.visitTick(t);if(Et(i))try{await i}catch(r){let o=t[t.length-1].node;throw this.handleError(r,o)}}}if(this.listeners.OnceExit)for(let[t,i]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let r=e.nodes.map(o=>i(o,this.helpers));await Promise.all(r)}else await i(e,this.helpers)}catch(r){throw this.handleError(r)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(i=>e.Once(i,this.helpers));return Et(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Us;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new Is(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[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 e of this.plugins){let t=this.runOnRoot(e);if(Et(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[De];)e[De]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[i,r]of e){this.result.lastPlugin=i;let o;try{o=r(t,this.helpers)}catch(s){throw this.handleError(s,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(Et(o))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:i,visitors:r}=t;if(i.type!=="root"&&i.type!=="document"&&!i.parent){e.pop();return}if(r.length>0&&t.visitorIndex<r.length){let[s,c]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=s;try{return c(i.toProxy(),this.helpers)}catch(u){throw this.handleError(u,i)}}if(t.iterator!==0){let s=t.iterator,c;for(;c=i.nodes[i.indexes[s]];)if(i.indexes[s]+=1,!c[De]){c[De]=!0,e.push(Nr(c));return}t.iterator=0,delete i.indexes[s]}let o=t.events;for(;t.eventIndex<o.length;){let s=o[t.eventIndex];if(t.eventIndex+=1,s===Qe){i.nodes&&i.nodes.length&&(i[De]=!0,t.iterator=i.getIterator());return}else if(this.listeners[s]){t.visitors=this.listeners[s];return}}e.pop()}walkSync(e){e[De]=!0;let t=wr(e);for(let i of t)if(i===Qe)e.nodes&&e.each(r=>{r[De]||this.walkSync(r)});else{let r=this.listeners[i];if(r&&this.visitSync(r,e.toProxy()))return}}warnings(){return this.sync().warnings()}};Oe.registerPostcss=n=>{kn=n};Cr.exports=Oe;Oe.default=Oe;Hs.registerLazyResult(Oe);_s.registerLazyResult(Oe)});var Dr=K((Du,Mr)=>{"use strict";var $s=Nn(),Vs=qt(),Ks=zt(),Js=lt(),Mu=Mn(),Ft=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 e,t=Vs;try{e=t(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(e,t,i){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=i,this._map=void 0;let r=Js;this.result=new Ks(this._processor,void 0,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let s=new $s(r,void 0,this._opts,t);if(s.isMap()){let[c,u]=s.generate();c&&(this.result.css=c),u&&(this.result.map=u)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}};Mr.exports=Ft;Ft.default=Ft});var Lr=K((ku,kr)=>{"use strict";var Qs=Tt(),Ys=Ln(),Zs=Dr(),Xs=Ke(),qe=class{constructor(e=[]){this.version="8.5.8",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let i of e)if(i.postcss===!0?i=i():i.postcss&&(i=i.postcss),typeof i=="object"&&Array.isArray(i.plugins))t=t.concat(i.plugins);else if(typeof i=="object"&&i.postcssPlugin)t.push(i);else if(typeof i=="function")t.push(i);else if(!(typeof i=="object"&&(i.parse||i.stringify)))throw new Error(i+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Zs(this,e,t):new Ys(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};kr.exports=qe;qe.default=qe;Xs.registerProcessor(qe);Qs.registerProcessor(qe)});var Ir=K((Lu,_r)=>{"use strict";var Rr=Rt(),Tr=ft(),el=ve(),tl=kt(),vr=pt(),Br=Tt(),nl=rr(),il=xt(),rl=Ln(),ol=Fn(),sl=ct(),ll=qt(),Rn=Lr(),al=zt(),Or=Ke(),Pr=Pt(),ul=lt(),cl=Cn();function te(...n){return n.length===1&&Array.isArray(n[0])&&(n=n[0]),new Rn(n)}te.plugin=function(e,t){let i=!1;function r(...s){console&&console.warn&&!i&&(i=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let c=t(...s);return c.postcssPlugin=e,c.postcssVersion=new Rn().version,c}let o;return Object.defineProperty(r,"postcss",{get(){return o||(o=r()),o}}),r.process=function(s,c,u){return te([r(u)]).process(s,c)},r};te.stringify=ul;te.parse=ll;te.fromJSON=nl;te.list=ol;te.comment=n=>new Tr(n);te.atRule=n=>new Rr(n);te.decl=n=>new vr(n);te.rule=n=>new Pr(n);te.root=n=>new Or(n);te.document=n=>new Br(n);te.CssSyntaxError=tl;te.Declaration=vr;te.Container=el;te.Processor=Rn;te.Document=Br;te.Comment=Tr;te.Warning=cl;te.AtRule=Rr;te.Result=al;te.Input=il;te.Rule=Pr;te.Root=Or;te.Node=sl;rl.registerPostcss(te);_r.exports=te;te.default=te});function ge(n){try{window.parent.postMessage(n,"*")}catch{}}function Qn(n){let e=t=>{let i=t.data;if(!i||i.source!=="hf-parent"||i.type!=="control")return;let r=i.action;if(r==="play"){n.onPlay();return}if(r==="pause"){n.onPause();return}if(r==="seek"){n.onSeek(Number(i.frame??0),i.seekMode??"commit");return}if(r==="set-muted"){n.onSetMuted(!!i.muted);return}if(r==="set-media-output-muted"){n.onSetMediaOutputMuted(!!i.muted);return}if(r==="set-playback-rate"){n.onSetPlaybackRate(Number(i.playbackRate??1));return}if(r==="enable-pick-mode"){n.onEnablePickMode();return}if(r==="disable-pick-mode"){n.onDisablePickMode();return}if(r==="flash-elements"){let o=i.selectors,s=i.duration||800;o&&Ro(o,s)}};return window.addEventListener("message",e),e}function Ro(n,e){if(!document.getElementById("__hf-flash-styles")){let t=document.createElement("style");t.id="__hf-flash-styles",t.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 ${e}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(t)}for(let t of n)try{document.querySelectorAll(t).forEach(r=>{r.classList.add("__hf-flash"),setTimeout(()=>r.classList.remove("__hf-flash"),e)})}catch{}}var tn=null;function Yn(n){tn=n}function nt(n,e){if(tn)try{tn({source:"hf-preview",type:"analytics",event:n,properties:e??{}})}catch{}}function Zn(n){let e=[],t=c=>{if(typeof c.getAnimations!="function")return[];try{return c.getAnimations()}catch{return[]}},i=(c,u)=>{for(let a of c){try{a.currentTime=u}catch{}try{a.pause()}catch{}}},r=c=>{for(let u of c)try{u.play()}catch{}},o=c=>{for(let u of c)try{u.pause()}catch{}},s=c=>{c.baseDelay?c.el.style.animationDelay=c.baseDelay:c.el.style.removeProperty("animation-delay"),c.basePlayState?c.el.style.animationPlayState=c.basePlayState:c.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{e=[];let c=document.querySelectorAll("*");for(let u of c){if(!(u instanceof HTMLElement))continue;let a=window.getComputedStyle(u);!a.animationName||a.animationName==="none"||e.push({el:u,baseDelay:u.style.animationDelay||"",basePlayState:u.style.animationPlayState||""})}},seek:c=>{let u=Number(c.time)||0;for(let a of e){if(!a.el.isConnected)continue;let l=n?.resolveStartSeconds?n.resolveStartSeconds(a.el):Number.parseFloat(a.el.getAttribute("data-start")??"0")||0,f=Math.max(0,u-l)*1e3,m=t(a.el);if(m.length>0){i(m,f);continue}a.el.style.animationPlayState="paused",a.el.style.animationDelay=`-${(f/1e3).toFixed(3)}s`}},pause:()=>{for(let c of e){if(!c.el.isConnected)continue;let u=t(c.el);u.length>0&&o(u),s(c)}},play:()=>{for(let c of e)c.el.isConnected&&(s(c),r(t(c.el)))},revert:()=>{e=[]}}}function Xn(n){return{name:"gsap",discover:()=>{},seek:e=>{let t=n.getTimeline();if(!t)return;t.pause();let i=Math.max(0,Number(e.time)||0);typeof t.totalTime=="function"?t.totalTime(i,!1):t.seek(i,!1)},pause:()=>{let e=n.getTimeline();e&&e.pause()}}}function ni(){return{name:"lottie",discover:()=>{try{let n=window.lottie;if(n&&typeof n.getRegisteredAnimations=="function"){let e=n.getRegisteredAnimations();if(Array.isArray(e)&&e.length>0){let t=window.__hfLottie??[],i=new Set(t);for(let r of e)i.has(r)||t.push(r);window.__hfLottie=t}}}catch{}},seek:n=>{let e=Math.max(0,Number(n.time)||0),t=window.__hfLottie;if(!(!t||t.length===0))for(let i of t)try{if(ei(i))i.goToAndStop(e*1e3,!1);else if(ti(i)){if(typeof i.setCurrentRawFrameValue=="function"){let r=i.totalFrames??0,o=i.frameRate??30,s=e*o;r>0&&i.setCurrentRawFrameValue(Math.min(s,r-1))}else if(typeof i.seek=="function"){let r=i.duration??1,o=Math.min(100,e/r*100);i.seek(o)}}}catch{}},pause:()=>{let n=window.__hfLottie;if(!(!n||n.length===0))for(let e of n)try{(ei(e)||ti(e))&&e.pause()}catch{}},revert:()=>{}}}function ei(n){return typeof n=="object"&&n!==null&&typeof n.goToAndStop=="function"}function ti(n){return typeof n=="object"&&n!==null&&typeof n.pause=="function"&&("totalFrames"in n||"duration"in n)}function ii(){let n=null,e=0;return{name:"three",discover:()=>{},seek:t=>{n=Math.max(0,Number(t.time)||0),e=n,window.__hfThreeTime=n;try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:{time:n}}))}catch{}},pause:()=>{n==null&&(n=Math.max(0,e))},play:()=>{n=null},revert:()=>{n=null,e=0}}}function ri(){return{name:"waapi",discover:()=>{},seek:n=>{if(!document.getAnimations)return;let e=Math.max(0,(Number(n.time)||0)*1e3);for(let t of document.getAnimations()){try{t.currentTime=e}catch{}try{t.pause()}catch{}}},pause:()=>{if(document.getAnimations)for(let n of document.getAnimations())try{n.pause()}catch{}}}}function oi(n){let e=Array.from(document.querySelectorAll("video, audio")),t=n?.shouldIncludeElement?e.filter(s=>n.shouldIncludeElement?.(s)):e.filter(s=>s.hasAttribute("data-start")),i=[],r=[],o=0;for(let s of t){let c=n?.resolveStartSeconds?n.resolveStartSeconds(s):Number.parseFloat(s.dataset.start??"0");if(!Number.isFinite(c))continue;let u=Number.parseFloat(s.dataset.playbackStart??s.dataset.mediaStart??"0")||0,a=s.defaultPlaybackRate,l=Number.isFinite(a)&&a>0?Math.max(.1,Math.min(5,a)):1,f=s.loop,m=Number.isFinite(s.duration)&&s.duration>0?s.duration:null,h=n?.resolveDurationSeconds?.(s)??Number.parseFloat(s.dataset.duration??"");(!Number.isFinite(h)||h<=0)&&m!=null&&(h=Math.max(0,(m-u)/l));let M=Number.isFinite(h)&&h>0?c+h:Number.POSITIVE_INFINITY,C=Number.parseFloat(s.dataset.volume??""),A={el:s,start:c,mediaStart:u,duration:Number.isFinite(h)&&h>0?h:Number.POSITIVE_INFINITY,end:M,volume:Number.isFinite(C)?C:null,playbackRate:l,loop:f,sourceDuration:m};i.push(A),s.tagName==="VIDEO"&&r.push(A),Number.isFinite(M)&&(o=Math.max(o,M))}return{timedMediaEls:t,mediaClips:i,videoClips:r,maxMediaEnd:o}}var nn=new WeakMap,it=new WeakSet;function To(n){if(it.has(n))return;it.add(n);let e=()=>it.delete(n);n.addEventListener("playing",e,{once:!0}),n.addEventListener("pause",e,{once:!0}),n.addEventListener("error",e,{once:!0})}function si(n){let e=!!(n.outputMuted||n.userMuted);for(let t of n.clips){let{el:i}=t;if(!i.isConnected)continue;let r=(n.timeSeconds-t.start)*t.playbackRate+t.mediaStart;if(n.timeSeconds>=t.start&&n.timeSeconds<t.end&&r>=0){if(t.loop&&t.sourceDuration!=null&&t.sourceDuration>0){let h=t.sourceDuration-t.mediaStart;h>0&&r>=t.sourceDuration&&(r=t.mediaStart+(r-t.mediaStart)%h)}t.volume!=null&&(i.volume=t.volume),e&&(i.muted=!0);try{i.playbackRate=t.playbackRate*n.playbackRate}catch{}let s=i.currentTime||0,c=Math.abs(s-r),u=r-s,a=nn.get(i);nn.set(i,u);let l=a===void 0,f=!l&&Math.abs(u-a)>.5,m=c>3;if(c>.5&&(l||f||m))try{i.currentTime=r}catch{}n.playing&&i.paused&&!it.has(i)?(i.preload!=="auto"&&(i.preload="auto"),To(i),i.play().catch(h=>{it.delete(i),(h&&typeof h=="object"&&"name"in h?String(h.name??""):"")==="NotAllowedError"&&n.onAutoplayBlocked?.()})):!n.playing&&!i.paused&&i.pause();continue}nn.delete(i),i.paused||i.pause()}}function li(n){let e=!1,t=null,i=null,r=null,o=null;function s(y,p){try{window.dispatchEvent(new CustomEvent(y,{detail:p}))}catch{}}function c(y){r=y,s("hyperframe:picker:hovered",{elementInfo:r,isPickMode:e,timestamp:Date.now()})}function u(y){o=y,s("hyperframe:picker:selected",{elementInfo:o,isPickMode:e,timestamp:Date.now()})}function a(y){if(!y||y===document.body||y===document.documentElement)return!1;let p=y.tagName.toLowerCase();return!(p==="script"||p==="style"||p==="link"||p==="meta"||y.classList.contains("__hf-pick-highlight"))}function l(y){let p=y;if(p.id)return`#${p.id}`;let S=y.getAttribute("data-composition-id");if(S)return`[data-composition-id="${S}"]`;let F=y.getAttribute("data-composition-src");if(F)return`[data-composition-src="${F}"]`;let b=y.getAttribute("data-track-index");if(b)return`[data-track-index="${b}"]`;let N=y.tagName.toLowerCase(),B=y.parentElement;if(!B)return N;let W=B.querySelectorAll(`:scope > ${N}`);if(W.length===1)return N;for(let H=0;H<W.length;H+=1)if(W[H]===y)return`${N}:nth-of-type(${H+1})`;return N}function f(y){let p=y.tagName.toLowerCase(),S=(y.textContent??"").trim().replace(/\\s+/g," "),F=(b,N)=>b.length>N?`${b.slice(0,N-1)}\\u2026`:b;return p==="h1"||p==="h2"||p==="h3"?"Heading":p==="p"||p==="span"||p==="div"?S.length>0?F(S,56):"Text":p==="img"?"Image":p==="video"?"Video":p==="audio"?"Audio":p==="svg"?"Shape":y.getAttribute("data-composition-src")?"Composition":p==="section"?"Section":`${p.charAt(0).toUpperCase()}${p.slice(1)}`}function m(y,p,S){let F=typeof S=="number"&&S>0?S:8,b=[];if(document.elementsFromPoint)b=document.elementsFromPoint(y,p);else if(document.elementFromPoint){let W=document.elementFromPoint(y,p);b=W?[W]:[]}let N={},B=[];for(let W=0;W<b.length;W+=1){let H=b[W];if(!a(H))continue;let X=`${H.tagName}::${H.id||""}::${W}`;if(!N[X]&&(N[X]=!0,B.push(H),B.length>=F))break}return B}function h(y){let p=y.getBoundingClientRect(),S={};for(let b=0;b<y.attributes.length;b+=1){let N=y.attributes[b];N.name.startsWith("data-")&&(S[N.name]=N.value)}return{id:y.id||null,tagName:y.tagName.toLowerCase(),selector:l(y),label:f(y),boundingBox:{x:p.left,y:p.top,width:p.width,height:p.height},textContent:y.textContent?y.textContent.trim().slice(0,200):null,src:y.getAttribute("src")||y.getAttribute("data-composition-src")||null,dataAttributes:S}}function M(y,p,S){return m(y,p,S).map(h)}function C(y){if(!e)return;let S=m(y.clientX,y.clientY,1)[0]??(y.target instanceof Element?y.target:null);if(!a(S)||t===S)return;t&&t.classList.remove("__hf-pick-highlight"),t=S,S.classList.add("__hf-pick-highlight");let F=h(S);c(F),n.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:F})}function A(y){if(!e)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();let p=M(y.clientX,y.clientY,8);p.length!==0&&(c(p[0]??null),n.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:p,selectedIndex:0,point:{x:y.clientX,y:y.clientY}}))}function z(y){y.key==="Escape"&&(k(),n.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function P(){e||(e=!0,i=document.createElement("style"),i.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(i),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",C,!0),document.addEventListener("click",A,!0),document.addEventListener("keydown",z,!0),s("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function k(){e&&(e=!1,t&&(t.classList.remove("__hf-pick-highlight"),t=null),i&&(i.remove(),i=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",C,!0),document.removeEventListener("click",A,!0),document.removeEventListener("keydown",z,!0),s("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function Y(){window.__HF_PICKER_API={enable:P,disable:k,isActive:()=>e,getHovered:()=>r,getSelected:()=>o,getCandidatesAtPoint:(y,p,S)=>Number.isFinite(y)&&Number.isFinite(p)?M(y,p,S):[],pickAtPoint:(y,p,S)=>{if(!Number.isFinite(y)||!Number.isFinite(p))return null;let F=M(y,p,8);if(!F.length)return null;let b=Math.max(0,Math.min(F.length-1,Number(S??0))),N=F[b]??null;return N?(u(N),n.postMessage({source:"hf-preview",type:"element-picked",elementInfo:N}),k(),N):null},pickManyAtPoint:(y,p,S)=>{if(!Number.isFinite(y)||!Number.isFinite(p))return[];let F=M(y,p,8);if(!F.length)return[];let b=[],N=Array.isArray(S)?S:[0];for(let B of N){let W=Math.max(0,Math.min(F.length-1,Math.floor(Number(B)))),H=F[W];if(!H)continue;b.some(R=>R.selector===H.selector&&R.tagName===H.tagName)||b.push(H)}return b.length?(u(b[0]??null),n.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:b}),k(),b):[]}},s("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:P,disablePickMode:k,installPickerApi:Y}}function rn(n,e){let t=Number.isFinite(e)&&e>0?e:30,i=Number.isFinite(n)&&n>0?n:0;return Math.floor(i*t+1e-9)/t}function Dt(n,e,t){if(n){for(let i of Object.values(n))if(!(!i||i===e))try{t(i)}catch{}}}function ai(n,e,t){let i=rn(e,t);return n.pause(),typeof n.totalTime=="function"?n.totalTime(i,!1):n.seek(i,!1),i}function vo(n,e,t,i){let r=[];Dt(n,e,o=>{o.play(),r.push(o)});try{return ai(e,t,i)}finally{for(let o of r)try{o.pause()}catch{}}}function Bo(n,e){Dt(n,e,t=>{t.play()})}function ui(n){return{_timeline:null,play:()=>{let e=n.getTimeline();if(!e||n.getIsPlaying())return;let t=Math.max(0,Number(n.getSafeDuration?.()??e.duration()??0)||0);t>0&&Math.max(0,Number(e.time())||0)>=t&&(e.pause(),e.seek(0,!1),n.onDeterministicSeek(0),n.setIsPlaying(!1),n.onSyncMedia(0,!1),n.onRenderFrameSeek(0)),typeof e.timeScale=="function"&&e.timeScale(n.getPlaybackRate()),e.play(),Dt(n.getTimelineRegistry?.(),e,i=>{typeof i.timeScale=="function"&&i.timeScale(n.getPlaybackRate()),i.play()}),n.onDeterministicPlay(),n.setIsPlaying(!0),n.onShowNativeVideos(),n.onStatePost(!0)},pause:()=>{let e=n.getTimeline();if(!e)return;e.pause(),Dt(n.getTimelineRegistry?.(),e,i=>{i.pause()});let t=Math.max(0,Number(e.time())||0);n.onDeterministicSeek(t),n.onDeterministicPause(),n.setIsPlaying(!1),n.onSyncMedia(t,!1),n.onRenderFrameSeek(t),n.onStatePost(!0)},seek:e=>{let t=n.getTimeline();if(!t)return;let i=Math.max(0,Number(e)||0),r=vo(n.getTimelineRegistry?.(),t,i,n.getCanonicalFps());n.onDeterministicSeek(r),n.setIsPlaying(!1),n.onSyncMedia(r,!1),n.onRenderFrameSeek(r),n.onStatePost(!0)},renderSeek:e=>{let t=n.getTimeline(),i=n.getCanonicalFps(),r=t?(Bo(n.getTimelineRegistry?.(),t),ai(t,e,i)):rn(Math.max(0,Number(e)||0),i);n.onDeterministicSeek(r),n.setIsPlaying(!1),n.onSyncMedia(r,!1),n.onRenderFrameSeek(r),n.onStatePost(!0)},getTime:()=>Number(n.getTimeline()?.time()??0),getDuration:()=>Number(n.getTimeline()?.duration()??0),isPlaying:()=>n.getIsPlaying(),setPlaybackRate:e=>n.setPlaybackRate(e),getPlaybackRate:()=>n.getPlaybackRate()}}function ci(){return{capturedTimeline:null,isPlaying:!1,rafId:null,currentTime:0,deterministicAdapters:[],parityModeEnabled:!0,canonicalFps:30,bridgeMuted:!1,mediaOutputMuted:!1,mediaAutoplayBlockedPosted:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,timelinePollIntervalId:null,controlBridgeHandler:null,clampDurationLoggedRaw:null,beforeUnloadHandler:null,domReadyHandler:null,injectedCompStyles:[],injectedCompScripts:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,maxTimelineDurationSeconds:1800,nativeVisualWatchdogTick:0}}var Oo="data-hf-authored-duration",Po="data-hf-authored-end";function We(n){if(n==null||n==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}function _o(n){return We(n.getAttribute("data-duration"))}function Io(n){return We(n.getAttribute("data-end"))}function Wo(n){return We(n.getAttribute(Oo))}function Ho(n){return We(n.getAttribute(Po))}function Uo(n){let e=(n??"").trim();if(!e)return null;let t=We(e);if(t!=null)return{kind:"absolute",value:t};let i=e.match(/^([A-Za-z0-9_.:-]+)(?:\\s*([+-])\\s*([0-9]*\\.?[0-9]+))?$/);if(!i)return null;let r=(i[1]??"").trim();if(!r)return null;let o=i[2]??"+",s=i[3]??"0",c=Number.parseFloat(s),u=Number.isFinite(c)?Math.max(0,c):0,a=o==="-"?-u:u;return{kind:"reference",refId:r,offset:a}}function He(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=new WeakMap,r=new WeakMap,o=new Set,s=l=>{let f=document.getElementById(l);return f||(document.querySelector(`[data-composition-id="${CSS.escape(l)}"]`)??null)},c=l=>{let f=r.get(l);if(f!==void 0)return f;let m=null,h=_o(l)??(t?Wo(l):null);if(h!=null&&h>0&&(m=h),m==null||m<=0){let M=Io(l)??(t?Ho(l):null);if(M!=null){let C=a(l,0),A=M-C;Number.isFinite(A)&&A>0&&(m=A)}}if((m==null||m<=0)&&l instanceof HTMLMediaElement){let M=We(l.getAttribute("data-playback-start"))??We(l.getAttribute("data-media-start"))??0;Number.isFinite(l.duration)&&l.duration>M&&(m=l.duration-M)}if(m==null||m<=0){let M=l.getAttribute("data-composition-id");if(M){let C=e[M]??null;if(C&&typeof C.duration=="function")try{let A=Number(C.duration());Number.isFinite(A)&&A>0&&(m=A)}catch{}}}return m!=null&&Number.isFinite(m)&&m>0?(r.set(l,m),m):(r.set(l,null),null)},u=(l,f)=>{if(l.hasAttribute("data-composition-id")){let h=l.parentElement?.closest("[data-composition-id]");return h?a(h,f):0}let m=l.closest("[data-composition-id]");return m?a(m,f):0},a=(l,f)=>{let m=i.get(l);if(m!==void 0)return m??f;if(o.has(l))return f;o.add(l);try{let h=Uo(l.getAttribute("data-start"));if(!h){if(l.hasAttribute("data-composition-id")){let P=l.parentElement;if(P&&(P.hasAttribute("data-composition-src")||P.hasAttribute("data-composition-id"))){let k=a(P,f);return i.set(l,k),k}}return i.set(l,f),f}if(h.kind==="absolute"){let P=Math.max(0,h.value),k=Math.max(0,u(l,f)+P);return i.set(l,k),k}let M=s(h.refId);if(!M)return i.set(l,f),f;let C=a(M,0),A=c(M);if(A==null||A<=0){let P=Math.max(0,C+h.offset);return i.set(l,P),P}let z=Math.max(0,C+A+h.offset);return i.set(l,z),z}finally{o.delete(l)}};return{resolveStartForElement:(l,f=0)=>a(l,Math.max(0,f)),resolveDurationForElement:l=>c(l)}}var qo="data-hf-authored-duration",zo="data-hf-authored-end";function Se(n){if(n==null||n==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}function on(n){return Se(n.getAttribute("data-duration"))??Se(n.getAttribute(qo))}function di(n){return Se(n.getAttribute("data-end"))??Se(n.getAttribute(zo))}function sn(...n){let e=n.filter(t=>Number.isFinite(t??null));return e.length===0?null:Math.max(...e)}var fi={composition:0,video:1,image:2,element:3,audio:4};function jo(n){if(n.length===0)return;let e=new Map;for(let s of n){let c=e.get(s.track)??new Set;c.add(s.kind),e.set(s.track,c)}if(!Array.from(e.values()).some(s=>s.size>1))return;let i=0,r=new Map,o=[...e.keys()].sort((s,c)=>s-c);for(let s of o){let c=e.get(s);if(c.size===1)r.set(`${s}:${[...c][0]}`,i++);else{let u=[...c].sort((a,l)=>(fi[a]??99)-(fi[l]??99));for(let a of u)r.set(`${s}:${a}`,i++)}}for(let s of n){let c=`${s.track}:${s.kind}`,u=r.get(c);u!=null&&(s.track=u)}}function rt(n){let e=String(n??"").trim();if(!e)return null;let t=e.toLowerCase();if(t.startsWith("data:")||t.startsWith("javascript:"))return null;try{return new URL(e,document.baseURI).toString()}catch{return e}}function Go(n){let e=n.getAttribute("src")??n.getAttribute("data-src");if(e)return rt(e);let t=n.getAttribute("data-composition-src");if(t)return rt(t);let i=n.querySelector("img[src], video[src], audio[src], source[src]");return i?rt(i.getAttribute("src")):null}function mi(n){let t=window.__timelines??{},i=He({timelineRegistry:t,includeAuthoredTimingAttrs:!0}),r=T=>{if(!T)return null;let D=t[T]??null;if(!D||typeof D.duration!="function")return null;try{let L=Number(D.duration());return Number.isFinite(L)&&L>0?L:null}catch{return null}},o=T=>{let D=Se(T.getAttribute("data-duration"));if(D!=null&&D>0)return D;let L=Se(T.getAttribute("data-playback-start"))??Se(T.getAttribute("data-media-start"))??0;return Number.isFinite(T.duration)&&T.duration>L?Math.max(0,T.duration-L):null},s=()=>{let T=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(T.length===0)return null;let D=0;for(let L of T){let Q=i.resolveStartForElement(L,0);if(!Number.isFinite(Q))continue;let ne=o(L);ne==null||ne<=0||(D=Math.max(D,Math.max(0,Q)+ne))}return D>0?D:null},c=T=>{let D=T.trim().toLowerCase();return!(!D||D==="main"||D.includes("caption")||D.includes("ambient"))},u=(T,D)=>{let L=[],Q=null,ne=null,_=null,I=T.parentElement;for(;I;){let j=I.getAttribute("data-composition-id");j&&(L.push(j),!_&&I!==D&&(_=j),Q==null&&(Q=i.resolveStartForElement(I,0)),ne==null&&(ne=Se(I.getAttribute("data-duration"))??r(j)??null)),I=I.parentElement}return{parentCompositionId:_,compositionAncestors:L.reverse(),inheritedStart:Q,inheritedDuration:ne}},a=document.querySelector("[data-composition-id]"),l=Array.from(document.querySelectorAll("[data-composition-id]")),f=a?.getAttribute("data-composition-id")??null,m=a?i.resolveStartForElement(a,0):0,h=s(),M=h!=null?Math.max(0,h-Math.max(0,m)):null,C=r(f),A=on(a??document.body),z=sn(...l.filter(T=>T!==a).map(T=>{let D=i.resolveStartForElement(T,0),L=i.resolveDurationForElement(T)??r(T.getAttribute("data-composition-id"))??null;return!Number.isFinite(D)||L==null||L<=0?null:Math.max(0,D)+L})),P=z!=null?Math.max(0,z-Math.max(0,m)):null,k=typeof C=="number"&&Number.isFinite(C)&&C>0?C:null,Y=typeof A=="number"&&Number.isFinite(A)&&A>0?A:null,y=typeof M=="number"&&Number.isFinite(M)&&M>0?M:null,p=typeof P=="number"&&Number.isFinite(P)&&P>0?P:null,S=sn(y,p),F=k!=null&&S!=null&&k>S+1,b=Y??(F?S:sn(k,y,p)),N=b!=null?Math.min(b,n.maxTimelineDurationSeconds):null,W=(N!=null?m+N:null)??(typeof h=="number"&&Number.isFinite(h)&&h>0?h:null),H=(T,D)=>!Number.isFinite(D)||D<=0?0:W==null||!Number.isFinite(W)?D:!Number.isFinite(T)||T>=W?0:Math.max(0,Math.min(D,W-T)),X=[],R=[],Z=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),ee=0;for(let T=0;T<Z.length;T+=1){let D=Z[T];if(D===a||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(D.tagName))continue;let L=u(D,a),Q=i.resolveStartForElement(D,L.inheritedStart??0),ne=D.getAttribute("data-composition-id"),_=on(D);if((_==null||_<=0)&&ne&&ne!==f&&(_=r(ne)),(_==null||_<=0)&&D instanceof HTMLMediaElement){let ce=Se(D.getAttribute("data-playback-start"))??Se(D.getAttribute("data-media-start"))??0;Number.isFinite(D.duration)&&D.duration>0&&(_=Math.max(0,D.duration-ce))}if(_==null||_<=0){let ce=L.inheritedDuration;if(ce!=null&&ce>0){let Fe=(L.inheritedStart??0)+ce;_=Math.max(0,Fe-Q)}}if(_==null||_<=0||(_=H(Q,_),_<=0))continue;let I=Q+_;ee=Math.max(ee,I);let j=D.tagName.toLowerCase(),Ne=ne&&ne!==f?"composition":j==="video"?"video":j==="audio"?"audio":j==="img"?"image":"element";X.push({id:D.id||ne||`__node__index_${T}`,label:D.getAttribute("data-timeline-label")??D.getAttribute("data-label")??D.getAttribute("aria-label")??ne??D.id??D.className?.split(" ")[0]??Ne,start:Q,duration:_,track:Number.parseInt(D.getAttribute("data-track-index")??D.getAttribute("data-track")??String(T),10)||0,kind:Ne,tagName:j,compositionId:D.getAttribute("data-composition-id"),compositionAncestors:L.compositionAncestors,parentCompositionId:L.parentCompositionId,nodePath:null,compositionSrc:rt(D.getAttribute("data-composition-src")),assetUrl:Go(D),timelineRole:D.getAttribute("data-timeline-role"),timelineLabel:D.getAttribute("data-timeline-label"),timelineGroup:D.getAttribute("data-timeline-group"),timelinePriority:Se(D.getAttribute("data-timeline-priority"))})}let U=new Set(X.map(T=>T.id)),G=a?.getAttribute("data-composition-id")??null,v=G?t[G]??null:null;if(v&&a){let T=v;if(typeof T.getChildren=="function")try{let D=T.getChildren(!0,!0,!1)??[],L=new Map;for(let _ of a.children){let I=_;if(!I.id)continue;let j=I.tagName.toLowerCase();j==="script"||j==="style"||j==="link"||L.set(I,{id:I.id,start:1/0,end:-1/0})}let Q=_=>{let I=_;for(;I;){if(L.has(I))return I;if(I===a)return null;I=I.parentElement}return null};for(let _ of D){if(typeof _.targets!="function"||typeof _.startTime!="function"||typeof _.duration!="function")continue;let I=_.startTime(),j=_.parent;for(;j&&j!==v&&typeof j.startTime=="function";)I+=j.startTime(),j=j.parent;let Ne=I+_.duration();if(!(!Number.isFinite(I)||!Number.isFinite(Ne)))for(let ce of _.targets()){if(!(ce instanceof Element))continue;let ze=Q(ce);if(!ze)continue;let Fe=L.get(ze);Fe&&(Fe.start=Math.min(Fe.start,I),Fe.end=Math.max(Fe.end,Ne))}}let ne=X.length>0?Math.max(...X.map(_=>_.track))+1:0;for(let[_,I]of L){if(I.start===1/0||I.end===-1/0)continue;let j=_;if(U.has(j.id))continue;let Ne=Math.max(0,I.end-I.start);if(Ne<=0)continue;let ce=H(I.start,Ne);ce<=0||(ee=Math.max(ee,I.start+ce),X.push({id:j.id,label:j.getAttribute("data-timeline-label")??j.getAttribute("data-label")??j.getAttribute("aria-label")??j.id,start:I.start,duration:ce,track:Number.parseInt(j.getAttribute("data-track-index")??j.getAttribute("data-track")??"",10)||ne,kind:"element",tagName:j.tagName.toLowerCase(),compositionId:j.getAttribute("data-composition-id"),compositionAncestors:G?[G]:[],parentCompositionId:G,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:j.getAttribute("data-timeline-role"),timelineLabel:j.getAttribute("data-timeline-label"),timelineGroup:j.getAttribute("data-timeline-group"),timelinePriority:Se(j.getAttribute("data-timeline-priority"))}),U.add(j.id))}}catch{}}if(a&&N!=null&&N>0){let T=X.length>0?Math.max(...X.map(D=>D.track))+1:0;for(let D of a.children){let L=D;if(!L.id||U.has(L.id))continue;let Q=L.getAttribute("data-timeline-role");if(Q!=="overlay"&&Q!=="persistent-overlay")continue;let ne=L.tagName.toLowerCase();if(ne==="script"||ne==="style"||ne==="link"||ne==="meta"||window.getComputedStyle(L).display==="none")continue;let I=H(0,N);I<=0||(ee=Math.max(ee,I),X.push({id:L.id,label:L.getAttribute("data-timeline-label")??L.getAttribute("data-label")??L.getAttribute("aria-label")??L.id,start:0,duration:I,track:Number.parseInt(L.getAttribute("data-track-index")??L.getAttribute("data-track")??"",10)||T,kind:"element",tagName:ne,compositionId:L.getAttribute("data-composition-id"),compositionAncestors:G?[G]:[],parentCompositionId:G,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:Q,timelineLabel:L.getAttribute("data-timeline-label"),timelineGroup:L.getAttribute("data-timeline-group"),timelinePriority:Se(L.getAttribute("data-timeline-priority"))}),U.add(L.id))}}jo(X);for(let T of l){if(T===a)continue;let D=T.getAttribute("data-composition-id");if(!D||!c(D))continue;let L=i.resolveStartForElement(T,0),Q=on(T);if((Q==null||Q<=0)&&di(T)!=null){let j=di(T);Q=Math.max(0,j-L)}let ne=r(D),_=Q&&Q>0?Q:ne;if(_==null||_<=0)continue;let I=H(L,_);I<=0||R.push({id:D,label:T.getAttribute("data-label")??D,start:L,duration:I,thumbnailUrl:rt(T.getAttribute("data-thumbnail-url")),avatarName:null})}let J=Math.max(1,Math.min(Math.max(ee||1,N??0),n.maxTimelineDurationSeconds));return{source:"hf-preview",type:"timeline",durationInFrames:F&&Y==null?Number.POSITIVE_INFINITY:Math.max(1,Math.round(J*Math.max(1,n.canonicalFps))),clips:X,scenes:R,compositionWidth:Se(a?.getAttribute("data-width"))??1920,compositionHeight:Se(a?.getAttribute("data-height"))??1080}}var re=Lo(Ir(),1),Wr=re.default,Ru=re.default.stringify,Tu=re.default.fromJSON,vu=re.default.plugin,Bu=re.default.parse,Ou=re.default.list,Pu=re.default.document,_u=re.default.comment,Iu=re.default.atRule,Wu=re.default.rule,Hu=re.default.decl,Uu=re.default.root,qu=re.default.CssSyntaxError,zu=re.default.Declaration,ju=re.default.Container,Gu=re.default.Processor,$u=re.default.Document,Vu=re.default.Comment,Ku=re.default.Warning,Ju=re.default.AtRule,Qu=re.default.Result,Yu=re.default.Input,Zu=re.default.Rule,Xu=re.default.Root,ec=re.default.Node;function Tn(n){return n.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function dl(n){return n.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function fl(n,e,t){let i=ml(n,e,t),r=i.trim();if(!r||/^(html|body|:root|\\*)$/i.test(r))return n;if(new RegExp(`data-composition-id\\\\s*=\\\\s*(["\'])${Tn(t)}\\\\1`).test(r))return i;let s=i.match(/^\\s*/)?.[0]??"",c=i.match(/\\s*$/)?.[0]??"";return`${s}${e} ${r}${c}`}function ml(n,e,t){let i=Tn(t),r=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${i}"|\'${i}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return n.replace(new RegExp(`${r}(?:${o})+`,"g"),e).replace(new RegExp(`(?:${o})+${r}`,"g"),e)}var pl=new Set(["keyframes","-webkit-keyframes","font-face"]);function hl(n){return n?.type==="atrule"}function xl(n){let e=n.parent;for(;e;){if(hl(e)&&pl.has(e.name.toLowerCase()))return!0;e=e.parent}return!1}function vn(n,e){let t=e.trim();if(!n||!t)return n;let i=`[data-composition-id="${dl(t)}"]`,r=Wr.parse(n);return r.walkRules(o=>{xl(o)||(o.selectors=o.selectors.map(s=>fl(s,i,t)))}),r.toResult({map:!1}).css}function Hr(n,e,t="[HyperFrames] composition script error:"){let i=JSON.stringify(e),r=JSON.stringify(t),o=Tn(e),s=JSON.stringify(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${o}"|\'${o}\')\\s*\\]`),c=JSON.stringify(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`);return`(function(){\n var __hfCompId = ${i};\n var __hfErrorLabel = ${r};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = __hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "";\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${s};\n var __hfTimingSelectorPattern = ${c};\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n return selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\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 __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") {\n return function(id) {\n var found = target.getElementById(id);\n return found && __hfContains(found) ? found : null;\n };\n }\n var value = Reflect.get(target, prop, receiver);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\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 (_err) {}\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.slice.call(root.querySelectorAll(selector));\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsReceiver);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, receiver);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap) {\n${n}\n }).call(window, __hfScopedDocument, __hfScopedGsap);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})()`}var gl=8e3,Sl=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,yl=n=>new Promise(e=>{let t=!1,i=Date.now(),r=null,o=s=>{t||(t=!0,r!=null&&window.clearTimeout(r),e({status:s,elapsedMs:Math.max(0,Date.now()-i)}))};n.addEventListener("load",()=>o("load"),{once:!0}),n.addEventListener("error",()=>o("error"),{once:!0}),r=window.setTimeout(()=>o("timeout"),gl)});function Bn(n){for(;n.firstChild;)n.removeChild(n.firstChild);n.textContent=""}function Ur(n,e){let t=n.trim();if(!t)return n;try{return Sl.test(t)?new URL(t,document.baseURI).toString():e?new URL(t,e).toString():new URL(t,document.baseURI).toString()}catch{return n}}async function On(n){let e=null;n.hostCompositionId&&(e=Array.from(n.sourceNode.querySelectorAll("[data-composition-id]")).find(l=>l.getAttribute("data-composition-id")===n.hostCompositionId)??null);let t=e??n.sourceNode,i=e?.getAttribute("data-composition-id")?.trim()||n.hostCompositionId||null;if(n.headStyles)for(let a of n.headStyles){let l=a.cloneNode(!0);l instanceof HTMLStyleElement&&(i&&(l.textContent=vn(l.textContent||"",i)),document.head.appendChild(l),n.injectedStyles.push(l))}let r=Array.from(t.querySelectorAll("style"));for(let a of r){let l=a.cloneNode(!0);l instanceof HTMLStyleElement&&(i&&(l.textContent=vn(l.textContent||"",i)),document.head.appendChild(l),n.injectedStyles.push(l))}let o=[];if(n.headScripts)for(let a of n.headScripts){let l=a.getAttribute("type")?.trim()??"",f=a.getAttribute("src")?.trim()??"";if(f){let m=Ur(f,n.compositionUrl);o.push({kind:"external",src:m,type:l})}else{let m=a.textContent?.trim()??"";m&&o.push({kind:"inline",content:m,type:l,scopeCompositionId:i})}}let s=Array.from(t.querySelectorAll("script")),c=[...o];for(let a of s){let l=a.getAttribute("type")?.trim()??"",f=a.getAttribute("src")?.trim()??"";if(f){let m=Ur(f,n.compositionUrl);c.push({kind:"external",src:m,type:l})}else{let m=a.textContent?.trim()??"";m&&c.push({kind:"inline",content:m,type:l,scopeCompositionId:i})}a.parentNode?.removeChild(a)}let u=Array.from(t.querySelectorAll("style"));for(let a of u)a.parentNode?.removeChild(a);if(e){let a=document.importNode(e,!0),l=e.getAttribute("data-width"),f=e.getAttribute("data-height"),m=n.parseDimensionPx(l),h=n.parseDimensionPx(f);for(l&&n.host.setAttribute("data-width",l),f&&n.host.setAttribute("data-height",f),m&&n.host instanceof HTMLElement&&(n.host.style.width=m),h&&n.host instanceof HTMLElement&&(n.host.style.height=h);a.firstChild;)n.host.appendChild(a.firstChild)}else n.hasTemplate?n.host.appendChild(document.importNode(t,!0)):n.host.innerHTML=n.fallbackBodyInnerHtml;for(let a of c){let l=document.createElement("script");if(a.type&&(l.type=a.type),l.async=!1,a.kind==="external"?l.src=a.src:a.type.toLowerCase()==="module"?l.textContent=a.content:a.scopeCompositionId?l.textContent=Hr(a.content,a.scopeCompositionId):l.textContent=`(function(){${a.content}})();`,document.body.appendChild(l),n.injectedScripts.push(l),a.kind==="external"){let f=await yl(l);f.status!=="load"&&n.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:n.hostCompositionId,hostCompositionSrc:n.hostCompositionSrc,resolvedScriptSrc:a.src,loadStatus:f.status,elapsedMs:f.elapsedMs}})}}}async function qr(n){let e=Array.from(document.querySelectorAll("[data-composition-id]:not([data-composition-src])")).filter(t=>{if(t.children.length>0)return!1;let i=t.getAttribute("data-composition-id");return i?!!document.querySelector(`template#${CSS.escape(i)}-template`):!1});if(e.length!==0)for(let t of e){let i=t.getAttribute("data-composition-id"),r=document.querySelector(`template#${CSS.escape(i)}-template`);Bn(t),await On({host:t,hostCompositionId:i,hostCompositionSrc:`template#${i}-template`,sourceNode:r.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:n.injectedStyles,injectedScripts:n.injectedScripts,parseDimensionPx:n.parseDimensionPx,onDiagnostic:n.onDiagnostic})}}async function zr(n){let e=Array.from(document.querySelectorAll("[data-composition-src]"));e.length!==0&&await Promise.all(e.map(async t=>{let i=t.getAttribute("data-composition-src");if(!i)return;let r=null;try{r=new URL(i,document.baseURI)}catch{r=null}Bn(t);try{let o=t.getAttribute("data-composition-id"),s=o!=null?document.querySelector(`template#${CSS.escape(o)}-template`):null;if(s){await On({host:t,hostCompositionId:o,hostCompositionSrc:i,sourceNode:s.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:r,injectedStyles:n.injectedStyles,injectedScripts:n.injectedScripts,parseDimensionPx:n.parseDimensionPx,onDiagnostic:n.onDiagnostic});return}let c=await fetch(i);if(!c.ok)throw new Error(`HTTP ${c.status}`);let u=await c.text(),l=new DOMParser().parseFromString(u,"text/html"),f=(o?l.querySelector(`template#${CSS.escape(o)}-template`):null)??l.querySelector("template"),m=f?f.content:l.body,h=f?void 0:Array.from(l.head.querySelectorAll("style")),M=f?void 0:Array.from(l.head.querySelectorAll("script"));await On({host:t,hostCompositionId:o,hostCompositionSrc:i,sourceNode:m,hasTemplate:!!f,fallbackBodyInnerHtml:l.body.innerHTML,compositionUrl:r,injectedStyles:n.injectedStyles,injectedScripts:n.injectedScripts,parseDimensionPx:n.parseDimensionPx,headStyles:h,headScripts:M,onDiagnostic:n.onDiagnostic})}catch(o){n.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:t.getAttribute("data-composition-id"),hostCompositionSrc:i,errorMessage:o instanceof Error?o.message:"unknown_error"}}),Bn(t)}}))}function Pn(){let n=window.gsap;n&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(e=>e.ok?e.json():null).then(e=>{if(!e||!Array.isArray(e)||e.length===0)return;let t=[],i=document.querySelectorAll(".caption-group");for(let r of i){let o=r.querySelectorAll(":scope > span");for(let s of o)t.push(s)}for(let r of e){let o=null;if(r.wordId&&(o=document.getElementById(r.wordId)),!o&&r.wordIndex!==void 0&&(o=t[r.wordIndex]??null),!o||!(o instanceof HTMLElement))continue;let s={},c={};if(r.x!==void 0&&(s.x=r.x),r.y!==void 0&&(s.y=r.y),r.scale!==void 0&&(s.scale=r.scale),r.rotation!==void 0&&(s.rotation=r.rotation),r.opacity!==void 0&&(c.opacity=r.opacity),r.fontSize!==void 0&&(c.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(c.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(c.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let a=n.getTweensOf(o).filter(f=>f.vars.color!==void 0).sort((f,m)=>f.startTime()-m.startTime()),l=a.length>0?String(a[0].vars.color):"";for(let f of a)String(f.vars.color)===l?r.dimColor&&(f.vars.color=r.dimColor):r.activeColor&&(f.vars.color=r.activeColor);r.dimColor&&n.set(o,{color:r.dimColor})}if(Object.keys(c).length>0&&n.set(o,c),Object.keys(s).length>0){let u=document.createElement("span");u.style.display="inline-block",u.dataset.captionWrapper="true",o.parentNode?.insertBefore(u,o),u.appendChild(o),n.set(u,s)}}}).catch(()=>{})}var jr="data-hf-authored-duration",Gr="data-hf-authored-end";function $r(){let n=ci(),e=window,t=null,i=null,r=[],o=new Set,s=null;if(typeof e.__hfRuntimeTeardown=="function")try{e.__hfRuntimeTeardown()}catch{}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"),window.__timelines=window.__timelines||{};let c=d=>{r.push(d)},u=(d,g,x)=>{let w=x??`${d}:${JSON.stringify(g)}`;o.has(w)||(o.add(w),ge({source:"hf-preview",type:"diagnostic",code:d,details:g}))},a=d=>{let g={scale:1,focusX:960,focusY:540},x=[],w=[],E={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>x,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>w,getRenderState:()=>({...E,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},l=1/60,f=.75,m=.75,h=.35,M=900,C=3,A=2,z=.05,P=100,k=240,Y=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},y=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},p=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},S=()=>{let d=document.querySelector(\'[data-composition-id][data-root="true"]\');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.length===0?null:g.find(x=>!x.parentElement?.closest("[data-composition-id]"))??g[0]??null},F=()=>{let d=S();if(!d)return;let g=p(d.getAttribute("data-width")),x=p(d.getAttribute("data-height"));g&&(d.style.width=g),x&&(d.style.height=x),g&&d.style.setProperty("--comp-width",g),x&&d.style.setProperty("--comp-height",x)},b=()=>{let d=S(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(x=>x.hasAttribute("data-duration")||x.hasAttribute("data-end"));for(let x of g){if(d&&x===d)continue;let w=x.getAttribute("data-duration"),E=x.getAttribute("data-end");w!=null&&!x.hasAttribute(jr)&&x.setAttribute(jr,w),E!=null&&!x.hasAttribute(Gr)&&x.setAttribute(Gr,E),x.removeAttribute("data-duration"),x.removeAttribute("data-end")}},N=()=>{let d=S();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=p(d.getAttribute("data-width")),x=p(d.getAttribute("data-height"));g&&(d.style.width=g),x&&(d.style.height=x);let w=Array.from(d.children);for(let E of w){let O=E.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta"||!E.hasAttribute("data-start"))continue;let le=(E.style.top==="0px"||E.style.top==="0")&&(E.style.left==="0px"||E.style.left==="0")&&E.style.width==="100%"&&E.style.height==="100%",ae=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(E.style.transform);if(le&&ae&&!E.hasAttribute("data-width")&&!E.hasAttribute("data-height")){let ye=E.style.top,ue=E.style.left,tt=E.style.width,ie=E.style.height;E.style.top="",E.style.left="",E.style.width="",E.style.height="";let $=window.getComputedStyle(E);$.top!=="auto"||$.bottom!=="auto"||$.left!=="auto"||$.right!=="auto"||$.width!=="0px"||$.height!=="0px"||(E.style.top=ye,E.style.left=ue,E.style.width=tt,E.style.height=ie)}let V=window.getComputedStyle(E),we=V.position;if(we!=="absolute"&&we!=="fixed"&&(E.style.position="absolute"),!!E.style.top||!!E.style.bottom||V.top!=="auto"||V.bottom!=="auto"||(E.style.top="0"),!!E.style.left||!!E.style.right||V.left!=="auto"||V.right!=="auto"||(E.style.left="0"),O!=="audio"){let ye=p(E.getAttribute("data-width")),ue=p(E.getAttribute("data-height")),tt=V.width!=="0px"&&V.width!=="auto",ie=V.height!=="0px"&&V.height!=="auto";ye?!E.style.width&&!tt&&(E.style.width=ye):!E.style.width&&V.width==="0px"&&(E.style.width="100%"),ue?!E.style.height&&!ie&&(E.style.height=ue):!E.style.height&&V.height==="0px"&&(E.style.height="100%")}}},B=(d,g=0,x)=>He({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:x?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),W=(d,g)=>He({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),H=!!document.querySelector("[data-composition-src]"),X=!1;{let d=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let g of d){let x=g.getAttribute("data-composition-id");if(x&&g.children.length===0&&document.querySelector(`template#${CSS.escape(x)}-template`)){X=!0;break}}}let R=!H&&!X,Z=d=>{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},ee=d=>typeof d=="number"&&Number.isFinite(d)&&d>l,U=d=>{let g=Number(d.getAttribute("data-duration"));if(Number.isFinite(g)&&g>0)return g;let x=Number(d.getAttribute("data-playback-start")??d.getAttribute("data-media-start")??"0"),w=Number.isFinite(x)?Math.max(0,x):0;return Number.isFinite(d.duration)&&d.duration>w?Math.max(0,d.duration-w):null},G=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let x of d){let w=B(x,0);if(!Number.isFinite(w))continue;let E=U(x);E==null||E<=l||(g=Math.max(g,Math.max(0,w)+E))}return g>l?g:null},v=()=>{let d=S();if(!d)return null;let g=window.__timelines??{},x=He({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),w=0,E=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let O of E){if(!(O instanceof Element)||O.parentElement?.closest("[data-composition-id]")!==d)continue;let ae=x.resolveStartForElement(O,0),V=x.resolveDurationForElement(O);!Number.isFinite(ae)||V==null||V<=0||(w=Math.max(w,Math.max(0,ae)+V))}return w>l?w:null},J=()=>{let d=G();return typeof d!="number"||!Number.isFinite(d)||d<=l?null:d},Ee=d=>ee(d)?Math.max(l,d*f):l,xe=(d,g=0)=>{let x=Z(d),w=J(),E=v(),O=Math.max(w??0,E??0),le=Number.isFinite(g)&&g>l?g:0,ae=0;ee(x)?ae=Math.max(x,O,le):ee(O)?ae=Math.max(O,le):ae=le;let V=Math.max(1,Number(n.maxTimelineDurationSeconds)||1800);return ae>0?Math.max(0,Math.min(ae,V)):0},T=()=>{let d=window.__timelines??{},g=He({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),x=J(),w=v(),E=Math.max(x??0,w??0)||null,O=Ee(E),le=ie=>{let $=document.querySelector(`[data-composition-id="${CSS.escape(ie)}"]`);return $?g.resolveStartForElement($,0):0},ae=ie=>{let $=window.gsap;if(!$||typeof $.timeline!="function")return null;let oe=$.timeline({paused:!0});for(let pe of ie)oe.add(pe.timeline,le(pe.compositionId));return oe},V=(ie,$)=>{if(!ee(ie))return null;let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let pe=oe.timeline({paused:!0});if($)try{pe.add($,0)}catch{}let he=pe;if(typeof he.to=="function")try{he.to({},{duration:ie})}catch{}return pe},we=(ie,$)=>{let oe=ie;if(typeof oe.getChildren!="function")return[];try{let pe=oe.getChildren(!0,!0,!0)??[];if(!Array.isArray(pe))return[];let he=[];for(let se of $)if(!pe.some(Ie=>Ie===se.timeline))try{let Ie=le(se.compositionId);ie.add(se.timeline,Ie),he.push(se.compositionId)}catch{}return he}catch{return[]}},Te=S(),de=Te?.getAttribute("data-composition-id")??null;if(!de)return{timeline:null};let me=d[de]??null,ue=(()=>{if(!Te)return[];let ie=new Set,$=Array.from(Te.querySelectorAll("[data-composition-id]")),oe=[];for(let pe of $){let he=pe.getAttribute("data-composition-id");if(!he||he===de||ie.has(he))continue;ie.add(he);let se=d[he]??null;if(!se||typeof se.play!="function"||typeof se.pause!="function")continue;let Ae=Z(se);oe.push({compositionId:he,timeline:se,durationSeconds:Ae??0})}return oe})(),tt=ie=>{for(let $ of ie){let oe=$.timeline;if(typeof oe.paused=="function")try{oe.paused(!1)}catch{}}};if(ue.length>0&&tt(ue),me){let ie=ue.length>0?we(me,ue):[];if((ue.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+de+"\'])"))&&(L=!0),ie.length>0)try{let se=me.time();me.seek(se,!1)}catch{}let $=Z(me);if(!ee($)&&ue.length>0){let se=ue.map(bo=>bo.compositionId),Ae=ae(ue),Ie=Z(Ae);if(Ae&&ee(Ie))return{timeline:Ae,selectedTimelineIds:se,selectedDurationSeconds:Ie,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:de,rootDurationSeconds:$,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:O,selectedDurationSeconds:Ie,mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:se,autoNestedChildren:ie}}};let Xt=V(E??0,me),en=Z(Xt);if(Xt&&ee(en))return{timeline:Xt,selectedTimelineIds:[de],selectedDurationSeconds:en,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:de,rootDurationSeconds:$,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:en,selectedTimelineIds:[de],autoNestedChildren:ie}}}}if(!ee($)&&ue.length===0){let se=V(E??0,me),Ae=Z(se);if(se&&ee(Ae))return{timeline:se,selectedTimelineIds:[de],selectedDurationSeconds:Ae,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:de,rootDurationSeconds:$,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Ae,selectedTimelineIds:[de]}}}}let oe=Te?.getAttribute("data-duration"),pe=oe?parseFloat(oe):null,he=Math.max(ee(pe)?pe:0,w??0);if(he>0&&ee(he)&&ee($)&&he>=$+.5){let se=me;if(typeof se.to=="function")try{se.to({},{duration:0},he)}catch{}let Ae=Z(me);if(ee(Ae))return{timeline:me,selectedTimelineIds:[de],selectedDurationSeconds:Ae,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:de,rootDurationSeconds:$,rootDeclaredDur:pe,authoredCompositionDurationFloorSeconds:w,newDur:Ae}}}}return{timeline:me,selectedTimelineIds:[de],selectedDurationSeconds:$,mediaDurationFloorSeconds:x,diagnostics:ie.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:de,selectedDurationSeconds:$,autoNestedChildren:ie}}:void 0}}if(ue.length>0){let ie=ue.map(pe=>pe.compositionId),$=ae(ue),oe=Z($);if($)return{timeline:$,selectedTimelineIds:ie,selectedDurationSeconds:oe,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:de,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:O,selectedDurationSeconds:oe,mediaDurationFloorSeconds:x,selectedTimelineIds:ie}}}}return{timeline:null}},D=()=>{let d=n.capturedTimeline;if(!d||typeof d.time!="function")return;let g=Number(d.time());Number.isFinite(g)&&(n.currentTime=Math.max(0,g))},L=!1,Q=()=>{if(!R)return!1;let d=n.capturedTimeline,g=Z(d),x=ee(g);if(d&&x&&L)return!1;let w=T();return w.timeline?d&&d===w.timeline?(typeof d.timeScale=="function"&&d.timeScale(n.playbackRate),!1):(n.capturedTimeline=w.timeline,typeof n.capturedTimeline.timeScale=="function"&&n.capturedTimeline.timeScale(n.playbackRate),w.diagnostics&&ge({source:"hf-preview",type:"diagnostic",code:w.diagnostics.code,details:w.diagnostics.details}),ge({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:w.selectedTimelineIds??[],selectedDurationSeconds:w.selectedDurationSeconds??null,mediaDurationFloorSeconds:w.mediaDurationFloorSeconds??null}}),!0):!1},ne=()=>{let d=S();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),x=Number(d.getAttribute("data-width")),w=Number(d.getAttribute("data-height")),E=window.getComputedStyle(d),O=Number.isFinite(x)&&x>0&&Number.isFinite(w)&&w>0,le=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!O||!le||u("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:x,declaredHeight:w,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:E.display,visibility:E.visibility,overflow:E.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},_=()=>{n.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,ne()}))},I=()=>{t=d=>{let g=Y(d.error??d.message).slice(0,k);if(!g)return;let x=y(g);ge({source:"hf-preview",type:"diagnostic",code:x.code,details:{category:x.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},i=d=>{let g=Y(d.reason).slice(0,k);if(!g)return;let x=y(g);ge({source:"hf-preview",type:"diagnostic",code:`${x.code}_unhandled_rejection`,details:{category:`${x.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",t),window.addEventListener("unhandledrejection",i)},j=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let x of d){let w=()=>{if(!(x instanceof Element))return;let E=x.tagName.toLowerCase(),O=x.getAttribute("src")??x.getAttribute("href")??x.getAttribute("poster")??null,le=E==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";u(le,{tagName:E,assetUrl:O,currentSrc:(x instanceof HTMLImageElement||x instanceof HTMLMediaElement)&&x.currentSrc||null,readyState:x instanceof HTMLMediaElement?x.readyState:null,networkState:x instanceof HTMLMediaElement?x.networkState:null},`${le}:${E}:${O??"unknown"}`)};x.addEventListener("error",w),c(()=>{x.removeEventListener("error",w)})}let g=document.fonts;g&&g.ready.then(()=>{if(n.tornDown)return;let x=Array.from(g).filter(w=>w.status==="error").map(w=>w.family).filter(w=>!!w).slice(0,10);x.length!==0&&u("runtime_font_load_issue",{failedFamilies:x,totalFaces:Array.from(g).length},`runtime-font-load-issue:${x.join("|")}`)}).catch(()=>{})},Ne=(d,g)=>{if(!d.timeline)return!1;let x=n.capturedTimeline;if(x&&x===d.timeline)return!1;let w=Math.max(0,n.currentTime||0),E=n.isPlaying;n.capturedTimeline=d.timeline,typeof n.capturedTimeline.timeScale=="function"&&n.capturedTimeline.timeScale(n.playbackRate);try{n.capturedTimeline.pause(),n.capturedTimeline.seek(w,!1),E&&n.capturedTimeline.play()}catch{}return ge({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:w,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},ce=null,ze=!1,Fe=new Set,wt=()=>{n.tornDown||(ce!=null&&window.clearTimeout(ce),ce=window.setTimeout(()=>{if(n.tornDown)return;ce=null;let d=T();if(!d.timeline||!ee(d.mediaDurationFloorSeconds??null))return;if(!n.capturedTimeline){Q()&&(je(),Re(!0));return}if(ze)return;let x=Z(n.capturedTimeline),w=d.selectedDurationSeconds??Z(d.timeline);ee(w)&&(!ee(x)||w>=x+z)&&Ne(d,"manual")&&(ze=!0,ge({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:x??null,selectedDurationSeconds:w??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),je(),Re(!0))},P))},Ao=()=>{for(let d of Fe)d.removeEventListener("loadedmetadata",wt),d.removeEventListener("durationchange",wt);Fe.clear()},Jt=()=>{if(n.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d)Fe.has(g)||(Fe.add(g),g.addEventListener("loadedmetadata",wt),g.addEventListener("durationchange",wt),g.preload!=="auto"&&(g.preload="auto"),g.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&g.load())},Gn=()=>{let d=E=>{let O=E.closest("[data-composition-id]"),le=O?B(O,0):null,ae=O?W(O,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:O,inheritedStart:le,inheritedDuration:ae}},g=oi({shouldIncludeElement:E=>E.hasAttribute("data-start")||!!d(E).compositionRoot,resolveStartSeconds:E=>{let O=d(E);return B(E,O.inheritedStart??0)},resolveDurationSeconds:E=>{let O=d(E),le=B(E,O.inheritedStart??0),ae=Number.parseFloat(E.dataset.playbackStart??E.dataset.mediaStart??"0")||0,V=O.inheritedStart!=null&&O.inheritedDuration!=null&&O.inheritedDuration>0?Math.max(0,O.inheritedStart+O.inheritedDuration-le):null,we=Number.isFinite(E.duration)&&E.duration>ae?Math.max(0,E.duration-ae):null;return we!=null&&V!=null?Math.min(we,V):we??V}});si({clips:g.mediaClips,timeSeconds:n.currentTime,playing:n.isPlaying,playbackRate:n.playbackRate,outputMuted:n.mediaOutputMuted,userMuted:n.bridgeMuted,onAutoplayBlocked:()=>{n.mediaAutoplayBlockedPosted||(n.mediaAutoplayBlockedPosted=!0,ge({source:"hf-preview",type:"media-autoplay-blocked"}))}});let x=document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null,w=Array.from(document.querySelectorAll("[data-start]"));for(let E of w){if(!(E instanceof HTMLElement))continue;let O=E.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta")continue;if(!E.getAttribute("data-composition-id")){let ye=E.closest("[data-composition-id]")?.getAttribute("data-composition-id")??null;if(ye&&ye!==x)continue}let ae=B(E,0),V=W(E),we=E.getAttribute("data-composition-id");if(we){let me=(window.__timelines??{})[we],ye=null;if(me&&typeof me.duration=="function"){let ue=Number(me.duration());Number.isFinite(ue)&&ue>0&&(ye=ue)}V!=null&&V>0&&ye!=null?V=Math.min(V,ye):(V==null||V<=0)&&ye!=null&&(V=ye)}let Te=V!=null&&V>0?ae+V:Number.POSITIVE_INFINITY,de=n.currentTime>=ae&&(Number.isFinite(Te)?n.currentTime<Te:!0);E.style.visibility=de?"visible":"hidden"}},Re=d=>{D();let g=Math.max(0,Math.round((n.currentTime||0)*n.canonicalFps)),x=Date.now();(d||g!==n.bridgeLastPostedFrame||n.isPlaying!==n.bridgeLastPostedPlaying||n.bridgeMuted!==n.bridgeLastPostedMuted||x-n.bridgeLastPostedAt>=n.bridgeMaxPostIntervalMs)&&(n.bridgeLastPostedFrame=g,n.bridgeLastPostedPlaying=n.isPlaying,n.bridgeLastPostedMuted=n.bridgeMuted,n.bridgeLastPostedAt=x,ge({source:"hf-preview",type:"state",frame:g,isPlaying:n.isPlaying,muted:n.bridgeMuted,playbackRate:n.playbackRate}))},je=()=>{b(),F(),N();let d=S();if(d){let x=p(d.getAttribute("data-width")),w=p(d.getAttribute("data-height")),E=x?parseInt(x,10):0,O=w?parseInt(w,10):0;E>0&&O>0&&ge({source:"hf-preview",type:"stage-size",width:E,height:O})}Q();let g=mi({canonicalFps:n.canonicalFps,maxTimelineDurationSeconds:n.maxTimelineDurationSeconds});window.__clipManifest=g,ge(g),_()},et=(d,g=0)=>{for(let x of n.deterministicAdapters){try{d==="discover"&&x.discover(),d==="pause"&&x.pause(),d==="play"&&x.play&&x.play()}catch{}if(d==="discover")try{x.seek({time:g})}catch{}}};if(R)Pn();else{let d={injectedStyles:n.injectedCompStyles,injectedScripts:n.injectedCompScripts,parseDimensionPx:p,onDiagnostic:({code:g,details:x})=>{ge({source:"hf-preview",type:"diagnostic",code:g,details:x})}};zr(d).then(()=>qr(d)).finally(()=>{R=!0,et("discover",n.currentTime),Jt(),j(),Pn(),je(),Re(!0)})}let Ct=li({postMessage:d=>ge(d)});Ct.installPickerApi();let $n=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?n.playbackRate=1:n.playbackRate=Math.max(.1,Math.min(5,g)),n.capturedTimeline&&typeof n.capturedTimeline.timeScale=="function"&&n.capturedTimeline.timeScale(n.playbackRate);let x=document.querySelectorAll("video, audio");for(let w of x)if(w instanceof HTMLMediaElement)try{w.playbackRate=n.playbackRate}catch{}},fe=ui({getTimeline:()=>n.capturedTimeline,setTimeline:d=>{n.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>n.isPlaying,setIsPlaying:d=>{n.isPlaying=d},getPlaybackRate:()=>n.playbackRate,setPlaybackRate:$n,getCanonicalFps:()=>n.canonicalFps,onSyncMedia:(d,g)=>{n.currentTime=Math.max(0,Number(d)||0),n.isPlaying=g,Gn()},onStatePost:Re,onDeterministicSeek:d=>{for(let g of n.deterministicAdapters)try{g.seek({time:Number(d)||0})}catch{}},onDeterministicPause:()=>et("pause"),onDeterministicPlay:()=>et("play"),onRenderFrameSeek:()=>{},onShowNativeVideos:()=>{},getSafeDuration:()=>xe(n.capturedTimeline,0)});window.__player=a(fe),window.__playerReady=!0,window.__renderReady=!0,Yn(ge),nt("composition_loaded",{duration:fe.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),n.controlBridgeHandler=Qn({onPlay:()=>{fe.play(),nt("composition_played",{time:fe.getTime()})},onPause:()=>{fe.pause(),nt("composition_paused",{time:fe.getTime()})},onSeek:(d,g)=>{let x=Math.max(0,d)/n.canonicalFps;fe.seek(x),nt("composition_seeked",{time:x})},onSetMuted:d=>{n.bridgeMuted=d;let g=d||n.mediaOutputMuted,x=document.querySelectorAll("video, audio");for(let w of x)w instanceof HTMLMediaElement&&(w.muted=g)},onSetMediaOutputMuted:d=>{n.mediaOutputMuted=d;let g=d||n.bridgeMuted,x=document.querySelectorAll("video, audio");for(let w of x)w instanceof HTMLMediaElement&&(w.muted=g)},onSetPlaybackRate:d=>$n(d),onEnablePickMode:()=>Ct.enablePickMode(),onDisablePickMode:()=>Ct.disablePickMode()}),Q(),n.capturedTimeline&&(fe._timeline=n.capturedTimeline),R&&setTimeout(()=>{let d=n.capturedTimeline;Q()&&n.capturedTimeline!==d&&(fe._timeline=n.capturedTimeline),et("discover",n.currentTime),je(),Re(!0)},0),n.deterministicAdapters=[ri(),Zn({resolveStartSeconds:d=>B(d,0)}),ni(),ii(),Xn({getTimeline:()=>n.capturedTimeline})],I(),et("discover"),Jt(),n.timelinePollIntervalId&&clearInterval(n.timelinePollIntervalId);let Qt=0,Mt=null,Vn=0,Yt=!1,Ge=0,Kn=()=>{Vn=Date.now(),Yt=!1,Ge=0};n.timelinePollIntervalId=setInterval(()=>{Qt+=1;let g=n.isPlaying&&n.capturedTimeline!=null&&Math.max(0,n.currentTime||0)<A?!1:Q();if(n.capturedTimeline&&!fe._timeline&&(fe._timeline=n.capturedTimeline),(g||Qt%20===0)&&je(),Qt%10===0&&Jt(),D(),n.isPlaying&&n.capturedTimeline){let x=Math.max(0,n.currentTime||0),w=Mt,E=xe(n.capturedTimeline,0);if(E>0&&x>=E){fe.pause(),fe.seek(E),Mt=E,Ge=0,Re(!0);return}if(w!=null&&w>=m&&x<=h?Ge+=1:Ge=0,!Yt&&Ge>=C&&Date.now()-Vn>M){let le=T();Ne(le,"loop_guard")&&(Yt=!0,Ge=0)}Mt=Math.max(0,n.currentTime||0)}else Mt=Math.max(0,n.currentTime||0);n.isPlaying&&Gn(),Re(!1)},50),je(),Re(!0);let Eo=fe.seek;fe.seek=d=>{Kn(),Eo(d)};let Fo=fe.renderSeek;fe.renderSeek=d=>{Kn(),Fo(d)};let Zt=()=>{if(!n.tornDown){n.tornDown=!0,n.timelinePollIntervalId&&(clearInterval(n.timelinePollIntervalId),n.timelinePollIntervalId=null),ce!=null&&(window.clearTimeout(ce),ce=null),s!=null&&(window.cancelAnimationFrame(s),s=null),Ao(),n.controlBridgeHandler&&(window.removeEventListener("message",n.controlBridgeHandler),n.controlBridgeHandler=null),t&&(window.removeEventListener("error",t),t=null),i&&(window.removeEventListener("unhandledrejection",i),i=null),n.beforeUnloadHandler&&(window.removeEventListener("beforeunload",n.beforeUnloadHandler),n.beforeUnloadHandler=null),Ct.disablePickMode();for(let d of n.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch{}n.deterministicAdapters=[];for(let d of r.splice(0))try{d()}catch{}for(let d of n.injectedCompStyles)try{d.remove()}catch{}n.injectedCompStyles=[];for(let d of n.injectedCompScripts)try{d.remove()}catch{}n.injectedCompScripts=[],n.capturedTimeline=null,e.__hfRuntimeTeardown===Zt&&(e.__hfRuntimeTeardown=null)}};e.__hfRuntimeTeardown=Zt,n.beforeUnloadHandler=Zt,window.addEventListener("beforeunload",n.beforeUnloadHandler)}var Vr=["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"],_n=[[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 Al(n){if(n<=255)return Vr[n];let e=0,t=_n.length-1;for(;e<=t;){let i=e+t>>1,r=_n[i];if(n<r[0]){t=i-1;continue}if(n>r[1]){e=i+1;continue}return r[2]}return"L"}function El(n){let e=n.length;if(e===0)return null;let t=new Array(e),i=!1;for(let a=0;a<e;){let l=n.charCodeAt(a),f=l,m=1;if(l>=55296&&l<=56319&&a+1<e){let M=n.charCodeAt(a+1);M>=56320&&M<=57343&&(f=(l-55296<<10)+(M-56320)+65536,m=2)}let h=Al(f);(h==="R"||h==="AL"||h==="AN")&&(i=!0);for(let M=0;M<m;M++)t[a+M]=h;a+=m}if(!i)return null;let r=0;for(let a=0;a<e;a++){let l=t[a];if(l==="L"){r=0;break}if(l==="R"||l==="AL"){r=1;break}}let o=new Int8Array(e);for(let a=0;a<e;a++)o[a]=r;let s=r&1?"R":"L",c=s,u=c;for(let a=0;a<e;a++)t[a]==="NSM"?t[a]=u:u=t[a];u=c;for(let a=0;a<e;a++){let l=t[a];l==="EN"?t[a]=u==="AL"?"AN":"EN":(l==="R"||l==="L"||l==="AL")&&(u=l)}for(let a=0;a<e;a++)t[a]==="AL"&&(t[a]="R");for(let a=1;a<e-1;a++)t[a]==="ES"&&t[a-1]==="EN"&&t[a+1]==="EN"&&(t[a]="EN"),t[a]==="CS"&&(t[a-1]==="EN"||t[a-1]==="AN")&&t[a+1]===t[a-1]&&(t[a]=t[a-1]);for(let a=0;a<e;a++){if(t[a]!=="EN")continue;let l;for(l=a-1;l>=0&&t[l]==="ET";l--)t[l]="EN";for(l=a+1;l<e&&t[l]==="ET";l++)t[l]="EN"}for(let a=0;a<e;a++){let l=t[a];(l==="WS"||l==="ES"||l==="ET"||l==="CS")&&(t[a]="ON")}u=c;for(let a=0;a<e;a++){let l=t[a];l==="EN"?t[a]=u==="L"?"L":"EN":(l==="R"||l==="L")&&(u=l)}for(let a=0;a<e;a++){if(t[a]!=="ON")continue;let l=a+1;for(;l<e&&t[l]==="ON";)l++;let f=a>0?t[a-1]:c,m=l<e?t[l]:c,h=f!=="L"?"R":"L";if(h===(m!=="L"?"R":"L"))for(let C=a;C<l;C++)t[C]=h;a=l-1}for(let a=0;a<e;a++)t[a]==="ON"&&(t[a]=s);for(let a=0;a<e;a++){let l=t[a];(o[a]&1)===0?l==="R"?o[a]++:(l==="AN"||l==="EN")&&(o[a]+=2):(l==="L"||l==="AN"||l==="EN")&&o[a]++}return o}function Kr(n,e){let t=El(n);if(t===null)return null;let i=new Int8Array(e.length);for(let r=0;r<e.length;r++)i[r]=t[e[r]];return i}var Fl=/[ \\t\\n\\r\\f]+/g,bl=/[\\t\\n\\r\\f]| {2,}|^ | $/;function Nl(n){let e=n??"normal";return e==="pre-wrap"?{mode:e,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:e,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function wl(n){if(!bl.test(n))return n;let e=n.replace(Fl," ");return e.charCodeAt(0)===32&&(e=e.slice(1)),e.length>0&&e.charCodeAt(e.length-1)===32&&(e=e.slice(0,-1)),e}function Cl(n){return/[\\r\\f]/.test(n)?n.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):n.replace(/\\r\\n/g,`\n`)}var In=null,Ml;function Dl(){return In===null&&(In=new Intl.Segmenter(Ml,{granularity:"word"})),In}var kl=/\\p{Script=Arabic}/u,jt=/\\p{M}/u,no=/\\p{Nd}/u;function Jr(n){return kl.test(n)}function Qr(n){return n>=19968&&n<=40959||n>=13312&&n<=19903||n>=131072&&n<=173791||n>=173824&&n<=177983||n>=177984&&n<=178207||n>=178208&&n<=183983||n>=183984&&n<=191471||n>=191472&&n<=192093||n>=194560&&n<=195103||n>=196608&&n<=201551||n>=201552&&n<=205743||n>=205744&&n<=210041||n>=63744&&n<=64255||n>=12288&&n<=12351||n>=12352&&n<=12447||n>=12448&&n<=12543||n>=44032&&n<=55215||n>=65280&&n<=65519}function Me(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(!(t<12288)){if(t>=55296&&t<=56319&&e+1<n.length){let i=n.charCodeAt(e+1);if(i>=56320&&i<=57343){let r=(t-55296<<10)+(i-56320)+65536;if(Qr(r))return!0;e++;continue}}if(Qr(t))return!0}}return!1}function Ll(n){let e=Vt(n);return e!==null&&($t.has(e)||Pe.has(e))}var Rl=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Tl(n){return Me(n)}function vl(n){let e=Vt(n);return e!==null&&Rl.has(e)}function Gt(n){return!Ll(n)&&!vl(n)}var $t=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"]),Nt=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Hn=new Set(["\'","\\u2019"]),Pe=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Bl=new Set([":",".","\\u060C","\\u061B"]),Ol=new Set(["\\u104F"]),Pl=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function _l(n){if(Un(n))return!0;let e=!1;for(let t of n){if(Pe.has(t)){e=!0;continue}if(!(e&&jt.test(t)))return!1}return e}function Il(n){for(let e of n)if(!$t.has(e)&&!Pe.has(e))return!1;return n.length>0}function Wl(n){if(Un(n))return!0;for(let e of n)if(!Nt.has(e)&&!Hn.has(e)&&!jt.test(e))return!1;return n.length>0}function Un(n){let e=!1;for(let t of n)if(!(t==="\\\\"||jt.test(t))){if(Nt.has(t)||Pe.has(t)||Hn.has(t)){e=!0;continue}return!1}return e}function io(n,e){let t=e-1;if(t<=0)return Math.max(t,0);let i=n.charCodeAt(t);if(i<56320||i>57343)return t;let r=t-1;if(r<0)return t;let o=n.charCodeAt(r);return o>=55296&&o<=56319?r:t}function Vt(n){if(n.length===0)return null;let e=io(n,n.length);return n.slice(e)}function Hl(n){let e=Array.from(n),t=e.length;for(;t>0;){let i=e[t-1];if(jt.test(i)){t--;continue}if(Nt.has(i)||Hn.has(i)){t--;continue}break}return t<=0||t===e.length?null:{head:e.slice(0,t).join(""),tail:e.slice(t).join("")}}function Ul(n,e,t){return t==="text"&&!e&&n.length===1&&n!=="-"&&n!=="\\u2014"?n:null}function Yr(n,e,t,i){let r=e[i],o=n[i];if(r==null)return o;let s=t[i];if(o.length===s)return o;let c=r.repeat(s);return n[i]=c,c}function Zr(n,e){return n&&e!==null&&Bl.has(e)}function ql(n){let e=Vt(n);return e!==null&&Ol.has(e)}function zl(n){if(n.length<2||n[0]!==" ")return null;let e=n.slice(1);return/^\\p{M}+$/u.test(e)?{space:" ",marks:e}:null}function Kt(n){let e=n.length;for(;e>0;){let t=io(n,e),i=n.slice(t,e);if(Pl.has(i))return!0;if(!Pe.has(i))return!1;e=t}return!1}function jl(n,e){if(e.preserveOrdinarySpaces||e.preserveHardBreaks){if(n===" ")return"preserved-space";if(n===" ")return"tab";if(e.preserveHardBreaks&&n===`\n`)return"hard-break"}return n===" "?"space":n==="\\xA0"||n==="\\u202F"||n==="\\u2060"||n==="\\uFEFF"?"glue":n==="\\u200B"?"zero-width-break":n==="\\xAD"?"soft-hyphen":"text"}var Gl=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function be(n){return n.length===1?n[0]:n.join("")}function $l(n,e){let t=[];for(let i=n.length-1;i>=0;i--)t.push(n[i]);return t.push(e),be(t)}function Vl(n,e,t,i){if(!Gl.test(n))return[{text:n,isWordLike:e,kind:"text",start:t}];let r=[],o=null,s=[],c=t,u=!1,a=0;for(let l of n){let f=jl(l,i),m=f==="text"&&e;if(o!==null&&f===o&&m===u){s.push(l),a+=l.length;continue}o!==null&&r.push({text:be(s),isWordLike:u,kind:o,start:c}),o=f,s=[l],c=t+a,u=m,a+=l.length}return o!==null&&r.push({text:be(s),isWordLike:u,kind:o,start:c}),r}function Wn(n){return n==="space"||n==="preserved-space"||n==="zero-width-break"||n==="hard-break"}var Kl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Jl(n,e){let t=n.texts[e];return t.startsWith("www.")?!0:Kl.test(t)&&e+1<n.len&&n.kinds[e+1]==="text"&&n.texts[e+1]==="//"}function Ql(n){return n.includes("?")&&(n.includes("://")||n.startsWith("www."))}function Yl(n){let e=n.texts.slice(),t=n.isWordLike.slice(),i=n.kinds.slice(),r=n.starts.slice();for(let s=0;s<n.len;s++){if(i[s]!=="text"||!Jl(n,s))continue;let c=[e[s]],u=s+1;for(;u<n.len&&!Wn(i[u]);){c.push(e[u]),t[s]=!0;let a=e[u].includes("?");if(i[u]="text",e[u]="",u++,a)break}e[s]=be(c)}let o=0;for(let s=0;s<e.length;s++){let c=e[s];c.length!==0&&(o!==s&&(e[o]=c,t[o]=t[s],i[o]=i[s],r[o]=r[s]),o++)}return e.length=o,t.length=o,i.length=o,r.length=o,{len:o,texts:e,isWordLike:t,kinds:i,starts:r}}function Zl(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o];if(e.push(s),t.push(n.isWordLike[o]),i.push(n.kinds[o]),r.push(n.starts[o]),!Ql(s))continue;let c=o+1;if(c>=n.len||Wn(n.kinds[c]))continue;let u=[],a=n.starts[c],l=c;for(;l<n.len&&!Wn(n.kinds[l]);)u.push(n.texts[l]),l++;u.length>0&&(e.push(be(u)),t.push(!0),i.push("text"),r.push(a),o=l-1)}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}var Xl=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),Xr=/^[A-Za-z0-9_]+[,:;]*$/,eo=/[,:;]+$/;function ro(n){for(let e of n)if(no.test(e))return!0;return!1}function bt(n){if(n.length===0)return!1;for(let e of n)if(!(no.test(e)||Xl.has(e)))return!1;return!0}function ea(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o],c=n.kinds[o];if(c==="text"&&bt(s)&&ro(s)){let u=[s],a=o+1;for(;a<n.len&&n.kinds[a]==="text"&&bt(n.texts[a]);)u.push(n.texts[a]),a++;e.push(be(u)),t.push(!0),i.push("text"),r.push(n.starts[o]),o=a-1;continue}e.push(s),t.push(n.isWordLike[o]),i.push(c),r.push(n.starts[o])}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function ta(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o],c=n.kinds[o],u=n.isWordLike[o];if(c==="text"&&u&&Xr.test(s)){let a=[s],l=eo.test(s),f=o+1;for(;l&&f<n.len&&n.kinds[f]==="text"&&n.isWordLike[f]&&Xr.test(n.texts[f]);){let m=n.texts[f];a.push(m),l=eo.test(m),f++}e.push(be(a)),t.push(!0),i.push("text"),r.push(n.starts[o]),o=f-1;continue}e.push(s),t.push(u),i.push(c),r.push(n.starts[o])}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function na(n){let e=[],t=[],i=[],r=[];for(let o=0;o<n.len;o++){let s=n.texts[o];if(n.kinds[o]==="text"&&s.includes("-")){let c=s.split("-"),u=c.length>1;for(let a=0;a<c.length;a++){let l=c[a];if(!u)break;(l.length===0||!ro(l)||!bt(l))&&(u=!1)}if(u){let a=0;for(let l=0;l<c.length;l++){let f=c[l],m=l<c.length-1?`${f}-`:f;e.push(m),t.push(!0),i.push("text"),r.push(n.starts[o]+a),a+=m.length}continue}}e.push(s),t.push(n.isWordLike[o]),i.push(n.kinds[o]),r.push(n.starts[o])}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function ia(n){let e=[],t=[],i=[],r=[],o=0;for(;o<n.len;){let s=[n.texts[o]],c=n.isWordLike[o],u=n.kinds[o],a=n.starts[o];if(u==="glue"){let l=[s[0]],f=a;for(o++;o<n.len&&n.kinds[o]==="glue";)l.push(n.texts[o]),o++;let m=be(l);if(o<n.len&&n.kinds[o]==="text")s[0]=m,s.push(n.texts[o]),c=n.isWordLike[o],u="text",a=f,o++;else{e.push(m),t.push(!1),i.push("glue"),r.push(f);continue}}else o++;if(u==="text")for(;o<n.len&&n.kinds[o]==="glue";){let l=[];for(;o<n.len&&n.kinds[o]==="glue";)l.push(n.texts[o]),o++;let f=be(l);if(o<n.len&&n.kinds[o]==="text"){s.push(f,n.texts[o]),c=c||n.isWordLike[o],o++;continue}s.push(f)}e.push(be(s)),t.push(c),i.push(u),r.push(a)}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function ra(n){let e=n.texts.slice(),t=n.isWordLike.slice(),i=n.kinds.slice(),r=n.starts.slice();for(let o=0;o<e.length-1;o++){if(i[o]!=="text"||i[o+1]!=="text"||!Me(e[o])||!Me(e[o+1]))continue;let s=Hl(e[o]);s!==null&&(e[o]=s.head,e[o+1]=s.tail+e[o+1],r[o+1]=r[o]+s.head.length)}return{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function to(n,e,t){let i=Dl(),r=0,o=[],s=[],c=[],u=[],a=[],l=[],f=[],m=[],h=[],M=[],C=[],A=[];for(let p of i.segment(n))for(let S of Vl(p.segment,p.isWordLike??!1,p.index,t)){let Z=function(){l[R]!==null&&(s[R]=[Yr(o,l,f,R)],l[R]=null),s[R].push(S.text),c[R]=c[R]||S.isWordLike,m[R]=m[R]||N,h[R]=h[R]||B,M[R]=H,C[R]=X,A[R]=Zr(h[R],W)},F=S.kind==="text",b=Ul(S.text,S.isWordLike,S.kind),N=Me(S.text),B=Jr(S.text),W=Vt(S.text),H=Kt(S.text),X=ql(S.text),R=r-1;e.carryCJKAfterClosingQuote&&F&&r>0&&u[R]==="text"&&N&&m[R]&&M[R]||F&&r>0&&u[R]==="text"&&Il(S.text)&&m[R]||F&&r>0&&u[R]==="text"&&C[R]?Z():F&&r>0&&u[R]==="text"&&S.isWordLike&&B&&A[R]?(Z(),c[R]=!0):b!==null&&r>0&&u[R]==="text"&&l[R]===b?f[R]=(f[R]??1)+1:F&&!S.isWordLike&&r>0&&u[R]==="text"&&(_l(S.text)||S.text==="-"&&c[R])?Z():(o[r]=S.text,s[r]=[S.text],c[r]=S.isWordLike,u[r]=S.kind,a[r]=S.start,l[r]=b,f[r]=b===null?0:1,m[r]=N,h[r]=B,M[r]=H,C[r]=X,A[r]=Zr(B,W),r++)}for(let p=0;p<r;p++){if(l[p]!==null){o[p]=Yr(o,l,f,p);continue}o[p]=be(s[p])}for(let p=1;p<r;p++)u[p]==="text"&&!c[p]&&Un(o[p])&&u[p-1]==="text"&&(o[p-1]+=o[p],c[p-1]=c[p-1]||c[p],o[p]="");let z=Array.from({length:r},()=>null),P=-1;for(let p=r-1;p>=0;p--){let S=o[p];if(S.length!==0){if(u[p]==="text"&&!c[p]&&Wl(S)&&P>=0&&u[P]==="text"){let F=z[P]??[];F.push(S),z[P]=F,a[P]=a[p],o[p]="";continue}P=p}}for(let p=0;p<r;p++){let S=z[p];S!=null&&(o[p]=$l(S,o[p]))}let k=0;for(let p=0;p<r;p++){let S=o[p];S.length!==0&&(k!==p&&(o[k]=S,c[k]=c[p],u[k]=u[p],a[k]=a[p]),k++)}o.length=k,c.length=k,u.length=k,a.length=k;let Y=ia({len:k,texts:o,isWordLike:c,kinds:u,starts:a}),y=ra(ta(na(ea(Zl(Yl(Y))))));for(let p=0;p<y.len-1;p++){let S=zl(y.texts[p]);S!==null&&(y.kinds[p]!=="space"&&y.kinds[p]!=="preserved-space"||y.kinds[p+1]!=="text"||!Jr(y.texts[p+1])||(y.texts[p]=S.space,y.isWordLike[p]=!1,y.kinds[p]=y.kinds[p]==="preserved-space"?"preserved-space":"space",y.texts[p+1]=S.marks+y.texts[p+1],y.starts[p+1]=y.starts[p]+S.space.length))}return y}function oa(n,e){if(n.len===0)return[];if(!e.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:n.len,consumedEndSegmentIndex:n.len}];let t=[],i=0;for(let r=0;r<n.len;r++)n.kinds[r]==="hard-break"&&(t.push({startSegmentIndex:i,endSegmentIndex:r,consumedEndSegmentIndex:r+1}),i=r+1);return i<n.len&&t.push({startSegmentIndex:i,endSegmentIndex:n.len,consumedEndSegmentIndex:n.len}),t}function sa(n){if(n.len<=1)return n;let e=[],t=[],i=[],r=[],o=null,s=!1,c=0,u=!1,a=!1;function l(){o!==null&&(e.push(be(o)),t.push(s),i.push("text"),r.push(c),o=null)}for(let f=0;f<n.len;f++){let m=n.texts[f],h=n.kinds[f],M=n.isWordLike[f],C=n.starts[f];if(h==="text"){let A=Tl(m),z=Gt(m);if(o!==null&&u&&a){o.push(m),s=s||M,u=u||A,a=z;continue}l(),o=[m],s=M,c=C,u=A,a=z;continue}l(),e.push(m),t.push(M),i.push(h),r.push(C)}return l(),{len:e.length,texts:e,isWordLike:t,kinds:i,starts:r}}function oo(n,e,t="normal",i="normal"){let r=Nl(t),o=r.mode==="pre-wrap"?Cl(n):wl(n);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let s=i==="keep-all"?sa(to(o,e,r)):to(o,e,r);return{normalized:o,chunks:oa(s,r),...s}}var Ye=null,so=new Map,Ze=null,la=96,aa=/\\p{Emoji_Presentation}/u,ua=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,qn=null,lo=new Map;function zn(){if(Ye!==null)return Ye;if(typeof OffscreenCanvas<"u")return Ye=new OffscreenCanvas(1,1).getContext("2d"),Ye;if(typeof document<"u")return Ye=document.createElement("canvas").getContext("2d"),Ye;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function ca(n){let e=so.get(n);return e||(e=new Map,so.set(n,e)),e}function Le(n,e){let t=e.get(n);return t===void 0&&(t={width:zn().measureText(n).width,containsCJK:Me(n)},e.set(n,t)),t}function Xe(){if(Ze!==null)return Ze;if(typeof navigator>"u")return Ze={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ze;let n=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&n.includes("Safari/")&&!n.includes("Chrome/")&&!n.includes("Chromium/")&&!n.includes("CriOS/")&&!n.includes("FxiOS/")&&!n.includes("EdgiOS/"),i=n.includes("Chrome/")||n.includes("Chromium/")||n.includes("CriOS/")||n.includes("Edg/");return Ze={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:i,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Ze}function da(n){let e=n.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return e?parseFloat(e[1]):16}function ao(){return qn===null&&(qn=new Intl.Segmenter(void 0,{granularity:"grapheme"})),qn}function fa(n){return aa.test(n)||n.includes("\\uFE0F")}function uo(n){return ua.test(n)}function ma(n,e){let t=lo.get(n);if(t!==void 0)return t;let i=zn();i.font=n;let r=i.measureText("\\u{1F600}").width;if(t=0,r>e+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=n,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let s=o.getBoundingClientRect().width;document.body.removeChild(o),r-s>.5&&(t=r-s)}return lo.set(n,t),t}function pa(n){let e=0,t=ao();for(let i of t.segment(n))fa(i.segment)&&e++;return e}function ha(n,e){return e.emojiCount===void 0&&(e.emojiCount=pa(n)),e.emojiCount}function _e(n,e,t){return t===0?e.width:e.width-ha(n,e)*t}function co(n,e,t,i,r){if(e.breakableFitAdvances!==void 0)return e.breakableFitAdvances;let o=ao(),s=[];for(let l of o.segment(n))s.push(l.segment);if(s.length<=1)return e.breakableFitAdvances=null,e.breakableFitAdvances;if(r==="sum-graphemes"){let l=[];for(let f of s){let m=Le(f,t);l.push(_e(f,m,i))}return e.breakableFitAdvances=l,e.breakableFitAdvances}if(r==="pair-context"||s.length>la){let l=[],f=null,m=0;for(let h of s){let M=Le(h,t),C=_e(h,M,i);if(f===null)l.push(C);else{let A=f+h,z=Le(A,t);l.push(_e(A,z,i)-m)}f=h,m=C}return e.breakableFitAdvances=l,e.breakableFitAdvances}let c=[],u="",a=0;for(let l of s){u+=l;let f=Le(u,t),m=_e(u,f,i);c.push(m-a),a=m}return e.breakableFitAdvances=c,e.breakableFitAdvances}function fo(n,e){let t=zn();t.font=n;let i=ca(n),r=da(n),o=e?ma(n,r):0;return{cache:i,fontSize:r,emojiCorrection:o}}function xa(n,e){for(;e<n.widths.length;){let t=n.kinds[e];if(t!=="space"&&t!=="zero-width-break"&&t!=="soft-hyphen")break;e++}return e}function ga(n,e){if(e<=0)return 0;let t=n%e;return Math.abs(t)<=1e-6?e:e-t}function Sa(n,e,t,i,r){let o=0,s=e;for(;o<n.length;){let c=s+n[o];if((o+1<n.length?c+r:c)>t+i)break;s=c,o++}return{fitCount:o,fittedWidth:s}}function mo(n,e){return n.simpleLineWalkFastPath?po(n,e):ho(n,e)}function po(n,e,t){let{widths:i,kinds:r,breakableFitAdvances:o}=n;if(i.length===0)return 0;let c=Xe().lineFitEpsilon,u=e+c,a=0,l=0,f=!1,m=0,h=0,M=0,C=0,A=-1,z=0;function P(){A=-1,z=0}function k(b=M,N=C,B=l){a++,t?.({startSegmentIndex:m,startGraphemeIndex:h,endSegmentIndex:b,endGraphemeIndex:N,width:B}),l=0,f=!1,P()}function Y(b,N){f=!0,m=b,h=0,M=b+1,C=0,l=N}function y(b,N,B){f=!0,m=b,h=N,M=b,C=N+1,l=B}function p(b,N){if(!f){Y(b,N);return}l+=N,M=b+1,C=0}function S(b,N){let B=o[b];for(let W=N;W<B.length;W++){let H=B[W];f?l+H>u?(k(),y(b,W,H)):(l+=H,M=b,C=W+1):y(b,W,H)}f&&M===b&&C===B.length&&(M=b+1,C=0)}let F=0;for(;F<i.length&&!(!f&&(F=xa(n,F),F>=i.length));){let b=i[F],N=r[F],B=N==="space"||N==="preserved-space"||N==="tab"||N==="zero-width-break"||N==="soft-hyphen";if(!f){b>e&&o[F]!==null?S(F,0):Y(F,b),B&&(A=F+1,z=l-b),F++;continue}if(l+b>u){if(B){p(F,b),k(F+1,0,l-b),F++;continue}if(A>=0){if(M>A||M===A&&C>0){k();continue}k(A,0,z);continue}if(b>e&&o[F]!==null){k(),S(F,0),F++;continue}k();continue}p(F,b),B&&(A=F+1,z=l-b),F++}return f&&k(),a}function ho(n,e,t){if(n.simpleLineWalkFastPath)return po(n,e,t);let{widths:i,lineEndFitAdvances:r,lineEndPaintAdvances:o,kinds:s,breakableFitAdvances:c,discretionaryHyphenWidth:u,tabStopAdvance:a,chunks:l}=n;if(i.length===0||l.length===0)return 0;let f=Xe(),m=f.lineFitEpsilon,h=e+m,M=0,C=0,A=!1,z=0,P=0,k=0,Y=0,y=-1,p=0,S=0,F=null;function b(){y=-1,p=0,S=0,F=null}function N(U=k,G=Y,v=C){M++,t?.({startSegmentIndex:z,startGraphemeIndex:P,endSegmentIndex:U,endGraphemeIndex:G,width:v}),C=0,A=!1,b()}function B(U,G){A=!0,z=U,P=0,k=U+1,Y=0,C=G}function W(U,G,v){A=!0,z=U,P=G,k=U,Y=G+1,C=v}function H(U,G){if(!A){B(U,G);return}C+=G,k=U+1,Y=0}function X(U,G,v,J){if(!G)return;let Ee=U==="tab"?0:r[v],xe=U==="tab"?J:o[v];y=v+1,p=C-J+Ee,S=C-J+xe,F=U}function R(U,G){let v=c[U];for(let J=G;J<v.length;J++){let Ee=v[J];A?C+Ee>h?(N(),W(U,J,Ee)):(C+=Ee,k=U,Y=J+1):W(U,J,Ee)}A&&k===U&&Y===v.length&&(k=U+1,Y=0)}function Z(U){if(F!=="soft-hyphen")return!1;let G=c[U];if(G==null)return!1;let{fitCount:v,fittedWidth:J}=Sa(G,C,e,m,u);return v===0?!1:(C=J,k=U,Y=v,b(),v===G.length?(k=U+1,Y=0,!0):(N(U,v,J+u),R(U,v),!0))}function ee(U){M++,t?.({startSegmentIndex:U.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:U.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),b()}for(let U=0;U<l.length;U++){let G=l[U];if(G.startSegmentIndex===G.endSegmentIndex){ee(G);continue}A=!1,C=0,z=G.startSegmentIndex,P=0,k=G.startSegmentIndex,Y=0,b();let v=G.startSegmentIndex;for(;v<G.endSegmentIndex;){let J=s[v],Ee=J==="space"||J==="preserved-space"||J==="tab"||J==="zero-width-break"||J==="soft-hyphen",xe=J==="tab"?ga(C,a):i[v];if(J==="soft-hyphen"){A&&(k=v+1,Y=0,y=v+1,p=C+u,S=C+u,F=J),v++;continue}if(!A){xe>e&&c[v]!==null?R(v,0):B(v,xe),X(J,Ee,v,xe),v++;continue}if(C+xe>h){let D=C+(J==="tab"?0:r[v]),L=C+(J==="tab"?xe:o[v]);if(F==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&p<=h){N(y,0,S);continue}if(F==="soft-hyphen"&&Z(v)){v++;continue}if(Ee&&D<=h){H(v,xe),N(v+1,0,L),v++;continue}if(y>=0&&p<=h){if(k>y||k===y&&Y>0){N();continue}let Q=y;N(Q,0,S),v=Q;continue}if(xe>e&&c[v]!==null){N(),R(v,0),v++;continue}N();continue}H(v,xe),X(J,Ee,v,xe),v++}if(A){let J=y===G.consumedEndSegmentIndex?S:C;N(G.consumedEndSegmentIndex,0,J)}}return M}var jn=null;function ya(){return jn===null&&(jn=new Intl.Segmenter(void 0,{granularity:"grapheme"})),jn}function Aa(n){return n?{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 Ea(n,e){let t=[],i=[],r=0,o=!1,s=!1,c=!1;function u(){i.length!==0&&(t.push({text:i.length===1?i[0]:i.join(""),start:r}),i=[],o=!1,s=!1,c=!1)}function a(f,m,h){i=[f],r=m,o=h,s=Kt(f),c=Nt.has(f)}function l(f,m){i.push(f),o=o||m;let h=Kt(f);f.length===1&&Pe.has(f)?s=s||h:s=h,c=!1}for(let f of ya().segment(n)){let m=f.segment,h=Me(m);if(i.length===0){a(m,f.index,h);continue}if(c||$t.has(m)||Pe.has(m)||e.carryCJKAfterClosingQuote&&h&&s){l(m,h);continue}if(!o&&!h){l(m,h);continue}u(),a(m,f.index,h)}return u(),t}function Fa(n){if(n.length<=1)return n;let e=[],t=[n[0].text],i=n[0].start,r=Me(n[0].text),o=Gt(n[0].text);function s(){e.push({text:t.length===1?t[0]:t.join(""),start:i})}for(let c=1;c<n.length;c++){let u=n[c],a=Me(u.text),l=Gt(u.text);if(r&&o){t.push(u.text),r=r||a,o=l;continue}s(),t=[u.text],i=u.start,r=a,o=l}return s(),e}function ba(n,e,t,i){let r=Xe(),{cache:o,emojiCorrection:s}=fo(e,uo(n.normalized)),c=_e("-",Le("-",o),s),a=_e(" ",Le(" ",o),s)*8;if(n.len===0)return Aa(t);let l=[],f=[],m=[],h=[],M=n.chunks.length<=1,C=t?[]:null,A=[],z=t?[]:null,P=Array.from({length:n.len});function k(S,F,b,N,B,W,H){B!=="text"&&B!=="space"&&B!=="zero-width-break"&&(M=!1),l.push(F),f.push(b),m.push(N),h.push(B),C?.push(W),A.push(H),z!==null&&z.push(S)}function Y(S,F,b,N,B){let W=Le(S,o),H=_e(S,W,s),X=F==="space"||F==="preserved-space"||F==="zero-width-break"?0:H,R=F==="space"||F==="zero-width-break"?0:H;if(B&&N&&S.length>1){let Z="sum-graphemes";bt(S)?Z="pair-context":r.preferPrefixWidthsForBreakableRuns&&(Z="segment-prefixes");let ee=co(S,W,o,s,Z);k(S,H,X,R,F,b,ee);return}k(S,H,X,R,F,b,null)}for(let S=0;S<n.len;S++){P[S]=l.length;let F=n.texts[S],b=n.isWordLike[S],N=n.kinds[S],B=n.starts[S];if(N==="soft-hyphen"){k(F,0,c,c,N,B,null);continue}if(N==="hard-break"){k(F,0,0,0,N,B,null);continue}if(N==="tab"){k(F,0,0,0,N,B,null);continue}let W=Le(F,o);if(N==="text"&&W.containsCJK){let H=Ea(F,r),X=i==="keep-all"?Fa(H):H;for(let R=0;R<X.length;R++){let Z=X[R];Y(Z.text,"text",B+Z.start,b,i==="keep-all"||!Me(Z.text))}continue}Y(F,N,B,b,!0)}let y=Na(n.chunks,P,l.length),p=C===null?null:Kr(n.normalized,C);return z!==null?{widths:l,lineEndFitAdvances:f,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:M,segLevels:p,breakableFitAdvances:A,discretionaryHyphenWidth:c,tabStopAdvance:a,chunks:y,segments:z}:{widths:l,lineEndFitAdvances:f,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:M,segLevels:p,breakableFitAdvances:A,discretionaryHyphenWidth:c,tabStopAdvance:a,chunks:y}}function Na(n,e,t){let i=[];for(let r=0;r<n.length;r++){let o=n[r],s=o.startSegmentIndex<e.length?e[o.startSegmentIndex]:t,c=o.endSegmentIndex<e.length?e[o.endSegmentIndex]:t,u=o.consumedEndSegmentIndex<e.length?e[o.consumedEndSegmentIndex]:t;i.push({startSegmentIndex:s,endSegmentIndex:c,consumedEndSegmentIndex:u})}return i}function wa(n,e,t,i){let r=i?.wordBreak??"normal",o=oo(n,Xe(),i?.whiteSpace,r);return ba(o,e,t,r)}function xo(n,e,t){return wa(n,e,!1,t)}function go(n,e,t){let i=mo(n,e);return{lineCount:i,height:i*t}}var Ca={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function So(n,e){let t={...Ca,...e},i=1.2;for(let r=t.baseFontSize;r>=t.minFontSize;r-=t.step){let o=`${t.fontWeight} ${r}px ${t.fontFamily}`,s=xo(n,o),{lineCount:c}=go(s,t.maxWidth,r*i);if(c<=1)return{fontSize:r,fits:!0}}return{fontSize:t.minFontSize,fits:!1}}window.__timelines=window.__timelines||{};window.__hyperframes={fitTextFontSize:So};function yo(){let n=window;n.__hyperframeRuntimeBootstrapped||(n.__hyperframeRuntimeBootstrapped=!0,$r())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",yo,{once:!0}):yo();})();\n';
6208
6260
  }
6209
6261
  });
6210
6262
 
@@ -8441,22 +8493,22 @@ function getMeasureContext() {
8441
8493
  throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");
8442
8494
  }
8443
8495
  function getSegmentMetricCache(font) {
8444
- let cache2 = segmentMetricCaches.get(font);
8445
- if (!cache2) {
8446
- cache2 = /* @__PURE__ */ new Map();
8447
- segmentMetricCaches.set(font, cache2);
8496
+ let cache = segmentMetricCaches.get(font);
8497
+ if (!cache) {
8498
+ cache = /* @__PURE__ */ new Map();
8499
+ segmentMetricCaches.set(font, cache);
8448
8500
  }
8449
- return cache2;
8501
+ return cache;
8450
8502
  }
8451
- function getSegmentMetrics(seg, cache2) {
8452
- let metrics = cache2.get(seg);
8503
+ function getSegmentMetrics(seg, cache) {
8504
+ let metrics = cache.get(seg);
8453
8505
  if (metrics === void 0) {
8454
8506
  const ctx = getMeasureContext();
8455
8507
  metrics = {
8456
8508
  width: ctx.measureText(seg).width,
8457
8509
  containsCJK: isCJK(seg)
8458
8510
  };
8459
- cache2.set(seg, metrics);
8511
+ cache.set(seg, metrics);
8460
8512
  }
8461
8513
  return metrics;
8462
8514
  }
@@ -8545,7 +8597,7 @@ function getCorrectedSegmentWidth(seg, metrics, emojiCorrection) {
8545
8597
  return metrics.width;
8546
8598
  return metrics.width - getEmojiCount(seg, metrics) * emojiCorrection;
8547
8599
  }
8548
- function getSegmentBreakableFitAdvances(seg, metrics, cache2, emojiCorrection, mode) {
8600
+ function getSegmentBreakableFitAdvances(seg, metrics, cache, emojiCorrection, mode) {
8549
8601
  if (metrics.breakableFitAdvances !== void 0)
8550
8602
  return metrics.breakableFitAdvances;
8551
8603
  const graphemeSegmenter = getSharedGraphemeSegmenter();
@@ -8560,7 +8612,7 @@ function getSegmentBreakableFitAdvances(seg, metrics, cache2, emojiCorrection, m
8560
8612
  if (mode === "sum-graphemes") {
8561
8613
  const advances2 = [];
8562
8614
  for (const grapheme of graphemes) {
8563
- const graphemeMetrics = getSegmentMetrics(grapheme, cache2);
8615
+ const graphemeMetrics = getSegmentMetrics(grapheme, cache);
8564
8616
  advances2.push(getCorrectedSegmentWidth(grapheme, graphemeMetrics, emojiCorrection));
8565
8617
  }
8566
8618
  metrics.breakableFitAdvances = advances2;
@@ -8571,13 +8623,13 @@ function getSegmentBreakableFitAdvances(seg, metrics, cache2, emojiCorrection, m
8571
8623
  let previousGrapheme = null;
8572
8624
  let previousWidth = 0;
8573
8625
  for (const grapheme of graphemes) {
8574
- const graphemeMetrics = getSegmentMetrics(grapheme, cache2);
8626
+ const graphemeMetrics = getSegmentMetrics(grapheme, cache);
8575
8627
  const currentWidth = getCorrectedSegmentWidth(grapheme, graphemeMetrics, emojiCorrection);
8576
8628
  if (previousGrapheme === null) {
8577
8629
  advances2.push(currentWidth);
8578
8630
  } else {
8579
8631
  const pair = previousGrapheme + grapheme;
8580
- const pairMetrics = getSegmentMetrics(pair, cache2);
8632
+ const pairMetrics = getSegmentMetrics(pair, cache);
8581
8633
  advances2.push(getCorrectedSegmentWidth(pair, pairMetrics, emojiCorrection) - previousWidth);
8582
8634
  }
8583
8635
  previousGrapheme = grapheme;
@@ -8591,7 +8643,7 @@ function getSegmentBreakableFitAdvances(seg, metrics, cache2, emojiCorrection, m
8591
8643
  let prefixWidth = 0;
8592
8644
  for (const grapheme of graphemes) {
8593
8645
  prefix += grapheme;
8594
- const prefixMetrics = getSegmentMetrics(prefix, cache2);
8646
+ const prefixMetrics = getSegmentMetrics(prefix, cache);
8595
8647
  const nextPrefixWidth = getCorrectedSegmentWidth(prefix, prefixMetrics, emojiCorrection);
8596
8648
  advances.push(nextPrefixWidth - prefixWidth);
8597
8649
  prefixWidth = nextPrefixWidth;
@@ -8602,10 +8654,10 @@ function getSegmentBreakableFitAdvances(seg, metrics, cache2, emojiCorrection, m
8602
8654
  function getFontMeasurementState(font, needsEmojiCorrection) {
8603
8655
  const ctx = getMeasureContext();
8604
8656
  ctx.font = font;
8605
- const cache2 = getSegmentMetricCache(font);
8657
+ const cache = getSegmentMetricCache(font);
8606
8658
  const fontSize = parseFontSize(font);
8607
8659
  const emojiCorrection = needsEmojiCorrection ? getEmojiCorrection(font, fontSize) : 0;
8608
- return { cache: cache2, fontSize, emojiCorrection };
8660
+ return { cache, fontSize, emojiCorrection };
8609
8661
  }
8610
8662
  var measureContext, segmentMetricCaches, cachedEngineProfile, MAX_PREFIX_FIT_GRAPHEMES, emojiPresentationRe, maybeEmojiRe, sharedGraphemeSegmenter, emojiCorrectionCache;
8611
8663
  var init_measurement = __esm({
@@ -9149,9 +9201,9 @@ function mergeKeepAllTextUnits(units) {
9149
9201
  }
9150
9202
  function measureAnalysis(analysis, font, includeSegments, wordBreak) {
9151
9203
  const engineProfile = getEngineProfile();
9152
- const { cache: cache2, emojiCorrection } = getFontMeasurementState(font, textMayContainEmoji(analysis.normalized));
9153
- const discretionaryHyphenWidth = getCorrectedSegmentWidth("-", getSegmentMetrics("-", cache2), emojiCorrection);
9154
- const spaceWidth = getCorrectedSegmentWidth(" ", getSegmentMetrics(" ", cache2), emojiCorrection);
9204
+ const { cache, emojiCorrection } = getFontMeasurementState(font, textMayContainEmoji(analysis.normalized));
9205
+ const discretionaryHyphenWidth = getCorrectedSegmentWidth("-", getSegmentMetrics("-", cache), emojiCorrection);
9206
+ const spaceWidth = getCorrectedSegmentWidth(" ", getSegmentMetrics(" ", cache), emojiCorrection);
9155
9207
  const tabStopAdvance = spaceWidth * 8;
9156
9208
  if (analysis.len === 0)
9157
9209
  return createEmptyPrepared(includeSegments);
@@ -9178,7 +9230,7 @@ function measureAnalysis(analysis, font, includeSegments, wordBreak) {
9178
9230
  segments.push(text);
9179
9231
  }
9180
9232
  function pushMeasuredTextSegment(text, kind, start, wordLike, allowOverflowBreaks) {
9181
- const textMetrics = getSegmentMetrics(text, cache2);
9233
+ const textMetrics = getSegmentMetrics(text, cache);
9182
9234
  const width = getCorrectedSegmentWidth(text, textMetrics, emojiCorrection);
9183
9235
  const lineEndFitAdvance = kind === "space" || kind === "preserved-space" || kind === "zero-width-break" ? 0 : width;
9184
9236
  const lineEndPaintAdvance = kind === "space" || kind === "zero-width-break" ? 0 : width;
@@ -9189,7 +9241,7 @@ function measureAnalysis(analysis, font, includeSegments, wordBreak) {
9189
9241
  } else if (engineProfile.preferPrefixWidthsForBreakableRuns) {
9190
9242
  fitMode = "segment-prefixes";
9191
9243
  }
9192
- const fitAdvances = getSegmentBreakableFitAdvances(text, textMetrics, cache2, emojiCorrection, fitMode);
9244
+ const fitAdvances = getSegmentBreakableFitAdvances(text, textMetrics, cache, emojiCorrection, fitMode);
9193
9245
  pushMeasuredSegment(text, width, lineEndFitAdvance, lineEndPaintAdvance, kind, start, fitAdvances);
9194
9246
  return;
9195
9247
  }
@@ -9213,7 +9265,7 @@ function measureAnalysis(analysis, font, includeSegments, wordBreak) {
9213
9265
  pushMeasuredSegment(segText, 0, 0, 0, segKind, segStart, null);
9214
9266
  continue;
9215
9267
  }
9216
- const segMetrics = getSegmentMetrics(segText, cache2);
9268
+ const segMetrics = getSegmentMetrics(segText, cache);
9217
9269
  if (segKind === "text" && segMetrics.containsCJK) {
9218
9270
  const baseUnits = buildBaseCjkUnits(segText, engineProfile);
9219
9271
  const measuredUnits = wordBreak === "keep-all" ? mergeKeepAllTextUnits(baseUnits) : baseUnits;
@@ -9490,9 +9542,12 @@ function readCache(path2) {
9490
9542
  }
9491
9543
  }
9492
9544
  function writeCache(path2, data) {
9493
- mkdirSync(dirname3(path2), { recursive: true });
9494
- const entry = { fetchedAt: Date.now(), data };
9495
- writeFileSync(path2, JSON.stringify(entry), "utf-8");
9545
+ try {
9546
+ mkdirSync(dirname3(path2), { recursive: true });
9547
+ const entry = { fetchedAt: Date.now(), data };
9548
+ writeFileSync(path2, JSON.stringify(entry), "utf-8");
9549
+ } catch {
9550
+ }
9496
9551
  }
9497
9552
  async function fetchJson(url) {
9498
9553
  const res = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
@@ -11379,6 +11434,10 @@ var init_fileWatcher = __esm({
11379
11434
  });
11380
11435
 
11381
11436
  // src/server/runtimeSource.ts
11437
+ var runtimeSource_exports = {};
11438
+ __export(runtimeSource_exports, {
11439
+ loadRuntimeSource: () => loadRuntimeSource
11440
+ });
11382
11441
  import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
11383
11442
  import { resolve as resolve7, dirname as dirname4 } from "path";
11384
11443
  async function loadRuntimeSource() {
@@ -11489,7 +11548,7 @@ function registerProjectRoutes(api, adapter2) {
11489
11548
  const project = await adapter2.resolveProject(c2.req.param("id"));
11490
11549
  if (!project) return c2.json({ error: "not found" }, 404);
11491
11550
  const files = walkDir(project.dir);
11492
- return c2.json({ id: project.id, files });
11551
+ return c2.json({ id: project.id, dir: project.dir, title: project.title, files });
11493
11552
  });
11494
11553
  }
11495
11554
  var init_projects = __esm({
@@ -28495,23 +28554,23 @@ var init_videoFrameExtractor = __esm({
28495
28554
  // ../engine/src/services/videoFrameInjector.ts
28496
28555
  import { promises as fs } from "fs";
28497
28556
  function createFrameDataUriCache(cacheLimit) {
28498
- const cache2 = /* @__PURE__ */ new Map();
28557
+ const cache = /* @__PURE__ */ new Map();
28499
28558
  const inFlight = /* @__PURE__ */ new Map();
28500
28559
  function remember(framePath, dataUri) {
28501
- if (cache2.has(framePath)) {
28502
- cache2.delete(framePath);
28560
+ if (cache.has(framePath)) {
28561
+ cache.delete(framePath);
28503
28562
  }
28504
- cache2.set(framePath, dataUri);
28505
- if (cache2.size > cacheLimit) {
28506
- const oldestKey = cache2.keys().next().value;
28563
+ cache.set(framePath, dataUri);
28564
+ if (cache.size > cacheLimit) {
28565
+ const oldestKey = cache.keys().next().value;
28507
28566
  if (oldestKey) {
28508
- cache2.delete(oldestKey);
28567
+ cache.delete(oldestKey);
28509
28568
  }
28510
28569
  }
28511
28570
  return dataUri;
28512
28571
  }
28513
28572
  async function get(framePath) {
28514
- const cached2 = cache2.get(framePath);
28573
+ const cached2 = cache.get(framePath);
28515
28574
  if (cached2) {
28516
28575
  remember(framePath, cached2);
28517
28576
  return cached2;
@@ -28693,6 +28752,33 @@ async function queryElementStacking(page, nativeHdrIds) {
28693
28752
  }
28694
28753
  return [0, 0, 0, 0];
28695
28754
  }
28755
+ function getClipRect(node) {
28756
+ let current = node.parentElement;
28757
+ let clip = null;
28758
+ while (current) {
28759
+ const cs = window.getComputedStyle(current);
28760
+ if (cs.overflow === "hidden" || cs.overflow === "clip") {
28761
+ const r2 = current.getBoundingClientRect();
28762
+ const ancestor = {
28763
+ x: Math.round(r2.x),
28764
+ y: Math.round(r2.y),
28765
+ width: Math.round(r2.width),
28766
+ height: Math.round(r2.height)
28767
+ };
28768
+ if (!clip) {
28769
+ clip = ancestor;
28770
+ } else {
28771
+ const x1 = Math.max(clip.x, ancestor.x);
28772
+ const y1 = Math.max(clip.y, ancestor.y);
28773
+ const x22 = Math.min(clip.x + clip.width, ancestor.x + ancestor.width);
28774
+ const y2 = Math.min(clip.y + clip.height, ancestor.y + ancestor.height);
28775
+ clip = { x: x1, y: y1, width: Math.max(0, x22 - x1), height: Math.max(0, y2 - y1) };
28776
+ }
28777
+ }
28778
+ current = current.parentElement;
28779
+ }
28780
+ return clip;
28781
+ }
28696
28782
  function getEffectiveOpacity(node) {
28697
28783
  let opacity = 1;
28698
28784
  let current = node;
@@ -28773,7 +28859,8 @@ async function queryElementStacking(page, nativeHdrIds) {
28773
28859
  // for non-replaced elements); normalize to the CSS defaults so callers
28774
28860
  // can rely on a populated value.
28775
28861
  objectFit: style.objectFit || "fill",
28776
- objectPosition: style.objectPosition || "50% 50%"
28862
+ objectPosition: style.objectPosition || "50% 50%",
28863
+ clipRect: isHdrEl ? getClipRect(el) : null
28777
28864
  });
28778
28865
  }
28779
28866
  return results;
@@ -29126,6 +29213,7 @@ function calculateOptimalWorkers(totalFrames, requested, config) {
29126
29213
  const effectiveCoresPerWorker = config?.coresPerWorker ?? DEFAULT_CONFIG2.coresPerWorker;
29127
29214
  const effectiveMinParallelFrames = config?.minParallelFrames ?? DEFAULT_CONFIG2.minParallelFrames;
29128
29215
  const effectiveLargeRenderThreshold = config?.largeRenderThreshold ?? DEFAULT_CONFIG2.largeRenderThreshold;
29216
+ const captureCostMultiplier = Math.max(1, config?.captureCostMultiplier ?? 1);
29129
29217
  if (requested !== void 0) {
29130
29218
  return Math.max(MIN_WORKERS, Math.min(effectiveMaxWorkers, requested));
29131
29219
  }
@@ -29138,8 +29226,14 @@ function calculateOptimalWorkers(totalFrames, requested, config) {
29138
29226
  const optimal = Math.min(cpuBasedWorkers, memoryBasedWorkers, frameBasedWorkers);
29139
29227
  const minWorkersForJob = totalFrames >= effectiveMinParallelFrames ? 2 : MIN_WORKERS;
29140
29228
  let finalWorkers = Math.max(minWorkersForJob, Math.min(effectiveMaxWorkers, optimal));
29141
- if (totalFrames >= effectiveLargeRenderThreshold) {
29142
- const cpuScaledMax = Math.max(2, Math.floor(cpuCount / effectiveCoresPerWorker));
29229
+ const weightedFrames = totalFrames * captureCostMultiplier;
29230
+ const contentionThreshold = Math.max(
29231
+ effectiveMinParallelFrames,
29232
+ Math.floor(effectiveLargeRenderThreshold / 3)
29233
+ );
29234
+ if (totalFrames >= effectiveLargeRenderThreshold || weightedFrames >= contentionThreshold) {
29235
+ const weightedCoresPerWorker = effectiveCoresPerWorker * captureCostMultiplier;
29236
+ const cpuScaledMax = Math.max(MIN_WORKERS, Math.floor(cpuCount / weightedCoresPerWorker));
29143
29237
  if (finalWorkers > cpuScaledMax) {
29144
29238
  finalWorkers = cpuScaledMax;
29145
29239
  }
@@ -29654,6 +29748,7 @@ function roundedRectAlpha(px, py, w, h3, radii) {
29654
29748
  function blitRgb48leRegion(canvas, source, dx, dy, sw, sh, canvasWidth, canvasHeight, opacity, borderRadius) {
29655
29749
  if (sw <= 0 || sh <= 0) return;
29656
29750
  const op = opacity ?? 1;
29751
+ if (op <= 0) return;
29657
29752
  const x0 = Math.max(0, dx);
29658
29753
  const y0 = Math.max(0, dy);
29659
29754
  const x1 = Math.min(canvasWidth, dx + sw);
@@ -29669,6 +29764,31 @@ function blitRgb48leRegion(canvas, source, dx, dy, sw, sh, canvasWidth, canvasHe
29669
29764
  const dstRowOff = ((y0 + y2) * canvasWidth + x0) * 6;
29670
29765
  source.copy(canvas, dstRowOff, srcRowOff, srcRowOff + clippedW * 6);
29671
29766
  }
29767
+ } else if (!hasMask) {
29768
+ const invOp = 1 - op;
29769
+ for (let y2 = 0; y2 < y1 - y0; y2++) {
29770
+ let srcOff = ((srcOffsetY + y2) * sw + srcOffsetX) * 6;
29771
+ let dstOff = ((y0 + y2) * canvasWidth + x0) * 6;
29772
+ for (let x4 = 0; x4 < clippedW; x4++) {
29773
+ const sr = source[srcOff] | source[srcOff + 1] << 8;
29774
+ const sg = source[srcOff + 2] | source[srcOff + 3] << 8;
29775
+ const sb = source[srcOff + 4] | source[srcOff + 5] << 8;
29776
+ const dr = canvas[dstOff] | canvas[dstOff + 1] << 8;
29777
+ const dg = canvas[dstOff + 2] | canvas[dstOff + 3] << 8;
29778
+ const db = canvas[dstOff + 4] | canvas[dstOff + 5] << 8;
29779
+ const r2 = sr * op + dr * invOp + 0.5 | 0;
29780
+ const g = sg * op + dg * invOp + 0.5 | 0;
29781
+ const b = sb * op + db * invOp + 0.5 | 0;
29782
+ canvas[dstOff] = r2 & 255;
29783
+ canvas[dstOff + 1] = r2 >>> 8;
29784
+ canvas[dstOff + 2] = g & 255;
29785
+ canvas[dstOff + 3] = g >>> 8;
29786
+ canvas[dstOff + 4] = b & 255;
29787
+ canvas[dstOff + 5] = b >>> 8;
29788
+ srcOff += 6;
29789
+ dstOff += 6;
29790
+ }
29791
+ }
29672
29792
  } else {
29673
29793
  for (let y2 = 0; y2 < y1 - y0; y2++) {
29674
29794
  for (let x4 = 0; x4 < clippedW; x4++) {
@@ -29716,6 +29836,7 @@ function blitRgb48leAffine(canvas, source, matrix, srcW, srcH, canvasW, canvasH,
29716
29836
  const invTx = -(invA * tx + invC * ty);
29717
29837
  const invTy = -(invB * tx + invD * ty);
29718
29838
  const op = opacity ?? 1;
29839
+ if (op <= 0) return;
29719
29840
  const hasMask = borderRadius !== void 0;
29720
29841
  const corners = [
29721
29842
  [tx, ty],
@@ -32899,6 +33020,17 @@ function detectRenderModeHints(html) {
32899
33020
  reasons
32900
33021
  };
32901
33022
  }
33023
+ function detectShaderTransitionUsage(html) {
33024
+ let scriptMatch;
33025
+ const scriptPattern = new RegExp(INLINE_SCRIPT_PATTERN.source, INLINE_SCRIPT_PATTERN.flags);
33026
+ while ((scriptMatch = scriptPattern.exec(html)) !== null) {
33027
+ const attrs = scriptMatch[1] || "";
33028
+ if (/\bsrc\s*=/i.test(attrs)) continue;
33029
+ const content = stripJsComments(stripCompilerMountBootstrap(scriptMatch[2] || ""));
33030
+ if (SHADER_TRANSITION_USAGE_PATTERN.test(content)) return true;
33031
+ }
33032
+ return false;
33033
+ }
32902
33034
  async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagName19) {
32903
33035
  let filePath = src;
32904
33036
  if (isHttpUrl(src)) {
@@ -33435,6 +33567,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir) {
33435
33567
  "$1"
33436
33568
  );
33437
33569
  const renderModeHints = detectRenderModeHints(sanitizedHtml);
33570
+ const hasShaderTransitions = detectShaderTransitionUsage(sanitizedHtml);
33438
33571
  const coalescedHtml = await injectDeterministicFontFaces(
33439
33572
  coalesceHeadStylesAndBodyScripts2(promoteCssImportsToLinkTags(sanitizedHtml))
33440
33573
  );
@@ -33482,7 +33615,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir) {
33482
33615
  width,
33483
33616
  height,
33484
33617
  staticDuration,
33485
- renderModeHints
33618
+ renderModeHints,
33619
+ hasShaderTransitions
33486
33620
  };
33487
33621
  }
33488
33622
  async function discoverMediaFromBrowser(page) {
@@ -33584,10 +33718,11 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
33584
33718
  audios,
33585
33719
  images,
33586
33720
  unresolvedCompositions: remaining,
33587
- renderModeHints: compiled.renderModeHints
33721
+ renderModeHints: compiled.renderModeHints,
33722
+ hasShaderTransitions: compiled.hasShaderTransitions
33588
33723
  };
33589
33724
  }
33590
- var INLINE_SCRIPT_PATTERN, COMPILER_MOUNT_BLOCK_START, COMPILER_MOUNT_BLOCK_END;
33725
+ var INLINE_SCRIPT_PATTERN, COMPILER_MOUNT_BLOCK_START, COMPILER_MOUNT_BLOCK_END, SHADER_TRANSITION_USAGE_PATTERN;
33591
33726
  var init_htmlCompiler2 = __esm({
33592
33727
  "../producer/src/services/htmlCompiler.ts"() {
33593
33728
  "use strict";
@@ -33602,6 +33737,7 @@ var init_htmlCompiler2 = __esm({
33602
33737
  INLINE_SCRIPT_PATTERN = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
33603
33738
  COMPILER_MOUNT_BLOCK_START = "/* __HF_COMPILER_MOUNT_START__ */";
33604
33739
  COMPILER_MOUNT_BLOCK_END = "/* __HF_COMPILER_MOUNT_END__ */";
33740
+ SHADER_TRANSITION_USAGE_PATTERN = /\b(?:(?:window|globalThis)\s*\.\s*)?HyperShader\s*\.\s*init\s*\(|\b__hf\s*\.\s*transitions\s*=/;
33605
33741
  }
33606
33742
  });
33607
33743
 
@@ -33650,45 +33786,6 @@ var init_logger = __esm({
33650
33786
  }
33651
33787
  });
33652
33788
 
33653
- // ../producer/src/services/frameDirCache.ts
33654
- import { readdirSync as readdirSync13 } from "fs";
33655
- function getMaxFrameIndex(frameDir) {
33656
- const cached2 = cache.get(frameDir);
33657
- if (cached2 !== void 0) {
33658
- cache.delete(frameDir);
33659
- cache.set(frameDir, cached2);
33660
- return cached2;
33661
- }
33662
- let max = 0;
33663
- try {
33664
- for (const name of readdirSync13(frameDir)) {
33665
- const m2 = FRAME_FILENAME_RE.exec(name);
33666
- if (!m2) continue;
33667
- const n = Number(m2[1]);
33668
- if (Number.isFinite(n) && n > max) max = n;
33669
- }
33670
- } catch {
33671
- }
33672
- if (cache.size >= MAX_ENTRIES) {
33673
- const oldest = cache.keys().next().value;
33674
- if (oldest !== void 0) cache.delete(oldest);
33675
- }
33676
- cache.set(frameDir, max);
33677
- return max;
33678
- }
33679
- function clearMaxFrameIndex(frameDir) {
33680
- return cache.delete(frameDir);
33681
- }
33682
- var cache, FRAME_FILENAME_RE, MAX_ENTRIES;
33683
- var init_frameDirCache = __esm({
33684
- "../producer/src/services/frameDirCache.ts"() {
33685
- "use strict";
33686
- cache = /* @__PURE__ */ new Map();
33687
- FRAME_FILENAME_RE = /^frame_(\d+)\.png$/;
33688
- MAX_ENTRIES = 1e3;
33689
- }
33690
- });
33691
-
33692
33789
  // ../producer/src/services/hdrImageTransferCache.ts
33693
33790
  function createHdrImageTransferCache(options = {}) {
33694
33791
  const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
@@ -33761,7 +33858,10 @@ import {
33761
33858
  mkdirSync as mkdirSync20,
33762
33859
  rmSync as rmSync7,
33763
33860
  readFileSync as readFileSync23,
33764
- readdirSync as readdirSync14,
33861
+ openSync,
33862
+ readSync,
33863
+ closeSync,
33864
+ readdirSync as readdirSync13,
33765
33865
  statSync as statSync11,
33766
33866
  writeFileSync as writeFileSync14,
33767
33867
  copyFileSync as copyFileSync2,
@@ -33788,7 +33888,7 @@ function sampleDirectoryBytes(dir) {
33788
33888
  if (!current) continue;
33789
33889
  let entries2 = [];
33790
33890
  try {
33791
- entries2 = readdirSync14(current);
33891
+ entries2 = readdirSync13(current);
33792
33892
  } catch {
33793
33893
  continue;
33794
33894
  }
@@ -33822,6 +33922,94 @@ function countNonZeroRgb48(buf) {
33822
33922
  }
33823
33923
  return n;
33824
33924
  }
33925
+ function createHdrPerfCollector() {
33926
+ return {
33927
+ frames: 0,
33928
+ normalFrames: 0,
33929
+ transitionFrames: 0,
33930
+ domLayerCaptures: 0,
33931
+ hdrVideoLayerBlits: 0,
33932
+ hdrImageLayerBlits: 0,
33933
+ timings: {
33934
+ frameSeekMs: 0,
33935
+ frameInjectMs: 0,
33936
+ stackingQueryMs: 0,
33937
+ canvasClearMs: 0,
33938
+ normalCompositeMs: 0,
33939
+ transitionCompositeMs: 0,
33940
+ encoderWriteMs: 0,
33941
+ hdrVideoReadDecodeMs: 0,
33942
+ hdrVideoTransferMs: 0,
33943
+ hdrVideoBlitMs: 0,
33944
+ hdrImageTransferMs: 0,
33945
+ hdrImageBlitMs: 0,
33946
+ domLayerSeekMs: 0,
33947
+ domLayerInjectMs: 0,
33948
+ domMaskApplyMs: 0,
33949
+ domScreenshotMs: 0,
33950
+ domMaskRemoveMs: 0,
33951
+ domPngDecodeMs: 0,
33952
+ domBlitMs: 0
33953
+ }
33954
+ };
33955
+ }
33956
+ function addHdrTiming(perf, key2, startMs) {
33957
+ if (!perf) return;
33958
+ perf.timings[key2] += Date.now() - startMs;
33959
+ }
33960
+ function averageTiming(totalMs, count) {
33961
+ return count > 0 ? Math.round(totalMs / count * 100) / 100 : 0;
33962
+ }
33963
+ function finalizeHdrPerf(perf) {
33964
+ const avgMs = {};
33965
+ const perFrameKeys = [
33966
+ "frameSeekMs",
33967
+ "frameInjectMs",
33968
+ "stackingQueryMs",
33969
+ "canvasClearMs",
33970
+ "encoderWriteMs"
33971
+ ];
33972
+ for (const key2 of perFrameKeys) avgMs[key2] = averageTiming(perf.timings[key2], perf.frames);
33973
+ avgMs.normalCompositeMs = averageTiming(perf.timings.normalCompositeMs, perf.normalFrames);
33974
+ avgMs.transitionCompositeMs = averageTiming(
33975
+ perf.timings.transitionCompositeMs,
33976
+ perf.transitionFrames
33977
+ );
33978
+ const perDomLayerKeys = [
33979
+ "domLayerSeekMs",
33980
+ "domLayerInjectMs",
33981
+ "domMaskApplyMs",
33982
+ "domScreenshotMs",
33983
+ "domMaskRemoveMs",
33984
+ "domPngDecodeMs",
33985
+ "domBlitMs"
33986
+ ];
33987
+ for (const key2 of perDomLayerKeys) {
33988
+ avgMs[key2] = averageTiming(perf.timings[key2], perf.domLayerCaptures);
33989
+ }
33990
+ const perHdrVideoKeys = [
33991
+ "hdrVideoReadDecodeMs",
33992
+ "hdrVideoTransferMs",
33993
+ "hdrVideoBlitMs"
33994
+ ];
33995
+ for (const key2 of perHdrVideoKeys) {
33996
+ avgMs[key2] = averageTiming(perf.timings[key2], perf.hdrVideoLayerBlits);
33997
+ }
33998
+ const perHdrImageKeys = ["hdrImageTransferMs", "hdrImageBlitMs"];
33999
+ for (const key2 of perHdrImageKeys) {
34000
+ avgMs[key2] = averageTiming(perf.timings[key2], perf.hdrImageLayerBlits);
34001
+ }
34002
+ return {
34003
+ frames: perf.frames,
34004
+ normalFrames: perf.normalFrames,
34005
+ transitionFrames: perf.transitionFrames,
34006
+ domLayerCaptures: perf.domLayerCaptures,
34007
+ hdrVideoLayerBlits: perf.hdrVideoLayerBlits,
34008
+ hdrImageLayerBlits: perf.hdrImageLayerBlits,
34009
+ timings: { ...perf.timings },
34010
+ avgMs
34011
+ };
34012
+ }
33825
34013
  function projectBrowserEndToCompositionTimeline(existingStart, browserStart, browserEnd) {
33826
34014
  return browserEnd + (existingStart - browserStart);
33827
34015
  }
@@ -33905,7 +34093,8 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
33905
34093
  mediaStart: a.mediaStart
33906
34094
  })),
33907
34095
  subCompositions: Array.from(compiled.subCompositions.keys()),
33908
- renderModeHints: compiled.renderModeHints
34096
+ renderModeHints: compiled.renderModeHints,
34097
+ hasShaderTransitions: compiled.hasShaderTransitions
33909
34098
  };
33910
34099
  writeFileSync14(join36(compileDir, "summary.json"), JSON.stringify(summary, null, 2), "utf-8");
33911
34100
  }
@@ -33918,30 +34107,375 @@ function applyRenderModeHints(cfg, compiled, log2 = defaultLogger) {
33918
34107
  reasons: compiled.renderModeHints.reasons.map((reason) => reason.message)
33919
34108
  });
33920
34109
  }
33921
- function blitHdrVideoLayer(canvas, el, time, fps, hdrFrameDirs, hdrStartTimes, width, height, log2, sourceTransfer, targetTransfer) {
33922
- const frameDir = hdrFrameDirs.get(el.id);
34110
+ function resolveRenderWorkerCount(totalFrames, requestedWorkers, cfg, compiled, composition, log2 = defaultLogger, measuredCaptureCost) {
34111
+ const captureCost = combineCaptureCostEstimates(
34112
+ estimateCaptureCostMultiplier(compiled, composition),
34113
+ measuredCaptureCost
34114
+ );
34115
+ const workerCount = calculateOptimalWorkers(totalFrames, requestedWorkers, {
34116
+ ...cfg,
34117
+ captureCostMultiplier: captureCost.multiplier
34118
+ });
34119
+ if (requestedWorkers !== void 0 || captureCost.multiplier <= 1) {
34120
+ return workerCount;
34121
+ }
34122
+ const baselineWorkers = calculateOptimalWorkers(totalFrames, void 0, cfg);
34123
+ if (workerCount < baselineWorkers) {
34124
+ log2.warn(
34125
+ "[Render] Reduced auto worker count for high-cost capture workload to avoid Chrome compositor starvation.",
34126
+ {
34127
+ from: baselineWorkers,
34128
+ to: workerCount,
34129
+ costMultiplier: captureCost.multiplier,
34130
+ reasons: captureCost.reasons
34131
+ }
34132
+ );
34133
+ }
34134
+ return workerCount;
34135
+ }
34136
+ function estimateCaptureCostMultiplier(compiled, composition) {
34137
+ let multiplier = 1;
34138
+ const reasons = [];
34139
+ if (compiled.hasShaderTransitions) {
34140
+ multiplier += 2;
34141
+ reasons.push("shader-transitions");
34142
+ }
34143
+ const reasonCodes = new Set(compiled.renderModeHints.reasons.map((reason) => reason.code));
34144
+ if (reasonCodes.has("requestAnimationFrame")) {
34145
+ multiplier += 1;
34146
+ reasons.push("requestAnimationFrame");
34147
+ }
34148
+ if (reasonCodes.has("iframe")) {
34149
+ multiplier += 0.5;
34150
+ reasons.push("iframe");
34151
+ }
34152
+ if (composition.videos.length > 0) {
34153
+ multiplier += Math.min(2, composition.videos.length * 0.75);
34154
+ reasons.push(`${composition.videos.length} video${composition.videos.length === 1 ? "" : "s"}`);
34155
+ }
34156
+ if (composition.audios.length > 0) {
34157
+ multiplier += Math.min(1, composition.audios.length * 0.75);
34158
+ reasons.push(`${composition.audios.length} audio${composition.audios.length === 1 ? "" : "s"}`);
34159
+ }
34160
+ return {
34161
+ multiplier: Math.round(multiplier * 100) / 100,
34162
+ reasons
34163
+ };
34164
+ }
34165
+ function combineCaptureCostEstimates(staticCost, measuredCost) {
34166
+ if (!measuredCost || measuredCost.multiplier <= 1) return staticCost;
34167
+ if (staticCost.multiplier >= measuredCost.multiplier) {
34168
+ return {
34169
+ multiplier: staticCost.multiplier,
34170
+ reasons: [...staticCost.reasons, ...measuredCost.reasons],
34171
+ p95Ms: measuredCost.p95Ms
34172
+ };
34173
+ }
34174
+ return {
34175
+ multiplier: measuredCost.multiplier,
34176
+ reasons: [...measuredCost.reasons, ...staticCost.reasons],
34177
+ p95Ms: measuredCost.p95Ms
34178
+ };
34179
+ }
34180
+ function createCaptureCalibrationConfig(cfg) {
34181
+ return {
34182
+ ...cfg,
34183
+ protocolTimeout: Math.min(cfg.protocolTimeout, CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS)
34184
+ };
34185
+ }
34186
+ function estimateMeasuredCaptureCostMultiplier(samples) {
34187
+ if (samples.length === 0) {
34188
+ return { multiplier: 1, reasons: [] };
34189
+ }
34190
+ const sorted = [...samples].sort((a, b) => a.captureTimeMs - b.captureTimeMs);
34191
+ const p95Index = Math.max(0, Math.ceil(sorted.length * 0.95) - 1);
34192
+ const p95Sample = sorted[p95Index] ?? sorted[sorted.length - 1];
34193
+ if (!p95Sample) {
34194
+ return { multiplier: 1, reasons: [] };
34195
+ }
34196
+ const p95Ms = Math.round(p95Sample.captureTimeMs);
34197
+ const multiplier = Math.min(
34198
+ MAX_MEASURED_CAPTURE_COST_MULTIPLIER,
34199
+ Math.max(1, Math.round(p95Ms / CAPTURE_CALIBRATION_TARGET_MS * 100) / 100)
34200
+ );
34201
+ return {
34202
+ multiplier,
34203
+ reasons: multiplier > 1 ? [`calibration-p95=${p95Ms}ms`] : [],
34204
+ p95Ms
34205
+ };
34206
+ }
34207
+ function selectCaptureCalibrationFrames(totalFrames) {
34208
+ if (totalFrames <= 0) return [];
34209
+ const lastFrame = totalFrames - 1;
34210
+ const candidates = [
34211
+ 0,
34212
+ Math.floor(totalFrames * 0.25),
34213
+ Math.floor(totalFrames * 0.5),
34214
+ Math.floor(totalFrames * 0.75),
34215
+ lastFrame
34216
+ ];
34217
+ return Array.from(
34218
+ new Set(candidates.map((frame) => Math.max(0, Math.min(lastFrame, frame))))
34219
+ ).sort((a, b) => a - b);
34220
+ }
34221
+ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
34222
+ const ranges = [];
34223
+ let rangeStart = null;
34224
+ for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
34225
+ const framePath = join36(framesDir, `frame_${String(frameIndex).padStart(6, "0")}.${frameExt}`);
34226
+ const missing = !existsSync34(framePath);
34227
+ if (missing && rangeStart === null) {
34228
+ rangeStart = frameIndex;
34229
+ } else if (!missing && rangeStart !== null) {
34230
+ ranges.push({ startFrame: rangeStart, endFrame: frameIndex });
34231
+ rangeStart = null;
34232
+ }
34233
+ }
34234
+ if (rangeStart !== null) {
34235
+ ranges.push({ startFrame: rangeStart, endFrame: totalFrames });
34236
+ }
34237
+ return ranges;
34238
+ }
34239
+ function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt) {
34240
+ const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
34241
+ const batches = [];
34242
+ for (let i2 = 0; i2 < ranges.length; i2 += workersPerBatch) {
34243
+ const batchIndex = batches.length;
34244
+ const batch = ranges.slice(i2, i2 + workersPerBatch).map((range, workerId) => ({
34245
+ workerId,
34246
+ startFrame: range.startFrame,
34247
+ endFrame: range.endFrame,
34248
+ outputDir: join36(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`)
34249
+ }));
34250
+ batches.push(batch);
34251
+ }
34252
+ return batches;
34253
+ }
34254
+ function getNextRetryWorkerCount(currentWorkers) {
34255
+ return Math.max(1, Math.floor(currentWorkers / 2));
34256
+ }
34257
+ function isRecoverableParallelCaptureError(error) {
34258
+ const message = error instanceof Error ? error.message : String(error);
34259
+ return message.includes("[Parallel] Capture failed") && /Runtime\.callFunctionOn timed out|HeadlessExperimental\.beginFrame timed out|Waiting failed|timeout exceeded|timed out|Navigation timeout|Protocol error|Target closed/i.test(
34260
+ message
34261
+ );
34262
+ }
34263
+ function shouldFallbackToScreenshotAfterCalibrationError(error) {
34264
+ const message = error instanceof Error ? error.message : String(error);
34265
+ return /HeadlessExperimental\.beginFrame timed out|beginFrame probe timeout|Another frame is pending|Frame still pending|Protocol error.*HeadlessExperimental\.beginFrame/i.test(
34266
+ message
34267
+ );
34268
+ }
34269
+ function countCapturedFrames(totalFrames, framesDir, frameExt) {
34270
+ let captured = 0;
34271
+ for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
34272
+ const framePath = join36(framesDir, `frame_${String(frameIndex).padStart(6, "0")}.${frameExt}`);
34273
+ if (existsSync34(framePath)) captured++;
34274
+ }
34275
+ return captured;
34276
+ }
34277
+ function countFrameRanges(ranges) {
34278
+ return ranges.reduce((sum, range) => sum + (range.endFrame - range.startFrame), 0);
34279
+ }
34280
+ async function measureCaptureCostFromSession(session, totalFrames, fps) {
34281
+ const sampledFrames = selectCaptureCalibrationFrames(totalFrames);
34282
+ const samples = [];
34283
+ for (const frameIndex of sampledFrames) {
34284
+ const time = frameIndex / fps;
34285
+ const startedAt = Date.now();
34286
+ const result = await captureFrameToBuffer(session, frameIndex, time);
34287
+ samples.push({
34288
+ frameIndex,
34289
+ captureTimeMs: result.captureTimeMs || Date.now() - startedAt
34290
+ });
34291
+ }
34292
+ return {
34293
+ estimate: estimateMeasuredCaptureCostMultiplier(samples),
34294
+ samples
34295
+ };
34296
+ }
34297
+ async function executeDiskCaptureWithAdaptiveRetry(options) {
34298
+ const attempts = [];
34299
+ let currentWorkers = options.initialWorkerCount;
34300
+ let missingRanges = null;
34301
+ let attempt = 0;
34302
+ while (true) {
34303
+ const frameCount = missingRanges ? countFrameRanges(missingRanges) : options.totalFrames;
34304
+ attempts.push({
34305
+ attempt,
34306
+ workers: currentWorkers,
34307
+ frameCount,
34308
+ reason: attempt === 0 ? "initial" : "retry"
34309
+ });
34310
+ const attemptWorkDir = join36(options.workDir, `capture-attempt-${attempt}`);
34311
+ const batches = missingRanges ? buildMissingFrameRetryBatches(missingRanges, currentWorkers, attemptWorkDir, attempt) : [distributeFrames(options.totalFrames, currentWorkers, attemptWorkDir)];
34312
+ try {
34313
+ for (const tasks of batches) {
34314
+ const capturedBeforeBatch = countCapturedFrames(
34315
+ options.totalFrames,
34316
+ options.framesDir,
34317
+ options.frameExt
34318
+ );
34319
+ try {
34320
+ await executeParallelCapture(
34321
+ options.serverUrl,
34322
+ attemptWorkDir,
34323
+ tasks,
34324
+ options.captureOptions,
34325
+ options.createBeforeCaptureHook,
34326
+ options.abortSignal,
34327
+ options.onProgress ? (progress) => {
34328
+ options.onProgress?.({
34329
+ ...progress,
34330
+ totalFrames: options.totalFrames,
34331
+ capturedFrames: Math.min(
34332
+ options.totalFrames,
34333
+ capturedBeforeBatch + progress.capturedFrames
34334
+ )
34335
+ });
34336
+ } : void 0,
34337
+ void 0,
34338
+ options.cfg
34339
+ );
34340
+ } finally {
34341
+ await mergeWorkerFrames(attemptWorkDir, tasks, options.framesDir);
34342
+ }
34343
+ }
34344
+ const remaining = findMissingFrameRanges(
34345
+ options.totalFrames,
34346
+ options.framesDir,
34347
+ options.frameExt
34348
+ );
34349
+ if (remaining.length === 0) {
34350
+ return attempts;
34351
+ }
34352
+ if (!options.allowRetry || currentWorkers <= 1) {
34353
+ throw new Error(
34354
+ `[Render] Capture completed but ${countFrameRanges(remaining)} frame(s) are missing`
34355
+ );
34356
+ }
34357
+ const nextWorkers = getNextRetryWorkerCount(currentWorkers);
34358
+ options.log.warn("[Render] Retrying missing captured frames with fewer workers.", {
34359
+ fromWorkers: currentWorkers,
34360
+ toWorkers: nextWorkers,
34361
+ missingFrames: countFrameRanges(remaining)
34362
+ });
34363
+ currentWorkers = nextWorkers;
34364
+ missingRanges = remaining;
34365
+ attempt++;
34366
+ } catch (error) {
34367
+ const remaining = findMissingFrameRanges(
34368
+ options.totalFrames,
34369
+ options.framesDir,
34370
+ options.frameExt
34371
+ );
34372
+ if (remaining.length === 0) {
34373
+ return attempts;
34374
+ }
34375
+ if (!options.allowRetry || currentWorkers <= 1 || !isRecoverableParallelCaptureError(error)) {
34376
+ throw error;
34377
+ }
34378
+ const nextWorkers = getNextRetryWorkerCount(currentWorkers);
34379
+ options.log.warn("[Render] Parallel capture timed out; retrying missing frames.", {
34380
+ fromWorkers: currentWorkers,
34381
+ toWorkers: nextWorkers,
34382
+ missingFrames: countFrameRanges(remaining),
34383
+ error: error instanceof Error ? error.message : String(error)
34384
+ });
34385
+ currentWorkers = nextWorkers;
34386
+ missingRanges = remaining;
34387
+ attempt++;
34388
+ }
34389
+ }
34390
+ }
34391
+ function cropRgb48le(src, srcW, srcH, cropX, cropY, cropW, cropH) {
34392
+ const BPP = 6;
34393
+ const dst = Buffer.alloc(cropW * cropH * BPP);
34394
+ for (let row = 0; row < cropH; row++) {
34395
+ const srcRow = cropY + row;
34396
+ if (srcRow < 0 || srcRow >= srcH) continue;
34397
+ const srcOff = (srcRow * srcW + cropX) * BPP;
34398
+ const dstOff = row * cropW * BPP;
34399
+ const copyLen = Math.min(cropW, srcW - cropX) * BPP;
34400
+ if (copyLen > 0) src.copy(dst, dstOff, srcOff, srcOff + copyLen);
34401
+ }
34402
+ return dst;
34403
+ }
34404
+ function closeHdrVideoFrameSource(source, log2) {
34405
+ try {
34406
+ closeSync(source.fd);
34407
+ } catch (err) {
34408
+ log2?.warn("Failed to close HDR raw frame file", {
34409
+ rawPath: source.rawPath,
34410
+ error: err instanceof Error ? err.message : String(err)
34411
+ });
34412
+ }
34413
+ }
34414
+ function blitHdrVideoLayer(canvas, el, time, fps, hdrVideoFrameSources, hdrStartTimes, width, height, log2, sourceTransfer, targetTransfer, hdrPerf) {
34415
+ const frameSource = hdrVideoFrameSources.get(el.id);
33923
34416
  const startTime = hdrStartTimes.get(el.id);
33924
- if (!frameDir || startTime === void 0) {
34417
+ if (!frameSource || startTime === void 0 || el.opacity <= 0) {
33925
34418
  return;
33926
34419
  }
33927
34420
  const videoFrameIndex = Math.round((time - startTime) * fps) + 1;
33928
34421
  if (videoFrameIndex < 1) return;
33929
- const maxIndex = getMaxFrameIndex(frameDir);
33930
- const effectiveIndex = maxIndex > 0 ? Math.min(videoFrameIndex, maxIndex) : videoFrameIndex;
33931
- const framePath = join36(frameDir, `frame_${String(effectiveIndex).padStart(4, "0")}.png`);
33932
- if (!existsSync34(framePath)) {
33933
- return;
33934
- }
34422
+ const effectiveIndex = Math.min(videoFrameIndex, frameSource.frameCount);
34423
+ if (effectiveIndex < 1) return;
34424
+ const frameOffset = (effectiveIndex - 1) * frameSource.frameSize;
33935
34425
  try {
33936
- const { data: hdrRgb, width: srcW, height: srcH } = decodePngToRgb48le(readFileSync23(framePath));
34426
+ if (hdrPerf) hdrPerf.hdrVideoLayerBlits += 1;
34427
+ let timingStart = Date.now();
34428
+ const bytesRead = readSync(
34429
+ frameSource.fd,
34430
+ frameSource.scratch,
34431
+ 0,
34432
+ frameSource.frameSize,
34433
+ frameOffset
34434
+ );
34435
+ if (bytesRead !== frameSource.frameSize) return;
34436
+ const hdrRgb = frameSource.scratch;
34437
+ const srcW = frameSource.width;
34438
+ const srcH = frameSource.height;
34439
+ addHdrTiming(hdrPerf, "hdrVideoReadDecodeMs", timingStart);
33937
34440
  if (sourceTransfer && targetTransfer && sourceTransfer !== targetTransfer) {
34441
+ timingStart = Date.now();
33938
34442
  convertTransfer(hdrRgb, sourceTransfer, targetTransfer);
34443
+ addHdrTiming(hdrPerf, "hdrVideoTransferMs", timingStart);
33939
34444
  }
33940
34445
  const viewportMatrix = parseTransformMatrix(el.transform);
33941
34446
  const br = el.borderRadius;
33942
34447
  const hasBorderRadius = br[0] > 0 || br[1] > 0 || br[2] > 0 || br[3] > 0;
33943
34448
  const borderRadiusParam = hasBorderRadius ? br : void 0;
33944
- if (viewportMatrix) {
34449
+ let blitX = el.x;
34450
+ let blitY = el.y;
34451
+ let blitSrcX = 0;
34452
+ let blitSrcY = 0;
34453
+ let blitW = srcW;
34454
+ let blitH = srcH;
34455
+ let clipped = false;
34456
+ if (el.clipRect) {
34457
+ const cr = el.clipRect;
34458
+ const cx1 = Math.max(blitX, cr.x);
34459
+ const cy1 = Math.max(blitY, cr.y);
34460
+ const cx2 = Math.min(blitX + blitW, cr.x + cr.width);
34461
+ const cy2 = Math.min(blitY + blitH, cr.y + cr.height);
34462
+ if (cx2 <= cx1 || cy2 <= cy1) return;
34463
+ blitSrcX = cx1 - blitX;
34464
+ blitSrcY = cy1 - blitY;
34465
+ blitW = cx2 - cx1;
34466
+ blitH = cy2 - cy1;
34467
+ blitX = cx1;
34468
+ blitY = cy1;
34469
+ clipped = true;
34470
+ }
34471
+ const isTranslationOnly = !!(viewportMatrix && Math.abs(viewportMatrix[0] - 1) < 1e-3 && Math.abs(viewportMatrix[1]) < 1e-3 && Math.abs(viewportMatrix[2]) < 1e-3 && Math.abs(viewportMatrix[3] - 1) < 1e-3);
34472
+ timingStart = Date.now();
34473
+ if (viewportMatrix && !isTranslationOnly) {
34474
+ if (clipped && log2) {
34475
+ log2.debug(
34476
+ `HDR clip rect on affine-transformed element ${el.id} \u2014 clip not applied (affine scissor not yet supported)`
34477
+ );
34478
+ }
33945
34479
  blitRgb48leAffine(
33946
34480
  canvas,
33947
34481
  hdrRgb,
@@ -33953,6 +34487,20 @@ function blitHdrVideoLayer(canvas, el, time, fps, hdrFrameDirs, hdrStartTimes, w
33953
34487
  el.opacity < 0.999 ? el.opacity : void 0,
33954
34488
  borderRadiusParam
33955
34489
  );
34490
+ } else if (clipped) {
34491
+ const croppedBuf = cropRgb48le(hdrRgb, srcW, srcH, blitSrcX, blitSrcY, blitW, blitH);
34492
+ blitRgb48leRegion(
34493
+ canvas,
34494
+ croppedBuf,
34495
+ blitX,
34496
+ blitY,
34497
+ blitW,
34498
+ blitH,
34499
+ width,
34500
+ height,
34501
+ el.opacity < 0.999 ? el.opacity : void 0,
34502
+ borderRadiusParam
34503
+ );
33956
34504
  } else {
33957
34505
  blitRgb48leRegion(
33958
34506
  canvas,
@@ -33967,6 +34515,7 @@ function blitHdrVideoLayer(canvas, el, time, fps, hdrFrameDirs, hdrStartTimes, w
33967
34515
  borderRadiusParam
33968
34516
  );
33969
34517
  }
34518
+ addHdrTiming(hdrPerf, "hdrVideoBlitMs", timingStart);
33970
34519
  } catch (err) {
33971
34520
  if (log2) {
33972
34521
  log2.debug(`HDR blit failed for ${el.id}`, {
@@ -33975,17 +34524,24 @@ function blitHdrVideoLayer(canvas, el, time, fps, hdrFrameDirs, hdrStartTimes, w
33975
34524
  }
33976
34525
  }
33977
34526
  }
33978
- function blitHdrImageLayer(canvas, el, hdrImageBuffers, hdrImageTransferCache, width, height, log2, sourceTransfer, targetTransfer) {
34527
+ function blitHdrImageLayer(canvas, el, hdrImageBuffers, hdrImageTransferCache, width, height, log2, sourceTransfer, targetTransfer, hdrPerf) {
33979
34528
  const buf = hdrImageBuffers.get(el.id);
33980
- if (!buf) {
34529
+ if (!buf || el.opacity <= 0) {
33981
34530
  return;
33982
34531
  }
34532
+ if (el.clipRect && log2) {
34533
+ log2.debug(`HDR clip rect on image element ${el.id} \u2014 clip not yet supported for images`);
34534
+ }
33983
34535
  try {
34536
+ if (hdrPerf) hdrPerf.hdrImageLayerBlits += 1;
34537
+ let timingStart = Date.now();
33984
34538
  const hdrRgb = sourceTransfer && targetTransfer ? hdrImageTransferCache.getConverted(el.id, sourceTransfer, targetTransfer, buf.data) : buf.data;
34539
+ addHdrTiming(hdrPerf, "hdrImageTransferMs", timingStart);
33985
34540
  const viewportMatrix = parseTransformMatrix(el.transform);
33986
34541
  const br = el.borderRadius;
33987
34542
  const hasBorderRadius = br[0] > 0 || br[1] > 0 || br[2] > 0 || br[3] > 0;
33988
34543
  const borderRadiusParam = hasBorderRadius ? br : void 0;
34544
+ timingStart = Date.now();
33989
34545
  if (viewportMatrix) {
33990
34546
  blitRgb48leAffine(
33991
34547
  canvas,
@@ -34012,6 +34568,7 @@ function blitHdrImageLayer(canvas, el, hdrImageBuffers, hdrImageTransferCache, w
34012
34568
  borderRadiusParam
34013
34569
  );
34014
34570
  }
34571
+ addHdrTiming(hdrPerf, "hdrImageBlitMs", timingStart);
34015
34572
  } catch (err) {
34016
34573
  if (log2) {
34017
34574
  log2.debug(`HDR image blit failed for ${el.id}`, {
@@ -34032,12 +34589,13 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34032
34589
  nativeHdrImageIds,
34033
34590
  hdrImageBuffers,
34034
34591
  hdrImageTransferCache,
34035
- hdrFrameDirs,
34592
+ hdrVideoFrameSources,
34036
34593
  hdrVideoStartTimes,
34037
34594
  imageTransfers,
34038
34595
  videoTransfers,
34039
34596
  debugDumpEnabled,
34040
- debugDumpDir
34597
+ debugDumpDir,
34598
+ hdrPerf
34041
34599
  } = ctx;
34042
34600
  const filteredStacking = elementFilter ? fullStacking.filter((e2) => elementFilter.has(e2.id)) : fullStacking;
34043
34601
  const layers = groupIntoLayers(filteredStacking);
@@ -34064,6 +34622,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34064
34622
  }
34065
34623
  for (const [layerIdx, layer] of layers.entries()) {
34066
34624
  if (layer.type === "hdr") {
34625
+ if (layer.element.opacity <= 0) continue;
34067
34626
  const before2 = shouldLog ? countNonZeroRgb48(canvas) : 0;
34068
34627
  const isHdrImage = nativeHdrImageIds.has(layer.element.id);
34069
34628
  if (isHdrImage) {
@@ -34076,7 +34635,8 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34076
34635
  height,
34077
34636
  log2,
34078
34637
  imageTransfers.get(layer.element.id),
34079
- effectiveHdr.transfer
34638
+ effectiveHdr.transfer,
34639
+ hdrPerf
34080
34640
  );
34081
34641
  } else {
34082
34642
  blitHdrVideoLayer(
@@ -34084,13 +34644,14 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34084
34644
  layer.element,
34085
34645
  time,
34086
34646
  fps,
34087
- hdrFrameDirs,
34647
+ hdrVideoFrameSources,
34088
34648
  hdrVideoStartTimes,
34089
34649
  width,
34090
34650
  height,
34091
34651
  log2,
34092
34652
  videoTransfers.get(layer.element.id),
34093
- effectiveHdr.transfer
34653
+ effectiveHdr.transfer,
34654
+ hdrPerf
34094
34655
  );
34095
34656
  }
34096
34657
  if (shouldLog) {
@@ -34108,11 +34669,10 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34108
34669
  bufferDims: buf ? `${buf.width}x${buf.height}` : null
34109
34670
  });
34110
34671
  } else {
34111
- const frameDir = hdrFrameDirs.get(layer.element.id);
34672
+ const frameSource = hdrVideoFrameSources.get(layer.element.id);
34112
34673
  const startTime = hdrVideoStartTimes.get(layer.element.id) ?? 0;
34113
34674
  const localTime = time - startTime;
34114
34675
  const frameNum = Math.floor(localTime * fps) + 1;
34115
- const expectedFrame = frameDir ? join36(frameDir, `frame_${String(frameNum).padStart(4, "0")}.png`) : null;
34116
34676
  log2.info("[diag] hdr layer blit", {
34117
34677
  frame: debugFrameIndex,
34118
34678
  layerIdx,
@@ -34123,8 +34683,8 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34123
34683
  startTime,
34124
34684
  localTime: localTime.toFixed(3),
34125
34685
  hdrFrameNum: frameNum,
34126
- expectedFrame,
34127
- expectedFrameExists: expectedFrame ? existsSync34(expectedFrame) : false
34686
+ rawPath: frameSource?.rawPath ?? null,
34687
+ frameCount: frameSource?.frameCount ?? null
34128
34688
  });
34129
34689
  }
34130
34690
  }
@@ -34132,20 +34692,35 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
34132
34692
  const allElementIds = fullStacking.map((e2) => e2.id);
34133
34693
  const layerIds = new Set(layer.elementIds);
34134
34694
  const hideIds = allElementIds.filter((id) => !layerIds.has(id));
34695
+ if (hdrPerf) hdrPerf.domLayerCaptures += 1;
34696
+ let timingStart = Date.now();
34135
34697
  await domSession.page.evaluate((t3) => {
34136
34698
  if (window.__hf && typeof window.__hf.seek === "function") window.__hf.seek(t3);
34137
34699
  }, time);
34700
+ addHdrTiming(hdrPerf, "domLayerSeekMs", timingStart);
34138
34701
  if (beforeCaptureHook) {
34702
+ timingStart = Date.now();
34139
34703
  await beforeCaptureHook(domSession.page, time);
34704
+ addHdrTiming(hdrPerf, "domLayerInjectMs", timingStart);
34140
34705
  }
34706
+ timingStart = Date.now();
34141
34707
  await applyDomLayerMask(domSession.page, layer.elementIds, hideIds);
34708
+ addHdrTiming(hdrPerf, "domMaskApplyMs", timingStart);
34709
+ timingStart = Date.now();
34142
34710
  const domPng = await captureAlphaPng(domSession.page, width, height);
34711
+ addHdrTiming(hdrPerf, "domScreenshotMs", timingStart);
34712
+ timingStart = Date.now();
34143
34713
  await removeDomLayerMask(domSession.page, hideIds);
34714
+ addHdrTiming(hdrPerf, "domMaskRemoveMs", timingStart);
34144
34715
  try {
34716
+ timingStart = Date.now();
34145
34717
  const { data: domRgba } = decodePng(domPng);
34718
+ addHdrTiming(hdrPerf, "domPngDecodeMs", timingStart);
34146
34719
  const before2 = shouldLog ? countNonZeroRgb48(canvas) : 0;
34147
34720
  const alphaPixels = shouldLog ? countNonZeroAlpha(domRgba) : 0;
34721
+ timingStart = Date.now();
34148
34722
  blitRgba8OverRgb48le(domRgba, canvas, width, height, effectiveHdr.transfer);
34723
+ addHdrTiming(hdrPerf, "domBlitMs", timingStart);
34149
34724
  if (shouldLog && debugDumpDir) {
34150
34725
  const after2 = countNonZeroRgb48(canvas);
34151
34726
  const dumpName = `frame_${String(debugFrameIndex).padStart(4, "0")}_layer_${String(layerIdx).padStart(2, "0")}_dom.png`;
@@ -34236,6 +34811,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34236
34811
  videoExtractionFailures: 0,
34237
34812
  imageDecodeFailures: 0
34238
34813
  };
34814
+ let hdrPerf;
34239
34815
  const perfOutputPath = join36(workDir, "perf-summary.json");
34240
34816
  const cfg = { ...job.config.producerConfig ?? resolveConfig() };
34241
34817
  const outputFormat = job.config.format ?? "mp4";
@@ -34544,7 +35120,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34544
35120
  let extractionResult = null;
34545
35121
  const nativeHdrVideoIds = /* @__PURE__ */ new Set();
34546
35122
  const videoTransfers = /* @__PURE__ */ new Map();
34547
- if (job.config.hdr && composition.videos.length > 0) {
35123
+ if (job.config.hdrMode !== "force-sdr" && composition.videos.length > 0) {
34548
35124
  await Promise.all(
34549
35125
  composition.videos.map(async (v) => {
34550
35126
  let videoPath = v.src;
@@ -34565,7 +35141,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34565
35141
  const imageTransfers = /* @__PURE__ */ new Map();
34566
35142
  const hdrImageSrcPaths = /* @__PURE__ */ new Map();
34567
35143
  const imageColorSpaces = [];
34568
- if (job.config.hdr && composition.images.length > 0) {
35144
+ if (job.config.hdrMode !== "force-sdr" && composition.images.length > 0) {
34569
35145
  const probed = await Promise.all(
34570
35146
  composition.images.map(async (img) => {
34571
35147
  let imgPath = img.src;
@@ -34622,28 +35198,53 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34622
35198
  perfStages.videoExtractMs = Date.now() - stage2Start;
34623
35199
  }
34624
35200
  let effectiveHdr;
34625
- if (job.config.hdr) {
35201
+ let forcedHdrWithoutSources = false;
35202
+ {
35203
+ const hdrMode = job.config.hdrMode ?? "auto";
34626
35204
  const videoColorSpaces = (extractionResult?.extracted ?? []).map(
34627
35205
  (ext) => ext.metadata.colorSpace
34628
35206
  );
34629
35207
  const allColorSpaces = [...videoColorSpaces, ...imageColorSpaces];
34630
- if (allColorSpaces.length > 0) {
34631
- const info = analyzeCompositionHdr(allColorSpaces);
34632
- if (info.hasHdr && info.dominantTransfer) {
35208
+ const info = allColorSpaces.length > 0 ? analyzeCompositionHdr(allColorSpaces) : null;
35209
+ if (hdrMode === "force-sdr") {
35210
+ effectiveHdr = void 0;
35211
+ } else if (hdrMode === "force-hdr") {
35212
+ if (info?.hasHdr && info.dominantTransfer) {
35213
+ effectiveHdr = { transfer: info.dominantTransfer };
35214
+ } else {
35215
+ effectiveHdr = { transfer: "hlg" };
35216
+ forcedHdrWithoutSources = true;
35217
+ }
35218
+ } else {
35219
+ if (info?.hasHdr && info.dominantTransfer) {
34633
35220
  effectiveHdr = { transfer: info.dominantTransfer };
34634
35221
  }
34635
35222
  }
34636
35223
  }
34637
35224
  if (effectiveHdr && outputFormat !== "mp4") {
35225
+ const hdrSourceReason = forcedHdrWithoutSources ? "HDR was forced without detected HDR sources" : "HDR source detected";
34638
35226
  log2.warn(
34639
- `[Render] HDR source detected but format is "${outputFormat}" \u2014 falling back to SDR. HDR + alpha is not supported. Use --format mp4 for HDR10 output.`
35227
+ `[Render] ${hdrSourceReason}, but format is "${outputFormat}" \u2014 falling back to SDR. HDR + alpha is not supported. Use --format mp4 for HDR10 output.`
34640
35228
  );
34641
35229
  effectiveHdr = void 0;
34642
35230
  }
34643
- if (effectiveHdr) {
34644
- log2.info(
34645
- `[Render] HDR source detected \u2014 output: ${effectiveHdr.transfer.toUpperCase()} (BT.2020, 10-bit H.265)`
34646
- );
35231
+ {
35232
+ const hdrMode = job.config.hdrMode ?? "auto";
35233
+ if (forcedHdrWithoutSources) {
35234
+ log2.warn(
35235
+ "[Render] HDR forced by --hdr flag, but no HDR sources were detected \u2014 defaulting to HLG. SDR-only compositions may look perceptually wrong on HDR displays."
35236
+ );
35237
+ }
35238
+ if (effectiveHdr) {
35239
+ const reason = hdrMode === "force-hdr" ? forcedHdrWithoutSources ? "forced by --hdr flag (no HDR sources detected \u2014 defaulting to HLG)" : "forced by --hdr flag" : "auto-detected from source(s)";
35240
+ log2.info(
35241
+ `[Render] HDR ${reason} \u2014 output: ${effectiveHdr.transfer.toUpperCase()} (BT.2020, 10-bit H.265)`
35242
+ );
35243
+ } else if (hdrMode === "force-sdr") {
35244
+ log2.info("[Render] SDR forced by --sdr flag");
35245
+ } else {
35246
+ log2.info("[Render] No HDR sources detected \u2014 rendering SDR");
35247
+ }
34647
35248
  }
34648
35249
  const stage3Start = Date.now();
34649
35250
  updateJobStatus(job, "preprocessing", "Processing audio tracks", 20, onProgress);
@@ -34690,7 +35291,101 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34690
35291
  ...captureOptions,
34691
35292
  skipReadinessVideoIds: Array.from(nativeHdrVideoIds)
34692
35293
  });
34693
- const workerCount = calculateOptimalWorkers(totalFrames, job.config.workers, cfg);
35294
+ let captureCalibration;
35295
+ let switchedToScreenshotAfterCalibration = false;
35296
+ if (job.config.workers === void 0 && totalFrames >= 60) {
35297
+ const calibrationDir = join36(workDir, "capture-calibration");
35298
+ const calibrationCfg = createCaptureCalibrationConfig(cfg);
35299
+ const videoInjector = createVideoFrameInjector(frameLookup);
35300
+ let calibrationSession = null;
35301
+ try {
35302
+ calibrationSession = await createCaptureSession(
35303
+ fileServer.url,
35304
+ calibrationDir,
35305
+ buildHdrCaptureOptions(),
35306
+ videoInjector,
35307
+ calibrationCfg
35308
+ );
35309
+ if (!calibrationSession.isInitialized) {
35310
+ await initializeSession(calibrationSession);
35311
+ }
35312
+ assertNotAborted();
35313
+ captureCalibration = await measureCaptureCostFromSession(
35314
+ calibrationSession,
35315
+ totalFrames,
35316
+ job.config.fps
35317
+ );
35318
+ if (captureCalibration.estimate.multiplier > 1) {
35319
+ log2.warn("[Render] Measured slow frame capture during auto-worker calibration.", {
35320
+ multiplier: captureCalibration.estimate.multiplier,
35321
+ p95Ms: captureCalibration.estimate.p95Ms,
35322
+ sampledFrames: captureCalibration.samples.map((sample) => sample.frameIndex)
35323
+ });
35324
+ } else {
35325
+ log2.debug("[Render] Auto-worker calibration kept baseline capture cost.", {
35326
+ p95Ms: captureCalibration.estimate.p95Ms,
35327
+ sampledFrames: captureCalibration.samples.map((sample) => sample.frameIndex)
35328
+ });
35329
+ }
35330
+ } catch (error) {
35331
+ const shouldFallbackToScreenshot = !cfg.forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
35332
+ if (shouldFallbackToScreenshot) {
35333
+ cfg.forceScreenshot = true;
35334
+ switchedToScreenshotAfterCalibration = true;
35335
+ if (probeSession) {
35336
+ lastBrowserConsole = probeSession.browserConsoleBuffer;
35337
+ await closeCaptureSession(probeSession).catch(() => {
35338
+ });
35339
+ probeSession = null;
35340
+ }
35341
+ }
35342
+ captureCalibration = {
35343
+ estimate: {
35344
+ multiplier: MAX_MEASURED_CAPTURE_COST_MULTIPLIER,
35345
+ reasons: shouldFallbackToScreenshot ? ["calibration-beginframe-timeout", "screenshot-fallback"] : ["calibration-failed"]
35346
+ },
35347
+ samples: []
35348
+ };
35349
+ if (shouldFallbackToScreenshot) {
35350
+ log2.warn(
35351
+ "[Render] BeginFrame auto-worker calibration timed out; falling back to screenshot capture mode.",
35352
+ {
35353
+ protocolTimeout: calibrationCfg.protocolTimeout,
35354
+ error: error instanceof Error ? error.message : String(error)
35355
+ }
35356
+ );
35357
+ } else {
35358
+ log2.warn("[Render] Auto-worker calibration failed; using conservative worker budget.", {
35359
+ protocolTimeout: calibrationCfg.protocolTimeout,
35360
+ error: error instanceof Error ? error.message : String(error)
35361
+ });
35362
+ }
35363
+ } finally {
35364
+ if (calibrationSession) {
35365
+ lastBrowserConsole = calibrationSession.browserConsoleBuffer;
35366
+ await closeCaptureSession(calibrationSession).catch(() => {
35367
+ });
35368
+ }
35369
+ }
35370
+ }
35371
+ let workerCount = resolveRenderWorkerCount(
35372
+ totalFrames,
35373
+ job.config.workers,
35374
+ cfg,
35375
+ compiled,
35376
+ composition,
35377
+ log2,
35378
+ captureCalibration?.estimate
35379
+ );
35380
+ if (switchedToScreenshotAfterCalibration && workerCount > 1) {
35381
+ workerCount = 1;
35382
+ }
35383
+ if (workerCount > 1 && probeSession) {
35384
+ lastBrowserConsole = probeSession.browserConsoleBuffer;
35385
+ await closeCaptureSession(probeSession);
35386
+ probeSession = null;
35387
+ }
35388
+ const captureAttempts = [];
34694
35389
  const FORMAT_EXT2 = {
34695
35390
  mp4: ".mp4",
34696
35391
  webm: ".webm",
@@ -34714,6 +35409,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34714
35409
  job.framesRendered = 0;
34715
35410
  if (hasHdrContent) {
34716
35411
  log2.info("[Render] HDR layered composite: z-ordered DOM + native HLG video layers");
35412
+ hdrPerf = createHdrPerfCollector();
34717
35413
  cfg.forceScreenshot = true;
34718
35414
  const hdrVideoIds = composition.videos.filter((v) => nativeHdrVideoIds.has(v.id)).map((v) => v.id);
34719
35415
  const hdrVideoSrcPaths = /* @__PURE__ */ new Map();
@@ -34737,7 +35433,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34737
35433
  let hdrEncoder = null;
34738
35434
  let hdrEncoderClosed = false;
34739
35435
  let domSessionClosed = false;
34740
- const hdrFrameDirs = /* @__PURE__ */ new Map();
35436
+ const hdrVideoFrameSources = /* @__PURE__ */ new Map();
34741
35437
  try {
34742
35438
  await initializeSession(domSession);
34743
35439
  assertNotAborted();
@@ -34856,6 +35552,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34856
35552
  mkdirSync20(frameDir, { recursive: true });
34857
35553
  const duration = video.end - video.start;
34858
35554
  const dims = hdrExtractionDims.get(videoId) ?? { width, height };
35555
+ const rawPath = join36(frameDir, "frames.rgb48le");
34859
35556
  const ffmpegArgs = [
34860
35557
  "-ss",
34861
35558
  String(video.mediaStart),
@@ -34869,10 +35566,10 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34869
35566
  `scale=${dims.width}:${dims.height}:force_original_aspect_ratio=increase,crop=${dims.width}:${dims.height}`,
34870
35567
  "-pix_fmt",
34871
35568
  "rgb48le",
34872
- "-c:v",
34873
- "png",
35569
+ "-f",
35570
+ "rawvideo",
34874
35571
  "-y",
34875
- join36(frameDir, "frame_%04d.png")
35572
+ rawPath
34876
35573
  ];
34877
35574
  const result = await runFfmpeg(ffmpegArgs, { signal: abortSignal });
34878
35575
  if (!result.success) {
@@ -34886,7 +35583,24 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34886
35583
  `HDR frame extraction failed for video "${videoId}". Aborting render to avoid shipping black HDR layers.`
34887
35584
  );
34888
35585
  }
34889
- hdrFrameDirs.set(videoId, frameDir);
35586
+ const frameSize = dims.width * dims.height * 6;
35587
+ const frameCount = Math.floor(statSync11(rawPath).size / frameSize);
35588
+ if (frameCount < 1) {
35589
+ hdrDiagnostics.videoExtractionFailures += 1;
35590
+ throw new Error(
35591
+ `HDR frame extraction produced no frames for video "${videoId}". Aborting render to avoid shipping black HDR layers.`
35592
+ );
35593
+ }
35594
+ hdrVideoFrameSources.set(videoId, {
35595
+ dir: frameDir,
35596
+ rawPath,
35597
+ fd: openSync(rawPath, "r"),
35598
+ width: dims.width,
35599
+ height: dims.height,
35600
+ frameSize,
35601
+ frameCount,
35602
+ scratch: Buffer.allocUnsafe(frameSize)
35603
+ });
34890
35604
  }
34891
35605
  const hdrImageBuffers = /* @__PURE__ */ new Map();
34892
35606
  for (const [imageId, srcPath] of hdrImageSrcPaths) {
@@ -34935,7 +35649,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34935
35649
  const cleanedUpVideos = /* @__PURE__ */ new Set();
34936
35650
  const hdrVideoEndTimes = /* @__PURE__ */ new Map();
34937
35651
  for (const v of composition.videos) {
34938
- if (hdrFrameDirs.has(v.id)) {
35652
+ if (hdrVideoFrameSources.has(v.id)) {
34939
35653
  hdrVideoEndTimes.set(v.id, v.end);
34940
35654
  }
34941
35655
  }
@@ -34964,12 +35678,13 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34964
35678
  nativeHdrImageIds,
34965
35679
  hdrImageBuffers,
34966
35680
  hdrImageTransferCache,
34967
- hdrFrameDirs,
35681
+ hdrVideoFrameSources,
34968
35682
  hdrVideoStartTimes,
34969
35683
  imageTransfers,
34970
35684
  videoTransfers,
34971
35685
  debugDumpEnabled,
34972
- debugDumpDir
35686
+ debugDumpDir,
35687
+ hdrPerf
34973
35688
  };
34974
35689
  const bufSize = width * height * 6;
34975
35690
  const hasTransitions = transitionRanges.length > 0;
@@ -34980,13 +35695,20 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
34980
35695
  for (let i2 = 0; i2 < totalFrames; i2++) {
34981
35696
  assertNotAborted();
34982
35697
  const time = i2 / job.config.fps;
35698
+ if (hdrPerf) hdrPerf.frames += 1;
35699
+ let timingStart = Date.now();
34983
35700
  await domSession.page.evaluate((t3) => {
34984
35701
  if (window.__hf && typeof window.__hf.seek === "function") window.__hf.seek(t3);
34985
35702
  }, time);
35703
+ addHdrTiming(hdrPerf, "frameSeekMs", timingStart);
34986
35704
  if (beforeCaptureHook) {
35705
+ timingStart = Date.now();
34987
35706
  await beforeCaptureHook(domSession.page, time);
35707
+ addHdrTiming(hdrPerf, "frameInjectMs", timingStart);
34988
35708
  }
35709
+ timingStart = Date.now();
34989
35710
  const stackingInfo = await queryElementStacking(domSession.page, nativeHdrIds);
35711
+ addHdrTiming(hdrPerf, "stackingQueryMs", timingStart);
34990
35712
  const activeTransition = transitionRanges.find(
34991
35713
  (t3) => i2 >= t3.startFrame && i2 <= t3.endFrame
34992
35714
  );
@@ -35001,21 +35723,29 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35001
35723
  });
35002
35724
  }
35003
35725
  if (activeTransition && transBufferA && transBufferB && transOutput) {
35726
+ if (hdrPerf) hdrPerf.transitionFrames += 1;
35727
+ const transitionTimingStart = Date.now();
35004
35728
  const progress = activeTransition.endFrame === activeTransition.startFrame ? 1 : (i2 - activeTransition.startFrame) / (activeTransition.endFrame - activeTransition.startFrame);
35005
35729
  const sceneAIds = new Set(sceneElements[activeTransition.fromScene] ?? []);
35006
35730
  const sceneBIds = new Set(sceneElements[activeTransition.toScene] ?? []);
35731
+ timingStart = Date.now();
35007
35732
  transBufferA.fill(0);
35008
35733
  transBufferB.fill(0);
35734
+ addHdrTiming(hdrPerf, "canvasClearMs", timingStart);
35009
35735
  for (const [sceneBuf, sceneIds] of [
35010
35736
  [transBufferA, sceneAIds],
35011
35737
  [transBufferB, sceneBIds]
35012
35738
  ]) {
35013
35739
  assertNotAborted();
35740
+ timingStart = Date.now();
35014
35741
  await domSession.page.evaluate((t3) => {
35015
35742
  if (window.__hf && typeof window.__hf.seek === "function") window.__hf.seek(t3);
35016
35743
  }, time);
35744
+ addHdrTiming(hdrPerf, "domLayerSeekMs", timingStart);
35017
35745
  if (beforeCaptureHook) {
35746
+ timingStart = Date.now();
35018
35747
  await beforeCaptureHook(domSession.page, time);
35748
+ addHdrTiming(hdrPerf, "domLayerInjectMs", timingStart);
35019
35749
  }
35020
35750
  for (const el of stackingInfo) {
35021
35751
  if (!el.isHdr || !sceneIds.has(el.id)) continue;
@@ -35029,7 +35759,8 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35029
35759
  height,
35030
35760
  log2,
35031
35761
  imageTransfers.get(el.id),
35032
- effectiveHdr?.transfer
35762
+ effectiveHdr?.transfer,
35763
+ hdrPerf
35033
35764
  );
35034
35765
  } else {
35035
35766
  blitHdrVideoLayer(
@@ -35037,28 +35768,39 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35037
35768
  el,
35038
35769
  time,
35039
35770
  job.config.fps,
35040
- hdrFrameDirs,
35771
+ hdrVideoFrameSources,
35041
35772
  hdrVideoStartTimes,
35042
35773
  width,
35043
35774
  height,
35044
35775
  log2,
35045
35776
  videoTransfers.get(el.id),
35046
- effectiveHdr?.transfer
35777
+ effectiveHdr?.transfer,
35778
+ hdrPerf
35047
35779
  );
35048
35780
  }
35049
35781
  }
35050
35782
  const showIds = Array.from(sceneIds);
35051
35783
  const hideIds = stackingInfo.map((e2) => e2.id).filter((id) => !sceneIds.has(id) || nativeHdrIds.has(id));
35784
+ if (hdrPerf) hdrPerf.domLayerCaptures += 1;
35785
+ timingStart = Date.now();
35052
35786
  await applyDomLayerMask(domSession.page, showIds, hideIds);
35787
+ addHdrTiming(hdrPerf, "domMaskApplyMs", timingStart);
35788
+ timingStart = Date.now();
35053
35789
  const domPng = await captureAlphaPng(domSession.page, width, height);
35790
+ addHdrTiming(hdrPerf, "domScreenshotMs", timingStart);
35791
+ timingStart = Date.now();
35054
35792
  await removeDomLayerMask(domSession.page, hideIds);
35793
+ addHdrTiming(hdrPerf, "domMaskRemoveMs", timingStart);
35055
35794
  try {
35795
+ timingStart = Date.now();
35056
35796
  const { data: domRgba } = decodePng(domPng);
35797
+ addHdrTiming(hdrPerf, "domPngDecodeMs", timingStart);
35057
35798
  if (!effectiveHdr) {
35058
35799
  throw new Error(
35059
35800
  "Invariant violation: effectiveHdr is undefined inside hasHdrVideo branch"
35060
35801
  );
35061
35802
  }
35803
+ timingStart = Date.now();
35062
35804
  blitRgba8OverRgb48le(
35063
35805
  domRgba,
35064
35806
  sceneBuf,
@@ -35066,6 +35808,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35066
35808
  height,
35067
35809
  effectiveHdr.transfer
35068
35810
  );
35811
+ addHdrTiming(hdrPerf, "domBlitMs", timingStart);
35069
35812
  } catch (err) {
35070
35813
  log2.warn("DOM layer decode/blit failed; skipping overlay for transition scene", {
35071
35814
  frameIndex: i2,
@@ -35076,9 +35819,16 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35076
35819
  }
35077
35820
  const transitionFn = TRANSITIONS[activeTransition.shader] ?? crossfade;
35078
35821
  transitionFn(transBufferA, transBufferB, transOutput, width, height, progress);
35822
+ addHdrTiming(hdrPerf, "transitionCompositeMs", transitionTimingStart);
35823
+ timingStart = Date.now();
35079
35824
  hdrEncoder.writeFrame(transOutput);
35825
+ addHdrTiming(hdrPerf, "encoderWriteMs", timingStart);
35080
35826
  } else {
35827
+ if (hdrPerf) hdrPerf.normalFrames += 1;
35828
+ timingStart = Date.now();
35081
35829
  normalCanvas.fill(0);
35830
+ addHdrTiming(hdrPerf, "canvasClearMs", timingStart);
35831
+ timingStart = Date.now();
35082
35832
  await compositeHdrFrame(
35083
35833
  hdrCompositeCtx,
35084
35834
  normalCanvas,
@@ -35087,6 +35837,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35087
35837
  void 0,
35088
35838
  i2
35089
35839
  );
35840
+ addHdrTiming(hdrPerf, "normalCompositeMs", timingStart);
35090
35841
  if (debugDumpEnabled && debugDumpDir && i2 % 30 === 0) {
35091
35842
  const previewPath = join36(
35092
35843
  debugDumpDir,
@@ -35094,26 +35845,29 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35094
35845
  );
35095
35846
  writeFileSync14(previewPath, normalCanvas);
35096
35847
  }
35848
+ timingStart = Date.now();
35097
35849
  hdrEncoder.writeFrame(normalCanvas);
35850
+ addHdrTiming(hdrPerf, "encoderWriteMs", timingStart);
35098
35851
  }
35099
35852
  if (process.env.KEEP_TEMP !== "1") {
35100
35853
  for (const [videoId, endTime] of hdrVideoEndTimes) {
35101
35854
  if (time > endTime && !cleanedUpVideos.has(videoId)) {
35102
35855
  const stillNeeded = activeTransition && (sceneElements[activeTransition.fromScene]?.includes(videoId) || sceneElements[activeTransition.toScene]?.includes(videoId));
35103
35856
  if (!stillNeeded) {
35104
- const frameDir = hdrFrameDirs.get(videoId);
35105
- if (frameDir) {
35857
+ const frameSource = hdrVideoFrameSources.get(videoId);
35858
+ if (frameSource) {
35859
+ closeHdrVideoFrameSource(frameSource, log2);
35106
35860
  try {
35107
- rmSync7(frameDir, { recursive: true, force: true });
35861
+ rmSync7(frameSource.dir, { recursive: true, force: true });
35108
35862
  } catch (err) {
35109
- log2.warn("Failed to clean up HDR frame directory", {
35863
+ log2.warn("Failed to clean up HDR raw frame directory", {
35110
35864
  videoId,
35111
- frameDir,
35865
+ frameDir: frameSource.dir,
35866
+ rawPath: frameSource.rawPath,
35112
35867
  error: err instanceof Error ? err.message : String(err)
35113
35868
  });
35114
35869
  }
35115
- clearMaxFrameIndex(frameDir);
35116
- hdrFrameDirs.delete(videoId);
35870
+ hdrVideoFrameSources.delete(videoId);
35117
35871
  }
35118
35872
  cleanedUpVideos.add(videoId);
35119
35873
  }
@@ -35162,10 +35916,10 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35162
35916
  });
35163
35917
  });
35164
35918
  }
35165
- for (const frameDir of hdrFrameDirs.values()) {
35166
- clearMaxFrameIndex(frameDir);
35919
+ for (const frameSource of hdrVideoFrameSources.values()) {
35920
+ closeHdrVideoFrameSource(frameSource, log2);
35167
35921
  }
35168
- hdrFrameDirs.clear();
35922
+ hdrVideoFrameSources.clear();
35169
35923
  }
35170
35924
  } else {
35171
35925
  let streamingEncoder = null;
@@ -35282,15 +36036,18 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35282
36036
  perfStages.encodeMs = encodeResult.durationMs;
35283
36037
  } else {
35284
36038
  if (workerCount > 1) {
35285
- const tasks = distributeFrames(job.totalFrames, workerCount, workDir);
35286
- await executeParallelCapture(
35287
- fileServer.url,
36039
+ const attempts = await executeDiskCaptureWithAdaptiveRetry({
36040
+ serverUrl: fileServer.url,
35288
36041
  workDir,
35289
- tasks,
35290
- buildHdrCaptureOptions(),
35291
- () => createVideoFrameInjector(frameLookup),
36042
+ framesDir,
36043
+ totalFrames: job.totalFrames,
36044
+ initialWorkerCount: workerCount,
36045
+ allowRetry: job.config.workers === void 0,
36046
+ frameExt: needsAlpha ? "png" : "jpg",
36047
+ captureOptions: buildHdrCaptureOptions(),
36048
+ createBeforeCaptureHook: () => createVideoFrameInjector(frameLookup),
35292
36049
  abortSignal,
35293
- (progress) => {
36050
+ onProgress: (progress) => {
35294
36051
  job.framesRendered = progress.capturedFrames;
35295
36052
  const frameProgress = progress.capturedFrames / progress.totalFrames;
35296
36053
  const progressPct = 25 + frameProgress * 45;
@@ -35298,16 +36055,20 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35298
36055
  updateJobStatus(
35299
36056
  job,
35300
36057
  "rendering",
35301
- `Capturing frame ${progress.capturedFrames}/${progress.totalFrames} (${workerCount} workers)`,
36058
+ `Capturing frame ${progress.capturedFrames}/${progress.totalFrames} (${progress.activeWorkers} workers)`,
35302
36059
  Math.round(progressPct),
35303
36060
  onProgress
35304
36061
  );
35305
36062
  }
35306
36063
  },
35307
- void 0,
35308
- cfg
35309
- );
35310
- await mergeWorkerFrames(workDir, tasks, framesDir);
36064
+ cfg,
36065
+ log: log2
36066
+ });
36067
+ captureAttempts.push(...attempts);
36068
+ const lastAttempt = attempts[attempts.length - 1];
36069
+ if (lastAttempt) {
36070
+ workerCount = lastAttempt.workers;
36071
+ }
35311
36072
  if (probeSession) {
35312
36073
  lastBrowserConsole = probeSession.browserConsoleBuffer;
35313
36074
  await closeCaptureSession(probeSession);
@@ -35357,7 +36118,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35357
36118
  const stage5Start = Date.now();
35358
36119
  updateJobStatus(job, "encoding", "Writing PNG sequence", 75, onProgress);
35359
36120
  if (!existsSync34(outputPath)) mkdirSync20(outputPath, { recursive: true });
35360
- const captured = readdirSync14(framesDir).filter((name) => name.endsWith(".png")).sort();
36121
+ const captured = readdirSync13(framesDir).filter((name) => name.endsWith(".png")).sort();
35361
36122
  if (captured.length === 0) {
35362
36123
  throw new Error(
35363
36124
  `[Render] png-sequence output requested but no PNGs were captured to ${framesDir}`
@@ -35477,7 +36238,15 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35477
36238
  stages: perfStages,
35478
36239
  videoExtractBreakdown: extractionResult?.phaseBreakdown,
35479
36240
  tmpPeakBytes,
36241
+ captureCalibration: captureCalibration ? {
36242
+ sampledFrames: captureCalibration.samples.map((sample) => sample.frameIndex),
36243
+ p95Ms: captureCalibration.estimate.p95Ms,
36244
+ multiplier: captureCalibration.estimate.multiplier,
36245
+ reasons: captureCalibration.estimate.reasons
36246
+ } : void 0,
36247
+ captureAttempts: captureAttempts.length > 0 ? captureAttempts : void 0,
35480
36248
  hdrDiagnostics: hdrDiagnostics.videoExtractionFailures > 0 || hdrDiagnostics.imageDecodeFailures > 0 ? { ...hdrDiagnostics } : void 0,
36249
+ hdrPerf: hdrPerf ? finalizeHdrPerf(hdrPerf) : void 0,
35481
36250
  captureAvgMs: totalFrames > 0 ? Math.round((perfStages.captureMs ?? 0) / totalFrames) : void 0,
35482
36251
  peakRssMb: Math.round(peakRssBytes / (1024 * 1024)),
35483
36252
  peakHeapUsedMb: Math.round(peakHeapUsedBytes / (1024 * 1024))
@@ -35592,7 +36361,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
35592
36361
  clearInterval(memSamplerInterval);
35593
36362
  }
35594
36363
  }
35595
- var RenderCancelledError, BROWSER_MEDIA_EPSILON;
36364
+ var RenderCancelledError, BROWSER_MEDIA_EPSILON, CAPTURE_CALIBRATION_TARGET_MS, MAX_MEASURED_CAPTURE_COST_MULTIPLIER, CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS;
35596
36365
  var init_renderOrchestrator = __esm({
35597
36366
  "../producer/src/services/renderOrchestrator.ts"() {
35598
36367
  "use strict";
@@ -35602,7 +36371,6 @@ var init_renderOrchestrator = __esm({
35602
36371
  init_htmlCompiler2();
35603
36372
  init_logger();
35604
36373
  init_paths();
35605
- init_frameDirCache();
35606
36374
  init_hdrImageTransferCache();
35607
36375
  RenderCancelledError = class extends Error {
35608
36376
  reason;
@@ -35613,6 +36381,9 @@ var init_renderOrchestrator = __esm({
35613
36381
  }
35614
36382
  };
35615
36383
  BROWSER_MEDIA_EPSILON = 1e-4;
36384
+ CAPTURE_CALIBRATION_TARGET_MS = 600;
36385
+ MAX_MEASURED_CAPTURE_COST_MULTIPLIER = 8;
36386
+ CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS = 3e4;
35616
36387
  }
35617
36388
  });
35618
36389
 
@@ -37027,7 +37798,7 @@ import {
37027
37798
  cpSync,
37028
37799
  writeFileSync as writeFileSync17,
37029
37800
  readFileSync as readFileSync26,
37030
- readdirSync as readdirSync15
37801
+ readdirSync as readdirSync14
37031
37802
  } from "fs";
37032
37803
  import { resolve as resolve22, basename as basename5, join as join41, dirname as dirname14 } from "path";
37033
37804
  import { fileURLToPath as fileURLToPath5 } from "url";
@@ -37110,7 +37881,7 @@ function getSharedTemplateDir() {
37110
37881
  return resolveAssetDir(["..", "templates", "_shared"], ["templates", "_shared"]);
37111
37882
  }
37112
37883
  function patchVideoSrc(dir, videoFilename, durationSeconds) {
37113
- const htmlFiles = readdirSync15(dir, { withFileTypes: true, recursive: true }).filter((e2) => e2.isFile() && e2.name.endsWith(".html")).map((e2) => join41(e2.parentPath ?? e2.path, e2.name));
37884
+ const htmlFiles = readdirSync14(dir, { withFileTypes: true, recursive: true }).filter((e2) => e2.isFile() && e2.name.endsWith(".html")).map((e2) => join41(e2.parentPath ?? e2.path, e2.name));
37114
37885
  for (const file of htmlFiles) {
37115
37886
  let content = readFileSync26(file, "utf-8");
37116
37887
  if (videoFilename) {
@@ -37242,7 +38013,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
37242
38013
  }
37243
38014
  const sharedDir = getSharedTemplateDir();
37244
38015
  if (existsSync39(sharedDir)) {
37245
- for (const entry of readdirSync15(sharedDir, { withFileTypes: true })) {
38016
+ for (const entry of readdirSync14(sharedDir, { withFileTypes: true })) {
37246
38017
  const src = join41(sharedDir, entry.name);
37247
38018
  const dest = resolve22(destDir, entry.name);
37248
38019
  if (entry.isFile() || entry.isSymbolicLink()) {
@@ -37357,7 +38128,7 @@ var init_init = __esm({
37357
38128
  const templateId2 = exampleFlag ?? "blank";
37358
38129
  const name2 = args.name ?? "my-video";
37359
38130
  const destDir2 = resolve22(name2);
37360
- if (existsSync39(destDir2) && readdirSync15(destDir2).length > 0) {
38131
+ if (existsSync39(destDir2) && readdirSync14(destDir2).length > 0) {
37361
38132
  console.error(c.error(`Directory already exists and is not empty: ${name2}`));
37362
38133
  process.exit(1);
37363
38134
  }
@@ -37435,7 +38206,7 @@ var init_init = __esm({
37435
38206
  await patchTranscript(destDir2, transcriptFile2);
37436
38207
  }
37437
38208
  console.log(c.success(`Created ${c.accent(name2 + "/")}`));
37438
- for (const f3 of readdirSync15(destDir2).filter((f4) => !f4.startsWith("."))) {
38209
+ for (const f3 of readdirSync14(destDir2).filter((f4) => !f4.startsWith("."))) {
37439
38210
  console.log(` ${c.accent(f3)}`);
37440
38211
  }
37441
38212
  console.log();
@@ -37483,7 +38254,7 @@ var init_init = __esm({
37483
38254
  name = nameResult;
37484
38255
  }
37485
38256
  const destDir = resolve22(name);
37486
- if (existsSync39(destDir) && readdirSync15(destDir).length > 0) {
38257
+ if (existsSync39(destDir) && readdirSync14(destDir).length > 0) {
37487
38258
  const overwrite = await Rt({
37488
38259
  message: `Directory ${c.accent(name)} already exists and is not empty. Overwrite?`,
37489
38260
  initialValue: false
@@ -37606,7 +38377,7 @@ ${c.dim("Use --example blank for offline use.")}`
37606
38377
  if (existsSync39(transcriptFile)) {
37607
38378
  await patchTranscript(destDir, transcriptFile);
37608
38379
  }
37609
- const files = readdirSync15(destDir);
38380
+ const files = readdirSync14(destDir);
37610
38381
  Vt2(files.map((f3) => c.accent(f3)).join("\n"), c.success(`Created ${name}/`));
37611
38382
  if (!skipSkills) {
37612
38383
  const installSkills = await Rt({
@@ -38269,7 +39040,7 @@ var init_play = __esm({
38269
39040
 
38270
39041
  // src/utils/publishProject.ts
38271
39042
  import { basename as basename7, join as join42, relative as relative4 } from "path";
38272
- import { readdirSync as readdirSync16, readFileSync as readFileSync28, statSync as statSync16 } from "fs";
39043
+ import { readdirSync as readdirSync15, readFileSync as readFileSync28, statSync as statSync16 } from "fs";
38273
39044
  import AdmZip from "adm-zip";
38274
39045
  function isRecord2(value) {
38275
39046
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -38358,7 +39129,7 @@ function shouldIgnoreSegment(segment) {
38358
39129
  return segment.startsWith(".") || IGNORED_DIRS.has(segment) || IGNORED_FILES.has(segment);
38359
39130
  }
38360
39131
  function collectProjectFiles(rootDir, currentDir, paths) {
38361
- for (const entry of readdirSync16(currentDir, { withFileTypes: true })) {
39132
+ for (const entry of readdirSync15(currentDir, { withFileTypes: true })) {
38362
39133
  if (shouldIgnoreSegment(entry.name)) continue;
38363
39134
  const absolutePath = join42(currentDir, entry.name);
38364
39135
  const relativePath = relative4(rootDir, absolutePath).replaceAll("\\", "/");
@@ -38645,13 +39416,13 @@ function buildDockerRunArgs(input) {
38645
39416
  options.quality,
38646
39417
  "--format",
38647
39418
  options.format,
38648
- "--workers",
38649
- String(options.workers),
39419
+ ...options.workers != null ? ["--workers", String(options.workers)] : [],
38650
39420
  ...options.crf != null ? ["--crf", String(options.crf)] : [],
38651
39421
  ...options.videoBitrate ? ["--video-bitrate", options.videoBitrate] : [],
38652
39422
  ...options.quiet ? ["--quiet"] : [],
38653
39423
  ...options.gpu ? ["--gpu"] : [],
38654
- ...options.hdr ? ["--hdr"] : []
39424
+ ...options.hdrMode === "force-hdr" ? ["--hdr"] : [],
39425
+ ...options.hdrMode === "force-sdr" ? ["--sdr"] : []
38655
39426
  ];
38656
39427
  }
38657
39428
  var init_dockerRunArgs = __esm({
@@ -38707,9 +39478,6 @@ import { mkdirSync as mkdirSync24, readFileSync as readFileSync29, statSync as s
38707
39478
  import { cpus as cpus3, freemem as freemem3, tmpdir as tmpdir4 } from "os";
38708
39479
  import { resolve as resolve28, dirname as dirname16, join as join44, basename as basename9 } from "path";
38709
39480
  import { execFileSync as execFileSync6, spawn as spawn11 } from "child_process";
38710
- function defaultWorkerCount() {
38711
- return Math.max(1, Math.min(Math.floor(CPU_CORE_COUNT * 3 / 4), 8));
38712
- }
38713
39481
  function dockerImageTag(version) {
38714
39482
  return `${DOCKER_IMAGE_PREFIX}:${version}`;
38715
39483
  }
@@ -38801,7 +39569,7 @@ async function renderDocker(projectDir, outputPath, options) {
38801
39569
  format: options.format,
38802
39570
  workers: options.workers,
38803
39571
  gpu: options.gpu,
38804
- hdr: options.hdr,
39572
+ hdrMode: options.hdrMode,
38805
39573
  crf: options.crf,
38806
39574
  videoBitrate: options.videoBitrate,
38807
39575
  quiet: options.quiet
@@ -38850,7 +39618,7 @@ async function renderLocal(projectDir, outputPath, options) {
38850
39618
  format: options.format,
38851
39619
  workers: options.workers,
38852
39620
  useGpu: options.gpu,
38853
- hdr: options.hdr,
39621
+ hdrMode: options.hdrMode,
38854
39622
  crf: options.crf,
38855
39623
  videoBitrate: options.videoBitrate
38856
39624
  });
@@ -38897,7 +39665,7 @@ function trackRenderMetrics(job, elapsedMs, options, docker) {
38897
39665
  durationMs: elapsedMs,
38898
39666
  fps: options.fps,
38899
39667
  quality: options.quality,
38900
- workers: options.workers,
39668
+ workers: options.workers ?? perf?.workers,
38901
39669
  docker,
38902
39670
  gpu: options.gpu,
38903
39671
  compositionDurationMs,
@@ -38963,7 +39731,7 @@ var init_render2 = __esm({
38963
39731
  ["High quality at 60fps", "hyperframes render --fps 60 --quality high --output hd.mp4"],
38964
39732
  ["Deterministic render via Docker", "hyperframes render --docker --output deterministic.mp4"],
38965
39733
  ["Parallel rendering with 6 workers", "hyperframes render --workers 6 --output fast.mp4"],
38966
- ["HDR output (H.265 10-bit)", "hyperframes render --hdr --output hdr-output.mp4"]
39734
+ ["HDR output (auto-detected)", "hyperframes render --output hdr-output.mp4"]
38967
39735
  ];
38968
39736
  VALID_FPS = /* @__PURE__ */ new Set([24, 30, 60]);
38969
39737
  VALID_QUALITY = /* @__PURE__ */ new Set(["draft", "standard", "high"]);
@@ -39015,7 +39783,12 @@ var init_render2 = __esm({
39015
39783
  },
39016
39784
  hdr: {
39017
39785
  type: "boolean",
39018
- description: "Enable HDR: probe sources for PQ/HLG, output H.265 10-bit BT.2020",
39786
+ description: "Force HDR output even if no HDR sources are detected",
39787
+ default: false
39788
+ },
39789
+ sdr: {
39790
+ type: "boolean",
39791
+ description: "Force SDR output even if HDR sources are detected",
39019
39792
  default: false
39020
39793
  },
39021
39794
  crf: {
@@ -39121,9 +39894,8 @@ var init_render2 = __esm({
39121
39894
  );
39122
39895
  process.exit(1);
39123
39896
  }
39124
- const workerCount = workers ?? defaultWorkerCount();
39125
39897
  if (!quiet) {
39126
- const workerLabel = args.workers != null ? `${workerCount} workers` : `${workerCount} workers (auto \u2014 ${CPU_CORE_COUNT} cores detected)`;
39898
+ const workerLabel = workers != null ? `${workers} workers` : `auto workers (${CPU_CORE_COUNT} cores detected)`;
39127
39899
  console.log("");
39128
39900
  console.log(
39129
39901
  c.accent("\u25C6") + " Rendering " + c.accent(project.name) + c.dim(" \u2192 " + outputPath)
@@ -39191,14 +39963,18 @@ var init_render2 = __esm({
39191
39963
  console.log("");
39192
39964
  }
39193
39965
  }
39966
+ if (args.hdr && args.sdr) {
39967
+ console.error("Error: --hdr and --sdr are mutually exclusive.");
39968
+ process.exit(1);
39969
+ }
39194
39970
  if (useDocker) {
39195
39971
  await renderDocker(project.dir, outputPath, {
39196
39972
  fps,
39197
39973
  quality,
39198
39974
  format,
39199
- workers: workerCount,
39975
+ workers,
39200
39976
  gpu: useGpu,
39201
- hdr: args.hdr ?? false,
39977
+ hdrMode: args.sdr ? "force-sdr" : args.hdr ? "force-hdr" : "auto",
39202
39978
  crf,
39203
39979
  videoBitrate,
39204
39980
  quiet
@@ -39208,9 +39984,9 @@ var init_render2 = __esm({
39208
39984
  fps,
39209
39985
  quality,
39210
39986
  format,
39211
- workers: workerCount,
39987
+ workers,
39212
39988
  gpu: useGpu,
39213
- hdr: args.hdr ?? false,
39989
+ hdrMode: args.sdr ? "force-sdr" : args.hdr ? "force-hdr" : "auto",
39214
39990
  crf,
39215
39991
  videoBitrate,
39216
39992
  quiet,
@@ -39992,11 +40768,11 @@ __export(info_exports, {
39992
40768
  default: () => info_default,
39993
40769
  examples: () => examples11
39994
40770
  });
39995
- import { readFileSync as readFileSync31, readdirSync as readdirSync17, statSync as statSync18 } from "fs";
40771
+ import { readFileSync as readFileSync31, readdirSync as readdirSync16, statSync as statSync18 } from "fs";
39996
40772
  import { join as join46 } from "path";
39997
40773
  function totalSize(dir) {
39998
40774
  let total = 0;
39999
- for (const entry of readdirSync17(dir, { withFileTypes: true })) {
40775
+ for (const entry of readdirSync16(dir, { withFileTypes: true })) {
40000
40776
  const path2 = join46(dir, entry.name);
40001
40777
  if (entry.isDirectory()) {
40002
40778
  total += totalSize(path2);
@@ -40791,7 +41567,7 @@ __export(synthesize_exports, {
40791
41567
  synthesize: () => synthesize
40792
41568
  });
40793
41569
  import { execFileSync as execFileSync7 } from "child_process";
40794
- import { existsSync as existsSync49, writeFileSync as writeFileSync20, mkdirSync as mkdirSync26, readdirSync as readdirSync18, unlinkSync as unlinkSync6 } from "fs";
41570
+ import { existsSync as existsSync49, writeFileSync as writeFileSync20, mkdirSync as mkdirSync26, readdirSync as readdirSync17, unlinkSync as unlinkSync6 } from "fs";
40795
41571
  import { join as join50, dirname as dirname19, basename as basename10 } from "path";
40796
41572
  import { homedir as homedir10 } from "os";
40797
41573
  function findPython() {
@@ -40833,7 +41609,7 @@ function ensureSynthScript() {
40833
41609
  writeFileSync20(SCRIPT_PATH, SYNTH_SCRIPT);
40834
41610
  const currentName = basename10(SCRIPT_PATH);
40835
41611
  try {
40836
- for (const entry of readdirSync18(SCRIPT_DIR)) {
41612
+ for (const entry of readdirSync17(SCRIPT_DIR)) {
40837
41613
  if (entry !== currentName && /^synth(-v\d+)?\.py$/.test(entry)) {
40838
41614
  try {
40839
41615
  unlinkSync6(join50(SCRIPT_DIR, entry));
@@ -41679,18 +42455,6 @@ Run ${c.accent("hyperframes telemetry --help")} for usage.`
41679
42455
  }
41680
42456
  });
41681
42457
 
41682
- // src/commands/contrast-audit.browser.js
41683
- var contrast_audit_browser_exports = {};
41684
- __export(contrast_audit_browser_exports, {
41685
- default: () => contrast_audit_browser_default
41686
- });
41687
- var contrast_audit_browser_default;
41688
- var init_contrast_audit_browser = __esm({
41689
- "src/commands/contrast-audit.browser.js"() {
41690
- contrast_audit_browser_default = '// Browser-side WCAG contrast audit.\n// Loaded as a raw string and injected via page.addScriptTag to avoid\n// esbuild mangling (page.evaluate serializes functions; __name helpers break).\n//\n// NOTE: WCAG math (relLum, wcagRatio, parseColor, median) is duplicated in\n// skills/hyperframes/scripts/contrast-report.mjs \u2014 keep in sync.\n\n/* eslint-disable */\nwindow.__contrastAudit = async function (imgBase64, time) {\n function relLum(r, g, b) {\n function ch(v) {\n var s = v / 255;\n return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);\n }\n return 0.2126 * ch(r) + 0.7152 * ch(g) + 0.0722 * ch(b);\n }\n\n function wcagRatio(r1, g1, b1, r2, g2, b2) {\n var l1 = relLum(r1, g1, b1),\n l2 = relLum(r2, g2, b2);\n var hi = l1 > l2 ? l1 : l2,\n lo = l1 > l2 ? l2 : l1;\n return (hi + 0.05) / (lo + 0.05);\n }\n\n function parseColor(c) {\n var m = c.match(/rgba?\\(([^)]+)\\)/);\n if (!m) return [0, 0, 0, 1];\n var p = m[1].split(",").map(function (s) {\n return parseFloat(s.trim());\n });\n return [p[0], p[1], p[2], p[3] != null ? p[3] : 1];\n }\n\n function selectorOf(el) {\n if (el.id) return "#" + el.id;\n var cls = Array.from(el.classList).slice(0, 2).join(".");\n return cls ? el.tagName.toLowerCase() + "." + cls : el.tagName.toLowerCase();\n }\n\n function median(arr) {\n var s = arr.slice().sort(function (a, b) {\n return a - b;\n });\n return s[Math.floor(s.length / 2)];\n }\n\n // Decode screenshot into canvas pixel data\n var img = new Image();\n await new Promise(function (resolve) {\n img.onload = resolve;\n img.onerror = function () {\n resolve();\n };\n img.src = "data:image/png;base64," + imgBase64;\n });\n if (!img.naturalWidth) return [];\n var canvas = document.createElement("canvas");\n canvas.width = img.naturalWidth || 1920;\n canvas.height = img.naturalHeight || 1080;\n var ctx = canvas.getContext("2d");\n if (!ctx) return [];\n ctx.drawImage(img, 0, 0);\n var px = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n var w = canvas.width;\n var h = canvas.height;\n\n // Walk DOM for text elements\n var out = [];\n var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);\n var node;\n while ((node = walker.nextNode())) {\n var el = node;\n\n // Must have a direct text node child\n var hasText = false;\n for (var i = 0; i < el.childNodes.length; i++) {\n if (\n el.childNodes[i].nodeType === 3 &&\n (el.childNodes[i].textContent || "").trim().length > 0\n ) {\n hasText = true;\n break;\n }\n }\n if (!hasText) continue;\n\n var cs = getComputedStyle(el);\n if (cs.visibility === "hidden" || cs.display === "none") continue;\n if (parseFloat(cs.opacity) <= 0.01) continue;\n var rect = el.getBoundingClientRect();\n if (rect.width < 8 || rect.height < 8) continue;\n\n var fg = parseColor(cs.color);\n if (fg[3] <= 0.01) continue;\n\n // Sample 4px ring outside bbox for background color\n var rr = [],\n gg = [],\n bb = [];\n var x0 = Math.max(0, Math.floor(rect.x) - 4);\n var x1 = Math.min(w - 1, Math.ceil(rect.x + rect.width) + 4);\n var y0 = Math.max(0, Math.floor(rect.y) - 4);\n var y1 = Math.min(h - 1, Math.ceil(rect.y + rect.height) + 4);\n var sample = function (sx, sy) {\n var idx = (sy * w + sx) * 4;\n rr.push(px[idx]);\n gg.push(px[idx + 1]);\n bb.push(px[idx + 2]);\n };\n for (var x = x0; x <= x1; x++) {\n sample(x, y0);\n sample(x, y1);\n }\n for (var y = y0; y <= y1; y++) {\n sample(x0, y);\n sample(x1, y);\n }\n\n if (rr.length === 0) continue;\n\n var bgR = median(rr),\n bgG = median(gg),\n bgB = median(bb);\n\n // Composite foreground alpha over measured background\n var compR = Math.round(fg[0] * fg[3] + bgR * (1 - fg[3]));\n var compG = Math.round(fg[1] * fg[3] + bgG * (1 - fg[3]));\n var compB = Math.round(fg[2] * fg[3] + bgB * (1 - fg[3]));\n\n var ratio = +wcagRatio(compR, compG, compB, bgR, bgG, bgB).toFixed(2);\n var fontSize = parseFloat(cs.fontSize);\n var fontWeight = Number(cs.fontWeight) || 400;\n var large = fontSize >= 24 || (fontSize >= 19 && fontWeight >= 700);\n\n out.push({\n time: time,\n selector: selectorOf(el),\n text: (el.textContent || "").trim().slice(0, 50),\n ratio: ratio,\n wcagAA: large ? ratio >= 3 : ratio >= 4.5,\n large: large,\n fg: "rgb(" + compR + "," + compG + "," + compB + ")",\n bg: "rgb(" + bgR + "," + bgG + "," + bgB + ")",\n });\n }\n return out;\n};\n';
41691
- }
41692
- });
41693
-
41694
42458
  // src/commands/validate.ts
41695
42459
  var validate_exports = {};
41696
42460
  __export(validate_exports, {
@@ -41724,7 +42488,7 @@ async function seekTo2(page, time) {
41724
42488
  async function runContrastAudit(page) {
41725
42489
  const duration = await getCompositionDuration3(page);
41726
42490
  if (duration <= 0) return [];
41727
- await page.addScriptTag({ content: contrast_audit_browser_default });
42491
+ await page.addScriptTag({ content: loadContrastAuditScript() });
41728
42492
  const results = [];
41729
42493
  for (let i2 = 0; i2 < CONTRAST_SAMPLES; i2++) {
41730
42494
  const t3 = +((i2 + 0.5) / CONTRAST_SAMPLES * duration).toFixed(3);
@@ -41739,6 +42503,16 @@ async function runContrastAudit(page) {
41739
42503
  }
41740
42504
  return results;
41741
42505
  }
42506
+ function loadContrastAuditScript() {
42507
+ const candidates = [
42508
+ join52(__dirname3, "contrast-audit.browser.js"),
42509
+ join52(__dirname3, "commands", "contrast-audit.browser.js")
42510
+ ];
42511
+ for (const candidate of candidates) {
42512
+ if (existsSync52(candidate)) return readFileSync35(candidate, "utf-8");
42513
+ }
42514
+ throw new Error("Missing contrast audit browser script");
42515
+ }
41742
42516
  async function validateInBrowser(projectDir, opts) {
41743
42517
  const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
41744
42518
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
@@ -41857,7 +42631,6 @@ var init_validate = __esm({
41857
42631
  init_project();
41858
42632
  init_colors();
41859
42633
  init_updateCheck();
41860
- init_contrast_audit_browser();
41861
42634
  __filename2 = fileURLToPath8(import.meta.url);
41862
42635
  __dirname3 = dirname21(__filename2);
41863
42636
  CONTRAST_SAMPLES = 5;
@@ -41964,8 +42737,7 @@ __export(snapshot_exports, {
41964
42737
  import { spawn as spawn12 } from "child_process";
41965
42738
  import { existsSync as existsSync53, mkdtempSync as mkdtempSync3, readFileSync as readFileSync36, mkdirSync as mkdirSync27, rmSync as rmSync10 } from "fs";
41966
42739
  import { tmpdir as tmpdir5 } from "os";
41967
- import { resolve as resolve36, join as join53, dirname as dirname22, relative as relative6, isAbsolute as isAbsolute7 } from "path";
41968
- import { fileURLToPath as fileURLToPath9 } from "url";
42740
+ import { resolve as resolve36, join as join53, relative as relative6, isAbsolute as isAbsolute7 } from "path";
41969
42741
  async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDecoder = false) {
41970
42742
  const tmp = mkdtempSync3(join53(tmpdir5(), "hf-snapshot-frame-"));
41971
42743
  const outPath = join53(tmp, "frame.png");
@@ -42022,9 +42794,9 @@ async function captureSnapshots(projectDir, opts) {
42022
42794
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
42023
42795
  const numFrames = opts.frames ?? 5;
42024
42796
  let html = await bundleToSingleHtml2(projectDir);
42025
- const runtimePath = resolve36(__dirname4, "hyperframe.runtime.iife.js");
42026
- if (existsSync53(runtimePath)) {
42027
- const runtimeSource = readFileSync36(runtimePath, "utf-8");
42797
+ const { loadRuntimeSource: loadRuntimeSource2 } = await Promise.resolve().then(() => (init_runtimeSource(), runtimeSource_exports));
42798
+ const runtimeSource = await loadRuntimeSource2();
42799
+ if (runtimeSource) {
42028
42800
  html = html.replace(
42029
42801
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
42030
42802
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
@@ -42238,15 +43010,13 @@ async function captureSnapshots(projectDir, opts) {
42238
43010
  }
42239
43011
  return savedPaths;
42240
43012
  }
42241
- var __filename3, __dirname4, FFMPEG_EXTRACT_TIMEOUT_MS, examples21, snapshot_default;
43013
+ var FFMPEG_EXTRACT_TIMEOUT_MS, examples21, snapshot_default;
42242
43014
  var init_snapshot = __esm({
42243
43015
  "src/commands/snapshot.ts"() {
42244
43016
  "use strict";
42245
43017
  init_dist();
42246
43018
  init_project();
42247
43019
  init_colors();
42248
- __filename3 = fileURLToPath9(import.meta.url);
42249
- __dirname4 = dirname22(__filename3);
42250
43020
  FFMPEG_EXTRACT_TIMEOUT_MS = 3e4;
42251
43021
  examples21 = [
42252
43022
  ["Capture 5 key frames from a composition", "snapshot captures/stripe"],
@@ -43265,7 +44035,7 @@ var init_animationCataloger = __esm({
43265
44035
  });
43266
44036
 
43267
44037
  // src/capture/mediaCapture.ts
43268
- import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync22, readdirSync as readdirSync19, readFileSync as readFileSync37, statSync as statSync20 } from "fs";
44038
+ import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync22, readdirSync as readdirSync18, readFileSync as readFileSync37, statSync as statSync20 } from "fs";
43269
44039
  import { join as join55 } from "path";
43270
44040
  async function saveLottieAnimations(discoveredLotties, lottieDir) {
43271
44041
  let savedCount = 0;
@@ -43329,7 +44099,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
43329
44099
  const manifest = [];
43330
44100
  const previewDir = join55(lottieDir, "previews");
43331
44101
  mkdirSync29(previewDir, { recursive: true });
43332
- for (const file of readdirSync19(lottieDir)) {
44102
+ for (const file of readdirSync18(lottieDir)) {
43333
44103
  if (!file.endsWith(".json")) continue;
43334
44104
  try {
43335
44105
  const raw = JSON.parse(readFileSync37(join55(lottieDir, file), "utf-8"));
@@ -83960,7 +84730,7 @@ ${underline2}`);
83960
84730
  });
83961
84731
 
83962
84732
  // src/capture/contentExtractor.ts
83963
- import { readdirSync as readdirSync20, statSync as statSync22, readFileSync as readFileSync38 } from "fs";
84733
+ import { readdirSync as readdirSync19, statSync as statSync22, readFileSync as readFileSync38 } from "fs";
83964
84734
  import { join as join56 } from "path";
83965
84735
  async function detectLibraries(page, capturedShaders) {
83966
84736
  let detectedLibraries = [];
@@ -84081,7 +84851,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
84081
84851
  try {
84082
84852
  const { GoogleGenAI: GoogleGenAI2 } = await Promise.resolve().then(() => (init_node4(), node_exports));
84083
84853
  const ai = new GoogleGenAI2({ apiKey: geminiKey });
84084
- const imageFiles = readdirSync20(join56(outputDir, "assets")).filter(
84854
+ const imageFiles = readdirSync19(join56(outputDir, "assets")).filter(
84085
84855
  (f3) => /\.(png|jpg|jpeg|webp|gif)$/i.test(f3)
84086
84856
  );
84087
84857
  const model = process.env.HYPERFRAMES_GEMINI_MODEL || "gemini-3.1-flash-lite-preview";
@@ -84141,7 +84911,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
84141
84911
  const fontLines = [];
84142
84912
  const assetsPath = join56(outputDir, "assets");
84143
84913
  try {
84144
- for (const file of readdirSync20(assetsPath)) {
84914
+ for (const file of readdirSync19(assetsPath)) {
84145
84915
  if (file === "svgs" || file === "fonts" || file === "lottie" || file === "videos") continue;
84146
84916
  const filePath = join56(assetsPath, file);
84147
84917
  const stat3 = statSync22(filePath);
@@ -84173,7 +84943,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
84173
84943
  }
84174
84944
  try {
84175
84945
  const svgsPath = join56(assetsPath, "svgs");
84176
- for (const file of readdirSync20(svgsPath)) {
84946
+ for (const file of readdirSync19(svgsPath)) {
84177
84947
  if (!file.endsWith(".svg")) continue;
84178
84948
  const svgMatch = tokens.svgs.find(
84179
84949
  (s2) => s2.label && file.includes(
@@ -84188,7 +84958,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
84188
84958
  }
84189
84959
  try {
84190
84960
  const fontsPath = join56(assetsPath, "fonts");
84191
- for (const file of readdirSync20(fontsPath)) {
84961
+ for (const file of readdirSync19(fontsPath)) {
84192
84962
  fontLines.push(`fonts/${file} \u2014 font file`);
84193
84963
  }
84194
84964
  } catch {
@@ -85371,7 +86141,7 @@ __export(autoUpdate_exports, {
85371
86141
  scheduleBackgroundInstall: () => scheduleBackgroundInstall
85372
86142
  });
85373
86143
  import { spawn as spawn13 } from "child_process";
85374
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync32, openSync } from "fs";
86144
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync32, openSync as openSync2 } from "fs";
85375
86145
  import { homedir as homedir11 } from "os";
85376
86146
  import { join as join61 } from "path";
85377
86147
  import { compareVersions as compareVersions2 } from "compare-versions";
@@ -85420,7 +86190,7 @@ function launchDetachedInstall(installCommand, version) {
85420
86190
  } catch (e) {}
85421
86191
  });
85422
86192
  `;
85423
- const out = openSync(LOG_FILE, "a", 384);
86193
+ const out = openSync2(LOG_FILE, "a", 384);
85424
86194
  const child = spawn13(process.execPath, ["-e", nodeScript], {
85425
86195
  detached: true,
85426
86196
  stdio: ["ignore", out, out],
@@ -85521,6 +86291,18 @@ var init_autoUpdate = __esm({
85521
86291
  }
85522
86292
  });
85523
86293
 
86294
+ // src/commands/contrast-audit.browser.js
86295
+ var contrast_audit_browser_exports = {};
86296
+ __export(contrast_audit_browser_exports, {
86297
+ default: () => contrast_audit_browser_default
86298
+ });
86299
+ var contrast_audit_browser_default;
86300
+ var init_contrast_audit_browser = __esm({
86301
+ "src/commands/contrast-audit.browser.js"() {
86302
+ contrast_audit_browser_default = '// Browser-side WCAG contrast audit.\n// Loaded as a raw string and injected via page.addScriptTag to avoid\n// esbuild mangling (page.evaluate serializes functions; __name helpers break).\n//\n// NOTE: WCAG math (relLum, wcagRatio, parseColor, median) is duplicated in\n// skills/hyperframes/scripts/contrast-report.mjs \u2014 keep in sync.\n\n/* eslint-disable */\nwindow.__contrastAudit = async function (imgBase64, time) {\n function relLum(r, g, b) {\n function ch(v) {\n var s = v / 255;\n return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);\n }\n return 0.2126 * ch(r) + 0.7152 * ch(g) + 0.0722 * ch(b);\n }\n\n function wcagRatio(r1, g1, b1, r2, g2, b2) {\n var l1 = relLum(r1, g1, b1),\n l2 = relLum(r2, g2, b2);\n var hi = l1 > l2 ? l1 : l2,\n lo = l1 > l2 ? l2 : l1;\n return (hi + 0.05) / (lo + 0.05);\n }\n\n function parseColor(c) {\n var m = c.match(/rgba?\\(([^)]+)\\)/);\n if (!m) return [0, 0, 0, 1];\n var p = m[1].split(",").map(function (s) {\n return parseFloat(s.trim());\n });\n return [p[0], p[1], p[2], p[3] != null ? p[3] : 1];\n }\n\n function selectorOf(el) {\n if (el.id) return "#" + el.id;\n var cls = Array.from(el.classList).slice(0, 2).join(".");\n return cls ? el.tagName.toLowerCase() + "." + cls : el.tagName.toLowerCase();\n }\n\n function median(arr) {\n var s = arr.slice().sort(function (a, b) {\n return a - b;\n });\n return s[Math.floor(s.length / 2)];\n }\n\n // Decode screenshot into canvas pixel data\n var img = new Image();\n await new Promise(function (resolve) {\n img.onload = resolve;\n img.onerror = function () {\n resolve();\n };\n img.src = "data:image/png;base64," + imgBase64;\n });\n if (!img.naturalWidth) return [];\n var canvas = document.createElement("canvas");\n canvas.width = img.naturalWidth || 1920;\n canvas.height = img.naturalHeight || 1080;\n var ctx = canvas.getContext("2d");\n if (!ctx) return [];\n ctx.drawImage(img, 0, 0);\n var px = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n var w = canvas.width;\n var h = canvas.height;\n\n // Walk DOM for text elements\n var out = [];\n var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);\n var node;\n while ((node = walker.nextNode())) {\n var el = node;\n\n // Must have a direct text node child\n var hasText = false;\n for (var i = 0; i < el.childNodes.length; i++) {\n if (\n el.childNodes[i].nodeType === 3 &&\n (el.childNodes[i].textContent || "").trim().length > 0\n ) {\n hasText = true;\n break;\n }\n }\n if (!hasText) continue;\n\n var cs = getComputedStyle(el);\n if (cs.visibility === "hidden" || cs.display === "none") continue;\n if (parseFloat(cs.opacity) <= 0.01) continue;\n var rect = el.getBoundingClientRect();\n if (rect.width < 8 || rect.height < 8) continue;\n\n var fg = parseColor(cs.color);\n if (fg[3] <= 0.01) continue;\n\n // Sample 4px ring outside bbox for background color\n var rr = [],\n gg = [],\n bb = [];\n var x0 = Math.max(0, Math.floor(rect.x) - 4);\n var x1 = Math.min(w - 1, Math.ceil(rect.x + rect.width) + 4);\n var y0 = Math.max(0, Math.floor(rect.y) - 4);\n var y1 = Math.min(h - 1, Math.ceil(rect.y + rect.height) + 4);\n var sample = function (sx, sy) {\n var idx = (sy * w + sx) * 4;\n rr.push(px[idx]);\n gg.push(px[idx + 1]);\n bb.push(px[idx + 2]);\n };\n for (var x = x0; x <= x1; x++) {\n sample(x, y0);\n sample(x, y1);\n }\n for (var y = y0; y <= y1; y++) {\n sample(x0, y);\n sample(x1, y);\n }\n\n if (rr.length === 0) continue;\n\n var bgR = median(rr),\n bgG = median(gg),\n bgB = median(bb);\n\n // Composite foreground alpha over measured background\n var compR = Math.round(fg[0] * fg[3] + bgR * (1 - fg[3]));\n var compG = Math.round(fg[1] * fg[3] + bgG * (1 - fg[3]));\n var compB = Math.round(fg[2] * fg[3] + bgB * (1 - fg[3]));\n\n var ratio = +wcagRatio(compR, compG, compB, bgR, bgG, bgB).toFixed(2);\n var fontSize = parseFloat(cs.fontSize);\n var fontWeight = Number(cs.fontWeight) || 400;\n var large = fontSize >= 24 || (fontSize >= 19 && fontWeight >= 700);\n\n out.push({\n time: time,\n selector: selectorOf(el),\n text: (el.textContent || "").trim().slice(0, 50),\n ratio: ratio,\n wcagAA: large ? ratio >= 3 : ratio >= 4.5,\n large: large,\n fg: "rgb(" + compR + "," + compG + "," + compB + ")",\n bg: "rgb(" + bgR + "," + bgG + "," + bgB + ")",\n });\n }\n return out;\n};\n';
86303
+ }
86304
+ });
86305
+
85524
86306
  // src/commands/layout-audit.browser.js
85525
86307
  var layout_audit_browser_exports = {};
85526
86308
  __export(layout_audit_browser_exports, {