@hyperframes/studio 0.8.192 → 0.8.193

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.
@@ -1,4 +1,4 @@
1
- var xe=Object.defineProperty;var Ie=(r,i,e)=>i in r?xe(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var l=(r,i,e)=>Ie(r,typeof i!="symbol"?i+"":i,e);import{S as Oe,r as Ne,a as fe,i as Fe,b as w,c as _e,p as Ve,d as Ue,e as He,f as ze,s as We,g as ge,F as ye}from"./index-CHu83hHM.js";function $e(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function I(r){return typeof r=="object"&&r!==null}function je(r){return I(r)&&typeof r.getDuration=="function"}function Be(r){return I(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function qe(r){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(r))throw new Error(`Invalid HyperFrames runtime version: ${r}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${r}/dist/hyperframe.runtime.iife.js`}const W=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:qe("0.0.0-dev");function j(r){if(r===null)return null;const i=Number.parseInt(r,10);return Number.isFinite(i)&&i>0?i:null}function Ge(r){const i=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!i)return null;const e=j(i.getAttribute("data-width")),t=j(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}function Ye(r){return Array.isArray(r)?r.find(i=>typeof i=="string"&&i.trim()!==""&&i!=="[object Event]")??null:null}class Xe{constructor(i,e){l(this,"_interval",null);l(this,"_runtimeInjected",!1);l(this,"_runtimeScript",null);l(this,"_failure",null);this._iframe=i,this._callbacks=e}get failed(){return this._failure!==null&&this._failure.document===this._iframe.contentDocument}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._failure=null,this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{i++;let e=null;try{e=this._poll(i)}catch(t){t instanceof DOMException&&t.name==="SecurityError"||(e={kind:"error",message:t instanceof Error?t.message:String(t)})}e??(e=this._deadlineOutcome(i)),e&&(this.stop(),e.kind==="error"?(this._failure={document:this._iframe.contentDocument},this._callbacks.onError(e.message)):this._callbacks.onReady(e.result))},200)}_deadlineOutcome(i){var e,t;return i<40||(t=(e=this._callbacks).hostOwnsDeadline)!=null&&t.call(e)?null:{kind:"error",message:"Composition timeline not found after 8s"}}_poll(i){const e=this._iframe.contentWindow;if(!e)return null;const t=Ye(Reflect.get(e,Oe));if(t!==null)return{kind:"error",message:t};const s=this._iframe.contentDocument,n=Reflect.get(e,"__timelines"),o=this.hasRuntimeBridge(e);if($e({hasRuntime:o,hasTimelines:I(n)&&Object.keys(n).length>0,hasNestedCompositions:!!(s!=null&&s.querySelector("[data-composition-src]")),runtimeInjected:this._runtimeInjected,attempts:i}))return this._injectRuntime(),null;if(this._runtimeInjected&&!o)return null;const a=this._resolveReadyResult(e,s);return a?{kind:"ready",result:a}:null}_resolveReadyResult(i,e){var n;const t=this._resolvePlaybackDurationAdapter(i)??{kind:"document",getDuration:()=>0};let s=t.getDuration();if(!Number.isFinite(s)||s<=0){if(t.kind==="direct-timeline")return null;s=e?((n=Ne(e))==null?void 0:n.durationSeconds)??0:0}return s<=0?null:{duration:s,adapter:{...t,getDuration:()=>s},compositionSize:Ge(e)}}stop(){this._runtimeScript&&(this._runtimeScript.onerror=null,this._runtimeScript=null),this.failed||(this._failure=null),this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return I(Reflect.get(i,"__player"))}_injectRuntime(){var i,e,t,s;this._runtimeInjected=!0;try{const n=this._iframe.contentDocument;if(!n)return;const o=n.createElement("script");o.src=((e=(i=this._callbacks).resolveRuntimeUrl)==null?void 0:e.call(i))??W,this._runtimeScript=o,o.onerror=()=>{this._runtimeScript!==o||this._iframe.contentDocument!==n||(this.stop(),this._failure={document:n},this._callbacks.onError("HyperFrames runtime failed to load from "+o.src))},(n.head||n.documentElement).appendChild(o),(s=(t=this._callbacks).onRuntimeInjected)==null||s.call(t)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var a,c;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!I(e))return null;const t=Object.keys(e);if(t.length===0)return null;const s=(c=(a=this._iframe.contentDocument)==null?void 0:a.querySelector("[data-composition-id]"))==null?void 0:c.getAttribute("data-composition-id"),n=s&&s in e?s:t[t.length-1],o=e[n];return Be(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(je(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Ze=`
1
+ var xe=Object.defineProperty;var Ie=(r,i,e)=>i in r?xe(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var l=(r,i,e)=>Ie(r,typeof i!="symbol"?i+"":i,e);import{S as Oe,r as Ne,a as fe,i as Fe,b as w,c as _e,p as Ve,d as Ue,e as He,f as ze,s as We,g as ge,F as ye}from"./index-Ca-mgTnS.js";function $e(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function I(r){return typeof r=="object"&&r!==null}function je(r){return I(r)&&typeof r.getDuration=="function"}function Be(r){return I(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function qe(r){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(r))throw new Error(`Invalid HyperFrames runtime version: ${r}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${r}/dist/hyperframe.runtime.iife.js`}const W=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:qe("0.0.0-dev");function j(r){if(r===null)return null;const i=Number.parseInt(r,10);return Number.isFinite(i)&&i>0?i:null}function Ge(r){const i=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!i)return null;const e=j(i.getAttribute("data-width")),t=j(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}function Ye(r){return Array.isArray(r)?r.find(i=>typeof i=="string"&&i.trim()!==""&&i!=="[object Event]")??null:null}class Xe{constructor(i,e){l(this,"_interval",null);l(this,"_runtimeInjected",!1);l(this,"_runtimeScript",null);l(this,"_failure",null);this._iframe=i,this._callbacks=e}get failed(){return this._failure!==null&&this._failure.document===this._iframe.contentDocument}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._failure=null,this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{i++;let e=null;try{e=this._poll(i)}catch(t){t instanceof DOMException&&t.name==="SecurityError"||(e={kind:"error",message:t instanceof Error?t.message:String(t)})}e??(e=this._deadlineOutcome(i)),e&&(this.stop(),e.kind==="error"?(this._failure={document:this._iframe.contentDocument},this._callbacks.onError(e.message)):this._callbacks.onReady(e.result))},200)}_deadlineOutcome(i){var e,t;return i<40||(t=(e=this._callbacks).hostOwnsDeadline)!=null&&t.call(e)?null:{kind:"error",message:"Composition timeline not found after 8s"}}_poll(i){const e=this._iframe.contentWindow;if(!e)return null;const t=Ye(Reflect.get(e,Oe));if(t!==null)return{kind:"error",message:t};const s=this._iframe.contentDocument,n=Reflect.get(e,"__timelines"),o=this.hasRuntimeBridge(e);if($e({hasRuntime:o,hasTimelines:I(n)&&Object.keys(n).length>0,hasNestedCompositions:!!(s!=null&&s.querySelector("[data-composition-src]")),runtimeInjected:this._runtimeInjected,attempts:i}))return this._injectRuntime(),null;if(this._runtimeInjected&&!o)return null;const a=this._resolveReadyResult(e,s);return a?{kind:"ready",result:a}:null}_resolveReadyResult(i,e){var n;const t=this._resolvePlaybackDurationAdapter(i)??{kind:"document",getDuration:()=>0};let s=t.getDuration();if(!Number.isFinite(s)||s<=0){if(t.kind==="direct-timeline")return null;s=e?((n=Ne(e))==null?void 0:n.durationSeconds)??0:0}return s<=0?null:{duration:s,adapter:{...t,getDuration:()=>s},compositionSize:Ge(e)}}stop(){this._runtimeScript&&(this._runtimeScript.onerror=null,this._runtimeScript=null),this.failed||(this._failure=null),this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return I(Reflect.get(i,"__player"))}_injectRuntime(){var i,e,t,s;this._runtimeInjected=!0;try{const n=this._iframe.contentDocument;if(!n)return;const o=n.createElement("script");o.src=((e=(i=this._callbacks).resolveRuntimeUrl)==null?void 0:e.call(i))??W,this._runtimeScript=o,o.onerror=()=>{this._runtimeScript!==o||this._iframe.contentDocument!==n||(this.stop(),this._failure={document:n},this._callbacks.onError("HyperFrames runtime failed to load from "+o.src))},(n.head||n.documentElement).appendChild(o),(s=(t=this._callbacks).onRuntimeInjected)==null||s.call(t)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var a,c;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!I(e))return null;const t=Object.keys(e);if(t.length===0)return null;const s=(c=(a=this._iframe.contentDocument)==null?void 0:a.querySelector("[data-composition-id]"))==null?void 0:c.getAttribute("data-composition-id"),n=s&&s in e?s:t[t.length-1],o=e[n];return Be(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(je(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Ze=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;