// @bun
var{defineProperty:XJ,getOwnPropertyNames:XX,getOwnPropertyDescriptor:ZX}=Object,$X=Object.prototype.hasOwnProperty;function YX(J){return this[J]}var fX=(J)=>{var X=(OJ??=new WeakMap).get(J),Z;if(X)return X;if(X=XJ({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function"){for(var $ of XX(J))if(!$X.call(X,$))XJ(X,$,{get:YX.bind(J,$),enumerable:!(Z=ZX(J,$))||Z.enumerable})}return OJ.set(J,X),X},OJ;var KX=(J)=>J;function GX(J,X){this[J]=KX.bind(null,X)}var QX=(J,X)=>{for(var Z in X)XJ(J,Z,{get:X[Z],enumerable:!0,configurable:!0,set:GX.bind(X,Z)})};var q=(J,X)=>()=>(J&&(X=J(J=0)),X);var u=import.meta.require;function WX(J){if(d.set(J.name,J),J.client)ZJ.set(J.name,J.client)}function hX(J){return d.get(J)}function mX(){return Array.from(d.values())}function uX(J){return ZJ.delete(J),d.delete(J)}function R(J){return WX(J),{name:J.name,hasEndTag:J.hasEndTag??!0,description:J.description,handler:async(Z,$,K,Y)=>{let Q=zX($,J.defaults);if(J.validate){let G=J.validate(Q);if(G!==!0){let z=typeof G==="string"?G:`Invalid parameters for @${J.name}`;throw Error(z)}}let W=Z;if(J.transform)W=await J.transform(Z,Q,K,Y);if(J.clientScript){let G=J.clientScript(Q);W+=`<script>${G}</script>`}if(J.css){let G=J.css(Q);W+=`<style>${G}</style>`}return W}}}function dX(J,X){let Z=typeof X==="function"?{mounted:X}:X;return ZJ.set(J,Z),Z}function zX(J,X){let Z={...X};for(let $ of J){let K=$.indexOf(":"),Y=$.indexOf("="),Q=K>=0&&(Y<0||K<Y)?K:Y;if(Q>=0){let W=$.slice(0,Q).trim(),G=$.slice(Q+1).trim();if(G==="true")G=!0;else if(G==="false")G=!1;else if(G==="null")G=null;else if(!Number.isNaN(Number(G)))G=Number(G);else if(typeof G==="string"&&G.startsWith("{"))try{G=JSON.parse(G)}catch{}Z[W]=G}else{let W=Object.keys(Z).filter((G)=>!X||!(G in X)).length;Z[W===0?"value":`arg${W}`]=$}}return Z}function lX(){return[R({name:"uppercase",description:"Convert content to uppercase",transform:(J)=>J.toUpperCase()}),R({name:"lowercase",description:"Convert content to lowercase",transform:(J)=>J.toLowerCase()}),R({name:"capitalize",description:"Capitalize first letter of content",transform:(J)=>J.charAt(0).toUpperCase()+J.slice(1)}),R({name:"trim",description:"Remove leading and trailing whitespace",transform:(J)=>J.trim()}),R({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:(J,{length:X,suffix:Z})=>J.length>X?J.slice(0,X)+Z:J}),R({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:(J,{color:X})=>`<mark style="background-color: ${X}; padding: 0.1em 0.2em; border-radius: 0.2em;">${J}</mark>`}),R({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:(J,{variant:X,color:Z})=>{let $={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Z?`background: ${Z}; color: white;`:$[X]||$.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${J}</span>`}}),R({name:"code",description:"Style content as inline code",transform:(J)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${J}</code>`}),R({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:(J,{text:X,position:Z})=>`<span class="stx-tooltip" data-tooltip="${X}" data-tooltip-position="${Z}" style="position: relative; cursor: help;">${J}</span>`,css:()=>`
        .stx-tooltip::after {
          content: attr(data-tooltip);
          position: absolute;
          bottom: 100%;
          left: 50%;
          transform: translateX(-50%);
          padding: 0.5em 0.75em;
          background: #1f2937;
          color: white;
          font-size: 0.75rem;
          border-radius: 0.25rem;
          white-space: nowrap;
          opacity: 0;
          visibility: hidden;
          transition: opacity 0.2s, visibility 0.2s;
          z-index: 1000;
          margin-bottom: 0.25rem;
        }
        .stx-tooltip:hover::after {
          opacity: 1;
          visibility: visible;
        }
      `}),R({name:"clipboard",description:"Add copy to clipboard functionality",defaults:{label:"Copy"},transform:(J,{label:X})=>{let Z=`clipboard-${Date.now()}-${Math.random().toString(36).slice(2)}`;return`
          <span class="stx-clipboard" data-clipboard-id="${Z}">
            <span class="stx-clipboard-content">${J}</span>
            <button type="button" class="stx-clipboard-btn" onclick="navigator.clipboard.writeText(document.querySelector('[data-clipboard-id=\\'${Z}\\'] .stx-clipboard-content').textContent).then(() => { this.textContent = 'Copied!'; setTimeout(() => this.textContent = '${X}', 2000); })">${X}</button>
          </span>
        `},css:()=>`
        .stx-clipboard {
          display: inline-flex;
          align-items: center;
          gap: 0.5em;
        }
        .stx-clipboard-btn {
          padding: 0.25em 0.5em;
          font-size: 0.75em;
          background: #e5e7eb;
          border: none;
          border-radius: 0.25em;
          cursor: pointer;
        }
        .stx-clipboard-btn:hover {
          background: #d1d5db;
        }
      `}),R({name:"time",description:"Display relative time",defaults:{date:""},hasEndTag:!1,transform:(J,{date:X})=>{let Z=X?new Date(X).getTime():Date.now();return`<time datetime="${new Date(Z).toISOString()}" data-stx-relative-time="${Z}"></time>`},clientScript:()=>`
        document.querySelectorAll('[data-stx-relative-time]').forEach(el => {
          const timestamp = parseInt(el.dataset.stxRelativeTime);
          const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });
          const diff = timestamp - Date.now();
          const seconds = Math.floor(diff / 1000);
          const minutes = Math.floor(seconds / 60);
          const hours = Math.floor(minutes / 60);
          const days = Math.floor(hours / 24);

          if (Math.abs(days) > 0) el.textContent = rtf.format(days, 'day');
          else if (Math.abs(hours) > 0) el.textContent = rtf.format(hours, 'hour');
          else if (Math.abs(minutes) > 0) el.textContent = rtf.format(minutes, 'minute');
          else el.textContent = rtf.format(seconds, 'second');
        });
      `}),R({name:"currency",description:"Format number as currency",defaults:{amount:0,currency:"USD",locale:"en-US"},hasEndTag:!1,transform:(J,{amount:X,currency:Z,locale:$})=>{return new Intl.NumberFormat($,{style:"currency",currency:Z}).format(X)}}),R({name:"number",description:"Format number with locale",defaults:{value:0,decimals:2,locale:"en-US"},hasEndTag:!1,transform:(J,{value:X,decimals:Z,locale:$})=>{return new Intl.NumberFormat($,{minimumFractionDigits:Z,maximumFractionDigits:Z}).format(X)}}),R({name:"pluralize",description:"Pluralize text based on count",defaults:{count:0,singular:"",plural:""},hasEndTag:!1,transform:(J,{count:X,singular:Z,plural:$})=>{let K=X===1?Z:$||Z+"s";return`${X} ${K}`}})]}function pX(){return`
// STX Directive Runtime
(function() {
  if (typeof window === 'undefined') return;

  window.STX = window.STX || {};
  window.STX.directives = window.STX.directives || {};

  // Register a client-side directive
  window.STX.directive = function(name, definition) {
    if (typeof definition === 'function') {
      definition = { mounted: definition };
    }
    window.STX.directives[name] = definition;
  };

  // Apply directive to element
  window.STX.applyDirective = function(el, name, value, arg, modifiers) {
    const directive = window.STX.directives[name];
    if (!directive) {
      console.warn('[stx] Unknown directive:', name);
      return;
    }

    const binding = {
      value: value,
      arg: arg,
      modifiers: modifiers || {},
      dir: directive
    };

    // Store binding on element for updates
    el.__stx_directives__ = el.__stx_directives__ || {};
    el.__stx_directives__[name] = binding;

    // Call lifecycle hooks
    if (directive.created) directive.created(el, binding);
    if (directive.beforeMount) directive.beforeMount(el, binding);

    // Defer mounted until DOM is ready
    requestAnimationFrame(function() {
      if (directive.mounted) directive.mounted(el, binding);
    });
  };

  // Update directive on element
  window.STX.updateDirective = function(el, name, newValue) {
    const binding = el.__stx_directives__ && el.__stx_directives__[name];
    if (!binding) return;

    const directive = binding.dir;
    const oldValue = binding.value;
    binding.oldValue = oldValue;
    binding.value = newValue;

    if (directive.beforeUpdate) directive.beforeUpdate(el, binding);
    if (directive.updated) directive.updated(el, binding);
  };

  // Remove directive from element
  window.STX.removeDirective = function(el, name) {
    const binding = el.__stx_directives__ && el.__stx_directives__[name];
    if (!binding) return;

    const directive = binding.dir;
    if (directive.beforeUnmount) directive.beforeUnmount(el, binding);
    if (directive.unmounted) directive.unmounted(el, binding);

    delete el.__stx_directives__[name];
  };

  // Auto-apply directives on page load
  document.addEventListener('DOMContentLoaded', function() {
    document.querySelectorAll('[data-stx-directive]').forEach(function(el) {
      const directives = el.dataset.stxDirective.split(';');
      directives.forEach(function(d) {
        const [name, value] = d.split(':').map(s => s.trim());
        window.STX.applyDirective(el, name, value);
      });
    });
  });

  console.log('[stx] Directive runtime initialized');
})();
`}function cX(J){let X=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return J.replace(X,(Z,$,K,Y,Q)=>{let G=(Y?Y.split("."):[]).reduce((z,j)=>{return z[j]=!0,z},{});return`data-stx-directive="${$}:${Q}" data-stx-directive-arg="${K||""}" data-stx-directive-modifiers='${JSON.stringify(G)}'`})}var d,ZJ;var EJ=q(()=>{d=new Map,ZJ=new Map});import{createHash as $J}from"crypto";import{readFile as _X,stat as kJ}from"fs/promises";async function S(J){try{let X=await _X(J);return $J("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function rX(J){return $J("sha256").update(J).digest("hex").slice(0,16)}function HJ(J){return $J("sha256").update(J).digest("hex").slice(0,16)}function l(J,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${HJ(J)}-${HJ(Z)}`}async function YJ(J){try{return(await kJ(J)).mtimeMs}catch{return 0}}async function V(J){try{return await kJ(J),!0}catch{return!1}}var g=()=>{};import{mkdir as MX,readFile as UJ,writeFile as NX,readdir as FJ,rm as KJ,stat as LX}from"fs/promises";import{join as v,dirname as wX}from"path";async function jX(J){try{await MX(J,{recursive:!0})}catch{}}function IJ(J,X,Z){return v(J,Z,`${X}.json`)}async function AJ(J,X,Z){if((Date.now()-J.createdAt)/86400000>Z)return!1;if(await YJ(X)!==J.srcMtime)return!1;return!0}async function TJ(J,X,Z,$=y){if(!$.enabled)return null;let K=l(J,X),Y=C.get(K);if(Y){if(await AJ(Y,J,$.maxAge))return Y.lastAccessedAt=Date.now(),Y.data;C.delete(K)}let Q=IJ($.directory,K,Z);if(await V(Q))try{let W=await UJ(Q,"utf-8"),G=JSON.parse(W);if(await AJ(G,J,$.maxAge))return G.lastAccessedAt=Date.now(),C.set(K,G),G.data}catch{}return null}async function RJ(J,X,Z,$,K=y){if(!K.enabled)return;let Y=l(J,X),Q=await S(J),W=await YJ(J),G={key:Y,src:J,srcHash:Q,srcMtime:W,optionsHash:l("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};C.set(Y,G);let z=IJ(K.directory,Y,$);try{await jX(wX(z)),await NX(z,JSON.stringify(G,null,2))}catch(j){console.warn(`[stx-media] Failed to write cache: ${j}`)}}async function JZ(J,X,Z=y){for(let[$,K]of C.entries())if(K.src===J)C.delete($)}async function SJ(J,X=y){if(J==="all")C.clear();else C.clear();let Z=J==="all"?["image","video"]:[J];for(let $ of Z){let K=v(X.directory,$);try{await KJ(K,{recursive:!0,force:!0})}catch{}}}async function XZ(J=y){let X={memoryEntries:C.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Z of["image","video"]){let $=v(J.directory,Z);try{let K=await FJ($);X.diskEntries[Z]=K.length;for(let Y of K){let Q=v($,Y),W=await LX(Q);X.totalSizeMB+=W.size/1048576}}catch{}}return X}async function ZZ(J=y){let X=0,Z=J.maxAge*24*60*60*1000;for(let $ of["image","video"]){let K=v(J.directory,$);try{let Y=await FJ(K);for(let Q of Y){let W=v(K,Q);try{let G=await UJ(W,"utf-8"),z=JSON.parse(G);if(Date.now()-z.createdAt>Z)await KJ(W),C.delete(z.key),X++}catch{await KJ(W).catch(()=>{}),X++}}}catch{}}return X}var C,y;var VJ=q(()=>{g();C=new Map,y={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class c{config;constructor(J={}){this.config={...BX,...J}}async get(J,X){return TJ(J,X,"video",this.config)}async set(J,X,Z){return RJ(J,X,Z,"video",this.config)}async clear(){return SJ("video",this.config)}updateConfig(J){this.config={...this.config,...J}}}function GJ(J){if(!p)p=new c(J);else if(J)p.updateConfig(J);return p}async function a(J,X,Z){let $=Z?{directory:`${Z.outputDir}/../.cache`}:{};return GJ($).get(J,X)}async function n(J,X,Z,$){let K=$?{directory:`${$.outputDir}/../.cache`}:{};return GJ(K).set(J,X,Z)}async function qJ(){return GJ().clear()}var BX,p=null;var QJ=q(()=>{VJ();BX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as WJ,basename as zJ,extname as _J,join as i}from"path";import{mkdir as MJ}from"fs/promises";async function NJ(){try{return await import("ts-videos")}catch{return null}}async function r(J,X,Z,$){let K=await NJ();if(!K)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Y=WJ(J);if(!await V(Y))return null;await MJ(Z,{recursive:!0});let Q=await S(Y),W=zJ(J,_J(J)),G=X.format||"webp",z=X.timestamp||0,j=`${W}-poster-${Q}.${G}`,_=i(Z,j),L=await K.extractThumbnails(Y,{timestamps:[z],width:X.width||1280,height:X.height,format:G,quality:X.quality||85,outputDir:Z,outputPattern:j.replace(`.${G}`,"")});if(L&&L.length>0){let M=L[0];return{path:_,url:`${$}/${j}`,width:M.width||X.width||1280,height:M.height||720,timestamp:z,size:M.size||0}}return null}catch(Y){return console.warn(`[stx-media] Failed to generate poster: ${Y}`),null}}async function o(J,X,Z,$){let K=await NJ();if(!K)return[];try{let Y=WJ(J);if(!await V(Y))return[];await MJ(Z,{recursive:!0});let Q=await S(Y),W=zJ(J,_J(J)),G=X.format||"webp",_=(await new K.Input(Y).getInfo()).duration||60,L=X.count||10,M=X.interval||_/L,O=[];for(let B=0;B<L&&B*M<_;B++)O.push(B*M);let N=await K.extractThumbnails(Y,{timestamps:O,width:X.width||320,format:G,quality:X.quality||80,outputDir:Z,outputPattern:`${W}-thumb-${Q}`});if(N&&N.length>0)return N.map((B,k)=>({path:B.path||i(Z,`${W}-thumb-${Q}-${k}.${G}`),url:`${$}/${W}-thumb-${Q}-${k}.${G}`,width:B.width||X.width||320,height:B.height||180,timestamp:O[k],size:B.size||0}));return[]}catch(Y){return console.warn(`[stx-media] Failed to generate thumbnails: ${Y}`),[]}}async function CJ(J,X,Z,$){let K=await NJ();if(!K)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Y=WJ(J);if(!await V(Y))return null;await MJ(Z,{recursive:!0});let Q=await S(Y),W=zJ(J,_J(J)),j=(await new K.Input(Y).getInfo()).duration||60,_=X.columns||10,L=X.interval||5,M=X.thumbnailWidth||160,O=X.thumbnailHeight||90,N=X.format||"jpeg",B=Math.ceil(j/L),k=Math.ceil(B/_),U=`${W}-sprite-${Q}.${N}`,H=i(Z,U),I=[];for(let w=0;w<B;w++)I.push(w*L);let E=await K.extractThumbnails(Y,{timestamps:I,width:M,height:O,format:N,quality:X.quality||70,outputDir:i(Z,".temp")});if(!E||E.length===0)return null;try{let w=await import("ts-images"),T=_*M,x=k*O,h=await w.createSprite({images:E.map((D)=>D.path),columns:_,padding:0,outputPath:H,format:N,quality:X.quality||70});return{url:`${$}/${U}`,path:H,columns:_,rows:k,thumbnailWidth:M,thumbnailHeight:O,interval:L,totalFrames:B}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Y){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Y}`),null}}var LJ=q(()=>{g()});import{resolve as xJ,basename as DJ,extname as PJ,join as b}from"path";import{mkdir as s,writeFile as vJ}from"fs/promises";async function yJ(){try{return await import("ts-videos")}catch{return null}}async function t(J,X,Z,$,K){let Y=await yJ();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=xJ(J);if(!await V(Q))return null;let W=await S(Q),G=DJ(J,PJ(J)),z=b(Z,`${G}-${W}-hls`);await s(z,{recursive:!0});let j=X.length>0?X:fJ,_=K?.segmentDuration||6,O=(await new Y.Input(Q).getInfo()).duration||0,N=[],B=0;for(let H of j){let I=b(z,H.label);await s(I,{recursive:!0});let E=`${H.label}.m3u8`,w=b(I,E);try{let T=await Y.generateHLS(Q,{outputDir:I,segmentDuration:_,width:H.width,height:H.height,videoBitrate:H.bitrate,audioBitrate:H.audioBitrate,playlistName:H.label});if(T)N.push({quality:H,url:`${$}/${G}-${W}-hls/${H.label}/${E}`,path:w}),B+=T.segmentCount||Math.ceil(O/_)}catch(T){console.warn(`[stx-media] Failed to generate HLS for ${H.label}: ${T}`)}}if(N.length===0)return null;let k=b(z,"master.m3u8"),U=OX(N,$,G,W);return await vJ(k,U),{manifestUrl:`${$}/${G}-${W}-hls/master.m3u8`,manifestPath:k,playlists:N,segmentCount:B,duration:O}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function OX(J,X,Z,$){let K=["#EXTM3U","#EXT-X-VERSION:3"];for(let Y of J){let{quality:Q}=Y,W=Q.bitrate+(Q.audioBitrate||128000),G=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;K.push(`#EXT-X-STREAM-INF:BANDWIDTH=${W},RESOLUTION=${G},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return K.join(`
`)}async function e(J,X,Z,$,K){let Y=await yJ();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=xJ(J);if(!await V(Q))return null;let W=await S(Q),G=DJ(J,PJ(J)),z=b(Z,`${G}-${W}-dash`);await s(z,{recursive:!0});let j=X.length>0?X:fJ,_=K?.segmentDuration||4,L=K?.minBufferTime||2,N=(await new Y.Input(Q).getInfo()).duration||0,B=[],k=[];for(let E of j){let w=b(z,E.label);await s(w,{recursive:!0});try{if(await Y.generateDASH(Q,{outputDir:w,segmentDuration:_,width:E.width,height:E.height,videoBitrate:E.bitrate,audioBitrate:E.audioBitrate})){if(B.push({bandwidth:E.bitrate,width:E.width,height:E.height||Math.round(E.width*9/16),url:`${$}/${G}-${W}-dash/${E.label}/video`}),E.audioBitrate)k.push({bandwidth:E.audioBitrate,url:`${$}/${G}-${W}-dash/${E.label}/audio`})}}catch(T){console.warn(`[stx-media] Failed to generate DASH for ${E.label}: ${T}`)}}if(B.length===0)return null;let U=b(z,"manifest.mpd"),H=EX(B,k,N,_,L);await vJ(U,H);let I=[{type:"video",representations:B}];if(k.length>0)I.push({type:"audio",representations:k});return{manifestUrl:`${$}/${G}-${W}-dash/manifest.mpd`,manifestPath:U,adaptationSets:I,duration:N}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function EX(J,X,Z,$,K){let Y=bJ(Z),Q=bJ(K),W=`<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
     type="static"
     mediaPresentationDuration="${Y}"
     minBufferTime="${Q}"
     profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
  <Period>
    <AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
`;for(let G=0;G<J.length;G++){let z=J[G];W+=`      <Representation id="video${G}" bandwidth="${z.bandwidth}" width="${z.width}" height="${z.height}">
        <BaseURL>${z.url}/</BaseURL>
        <SegmentBase indexRange="0-999">
          <Initialization range="0-999"/>
        </SegmentBase>
      </Representation>
`}if(W+=`    </AdaptationSet>
`,X.length>0){W+=`    <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
`;for(let G=0;G<X.length;G++){let z=X[G];W+=`      <Representation id="audio${G}" bandwidth="${z.bandwidth}">
        <BaseURL>${z.url}/</BaseURL>
        <SegmentBase indexRange="0-999">
          <Initialization range="0-999"/>
        </SegmentBase>
      </Representation>
`}W+=`    </AdaptationSet>
`}return W+=`  </Period>
</MPD>`,W}function bJ(J){let X=Math.floor(J/3600),Z=Math.floor(J%3600/60),$=Math.floor(J%60),K="PT";if(X>0)K+=`${X}H`;if(Z>0)K+=`${Z}M`;return K+=`${$}S`,K}var fJ;var wJ=q(()=>{g();fJ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as gJ,basename as HX,extname as kX,join as AX}from"path";import{mkdir as UX}from"fs/promises";async function hJ(){try{return await import("ts-videos")}catch{return null}}function FX(J){switch(J){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function IX(J){switch(J){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function jJ(J){let X=await hJ();if(!X)return null;try{let Z=gJ(J),K=await new X.Input(Z).getInfo();return{duration:K.duration||0,width:K.width||0,height:K.height||0,frameRate:K.frameRate||0,bitrate:K.bitrate||0,codec:K.videoCodec||"",audioCodec:K.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function mJ(J,X,Z,$){let K=await hJ();if(!K)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:J,processed:!1};let Y=await a(J,X,Z);if(Y)return Y;try{let Q=gJ(J);if(!await V(Q))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let W=Z.outputDir||"dist/videos",G=Z.baseUrl||"/videos";await UX(W,{recursive:!0});let z=await S(Q),j=HX(J,kX(J)),_={src:J,processed:!0,hash:z};$?.({percentage:5,stage:"analyzing"}),_.metadata=await jJ(Q)||void 0;let L={};if(X.quality)L.bitrate=FX(X.quality);if(X.platform)Object.assign(L,IX(X.platform));if(X.transcode)Object.assign(L,X.transcode);if(Object.keys(L).length>0||X.process){$?.({percentage:10,stage:"transcoding"});let M=`${j}-${z}.mp4`,O=AX(W,M);try{let N=await TX(Q,O,L,K,(B)=>$?.({percentage:10+B*0.5,stage:"transcoding"}));if(N)_.transcoded={path:O,url:`${G}/${M}`,duration:N.duration,size:N.size,video:{codec:L.codec||"h264",width:N.width,height:N.height,bitrate:N.bitrate,frameRate:N.frameRate},audio:N.audioCodec?{codec:L.audioCodec||"aac",bitrate:L.audioBitrate||128000,sampleRate:L.sampleRate||48000,channels:L.channels||2}:void 0}}catch(N){_.errors=_.errors||[],_.errors.push(`Transcoding failed: ${N}`)}}if(X.generatePoster){$?.({percentage:65,stage:"generating-poster"});let M=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},O=await r(Q,M,W,G);if(O)_.poster=O}if(Z.thumbnails?.enabled){$?.({percentage:70,stage:"generating-thumbnails"});let M=await o(Q,Z.thumbnails,W,G);if(M.length>0)_.thumbnails=M}if(X.streaming){$?.({percentage:80,stage:"generating-manifests"});let M=typeof X.streaming==="object"?X.streaming:Z.streaming||{format:"hls"};if(M.format==="hls"||M.format===void 0){let O=await t(Q,M.qualities||Z.streaming?.defaultQualities||[],W,G);if(O)_.streaming={..._.streaming,hls:O}}if(M.format==="dash"){let O=await e(Q,M.qualities||Z.streaming?.defaultQualities||[],W,G);if(O)_.streaming={..._.streaming,dash:O}}}if(X.spriteSheet)$?.({percentage:90,stage:"generating-sprite-sheet"});return $?.({percentage:100,stage:"complete"}),await n(J,X,_,Z),_}catch(Q){return{src:J,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function TX(J,X,Z,$,K){try{let Q=await new $.Conversion(J,X,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((W)=>{K?.(W.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(Y){return console.error(`[stx-media] Transcoding failed: ${Y}`),null}}var uJ=q(()=>{g();QJ();LJ();wJ()});var dJ={};QX(dJ,{setCachedVideoResult:()=>n,processVideo:()=>mJ,getCachedVideoResult:()=>a,generateThumbnails:()=>o,generateSpriteSheet:()=>CJ,generatePoster:()=>r,generateHLSManifest:()=>t,generateDASHManifest:()=>e,clearVideoCache:()=>qJ,analyzeVideo:()=>jJ,VideoProcessorCache:()=>c});var lJ=q(()=>{uJ();LJ();wJ();QJ()});function aJ(){return R({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(J,X,Z,$)=>{let{src:K,options:Y}=RX(J,X,Z);if(!K)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:K,poster:Y.poster,controls:Y.controls!==!1,autoplay:Y.autoplay||!1,muted:Y.muted||!1,loop:Y.loop||!1,preload:Y.preload||"metadata",playsinline:Y.playsinline!==!1,lazy:Y.lazy!==!1,player:Y.player||"native",type:Y.type,width:Y.width,height:Y.height,class:Y.class,style:Y.style,id:Y.id,crossorigin:Y.crossorigin,disablePictureInPicture:Y.disablePictureInPicture,disableRemotePlayback:Y.disableRemotePlayback,title:Y.title,quality:Y.quality,platform:Y.platform,process:Y.process,generatePoster:Y.generatePoster,streaming:Y.streaming,transcode:Y.transcode,spriteSheet:Y.spriteSheet,waveform:Y.waveform},G={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},z=await JJ(Q,G),j=z.html;if(z.css)j+=`
<style>${z.css}</style>`;if(z.script)j+=`
<script>${z.script}</script>`;return j},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function RX(J,X,Z){if(X.src)return{src:String(X.src),options:X.options||{}};let $=J.trim();if($.startsWith("@video(")||$.startsWith("("))$=$.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let K=SX($),Y=pJ(K[0],Z)||"",Q={};if(K[1]){let W=pJ(K[1],Z);if(typeof W==="object"&&W!==null)Q=W;else if(typeof K[1]==="string")try{Q=JSON.parse(K[1])}catch{}}return{src:Y,options:Q}}function SX(J){let X=[],Z="",$=!1,K="",Y=0,Q=0;for(let W=0;W<J.length;W++){let G=J[W],z=W>0?J[W-1]:"";if((G==='"'||G==="'"||G==="`")&&z!=="\\"){if(!$)$=!0,K=G;else if(G===K)$=!1,K="";else Z+=G;continue}if(!$){if(G==="{")Y++;if(G==="}")Y--;if(G==="[")Q++;if(G==="]")Q--;if(G===","&&Y===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=G}if(Z.trim())X.push(Z.trim());return X}function pJ(J,X){if(typeof J!=="string")return J;let Z=J.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let $=X[Z];if($!==void 0)return $}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var VX;var nJ=q(()=>{EJ();cJ();VX=aJ()});async function rJ(){try{return await Promise.resolve().then(() => (lJ(),dJ))}catch(J){if(!iJ)console.warn("[stx-media] Video processor not available, some features disabled:",J),iJ=!0;return null}}async function JJ(J,X={}){let Z=X,$=J;if($.process&&!$.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return PX($,Z)}if(Z.processedResult?.processed)return eJ(J,Z.processedResult,X);let K;if($.generatePoster&&$.src&&!J.poster)K=await vX($,Z);let{src:Y,sources:Q=[],poster:W,posterPlaceholder:G,controls:z=oJ,autoplay:j=!1,muted:_=!1,loop:L=!1,preload:M=sJ,playsinline:O=!0,lazy:N=!0,player:B="native",type:k,width:U,height:H,crossorigin:I,disablePictureInPicture:E=!1,disableRemotePlayback:w=!1}=J,T=K||W,x=J.class,h=J.style,D=J.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(B==="ts-video")return bX(J,X);if(k&&k!=="video")return CX(Y||"",k,J);let f=Q.length>0?Q:Y?[{src:Y,type:tJ(Y)}]:[],A=[`id="${D}"`];if(z)A.push("controls");if(j)A.push("autoplay");if(_)A.push("muted");if(L)A.push("loop");if(O)A.push("playsinline");if(E)A.push("disablepictureinpicture");if(w)A.push("disableremoteplayback");if(I)A.push(`crossorigin="${I}"`);if(N){if(A.push(`data-preload="${M}"`),A.push('preload="none"'),T)A.push(`data-poster="${F(T)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${M}"`),T)A.push(`poster="${F(T)}"`);if(U)A.push(`width="${U}"`);if(H)A.push(`height="${H}"`);if(x)A.push(`class="${F(x)}"`);if(h)A.push(`style="${F(h)}"`);let m=f.map((P)=>{return`  <source ${N?`data-src="${F(P.src)}"`:`src="${F(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
`),JX=`<video ${A.join(" ")}>
${m}
  Your browser does not support the video tag.
</video>`,BJ;if(N)BJ=`
(function() {
  var video = document.getElementById('${D}');
  if (!video) return;

  var observer = new IntersectionObserver(function(entries) {
    entries.forEach(function(entry) {
      if (entry.isIntersecting) {
        // Load poster
        if (video.dataset.poster) {
          video.poster = video.dataset.poster;
          delete video.dataset.poster;
        }

        // Load sources
        var sources = video.querySelectorAll('source[data-src]');
        sources.forEach(function(source) {
          source.src = source.dataset.src;
          delete source.dataset.src;
        });

        // Set preload
        if (video.dataset.preload) {
          video.preload = video.dataset.preload;
          delete video.dataset.preload;
        }

        video.load();
        observer.disconnect();
      }
    });
  }, { rootMargin: '50px' });

  observer.observe(video);
})();
`.trim();return{html:JX,script:BJ}}function CX(J,X,Z){let{width:$=640,height:K=360}=Z,Y=Z.class,Q=Z.style,W=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,G,z=null;switch(X){case"youtube":z=xX(J),G=z?`https://www.youtube-nocookie.com/embed/${z}`:J;break;case"vimeo":z=DX(J),G=z?`https://player.vimeo.com/video/${z}`:J;break;case"dailymotion":z=J.split("/").pop()||"",G=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=J.split("/").pop()||"",G=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:G=J}let j=[`id="${W}"`,`src="${F(G)}"`,`width="${$}"`,`height="${K}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Y)j.push(`class="${F(Y)}"`);if(Q)j.push(`style="${F(Q)}"`);if(Z.lazy)j.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
  <iframe ${j.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
</div>`}}function bX(J,X={}){let{src:Z,sources:$=[],poster:K,controls:Y=!0,autoplay:Q=!1,muted:W=!1,loop:G=!1,preload:z="metadata",playsinline:j=!0,lazy:_=!0,width:L,height:M}=J,O=J.class,N=J.style,B=J.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,k={src:$.length>0?$:Z,autoplay:Q,loop:G,muted:W,playsinline:j,preload:z,poster:K,controls:Y,title:J.title},U=["position: relative",L?`width: ${typeof L==="number"?L+"px":L}`:"width: 100%",M?`height: ${typeof M==="number"?M+"px":M}`:"",N||""].filter(Boolean).join("; "),H=`
<div
  id="${B}"
  class="ts-video-player${O?" "+F(O):""}"
  style="${U}"
  data-ts-video-player
  data-config='${JSON.stringify(k)}'
  ${_?"data-lazy":""}
>
  <div class="ts-video-player__container">
    ${K?`
    <div class="ts-video-player__placeholder" style="background-image: url('${F(K)}');">
      <button class="ts-video-player__play-button" aria-label="Play video">
        <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
          <path d="M8 5v14l11-7z"/>
        </svg>
      </button>
    </div>
    `:""}
  </div>
</div>
`.trim(),I=`
(function() {
  var container = document.getElementById('${B}');
  if (!container) return;

  var config = JSON.parse(container.dataset.config || '{}');
  var isLazy = container.hasAttribute('data-lazy');

  function loadPlayer() {
    if (typeof TSVideoPlayer !== 'undefined') {
      initPlayer();
      return;
    }

    // Load ts-video-player from CDN
    var script = document.createElement('script');
    script.src = '${qX}';
    script.onload = initPlayer;
    script.onerror = function() {
      console.error('[stx] Failed to load ts-video-player');
      fallbackToNative();
    };
    document.head.appendChild(script);
  }

  function initPlayer() {
    var player = TSVideoPlayer.createPlayer(container, config);
    if (config.src) {
      player.setSrc(config.src);
    }
    container.__tsVideoPlayer = player;

    // Remove placeholder
    var placeholder = container.querySelector('.ts-video-player__placeholder');
    if (placeholder) {
      placeholder.style.display = 'none';
    }
  }

  function fallbackToNative() {
    // Fallback to native video element
    var video = document.createElement('video');
    video.controls = config.controls !== false;
    video.autoplay = config.autoplay;
    video.muted = config.muted;
    video.loop = config.loop;
    video.playsInline = config.playsinline;
    video.preload = config.preload || 'metadata';
    if (config.poster) video.poster = config.poster;
    if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
    video.style.width = '100%';
    video.style.height = '100%';

    var containerEl = container.querySelector('.ts-video-player__container');
    if (containerEl) {
      containerEl.innerHTML = '';
      containerEl.appendChild(video);
    }
  }

  if (isLazy) {
    var observer = new IntersectionObserver(function(entries) {
      entries.forEach(function(entry) {
        if (entry.isIntersecting) {
          loadPlayer();
          observer.disconnect();
        }
      });
    }, { rootMargin: '50px' });
    observer.observe(container);
  }
else {
    if (document.readyState === 'loading') {
      document.addEventListener('DOMContentLoaded', loadPlayer);
    }
else {
      loadPlayer();
    }
  }

  // Handle play button click
  var playButton = container.querySelector('.ts-video-player__play-button');
  if (playButton) {
    playButton.addEventListener('click', function() {
      loadPlayer();
      var check = setInterval(function() {
        if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
          container.__tsVideoPlayer.play();
          clearInterval(check);
        }
      }, 100);
    });
  }
})();
`.trim(),E=`
.ts-video-player {
  position: relative;
  background: #000;
}

.ts-video-player__container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
}

.ts-video-player__container > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ts-video-player__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.ts-video-player__play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.ts-video-player__play-button:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.9);
}

.ts-video-player__play-button svg {
  margin-left: 4px;
}
`.trim();return{html:H,script:I,css:E}}function tJ(J){switch(J.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function xX(J){let X=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of X){let $=J.match(Z);if($)return $[1]}return null}function DX(J){let X=J.match(/vimeo\.com\/(\d+)/);return X?X[1]:null}function F(J){return J.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function VZ(J,X,Z){if(X.src)return{src:String(X.src),...X};let $=J.trim();if($.startsWith("@video(")||$.startsWith("("))$=$.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let K=$.indexOf(",");if(K===-1)return{src:$.replace(/^['"]|['"]$/g,"")};let Y=$.slice(0,K).trim().replace(/^['"]|['"]$/g,""),Q=$.slice(K+1).trim();try{let W=JSON.parse(Q);return{src:Y,...W}}catch{return{src:Y}}}async function PX(J,X){let Z=await rJ();if(!Z)return JJ({...J,process:!1},X);let $=X.tsVideosConfig,K=await Z.processVideo(J.src,J,$,J.onProcessProgress);if(K.processed)return eJ(J,K,X);return JJ({...J,process:!1},X)}async function vX(J,X){let Z=await rJ();if(!Z||!J.src)return;let $=typeof J.generatePoster==="object"?J.generatePoster:{timestamp:0},K=X.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(J.src,$,K.outputDir,K.baseUrl||"/videos"))?.url}function eJ(J,X,Z){let{controls:$=oJ,autoplay:K=!1,muted:Y=!1,loop:Q=!1,preload:W=sJ,playsinline:G=!0,lazy:z=!0,width:j,height:_,crossorigin:L,disablePictureInPicture:M=!1,disableRemotePlayback:O=!1}=J,N=J.class,B=J.style,k=J.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,U=J.src,H=tJ(U);if(X.transcoded)U=X.transcoded.url,H="video/mp4";let I=X.streaming?.hls||X.streaming?.dash;if(I){if(X.streaming?.hls)U=X.streaming.hls.manifestUrl,H="application/x-mpegURL";else if(X.streaming?.dash)U=X.streaming.dash.manifestUrl,H="application/dash+xml"}let E=X.poster?.url||J.poster,w=[`id="${k}"`];if($)w.push("controls");if(K)w.push("autoplay");if(Y)w.push("muted");if(Q)w.push("loop");if(G)w.push("playsinline");if(M)w.push("disablepictureinpicture");if(O)w.push("disableremoteplayback");if(L)w.push(`crossorigin="${L}"`);if(z){if(w.push(`data-preload="${W}"`),w.push('preload="none"'),E)w.push(`data-poster="${F(E)}"`);w.push("data-stx-lazy")}else if(w.push(`preload="${W}"`),E)w.push(`poster="${F(E)}"`);let T=j||X.metadata?.width,x=_||X.metadata?.height;if(T)w.push(`width="${T}"`);if(x)w.push(`height="${x}"`);if(N)w.push(`class="${F(N)}"`);if(B)w.push(`style="${F(B)}"`);let D=`  <source ${z?`data-src="${F(U)}"`:`src="${F(U)}"`} type="${H}" />`,f=`<video ${w.join(" ")}>
${D}
  Your browser does not support the video tag.
</video>`;if(X.spriteSheet)f=`<div class="stx-video-wrapper" data-sprite-sheet="${F(X.spriteSheet.url)}" data-sprite-cols="${X.spriteSheet.columns}" data-sprite-interval="${X.spriteSheet.interval}">
${f}
</div>`;let A;if(z)A=`
(function() {
  var video = document.getElementById('${k}');
  if (!video) return;

  var observer = new IntersectionObserver(function(entries) {
    entries.forEach(function(entry) {
      if (entry.isIntersecting) {
        // Load poster
        if (video.dataset.poster) {
          video.poster = video.dataset.poster;
          delete video.dataset.poster;
        }

        // Load sources
        var sources = video.querySelectorAll('source[data-src]');
        sources.forEach(function(source) {
          source.src = source.dataset.src;
          delete source.dataset.src;
        });

        // Set preload
        if (video.dataset.preload) {
          video.preload = video.dataset.preload;
          delete video.dataset.preload;
        }

        video.load();
        observer.disconnect();
      }
    });
  }, { rootMargin: '50px' });

  observer.observe(video);
})();
`.trim();let m;if(I)m=`
.stx-video-wrapper {
  position: relative;
  width: 100%;
}
.stx-video-wrapper video {
  width: 100%;
  height: auto;
}
`.trim();return{html:f,script:A,css:m}}var iJ=!1,oJ=!0,sJ="metadata",qX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var cJ=q(()=>{nJ()});cJ();export{VX as videoDirective,JJ as renderVideoComponent,VZ as parseVideoDirectiveOptions,aJ as createVideoDirective};
