popost 4.6.7 → 4.6.9

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.
Files changed (42) hide show
  1. package/SKILL.md +5 -5
  2. package/assets/canvas/assets/{dist-BmD8AP0A.js → dist-CX2mxpwq.js} +1 -1
  3. package/assets/canvas/assets/{es-CC29Cabv.js → es-BFnFFu6P.js} +1 -1
  4. package/assets/canvas/assets/{index-DS6BKqT0.css → index-C5rz5H21.css} +1 -1
  5. package/assets/canvas/assets/{index-DhwyFpu2.js → index-CwqBT_rk.js} +1 -1
  6. package/assets/canvas/assets/{jszip.min-Bwf_yCrF.js → jszip.min-DqfCBLrH.js} +1 -1
  7. package/assets/canvas/build-info.json +7 -7
  8. package/assets/canvas/index.html +2 -2
  9. package/dist/cli.js +944 -613
  10. package/dist/index.js +411 -175
  11. package/dist/types/cloud/service.d.ts +2 -0
  12. package/dist/types/device-login.d.ts +6 -1
  13. package/dist/types/device-pending.d.ts +11 -0
  14. package/dist/types/editor/handoff.d.ts +1 -1
  15. package/dist/types/providers/link-bundle.d.ts +8 -2
  16. package/dist/types/providers/link-video.d.ts +27 -0
  17. package/dist/types/providers/link.d.ts +2 -0
  18. package/dist/types/runtime.d.ts +5 -1
  19. package/dist/types/system-browser.d.ts +17 -0
  20. package/dist/types/version.d.ts +1 -1
  21. package/dist/types/video/compile/footage.d.ts +2 -0
  22. package/dist/types/video/compile/index.d.ts +2 -0
  23. package/dist/types/video/compile/page-bundle.d.ts +1 -1
  24. package/dist/types/video/compile/page.d.ts +1 -0
  25. package/dist/types/video/media/footage.d.ts +1 -0
  26. package/dist/types/video/page/contract.d.ts +2 -0
  27. package/dist/types/video/preview/protocol.d.ts +1 -0
  28. package/dist/types/video/preview/reference.d.ts +9 -0
  29. package/dist/types/video/preview/shell/footage.d.ts +1 -0
  30. package/dist/types/video/preview/shell/i18n.d.ts +1 -0
  31. package/dist/types/video/preview/shell/studio/copy.d.ts +1 -0
  32. package/dist/types/video/preview/shell/studio/style.d.ts +1 -1
  33. package/dist/types/video/preview/shell-bundle.d.ts +1 -1
  34. package/dist/types/workflow/post-bundle.d.ts +9 -2
  35. package/package.json +1 -1
  36. package/references/host-editor.md +2 -2
  37. package/references/image-workflow.md +1 -1
  38. package/references/onboarding.md +5 -3
  39. package/references/post-bundle.md +4 -3
  40. package/references/providers.md +1 -1
  41. package/references/video-editing.md +4 -0
  42. package/references/video-step-1-read.md +3 -1
@@ -61,6 +61,8 @@ export declare class CloudService {
61
61
  private ticket;
62
62
  private tail;
63
63
  private timer;
64
+ private lastMode?;
65
+ private get runtime();
64
66
  private lang;
65
67
  constructor(rt: Runtime, rootOf: () => string, options?: CloudOptions);
66
68
  private get root();
@@ -1,3 +1,4 @@
1
+ import { UsageError } from './args';
1
2
  import { type CredentialsLocation } from './credentials';
2
3
  import type { Runtime } from './runtime';
3
4
  export interface DeviceGrant {
@@ -8,6 +9,10 @@ export interface DeviceGrant {
8
9
  }
9
10
  export declare const deviceLocation: (rt: CredentialsLocation) => string | undefined;
10
11
  export declare const parseDeviceGrant: (value: string) => DeviceGrant;
12
+ export declare class DeviceRequestError extends UsageError {
13
+ readonly retryable: boolean;
14
+ constructor(message: string, retryable: boolean);
15
+ }
11
16
  export declare const deviceApi: <T>(fetcher: Runtime["fetch"], baseUrl: string, route: string, payload: unknown) => Promise<T>;
12
17
  export declare const deviceTokenProvider: (grant: DeviceGrant, fetcher: Runtime["fetch"]) => (baseUrl: string) => Promise<string>;
13
- export declare const login: (rt: Runtime, requestedBase?: string, noOpen?: boolean) => Promise<number>;
18
+ export declare const login: (rt: Runtime, requestedBase?: string, noOpen?: boolean, noWait?: boolean) => Promise<number>;
@@ -0,0 +1,11 @@
1
+ import type { DeviceGrant } from './device-login';
2
+ import type { Runtime } from './runtime';
3
+ export interface PendingLogin extends DeviceGrant {
4
+ userCode: string;
5
+ expiresAt: number;
6
+ interval: number;
7
+ browserOpened?: boolean;
8
+ }
9
+ /** Keep interrupted browser approvals recoverable without exposing the installation signing key. */
10
+ export declare const savePrivate: (rt: Runtime, file: string, value: unknown) => Promise<void>;
11
+ export declare const readPending: (rt: Runtime, file: string) => Promise<PendingLogin | null>;
@@ -2,7 +2,7 @@ import { type CloudMode } from '../cloud/service';
2
2
  import type { Project } from '../core/project';
3
3
  import type { Runtime } from '../runtime';
4
4
  /** The editor build's version (`packages/canvas-editor/src/version.ts`); a service of another version is not reused. */
5
- export declare const EDITOR_VERSION = "4.1.2";
5
+ export declare const EDITOR_VERSION = "4.1.3";
6
6
  export declare const editorInfo: (project: Project) => {
7
7
  schema: string;
8
8
  version: string;
@@ -1,6 +1,7 @@
1
1
  import type { Runtime } from '../runtime';
2
2
  import { type JsonRecord } from './base';
3
3
  import { PopostApiError } from './errors';
4
+ import type { SavedVideo } from './link-video';
4
5
  export interface RemoteImage {
5
6
  readonly url: string;
6
7
  readonly mimeType?: string;
@@ -10,6 +11,8 @@ export interface RemoteImage {
10
11
  }
11
12
  export interface PostPlan {
12
13
  readonly platform: string;
14
+ /** `video`: the pictures are the cover only, the file is fetched separately (link-video.ts); null when the server did not say */
15
+ readonly kind: 'images' | 'video' | null;
13
16
  readonly sourceUrl: string;
14
17
  readonly title: string;
15
18
  readonly text: string;
@@ -49,5 +52,8 @@ export interface Downloaded {
49
52
  * ones before it. `retry` is what the user is told to do about a failure.
50
53
  */
51
54
  export declare const downloadPictures: (rt: Runtime, images: readonly RemoteImage[], outDir: string, retry: string) => Promise<Downloaded>;
52
- /** The PostBundle for a downloaded post; its resources are the files in `saved`, as paths relative to the bundle file. */
53
- export declare const buildBundle: (rt: Runtime, plan: PostPlan, saved: readonly SavedImage[]) => JsonRecord;
55
+ /**
56
+ * The PostBundle for a downloaded post; its resources are the files in `saved` and the post's `video`, as paths relative
57
+ * to the bundle file. Pages (`pageOrder`) are the pictures only: a video post's one picture is its cover.
58
+ */
59
+ export declare const buildBundle: (rt: Runtime, plan: PostPlan, saved: readonly SavedImage[], video?: SavedVideo) => JsonRecord;
@@ -0,0 +1,27 @@
1
+ import type { Runtime } from '../runtime';
2
+ import { type PopostClient } from './api';
3
+ /** The server keeps source videos up to this size. */
4
+ export declare const MAX_VIDEO_BYTES: number;
5
+ export interface SavedVideo {
6
+ readonly file: string;
7
+ readonly path: string;
8
+ readonly mimeType: string;
9
+ readonly sha256: string;
10
+ readonly bytes: number;
11
+ }
12
+ export type VideoOutcome = {
13
+ readonly saved: SavedVideo;
14
+ } | {
15
+ readonly missing: {
16
+ readonly code: string;
17
+ readonly error: string;
18
+ };
19
+ }
20
+ /** the caller may not fetch videos (the web Agent): nothing to report */
21
+ | {
22
+ readonly skipped: true;
23
+ };
24
+ /** MP4 / QuickTime / WebM from the first bytes; `claimed` only decides between MP4 and QuickTime without an `ftyp` box. */
25
+ export declare const sniffVideoMime: (head: Uint8Array, claimed: string) => string | null;
26
+ /** Downloads the video of a parsed video post into `outDir`. `retry` is what the user is told to do about a failed download. */
27
+ export declare const downloadVideo: (rt: Runtime, client: PopostClient, inspirationId: string, outDir: string, retry: string) => Promise<VideoOutcome>;
@@ -5,6 +5,8 @@ export interface LinkOptions {
5
5
  readonly out?: string;
6
6
  readonly timeoutSec: number;
7
7
  readonly noDownload: boolean;
8
+ /** keep a video post to its cover and text: do not fetch the original video */
9
+ readonly noVideo?: boolean;
8
10
  readonly libraryOnly?: boolean;
9
11
  readonly config?: string;
10
12
  }
@@ -158,8 +158,12 @@ export interface Runtime {
158
158
  readonly homeDir?: string;
159
159
  readonly deviceName?: string;
160
160
  readonly explicitApiKey?: boolean;
161
+ /** Re-read desktop credentials when an editor outlives a browser authorization. */
162
+ readonly refreshAccount?: () => Pick<Runtime, 'env' | 'deviceAccess' | 'credentialScope'>;
163
+ /** Opaque local credential identity for account-isolated cloud caches. */
164
+ readonly credentialScope?: string;
161
165
  readonly deviceAccess?: (baseUrl: string) => Promise<string>;
162
- readonly openExternal?: (url: string) => Promise<void>;
166
+ readonly openExternal?: (url: string) => Promise<boolean | void>;
163
167
  /** Desktop-only: reads all of standard input (`auth set --stdin`). Omitted by hosts without a stdin. */
164
168
  readonly stdin?: () => Promise<string>;
165
169
  /** Desktop-only, interactive terminal input without echo. Never falls back to visible input. */
@@ -0,0 +1,17 @@
1
+ interface BrowserCommand {
2
+ command: string;
3
+ args: string[];
4
+ wait?: boolean;
5
+ }
6
+ export interface BrowserHost {
7
+ os: string;
8
+ env: NodeJS.ProcessEnv;
9
+ preferred: () => Promise<string>;
10
+ available: (command: string) => Promise<boolean>;
11
+ launch: (command: BrowserCommand) => Promise<boolean>;
12
+ }
13
+ export declare const macDefaultBrowser: (handlers: string) => string;
14
+ /** Explicit browser apps bypass IDE URL handlers, BROWSER wrappers and embedded webviews. */
15
+ export declare const browserCommands: (os: string, env: NodeJS.ProcessEnv, preferred: string, url: string) => BrowserCommand[];
16
+ export declare const openSystemBrowser: (url: string, host: BrowserHost) => Promise<boolean>;
17
+ export {};
@@ -1,2 +1,2 @@
1
1
  /** The CLI version; equals `metadata.version` in SKILL.md and is sent to popost.ai as `x-popost-client-version`. */
2
- export declare const VERSION = "4.6.7";
2
+ export declare const VERSION = "4.6.9";
@@ -4,6 +4,8 @@ import { type FootageColour } from '../media/footage';
4
4
  /** Where frame pictures go, relative to the project directory. */
5
5
  export declare const FOOTAGE_CACHE = ".cache/video";
6
6
  export interface FootageProbe {
7
+ /** Codecs that common browsers decode directly; other sources keep extracted frame pictures. */
8
+ native?: Record<string, boolean>;
7
9
  /** For check and resolve. */
8
10
  info: Record<string, FootageInfo>;
9
11
  colour: Record<string, FootageColour>;
@@ -19,6 +19,8 @@ export interface BuiltPage {
19
19
  footage?: FootageStats;
20
20
  }
21
21
  export interface BuildOptions {
22
+ /** Interactive Studio decodes source video directly; exports still extract deterministic frame pictures. */
23
+ nativeFootage?: boolean;
22
24
  /** Render scale: the page's size, and the size video frames are extracted at. Default 1. */
23
25
  scale?: number;
24
26
  /** An immutable JSON snapshot, supplied by Studio exports. Assets still resolve against projectDir. */
@@ -1 +1 @@
1
- export declare const PAGE_BUNDLE = "\"use strict\";(()=>{var de=(e,t)=>t<e.start?\"before\":t<e.end?\"spoken\":\"past\",$={padding:.1,radius:.2},D={scale:1,background:!1},me=(e,t)=>!e||t===\"before\"?D:t===\"past\"?e.past?{...D,...e.past.color?{color:e.past.color}:{},...e.past.opacity!==void 0?{opacity:e.past.opacity}:{}}:D:{scale:e.scale??1,background:e.background!==void 0,...e.color?{color:e.color}:{},...e.weight?{weight:e.weight}:{}},lt=(e,t,n)=>{let o=0;for(;o<e.length&&(e[o]?.start??1/0)<=n;)o++;return o===0?0:e[o]?.from??t},ue=(e,t,n,o)=>{let s=Math.round(t.chars*n);return e.reveal===\"words\"&&e.words?Math.min(s,lt(e.words,n,o)):s};var g=e=>e>0?e<1?e:1:0,C=(e,t,n)=>e+(t-e)*n,v=(e,t)=>{let n=g(t);switch(e){case\"linear\":return n;case\"in\":return n*n*n;case\"out\":return 1-(1-n)**3;case\"in-out\":return n<.5?4*n*n*n:1-(-2*n+2)**3/2}},M=e=>{let t=(Math.imul(e|0,2654435761)^1540483477)>>>0;return t=Math.imul(t^t>>>15,2246822507)>>>0,t=Math.imul(t^t>>>13,3266489909)>>>0,((t^t>>>16)>>>0)/4294967296};var Z={opacity:1,translate:[0,0],scale:1,rotate:0,blur:0,clip:[0,0,0,0],chars:1};var B={left:[-1,0],right:[1,0],up:[0,-1],down:[0,1]},Q={up:0,right:1,down:2,left:3},dt={left:\"right\",right:\"left\",up:\"down\",down:\"up\"},mt=.6,O=.6,ut=.25,pt=.04,ft=(e,t)=>e<O?C(mt,1+t,v(\"out\",e/O)):C(1+t,1,v(\"in-out\",(e-O)/(1-O))),pe=(e,t,n)=>{switch(e.preset){case\"none\":return{};case\"fade\":return{opacity:n};case\"pop\":return{scale:ft(n,e.overshoot),opacity:g(n/ut)};case\"scale-in\":return{scale:n};case\"slide\":{let[o,s]=B[t];return{translate:[-o*e.distance*(1-n),-s*e.distance*(1-n)],opacity:g(n*2)}}case\"wipe\":{let o=[0,0,0,0];return o[Q[t]]=1-n,{clip:o}}case\"type\":return{chars:n};case\"blur\":return{blur:pt*(1-n),opacity:n}}},ee=(e,t,n)=>{let o=e.preset===\"type\"?g(n):v(e.ease,n),s=t===\"enter\"?pe(e,e.direction,o):pe(e,dt[e.direction],1-o);return{...Z,...s}};var oe={opacity:1,translate:[0,0],scale:1,rotate:0,blur:0,smear:[0,0],clip:[0,0,0,0],z:0},p=(e={})=>({...oe,...e}),S=()=>p({opacity:0}),W={black:\"#000000\",white:\"#ffffff\"},he=1.5,be=.06,ge=.5,ye=.25,xe=.08,ve=.05,te=.08,ht=.15,Se=90,T=e=>e.strength??1,z=e=>1-Math.abs(2*e-1),ne=e=>e<.5?e/.5:(e-.5)/.5,se=e=>B[e in B?e:\"left\"],we=(e,t)=>{let n=e*Math.PI/180,o=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n));return Math.max((t.width*o+t.height*s)/t.width,(t.width*s+t.height*o)/t.height)},Te=(e,t)=>Math.min(t-1,Math.max(0,Math.round(e*(t+1))-1)),fe=(e,t,n)=>({old:n<.5?p():S(),next:p({opacity:n<.5?0:1,z:1}),overlay:{color:e,opacity:t}}),bt=(e,t)=>{if(e.direction===\"center-out\")return{old:p(),next:p({clip:{radius:t},z:1})};if(e.direction===\"edges-in\")return{old:p({clip:{radius:1-t},z:1}),next:p()};let n=[0,0,0,0];return n[Q[e.direction]]=1-t,{old:p(),next:p({clip:n,z:1})}},gt=(e,t)=>{let[n,o]=se(e.direction),s=[n*t,o*t],r=[n*(t-1),o*(t-1)];return e.mode===\"cover\"?{old:p(),next:p({translate:r,z:1})}:e.mode===\"reveal\"?{old:p({translate:s,z:1}),next:p()}:{old:p({translate:s}),next:p({translate:r,z:1})}},yt=(e,t,n,o)=>{let s=v(\"in-out\",ne(t)),r=Se*T(e),a=t<.5?r*s:-r*(1-s),i=p({rotate:a,scale:we(a,o),z:1});return t<.5?{old:i,next:S()}:{old:S(),next:i}},xt=(e,t,n)=>{let o=Te(n,e.frames),s=(o+.5)/e.frames>.3+.4*M(o),r=(M(o+101)-.5)*2*xe*T(e)*z(g(n)),a=p({translate:[r,0],scale:1+2*Math.abs(r),z:1});return s?{old:S(),next:a}:{old:a,next:S()}},vt=(e,t,n)=>{let o=Te(n,e.frames),s=ve*T(e)*(t<.5?t/.5:((1-t)/.5)**2),r=o%2===0?1:-1,a=s*r*(.6+.4*M(o)),i=s*(M(o+7)-.5),c=p({translate:[a,i],scale:1+2*s,z:1});return t<.5?{old:c,next:S()}:{old:S(),next:c}},St=(e,t)=>{let[n,o]=se(e.direction),s=te*T(e)*z(t),r=[Math.abs(n)*s,Math.abs(o)*s];return{old:p({translate:[n*t,o*t],smear:r}),next:p({translate:[n*(t-1),o*(t-1)],smear:r,z:1})}},wt={fade:(e,t)=>fe(W[e.via],g(T(e)*z(t)),t),flash:(e,t)=>fe(W.white,g(he*T(e)*z(t)),t),dissolve:(e,t)=>({old:p(),next:p({opacity:t,z:1})}),wipe:bt,slide:gt,zoom:(e,t)=>({old:p({scale:1+ge*T(e)*t,opacity:1-t,z:1}),next:p({scale:1+ye*T(e)*(1-t)})}),spin:yt,blur:(e,t)=>{let n=be*T(e)*(t<.5?ne(t):1-ne(t));return t<.5?{old:p({blur:n,z:1}),next:S()}:{old:S(),next:p({blur:n,z:1})}},glitch:xt,shake:vt,whip:St},Tt=(e,t)=>{let n=t%2===0?1:-1;return{translate:[e*n*(.6+.4*M(t)),e*(M(t+7)-.5)],scale:1+2*e}},Et={blur:(e,t)=>({layer:{blur:be*t}}),zoom:(e,t,n,o)=>({layer:{scale:1+(o===\"before\"?ge:ye)*t}}),shake:(e,t,n)=>({layer:Tt(ve*t,n)}),glitch:(e,t,n)=>{let o=(M(n+101)-.5)*2*xe*t;return{layer:{translate:[o,0],scale:1+2*Math.abs(o)}}},whip:(e,t,n,o)=>{let[s,r]=se(e.direction),a=ht*t*(o===\"after\"?-1:1);return{layer:{translate:[s*a,r*a],scale:1+2*Math.abs(a),smear:[Math.abs(s)*te*t,Math.abs(r)*te*t]}}},spin:(e,t,n,o,s)=>{let r=Se*t*(o===\"after\"?-1:1);return{layer:{rotate:r,scale:we(r,s)}}},flash:(e,t)=>({layer:{},overlay:{color:W.white,opacity:g(he*t)}}),fade:(e,t)=>({layer:{},overlay:{color:W[e.via],opacity:g(t)}}),dissolve:()=>({layer:{}}),wipe:()=>({layer:{}}),slide:()=>({layer:{}})},Mt=(e,t,n,o)=>{let s=t===\"after\"?1-v(e.ease,n):v(e.ease,n),r=Math.min(e.frames-1,Math.max(0,Math.round(n*e.frames)-(t===\"before\"?1:0))),a=Et[e.kind](e,s*T(e),r,t,o),i=p({...a.layer,z:1}),c=t===\"after\"?{old:S(),next:i}:{old:i,next:S()};return a.overlay&&a.overlay.opacity>0?{...c,overlay:a.overlay}:c},Ee=(e,t,n)=>{let o=e.side??\"both\";return o===\"both\"?wt[e.kind](e,v(e.ease,t),g(t),n):Mt(e,o,t,n)};var G={scale:1,translate:[0,0]};var kt=(e,t)=>{let n=C(e.scale[0],e.scale[1],t),o=[C(e.shift[0][0],e.shift[1][0],t),C(e.shift[0][1],e.shift[1][1],t)];return{scale:n,translate:[(1-n)*(e.focus[0]-.5)+(o[0]??0),(1-n)*(e.focus[1]-.5)+(o[1]??0)]}},Me=(e,t)=>{let n=e[0];if(!n)return G;let o=[...e].reverse().find(r=>t>=r.from)??n,s=t<o.from?0:g((t-o.from)/Math.max(1,o.to-o.from));return kt(o,v(o.ease,s))};var k={opacity:1,scale:1,translate:[0,0],rotate:0};var ke=(e,t)=>{let n=2*Math.PI*t/e.period,o=e.amount;switch(e.preset){case\"pulse\":return{...k,scale:1+o*(1-Math.cos(n))/2};case\"float\":{let s=o*Math.sin(n);return{...k,translate:[0,s===0?0:-s]}}case\"sway\":return{...k,rotate:o*Math.sin(n)};case\"blink\":return{...k,opacity:t%e.period<e.period/2?1:1-o};case\"spin\":return{...k,rotate:360*o*t/e.period}}};var _=(e,t)=>Math.min(Math.max(0,e.frames-1),Math.max(0,Math.floor(t))),Re=(e,t)=>t>=e.a&&t<e.a+e.frames,Rt=(e,t)=>{let n=e.side??\"both\";return n===\"after\"?(t-e.a)/e.frames:n===\"before\"?(t-e.a+1)/e.frames:(t-e.a+1)/(e.frames+1)},Le=(e,t)=>{let n=e.segments[t],o=n?.transition,s=e.segments[t+1]?.transition;if(!n)return[0,0];let r=o&&(o.side??\"both\")===\"both\"?o.a:n.start,a=s&&(s.side??\"both\")===\"both\"?s.a+s.frames-1:n.end-1;return[r,a]},re=(e,t,n)=>{let o=e.segments[t]?.base;if(!o||o.kind===\"color\"||o.kind===\"scene\")return G;if(o.moves)return Me(o.moves,n);if(o.zoom===0&&o.pan[0]===0&&o.pan[1]===0)return G;let[s,r]=Le(e,t),a=(n-s)/e.canvas.fps,i=(r-s)/e.canvas.fps,c=o.zoom>=0?o.zoom*a:-o.zoom*(i-a),m=Math.max(Math.abs(o.pan[0]),Math.abs(o.pan[1]))*i;return{scale:1+c+m,translate:[o.pan[0]*(a-i/2),o.pan[1]*(a-i/2)]}};var Ce=(e,t,n,o)=>{let s=Ee(n,Rt(n,o),e.canvas),r=n.side??\"both\",a={index:t,state:s.old,camera:re(e,t,o)},i={index:t+1,state:s.next,camera:re(e,t+1,o)};return{layers:r===\"both\"?[a,i]:r===\"after\"?[i]:[a],...s.overlay?{overlay:s.overlay}:{}}},j=(e,t)=>{let n=_(e,t),o=Math.max(0,e.segments.findIndex(a=>n>=a.start&&n<a.end)),s=e.segments[o]?.transition;if(s&&Re(s,n))return Ce(e,o-1,s,n);let r=e.segments[o+1]?.transition;return r&&Re(r,n)?Ce(e,o,r,n):{layers:[{index:o,state:oe,camera:re(e,o,n)}]}},Ct=(e,t)=>{let n=t-e.start,o=e.end-e.start;return e.enter.frames>0&&n<e.enter.frames?ee(e.enter,\"enter\",(n+1)/e.enter.frames):e.exit.frames>0&&n>=o-e.exit.frames?ee(e.exit,\"exit\",(n-(o-e.exit.frames))/e.exit.frames):Z},Lt=(e,t)=>{let n=e.start+e.enter.frames,o=Math.max(n,e.end-e.exit.frames);return Math.min(Math.max(0,t-n),o-n)},Ne=(e,t)=>{if(t<e.start||t>=e.end)return;let n=Ct(e,t),o=e.loop?ke(e.loop,Lt(e,t)):k;return o===k&&e.opacity===void 0&&e.rotate===void 0?n:{...n,opacity:n.opacity*o.opacity*(e.opacity??1),scale:n.scale*o.scale,translate:[n.translate[0]+o.translate[0],n.translate[1]+o.translate[1]],rotate:n.rotate+o.rotate+(e.rotate??0)}};var Nt=6,At=(e,t,n,o)=>{let s=Math.max(0,t.frames-1),r=o-e.start;return r<=0?Math.min(e.in,s):Math.min(s,e.in+Math.round(r*t.fps*e.speed/n))},It=(e,t)=>e+\"/\"+String(t).padStart(Nt,\"0\")+\".png\",ae=(e,t,n)=>{let o=e.footage?.[t.material];return o?.dir===void 0?void 0:It(o.dir,At(t,o,e.canvas.fps,n))};var Ae=\"popost-times=\";var Pt=e=>{let t=new Map;for(let n of e.items){if(!n.cue)continue;let o=n.cue.track+\"#\"+n.cue.index,s=t.get(o);t.set(o,s?[Math.min(s[0],n.start),Math.max(s[1],n.end)]:[n.start,n.end])}return[...t.values()]},Dt=(e,t)=>{let n=e.canvas.fps,o=t.base.kind===\"scene\"?t.base.offset??0:0,s=d=>Math.round(Math.max(o,(d-t.start)/n+o)*1e3)/1e3,r=Math.round(.2*n),a=d=>d>=t.start-r&&d<t.end,i=e.speech?.voice??[],c=(i.length?i:Pt(e)).filter(([d])=>a(d)).sort((d,l)=>d[0]-l[0]),m=(e.words??[]).flatMap(d=>d.tokens).filter(d=>a(d.start)).sort((d,l)=>d.start-l.start);if(!(!c.length&&!m.length))return{seconds:s(t.end),lines:c.map(([d,l])=>({at:s(d),end:s(l)})),words:m.map(d=>({text:d.text,at:s(d.start),end:s(d.end)}))}},Ie=(e,t,n)=>{let o=Dt(e,t);return o?n+\"#\"+Ae+encodeURIComponent(JSON.stringify(o)):n},K=e=>e.split(\"#\"+Ae)[0]??e;var _t=(e,t)=>{e.querySelectorAll(\"[data-slot]\").forEach(n=>{let o=t[n.getAttribute(\"data-slot\")??\"\"];o!==void 0&&(n instanceof(e.defaultView??globalThis).HTMLImageElement?n.setAttribute(\"src\",o):n.textContent=o)})},Pe=e=>[e?.__popostScene?.timeline,...Object.values(e?.__timelines??{})].filter(t=>typeof t==\"object\"&&t!==null&&(typeof t.seek==\"function\"||typeof t.time==\"function\")),De=e=>{let t=e.frame.contentDocument;if(t)for(let n of t.getAnimations())e.animations.includes(n)||e.animations.push(n)},Ft=e=>e?.picture?'The picture \"'+e.picture.src+'\" of the scene \"'+e.scene+'\" could not be loaded. Check its path: it is relative to the scene file.':'The scene \"'+(e?.scene??\"\")+'\" could not be loaded. Check that the file exists in the project directory and is an HTML page.',L=class extends Error{name=\"SceneLoadError\";failures;constructor(t){super(Ft(t[0])),this.failures=t}},Ht=async(e,t,n)=>{let o=Array.from(t.images),s=await Promise.allSettled(o.map(r=>r.decode()));return o.flatMap((r,a)=>{if(s[a]?.status!==\"rejected\")return[];let i=r.getAttribute(\"data-slot\"),c=i!==null&&e.slots?.[i]!==void 0;return[{segment:e.segment,scene:n,picture:{src:r.getAttribute(\"src\")??\"\",url:r.currentSrc||r.src,...c?{slot:i}:{}}}]})},Ot=async e=>{let{frame:t}=e,n=K(e.source??t.getAttribute(\"src\")??\"\"),o=Bt(t);try{await Wt(e,n)}finally{o()}},Bt=e=>{let t=e.parentElement;return!t||t.style.display!==\"none\"?()=>{}:(t.style.display=\"block\",t.style.visibility=\"hidden\",()=>{t.style.visibility===\"hidden\"&&(t.style.removeProperty(\"visibility\"),t.style.display=\"none\")})},Wt=async(e,t)=>{let{frame:n}=e;await new Promise(r=>{let a=()=>{n.contentDocument?.readyState!==\"complete\"||n.contentDocument.URL===\"about:blank\"||(n.removeEventListener(\"load\",a),r())};n.addEventListener(\"load\",a),e.source&&(n.src=e.source),a()});let o=n.contentDocument;if(!o?.body)throw new L([{segment:e.segment,scene:t}]);e.slots&&_t(o,e.slots),await o.fonts.ready;let s=await Ht(e,o,t);if(s.length)throw new L(s);De(e),zt(e)},_e=e=>e.ready??=Ot(e),zt=e=>{for(let t of e.animations)t.playState!==\"paused\"&&t.pause(),t.currentTime=0;for(let t of Pe(e.frame.contentWindow))t.pause?.()},Fe=(e,t,n)=>{De(e);let o=Math.max(0,t)*1e3,s=!1,r=[];for(let l of e.animations){l.playState!==\"paused\"&&l.pause(),l.currentTime=o;let u=Number(l.effect?.getComputedTiming().endTime??0);r.push(Math.min(o,u)),o>=u||(s=!0)}let a=e.frame.contentWindow,i=Math.max(0,t);for(let l of Pe(a)){l.pause?.(),typeof l.seek==\"function\"?l.seek(i,!1):l.time?.(i);let u=typeof l.totalDuration==\"function\"?l.totalDuration():typeof l.duration==\"function\"?l.duration():1/0;r.push(Math.min(i,u)),i>=u||(s=!0)}let c=a?.__popostScene?.render;typeof c==\"function\"&&(c(Math.max(0,t),n),s=!0);let m=r.join(\"|\"),d=e.clock!==m;return e.clock=m,s||d};var Gt='\"Noto Sans CJK SC\", \"Noto Sans SC\", \"PingFang SC\", \"Microsoft YaHei\", sans-serif',V={font:Gt,size:.045,weight:700,color:\"#ffffff\",align:\"center\",italic:!1},A=1.25;var so={headline:{...V,size:.065,weight:800,stroke:{color:\"#000000\",width:.12}},subtitle:{...V,size:.04,weight:700,stroke:{color:\"#000000\",width:.1}},label:{...V,size:.032,weight:700,color:\"#111111\",background:{color:\"#ffffff\",padding:.35,radius:.3}},caption:{...V,size:.036,weight:600,background:{color:\"rgba(0, 0, 0, 0.6)\",padding:.3,radius:.2}}};var He=(e,t)=>{let n=Array.from(e),o=[...t??[]].sort((a,i)=>a.from-i.from),s=[],r=0;for(let a of o){let i=Math.min(n.length,Math.max(r,a.from)),c=Math.min(n.length,a.to);i>r&&s.push({text:n.slice(r,i).join(\"\")}),c>i?(s.push({text:n.slice(i,c).join(\"\"),span:a}),r=c):r=i}return r<n.length&&s.push({text:n.slice(r).join(\"\")}),s};var R=e=>String(Math.round(e*1e4)/1e4),f=e=>R(e)+\"px\",b=(e,t,n,o)=>{let s=e.createElement(t);return s.style.cssText=n,o.appendChild(s),s},I=(e,t,n,o)=>{let s=(e.padding??.3)*t,r=(e.radius??0)*t;return\"background:\"+e.color+\";padding:\"+[s,o?s:0,s,n?s:0].map(f).join(\" \")+\";border-radius:\"+[n?r:0,o?r:0,o?r:0,n?r:0].map(f).join(\" \")+\";\"},U=e=>e?(e.color?\"color:\"+e.color+\";\":\"\")+(e.weight?\"font-weight:\"+e.weight+\";\":\"\")+(e.italic!==void 0?\"font-style:\"+(e.italic?\"italic\":\"normal\")+\";\":\"\"):\"\";var jt=(e,t)=>{let n=new Array(t).fill(void 0);for(let o of e??[])for(let s=Math.max(0,o.from);s<Math.min(t,o.to);s++)n[s]=o;return n},Be=(e,t,n,o)=>U(e)+(e?.background?I(e.background,o,t===e.from,t===Math.min(e.to,n)-1):\"\"),We=(e,t,n,o)=>{let s=Be(e.spans[t],t,e.chars.length,e.size),r=b(e.doc,\"span\",s,n);r.textContent=e.chars[t]??\"\",e.out.chars.push(r),e.out.charCss.push(s),e.out.owner.push(o)},Kt=e=>{let t=e.s.spoken?.background;if(!t)return\"\";let n=(t.padding??$.padding)*e.size,o=((e.s.lineHeight??A)-1.1)/2*e.size-n;return\"position:absolute;left:\"+f(-n)+\";right:\"+f(-n)+\";top:\"+f(o)+\";bottom:\"+f(o)+\";z-index:0;transform-origin:50% 50%;background:\"+t.color+\";border-radius:\"+f((t.radius??$.radius)*e.size)+\";\"},Oe=\"position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;white-space:pre;transform-origin:50% 50%;\",Vt=(e,t,n,o,s)=>{let r=b(e.doc,\"span\",\"display:inline-block;position:relative;white-space:nowrap;\",s),a=b(e.doc,\"span\",\"visibility:hidden;\",r),i=e.s.spoken?.weight;for(let l=n;l<o;l++){let u=e.spans[l]?.weight??e.s.weight,h=b(e.doc,\"span\",Be(e.spans[l],l,e.chars.length,e.size)+(i&&i>u?\"font-weight:\"+i+\";\":\"\"),a);h.textContent=e.chars[l]??\"\"}let c=Kt(e),m=c?b(e.doc,\"span\",c+\"display:none;\",r):void 0,d=b(e.doc,\"span\",Oe+\"z-index:1;\",r);d.dataset.glyphs=\"1\";for(let l=n;l<o;l++)We(e,l,d,{token:t,gap:!1});e.out.tokens.push({layer:d,layerCss:Oe,...m?{box:m}:{},boxCss:c})},ze=(e,t,n,o,s)=>{let r=Array.from(t.text??\"\"),a=t.words??[],i={doc:e,chars:r,spans:jt(n.spans,r.length),s:n,size:o,out:{chars:[],charCss:[],owner:[],tokens:[]}},c=0,m=0;for(;c<r.length;){let d=a[m];if(d&&c>=d.from){Vt(i,m,d.from,Math.max(d.from,Math.min(d.to,r.length)),s),c=Math.max(c,d.to),m++;continue}let l=Math.min(r.length,d?d.from:r.length),u=b(e,\"span\",\"position:relative;z-index:1;\",s);for(let h=c;h<l;h++)We(i,h,u,{token:m-1,gap:!0});c=l}return i.out},Ut=e=>e?(e.color?\"color:\"+e.color+\";\":\"\")+(e.weight?\"font-weight:\"+e.weight+\";\":\"\")+(e.opacity!==void 0?\"opacity:\"+R(e.opacity)+\";\":\"\"):\"\",Ge=(e,t,n,o)=>{let r=(t.words??[]).map(i=>de(i,n)),a=r.map(i=>me(t.style?.spoken,i));e.tokens.forEach((i,c)=>{let m=a[c]??D,d=\"transform:\"+(m.scale!==1?\"scale(\"+R(m.scale)+\")\":\"none\")+\";\";i.layer.style.cssText=i.layerCss+\"z-index:\"+(r[c]===\"spoken\"?2:1)+\";\"+d,i.box&&(i.box.style.cssText=i.boxCss+\"display:\"+(m.background?\"block\":\"none\")+\";\"+d)}),e.chars.forEach((i,c)=>{let m=e.owner[c]??{token:-1,gap:!0},d=m.token<0?void 0:m.gap?r[m.token]===\"past\"?a[m.token]:void 0:a[m.token];i.style.cssText=(e.charCss[c]??\"\")+Ut(d)+\"visibility:\"+(c<o?\"visible\":\"hidden\")+\";\"})};var E=e=>String(Math.round(e*1e4)/1e4),F=e=>E(e)+\"px\",Yt=e=>E(e*100)+\"%\",Xt=e=>({W:e.canvas.width,H:e.canvas.height,min:Math.min(e.canvas.width,e.canvas.height),halfDiagonal:Math.hypot(e.canvas.width,e.canvas.height)/2}),Ke=e=>e.every(t=>t<=0)?\"none\":\"inset(\"+e.map(Yt).join(\" \")+\")\",qt=(e,t)=>Array.isArray(e)?Ke(e):\"circle(\"+F(Math.max(0,e.radius)*t.halfDiagonal)+\" at 50% 50%)\",ie=(e,t,n,o)=>e===0&&t===0&&n===0&&o===1?\"none\":\"translate(\"+F(e)+\",\"+F(t)+\") rotate(\"+E(n)+\"deg) scale(\"+E(o)+\")\",Jt=(e,t,n)=>{if(!t){e.layer.style.cssText=e.layerCss+\"display:none;\",e.smear.setAttribute(\"stdDeviation\",\"0 0\"),e.img&&(e.img.style.cssText=e.imgCss);return}let o=t.state,s=o.smear[0]>0||o.smear[1]>0,r=o.blur>0?\"blur(\"+F(o.blur*n.min)+\")\":s?\"url(#\"+e.filterId+\")\":\"none\";e.layer.style.cssText=e.layerCss+\"display:block;z-index:\"+(o.z+1)+\";opacity:\"+E(o.opacity)+\";transform:\"+ie(o.translate[0]*n.W,o.translate[1]*n.H,o.rotate,o.scale)+\";filter:\"+r+\";clip-path:\"+qt(o.clip,n)+\";\",e.smear.setAttribute(\"stdDeviation\",E(o.smear[0]*n.min)+\" \"+E(o.smear[1]*n.min));let a=t.camera;e.img&&(e.img.style.cssText=e.imgCss+\"transform:\"+ie(a.translate[0]*n.W,a.translate[1]*n.H,0,a.scale)+\";\")},$t=(e,t,n)=>{let o=[e.shadow,t>0?\"blur(\"+F(t*n.min)+\")\":\"\"].filter(s=>s!==\"\");return o.length>0?o.join(\" \"):\"none\"},Zt=(e,t,n)=>e.css+\"display:\"+e.display+\";opacity:\"+E(t.opacity)+\";transform:\"+ie(t.translate[0]*n.min,t.translate[1]*n.min,t.rotate,t.scale)+\";filter:\"+$t(e,t.blur,n)+\";clip-path:\"+Ke(t.clip)+\";\",Qt=(e,t,n,o,s)=>{e.el.style.cssText=n?Zt(e,n,o):e.css+\"display:none;\";let r=n?ue(t,n,e.chars.length,s):e.chars.length;e.words?Ge(e.words,t,s,r):e.chars.forEach((a,i)=>{a.style.visibility=i<r?\"visible\":\"hidden\"})},je=(e,t,n)=>{if(e){if(t===void 0){e.hasAttribute(\"src\")&&e.removeAttribute(\"src\");return}e.getAttribute(\"src\")!==t&&e.setAttribute(\"src\",t),n.push(e)}},Y=(e,t,n,o=!0,s=!0)=>{let r=Xt(t),a=_(t,n),i=j(t,a),c=[];return e.live=!1,e.shown=[],e.segments.forEach((m,d)=>{let l=i.layers.find(y=>y.index===d);Jt(m,l,r);let u=t.segments[d]?.base,h=(a-(t.segments[d]?.start??0))/t.canvas.fps+(u?.kind===\"scene\"?u.offset??0:0);m.scene&&l&&e.shown.push({segment:d,seconds:Math.max(0,h)}),s&&m.scene&&l&&Fe(m.scene,h,t.canvas.fps)&&(e.live=!0),o&&u?.kind===\"video\"&&je(m.img,l?ae(t,u.play,a):void 0,c)}),e.overlay.style.cssText=i.overlay?e.overlayCss+\"display:block;background:\"+i.overlay.color+\";opacity:\"+E(i.overlay.opacity)+\";\":e.overlayCss+\"display:none;\",t.items.forEach((m,d)=>{let l=e.items[d];if(!l)return;let u=Ne(m,a);Qt(l,m,u,r,a),o&&m.play&&je(l.img,u?ae(t,m.play,a):void 0,c)}),c};var Ve=e=>String(Math.round(e*1e4)/1e4);var ce=e=>{let t=e.stops.map(n=>n.color+\" \"+Ve(n.at*100)+\"%\").join(\", \");return e.type===\"linear\"?\"linear-gradient(\"+Ve(e.angle??180)+\"deg, \"+t+\")\":\"radial-gradient(farthest-corner at 50% 50%, \"+t+\")\"};var q=\"http://www.w3.org/2000/svg\",X=e=>\"position:absolute;left:0;top:0;width:\"+f(e.canvas.width)+\";height:\"+f(e.canvas.height)+\";\",qe=e=>Math.min(e.canvas.width,e.canvas.height),Ue=e=>'\"'+e.replace(/[\"\\\\]/g,\"\\\\$&\").replace(/\\n/g,\"\\\\a \")+'\"',Je=(e,t)=>f(e.x*t)+\" \"+f(e.y*t)+\" \"+f(e.blur*t)+\" \"+e.color,en=(e,t,n,o,s)=>{let r=n.base.kind===\"color\"?n.base:n.base.kind===\"scene\"?void 0:n.base.ground,a=r?\"background:\"+(r.gradient?ce(r.gradient):r.color)+\";\":\"\",i=X(t)+\"overflow:hidden;transform-origin:50% 50%;\"+a,c=b(e,\"div\",i+\"display:none;\",o);c.dataset.segment=n.id;let m=\"popost-smear-\"+n.index,d=e.createElementNS(q,\"filter\");d.setAttribute(\"id\",m),d.setAttribute(\"color-interpolation-filters\",\"sRGB\");let l=e.createElementNS(q,\"feGaussianBlur\");if(l.setAttribute(\"stdDeviation\",\"0 0\"),l.setAttribute(\"edgeMode\",\"duplicate\"),d.appendChild(l),s.appendChild(d),n.base.kind===\"color\")return{layer:c,layerCss:i,imgCss:\"\",smear:l,filterId:m};if(n.base.kind===\"scene\"){let y=b(e,\"iframe\",\"position:absolute;left:0;top:0;width:100%;height:100%;border:0;display:block;pointer-events:none;background:transparent;\",c);return y.setAttribute(\"sandbox\",\"allow-scripts allow-same-origin\"),y.setAttribute(\"scrolling\",\"no\"),y.setAttribute(\"tabindex\",\"-1\"),{layer:c,layerCss:i,imgCss:\"\",smear:l,filterId:m,scene:{frame:y,source:Ie(t,n,n.base.src),segment:n.index,animations:[],...n.base.slots?{slots:n.base.slots}:{}}}}let u=\"position:absolute;left:0;top:0;width:100%;height:100%;display:block;transform-origin:50% 50%;object-fit:\"+n.base.fit+\";\",h=b(e,\"img\",u,c);return h.alt=\"\",n.base.kind===\"image\"&&(h.src=n.base.src),{layer:c,layerCss:i,img:h,imgCss:u,smear:l,filterId:m}},tn={left:\"flex-start\",center:\"center\",right:\"flex-end\"},Ye=e=>U(e.span),nn=(e,t,n,o,s)=>t.flatMap(r=>{let a=r.span?.background;if(!o){let m=b(e,\"span\",Ye(r)+(a?I(a,n,!0,!0)+\"-webkit-box-decoration-break:clone;box-decoration-break:clone;\":\"\"),s);return m.textContent=r.text,[]}let i=b(e,\"span\",Ye(r),s),c=Array.from(r.text);return c.map((m,d)=>{let l=b(e,\"span\",a?I(a,n,d===0,d===c.length-1):\"\",i);return l.textContent=m,l})}),on=(e,t)=>\"width:100%;text-align:\"+e.align+\";font-family:\"+e.font+\";font-size:\"+f(t)+\";font-weight:\"+e.weight+\";font-style:\"+(e.italic?\"italic\":\"normal\")+\";color:\"+e.color+\";line-height:\"+R(e.lineHeight??A)+\";white-space:pre-wrap;overflow-wrap:break-word;\"+(e.letterSpacing?\"letter-spacing:\"+f(e.letterSpacing*t)+\";\":\"\")+(e.shadow?\"text-shadow:\"+Je(e.shadow,t)+\";\":\"\")+(e.opacity!==void 0&&e.opacity!==1?\"opacity:\"+R(e.opacity)+\";\":\"\"),sn=(e,t,n,o)=>{let s=n.style;if(!s||n.text===void 0)return{chars:[]};let r=s.size*t.canvas.height,a=b(e,\"div\",on(s,r),o),i=s.stroke?\"-webkit-text-stroke:\"+f(s.stroke.width*r)+\" \"+s.stroke.color+\";paint-order:stroke fill;\":\"\",c=s.background?I(s.background,r,!0,!0)+\"-webkit-box-decoration-break:clone;box-decoration-break:clone;\":\"\",m=b(e,\"span\",i+c,a);if(n.words){let l=ze(e,n,s,r,m);return{chars:l.chars,block:a,words:l}}let d=n.enter.preset===\"type\"||n.exit.preset===\"type\";return{chars:nn(e,He(n.text,s.spans),r,d,m),block:a}},rn=(e,t)=>{let[n,o,s,r]=t.box,a=e.canvas.width,i=e.canvas.height,c=t.border?\"border:\"+f(t.border.width*qe(e))+\" solid \"+t.border.color+\";\":\"\";return\"position:absolute;left:\"+f(n*a)+\";top:\"+f(o*i)+\";width:\"+f(s*a)+\";height:\"+f(r*i)+\";z-index:\"+t.z+\";transform-origin:50% 50%;\"+c},Xe=(e,t)=>{if(t.shape===\"ellipse\"||t.mask===\"ellipse\")return\"border-radius:50%;\";let n=(t.radius??0)*Math.min(t.box[2]*e.canvas.width,t.box[3]*e.canvas.height);return n>0?\"border-radius:\"+f(n)+\";\":\"\"},an=(e,t,n,o)=>{let s=rn(t,n),r=n.shadow?\"drop-shadow(\"+Je(n.shadow,qe(t))+\")\":\"\";if(n.type===\"text\"){let c=s+\"align-items:center;justify-content:\"+tn[n.style?.align??\"center\"]+\";\",m=b(e,\"div\",c+\"display:none;\",o);return m.dataset.item=n.id,{el:m,css:c,display:\"flex\",shadow:r,...sn(e,t,n,m)}}if(n.type===\"image\"||n.type===\"video\"){let c=Xe(t,n),m=s+(c||n.type===\"video\"?\"overflow:hidden;\"+c:\"\"),d=b(e,\"div\",m+\"display:none;\",o);d.dataset.item=n.id;let l=b(e,\"img\",\"width:100%;height:100%;display:block;object-fit:\"+(n.fit??\"contain\")+\";\",d);return l.alt=\"\",n.type===\"image\"&&(l.src=n.src??\"\"),{el:d,css:m,display:\"block\",shadow:r,chars:[],img:l}}let a=s+\"background:\"+(n.gradient?ce(n.gradient):n.color??\"#ffffff\")+\";\"+Xe(t,n),i=b(e,\"div\",a+\"display:none;\",o);return i.dataset.item=n.id,{el:i,css:a,display:\"block\",shadow:r,chars:[]}},cn=e=>(e.fonts??[]).map(t=>\"@font-face{font-family:\"+Ue(t.family)+\";src:url(\"+Ue(t.src)+\");font-weight:1 1000;font-display:block}\").join(`\n`),$e=(e,t,n,o)=>{let s=n.canvas.width,r=n.canvas.height;if((n.fonts??[]).length>0){let x=e.createElement(\"style\");x.textContent=cn(n),e.head.appendChild(x)}let a=b(e,\"div\",\"position:relative;overflow:hidden;width:\"+f(Math.round(s*o))+\";height:\"+f(Math.round(r*o))+\";\",t),i=b(e,\"div\",\"position:relative;overflow:hidden;background:#000;width:\"+f(s)+\";height:\"+f(r)+\";transform-origin:0 0;\"+(o===1?\"\":\"transform:scale(\"+R(o)+\");\"),a),c=e.createElementNS(q,\"svg\");c.setAttribute(\"width\",\"0\"),c.setAttribute(\"height\",\"0\"),c.setAttribute(\"style\",\"position:absolute;width:0;height:0;\");let m=e.createElementNS(q,\"defs\");c.appendChild(m),i.appendChild(c);let d=b(e,\"div\",X(n)+\"z-index:0;isolation:isolate;\",i),l=n.segments.map(x=>en(e,n,x,d,m)),u=X(n)+\"z-index:1;\",h=b(e,\"div\",u+\"display:none;\",i),y=b(e,\"div\",X(n)+\"z-index:2;isolation:isolate;\",i),H=n.items.map(x=>an(e,n,x,y)),N=[...l.filter((x,P)=>n.segments[P]?.base.kind===\"image\"),...H.filter((x,P)=>n.items[P]?.type===\"image\")].flatMap(x=>x.img?[x.img]:[]);return{stage:i,segments:l,overlay:h,overlayCss:u,items:H,images:N,live:!1,shown:[]}};var ln=.3333333333333333,dn=80,mn=new Set([\"SCRIPT\",\"STYLE\",\"NOSCRIPT\",\"TEMPLATE\",\"TITLE\"]),un=e=>Array.from(e.childNodes).some(t=>t.nodeType===3&&(t.textContent??\"\").trim()!==\"\"),Ze=(e,t)=>e.right>t.left&&e.left<t.right&&e.bottom>t.top&&e.top<t.bottom,pn=(e,t)=>{let n=e,o=n.offsetWidth??0,s=n.offsetHeight??0;return o>0&&s>0?Math.min(t.width/o,t.height/s):1},fn=(e,t,n)=>{if(e.getClientRects().length===0||t.getComputedStyle(e).visibility!==\"visible\")return!1;let o=e.getBoundingClientRect();if(!(o.width>0&&o.height>0)||!Ze(o,n)||pn(e,o)<ln)return!1;let s=e.ownerDocument.documentElement,r=e.ownerDocument.body,a=1;for(let i=e;i;i=i.parentElement){let c=t.getComputedStyle(i);if(a*=Number(c.opacity),i!==e&&i!==s&&i!==r&&c.display!==\"inline\"&&(c.overflowX!==\"visible\"||c.overflowY!==\"visible\")&&!Ze(o,i.getBoundingClientRect()))return!1}return a>=.5},Qe=e=>{let t=e.defaultView;if(!t||!e.body)return[];let n={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight},o=[];return Array.from(e.body.querySelectorAll(\"*\")).forEach((s,r)=>{if(mn.has(s.tagName.toUpperCase())||!un(s))return;let a=(s.textContent??\"\").replace(/\\s+/g,\" \").trim().slice(0,dn);o.push({index:r,text:a,visible:fn(s,t,n)})}),o};var hn=1,bn=(e,t)=>e?{left:Math.min(e.left,t.left),top:Math.min(e.top,t.top),right:Math.max(e.right,t.right),bottom:Math.max(e.bottom,t.bottom)}:t,gn=(e,t,n)=>{if(!e)return{top:0,bottom:0,box:0};e.font=t.fontStyle+\" \"+t.fontWeight+\" \"+t.fontSize+\" \"+t.fontFamily;let o=e.measureText(n.replace(/\\s+/g,\"\"));return{top:Math.max(0,o.fontBoundingBoxAscent-o.actualBoundingBoxAscent),bottom:Math.max(0,o.fontBoundingBoxDescent-o.actualBoundingBoxDescent),box:o.fontBoundingBoxAscent+o.fontBoundingBoxDescent}},yn=e=>{let t=e.ownerDocument,n=t.defaultView,o=t.createElement(\"canvas\").getContext(\"2d\"),s=t.createRange(),r=t.createTreeWalker(e,NodeFilter.SHOW_TEXT),a;for(let i=r.nextNode();i;i=r.nextNode()){let c=i.textContent??\"\",m=i.parentElement;if(!c.trim()||!m||!n)continue;let d=gn(o,n.getComputedStyle(m),c);for(let l=0;l<c.length;l++){if(/\\s/.test(c.charAt(l)))continue;let u=(c.codePointAt(l)??0)>65535?2:1;s.setStart(i,l),s.setEnd(i,l+u),l+=u-1;let h=s.getBoundingClientRect();if(h.width<=0||h.height<=0)continue;let y=d.box>0?h.height/d.box:1;a=bn(a,{left:h.left,right:h.right,top:h.top+d.top*y,bottom:h.bottom-d.bottom*y})}}return a},et=e=>{let t=e.getBoundingClientRect(),n=e.offsetWidth>0?t.width/e.offsetWidth:1,o=e.offsetHeight>0?t.height/e.offsetHeight:1,s=t.left+e.clientLeft*n,r=t.top+e.clientTop*o;return{left:s,top:r,right:s+e.clientWidth*n,bottom:r+e.clientHeight*o}},tt=(e,t,n,o)=>{let r=[...n?[[\"left\",t.left-e.left],[\"right\",e.right-t.right]]:[],...o?[[\"top\",t.top-e.top],[\"bottom\",e.bottom-t.bottom]]:[]].reduce((a,i)=>!a||i[1]>a[1]?i:a,void 0);return r&&r[1]>hn?{side:r[0],px:Math.round(r[1])}:void 0},xn=e=>{let t=e.tagName.toLowerCase();if(e.id)return t+\"#\"+e.id;let n=Array.from(e.classList);return n.length?t+\".\"+n.join(\".\"):t},vn=(e,t)=>{let n=e.ownerDocument.defaultView,o=e.ownerDocument.body;for(let s=e.parentElement;s&&n&&s!==o&&s!==e.ownerDocument.documentElement;s=s.parentElement){let r=n.getComputedStyle(s),a=r.overflowX!==\"visible\",i=r.overflowY!==\"visible\";if(r.display===\"inline\"||!a&&!i)continue;let c=tt(t,et(s),a,i);if(c)return{ancestor:xn(s),...c}}},Sn=e=>{let t=[],n=[];for(let o of Array.from(e.querySelectorAll(\"[data-slot]\"))){if(!(o instanceof(e.defaultView??globalThis).HTMLElement)||o.tagName===\"IMG\")continue;let s=yn(o);if(!s)continue;let r={slot:o.getAttribute(\"data-slot\")??\"\",text:(o.textContent??\"\").trim().slice(0,40)},a=o.clientWidth>0&&o.clientHeight>0?tt(s,et(o),!0,!0):void 0,i=a?void 0:vn(o,s);a?t.push({...r,...a}):i&&n.push({...r,...i})}return{overflowing:t,clipped:n}},wn=e=>{let t=e;if(!t||typeof t.at!=\"number\"||!Number.isFinite(t.at)||t.at<0||typeof t.cue!=\"string\"||!t.cue)return[];let n=typeof t.gain==\"number\"&&Number.isFinite(t.gain)?Math.min(1,Math.max(0,t.gain)):.7;return[{at:Math.round(t.at*1e3)/1e3,cue:t.cue,gain:Math.round(n*1e3)/1e3,...typeof t.effect==\"string\"?{effect:t.effect}:{}}]},Tn=e=>{let t=e.defaultView?.__popostScene?.cues,n=[];try{n=JSON.parse(e.getElementById(\"popost-cues\")?.textContent??\"[]\")}catch{n=[]}return[...Array.isArray(t)?t:[],...Array.isArray(n)?n:[]].flatMap(wn).sort((o,s)=>o.at-s.at)},nt=(e,t)=>e.segments.flatMap(n=>{let o=n.scene?.frame.contentDocument;if(!n.scene||!o||t!==void 0&&n.scene.segment!==t)return[];let s=o.documentElement;return[{segment:n.scene.segment,src:K(n.scene.frame.getAttribute(\"src\")??\"\"),width:Math.max(s.scrollWidth,o.body?.scrollWidth??0),height:Math.max(s.scrollHeight,o.body?.scrollHeight??0),...Sn(o),elements:o.body?o.body.querySelectorAll(\"*\").length:0,texts:Qe(o),cues:Tn(o)}]});var ot=.5,En=e=>{let t=[],n=document.createRange(),o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let s=o.nextNode();s;s=o.nextNode()){if(s.parentElement?.closest(\"[data-glyphs]\"))continue;let r=s.textContent??\"\";for(let a=0;a<r.length;a++){if(/\\s/.test(r.charAt(a)))continue;let i=r.codePointAt(a)!==void 0&&(r.codePointAt(a)??0)>65535?2:1;n.setStart(s,a),n.setEnd(s,a+i);let c=n.getBoundingClientRect();c.width>0&&c.height>0&&t.push({left:c.left,top:c.top,right:c.right,bottom:c.bottom}),a+=i-1}}return t},Mn=(e,t)=>{let n=e.map(o=>(o.top+o.bottom)/2).sort((o,s)=>o-s);return n.reduce((o,s,r)=>r===0||s-(n[r-1]??s)>t/2?o+1:o,0)},kn=(e,t)=>{let n=e.style,o=document.createElement(\"canvas\").getContext(\"2d\");if(!n||!o)return[0,0];o.font=(n.italic?\"italic \":\"\")+n.weight+\" \"+t+\"px \"+n.font;let s=o.measureText((e.text??\"\").replace(/\\s+/g,\"\"));return[Math.max(0,s.fontBoundingBoxAscent-s.actualBoundingBoxAscent),Math.max(0,s.fontBoundingBoxDescent-s.actualBoundingBoxDescent)]},Rn=(e,t,n,o,s,r)=>{let a=o.canvas.width*r,i=o.canvas.height*r,c=(n.style?.size??0)*o.canvas.height,m=e.el.getBoundingClientRect(),d=t.getBoundingClientRect(),l=En(t),u=Math.min(...l.map(w=>w.left)),h=Math.max(...l.map(w=>w.right)),[y,H]=kn(n,c),N=(n.style?.stroke?.width??0)*c*r/2,x=Math.min(...l.map(w=>w.top))+y*r-N,P=Math.max(...l.map(w=>w.bottom))-H*r+N,J=(w,le,it,ct)=>[(w-s.left)/a,(le-s.top)/i,(it-w)/a,(ct-le)/i],at=l.length>0?h-u:0;return{id:n.id,fits:d.height<=m.height+ot*r&&at<=m.width+ot*r,lines:Mn(l,(n.style?.lineHeight??A)*c*r),ink:l.length>0?J(u-N,x,h+N,P):[0,0,0,0],block:l.length>0?J(u,d.top,h,d.bottom):J(d.left,d.top,d.left,d.bottom)}},st=(e,t,n)=>{let o=e.stage.getBoundingClientRect();return t.items.flatMap((s,r)=>{let a=e.items[r];if(s.type!==\"text\"||!a?.block)return[];let i=a.el.style.cssText;a.el.style.cssText=a.css+\"display:\"+a.display+\";\";try{return[Rn(a,a.block,s,t,o,n)]}finally{a.el.style.cssText=i}})};var Cn=()=>{let e=document.getElementById(\"popost-data\");if(!e?.textContent)throw new Error('popost video page: the <script id=\"popost-data\"> element with the timeline is missing. Build the page with compilePage.');return JSON.parse(e.textContent)},Ln=e=>[...new Set(e.resolved.items.flatMap(t=>{let n=t.style;return t.type!==\"text\"||!n?[]:[n.weight,...t.words&&n.spoken?.weight?[n.spoken.weight]:[]].map(s=>(n.italic?\"italic \":\"\")+s+\" \"+Math.round(n.size*e.resolved.canvas.height)+\"px \"+n.font)}))],Nn=e=>e.replace(/^[\"']|[\"']$/g,\"\"),An=async e=>{let t=e.resolved.fonts??[];if(t.length===0)return;let n=[];document.fonts.forEach(o=>{n.push(o)}),await Promise.all(t.map(async o=>{let s=n.filter(a=>Nn(a.family)===o.family),r=()=>new Error('Font \"'+o.family+'\" ('+o.src+\") could not be loaded. Check that the file exists in the project directory and is a WOFF2, WOFF, TTF or OTF font.\");if(s.length===0)throw r();await Promise.all(s.map(a=>a.load())).catch(()=>{throw r()})}))},In=async(e,t)=>{let n=Object.entries(t.resolved.footage??{}).filter(([,s])=>s.dir===void 0).map(([s])=>'\"'+s+'\"');if(n.length>0)throw new Error(\"Video material \"+n.join(\", \")+\" has no extracted frames: the page was compiled from resolve() alone. Build it with buildPage, which extracts them into the project's .cache directory.\");await Promise.all(e.images.map(s=>s.decode().catch(()=>{throw new Error('Image \"'+(s.getAttribute(\"src\")??\"\")+'\" could not be loaded. Check that the file exists in the project directory and is a PNG, JPEG or WebP picture.')}))),await An(t);let o=t.resolved.items.map(s=>s.text??\"\").join(\"\");await Promise.all(Ln(t).map(s=>document.fonts.load(s,o).catch(()=>[]))),await document.fonts.ready},rt=async e=>{let t=await Promise.allSettled(e.map(_e)),n=t.flatMap(s=>s.status===\"rejected\"&&s.reason instanceof L?s.reason.failures:[]);if(n.length>0)throw new L(n);let o=t.find(s=>s.status===\"rejected\");if(o)throw o.reason},Pn=()=>{let e=[],t=async()=>{let n=e,o=await Promise.allSettled(n.map(r=>r.decode()));if(n!==e)return t();let s=o.findIndex(r=>r.status===\"rejected\");if(s>=0)throw new Error('The video frame picture \"'+(n[s]?.getAttribute(\"src\")??\"\")+`\" could not be loaded. Build the page again: buildPage extracts the frames into the project's .cache directory.`)};return{settle:t,set:n=>{e=n}}},Dn=(e,t)=>{let n,o=()=>n??=In(e,t),s=e.segments.flatMap(r=>r.scene?[r.scene]:[]);return{all:async()=>{await o(),await rt(s)},frame:async r=>{await o();let a=j(t.resolved,_(t.resolved,r)).layers.map(i=>i.index);await rt(s.filter(i=>a.includes(i.segment)))}}},_n=e=>{let t=e.cloneNode(!0);return t.querySelectorAll(\"*\").forEach(n=>{n instanceof HTMLElement&&n.style.display===\"none\"&&n.remove()}),t.innerHTML},Fn=()=>{let e=Cn(),t=e.resolved,n=$e(document,document.body,t,e.scale),o=Pn(),s=Dn(n,e),r,a={frames:t.frames,fps:t.canvas.fps,width:t.canvas.width,height:t.canvas.height,scale:e.scale,prepare:async()=>{await s.all(),await o.settle()},preparePreview:s.frame,applyFrame:i=>o.set(Y(n,t,i)),previewFrame:i=>o.set(Y(n,t,i,!1)),settle:()=>o.settle(),layout:()=>st(n,t,e.scale),scenes:i=>nt(n,i),state:i=>(i!==void 0&&o.set(Y(n,t,i,!0,!1)),{markup:_n(n.stage),scenes:n.shown.map(c=>({...c}))}),changed:()=>{let i=n.stage.innerHTML,c=i===r;return r=i,!c||n.live}};a.applyFrame(0),window.__popostVideo=a};Fn();})();\n";
1
+ export declare const PAGE_BUNDLE = "\"use strict\";(()=>{var de=(e,t)=>t<e.start?\"before\":t<e.end?\"spoken\":\"past\",$={padding:.1,radius:.2},D={scale:1,background:!1},me=(e,t)=>!e||t===\"before\"?D:t===\"past\"?e.past?{...D,...e.past.color?{color:e.past.color}:{},...e.past.opacity!==void 0?{opacity:e.past.opacity}:{}}:D:{scale:e.scale??1,background:e.background!==void 0,...e.color?{color:e.color}:{},...e.weight?{weight:e.weight}:{}},lt=(e,t,n)=>{let o=0;for(;o<e.length&&(e[o]?.start??1/0)<=n;)o++;return o===0?0:e[o]?.from??t},ue=(e,t,n,o)=>{let s=Math.round(t.chars*n);return e.reveal===\"words\"&&e.words?Math.min(s,lt(e.words,n,o)):s};var g=e=>e>0?e<1?e:1:0,C=(e,t,n)=>e+(t-e)*n,v=(e,t)=>{let n=g(t);switch(e){case\"linear\":return n;case\"in\":return n*n*n;case\"out\":return 1-(1-n)**3;case\"in-out\":return n<.5?4*n*n*n:1-(-2*n+2)**3/2}},M=e=>{let t=(Math.imul(e|0,2654435761)^1540483477)>>>0;return t=Math.imul(t^t>>>15,2246822507)>>>0,t=Math.imul(t^t>>>13,3266489909)>>>0,((t^t>>>16)>>>0)/4294967296};var Z={opacity:1,translate:[0,0],scale:1,rotate:0,blur:0,clip:[0,0,0,0],chars:1};var B={left:[-1,0],right:[1,0],up:[0,-1],down:[0,1]},Q={up:0,right:1,down:2,left:3},dt={left:\"right\",right:\"left\",up:\"down\",down:\"up\"},mt=.6,O=.6,ut=.25,pt=.04,ft=(e,t)=>e<O?C(mt,1+t,v(\"out\",e/O)):C(1+t,1,v(\"in-out\",(e-O)/(1-O))),pe=(e,t,n)=>{switch(e.preset){case\"none\":return{};case\"fade\":return{opacity:n};case\"pop\":return{scale:ft(n,e.overshoot),opacity:g(n/ut)};case\"scale-in\":return{scale:n};case\"slide\":{let[o,s]=B[t];return{translate:[-o*e.distance*(1-n),-s*e.distance*(1-n)],opacity:g(n*2)}}case\"wipe\":{let o=[0,0,0,0];return o[Q[t]]=1-n,{clip:o}}case\"type\":return{chars:n};case\"blur\":return{blur:pt*(1-n),opacity:n}}},ee=(e,t,n)=>{let o=e.preset===\"type\"?g(n):v(e.ease,n),s=t===\"enter\"?pe(e,e.direction,o):pe(e,dt[e.direction],1-o);return{...Z,...s}};var oe={opacity:1,translate:[0,0],scale:1,rotate:0,blur:0,smear:[0,0],clip:[0,0,0,0],z:0},p=(e={})=>({...oe,...e}),S=()=>p({opacity:0}),W={black:\"#000000\",white:\"#ffffff\"},he=1.5,be=.06,ge=.5,ye=.25,xe=.08,ve=.05,te=.08,ht=.15,Se=90,T=e=>e.strength??1,z=e=>1-Math.abs(2*e-1),ne=e=>e<.5?e/.5:(e-.5)/.5,se=e=>B[e in B?e:\"left\"],we=(e,t)=>{let n=e*Math.PI/180,o=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n));return Math.max((t.width*o+t.height*s)/t.width,(t.width*s+t.height*o)/t.height)},Te=(e,t)=>Math.min(t-1,Math.max(0,Math.round(e*(t+1))-1)),fe=(e,t,n)=>({old:n<.5?p():S(),next:p({opacity:n<.5?0:1,z:1}),overlay:{color:e,opacity:t}}),bt=(e,t)=>{if(e.direction===\"center-out\")return{old:p(),next:p({clip:{radius:t},z:1})};if(e.direction===\"edges-in\")return{old:p({clip:{radius:1-t},z:1}),next:p()};let n=[0,0,0,0];return n[Q[e.direction]]=1-t,{old:p(),next:p({clip:n,z:1})}},gt=(e,t)=>{let[n,o]=se(e.direction),s=[n*t,o*t],r=[n*(t-1),o*(t-1)];return e.mode===\"cover\"?{old:p(),next:p({translate:r,z:1})}:e.mode===\"reveal\"?{old:p({translate:s,z:1}),next:p()}:{old:p({translate:s}),next:p({translate:r,z:1})}},yt=(e,t,n,o)=>{let s=v(\"in-out\",ne(t)),r=Se*T(e),a=t<.5?r*s:-r*(1-s),i=p({rotate:a,scale:we(a,o),z:1});return t<.5?{old:i,next:S()}:{old:S(),next:i}},xt=(e,t,n)=>{let o=Te(n,e.frames),s=(o+.5)/e.frames>.3+.4*M(o),r=(M(o+101)-.5)*2*xe*T(e)*z(g(n)),a=p({translate:[r,0],scale:1+2*Math.abs(r),z:1});return s?{old:S(),next:a}:{old:a,next:S()}},vt=(e,t,n)=>{let o=Te(n,e.frames),s=ve*T(e)*(t<.5?t/.5:((1-t)/.5)**2),r=o%2===0?1:-1,a=s*r*(.6+.4*M(o)),i=s*(M(o+7)-.5),c=p({translate:[a,i],scale:1+2*s,z:1});return t<.5?{old:c,next:S()}:{old:S(),next:c}},St=(e,t)=>{let[n,o]=se(e.direction),s=te*T(e)*z(t),r=[Math.abs(n)*s,Math.abs(o)*s];return{old:p({translate:[n*t,o*t],smear:r}),next:p({translate:[n*(t-1),o*(t-1)],smear:r,z:1})}},wt={fade:(e,t)=>fe(W[e.via],g(T(e)*z(t)),t),flash:(e,t)=>fe(W.white,g(he*T(e)*z(t)),t),dissolve:(e,t)=>({old:p(),next:p({opacity:t,z:1})}),wipe:bt,slide:gt,zoom:(e,t)=>({old:p({scale:1+ge*T(e)*t,opacity:1-t,z:1}),next:p({scale:1+ye*T(e)*(1-t)})}),spin:yt,blur:(e,t)=>{let n=be*T(e)*(t<.5?ne(t):1-ne(t));return t<.5?{old:p({blur:n,z:1}),next:S()}:{old:S(),next:p({blur:n,z:1})}},glitch:xt,shake:vt,whip:St},Tt=(e,t)=>{let n=t%2===0?1:-1;return{translate:[e*n*(.6+.4*M(t)),e*(M(t+7)-.5)],scale:1+2*e}},Et={blur:(e,t)=>({layer:{blur:be*t}}),zoom:(e,t,n,o)=>({layer:{scale:1+(o===\"before\"?ge:ye)*t}}),shake:(e,t,n)=>({layer:Tt(ve*t,n)}),glitch:(e,t,n)=>{let o=(M(n+101)-.5)*2*xe*t;return{layer:{translate:[o,0],scale:1+2*Math.abs(o)}}},whip:(e,t,n,o)=>{let[s,r]=se(e.direction),a=ht*t*(o===\"after\"?-1:1);return{layer:{translate:[s*a,r*a],scale:1+2*Math.abs(a),smear:[Math.abs(s)*te*t,Math.abs(r)*te*t]}}},spin:(e,t,n,o,s)=>{let r=Se*t*(o===\"after\"?-1:1);return{layer:{rotate:r,scale:we(r,s)}}},flash:(e,t)=>({layer:{},overlay:{color:W.white,opacity:g(he*t)}}),fade:(e,t)=>({layer:{},overlay:{color:W[e.via],opacity:g(t)}}),dissolve:()=>({layer:{}}),wipe:()=>({layer:{}}),slide:()=>({layer:{}})},Mt=(e,t,n,o)=>{let s=t===\"after\"?1-v(e.ease,n):v(e.ease,n),r=Math.min(e.frames-1,Math.max(0,Math.round(n*e.frames)-(t===\"before\"?1:0))),a=Et[e.kind](e,s*T(e),r,t,o),i=p({...a.layer,z:1}),c=t===\"after\"?{old:S(),next:i}:{old:i,next:S()};return a.overlay&&a.overlay.opacity>0?{...c,overlay:a.overlay}:c},Ee=(e,t,n)=>{let o=e.side??\"both\";return o===\"both\"?wt[e.kind](e,v(e.ease,t),g(t),n):Mt(e,o,t,n)};var G={scale:1,translate:[0,0]};var kt=(e,t)=>{let n=C(e.scale[0],e.scale[1],t),o=[C(e.shift[0][0],e.shift[1][0],t),C(e.shift[0][1],e.shift[1][1],t)];return{scale:n,translate:[(1-n)*(e.focus[0]-.5)+(o[0]??0),(1-n)*(e.focus[1]-.5)+(o[1]??0)]}},Me=(e,t)=>{let n=e[0];if(!n)return G;let o=[...e].reverse().find(r=>t>=r.from)??n,s=t<o.from?0:g((t-o.from)/Math.max(1,o.to-o.from));return kt(o,v(o.ease,s))};var k={opacity:1,scale:1,translate:[0,0],rotate:0};var ke=(e,t)=>{let n=2*Math.PI*t/e.period,o=e.amount;switch(e.preset){case\"pulse\":return{...k,scale:1+o*(1-Math.cos(n))/2};case\"float\":{let s=o*Math.sin(n);return{...k,translate:[0,s===0?0:-s]}}case\"sway\":return{...k,rotate:o*Math.sin(n)};case\"blink\":return{...k,opacity:t%e.period<e.period/2?1:1-o};case\"spin\":return{...k,rotate:360*o*t/e.period}}};var _=(e,t)=>Math.min(Math.max(0,e.frames-1),Math.max(0,Math.floor(t))),Re=(e,t)=>t>=e.a&&t<e.a+e.frames,Rt=(e,t)=>{let n=e.side??\"both\";return n===\"after\"?(t-e.a)/e.frames:n===\"before\"?(t-e.a+1)/e.frames:(t-e.a+1)/(e.frames+1)},Le=(e,t)=>{let n=e.segments[t],o=n?.transition,s=e.segments[t+1]?.transition;if(!n)return[0,0];let r=o&&(o.side??\"both\")===\"both\"?o.a:n.start,a=s&&(s.side??\"both\")===\"both\"?s.a+s.frames-1:n.end-1;return[r,a]},re=(e,t,n)=>{let o=e.segments[t]?.base;if(!o||o.kind===\"color\"||o.kind===\"scene\")return G;if(o.moves)return Me(o.moves,n);if(o.zoom===0&&o.pan[0]===0&&o.pan[1]===0)return G;let[s,r]=Le(e,t),a=(n-s)/e.canvas.fps,i=(r-s)/e.canvas.fps,c=o.zoom>=0?o.zoom*a:-o.zoom*(i-a),m=Math.max(Math.abs(o.pan[0]),Math.abs(o.pan[1]))*i;return{scale:1+c+m,translate:[o.pan[0]*(a-i/2),o.pan[1]*(a-i/2)]}};var Ce=(e,t,n,o)=>{let s=Ee(n,Rt(n,o),e.canvas),r=n.side??\"both\",a={index:t,state:s.old,camera:re(e,t,o)},i={index:t+1,state:s.next,camera:re(e,t+1,o)};return{layers:r===\"both\"?[a,i]:r===\"after\"?[i]:[a],...s.overlay?{overlay:s.overlay}:{}}},j=(e,t)=>{let n=_(e,t),o=Math.max(0,e.segments.findIndex(a=>n>=a.start&&n<a.end)),s=e.segments[o]?.transition;if(s&&Re(s,n))return Ce(e,o-1,s,n);let r=e.segments[o+1]?.transition;return r&&Re(r,n)?Ce(e,o,r,n):{layers:[{index:o,state:oe,camera:re(e,o,n)}]}},Ct=(e,t)=>{let n=t-e.start,o=e.end-e.start;return e.enter.frames>0&&n<e.enter.frames?ee(e.enter,\"enter\",(n+1)/e.enter.frames):e.exit.frames>0&&n>=o-e.exit.frames?ee(e.exit,\"exit\",(n-(o-e.exit.frames))/e.exit.frames):Z},Lt=(e,t)=>{let n=e.start+e.enter.frames,o=Math.max(n,e.end-e.exit.frames);return Math.min(Math.max(0,t-n),o-n)},Ne=(e,t)=>{if(t<e.start||t>=e.end)return;let n=Ct(e,t),o=e.loop?ke(e.loop,Lt(e,t)):k;return o===k&&e.opacity===void 0&&e.rotate===void 0?n:{...n,opacity:n.opacity*o.opacity*(e.opacity??1),scale:n.scale*o.scale,translate:[n.translate[0]+o.translate[0],n.translate[1]+o.translate[1]],rotate:n.rotate+o.rotate+(e.rotate??0)}};var Nt=6,At=(e,t,n,o)=>{let s=Math.max(0,t.frames-1),r=o-e.start;return r<=0?Math.min(e.in,s):Math.min(s,e.in+Math.round(r*t.fps*e.speed/n))},It=(e,t)=>e+\"/\"+String(t).padStart(Nt,\"0\")+\".png\",ae=(e,t,n)=>{let o=e.footage?.[t.material];return o?.dir===void 0?void 0:It(o.dir,At(t,o,e.canvas.fps,n))};var Ae=\"popost-times=\";var Pt=e=>{let t=new Map;for(let n of e.items){if(!n.cue)continue;let o=n.cue.track+\"#\"+n.cue.index,s=t.get(o);t.set(o,s?[Math.min(s[0],n.start),Math.max(s[1],n.end)]:[n.start,n.end])}return[...t.values()]},Dt=(e,t)=>{let n=e.canvas.fps,o=t.base.kind===\"scene\"?t.base.offset??0:0,s=d=>Math.round(Math.max(o,(d-t.start)/n+o)*1e3)/1e3,r=Math.round(.2*n),a=d=>d>=t.start-r&&d<t.end,i=e.speech?.voice??[],c=(i.length?i:Pt(e)).filter(([d])=>a(d)).sort((d,l)=>d[0]-l[0]),m=(e.words??[]).flatMap(d=>d.tokens).filter(d=>a(d.start)).sort((d,l)=>d.start-l.start);if(!(!c.length&&!m.length))return{seconds:s(t.end),lines:c.map(([d,l])=>({at:s(d),end:s(l)})),words:m.map(d=>({text:d.text,at:s(d.start),end:s(d.end)}))}},Ie=(e,t,n)=>{let o=Dt(e,t);return o?n+\"#\"+Ae+encodeURIComponent(JSON.stringify(o)):n},K=e=>e.split(\"#\"+Ae)[0]??e;var _t=(e,t)=>{e.querySelectorAll(\"[data-slot]\").forEach(n=>{let o=t[n.getAttribute(\"data-slot\")??\"\"];o!==void 0&&(n instanceof(e.defaultView??globalThis).HTMLImageElement?n.setAttribute(\"src\",o):n.textContent=o)})},Pe=e=>[e?.__popostScene?.timeline,...Object.values(e?.__timelines??{})].filter(t=>typeof t==\"object\"&&t!==null&&(typeof t.seek==\"function\"||typeof t.time==\"function\")),De=e=>{let t=e.frame.contentDocument;if(t)for(let n of t.getAnimations())e.animations.includes(n)||e.animations.push(n)},Ft=e=>e?.picture?'The picture \"'+e.picture.src+'\" of the scene \"'+e.scene+'\" could not be loaded. Check its path: it is relative to the scene file.':'The scene \"'+(e?.scene??\"\")+'\" could not be loaded. Check that the file exists in the project directory and is an HTML page.',L=class extends Error{name=\"SceneLoadError\";failures;constructor(t){super(Ft(t[0])),this.failures=t}},Ht=async(e,t,n)=>{let o=Array.from(t.images),s=await Promise.allSettled(o.map(r=>r.decode()));return o.flatMap((r,a)=>{if(s[a]?.status!==\"rejected\")return[];let i=r.getAttribute(\"data-slot\"),c=i!==null&&e.slots?.[i]!==void 0;return[{segment:e.segment,scene:n,picture:{src:r.getAttribute(\"src\")??\"\",url:r.currentSrc||r.src,...c?{slot:i}:{}}}]})},Ot=async e=>{let{frame:t}=e,n=K(e.source??t.getAttribute(\"src\")??\"\"),o=Bt(t);try{await Wt(e,n)}finally{o()}},Bt=e=>{let t=e.parentElement;return!t||t.style.display!==\"none\"?()=>{}:(t.style.display=\"block\",t.style.visibility=\"hidden\",()=>{t.style.visibility===\"hidden\"&&(t.style.removeProperty(\"visibility\"),t.style.display=\"none\")})},Wt=async(e,t)=>{let{frame:n}=e;await new Promise(r=>{let a=()=>{n.contentDocument?.readyState!==\"complete\"||n.contentDocument.URL===\"about:blank\"||(n.removeEventListener(\"load\",a),r())};n.addEventListener(\"load\",a),e.source&&(n.src=e.source),a()});let o=n.contentDocument;if(!o?.body)throw new L([{segment:e.segment,scene:t}]);e.slots&&_t(o,e.slots),await o.fonts.ready;let s=await Ht(e,o,t);if(s.length)throw new L(s);De(e),zt(e)},_e=e=>e.ready??=Ot(e),zt=e=>{for(let t of e.animations)t.playState!==\"paused\"&&t.pause(),t.currentTime=0;for(let t of Pe(e.frame.contentWindow))t.pause?.()},Fe=(e,t,n)=>{De(e);let o=Math.max(0,t)*1e3,s=!1,r=[];for(let l of e.animations){l.playState!==\"paused\"&&l.pause(),l.currentTime=o;let u=Number(l.effect?.getComputedTiming().endTime??0);r.push(Math.min(o,u)),o>=u||(s=!0)}let a=e.frame.contentWindow,i=Math.max(0,t);for(let l of Pe(a)){l.pause?.(),typeof l.seek==\"function\"?l.seek(i,!1):l.time?.(i);let u=typeof l.totalDuration==\"function\"?l.totalDuration():typeof l.duration==\"function\"?l.duration():1/0;r.push(Math.min(i,u)),i>=u||(s=!0)}let c=a?.__popostScene?.render;typeof c==\"function\"&&(c(Math.max(0,t),n),s=!0);let m=r.join(\"|\"),d=e.clock!==m;return e.clock=m,s||d};var Gt='\"Noto Sans CJK SC\", \"Noto Sans SC\", \"PingFang SC\", \"Microsoft YaHei\", sans-serif',V={font:Gt,size:.045,weight:700,color:\"#ffffff\",align:\"center\",italic:!1},A=1.25;var so={headline:{...V,size:.065,weight:800,stroke:{color:\"#000000\",width:.12}},subtitle:{...V,size:.04,weight:700,stroke:{color:\"#000000\",width:.1}},label:{...V,size:.032,weight:700,color:\"#111111\",background:{color:\"#ffffff\",padding:.35,radius:.3}},caption:{...V,size:.036,weight:600,background:{color:\"rgba(0, 0, 0, 0.6)\",padding:.3,radius:.2}}};var He=(e,t)=>{let n=Array.from(e),o=[...t??[]].sort((a,i)=>a.from-i.from),s=[],r=0;for(let a of o){let i=Math.min(n.length,Math.max(r,a.from)),c=Math.min(n.length,a.to);i>r&&s.push({text:n.slice(r,i).join(\"\")}),c>i?(s.push({text:n.slice(i,c).join(\"\"),span:a}),r=c):r=i}return r<n.length&&s.push({text:n.slice(r).join(\"\")}),s};var R=e=>String(Math.round(e*1e4)/1e4),f=e=>R(e)+\"px\",b=(e,t,n,o)=>{let s=e.createElement(t);return s.style.cssText=n,o.appendChild(s),s},I=(e,t,n,o)=>{let s=(e.padding??.3)*t,r=(e.radius??0)*t;return\"background:\"+e.color+\";padding:\"+[s,o?s:0,s,n?s:0].map(f).join(\" \")+\";border-radius:\"+[n?r:0,o?r:0,o?r:0,n?r:0].map(f).join(\" \")+\";\"},U=e=>e?(e.color?\"color:\"+e.color+\";\":\"\")+(e.weight?\"font-weight:\"+e.weight+\";\":\"\")+(e.italic!==void 0?\"font-style:\"+(e.italic?\"italic\":\"normal\")+\";\":\"\"):\"\";var jt=(e,t)=>{let n=new Array(t).fill(void 0);for(let o of e??[])for(let s=Math.max(0,o.from);s<Math.min(t,o.to);s++)n[s]=o;return n},Be=(e,t,n,o)=>U(e)+(e?.background?I(e.background,o,t===e.from,t===Math.min(e.to,n)-1):\"\"),We=(e,t,n,o)=>{let s=Be(e.spans[t],t,e.chars.length,e.size),r=b(e.doc,\"span\",s,n);r.textContent=e.chars[t]??\"\",e.out.chars.push(r),e.out.charCss.push(s),e.out.owner.push(o)},Kt=e=>{let t=e.s.spoken?.background;if(!t)return\"\";let n=(t.padding??$.padding)*e.size,o=((e.s.lineHeight??A)-1.1)/2*e.size-n;return\"position:absolute;left:\"+f(-n)+\";right:\"+f(-n)+\";top:\"+f(o)+\";bottom:\"+f(o)+\";z-index:0;transform-origin:50% 50%;background:\"+t.color+\";border-radius:\"+f((t.radius??$.radius)*e.size)+\";\"},Oe=\"position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;white-space:pre;transform-origin:50% 50%;\",Vt=(e,t,n,o,s)=>{let r=b(e.doc,\"span\",\"display:inline-block;position:relative;white-space:nowrap;\",s),a=b(e.doc,\"span\",\"visibility:hidden;\",r),i=e.s.spoken?.weight;for(let l=n;l<o;l++){let u=e.spans[l]?.weight??e.s.weight,h=b(e.doc,\"span\",Be(e.spans[l],l,e.chars.length,e.size)+(i&&i>u?\"font-weight:\"+i+\";\":\"\"),a);h.textContent=e.chars[l]??\"\"}let c=Kt(e),m=c?b(e.doc,\"span\",c+\"display:none;\",r):void 0,d=b(e.doc,\"span\",Oe+\"z-index:1;\",r);d.dataset.glyphs=\"1\";for(let l=n;l<o;l++)We(e,l,d,{token:t,gap:!1});e.out.tokens.push({layer:d,layerCss:Oe,...m?{box:m}:{},boxCss:c})},ze=(e,t,n,o,s)=>{let r=Array.from(t.text??\"\"),a=t.words??[],i={doc:e,chars:r,spans:jt(n.spans,r.length),s:n,size:o,out:{chars:[],charCss:[],owner:[],tokens:[]}},c=0,m=0;for(;c<r.length;){let d=a[m];if(d&&c>=d.from){Vt(i,m,d.from,Math.max(d.from,Math.min(d.to,r.length)),s),c=Math.max(c,d.to),m++;continue}let l=Math.min(r.length,d?d.from:r.length),u=b(e,\"span\",\"position:relative;z-index:1;\",s);for(let h=c;h<l;h++)We(i,h,u,{token:m-1,gap:!0});c=l}return i.out},Ut=e=>e?(e.color?\"color:\"+e.color+\";\":\"\")+(e.weight?\"font-weight:\"+e.weight+\";\":\"\")+(e.opacity!==void 0?\"opacity:\"+R(e.opacity)+\";\":\"\"):\"\",Ge=(e,t,n,o)=>{let r=(t.words??[]).map(i=>de(i,n)),a=r.map(i=>me(t.style?.spoken,i));e.tokens.forEach((i,c)=>{let m=a[c]??D,d=\"transform:\"+(m.scale!==1?\"scale(\"+R(m.scale)+\")\":\"none\")+\";\";i.layer.style.cssText=i.layerCss+\"z-index:\"+(r[c]===\"spoken\"?2:1)+\";\"+d,i.box&&(i.box.style.cssText=i.boxCss+\"display:\"+(m.background?\"block\":\"none\")+\";\"+d)}),e.chars.forEach((i,c)=>{let m=e.owner[c]??{token:-1,gap:!0},d=m.token<0?void 0:m.gap?r[m.token]===\"past\"?a[m.token]:void 0:a[m.token];i.style.cssText=(e.charCss[c]??\"\")+Ut(d)+\"visibility:\"+(c<o?\"visible\":\"hidden\")+\";\"})};var E=e=>String(Math.round(e*1e4)/1e4),F=e=>E(e)+\"px\",Yt=e=>E(e*100)+\"%\",Xt=e=>({W:e.canvas.width,H:e.canvas.height,min:Math.min(e.canvas.width,e.canvas.height),halfDiagonal:Math.hypot(e.canvas.width,e.canvas.height)/2}),Ke=e=>e.every(t=>t<=0)?\"none\":\"inset(\"+e.map(Yt).join(\" \")+\")\",qt=(e,t)=>Array.isArray(e)?Ke(e):\"circle(\"+F(Math.max(0,e.radius)*t.halfDiagonal)+\" at 50% 50%)\",ie=(e,t,n,o)=>e===0&&t===0&&n===0&&o===1?\"none\":\"translate(\"+F(e)+\",\"+F(t)+\") rotate(\"+E(n)+\"deg) scale(\"+E(o)+\")\",Jt=(e,t,n)=>{if(!t){e.layer.style.cssText=e.layerCss+\"display:none;\",e.smear.setAttribute(\"stdDeviation\",\"0 0\"),e.img&&(e.img.style.cssText=e.imgCss);return}let o=t.state,s=o.smear[0]>0||o.smear[1]>0,r=o.blur>0?\"blur(\"+F(o.blur*n.min)+\")\":s?\"url(#\"+e.filterId+\")\":\"none\";e.layer.style.cssText=e.layerCss+\"display:block;z-index:\"+(o.z+1)+\";opacity:\"+E(o.opacity)+\";transform:\"+ie(o.translate[0]*n.W,o.translate[1]*n.H,o.rotate,o.scale)+\";filter:\"+r+\";clip-path:\"+qt(o.clip,n)+\";\",e.smear.setAttribute(\"stdDeviation\",E(o.smear[0]*n.min)+\" \"+E(o.smear[1]*n.min));let a=t.camera;e.img&&(e.img.style.cssText=e.imgCss+\"transform:\"+ie(a.translate[0]*n.W,a.translate[1]*n.H,0,a.scale)+\";\")},$t=(e,t,n)=>{let o=[e.shadow,t>0?\"blur(\"+F(t*n.min)+\")\":\"\"].filter(s=>s!==\"\");return o.length>0?o.join(\" \"):\"none\"},Zt=(e,t,n)=>e.css+\"display:\"+e.display+\";opacity:\"+E(t.opacity)+\";transform:\"+ie(t.translate[0]*n.min,t.translate[1]*n.min,t.rotate,t.scale)+\";filter:\"+$t(e,t.blur,n)+\";clip-path:\"+Ke(t.clip)+\";\",Qt=(e,t,n,o,s)=>{e.el.style.cssText=n?Zt(e,n,o):e.css+\"display:none;\";let r=n?ue(t,n,e.chars.length,s):e.chars.length;e.words?Ge(e.words,t,s,r):e.chars.forEach((a,i)=>{a.style.visibility=i<r?\"visible\":\"hidden\"})},je=(e,t,n)=>{if(e){if(t===void 0){e.hasAttribute(\"src\")&&e.removeAttribute(\"src\");return}e.getAttribute(\"src\")!==t&&e.setAttribute(\"src\",t),n.push(e)}},Y=(e,t,n,o=!0,s=!0)=>{let r=Xt(t),a=_(t,n),i=j(t,a),c=[];return e.live=!1,e.shown=[],e.segments.forEach((m,d)=>{let l=i.layers.find(y=>y.index===d);Jt(m,l,r);let u=t.segments[d]?.base,h=(a-(t.segments[d]?.start??0))/t.canvas.fps+(u?.kind===\"scene\"?u.offset??0:0);m.scene&&l&&e.shown.push({segment:d,seconds:Math.max(0,h)}),s&&m.scene&&l&&Fe(m.scene,h,t.canvas.fps)&&(e.live=!0),o&&u?.kind===\"video\"&&je(m.img,l?ae(t,u.play,a):void 0,c)}),e.overlay.style.cssText=i.overlay?e.overlayCss+\"display:block;background:\"+i.overlay.color+\";opacity:\"+E(i.overlay.opacity)+\";\":e.overlayCss+\"display:none;\",t.items.forEach((m,d)=>{let l=e.items[d];if(!l)return;let u=Ne(m,a);Qt(l,m,u,r,a),o&&m.play&&je(l.img,u?ae(t,m.play,a):void 0,c)}),c};var Ve=e=>String(Math.round(e*1e4)/1e4);var ce=e=>{let t=e.stops.map(n=>n.color+\" \"+Ve(n.at*100)+\"%\").join(\", \");return e.type===\"linear\"?\"linear-gradient(\"+Ve(e.angle??180)+\"deg, \"+t+\")\":\"radial-gradient(farthest-corner at 50% 50%, \"+t+\")\"};var q=\"http://www.w3.org/2000/svg\",X=e=>\"position:absolute;left:0;top:0;width:\"+f(e.canvas.width)+\";height:\"+f(e.canvas.height)+\";\",qe=e=>Math.min(e.canvas.width,e.canvas.height),Ue=e=>'\"'+e.replace(/[\"\\\\]/g,\"\\\\$&\").replace(/\\n/g,\"\\\\a \")+'\"',Je=(e,t)=>f(e.x*t)+\" \"+f(e.y*t)+\" \"+f(e.blur*t)+\" \"+e.color,en=(e,t,n,o,s)=>{let r=n.base.kind===\"color\"?n.base:n.base.kind===\"scene\"?void 0:n.base.ground,a=r?\"background:\"+(r.gradient?ce(r.gradient):r.color)+\";\":\"\",i=X(t)+\"overflow:hidden;transform-origin:50% 50%;\"+a,c=b(e,\"div\",i+\"display:none;\",o);c.dataset.segment=n.id;let m=\"popost-smear-\"+n.index,d=e.createElementNS(q,\"filter\");d.setAttribute(\"id\",m),d.setAttribute(\"color-interpolation-filters\",\"sRGB\");let l=e.createElementNS(q,\"feGaussianBlur\");if(l.setAttribute(\"stdDeviation\",\"0 0\"),l.setAttribute(\"edgeMode\",\"duplicate\"),d.appendChild(l),s.appendChild(d),n.base.kind===\"color\")return{layer:c,layerCss:i,imgCss:\"\",smear:l,filterId:m};if(n.base.kind===\"scene\"){let y=b(e,\"iframe\",\"position:absolute;left:0;top:0;width:100%;height:100%;border:0;display:block;pointer-events:none;background:transparent;\",c);return y.setAttribute(\"sandbox\",\"allow-scripts allow-same-origin\"),y.setAttribute(\"scrolling\",\"no\"),y.setAttribute(\"tabindex\",\"-1\"),{layer:c,layerCss:i,imgCss:\"\",smear:l,filterId:m,scene:{frame:y,source:Ie(t,n,n.base.src),segment:n.index,animations:[],...n.base.slots?{slots:n.base.slots}:{}}}}let u=\"position:absolute;left:0;top:0;width:100%;height:100%;display:block;transform-origin:50% 50%;object-fit:\"+n.base.fit+\";\",h=b(e,\"img\",u,c);return h.alt=\"\",n.base.kind===\"image\"&&(h.src=n.base.src),{layer:c,layerCss:i,img:h,imgCss:u,smear:l,filterId:m}},tn={left:\"flex-start\",center:\"center\",right:\"flex-end\"},Ye=e=>U(e.span),nn=(e,t,n,o,s)=>t.flatMap(r=>{let a=r.span?.background;if(!o){let m=b(e,\"span\",Ye(r)+(a?I(a,n,!0,!0)+\"-webkit-box-decoration-break:clone;box-decoration-break:clone;\":\"\"),s);return m.textContent=r.text,[]}let i=b(e,\"span\",Ye(r),s),c=Array.from(r.text);return c.map((m,d)=>{let l=b(e,\"span\",a?I(a,n,d===0,d===c.length-1):\"\",i);return l.textContent=m,l})}),on=(e,t)=>\"width:100%;text-align:\"+e.align+\";font-family:\"+e.font+\";font-size:\"+f(t)+\";font-weight:\"+e.weight+\";font-style:\"+(e.italic?\"italic\":\"normal\")+\";color:\"+e.color+\";line-height:\"+R(e.lineHeight??A)+\";white-space:pre-wrap;overflow-wrap:break-word;\"+(e.letterSpacing?\"letter-spacing:\"+f(e.letterSpacing*t)+\";\":\"\")+(e.shadow?\"text-shadow:\"+Je(e.shadow,t)+\";\":\"\")+(e.opacity!==void 0&&e.opacity!==1?\"opacity:\"+R(e.opacity)+\";\":\"\"),sn=(e,t,n,o)=>{let s=n.style;if(!s||n.text===void 0)return{chars:[]};let r=s.size*t.canvas.height,a=b(e,\"div\",on(s,r),o),i=s.stroke?\"-webkit-text-stroke:\"+f(s.stroke.width*r)+\" \"+s.stroke.color+\";paint-order:stroke fill;\":\"\",c=s.background?I(s.background,r,!0,!0)+\"-webkit-box-decoration-break:clone;box-decoration-break:clone;\":\"\",m=b(e,\"span\",i+c,a);if(n.words){let l=ze(e,n,s,r,m);return{chars:l.chars,block:a,words:l}}let d=n.enter.preset===\"type\"||n.exit.preset===\"type\";return{chars:nn(e,He(n.text,s.spans),r,d,m),block:a}},rn=(e,t)=>{let[n,o,s,r]=t.box,a=e.canvas.width,i=e.canvas.height,c=t.border?\"border:\"+f(t.border.width*qe(e))+\" solid \"+t.border.color+\";\":\"\";return\"position:absolute;left:\"+f(n*a)+\";top:\"+f(o*i)+\";width:\"+f(s*a)+\";height:\"+f(r*i)+\";z-index:\"+t.z+\";transform-origin:50% 50%;\"+c},Xe=(e,t)=>{if(t.shape===\"ellipse\"||t.mask===\"ellipse\")return\"border-radius:50%;\";let n=(t.radius??0)*Math.min(t.box[2]*e.canvas.width,t.box[3]*e.canvas.height);return n>0?\"border-radius:\"+f(n)+\";\":\"\"},an=(e,t,n,o)=>{let s=rn(t,n),r=n.shadow?\"drop-shadow(\"+Je(n.shadow,qe(t))+\")\":\"\";if(n.type===\"text\"){let c=s+\"align-items:center;justify-content:\"+tn[n.style?.align??\"center\"]+\";\",m=b(e,\"div\",c+\"display:none;\",o);return m.dataset.item=n.id,{el:m,css:c,display:\"flex\",shadow:r,...sn(e,t,n,m)}}if(n.type===\"image\"||n.type===\"video\"){let c=Xe(t,n),m=s+(c||n.type===\"video\"?\"overflow:hidden;\"+c:\"\"),d=b(e,\"div\",m+\"display:none;\",o);d.dataset.item=n.id;let l=b(e,\"img\",\"width:100%;height:100%;display:block;object-fit:\"+(n.fit??\"contain\")+\";\",d);return l.alt=\"\",n.type===\"image\"&&(l.src=n.src??\"\"),{el:d,css:m,display:\"block\",shadow:r,chars:[],img:l}}let a=s+\"background:\"+(n.gradient?ce(n.gradient):n.color??\"#ffffff\")+\";\"+Xe(t,n),i=b(e,\"div\",a+\"display:none;\",o);return i.dataset.item=n.id,{el:i,css:a,display:\"block\",shadow:r,chars:[]}},cn=e=>(e.fonts??[]).map(t=>\"@font-face{font-family:\"+Ue(t.family)+\";src:url(\"+Ue(t.src)+\");font-weight:1 1000;font-display:block}\").join(`\n`),$e=(e,t,n,o)=>{let s=n.canvas.width,r=n.canvas.height;if((n.fonts??[]).length>0){let x=e.createElement(\"style\");x.textContent=cn(n),e.head.appendChild(x)}let a=b(e,\"div\",\"position:relative;overflow:hidden;width:\"+f(Math.round(s*o))+\";height:\"+f(Math.round(r*o))+\";\",t),i=b(e,\"div\",\"position:relative;overflow:hidden;background:#000;width:\"+f(s)+\";height:\"+f(r)+\";transform-origin:0 0;\"+(o===1?\"\":\"transform:scale(\"+R(o)+\");\"),a),c=e.createElementNS(q,\"svg\");c.setAttribute(\"width\",\"0\"),c.setAttribute(\"height\",\"0\"),c.setAttribute(\"style\",\"position:absolute;width:0;height:0;\");let m=e.createElementNS(q,\"defs\");c.appendChild(m),i.appendChild(c);let d=b(e,\"div\",X(n)+\"z-index:0;isolation:isolate;\",i),l=n.segments.map(x=>en(e,n,x,d,m)),u=X(n)+\"z-index:1;\",h=b(e,\"div\",u+\"display:none;\",i),y=b(e,\"div\",X(n)+\"z-index:2;isolation:isolate;\",i),H=n.items.map(x=>an(e,n,x,y)),N=[...l.filter((x,P)=>n.segments[P]?.base.kind===\"image\"),...H.filter((x,P)=>n.items[P]?.type===\"image\")].flatMap(x=>x.img?[x.img]:[]);return{stage:i,segments:l,overlay:h,overlayCss:u,items:H,images:N,live:!1,shown:[]}};var ln=.3333333333333333,dn=80,mn=new Set([\"SCRIPT\",\"STYLE\",\"NOSCRIPT\",\"TEMPLATE\",\"TITLE\"]),un=e=>Array.from(e.childNodes).some(t=>t.nodeType===3&&(t.textContent??\"\").trim()!==\"\"),Ze=(e,t)=>e.right>t.left&&e.left<t.right&&e.bottom>t.top&&e.top<t.bottom,pn=(e,t)=>{let n=e,o=n.offsetWidth??0,s=n.offsetHeight??0;return o>0&&s>0?Math.min(t.width/o,t.height/s):1},fn=(e,t,n)=>{if(e.getClientRects().length===0||t.getComputedStyle(e).visibility!==\"visible\")return!1;let o=e.getBoundingClientRect();if(!(o.width>0&&o.height>0)||!Ze(o,n)||pn(e,o)<ln)return!1;let s=e.ownerDocument.documentElement,r=e.ownerDocument.body,a=1;for(let i=e;i;i=i.parentElement){let c=t.getComputedStyle(i);if(a*=Number(c.opacity),i!==e&&i!==s&&i!==r&&c.display!==\"inline\"&&(c.overflowX!==\"visible\"||c.overflowY!==\"visible\")&&!Ze(o,i.getBoundingClientRect()))return!1}return a>=.5},Qe=e=>{let t=e.defaultView;if(!t||!e.body)return[];let n={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight},o=[];return Array.from(e.body.querySelectorAll(\"*\")).forEach((s,r)=>{if(mn.has(s.tagName.toUpperCase())||!un(s))return;let a=(s.textContent??\"\").replace(/\\s+/g,\" \").trim().slice(0,dn);o.push({index:r,text:a,visible:fn(s,t,n)})}),o};var hn=1,bn=(e,t)=>e?{left:Math.min(e.left,t.left),top:Math.min(e.top,t.top),right:Math.max(e.right,t.right),bottom:Math.max(e.bottom,t.bottom)}:t,gn=(e,t,n)=>{if(!e)return{top:0,bottom:0,box:0};e.font=t.fontStyle+\" \"+t.fontWeight+\" \"+t.fontSize+\" \"+t.fontFamily;let o=e.measureText(n.replace(/\\s+/g,\"\"));return{top:Math.max(0,o.fontBoundingBoxAscent-o.actualBoundingBoxAscent),bottom:Math.max(0,o.fontBoundingBoxDescent-o.actualBoundingBoxDescent),box:o.fontBoundingBoxAscent+o.fontBoundingBoxDescent}},yn=e=>{let t=e.ownerDocument,n=t.defaultView,o=t.createElement(\"canvas\").getContext(\"2d\"),s=t.createRange(),r=t.createTreeWalker(e,NodeFilter.SHOW_TEXT),a;for(let i=r.nextNode();i;i=r.nextNode()){let c=i.textContent??\"\",m=i.parentElement;if(!c.trim()||!m||!n)continue;let d=gn(o,n.getComputedStyle(m),c);for(let l=0;l<c.length;l++){if(/\\s/.test(c.charAt(l)))continue;let u=(c.codePointAt(l)??0)>65535?2:1;s.setStart(i,l),s.setEnd(i,l+u),l+=u-1;let h=s.getBoundingClientRect();if(h.width<=0||h.height<=0)continue;let y=d.box>0?h.height/d.box:1;a=bn(a,{left:h.left,right:h.right,top:h.top+d.top*y,bottom:h.bottom-d.bottom*y})}}return a},et=e=>{let t=e.getBoundingClientRect(),n=e.offsetWidth>0?t.width/e.offsetWidth:1,o=e.offsetHeight>0?t.height/e.offsetHeight:1,s=t.left+e.clientLeft*n,r=t.top+e.clientTop*o;return{left:s,top:r,right:s+e.clientWidth*n,bottom:r+e.clientHeight*o}},tt=(e,t,n,o)=>{let r=[...n?[[\"left\",t.left-e.left],[\"right\",e.right-t.right]]:[],...o?[[\"top\",t.top-e.top],[\"bottom\",e.bottom-t.bottom]]:[]].reduce((a,i)=>!a||i[1]>a[1]?i:a,void 0);return r&&r[1]>hn?{side:r[0],px:Math.round(r[1])}:void 0},xn=e=>{let t=e.tagName.toLowerCase();if(e.id)return t+\"#\"+e.id;let n=Array.from(e.classList);return n.length?t+\".\"+n.join(\".\"):t},vn=(e,t)=>{let n=e.ownerDocument.defaultView,o=e.ownerDocument.body;for(let s=e.parentElement;s&&n&&s!==o&&s!==e.ownerDocument.documentElement;s=s.parentElement){let r=n.getComputedStyle(s),a=r.overflowX!==\"visible\",i=r.overflowY!==\"visible\";if(r.display===\"inline\"||!a&&!i)continue;let c=tt(t,et(s),a,i);if(c)return{ancestor:xn(s),...c}}},Sn=e=>{let t=[],n=[];for(let o of Array.from(e.querySelectorAll(\"[data-slot]\"))){if(!(o instanceof(e.defaultView??globalThis).HTMLElement)||o.tagName===\"IMG\")continue;let s=yn(o);if(!s)continue;let r={slot:o.getAttribute(\"data-slot\")??\"\",text:(o.textContent??\"\").trim().slice(0,40)},a=o.clientWidth>0&&o.clientHeight>0?tt(s,et(o),!0,!0):void 0,i=a?void 0:vn(o,s);a?t.push({...r,...a}):i&&n.push({...r,...i})}return{overflowing:t,clipped:n}},wn=e=>{let t=e;if(!t||typeof t.at!=\"number\"||!Number.isFinite(t.at)||t.at<0||typeof t.cue!=\"string\"||!t.cue)return[];let n=typeof t.gain==\"number\"&&Number.isFinite(t.gain)?Math.min(1,Math.max(0,t.gain)):.7;return[{at:Math.round(t.at*1e3)/1e3,cue:t.cue,gain:Math.round(n*1e3)/1e3,...typeof t.effect==\"string\"?{effect:t.effect}:{}}]},Tn=e=>{let t=e.defaultView?.__popostScene?.cues,n=[];try{n=JSON.parse(e.getElementById(\"popost-cues\")?.textContent??\"[]\")}catch{n=[]}return[...Array.isArray(t)?t:[],...Array.isArray(n)?n:[]].flatMap(wn).sort((o,s)=>o.at-s.at)},nt=(e,t)=>e.segments.flatMap(n=>{let o=n.scene?.frame.contentDocument;if(!n.scene||!o||t!==void 0&&n.scene.segment!==t)return[];let s=o.documentElement;return[{segment:n.scene.segment,src:K(n.scene.frame.getAttribute(\"src\")??\"\"),width:Math.max(s.scrollWidth,o.body?.scrollWidth??0),height:Math.max(s.scrollHeight,o.body?.scrollHeight??0),...Sn(o),elements:o.body?o.body.querySelectorAll(\"*\").length:0,texts:Qe(o),cues:Tn(o)}]});var ot=.5,En=e=>{let t=[],n=document.createRange(),o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let s=o.nextNode();s;s=o.nextNode()){if(s.parentElement?.closest(\"[data-glyphs]\"))continue;let r=s.textContent??\"\";for(let a=0;a<r.length;a++){if(/\\s/.test(r.charAt(a)))continue;let i=r.codePointAt(a)!==void 0&&(r.codePointAt(a)??0)>65535?2:1;n.setStart(s,a),n.setEnd(s,a+i);let c=n.getBoundingClientRect();c.width>0&&c.height>0&&t.push({left:c.left,top:c.top,right:c.right,bottom:c.bottom}),a+=i-1}}return t},Mn=(e,t)=>{let n=e.map(o=>(o.top+o.bottom)/2).sort((o,s)=>o-s);return n.reduce((o,s,r)=>r===0||s-(n[r-1]??s)>t/2?o+1:o,0)},kn=(e,t)=>{let n=e.style,o=document.createElement(\"canvas\").getContext(\"2d\");if(!n||!o)return[0,0];o.font=(n.italic?\"italic \":\"\")+n.weight+\" \"+t+\"px \"+n.font;let s=o.measureText((e.text??\"\").replace(/\\s+/g,\"\"));return[Math.max(0,s.fontBoundingBoxAscent-s.actualBoundingBoxAscent),Math.max(0,s.fontBoundingBoxDescent-s.actualBoundingBoxDescent)]},Rn=(e,t,n,o,s,r)=>{let a=o.canvas.width*r,i=o.canvas.height*r,c=(n.style?.size??0)*o.canvas.height,m=e.el.getBoundingClientRect(),d=t.getBoundingClientRect(),l=En(t),u=Math.min(...l.map(w=>w.left)),h=Math.max(...l.map(w=>w.right)),[y,H]=kn(n,c),N=(n.style?.stroke?.width??0)*c*r/2,x=Math.min(...l.map(w=>w.top))+y*r-N,P=Math.max(...l.map(w=>w.bottom))-H*r+N,J=(w,le,it,ct)=>[(w-s.left)/a,(le-s.top)/i,(it-w)/a,(ct-le)/i],at=l.length>0?h-u:0;return{id:n.id,fits:d.height<=m.height+ot*r&&at<=m.width+ot*r,lines:Mn(l,(n.style?.lineHeight??A)*c*r),ink:l.length>0?J(u-N,x,h+N,P):[0,0,0,0],block:l.length>0?J(u,d.top,h,d.bottom):J(d.left,d.top,d.left,d.bottom)}},st=(e,t,n)=>{let o=e.stage.getBoundingClientRect();return t.items.flatMap((s,r)=>{let a=e.items[r];if(s.type!==\"text\"||!a?.block)return[];let i=a.el.style.cssText;a.el.style.cssText=a.css+\"display:\"+a.display+\";\";try{return[Rn(a,a.block,s,t,o,n)]}finally{a.el.style.cssText=i}})};var Cn=()=>{let e=document.getElementById(\"popost-data\");if(!e?.textContent)throw new Error('popost video page: the <script id=\"popost-data\"> element with the timeline is missing. Build the page with compilePage.');return JSON.parse(e.textContent)},Ln=e=>[...new Set(e.resolved.items.flatMap(t=>{let n=t.style;return t.type!==\"text\"||!n?[]:[n.weight,...t.words&&n.spoken?.weight?[n.spoken.weight]:[]].map(s=>(n.italic?\"italic \":\"\")+s+\" \"+Math.round(n.size*e.resolved.canvas.height)+\"px \"+n.font)}))],Nn=e=>e.replace(/^[\"']|[\"']$/g,\"\"),An=async e=>{let t=e.resolved.fonts??[];if(t.length===0)return;let n=[];document.fonts.forEach(o=>{n.push(o)}),await Promise.all(t.map(async o=>{let s=n.filter(a=>Nn(a.family)===o.family),r=()=>new Error('Font \"'+o.family+'\" ('+o.src+\") could not be loaded. Check that the file exists in the project directory and is a WOFF2, WOFF, TTF or OTF font.\");if(s.length===0)throw r();await Promise.all(s.map(a=>a.load())).catch(()=>{throw r()})}))},In=async(e,t)=>{let n=Object.entries(t.resolved.footage??{}).filter(([,s])=>s.dir===void 0).map(([s])=>'\"'+s+'\"');if(n.length>0&&!t.nativeFootage)throw new Error(\"Video material \"+n.join(\", \")+\" has no extracted frames: the page was compiled from resolve() alone. Build it with buildPage, which extracts them into the project's .cache directory.\");await Promise.all(e.images.map(s=>s.decode().catch(()=>{throw new Error('Image \"'+(s.getAttribute(\"src\")??\"\")+'\" could not be loaded. Check that the file exists in the project directory and is a PNG, JPEG or WebP picture.')}))),await An(t);let o=t.resolved.items.map(s=>s.text??\"\").join(\"\");await Promise.all(Ln(t).map(s=>document.fonts.load(s,o).catch(()=>[]))),await document.fonts.ready},rt=async e=>{let t=await Promise.allSettled(e.map(_e)),n=t.flatMap(s=>s.status===\"rejected\"&&s.reason instanceof L?s.reason.failures:[]);if(n.length>0)throw new L(n);let o=t.find(s=>s.status===\"rejected\");if(o)throw o.reason},Pn=()=>{let e=[],t=async()=>{let n=e,o=await Promise.allSettled(n.map(r=>r.decode()));if(n!==e)return t();let s=o.findIndex(r=>r.status===\"rejected\");if(s>=0)throw new Error('The video frame picture \"'+(n[s]?.getAttribute(\"src\")??\"\")+`\" could not be loaded. Build the page again: buildPage extracts the frames into the project's .cache directory.`)};return{settle:t,set:n=>{e=n}}},Dn=(e,t)=>{let n,o=()=>n??=In(e,t),s=e.segments.flatMap(r=>r.scene?[r.scene]:[]);return{all:async()=>{await o(),await rt(s)},frame:async r=>{await o();let a=j(t.resolved,_(t.resolved,r)).layers.map(i=>i.index);await rt(s.filter(i=>a.includes(i.segment)))}}},_n=e=>{let t=e.cloneNode(!0);return t.querySelectorAll(\"*\").forEach(n=>{n instanceof HTMLElement&&n.style.display===\"none\"&&n.remove()}),t.innerHTML},Fn=()=>{let e=Cn(),t=e.resolved,n=$e(document,document.body,t,e.scale),o=Pn(),s=Dn(n,e),r,a={frames:t.frames,fps:t.canvas.fps,width:t.canvas.width,height:t.canvas.height,scale:e.scale,prepare:async()=>{await s.all(),await o.settle()},preparePreview:s.frame,applyFrame:i=>o.set(Y(n,t,i)),previewFrame:i=>o.set(Y(n,t,i,!1)),settle:()=>o.settle(),layout:()=>st(n,t,e.scale),scenes:i=>nt(n,i),state:i=>(i!==void 0&&o.set(Y(n,t,i,!0,!1)),{markup:_n(n.stage),scenes:n.shown.map(c=>({...c}))}),changed:()=>{let i=n.stage.innerHTML,c=i===r;return r=i,!c||n.live}};a.applyFrame(0),window.__popostVideo=a};Fn();})();\n";
@@ -7,4 +7,5 @@ import type { Resolved } from '../types';
7
7
  /** opts.scale (0 < scale <= 4, default 1) renders the same picture at width*scale x height*scale pixels. */
8
8
  export declare const compilePage: (resolved: Resolved, opts?: {
9
9
  scale?: number;
10
+ nativeFootage?: boolean;
10
11
  }) => Promise<string>;
@@ -22,6 +22,7 @@ export declare const readFootage: (rt: Runtime, file: string, options?: {
22
22
  }) => Promise<{
23
23
  facts: FootageFacts;
24
24
  colour: FootageColour;
25
+ native: boolean;
25
26
  }>;
26
27
  /**
27
28
  * When a person speaks in a clip made with speech, from its receipt beside it (<file>.speech.json, generate/speech.ts):
@@ -154,6 +154,8 @@ export interface PopostVideoPage {
154
154
  }
155
155
  /** What compilePage embeds in the page as JSON. */
156
156
  export interface PageData {
157
+ /** Interactive preview only; the shell supplies native video decoding. */
158
+ nativeFootage?: boolean;
157
159
  resolved: Resolved;
158
160
  scale: number;
159
161
  }
@@ -29,6 +29,7 @@ export interface PreviewState {
29
29
  /** The reference video, when one was given. The shell loads it from /reference. */
30
30
  reference: {
31
31
  name: string;
32
+ url?: string;
32
33
  } | null;
33
34
  /** Why something the shell could show is missing: an unreadable measure file, a scorer that failed. */
34
35
  messages: string[];
@@ -0,0 +1,9 @@
1
+ import type { Runtime } from '../../runtime';
2
+ export declare const REFERENCE_INFO = ".studio/reference.json";
3
+ export declare const referenceDescriptor: (rt: Runtime, dir: string, file: string) => {
4
+ name: string;
5
+ url?: string;
6
+ };
7
+ /** A portable reference shared by local previews, cloud synchronization and hosted Studio. */
8
+ export declare const savedReference: (rt: Runtime, dir: string) => Promise<string | undefined>;
9
+ export declare const prepareReference: (rt: Runtime, dir: string, explicit?: string) => Promise<string | undefined>;
@@ -2,5 +2,6 @@ import type { Resolved } from '../../types';
2
2
  /** Native decoding belongs to the interactive preview; export still uses deterministic extracted frames. */
3
3
  export declare const nativeFootage: (doc: Document, r: Resolved) => {
4
4
  sync: (frame: number, playing: boolean, speed: number) => void;
5
+ needsPictures: () => boolean;
5
6
  dispose: () => void;
6
7
  };
@@ -7,6 +7,7 @@ declare const EN: {
7
7
  readonly offline: "offline, retrying";
8
8
  readonly language: "中文";
9
9
  readonly languageTitle: "Switch the interface to Chinese";
10
+ readonly currentVideo: "Current video";
10
11
  readonly render: "Render";
11
12
  readonly reference: "Reference";
12
13
  readonly seekNote: "A browser video seek is near, not frame-exact.";
@@ -1,5 +1,6 @@
1
1
  import type { Store } from '../app';
2
2
  declare const en: {
3
+ readonly noReference: "No reference video is available for this project.";
3
4
  readonly shots: "Shots";
4
5
  readonly media: "Media";
5
6
  readonly script: "Script";
@@ -1,2 +1,2 @@
1
- export declare const STUDIO_CSS = "\n:root{--pc-bg:#f4f4f2;--pc-surface:#fff;--pc-surface-2:#f8f8f7;--pc-border:#dededb;--pc-text:#252525;--pc-muted:#85847d;--pc-hover:#ebebe8;--pc-accent:#ff7a1a;--pc-accent-soft:#fff1e5;--pc-stage:#e9e9e6;--timeline-height:240px;--left-width:264px;--right-width:300px}\nhtml.dark{color-scheme:dark;--pc-bg:#111;--pc-surface:#1a1a1a;--pc-surface-2:#141414;--pc-border:#363632;--pc-text:#f2f2f0;--pc-muted:#a5a59a;--pc-hover:#2a2a2a;--pc-accent-soft:#3e2b1b;--pc-stage:#0b0b0b}\nbody.studio{font:13px/1.45 'Helvetica Neue','PingFang SC',system-ui,sans-serif;background:var(--pc-bg);color:var(--pc-text);--bg:var(--pc-bg);--surface:var(--pc-surface);--fg:var(--pc-text);--muted:var(--pc-muted);--line:var(--pc-border);--accent:var(--pc-accent);--on-accent:#fff;--seg:#e7eef3;--item:#eee7f7;--audio:#e6f1e8;--stage:var(--pc-stage);--stage-fg:var(--pc-muted);--head:#292929}\n.studio [hidden]{display:none!important}.studio button,.studio input,.studio textarea,.studio select{font:inherit;color:inherit}.studio button:focus-visible,.studio a:focus-visible,.studio textarea:focus-visible,.studio input:focus-visible{outline:2px solid var(--pc-accent);outline-offset:2px}.studio button:disabled{opacity:.45;cursor:default}\n.studio #app{grid-template-rows:48px minmax(240px,1fr) var(--timeline-height) 24px;height:100dvh}.studio .main{display:grid;grid-template-rows:minmax(0,1fr);grid-template-columns:64px var(--left-width) minmax(0,1fr) var(--right-width);min-height:0;position:relative}.studio .left{overflow:hidden;min-height:0;min-width:0;display:flex;flex-direction:column}.studio .panel{width:auto;min-width:0;overflow:auto;background:var(--pc-surface);border-left:1px solid var(--pc-border);padding:12px 16px}.studio .panel>#problems,.studio .panel>#score,.studio .panel>#measures,.studio .panel>#notes{display:none}.studio .panel h2{font-size:12px;color:var(--pc-muted)}.studio .sel-title{font-size:13px;padding-bottom:10px;border-bottom:1px solid var(--pc-border);color:var(--pc-text);overflow-wrap:anywhere}.studio .status-line{font-size:11px;max-height:80px;overflow:auto}.studio #render-status{display:none}\n.studio-topbar{display:flex;align-items:center;gap:12px;padding:0 16px;background:var(--pc-surface-2);border-bottom:1px solid var(--pc-border);min-width:0;white-space:nowrap}.studio-brand{font-size:23px;font-weight:800;letter-spacing:-1.3px;margin-right:8px}.studio-brand:after{content:'\u2022';color:var(--pc-accent);font-size:15px;vertical-align:top;letter-spacing:0}.studio-project{min-width:80px;max-width:30%;overflow:hidden;text-overflow:ellipsis;flex:1}.studio-save{font-size:11px;color:var(--pc-muted)}.studio-save:before{content:'\u25CF';font-size:9px;color:#2e9e6b;margin-right:7px}.studio-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.studio-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:32px;padding:5px 10px;border:1px solid var(--pc-border);border-radius:8px;background:var(--pc-surface);text-decoration:none;font-size:12px;cursor:pointer}.studio-btn:hover{background:var(--pc-hover)}.studio-btn.primary{background:#292929;color:#fff;border-color:#292929}.dark .studio-btn.primary{background:#f2f2f0;color:#222}.studio-btn.selected{background:var(--pc-accent-soft);border-color:#ffb47c;color:#c76520}.studio-btn.ghost{border-color:transparent;background:transparent}.studio .tbtn{height:30px;min-width:30px;border:0;background:transparent;border-radius:7px}.studio .tbtn:hover{background:var(--pc-hover)}.studio #edit-render{display:none}.studio .edit-tools{gap:6px}.studio .tool-group{gap:2px}\n.studio-rail{min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:5px;padding:12px 5px;background:var(--pc-surface-2);border-right:1px solid var(--pc-border)}.studio-rail button{height:57px;flex:none;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;background:transparent;border:0;border-radius:8px;color:var(--pc-muted);font-size:11px;cursor:pointer}.studio-rail button.active{background:var(--pc-accent-soft);color:#e8711c}.studio-rail svg{width:19px;height:19px}.studio-content{min-height:0;overflow:auto;background:var(--pc-surface);border-right:1px solid var(--pc-border)}.studio-side-body{padding:14px 14px 20px;display:flex;flex-direction:column;gap:12px}.studio-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px}.studio-heading h2{margin:0;font-size:14px;font-weight:600;color:var(--pc-text)}.studio-heading small{font-size:10px;color:var(--pc-muted)}.studio-note{font-size:11px;line-height:1.7;color:var(--pc-muted);margin:0;overflow-wrap:anywhere}.studio-note.notice{padding:10px;border:1px solid #f0d5b9;border-radius:8px;background:var(--pc-accent-soft);color:#9a5c2d}.studio-note.bad{color:var(--err)}.studio-input{border:1px solid var(--pc-border);border-radius:7px;background:var(--pc-surface-2);width:100%;min-height:34px;padding:7px 9px;resize:vertical;min-width:0}.studio-field{display:flex;flex-direction:column;gap:6px;font-size:11px;color:var(--pc-muted)}.studio-field .studio-input{font-size:12px;color:var(--pc-text)}.studio-field-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}\n.studio-shot-list{display:flex;flex-direction:column;gap:7px}.studio-shot{width:100%;min-height:70px;justify-content:flex-start;text-align:left;padding:7px;gap:10px}.studio-thumb{display:block;width:74px;height:55px;object-fit:cover;border-radius:5px;background:var(--pc-stage);flex:none}.studio-shot-copy{display:flex;flex-direction:column;min-width:0;gap:7px}.studio-shot-copy strong{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:145px}.studio-shot-copy small{font-size:10px;color:var(--pc-muted)}.studio-media-list{display:grid;gap:12px}.studio-media-card,.studio-review-card,.studio-sentence{border:1px solid var(--pc-border);border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:9px}.studio-media-card>img,.studio-media-card>video{width:100%;max-height:150px;object-fit:contain;background:var(--pc-stage);border-radius:5px}.studio-media-card>audio{width:100%;height:30px}.studio-media-card>strong{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.studio-media-card .studio-btn{font-size:10px;padding:4px 6px}.studio-script-list{display:flex;flex-direction:column;gap:8px}.studio-sentence>button{align-self:flex-start;font-size:10px;min-height:24px}.studio-sentence textarea{font-size:12px}.studio-item{justify-content:flex-start;overflow-wrap:anywhere;text-align:left}.studio-slot-image{max-width:100%;max-height:150px;object-fit:contain}.studio-stage-heading{display:flex;align-items:center;justify-content:space-between;height:40px;flex:none;padding:0 18px;background:var(--pc-surface-2);border-bottom:1px solid var(--pc-border);font-size:12px}.studio-stage-heading small{font-size:10px;color:var(--pc-muted)}.studio .stage-area{min-height:0!important;padding:14px 18px;gap:14px;background:var(--pc-stage);min-height:160px}.studio .frame-box{box-shadow:0 2px 7px #0002,0 12px 30px #0001}.studio .caption{font-size:11px}.studio .note{font-size:10px;max-width:350px}.studio .transport{height:76px;min-height:76px;flex-wrap:wrap;align-content:center;background:var(--pc-surface-2);padding:4px 12px;gap:7px}.studio .transport .readout{font-size:11px;gap:8px;order:2;flex:1 0 calc(100% - 100px)}.studio .transport #jump{order:3;width:80px;font-size:10px}.studio .transport .speed{order:1;font-size:10px}.studio .transport .tbtn{min-width:24px;padding:0 4px}.studio .transport #back10,.studio .transport #fwd10{display:none}.studio .transport .slider-wrap{min-width:50px}\n.studio-timeline-wrap{position:relative;display:flex;flex-direction:column;min-height:0;border-top:1px solid var(--pc-border);background:var(--pc-surface)}.studio-timeline-toolbar{height:39px;flex:none;display:flex;align-items:center;gap:8px;padding:0 14px;border-bottom:1px solid var(--pc-border);background:var(--pc-surface-2)}.studio-timeline-toolbar .spacer{flex:1}.studio-timeline-toolbar input[type=range]{width:105px;accent-color:var(--pc-accent)}.studio .timeline{min-height:0;flex:1;max-height:none;overflow:auto}.studio .lanes{--label:160px;width:calc(100% * var(--timeline-zoom,1));min-width:100%;padding-bottom:9px}.studio .lane{height:34px;border-color:var(--pc-border)}.studio .lane-label{position:sticky;left:0;z-index:9;background:var(--pc-surface);line-height:33px;font-size:11px;padding-left:15px}.studio .ruler{height:28px;background:var(--pc-surface-2);position:sticky;top:0;z-index:10}.studio .ruler .lane-label{background:var(--pc-surface-2);line-height:27px}.studio .rtick{font-size:10px;color:var(--pc-muted)}.studio .lane.segments{height:70px}.studio .blk.seg{height:58px;top:5px;bottom:auto;line-height:13px;padding:0 4px;border:1px solid #aebfcb;background:#e8eef3;color:#4c6474}.studio .blk.seg img{display:block;position:absolute;left:0;top:0;width:100%;height:39px;object-fit:cover;pointer-events:none}.studio .blk.seg .segment-name{position:absolute;bottom:1px;left:4px;right:2px;font-size:9px;overflow:hidden;text-overflow:ellipsis}.studio .blk.seg.selected{border:2px solid var(--pc-accent);background:#fff0e2}.studio .blk.item{background:#eee8fa;color:#8c70a9;border:1px solid #d8c9ef;font-size:10px;top:5px;bottom:5px}.studio .lane.caption-lane .blk.item{background:#f5efdf;color:#8e7950;border-color:#e6dcc1}.studio .lane.caption-lane .blk.selected{border-color:var(--pc-accent)}.studio .blk.audio{background:#e7f2e9;color:#537b60;border:1px solid #b3d1bd;top:5px;bottom:5px;font-size:10px}.studio .blk.audio.wave-ready{color:transparent}.studio .blk.audio svg{width:100%;height:100%;position:absolute;inset:0;pointer-events:none}.studio .measure,.studio .lane.words-lane{display:none}.studio.show-analysis .measure,.studio.show-analysis .lane.words-lane{display:grid}.studio .band{z-index:2;opacity:.7}.studio .seg-grip{height:66px;top:2px}.studio .playhead{background:#292929;min-width:1px}.studio .selected{outline-color:var(--pc-accent)}\n.studio-footer{height:24px;background:var(--pc-surface-2);border-top:1px solid var(--pc-border);display:flex;align-items:center;justify-content:space-between;padding:0 14px;font-size:10px;color:var(--pc-muted)}.studio-handle{position:absolute;z-index:15;touch-action:none}.studio-handle.vertical{width:5px;top:0;bottom:0;cursor:col-resize}.studio-handle.horizontal{height:5px;left:0;right:0;top:-3px;cursor:row-resize}.studio-handle:hover{background:var(--pc-accent);opacity:.35}.studio.focus-preview .main{grid-template-columns:64px 0 minmax(0,1fr) 0}.studio.focus-preview .studio-content,.studio.focus-preview .panel{visibility:hidden;padding:0;overflow:hidden}.studio.panel-code{--left-width:min(480px,35vw)}\n.studio-code-wrap{display:flex;flex-direction:column;gap:10px;height:100%;padding:14px}.studio-json{flex:1;min-height:240px;white-space:pre;overflow:auto;resize:none;width:100%;font:12px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace!important;border:1px solid var(--pc-border);border-radius:8px;background:var(--pc-surface-2);padding:12px;tab-size:2}.studio-code-status{font-size:11px;color:var(--pc-muted);overflow-wrap:anywhere}.studio-scrim{position:fixed;inset:0;background:#0003;z-index:80}.studio-export{position:fixed;right:0;top:0;bottom:0;width:440px;max-width:100vw;overflow:auto;padding:18px 22px;background:var(--pc-surface);z-index:81;box-shadow:-12px 0 40px #0002;display:flex;flex-direction:column;gap:18px}.studio-export-header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--pc-border);padding-bottom:14px}.studio-export-fields{border:0;margin:0;padding:0;display:flex;flex-direction:column;gap:16px;min-width:0}.studio-export-fields>.studio-field{display:grid;grid-template-columns:95px 1fr;align-items:center;gap:12px;font-size:13px}.studio-segments{display:flex;padding:3px;background:var(--pc-bg);border-radius:8px;gap:3px}.studio-segments button{flex:1;border:0;background:transparent;border-radius:6px;padding:7px}.studio-segments button.selected{background:var(--pc-surface);color:var(--pc-text)}.studio-resolutions{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}.studio-resolutions button{position:relative;padding:5px;min-width:0}.export-gem{color:var(--pc-accent);display:inline-flex;align-items:center;justify-content:center;font-size:20px;line-height:15px;margin-left:3px}.studio-paid-info:empty{display:none}.studio-paid-info{border:1px solid #e9cfb8;background:var(--pc-accent-soft);border-radius:8px;padding:10px;font-size:11px}.studio-paid-info a{color:#df711e;margin-right:12px}.studio-paid-info p{color:var(--pc-text);margin-bottom:6px}.studio-check{display:flex;align-items:center;gap:8px;font-size:12px}.studio-check input{accent-color:var(--pc-accent)}.studio-export>progress{width:100%;accent-color:var(--pc-accent)}.studio-export-result{display:flex;gap:10px;flex-direction:column}.studio-export-result:empty{display:none}#studio-message{position:fixed;left:50%;bottom:35px;transform:translateX(-50%);max-width:min(650px,85vw);padding:11px 16px;background:#292929;color:white;box-shadow:0 5px 20px #0003;border-radius:8px;z-index:100;opacity:0;pointer-events:none;font-size:12px}#studio-message.visible{opacity:1}\n.studio .sel-box.thin .h-n{top:-9px}.studio .sel-box.thin .h-s{top:calc(100% + 9px)}\n@media(max-width:1300px){:root{--left-width:238px;--right-width:272px}.studio-save{display:none}.studio-topbar{gap:6px}.studio-project{max-width:25%}.studio .transport .readout{font-size:10px}.studio .lanes{--label:140px}}\n@media(max-width:1000px){.studio .main{grid-template-columns:55px 225px minmax(150px,1fr)}.studio .main{grid-template-columns:52px 190px minmax(0,1fr) 240px}.studio .panel{position:static;width:auto;display:block}.studio-topbar .studio-btn:not(.primary){padding:4px}.studio-topbar .studio-project{max-width:18%}.studio .readout>span:first-child{display:none}}\n\n.studio-export{left:50%;right:auto;top:50%;bottom:auto;transform:translate(-50%,-50%);width:min(740px,calc(100vw - 32px));max-height:calc(100dvh - 40px);padding:26px 30px;border-radius:16px;box-shadow:0 20px 70px #0003;gap:24px}.studio-export-header{border:0;padding:0}.studio-export-header h2{font-size:24px}.studio-export-header button{border:0;font-size:24px;background:transparent}.export-tabs{padding:4px}.export-tabs button{font-size:17px;font-weight:600}.studio-export-fields{gap:18px}.studio-export-fields>.studio-field{grid-template-columns:135px 1fr;font-size:15px}.studio-export .studio-segments button{position:relative;min-height:36px;font-size:15px}.studio-export>.primary{width:100%;min-height:46px;background:#df7634;border-color:#d66b29;font-size:17px}.studio-export .studio-note{font-size:13px}.export-pro{position:absolute;right:-8px;top:-10px;font-size:10px;border-radius:4px;padding:2px 5px;background:#df7634;color:#fff}.studio-export details{font-size:13px;color:var(--pc-muted)}.studio-export details summary{cursor:pointer}.studio-export details p{margin-top:12px}.studio-export .studio-input{border:0;background:var(--pc-bg);min-height:40px;font-size:15px}@media(max-width:600px){.studio-export{padding:20px}.studio-export-fields>.studio-field{grid-template-columns:90px 1fr}}\n.studio-draft-success{width:min(560px,calc(100vw - 32px));gap:18px;padding:30px}.studio-draft-success .studio-export-header h2{font-size:22px}.studio-draft-success>.studio-note{font-size:15px;line-height:1.7;margin:0}.studio-draft-actions{display:flex;justify-content:flex-end;gap:10px}.studio-draft-actions .studio-btn{padding:11px 18px;border:0;background:var(--pc-bg);font-size:14px}.studio-draft-actions .primary{background:#df7634;color:white}.studio-draft-success [role=status]:empty{display:none}\n";
1
+ export declare const STUDIO_CSS = "\n:root{--pc-bg:#f4f4f2;--pc-surface:#fff;--pc-surface-2:#f8f8f7;--pc-border:#dededb;--pc-text:#252525;--pc-muted:#85847d;--pc-hover:#ebebe8;--pc-accent:#ff7a1a;--pc-accent-soft:#fff1e5;--pc-stage:#e9e9e6;--timeline-height:240px;--left-width:264px;--right-width:300px}\nhtml.dark{color-scheme:dark;--pc-bg:#111;--pc-surface:#1a1a1a;--pc-surface-2:#141414;--pc-border:#363632;--pc-text:#f2f2f0;--pc-muted:#a5a59a;--pc-hover:#2a2a2a;--pc-accent-soft:#3e2b1b;--pc-stage:#0b0b0b}\nbody.studio{font:13px/1.45 'Helvetica Neue','PingFang SC',system-ui,sans-serif;background:var(--pc-bg);color:var(--pc-text);--bg:var(--pc-bg);--surface:var(--pc-surface);--fg:var(--pc-text);--muted:var(--pc-muted);--line:var(--pc-border);--accent:var(--pc-accent);--on-accent:#fff;--seg:#e7eef3;--item:#eee7f7;--audio:#e6f1e8;--stage:var(--pc-stage);--stage-fg:var(--pc-muted);--head:#292929}\n.studio [hidden]{display:none!important}.studio button,.studio input,.studio textarea,.studio select{font:inherit;color:inherit}.studio button:focus-visible,.studio a:focus-visible,.studio textarea:focus-visible,.studio input:focus-visible{outline:2px solid var(--pc-accent);outline-offset:2px}.studio button:disabled{opacity:.45;cursor:default}\n.studio #app{grid-template-rows:48px minmax(240px,1fr) var(--timeline-height) 24px;height:100dvh}.studio .main{display:grid;grid-template-rows:minmax(0,1fr);grid-template-columns:64px var(--left-width) minmax(0,1fr) var(--right-width);min-height:0;position:relative}.studio .left{overflow:hidden;min-height:0;min-width:0;display:flex;flex-direction:column}.studio .panel{width:auto;min-width:0;overflow:auto;background:var(--pc-surface);border-left:1px solid var(--pc-border);padding:12px 16px}.studio .panel>#problems,.studio .panel>#score,.studio .panel>#measures,.studio .panel>#notes{display:none}.studio .panel h2{font-size:12px;color:var(--pc-muted)}.studio .sel-title{font-size:13px;padding-bottom:10px;border-bottom:1px solid var(--pc-border);color:var(--pc-text);overflow-wrap:anywhere}.studio .status-line{font-size:11px;max-height:80px;overflow:auto}.studio #render-status{display:none}\n.studio-topbar{display:flex;align-items:center;gap:12px;padding:0 16px;background:var(--pc-surface-2);border-bottom:1px solid var(--pc-border);min-width:0;white-space:nowrap}.studio-brand{font-size:23px;font-weight:800;letter-spacing:-1.3px;margin-right:8px}.studio-brand:after{content:'\u2022';color:var(--pc-accent);font-size:15px;vertical-align:top;letter-spacing:0}.studio-project{min-width:80px;max-width:30%;overflow:hidden;text-overflow:ellipsis;flex:1}.studio-save{font-size:11px;color:var(--pc-muted)}.studio-save:before{content:'\u25CF';font-size:9px;color:#2e9e6b;margin-right:7px}.studio-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.studio-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:32px;padding:5px 10px;border:1px solid var(--pc-border);border-radius:8px;background:var(--pc-surface);text-decoration:none;font-size:12px;cursor:pointer}.studio-btn:hover{background:var(--pc-hover)}.studio-btn.primary{background:#292929;color:#fff;border-color:#292929}.dark .studio-btn.primary{background:#f2f2f0;color:#222}.studio-btn.selected{background:var(--pc-accent-soft);border-color:#ffb47c;color:#c76520}.studio-btn.ghost{border-color:transparent;background:transparent}.studio .tbtn{height:30px;min-width:30px;border:0;background:transparent;border-radius:7px}.studio .tbtn:hover{background:var(--pc-hover)}.studio #edit-render{display:none}.studio .edit-tools{gap:6px}.studio .tool-group{gap:2px}\n.studio-rail{min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:5px;padding:12px 5px;background:var(--pc-surface-2);border-right:1px solid var(--pc-border)}.studio-rail button{height:57px;flex:none;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;background:transparent;border:0;border-radius:8px;color:var(--pc-muted);font-size:11px;cursor:pointer}.studio-rail button.active{background:var(--pc-accent-soft);color:#e8711c}.studio-rail svg{width:19px;height:19px}.studio-content{min-height:0;overflow:auto;background:var(--pc-surface);border-right:1px solid var(--pc-border)}.studio-side-body{padding:14px 14px 20px;display:flex;flex-direction:column;gap:12px}.studio-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px}.studio-heading h2{margin:0;font-size:14px;font-weight:600;color:var(--pc-text)}.studio-heading small{font-size:10px;color:var(--pc-muted)}.studio-note{font-size:11px;line-height:1.7;color:var(--pc-muted);margin:0;overflow-wrap:anywhere}.studio-note.notice{padding:10px;border:1px solid #f0d5b9;border-radius:8px;background:var(--pc-accent-soft);color:#9a5c2d}.studio-note.bad{color:var(--err)}.studio-input{border:1px solid var(--pc-border);border-radius:7px;background:var(--pc-surface-2);width:100%;min-height:34px;padding:7px 9px;resize:vertical;min-width:0}.studio-field{display:flex;flex-direction:column;gap:6px;font-size:11px;color:var(--pc-muted)}.studio-field .studio-input{font-size:12px;color:var(--pc-text)}.studio-field-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}\n.studio-shot-list{display:flex;flex-direction:column;gap:7px}.studio-shot{width:100%;min-height:70px;justify-content:flex-start;text-align:left;padding:7px;gap:10px}.studio-thumb{display:block;width:74px;height:55px;object-fit:cover;border-radius:5px;background:var(--pc-stage);flex:none}.studio-shot-copy{display:flex;flex-direction:column;min-width:0;gap:7px}.studio-shot-copy strong{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:145px}.studio-shot-copy small{font-size:10px;color:var(--pc-muted)}.studio-media-list{display:grid;gap:12px}.studio-media-card,.studio-review-card,.studio-sentence{border:1px solid var(--pc-border);border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:9px}.studio-media-card>img,.studio-media-card>video{width:100%;max-height:150px;object-fit:contain;background:var(--pc-stage);border-radius:5px}.studio-media-card>audio{width:100%;height:30px}.studio-media-card>strong{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.studio-media-card .studio-btn{font-size:10px;padding:4px 6px}.studio-script-list{display:flex;flex-direction:column;gap:8px}.studio-sentence>button{align-self:flex-start;font-size:10px;min-height:24px}.studio-sentence textarea{font-size:12px}.studio-item{justify-content:flex-start;overflow-wrap:anywhere;text-align:left}.studio-slot-image{max-width:100%;max-height:150px;object-fit:contain}.studio-stage-heading{display:flex;align-items:center;justify-content:space-between;height:40px;flex:none;padding:0 18px;background:var(--pc-surface-2);border-bottom:1px solid var(--pc-border);font-size:12px}.studio-stage-heading small{font-size:10px;color:var(--pc-muted)}.studio .stage-area{min-height:0!important;padding:14px 18px;gap:14px;background:var(--pc-stage);min-height:160px}.studio .stage-area.comparing{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;gap:16px}.studio .stage-area.comparing .viewer{width:100%;min-height:0;align-self:stretch;justify-content:center;padding:8px;border:1px solid var(--pc-border);border-radius:10px;background:var(--pc-surface-2)}.studio .stage-area.comparing .caption{width:100%;font-weight:600;color:var(--pc-text);padding:0 4px 5px}.studio .stage-area.comparing .note{width:100%;padding-inline:4px}.studio .frame-box{box-shadow:0 2px 7px #0002,0 12px 30px #0001}.studio .caption{font-size:11px}.studio .note{font-size:10px;max-width:350px}.studio .transport{height:76px;min-height:76px;flex-wrap:wrap;align-content:center;background:var(--pc-surface-2);padding:4px 12px;gap:7px}.studio .transport .readout{font-size:11px;gap:8px;order:2;flex:1 0 calc(100% - 100px)}.studio .transport #jump{order:3;width:80px;font-size:10px}.studio .transport .speed{order:1;font-size:10px}.studio .transport .tbtn{min-width:24px;padding:0 4px}.studio .transport #back10,.studio .transport #fwd10{display:none}.studio .transport .slider-wrap{min-width:50px}\n.studio-timeline-wrap{position:relative;display:flex;flex-direction:column;min-height:0;border-top:1px solid var(--pc-border);background:var(--pc-surface)}.studio-timeline-toolbar{height:39px;flex:none;display:flex;align-items:center;gap:8px;padding:0 14px;border-bottom:1px solid var(--pc-border);background:var(--pc-surface-2)}.studio-timeline-toolbar .spacer{flex:1}.studio-timeline-toolbar input[type=range]{width:105px;accent-color:var(--pc-accent)}.studio .timeline{min-height:0;flex:1;max-height:none;overflow:auto}.studio .lanes{--label:160px;width:calc(100% * var(--timeline-zoom,1));min-width:100%;padding-bottom:9px}.studio .lane{height:34px;border-color:var(--pc-border)}.studio .lane-label{position:sticky;left:0;z-index:9;background:var(--pc-surface);line-height:33px;font-size:11px;padding-left:15px}.studio .ruler{height:28px;background:var(--pc-surface-2);position:sticky;top:0;z-index:10}.studio .ruler .lane-label{background:var(--pc-surface-2);line-height:27px}.studio .rtick{font-size:10px;color:var(--pc-muted)}.studio .lane.segments{height:70px}.studio .blk.seg{height:58px;top:5px;bottom:auto;line-height:13px;padding:0 4px;border:1px solid #aebfcb;background:#e8eef3;color:#4c6474}.studio .blk.seg img{display:block;position:absolute;left:0;top:0;width:100%;height:39px;object-fit:cover;pointer-events:none}.studio .blk.seg .segment-name{position:absolute;bottom:1px;left:4px;right:2px;font-size:9px;overflow:hidden;text-overflow:ellipsis}.studio .blk.seg.selected{border:2px solid var(--pc-accent);background:#fff0e2}.studio .blk.item{background:#eee8fa;color:#8c70a9;border:1px solid #d8c9ef;font-size:10px;top:5px;bottom:5px}.studio .lane.caption-lane .blk.item{background:#f5efdf;color:#8e7950;border-color:#e6dcc1}.studio .lane.caption-lane .blk.selected{border-color:var(--pc-accent)}.studio .blk.audio{background:#e7f2e9;color:#537b60;border:1px solid #b3d1bd;top:5px;bottom:5px;font-size:10px}.studio .blk.audio.wave-ready{color:transparent}.studio .blk.audio svg{width:100%;height:100%;position:absolute;inset:0;pointer-events:none}.studio .measure,.studio .lane.words-lane{display:none}.studio.show-analysis .measure,.studio.show-analysis .lane.words-lane{display:grid}.studio .band{z-index:2;opacity:.7}.studio .seg-grip{height:66px;top:2px}.studio .playhead{background:#292929;min-width:1px}.studio .selected{outline-color:var(--pc-accent)}\n.studio-footer{height:24px;background:var(--pc-surface-2);border-top:1px solid var(--pc-border);display:flex;align-items:center;justify-content:space-between;padding:0 14px;font-size:10px;color:var(--pc-muted)}.studio-handle{position:absolute;z-index:15;touch-action:none}.studio-handle.vertical{width:5px;top:0;bottom:0;cursor:col-resize}.studio-handle.horizontal{height:5px;left:0;right:0;top:-3px;cursor:row-resize}.studio-handle:hover{background:var(--pc-accent);opacity:.35}.studio.focus-preview .main{grid-template-columns:64px 0 minmax(0,1fr) 0}.studio.focus-preview .studio-content,.studio.focus-preview .panel{visibility:hidden;padding:0;overflow:hidden}.studio.panel-code{--left-width:min(480px,35vw)}\n.studio-code-wrap{display:flex;flex-direction:column;gap:10px;height:100%;padding:14px}.studio-json{flex:1;min-height:240px;white-space:pre;overflow:auto;resize:none;width:100%;font:12px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace!important;border:1px solid var(--pc-border);border-radius:8px;background:var(--pc-surface-2);padding:12px;tab-size:2}.studio-code-status{font-size:11px;color:var(--pc-muted);overflow-wrap:anywhere}.studio-scrim{position:fixed;inset:0;background:#0003;z-index:80}.studio-export{position:fixed;right:0;top:0;bottom:0;width:440px;max-width:100vw;overflow:auto;padding:18px 22px;background:var(--pc-surface);z-index:81;box-shadow:-12px 0 40px #0002;display:flex;flex-direction:column;gap:18px}.studio-export-header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--pc-border);padding-bottom:14px}.studio-export-fields{border:0;margin:0;padding:0;display:flex;flex-direction:column;gap:16px;min-width:0}.studio-export-fields>.studio-field{display:grid;grid-template-columns:95px 1fr;align-items:center;gap:12px;font-size:13px}.studio-segments{display:flex;padding:3px;background:var(--pc-bg);border-radius:8px;gap:3px}.studio-segments button{flex:1;border:0;background:transparent;border-radius:6px;padding:7px}.studio-segments button.selected{background:var(--pc-surface);color:var(--pc-text)}.studio-resolutions{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}.studio-resolutions button{position:relative;padding:5px;min-width:0}.export-gem{color:var(--pc-accent);display:inline-flex;align-items:center;justify-content:center;font-size:20px;line-height:15px;margin-left:3px}.studio-paid-info:empty{display:none}.studio-paid-info{border:1px solid #e9cfb8;background:var(--pc-accent-soft);border-radius:8px;padding:10px;font-size:11px}.studio-paid-info a{color:#df711e;margin-right:12px}.studio-paid-info p{color:var(--pc-text);margin-bottom:6px}.studio-check{display:flex;align-items:center;gap:8px;font-size:12px}.studio-check input{accent-color:var(--pc-accent)}.studio-export>progress{width:100%;accent-color:var(--pc-accent)}.studio-export-result{display:flex;gap:10px;flex-direction:column}.studio-export-result:empty{display:none}#studio-message{position:fixed;left:50%;bottom:35px;transform:translateX(-50%);max-width:min(650px,85vw);padding:11px 16px;background:#292929;color:white;box-shadow:0 5px 20px #0003;border-radius:8px;z-index:100;opacity:0;pointer-events:none;font-size:12px}#studio-message.visible{opacity:1}\n.studio .sel-box.thin .h-n{top:-9px}.studio .sel-box.thin .h-s{top:calc(100% + 9px)}\n@media(max-width:1300px){:root{--left-width:238px;--right-width:272px}.studio-save{display:none}.studio-topbar{gap:6px}.studio-project{max-width:25%}.studio .transport .readout{font-size:10px}.studio .lanes{--label:140px}}\n@media(max-width:1000px){.studio .main{grid-template-columns:55px 225px minmax(150px,1fr)}.studio .main{grid-template-columns:52px 190px minmax(0,1fr) 240px}.studio .panel{position:static;width:auto;display:block}.studio-topbar .studio-btn:not(.primary){padding:4px}.studio-topbar .studio-project{max-width:18%}.studio .readout>span:first-child{display:none}}\n\n.studio-export{left:50%;right:auto;top:50%;bottom:auto;transform:translate(-50%,-50%);width:min(740px,calc(100vw - 32px));max-height:calc(100dvh - 40px);padding:26px 30px;border-radius:16px;box-shadow:0 20px 70px #0003;gap:24px}.studio-export-header{border:0;padding:0}.studio-export-header h2{font-size:24px}.studio-export-header button{border:0;font-size:24px;background:transparent}.export-tabs{padding:4px}.export-tabs button{font-size:17px;font-weight:600}.studio-export-fields{gap:18px}.studio-export-fields>.studio-field{grid-template-columns:135px 1fr;font-size:15px}.studio-export .studio-segments button{position:relative;min-height:36px;font-size:15px}.studio-export>.primary{width:100%;min-height:46px;background:#df7634;border-color:#d66b29;font-size:17px}.studio-export .studio-note{font-size:13px}.export-pro{position:absolute;right:-8px;top:-10px;font-size:10px;border-radius:4px;padding:2px 5px;background:#df7634;color:#fff}.studio-export details{font-size:13px;color:var(--pc-muted)}.studio-export details summary{cursor:pointer}.studio-export details p{margin-top:12px}.studio-export .studio-input{border:0;background:var(--pc-bg);min-height:40px;font-size:15px}@media(max-width:600px){.studio-export{padding:20px}.studio-export-fields>.studio-field{grid-template-columns:90px 1fr}}\n.studio-draft-success{width:min(560px,calc(100vw - 32px));gap:18px;padding:30px}.studio-draft-success .studio-export-header h2{font-size:22px}.studio-draft-success>.studio-note{font-size:15px;line-height:1.7;margin:0}.studio-draft-actions{display:flex;justify-content:flex-end;gap:10px}.studio-draft-actions .studio-btn{padding:11px 18px;border:0;background:var(--pc-bg);font-size:14px}.studio-draft-actions .primary{background:#df7634;color:white}.studio-draft-success [role=status]:empty{display:none}\n";
2
2
  export declare const STUDIO_REFINEMENTS = "\n.studio .timeline-divider{height:20px;border-left:1px solid var(--pc-border);margin:0 5px}.studio .timeline-selection{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--pc-muted)}.studio .grip{z-index:8;opacity:0;width:9px}.studio .lane:has(.blk:hover) .grip,.studio .grip.selected{opacity:1;background:var(--pc-accent-soft);border:1px solid var(--pc-accent)}.studio .seg-grip{z-index:9;background:var(--pc-border);width:7px;margin-left:-7px}.studio .seg-grip:hover{background:var(--pc-accent)}.studio .blk.seg{display:flex;align-items:center;gap:6px;padding:4px 8px}.studio .blk.seg img{width:60px;height:38px;object-fit:cover;flex:none}.studio .segment-name{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.studio .scene-field{font-style:italic}.studio .stage-text-editor{position:absolute;z-index:30;min-height:50px;box-sizing:border-box;resize:vertical;border:2px solid var(--pc-accent);border-radius:3px;padding:4px;background:var(--pc-surface);color:var(--pc-text);font-weight:600;line-height:1.2;box-shadow:0 4px 18px #0002}.studio .panel .colour input[type=text]{min-width:86px}.studio .panel .fld.area textarea{height:64px}.studio .timeline .blk:focus-visible{outline:2px solid var(--pc-accent);outline-offset:2px}@media(max-width:1250px){.studio .timeline-selection{display:none}.studio-timeline-toolbar{gap:4px}.studio-timeline-toolbar .tbtn{padding:0 4px}.studio-timeline-toolbar .studio-btn{padding:4px 7px}}\n\n.studio #app{grid-template-rows:52px minmax(0,1fr) min(300px,36dvh) 24px;grid-template-rows:52px minmax(0,1fr) var(--timeline-height) 24px}\n.studio .main{overflow:hidden}.studio .panel{position:static;min-height:0;z-index:auto;scrollbar-gutter:stable}.studio .left{grid-column:3;grid-row:1}.studio .panel{grid-column:4;grid-row:1}.studio-rail{grid-column:1;grid-row:1}.studio-content{grid-column:2;grid-row:1;min-width:0;max-width:100%}\n.studio-topbar{justify-content:space-between;gap:12px}.studio-project{flex:1;max-width:none}.studio-global-actions{display:flex;gap:6px;align-items:center;margin-left:auto;flex:none}.studio-save{white-space:nowrap}.studio-topbar .primary{margin-left:8px}\n.studio-side-body,.studio-media-list,.studio-media-card,.studio-actions,.studio-shot-copy{min-width:0;max-width:100%}.studio-media-card>video,.studio-media-card>img,.studio-media-card>audio{display:block;min-width:0;max-width:100%;width:100%}.studio-media-card>video{aspect-ratio:16/10;height:132px}.studio-actions{display:grid;grid-template-columns:1fr;gap:6px}.studio-actions .studio-btn{white-space:normal;width:100%}.studio-media-card>strong{display:block;max-width:100%}.studio-resource-tabs{display:flex;gap:6px;padding:12px 14px 0}.studio-resource-tabs button{flex:1;font-size:12px}.studio-resource-tabs .selected{border-color:var(--pc-accent);background:var(--pc-accent-soft)}\n.studio .stage-area{min-width:0;overflow:hidden}.studio .viewer{flex:none}.studio .panel>h2,.studio .panel #selection>h2{display:none}.studio .panel .follow{display:none}.studio .panel .fs{border:0;border-top:1px solid var(--pc-border);padding:14px 0;margin:0 0 6px;min-width:0}.studio .panel .fs legend{font-size:12px;font-weight:600;padding:0 6px 0 0;color:var(--pc-text)}.studio .panel .row{gap:8px;margin:0 0 10px;flex-wrap:wrap}.studio .panel .fld{min-width:68px;flex:1}.studio .panel .fld.wide{flex-basis:100%}.studio .panel .fld input,.studio .panel .fld textarea,.studio .panel .fld select{min-width:0;width:100%;border-radius:7px;background:var(--pc-surface-2);border:1px solid var(--pc-border);padding:7px 8px;height:34px}.studio .panel .fld textarea{height:86px;line-height:1.7;resize:vertical}.studio .panel .fl{font-size:11px;margin-bottom:6px;color:var(--pc-muted)}.studio .panel .rv,.studio .panel .hint{display:none}.studio .panel details{padding:12px 0;border-top:1px solid var(--pc-border)}.studio .panel summary{cursor:pointer;color:var(--pc-muted);font-size:12px;margin-bottom:12px}.studio .sel-title{font-size:14px;font-weight:600;margin-bottom:14px}.studio .edit-status:has(#edit-status:empty){display:none}.studio .status-line:not(.bad){display:none}.studio .panel .chips{display:flex;flex-direction:column;gap:8px}.studio .panel .chip{padding:9px;text-align:left;border-radius:7px}\n.studio .timeline{overflow:scroll;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:auto}.studio .timeline::-webkit-scrollbar{width:11px;height:12px}.studio .timeline::-webkit-scrollbar-track{background:var(--pc-surface-2)}.studio .timeline::-webkit-scrollbar-thumb{background:#aaa9a1;border:3px solid var(--pc-surface-2);border-radius:8px}.studio .lanes{--label:112px;width:calc(100% * var(--timeline-zoom,1));min-width:100%;padding-bottom:20px}.studio .lane{grid-template-columns:var(--label) minmax(0,1fr)}.studio .lane-track{overflow:visible;min-width:0}.studio .lane-label{z-index:11;font-size:12px}.studio .lane.media-lane{height:44px}.studio .lane.caption-lane{height:38px}.studio .blk.item{padding:5px 6px;line-height:20px;cursor:pointer;z-index:3;min-width:3px}.studio .blk.audio{cursor:pointer;z-index:3}.studio .lane.caption-lane .blk.item{font-size:11px;line-height:18px;padding:3px 5px}.studio .blk.selected{outline:none;border:2px solid var(--pc-accent);box-shadow:0 0 0 1px var(--pc-surface);z-index:5}.studio .lane .shade{pointer-events:none;display:none}.studio .playhead-layer{pointer-events:none}.studio .ruler{z-index:15}.studio .lane.segments{height:62px;position:sticky;top:28px;z-index:12;background:var(--pc-surface)}.studio .playhead-layer{z-index:14}.studio .blk.seg{height:50px;cursor:pointer}.studio .blk.seg img{height:30px}.studio .seg-grip{height:58px}.studio-timeline-toolbar{height:42px;min-width:0}.studio-timeline-toolbar .edit-tools{border-right:1px solid var(--pc-border);padding-right:8px}.studio-timeline-toolbar #edit-split{min-height:28px}.studio-timeline-toolbar .tbtn{width:auto;display:inline-flex;align-items:center;justify-content:center;gap:5px;padding:0 7px}.studio-timeline-toolbar .studio-btn{font-size:11px}.studio .edit-tools .tool-group:last-child{display:none}\n.studio-export{width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 40px);padding:22px 24px;gap:18px}.studio-export-header h2{font-size:19px}.studio-export .studio-segments button{font-size:13px;min-height:32px}.studio-export .export-tabs button{font-size:14px}.studio-export-fields{gap:15px}.studio-export-fields>.studio-field{grid-template-columns:80px minmax(0,1fr);font-size:12px}.studio-export .studio-input{min-height:34px;font-size:13px}.studio-export>.primary{min-height:38px;font-size:14px}.studio-export .studio-note{font-size:12px}.studio-paid-info{line-height:1.7}.studio-paid-info p{margin:0 0 7px}.studio-paid-info .studio-btn{font-size:12px}.studio-export-result{font-size:12px}.studio-export-result a{color:var(--pc-accent)}.studio-slot-outline{position:absolute;border:2px solid var(--pc-accent);pointer-events:none;z-index:4}.studio-slot-name{position:absolute;left:-2px;bottom:100%;padding:3px 7px;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:var(--pc-accent);color:white;font-size:11px}.studio-slot-preview{max-width:100%;max-height:160px;object-fit:contain;border-radius:8px}.studio-cloud{max-width:180px;font-size:12px}.studio-element-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}\n@media(max-width:1100px){.studio .main{grid-template-columns:52px 208px minmax(0,1fr) 246px}.studio .panel{display:block;position:static;width:auto}.studio-global-actions{gap:3px}.studio-topbar .studio-btn{padding:5px 7px}.studio-project{max-width:140px}.studio .main>.studio-handle.vertical{display:none}}\n@media(max-width:820px){.studio .main{grid-template-columns:48px 0 minmax(0,1fr) 220px}.studio-content{visibility:hidden}.studio-topbar{gap:6px;padding:0 10px}.studio-brand{font-size:20px}.studio-project{display:none}.studio .lanes{--label:88px}.studio-timeline-toolbar{gap:5px;padding:0 8px}.studio-timeline-toolbar input[type=range]{width:70px}}\n\n.studio:not(.inspecting) .main{grid-template-columns:64px var(--left-width) minmax(0,1fr) 0}.studio:not(.inspecting) .panel,.studio:not(.inspecting) .inspector-resize{display:none}.studio-sentence.selected{border-color:var(--pc-accent);background:var(--pc-accent-soft)}.studio-item.selected{border-color:var(--pc-accent);background:var(--pc-accent-soft)}\n@media(max-width:1100px){.studio:not(.inspecting) .main{grid-template-columns:52px 208px minmax(0,1fr) 0}}@media(max-width:820px){.studio:not(.inspecting) .main{grid-template-columns:48px 0 minmax(0,1fr) 0}}\n\n.studio-cloud{position:relative;display:flex;align-items:center;gap:7px;max-width:310px;min-width:0}.studio-cloud-state{font-size:12px;max-width:185px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.studio-cloud-state.bad{color:var(--err)}.studio-cloud-link{position:absolute;right:0;top:calc(100% + 10px);z-index:90;width:min(420px,calc(100vw - 32px));border:1px solid var(--pc-border);border-radius:8px;padding:12px;background:var(--pc-surface);color:var(--pc-text);box-shadow:0 6px 25px #0002;font-size:12px}.studio-cloud[hidden]{display:none}\n.studio.focus-preview:not(.inspecting) .main{grid-template-columns:64px 0 minmax(0,1fr) 0}\n.studio-topbar .studio-icon-btn{width:34px;height:34px;min-width:34px;padding:0;border:0;background:transparent;color:var(--pc-text);border-radius:6px;flex:none}.studio-topbar .studio-icon-btn svg{width:18px;height:18px}.studio-topbar .studio-icon-btn:hover{background:var(--pc-hover)}.studio-topbar .studio-icon-btn.selected,.studio-topbar .studio-icon-btn[aria-pressed=true]{background:var(--pc-accent-soft);color:var(--pc-accent)}.studio-topbar .studio-icon-btn:focus-visible{outline:2px solid var(--pc-accent);outline-offset:2px}.studio-topbar .studio-icon-btn:disabled{opacity:.4;cursor:default}\n";