@bylqwjc/media-editor-image 1.0.26

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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/dist/chunk-5TBO732O.js +1 -0
  4. package/dist/index-CU3vkvDR.d.ts +44 -0
  5. package/dist/index.css +1 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +36 -0
  8. package/dist/lazy.css +1 -0
  9. package/dist/lazy.d.ts +8 -0
  10. package/dist/lazy.js +1 -0
  11. package/node_modules/@media-editor/core/LICENSE +21 -0
  12. package/node_modules/@media-editor/core/README.md +14 -0
  13. package/node_modules/@media-editor/core/dist/browser.cjs +1 -0
  14. package/node_modules/@media-editor/core/dist/browser.d.ts +117 -0
  15. package/node_modules/@media-editor/core/dist/browser.js +1 -0
  16. package/node_modules/@media-editor/core/dist/chunk-7D4QE3R2.js +1 -0
  17. package/node_modules/@media-editor/core/dist/chunk-7PSQLYXL.js +1 -0
  18. package/node_modules/@media-editor/core/dist/chunk-FAFKY4LX.js +1 -0
  19. package/node_modules/@media-editor/core/dist/chunk-VDEZTXEA.js +1 -0
  20. package/node_modules/@media-editor/core/dist/engine.cjs +1 -0
  21. package/node_modules/@media-editor/core/dist/engine.d.ts +663 -0
  22. package/node_modules/@media-editor/core/dist/engine.js +1 -0
  23. package/node_modules/@media-editor/core/dist/filerobot.cjs +1 -0
  24. package/node_modules/@media-editor/core/dist/filerobot.d.ts +88 -0
  25. package/node_modules/@media-editor/core/dist/filerobot.js +1 -0
  26. package/node_modules/@media-editor/core/dist/index.cjs +1 -0
  27. package/node_modules/@media-editor/core/dist/index.d.ts +250 -0
  28. package/node_modules/@media-editor/core/dist/index.js +1 -0
  29. package/node_modules/@media-editor/core/dist/platform-presets-Ca2LbKQ3.d.ts +80 -0
  30. package/node_modules/@media-editor/core/dist/state-D2oM5s1a.d.ts +2098 -0
  31. package/node_modules/@media-editor/core/node_modules/zod/LICENSE +21 -0
  32. package/node_modules/@media-editor/core/node_modules/zod/README.md +208 -0
  33. package/node_modules/@media-editor/core/node_modules/zod/index.cjs +1 -0
  34. package/node_modules/@media-editor/core/node_modules/zod/index.d.cts +4 -0
  35. package/node_modules/@media-editor/core/node_modules/zod/index.js +1 -0
  36. package/node_modules/@media-editor/core/node_modules/zod/package.json +76 -0
  37. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.cjs +1 -0
  38. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.cts +164 -0
  39. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.js +1 -0
  40. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.cjs +1 -0
  41. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.cts +5 -0
  42. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.js +1 -0
  43. package/node_modules/@media-editor/core/node_modules/zod/v3/external.cjs +1 -0
  44. package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.cts +6 -0
  45. package/node_modules/@media-editor/core/node_modules/zod/v3/external.js +1 -0
  46. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.cjs +1 -0
  47. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  48. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  49. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.cjs +1 -0
  50. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  51. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.js +1 -0
  52. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.cjs +1 -0
  53. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  54. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.js +1 -0
  55. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.cjs +1 -0
  56. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  57. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  58. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.cjs +1 -0
  59. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  60. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  61. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.cjs +1 -0
  62. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.cts +85 -0
  63. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.js +1 -0
  64. package/node_modules/@media-editor/core/node_modules/zod/v3/index.cjs +1 -0
  65. package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.cts +4 -0
  66. package/node_modules/@media-editor/core/node_modules/zod/v3/index.js +1 -0
  67. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.cjs +1 -0
  68. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.cts +3 -0
  69. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.js +1 -0
  70. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.cjs +1 -0
  71. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.cts +102 -0
  72. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.js +1 -0
  73. package/node_modules/@media-editor/core/node_modules/zod/v3/types.cjs +1 -0
  74. package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.cts +1031 -0
  75. package/node_modules/@media-editor/core/node_modules/zod/v3/types.js +1 -0
  76. package/node_modules/@media-editor/core/package.json +42 -0
  77. package/package.json +34 -0
@@ -0,0 +1 @@
1
+ import{outputSize as t,isOverlayHidden as e,findFilterPreset as n,normalizeDeg as s,overlayLayerRenderOrder as o}from"./chunk-VDEZTXEA.js";export{DEG2RAD,FILTER_PRESETS,buildFilterCss,centeredMaxRect,clampRect,evenize,findFilterPreset,fitRects,normalizeDeg,outputSize,rotatedSize}from"./chunk-VDEZTXEA.js";export{MIN_CLIP,canRedo,canUndo,clampAudioClip,clipDuration,clipStartsAt,contentDuration,createHistory,duplicateClip,locateOutput,pushHistory,redo,remapSrcIndices,removeClip,reorderClips,replacePresent,splitAtOutput,totalDuration,trimClipEdge,undo,usedVideoSrcIndices}from"./chunk-7D4QE3R2.js";import{DEFAULT_FILTERS as a}from"./chunk-7PSQLYXL.js";export{AudioClip,Clip,DEFAULT_FILTERS,ExportSettings,Overlay,Transition,VideoEditState,defaultVideoEditState}from"./chunk-7PSQLYXL.js";export{DEFAULT_PLATFORM_TARGETS,EDITOR_MESSAGES,IMAGE_PLATFORM_PRESETS,IMAGE_RATIO_PRESETS,VIDEO_PLATFORM_RATIO_PRESETS,VIDEO_RATIO_PRESETS,VIDEO_SIZE_PRESETS,buildImagePlatformPresets,buildVideoPlatformRatioPresets,buildVideoSizePresets,compensateAnnotationRotation,parseRatio,tEditor,toHant}from"./chunk-FAFKY4LX.js";function r(t,e,n,s){const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(n,Math.max(e,o)):s}function i(t,e){const n=r(t,2,8192,e);return n%2==0?n:n-1}function u(t){return t.exportSettings??void 0}function c(t){return r(u(t)?.frameRate,12,120,30)}function h(e){const n=t(e.canvas,e),s=function(e){const n=t(e.canvas,e),s=u(e);if(!s)return n;const o=Number.isFinite(Number(s.width))&&Number(s.width)>0,a=Number.isFinite(Number(s.height))&&Number(s.height)>0;if(!o&&!a)return n;const r=n.w>0&&n.h>0?n.w/n.h:1;if(o&&a)return{w:i(s.width,n.w),h:i(s.height,n.h)};if(o){const t=i(s.width,n.w);return{w:t,h:i(t/r,n.h)}}const c=i(s.height,n.h);return{w:i(c*r,n.w),h:c}}(e);return s.w===n.w&&s.h===n.h?[]:[`scale=${s.w}:${s.h}`]}function l(t){const{brightness:e,contrast:n,saturation:s}=t,o=t.gamma??0,a=t.temperature??0,r=t.tint??0,i=t.vibrance??0,u=t.highlights??0,c=t.shadows??0,h=t.whites??0,l=t.blacks??0,p=t.lightSense??0;if(0===e&&0===n&&0===s&&0===o&&0===a&&0===r&&0===i&&0===u&&0===c&&0===h&&0===l&&0===p)return null;const $=[],f=e+.08*u+.06*c+.05*h-.05*l+.08*p,m=n+.08*h+.08*l,d=s+.65*i;0!==f&&$.push(`brightness=${f.toFixed(3)}`),0!==m&&$.push(`contrast=${(1+m).toFixed(3)}`),0!==d&&$.push(`saturation=${(1+d).toFixed(3)}`),0!==o&&$.push(`gamma=${(1+o*(o>0?1:.5)).toFixed(3)}`);const v=$.length?[`eq=${$.join(":")}`]:[];return 0===a&&0===r||v.push(`colorbalance=rs=${(.18*a+.08*r).toFixed(3)}:gs=${(.02*a-.04*r).toFixed(3)}:bs=${(.18*-a-.08*r).toFixed(3)}`),v.join(",")}function p(t){return Boolean(t.hidden)}function $(t,e,n,s,o,a){return p(e)?`color=c=black:s=${s}x${o}:r=${a}:d=${Math.max(.001,e.out-e.in)},setsar=1,format=yuv420p[v${n}]`:`[${t}:v]trim=start=${e.in}:end=${e.out},setpts=PTS-STARTPTS,scale=${s}:${o}:force_original_aspect_ratio=increase,crop=${s}:${o},setsar=1,fps=${a},format=yuv420p[v${n}]`}function f(t,e={}){const o=[];if(t.flipX&&o.push("hflip"),t.flipY&&o.push("vflip"),o.push(...function(t){const e=s(t);if(0===e)return[];if(90===e)return["transpose=1"];if(180===e)return["transpose=1","transpose=1"];if(270===e)return["transpose=2"];const n=`${e}*PI/180`;return[`rotate=${n}:ow=rotw(${n}):oh=roth(${n}):c=black`]}(t.rotation)),t.crop){const{x:e,y:n,width:s,height:a}=t.crop;o.push(`crop=${s}:${a}:${e}:${n}`)}if(t.scale){const{width:e,height:n,fit:s}=t.scale;"force"===s?o.push(`scale=${e}:${n}`):"cover"===s?o.push(`scale=${e}:${n}:force_original_aspect_ratio=increase`,`crop=${e}:${n}`):o.push(`scale=${e}:${n}:force_original_aspect_ratio=decrease`,`pad=${e}:${n}:(ow-iw)/2:(oh-ih)/2:${function(t){if("string"!=typeof t)return"0x000000";const e=t.trim(),n=e.match(/^#?([0-9a-fA-F]{3})$/);if(n)return`0x${n[1].split("").map(t=>t+t).join("").toLowerCase()}`;const s=e.match(/^#?([0-9a-fA-F]{6})$/);return s?`0x${s[1].toLowerCase()}`:"0x000000"}(t.scale.backgroundColor)}`)}const a=l(t.filters);a&&o.push(a);const r=n(t.filterPreset);return r&&o.push(r.vf),!1!==e.includeExportScale&&o.push(...h(t)),o.push(`fps=${c(t)}`),s(t.rotation)%90==0||t.scale||o.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),o}function m(t,e){const n=function(t){const e=String(u(t)?.format??"mp4").toLowerCase();return"mov"===e||"mxf"===e?e:"mp4"}(e),s="mxf"===n?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],o=function(t){const e=Number(u(t)?.videoBitrateKbps);return Number.isFinite(e)&&e>=100?Math.round(e):0}(e);if(o>0?s.push("-b:v",`${o}k`,"-maxrate",`${o}k`,"-bufsize",`${Math.max(2*o,512)}k`):"mxf"===n&&s.push("-q:v","2"),t)if("mxf"===n)s.push("-c:a","pcm_s16le");else{s.push("-c:a",function(t){return"mp3"===u(t)?.audioCodec?"libmp3lame":"aac"}(e));const t=function(t){const e=Number(u(t)?.audioBitrateKbps);return Number.isFinite(e)&&e>=32?Math.round(e):0}(e);t>0&&s.push("-b:a",`${t}k`)}return"mxf"===n&&s.push("-f","mxf"),s}var d="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",v="anullsrc=r=44100:cl=stereo";function x(t){return t>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round(1e3*(t-.01))/1e3}:d=0.01`:""}function g(t,n=Number.POSITIVE_INFINITY){const s=[];for(const o of t??[]){if(e(o))continue;if("adjust"===o.type)continue;const t=Number(o.startAt),a=Number(o.endAt);if(Number.isFinite(t)&&Number.isFinite(a)&&!(a<=t)&&(s.push({startAt:Math.max(0,t),endAt:Math.max(t+.01,a)}),s.length>=n))break}return s}function b(t,e=2){const n=Math.max(e,Math.floor(Number(t)||e));return n%2==0?n:n-1}function S(t){const e=Number.isFinite(t.startAt)?Math.max(0,Number(t.startAt)):0,n=Number(t.endAt);return Number.isFinite(n)?{startAt:e,endAt:Math.max(e+.1,n)}:{startAt:e,endAt:e+3}}function A(t){const e=l({...a,...t}),s=n(t.filterPreset);return[e,s?.vf].filter(t=>Boolean(t))}function y(t,e){const n=Math.max(2,b(e.w)),s=Math.max(2,b(e.h)),o=Math.max(0,Math.min(n-2,b(t.x,0))),a=Math.max(0,Math.min(s-2,b(t.y,0))),r=Math.min(n-o,Math.max(2,b(t.w))),i=Math.min(s-a,Math.max(2,b(t.h)));return r<=1||i<=1?null:{x:o,y:a,w:r,h:i}}function T(t,n){const s=[];for(const o of t??[]){if(e(o))continue;if("adjust"!==o.type)continue;const t=y(o,n);if(!t)continue;const a=A(o);a.length&&s.push({rect:t,filters:a,...S(o)})}return s}function E(t,e,n,s){let o=e;return s.forEach((e,s)=>{const a=`[vtimed${n+s}]`;t.push(`${o}[${n+s}:v]overlay=0:0:enable='between(t,${e.startAt.toFixed(3)},${e.endAt.toFixed(3)})'${a}`),o=a}),o}function M(t,e,n){let s=e;return n.forEach((e,n)=>{const o=`[vadjsrc${n}]`,a=`[vadjbase${n}]`,r=`[vadjcrop${n}]`,i=`[vadj${n}]`,{rect:u}=e;t.push(`${s}split=2${o}${a}`),t.push(`${o}crop=${u.w}:${u.h}:${u.x}:${u.y},${e.filters.join(",")}${r}`),t.push(`${a}${r}overlay=${u.x}:${u.y}:enable='between(t,${e.startAt.toFixed(3)},${e.endAt.toFixed(3)})'${i}`),s=i}),s}function F(t){const e=Number(t.startAt),n=Number(t.endAt);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?"":`:enable='between(t,${Math.max(0,e).toFixed(3)},${Math.max(e+.01,n).toFixed(3)})'`}function P(t,e,n,s){const o=`[${s}src]`,a=`[${s}base]`,r=`[${s}crop]`,i=`[${s}]`,{rect:u}=n;return t.push(`${e}split=2${o}${a}`),t.push(`${o}crop=${u.w}:${u.h}:${u.x}:${u.y},${n.filters.join(",")}${r}`),t.push(`${a}${r}overlay=${u.x}:${u.y}:enable='between(t,${n.startAt.toFixed(3)},${n.endAt.toFixed(3)})'${i}`),i}function w(t,n,s,a,r,i,u){let c=n,h=0,l=0;for(const n of o(a??[])){if(e(n))continue;if("adjust"===n.type){const e=y(n,i),s=A(n);if(!e||!s.length)continue;c=P(t,c,{rect:e,filters:s,...S(n)},`v${u}adj${l}`),l++;continue}if(h>=r){h++;continue}const o=`[v${u}lay${h}]`;t.push(`${c}[${s+h}:v]overlay=0:0${F(n)}${o}`),c=o,h++}return c}function _(e,n,s){const{videoPaths:o,videoHasAudio:a,audioPaths:r,overlayPath:i,textOverlayPaths:u=[],overlayLayerPaths:l=[]}=n,b=(e.audioClips??[]).filter(t=>!t.muted),S=l.length>0,A=S?[]:g(e.overlays,u.length),y=S?[]:u.slice(0,A.length),F=S?l:[],P=S?[]:T(e.overlays,t(e.canvas,e));if(1===o.length&&0===b.length)return function(e,n,s,o,a,r=[],i=[]){const u=f(e,{includeExportScale:!1}),l=e.clips,d=e.keepAudio&&a,v=l.length>=2,b=l.some(p),S=c(e),A=i.length>0,y=A?[]:g(e.overlays,r.length),F=A?[]:r.slice(0,y.length),P=A?i:[],_=A?[]:T(e.overlays,t(e.canvas,e));if(v||b||o||F.length||P.length||_.length){const a=[];let r;if(v){l.forEach((t,n)=>{a.push($(0,t,n,e.canvas.w,e.canvas.h,S)),d&&a.push(`[0:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${x(t.out-t.in)}[a${n}]`)});const t=l.map((t,e)=>d?`[v${e}][a${e}]`:`[v${e}]`).join(""),n=d?"[vcat][acat]":"[vcat]";a.push(`${t}concat=n=${l.length}:v=1:a=${d?1:0}${n}`),r="[vcat]"}else b?(a.push($(0,l[0],0,e.canvas.w,e.canvas.h,S)),r="[v0]"):r="[0:v]";u.length&&(a.push(`${r}${u.join(",")}[vflt]`),r="[vflt]"),P.length?(o&&(a.push(`${r}[1:v]overlay=0:0[vlegacy]`),r="[vlegacy]"),r=w(a,r,1+(o?1:0),e.overlays,P.length,t(e.canvas,e),"s")):_.length&&(r=M(a,r,_)),!P.length&&o?(a.push(`${r}[1:v]overlay=0:0[vout]`),r="[vout]"):"[0:v]"===r&&(a.push("[0:v]null[vout]"),r="[vout]"),F.length&&(r=E(a,r,1+(o?1:0),y));const i=h(e);i.length&&(a.push(`${r}${i.join(",")}[vscaled]`),r="[vscaled]");const c=[];v||1!==l.length||c.push("-ss",String(l[0].in),"-t",String(l[0].out-l[0].in));const p=["-y",...c,"-i",n];o&&p.push("-i",o);for(const t of P)p.push("-i",t);for(const t of F)p.push("-i",t);return p.push("-filter_complex",a.join(";"),"-map",r),d&&p.push("-map",v?"[acat]":"0:a?"),p.push(...m(d,e)),p.push(s),p}const R=["-ss",String(l[0].in),"-t",String(l[0].out-l[0].in)],j=f(e),I=["-y",...R,"-i",n];return j.length&&I.push("-vf",j.join(",")),d||I.push("-an"),I.push(...m(d,e)),I.push(s),I}(e,o[0],s,i,a[0]??!1,y,F);const _=o.length,R=r.length,j=e.canvas.w,I=e.canvas.h,N=e.clips,k=e.keepAudio&&N.some(t=>a[t.srcIdx]),L=c(e),O=N.reduce((t,e)=>t+(e.out-e.in),0),C=[];N.forEach((t,e)=>{C.push($(t.srcIdx,t,e,j,I,L)),k&&(a[t.srcIdx]?C.push(`[${t.srcIdx}:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${x(t.out-t.in)},${d}[a${e}]`):C.push(`${v},atrim=start=0:end=${t.out-t.in},asetpts=PTS-STARTPTS,${d}[a${e}]`))});const D=N.map((t,e)=>k?`[v${e}][a${e}]`:`[v${e}]`).join("");C.push(`${D}concat=n=${N.length}:v=1:a=${k?1:0}${k?"[vcat][acat]":"[vcat]"}`);let V=k?"[acat]":"";if(!k&&b.length&&(C.push(`${v},atrim=start=0:end=${O},asetpts=PTS-STARTPTS,${d}[acat]`),V="[acat]"),b.length){b.forEach((t,e)=>{const n=Math.max(0,Math.round(1e3*t.startAt));C.push(function(t,e,n,s){const o=Math.min(2,Math.max(.5,e.speed??1)),a=function(t){return Math.max(.001,(t.out-t.in)/Math.max(.01,t.speed??1))}(e),r=Math.min(Math.max(0,e.fadeIn??0),a),i=Math.min(Math.max(0,e.fadeOut??0),a),u=[`atrim=start=${e.in}:end=${e.out}`,"asetpts=PTS-STARTPTS"];return Math.abs(o-1)>.001&&u.push(`atempo=${o.toFixed(3)}`),r>0&&u.push(`afade=t=in:st=0:d=${r.toFixed(3)}`),i>0&&u.push(`afade=t=out:st=${Math.max(0,a-i).toFixed(3)}:d=${i.toFixed(3)}`),u.push(`volume=${e.volume}`,d,`adelay=${n}|${n}`),`${t}${u.join(",")}[${s}]`}(`[${_+t.srcIdx}:a]`,t,n,`mu${e}`))});const t=`${V}${b.map((t,e)=>`[mu${e}]`).join("")}`;C.push(`${t}amix=inputs=${1+b.length}:duration=first:dropout_transition=0:normalize=0,alimiter=limit=0.95:level=disabled:latency=1[aout]`),V="[aout]"}let z="[vcat]";const X=f(e,{includeExportScale:!1});X.length&&(C.push(`${z}${X.join(",")}[vflt]`),z="[vflt]"),F.length?(i&&(C.push(`${z}[${_+R}:v]overlay=0:0[vlegacy]`),z="[vlegacy]"),z=w(C,z,_+R+(i?1:0),e.overlays,F.length,t(e.canvas,e),"m")):P.length&&(z=M(C,z,P)),!F.length&&i&&(C.push(`${z}[${_+R}:v]overlay=0:0[vout]`),z="[vout]"),y.length&&(z=E(C,z,_+R+(i?1:0),A));const G=h(e);G.length&&(C.push(`${z}${G.join(",")}[vscaled]`),z="[vscaled]");const Y=["-y"];for(const t of o)Y.push("-i",t);for(const t of r)Y.push("-i",t);i&&Y.push("-i",i);for(const t of F)Y.push("-i",t);for(const t of y)Y.push("-i",t);Y.push("-filter_complex",C.join(";"),"-map",z);const B=!!V;return B&&Y.push("-map",V),Y.push(...m(B,e)),B&&Y.push("-ar","44100","-ac","2"),Y.push(s),Y}function R(t,e,n){return["-y","-ss",String(e),"-i",t,"-frames:v","1","-q:v","2",n]}export{_ as buildFfmpegArgs,R as buildPosterArgs};
@@ -0,0 +1,80 @@
1
+ /**
2
+ * editor-core/i18n —— 编辑器文案字典(纯 TS,零框架依赖,Vue/React 壳共用)。
3
+ * key 规约(domain 扁平):tool.* tune.* overlay.* filter.* ratio.* act.* err.* tip.* msg.* lbl.* panel.* poster.* crop.*
4
+ * 插值:{name} 形式,tEditor 第三参传值。
5
+ * 单测保证所有 locale key 集合一致(Filerobot 内核覆盖键不在此,见 ImageEditor 的 FIE_* translations)。
6
+ */
7
+ type EditorLocale = 'zh' | 'en' | 'es' | 'zh-Hant';
8
+ declare const toHant: (value: string) => string;
9
+ declare const EDITOR_MESSAGES: Record<EditorLocale, Record<string, string>>;
10
+ /** 取文案;缺 key 兜底显示 key 本身;{name} 插值 */
11
+ declare function tEditor(locale: EditorLocale, key: string, vars?: Record<string, string | number>): string;
12
+
13
+ /**
14
+ * 内置平台发布目标表(SDK 自带默认值)。
15
+ * 原 SocialEcho 仓从 lib/ark-config.ts 的 PUBLISH_TARGETS 派生预设;为让 SDK 自包含、
16
+ * 去掉对宿主 ark-config 的硬依赖,这里内置编辑器预设真正用到的字段子集(15 行)。
17
+ * 宿主仍可调 buildPlatformPresets(自己的 targets) 注入,保持单一真值源。
18
+ */
19
+ interface PlatformTarget {
20
+ platform: string;
21
+ postType: string;
22
+ label: string;
23
+ shortLabel: string;
24
+ ratio: string;
25
+ imageSize: string;
26
+ videoRatio?: string;
27
+ videoResolution?: '720p' | '1080p';
28
+ }
29
+ /** 默认平台表(与原仓 PUBLISH_TARGETS 同步;升级宿主数据时复核) */
30
+ declare const DEFAULT_PLATFORM_TARGETS: PlatformTarget[];
31
+
32
+ /**
33
+ * 编辑器「平台 → 可选裁剪比例 / 输出尺寸」预设。
34
+ * 默认从内置 DEFAULT_PLATFORM_TARGETS 派生(SDK 自包含);
35
+ * 宿主可调 buildImagePlatformPresets/buildVideoSizePresets 传入自己的目标表保持单一真值源。
36
+ */
37
+
38
+ interface RatioPreset {
39
+ ratio: string;
40
+ value: number;
41
+ label: string;
42
+ }
43
+ declare function parseRatio(r: string): number;
44
+ /** 图片比例预设:精确 7 项(顺序即 UI 顺序) */
45
+ declare const IMAGE_RATIO_PRESETS: RatioPreset[];
46
+ /** 视频比例预设:常用社媒/横竖屏比例(顺序即 UI 顺序) */
47
+ declare const VIDEO_RATIO_PRESETS: RatioPreset[];
48
+ interface VideoPlatformRatioPreset {
49
+ platform: string;
50
+ postType: string;
51
+ label: string;
52
+ ratio: string;
53
+ value: number;
54
+ }
55
+ /** 视频平台比例快捷入口:从目标表 videoRatio 派生,保留平台/类型,按 platform+type+ratio 去重 */
56
+ declare function buildVideoPlatformRatioPresets(targets?: PlatformTarget[]): VideoPlatformRatioPreset[];
57
+ declare const VIDEO_PLATFORM_RATIO_PRESETS: VideoPlatformRatioPreset[];
58
+ interface PlatformPreset {
59
+ platform: string;
60
+ label: string;
61
+ ratio: string;
62
+ value: number;
63
+ w: number;
64
+ h: number;
65
+ }
66
+ /** 每平台一条(优先 postType='post',否则取该平台首条);w/h 来自 imageSize */
67
+ declare function buildImagePlatformPresets(targets?: PlatformTarget[]): PlatformPreset[];
68
+ /** 默认图片平台预设(内置表派生) */
69
+ declare const IMAGE_PLATFORM_PRESETS: PlatformPreset[];
70
+ interface SizePreset {
71
+ label: string;
72
+ w: number;
73
+ h: number;
74
+ }
75
+ /** 视频输出尺寸预设:从目标表派生(平台标签 + 实际像素),按 w×h 去重 */
76
+ declare function buildVideoSizePresets(targets?: PlatformTarget[]): SizePreset[];
77
+ /** 默认视频尺寸预设(内置表派生) */
78
+ declare const VIDEO_SIZE_PRESETS: SizePreset[];
79
+
80
+ export { DEFAULT_PLATFORM_TARGETS as D, type EditorLocale as E, IMAGE_PLATFORM_PRESETS as I, type PlatformPreset as P, type RatioPreset as R, type SizePreset as S, VIDEO_PLATFORM_RATIO_PRESETS as V, EDITOR_MESSAGES as a, IMAGE_RATIO_PRESETS as b, type PlatformTarget as c, VIDEO_RATIO_PRESETS as d, VIDEO_SIZE_PRESETS as e, type VideoPlatformRatioPreset as f, buildImagePlatformPresets as g, buildVideoPlatformRatioPresets as h, buildVideoSizePresets as i, toHant as j, parseRatio as p, tEditor as t };