@etaio/core-types 2.0.1 → 2.1.0
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-transformers.d.ts","sourceRoot":"","sources":["../../src/assets/asset-transformers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,
|
|
1
|
+
{"version":3,"file":"asset-transformers.d.ts","sourceRoot":"","sources":["../../src/assets/asset-transformers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EAGL,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE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,"file":"asset-validators.d.ts","sourceRoot":"","sources":["../../src/assets/asset-validators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"asset-validators.d.ts","sourceRoot":"","sources":["../../src/assets/asset-validators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAwCD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,gBAAgB,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,WAAW,CAErE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,kBAAkB,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,WAAW,CAErE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,qBAAqB,CA0F7E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAgD/D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAoC5E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,MAAM,EAAE,CA0BlF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,qBAAqB,CAgBzE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAA0B,GAAG,OAAO,CAE1F;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAyBT;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAGvD"}
|
package/dist/assets/asset.d.ts
CHANGED
|
@@ -12,9 +12,18 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export type UnifiedAssetType = 'image' | 'video' | 'audio' | 'text' | 'document' | 'graphics';
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Asset source category - where the asset came from (5 core values)
|
|
16
16
|
*/
|
|
17
|
-
export type AssetSource = '
|
|
17
|
+
export type AssetSource = 'generated' | 'uploaded' | 'library' | 'stock' | 'external';
|
|
18
|
+
/**
|
|
19
|
+
* Specific provider that created/sourced the asset (optional detail)
|
|
20
|
+
*/
|
|
21
|
+
export type AssetSourceProvider = 'pexels' | 'pixabay' | 'unsplash' | 'veo' | 'imagen' | 'stability' | 'runway' | 'elevenlabs' | 'suno' | 'google-photos' | 'youtube' | (string & {});
|
|
22
|
+
/**
|
|
23
|
+
* User preference for sourcing assets
|
|
24
|
+
* 'auto' = system decides based on availability/cost
|
|
25
|
+
*/
|
|
26
|
+
export type SourcePreference = AssetSource | 'auto';
|
|
18
27
|
/**
|
|
19
28
|
* Current processing status - unified type
|
|
20
29
|
*/
|
|
@@ -44,8 +53,10 @@ export interface Asset {
|
|
|
44
53
|
projectId?: string;
|
|
45
54
|
/** Type of asset */
|
|
46
55
|
type: UnifiedAssetType;
|
|
47
|
-
/** Where the asset came from */
|
|
56
|
+
/** Where the asset came from (category) */
|
|
48
57
|
source: AssetSource;
|
|
58
|
+
/** Specific provider (e.g., 'pexels', 'veo', 'stability') */
|
|
59
|
+
sourceProvider?: AssetSourceProvider;
|
|
49
60
|
/** Current processing status */
|
|
50
61
|
status: UnifiedAssetStatus;
|
|
51
62
|
/** File details */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../src/assets/asset.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../src/assets/asset.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,UAAU,GACV,SAAS,GACT,OAAO,GACP,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAE3B,QAAQ,GACR,SAAS,GACT,UAAU,GAEV,KAAK,GACL,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,MAAM,GAEN,eAAe,GACf,SAAS,GAET,CAAC,MAAM,GAAG,EAAE,CAAC,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AS,CAuBpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAclD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAatD"}
|
package/dist/index.es.js
CHANGED
|
@@ -216,7 +216,7 @@ function or(t, e, r) {
|
|
|
216
216
|
userId: e,
|
|
217
217
|
projectId: r,
|
|
218
218
|
type: i,
|
|
219
|
-
source: "
|
|
219
|
+
source: "uploaded",
|
|
220
220
|
status: "ready",
|
|
221
221
|
file: {
|
|
222
222
|
url: t.url,
|
|
@@ -330,13 +330,14 @@ function cr(t, e, r) {
|
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
function ur(t, e, r) {
|
|
333
|
-
const n = /* @__PURE__ */ new Date(), i = ve(t.mimeType || "image/jpeg", t.fileName), s = ["pexels", "pixabay", "unsplash"].includes(t.source) ? t.source :
|
|
333
|
+
const n = /* @__PURE__ */ new Date(), i = ve(t.mimeType || "image/jpeg", t.fileName), s = ["pexels", "pixabay", "unsplash"].includes(t.source), a = s ? "stock" : "external", o = s ? t.source : void 0;
|
|
334
334
|
return {
|
|
335
335
|
id: t.id,
|
|
336
336
|
userId: e,
|
|
337
337
|
projectId: r,
|
|
338
338
|
type: i,
|
|
339
|
-
source:
|
|
339
|
+
source: a,
|
|
340
|
+
sourceProvider: o,
|
|
340
341
|
status: "ready",
|
|
341
342
|
file: {
|
|
342
343
|
url: t.url,
|
|
@@ -384,7 +385,7 @@ function lr(t) {
|
|
|
384
385
|
userId: t.userId,
|
|
385
386
|
projectId: t.projectId,
|
|
386
387
|
type: t.type,
|
|
387
|
-
source: t.source || "
|
|
388
|
+
source: t.source || "uploaded",
|
|
388
389
|
status: t.status || "ready",
|
|
389
390
|
file: t.file,
|
|
390
391
|
metadata: t.metadata,
|
|
@@ -418,15 +419,11 @@ const Me = [
|
|
|
418
419
|
"document",
|
|
419
420
|
"graphics"
|
|
420
421
|
], Ze = [
|
|
421
|
-
"upload",
|
|
422
422
|
"generated",
|
|
423
|
+
"uploaded",
|
|
423
424
|
"library",
|
|
424
|
-
"
|
|
425
|
-
"
|
|
426
|
-
"pexels",
|
|
427
|
-
"pixabay",
|
|
428
|
-
"unsplash",
|
|
429
|
-
"render"
|
|
425
|
+
"stock",
|
|
426
|
+
"external"
|
|
430
427
|
], Ue = [
|
|
431
428
|
"processing",
|
|
432
429
|
"ready",
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(d,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(d=typeof globalThis<"u"?globalThis:d||self,C(d.etaioCoreTypes={}))})(this,function(d){"use strict";var or=Object.defineProperty;var dr=(d,C,z)=>C in d?or(d,C,{enumerable:!0,configurable:!0,writable:!0,value:z}):d[C]=z;var me=(d,C,z)=>dr(d,typeof C!="symbol"?C+"":C,z);function C(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"&&typeof t.userId=="string"&&typeof t.type=="string"&&t.file&&typeof t.file.url=="string"&&t.stats&&typeof t.stats.viewCount=="number"}function z(t){return t.source==="generated"&&t.generation!==void 0}function bt(t){return t.status==="ready"}function kt(t){return t.ai!==void 0&&(t.ai.description!==void 0||t.ai.transcription!==void 0||t.ai.extractedText!==void 0)}function wt(t){var e,i,r,n,a,s,o,h;return{id:t.id,type:t.type==="text"||t.type==="graphics"?"document":t.type,url:t.file.url,name:t.file.name,size:t.file.size,mimeType:t.file.mimeType,duration:(e=t.metadata)==null?void 0:e.duration,dimensions:(i=t.metadata)!=null&&i.width&&((r=t.metadata)!=null&&r.height)?{width:t.metadata.width,height:t.metadata.height}:void 0,thumbnail:(n=t.metadata)==null?void 0:n.thumbnail,description:(a=t.ai)==null?void 0:a.description,transcription:(s=t.ai)==null?void 0:s.transcription,extractedText:(o=t.ai)==null?void 0:o.extractedText,processingStatus:(h=t.ai)==null?void 0:h.processingStatus}}function Tt(t){var e;return((e=t.metadata)==null?void 0:e.title)||t.file.name||`${t.type}-${t.id}`}function St(t){const e=t.file.name.split(".");return e.length>1?(e[e.length-1]||"").toLowerCase():""}function Ct(t){return["image","video","audio"].includes(t.type)}function Et(t){if(t===0)return"0 Bytes";const e=1024,i=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,r)).toFixed(2))+" "+i[r]}function Ce(t,e="medium"){var i,r,n,a;if((r=(i=t.metadata)==null?void 0:i.thumbnails)!=null&&r[e])return t.metadata.thumbnails[e];if((n=t.metadata)!=null&&n.thumbnails){const s=t.metadata.thumbnails;return s.medium||s.large||s.small}if((a=t.metadata)!=null&&a.thumbnail)return t.metadata.thumbnail;if(t.type==="image")return t.file.url}function Ee(t){var i;if((i=t.metadata)!=null&&i.preview)return t.metadata.preview;const e=Ce(t);return e||t.file.url}function It(t){var e,i;return t.type==="image"||t.type==="video"?t.file.url:(i=(e=t.metadata)==null?void 0:e.thumbnails)!=null&&i.large?t.metadata.thumbnails.large:Ee(t)}function j(t,e){return t?t instanceof Date?e.fromDate(t):t:null}function w(t){if(t){if(t&&typeof t.toDate=="function")return t.toDate();if(t instanceof Date)return t}}function Rt(t){return{toFirestore:e=>({...e,createdAt:j(e.createdAt,t),updatedAt:j(e.updatedAt,t),expiresAt:j(e.expiresAt,t),archivedAt:j(e.archivedAt,t),trashedAt:j(e.trashedAt,t),stats:{...e.stats,lastUsed:j(e.stats.lastUsed,t)},file:{...e.file,signedUrlExpiry:j(e.file.signedUrlExpiry,t)}}),fromFirestore:e=>{var r,n;const i=e.data();if(!i)throw new Error("Document does not exist");return{...i,id:e.id,createdAt:w(i.createdAt)||new Date,updatedAt:w(i.updatedAt)||new Date,expiresAt:w(i.expiresAt),archivedAt:w(i.archivedAt),trashedAt:w(i.trashedAt),stats:{...i.stats,lastUsed:w((r=i.stats)==null?void 0:r.lastUsed)},file:{...i.file,signedUrlExpiry:w((n=i.file)==null?void 0:n.signedUrlExpiry)}}}}}const Ot={toFirestore:t=>{var i,r;const e={...t,createdAt:t.createdAt instanceof Date?t.createdAt:new Date(t.createdAt),updatedAt:t.updatedAt instanceof Date?t.updatedAt:new Date(t.updatedAt)};return t.expiresAt&&(e.expiresAt=t.expiresAt instanceof Date?t.expiresAt:new Date(t.expiresAt)),t.archivedAt&&(e.archivedAt=t.archivedAt instanceof Date?t.archivedAt:new Date(t.archivedAt)),t.trashedAt&&(e.trashedAt=t.trashedAt instanceof Date?t.trashedAt:new Date(t.trashedAt)),(i=t.stats)!=null&&i.lastUsed&&(e.stats={...t.stats,lastUsed:t.stats.lastUsed instanceof Date?t.stats.lastUsed:new Date(t.stats.lastUsed)}),(r=t.file)!=null&&r.signedUrlExpiry&&(e.file={...t.file,signedUrlExpiry:t.file.signedUrlExpiry instanceof Date?t.file.signedUrlExpiry:new Date(t.file.signedUrlExpiry)}),e},fromFirestore:t=>{var i,r;const e=t.data();return{...e,id:t.id||e.id,createdAt:w(e.createdAt)||new Date,updatedAt:w(e.updatedAt)||new Date,expiresAt:w(e.expiresAt),archivedAt:w(e.archivedAt),trashedAt:w(e.trashedAt),stats:{...e.stats,lastUsed:w((i=e.stats)==null?void 0:i.lastUsed)},file:{...e.file,signedUrlExpiry:w((r=e.file)==null?void 0:r.signedUrlExpiry)}}}};function ne(t,e){var r;const i=t.toLowerCase();if(i.startsWith("image/"))return"image";if(i.startsWith("video/"))return"video";if(i.startsWith("audio/"))return"audio";if(i.startsWith("text/"))return"text";if(i.includes("pdf")||i.includes("document")||i.includes("msword")||i.includes("spreadsheet")||i.includes("presentation"))return"document";if(i.includes("svg")||i.includes("illustrator"))return"graphics";if(e){const n=(r=e.split(".").pop())==null?void 0:r.toLowerCase();if(n){const a=["jpg","jpeg","png","gif","webp","bmp","ico"],s=["mp4","mov","avi","mkv","webm","flv"],o=["mp3","wav","ogg","flac","m4a","aac"],h=["pdf","doc","docx","xls","xlsx","ppt","pptx"],p=["svg","ai","eps"];if(a.includes(n))return"image";if(s.includes(n))return"video";if(o.includes(n))return"audio";if(h.includes(n))return"document";if(p.includes(n))return"graphics"}}return"document"}function Nt(t,e,i){const r=new Date,n=ne(t.mimeType||t.fileType,t.fileName);return{id:t.assetId,userId:e,projectId:i,type:n,source:"upload",status:"ready",file:{url:t.url,path:t.path,name:t.fileName,size:t.size,mimeType:t.mimeType||t.fileType,hash:t.hash,signedUrl:t.signedUrl,signedUrlExpiry:t.signedUrlExpiry instanceof Date?t.signedUrlExpiry:t.signedUrlExpiry?new Date(t.signedUrlExpiry):void 0},metadata:{...t.metadata,width:t.width,height:t.height,duration:t.duration,thumbnail:t.thumbnail,thumbnails:t.thumbnails,aspectRatio:t.width&&t.height?`${t.width}:${t.height}`:void 0},stats:{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:{access:"private",sharedWith:[],allowDownload:!0,allowExport:!0},createdAt:r,updatedAt:r}}function Dt(t){var i,r;const e=t.data();if(!e)throw new Error(`Document ${t.id} does not exist`);return{...e,id:t.id||e.id,createdAt:w(e.createdAt)||new Date,updatedAt:w(e.updatedAt)||new Date,expiresAt:w(e.expiresAt),archivedAt:w(e.archivedAt),trashedAt:w(e.trashedAt),stats:{...e.stats,lastUsed:w((i=e.stats)==null?void 0:i.lastUsed)},file:{...e.file,signedUrlExpiry:w((r=e.file)==null?void 0:r.signedUrlExpiry)}}}function Pt(t,e,i){const r=new Date,n=t.mimeType||"image/png",a=t.fileName||`generated-${t.id}.png`,s=ne(n,a);return{id:t.id,userId:e,projectId:i,type:s,source:"generated",status:"ready",file:{url:t.url,path:t.path||t.url,name:a,size:t.size||0,mimeType:n},metadata:{...t.metadata,width:t.width,height:t.height,duration:t.duration,aspectRatio:t.width&&t.height?`${t.width}:${t.height}`:void 0},generation:{provider:t.provider,model:t.model,prompt:t.prompt,revisedPrompt:t.revisedPrompt,negativePrompt:t.negativePrompt,parameters:t.parameters,cost:t.cost,currency:t.currency,tokens:t.tokens,credits:t.credits,generationTime:t.generationTime,requestId:t.requestId},stats:{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:{access:"private",sharedWith:[],allowDownload:!0,allowExport:!0},createdAt:r,updatedAt:r}}function Mt(t,e,i){const r=new Date,n=ne(t.mimeType||"image/jpeg",t.fileName),a=["pexels","pixabay","unsplash"].includes(t.source)?t.source:"external";return{id:t.id,userId:e,projectId:i,type:n,source:a,status:"ready",file:{url:t.url,path:t.url,name:t.fileName,size:t.size||0,mimeType:t.mimeType||"image/jpeg"},metadata:{title:t.description,description:t.description,tags:t.tags,width:t.width,height:t.height,aspectRatio:t.width&&t.height?`${t.width}:${t.height}`:void 0,thumbnail:t.thumbnail,thumbnails:t.thumbnails,colors:t.colors,externalId:t.externalId,externalSource:t.source,originalName:t.fileName},stats:{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:{access:"private",sharedWith:[],license:t.license,attribution:t.attribution||t.photographer,allowDownload:!0,allowExport:!0},createdAt:r,updatedAt:r}}function jt(t){const e=new Date;return{id:t.id,userId:t.userId,projectId:t.projectId,type:t.type,source:t.source||"upload",status:t.status||"ready",file:t.file,metadata:t.metadata,ai:t.ai,generation:t.generation,stats:t.stats||{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:t.permissions||{access:"private",sharedWith:[],allowDownload:!0,allowExport:!0},organization:t.organization,createdAt:t.createdAt||e,updatedAt:t.updatedAt||e,expiresAt:t.expiresAt,archivedAt:t.archivedAt,trashedAt:t.trashedAt}}const Ie=["image","video","audio","text","document","graphics"],Re=["upload","generated","library","external","recording","pexels","pixabay","unsplash","render"],Oe=["processing","ready","failed","archived"],Ne=["public","private","restricted"];function De(t){return typeof t=="string"&&Ie.includes(t)}function Pe(t){return typeof t=="string"&&Re.includes(t)}function Me(t){return typeof t=="string"&&Oe.includes(t)}function je(t){return typeof t=="string"&&Ne.includes(t)}function $e(t){const e=[];if((!t.id||typeof t.id!="string")&&e.push("Asset ID is required and must be a string"),(!t.userId||typeof t.userId!="string")&&e.push("User ID is required and must be a string"),t.type?De(t.type)||e.push(`Invalid asset type: ${t.type}. Must be one of: ${Ie.join(", ")}`):e.push("Asset type is required"),t.source?Pe(t.source)||e.push(`Invalid asset source: ${t.source}. Must be one of: ${Re.join(", ")}`):e.push("Asset source is required"),t.status?Me(t.status)||e.push(`Invalid asset status: ${t.status}. Must be one of: ${Oe.join(", ")}`):e.push("Asset status is required"),!t.file)e.push("File information is required");else{const i=Ue(t.file);e.push(...i)}return t.stats?((typeof t.stats.viewCount!="number"||t.stats.viewCount<0)&&e.push("Stats viewCount must be a non-negative number"),(typeof t.stats.useCount!="number"||t.stats.useCount<0)&&e.push("Stats useCount must be a non-negative number"),typeof t.stats.isFavorite!="boolean"&&e.push("Stats isFavorite must be a boolean")):e.push("Stats object is required"),t.permissions?(je(t.permissions.access)||e.push(`Invalid access level: ${t.permissions.access}. Must be one of: ${Ne.join(", ")}`),Array.isArray(t.permissions.sharedWith)||e.push("Permissions sharedWith must be an array")):e.push("Permissions object is required"),t.createdAt?!(t.createdAt instanceof Date)&&typeof t.createdAt!="string"&&e.push("createdAt must be a Date object or ISO string"):e.push("createdAt timestamp is required"),t.updatedAt?!(t.updatedAt instanceof Date)&&typeof t.updatedAt!="string"&&e.push("updatedAt must be a Date object or ISO string"):e.push("updatedAt timestamp is required"),{valid:e.length===0,errors:e}}function Ue(t){const e=[];if(!t.url||typeof t.url!="string")e.push("File URL is required and must be a string");else try{new URL(t.url)}catch{e.push("File URL must be a valid URL")}if((!t.path||typeof t.path!="string")&&e.push("File path is required and must be a string"),(!t.name||typeof t.name!="string")&&e.push("File name is required and must be a string"),(typeof t.size!="number"||t.size<0)&&e.push("File size must be a non-negative number"),(!t.mimeType||typeof t.mimeType!="string")&&e.push("File MIME type is required and must be a string"),t.signedUrl){try{new URL(t.signedUrl)}catch{e.push("Signed URL must be a valid URL")}t.signedUrlExpiry&&!(t.signedUrlExpiry instanceof Date)&&typeof t.signedUrlExpiry!="string"&&e.push("Signed URL expiry must be a Date object or ISO string")}return e}function Ze(t){const e=[];return t&&(t.width!==void 0&&(typeof t.width!="number"||t.width<=0)&&e.push("Metadata width must be a positive number"),t.height!==void 0&&(typeof t.height!="number"||t.height<=0)&&e.push("Metadata height must be a positive number"),t.duration!==void 0&&(typeof t.duration!="number"||t.duration<0)&&e.push("Metadata duration must be a non-negative number"),t.tags!==void 0&&!Array.isArray(t.tags)&&e.push("Metadata tags must be an array"),t.colors!==void 0&&!Array.isArray(t.colors)&&e.push("Metadata colors must be an array")),e}function Ve(t){const e=[];return t&&((!t.provider||typeof t.provider!="string")&&e.push("Generation provider is required and must be a string"),(!t.model||typeof t.model!="string")&&e.push("Generation model is required and must be a string"),(!t.prompt||typeof t.prompt!="string")&&e.push("Generation prompt is required and must be a string"),t.cost!==void 0&&typeof t.cost!="number"&&e.push("Generation cost must be a number"),t.tokens!==void 0&&typeof t.tokens!="number"&&e.push("Generation tokens must be a number")),e}function $t(t){const e=$e(t),i=Ze(t.metadata);if(e.errors.push(...i),t.generation){const r=Ve(t.generation);e.errors.push(...r)}return e.valid=e.errors.length===0,e}function Ut(t,e=100*1024*1024){return t>0&&t<=e}function Zt(t,e){const i=t.toLowerCase();switch(e){case"image":return i.startsWith("image/");case"video":return i.startsWith("video/");case"audio":return i.startsWith("audio/");case"text":return i.startsWith("text/");case"document":return i.includes("pdf")||i.includes("document")||i.includes("msword")||i.includes("spreadsheet")||i.includes("presentation");case"graphics":return i.includes("svg")||i.includes("illustrator");default:return!1}}function Vt(t){return t.status==="ready"&&!!t.file.url&&!t.trashedAt&&!t.archivedAt}function Ft(t){return t.expiresAt?new Date<new Date(t.expiresAt):!0}const Lt={micro:{width:320,height:180,format:"jpeg",quality:70},low:{width:640,height:360,format:"jpeg",quality:75},medium:{width:1280,height:720,format:"jpeg",quality:80},high:{width:1920,height:1080,format:"jpeg",quality:85}},qt={format:"mp3",bitrate:192,sampleRate:48e3,channels:2,enableTranscription:!0,whisperModel:"whisper-1",wordTimestamps:!0,temperature:0,enableDiarization:!0,enableSummarization:!0,enableTopics:!0,enableIntents:!0,enableSentiment:!0,enableEntities:!0},Bt={mp3:{mimeType:"audio/mpeg",extension:".mp3",defaultBitrate:192,maxChannels:2,description:"MP3 (MPEG Audio Layer III) - widely supported, good compression"},wav:{mimeType:"audio/wav",extension:".wav",defaultBitrate:1411,maxChannels:8,description:"WAV - lossless, high quality, large file size"},aac:{mimeType:"audio/aac",extension:".aac",defaultBitrate:128,maxChannels:48,description:"AAC - better quality than MP3 at same bitrate"},m4a:{mimeType:"audio/mp4",extension:".m4a",defaultBitrate:128,maxChannels:48,description:"M4A - AAC audio in MP4 container"},flac:{mimeType:"audio/flac",extension:".flac",defaultBitrate:1411,maxChannels:8,description:"FLAC - lossless compression, smaller than WAV"},ogg:{mimeType:"audio/ogg",extension:".ogg",defaultBitrate:128,maxChannels:255,description:"OGG Vorbis - open format, good quality"}},zt={"whisper-1":{maxDuration:25*60,costPerMinute:.006,languages:99,wordTimestamps:!0,description:"OpenAI Whisper API - most compatible"},"whisper-large-v2":{maxDuration:1/0,costPerMinute:.006,languages:99,wordTimestamps:!0,description:"Whisper Large V2 - high accuracy"},"whisper-large-v3":{maxDuration:1/0,costPerMinute:.006,languages:99,wordTimestamps:!0,description:"Whisper Large V3 - latest, best accuracy"}},Wt={minDialogueOverlap:.5,dialogueBuffer:.3,minHighlightDuration:3,maxHighlightDuration:30,minConfidenceScore:60,visualWeight:.35,dialogueWeight:.4,sentimentWeight:.15,topicWeight:.1,preferAction:!0,preferSpeakerChanges:!0,preferPositiveSentiment:!0};function Gt(t,e,i,r){const n=Math.max(t,i),a=Math.min(e,r),s=Math.max(0,a-n),o=Math.max(e-t,r-i),h=o>0?s/o:0;return{duration:s,percentage:h}}function Ht(t){return t>=90?"excellent":t>=75?"high":t>=60?"medium":"low"}function Qt(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60),r=Math.floor(t%60);return[e.toString().padStart(2,"0"),i.toString().padStart(2,"0"),r.toString().padStart(2,"0")].join(":")}function Yt(t){const e=t.trim();if(e.length===0)return!1;const i=e[e.length-1];return[".","!","?"].includes(i)}function Jt(t,e){const i=e.visualWeight+e.dialogueWeight+e.sentimentWeight+e.topicWeight;if(i===0)return 0;const r=(t.visual*e.visualWeight+t.dialogue*e.dialogueWeight+t.sentiment*e.sentimentWeight+t.topic*e.topicWeight)/i;return Math.min(100,Math.max(0,r))}function Xt(t){return{action:"#FF6B6B",dialogue:"#4ECDC4",reaction:"#FFD93D",transition:"#95E1D3",establishing:"#6C5CE7",climax:"#FF4757",resolution:"#2ECC71","b-roll":"#95A5A6",custom:"#A29BFE"}[t]||"#95A5A6"}function Kt(t){return{action:"⚡",dialogue:"💬",reaction:"😮",transition:"🔄",establishing:"🎬",climax:"🎯",resolution:"✨","b-roll":"📹",custom:"⭐"}[t]||"📌"}const ei={containerWidth:800,linesPerCaption:2,fontSize:48,fontFamily:"Poppins",color:"#DADADA",appearedColor:"#FFFFFF",activeColor:"#50FF12",activeFillColor:"#7E12FF",backgroundColor:"transparent",borderWidth:5,borderColor:"#000000",textAlign:"center"};function ti(t){return t.length?t.map((e,i)=>{var n,a,s,o,h;const r=[`Reference ${i+1}: ${e.metadata.title||"Untitled"} (${e.type})`];return e.metadata.description&&r.push(` Description: ${e.metadata.description}`),(n=e.metadata.tags)!=null&&n.length&&r.push(` Tags: ${e.metadata.tags.join(", ")}`),e.analysis.status==="completed"&&(e.analysis.mood&&r.push(` Mood: ${e.analysis.mood}`),(a=e.analysis.colors)!=null&&a.length&&r.push(` Colors: ${e.analysis.colors.slice(0,5).join(", ")}`),(s=e.analysis.keywords)!=null&&s.length&&r.push(` Keywords: ${e.analysis.keywords.slice(0,10).join(", ")}`),(o=e.analysis.objects)!=null&&o.length&&r.push(` Objects: ${e.analysis.objects.slice(0,10).join(", ")}`),(h=e.analysis.scenes)!=null&&h.length&&r.push(` Scenes: ${e.analysis.scenes.slice(0,5).join(", ")}`),e.analysis.transcriptSummary&&r.push(` Audio: ${e.analysis.transcriptSummary.slice(0,200)}...`),e.analysis.description&&r.push(` AI Description: ${e.analysis.description}`)),e.intent&&r.push(` Usage: ${e.intent}`),e.notes&&r.push(` Notes: ${e.notes}`),r.join(`
|
|
1
|
+
(function(d,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(d=typeof globalThis<"u"?globalThis:d||self,C(d.etaioCoreTypes={}))})(this,function(d){"use strict";var or=Object.defineProperty;var dr=(d,C,z)=>C in d?or(d,C,{enumerable:!0,configurable:!0,writable:!0,value:z}):d[C]=z;var me=(d,C,z)=>dr(d,typeof C!="symbol"?C+"":C,z);function C(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"&&typeof t.userId=="string"&&typeof t.type=="string"&&t.file&&typeof t.file.url=="string"&&t.stats&&typeof t.stats.viewCount=="number"}function z(t){return t.source==="generated"&&t.generation!==void 0}function bt(t){return t.status==="ready"}function kt(t){return t.ai!==void 0&&(t.ai.description!==void 0||t.ai.transcription!==void 0||t.ai.extractedText!==void 0)}function wt(t){var e,i,r,n,a,s,o,h;return{id:t.id,type:t.type==="text"||t.type==="graphics"?"document":t.type,url:t.file.url,name:t.file.name,size:t.file.size,mimeType:t.file.mimeType,duration:(e=t.metadata)==null?void 0:e.duration,dimensions:(i=t.metadata)!=null&&i.width&&((r=t.metadata)!=null&&r.height)?{width:t.metadata.width,height:t.metadata.height}:void 0,thumbnail:(n=t.metadata)==null?void 0:n.thumbnail,description:(a=t.ai)==null?void 0:a.description,transcription:(s=t.ai)==null?void 0:s.transcription,extractedText:(o=t.ai)==null?void 0:o.extractedText,processingStatus:(h=t.ai)==null?void 0:h.processingStatus}}function Tt(t){var e;return((e=t.metadata)==null?void 0:e.title)||t.file.name||`${t.type}-${t.id}`}function St(t){const e=t.file.name.split(".");return e.length>1?(e[e.length-1]||"").toLowerCase():""}function Ct(t){return["image","video","audio"].includes(t.type)}function Et(t){if(t===0)return"0 Bytes";const e=1024,i=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,r)).toFixed(2))+" "+i[r]}function Ce(t,e="medium"){var i,r,n,a;if((r=(i=t.metadata)==null?void 0:i.thumbnails)!=null&&r[e])return t.metadata.thumbnails[e];if((n=t.metadata)!=null&&n.thumbnails){const s=t.metadata.thumbnails;return s.medium||s.large||s.small}if((a=t.metadata)!=null&&a.thumbnail)return t.metadata.thumbnail;if(t.type==="image")return t.file.url}function Ee(t){var i;if((i=t.metadata)!=null&&i.preview)return t.metadata.preview;const e=Ce(t);return e||t.file.url}function It(t){var e,i;return t.type==="image"||t.type==="video"?t.file.url:(i=(e=t.metadata)==null?void 0:e.thumbnails)!=null&&i.large?t.metadata.thumbnails.large:Ee(t)}function j(t,e){return t?t instanceof Date?e.fromDate(t):t:null}function w(t){if(t){if(t&&typeof t.toDate=="function")return t.toDate();if(t instanceof Date)return t}}function Rt(t){return{toFirestore:e=>({...e,createdAt:j(e.createdAt,t),updatedAt:j(e.updatedAt,t),expiresAt:j(e.expiresAt,t),archivedAt:j(e.archivedAt,t),trashedAt:j(e.trashedAt,t),stats:{...e.stats,lastUsed:j(e.stats.lastUsed,t)},file:{...e.file,signedUrlExpiry:j(e.file.signedUrlExpiry,t)}}),fromFirestore:e=>{var r,n;const i=e.data();if(!i)throw new Error("Document does not exist");return{...i,id:e.id,createdAt:w(i.createdAt)||new Date,updatedAt:w(i.updatedAt)||new Date,expiresAt:w(i.expiresAt),archivedAt:w(i.archivedAt),trashedAt:w(i.trashedAt),stats:{...i.stats,lastUsed:w((r=i.stats)==null?void 0:r.lastUsed)},file:{...i.file,signedUrlExpiry:w((n=i.file)==null?void 0:n.signedUrlExpiry)}}}}}const Ot={toFirestore:t=>{var i,r;const e={...t,createdAt:t.createdAt instanceof Date?t.createdAt:new Date(t.createdAt),updatedAt:t.updatedAt instanceof Date?t.updatedAt:new Date(t.updatedAt)};return t.expiresAt&&(e.expiresAt=t.expiresAt instanceof Date?t.expiresAt:new Date(t.expiresAt)),t.archivedAt&&(e.archivedAt=t.archivedAt instanceof Date?t.archivedAt:new Date(t.archivedAt)),t.trashedAt&&(e.trashedAt=t.trashedAt instanceof Date?t.trashedAt:new Date(t.trashedAt)),(i=t.stats)!=null&&i.lastUsed&&(e.stats={...t.stats,lastUsed:t.stats.lastUsed instanceof Date?t.stats.lastUsed:new Date(t.stats.lastUsed)}),(r=t.file)!=null&&r.signedUrlExpiry&&(e.file={...t.file,signedUrlExpiry:t.file.signedUrlExpiry instanceof Date?t.file.signedUrlExpiry:new Date(t.file.signedUrlExpiry)}),e},fromFirestore:t=>{var i,r;const e=t.data();return{...e,id:t.id||e.id,createdAt:w(e.createdAt)||new Date,updatedAt:w(e.updatedAt)||new Date,expiresAt:w(e.expiresAt),archivedAt:w(e.archivedAt),trashedAt:w(e.trashedAt),stats:{...e.stats,lastUsed:w((i=e.stats)==null?void 0:i.lastUsed)},file:{...e.file,signedUrlExpiry:w((r=e.file)==null?void 0:r.signedUrlExpiry)}}}};function ne(t,e){var r;const i=t.toLowerCase();if(i.startsWith("image/"))return"image";if(i.startsWith("video/"))return"video";if(i.startsWith("audio/"))return"audio";if(i.startsWith("text/"))return"text";if(i.includes("pdf")||i.includes("document")||i.includes("msword")||i.includes("spreadsheet")||i.includes("presentation"))return"document";if(i.includes("svg")||i.includes("illustrator"))return"graphics";if(e){const n=(r=e.split(".").pop())==null?void 0:r.toLowerCase();if(n){const a=["jpg","jpeg","png","gif","webp","bmp","ico"],s=["mp4","mov","avi","mkv","webm","flv"],o=["mp3","wav","ogg","flac","m4a","aac"],h=["pdf","doc","docx","xls","xlsx","ppt","pptx"],p=["svg","ai","eps"];if(a.includes(n))return"image";if(s.includes(n))return"video";if(o.includes(n))return"audio";if(h.includes(n))return"document";if(p.includes(n))return"graphics"}}return"document"}function Nt(t,e,i){const r=new Date,n=ne(t.mimeType||t.fileType,t.fileName);return{id:t.assetId,userId:e,projectId:i,type:n,source:"uploaded",status:"ready",file:{url:t.url,path:t.path,name:t.fileName,size:t.size,mimeType:t.mimeType||t.fileType,hash:t.hash,signedUrl:t.signedUrl,signedUrlExpiry:t.signedUrlExpiry instanceof Date?t.signedUrlExpiry:t.signedUrlExpiry?new Date(t.signedUrlExpiry):void 0},metadata:{...t.metadata,width:t.width,height:t.height,duration:t.duration,thumbnail:t.thumbnail,thumbnails:t.thumbnails,aspectRatio:t.width&&t.height?`${t.width}:${t.height}`:void 0},stats:{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:{access:"private",sharedWith:[],allowDownload:!0,allowExport:!0},createdAt:r,updatedAt:r}}function Dt(t){var i,r;const e=t.data();if(!e)throw new Error(`Document ${t.id} does not exist`);return{...e,id:t.id||e.id,createdAt:w(e.createdAt)||new Date,updatedAt:w(e.updatedAt)||new Date,expiresAt:w(e.expiresAt),archivedAt:w(e.archivedAt),trashedAt:w(e.trashedAt),stats:{...e.stats,lastUsed:w((i=e.stats)==null?void 0:i.lastUsed)},file:{...e.file,signedUrlExpiry:w((r=e.file)==null?void 0:r.signedUrlExpiry)}}}function Pt(t,e,i){const r=new Date,n=t.mimeType||"image/png",a=t.fileName||`generated-${t.id}.png`,s=ne(n,a);return{id:t.id,userId:e,projectId:i,type:s,source:"generated",status:"ready",file:{url:t.url,path:t.path||t.url,name:a,size:t.size||0,mimeType:n},metadata:{...t.metadata,width:t.width,height:t.height,duration:t.duration,aspectRatio:t.width&&t.height?`${t.width}:${t.height}`:void 0},generation:{provider:t.provider,model:t.model,prompt:t.prompt,revisedPrompt:t.revisedPrompt,negativePrompt:t.negativePrompt,parameters:t.parameters,cost:t.cost,currency:t.currency,tokens:t.tokens,credits:t.credits,generationTime:t.generationTime,requestId:t.requestId},stats:{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:{access:"private",sharedWith:[],allowDownload:!0,allowExport:!0},createdAt:r,updatedAt:r}}function Mt(t,e,i){const r=new Date,n=ne(t.mimeType||"image/jpeg",t.fileName),a=["pexels","pixabay","unsplash"].includes(t.source),s=a?"stock":"external",o=a?t.source:void 0;return{id:t.id,userId:e,projectId:i,type:n,source:s,sourceProvider:o,status:"ready",file:{url:t.url,path:t.url,name:t.fileName,size:t.size||0,mimeType:t.mimeType||"image/jpeg"},metadata:{title:t.description,description:t.description,tags:t.tags,width:t.width,height:t.height,aspectRatio:t.width&&t.height?`${t.width}:${t.height}`:void 0,thumbnail:t.thumbnail,thumbnails:t.thumbnails,colors:t.colors,externalId:t.externalId,externalSource:t.source,originalName:t.fileName},stats:{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:{access:"private",sharedWith:[],license:t.license,attribution:t.attribution||t.photographer,allowDownload:!0,allowExport:!0},createdAt:r,updatedAt:r}}function jt(t){const e=new Date;return{id:t.id,userId:t.userId,projectId:t.projectId,type:t.type,source:t.source||"uploaded",status:t.status||"ready",file:t.file,metadata:t.metadata,ai:t.ai,generation:t.generation,stats:t.stats||{viewCount:0,useCount:0,isFavorite:!1,downloadCount:0},permissions:t.permissions||{access:"private",sharedWith:[],allowDownload:!0,allowExport:!0},organization:t.organization,createdAt:t.createdAt||e,updatedAt:t.updatedAt||e,expiresAt:t.expiresAt,archivedAt:t.archivedAt,trashedAt:t.trashedAt}}const Ie=["image","video","audio","text","document","graphics"],Re=["generated","uploaded","library","stock","external"],Oe=["processing","ready","failed","archived"],Ne=["public","private","restricted"];function De(t){return typeof t=="string"&&Ie.includes(t)}function Pe(t){return typeof t=="string"&&Re.includes(t)}function Me(t){return typeof t=="string"&&Oe.includes(t)}function je(t){return typeof t=="string"&&Ne.includes(t)}function $e(t){const e=[];if((!t.id||typeof t.id!="string")&&e.push("Asset ID is required and must be a string"),(!t.userId||typeof t.userId!="string")&&e.push("User ID is required and must be a string"),t.type?De(t.type)||e.push(`Invalid asset type: ${t.type}. Must be one of: ${Ie.join(", ")}`):e.push("Asset type is required"),t.source?Pe(t.source)||e.push(`Invalid asset source: ${t.source}. Must be one of: ${Re.join(", ")}`):e.push("Asset source is required"),t.status?Me(t.status)||e.push(`Invalid asset status: ${t.status}. Must be one of: ${Oe.join(", ")}`):e.push("Asset status is required"),!t.file)e.push("File information is required");else{const i=Ue(t.file);e.push(...i)}return t.stats?((typeof t.stats.viewCount!="number"||t.stats.viewCount<0)&&e.push("Stats viewCount must be a non-negative number"),(typeof t.stats.useCount!="number"||t.stats.useCount<0)&&e.push("Stats useCount must be a non-negative number"),typeof t.stats.isFavorite!="boolean"&&e.push("Stats isFavorite must be a boolean")):e.push("Stats object is required"),t.permissions?(je(t.permissions.access)||e.push(`Invalid access level: ${t.permissions.access}. Must be one of: ${Ne.join(", ")}`),Array.isArray(t.permissions.sharedWith)||e.push("Permissions sharedWith must be an array")):e.push("Permissions object is required"),t.createdAt?!(t.createdAt instanceof Date)&&typeof t.createdAt!="string"&&e.push("createdAt must be a Date object or ISO string"):e.push("createdAt timestamp is required"),t.updatedAt?!(t.updatedAt instanceof Date)&&typeof t.updatedAt!="string"&&e.push("updatedAt must be a Date object or ISO string"):e.push("updatedAt timestamp is required"),{valid:e.length===0,errors:e}}function Ue(t){const e=[];if(!t.url||typeof t.url!="string")e.push("File URL is required and must be a string");else try{new URL(t.url)}catch{e.push("File URL must be a valid URL")}if((!t.path||typeof t.path!="string")&&e.push("File path is required and must be a string"),(!t.name||typeof t.name!="string")&&e.push("File name is required and must be a string"),(typeof t.size!="number"||t.size<0)&&e.push("File size must be a non-negative number"),(!t.mimeType||typeof t.mimeType!="string")&&e.push("File MIME type is required and must be a string"),t.signedUrl){try{new URL(t.signedUrl)}catch{e.push("Signed URL must be a valid URL")}t.signedUrlExpiry&&!(t.signedUrlExpiry instanceof Date)&&typeof t.signedUrlExpiry!="string"&&e.push("Signed URL expiry must be a Date object or ISO string")}return e}function Ze(t){const e=[];return t&&(t.width!==void 0&&(typeof t.width!="number"||t.width<=0)&&e.push("Metadata width must be a positive number"),t.height!==void 0&&(typeof t.height!="number"||t.height<=0)&&e.push("Metadata height must be a positive number"),t.duration!==void 0&&(typeof t.duration!="number"||t.duration<0)&&e.push("Metadata duration must be a non-negative number"),t.tags!==void 0&&!Array.isArray(t.tags)&&e.push("Metadata tags must be an array"),t.colors!==void 0&&!Array.isArray(t.colors)&&e.push("Metadata colors must be an array")),e}function Ve(t){const e=[];return t&&((!t.provider||typeof t.provider!="string")&&e.push("Generation provider is required and must be a string"),(!t.model||typeof t.model!="string")&&e.push("Generation model is required and must be a string"),(!t.prompt||typeof t.prompt!="string")&&e.push("Generation prompt is required and must be a string"),t.cost!==void 0&&typeof t.cost!="number"&&e.push("Generation cost must be a number"),t.tokens!==void 0&&typeof t.tokens!="number"&&e.push("Generation tokens must be a number")),e}function $t(t){const e=$e(t),i=Ze(t.metadata);if(e.errors.push(...i),t.generation){const r=Ve(t.generation);e.errors.push(...r)}return e.valid=e.errors.length===0,e}function Ut(t,e=100*1024*1024){return t>0&&t<=e}function Zt(t,e){const i=t.toLowerCase();switch(e){case"image":return i.startsWith("image/");case"video":return i.startsWith("video/");case"audio":return i.startsWith("audio/");case"text":return i.startsWith("text/");case"document":return i.includes("pdf")||i.includes("document")||i.includes("msword")||i.includes("spreadsheet")||i.includes("presentation");case"graphics":return i.includes("svg")||i.includes("illustrator");default:return!1}}function Vt(t){return t.status==="ready"&&!!t.file.url&&!t.trashedAt&&!t.archivedAt}function Ft(t){return t.expiresAt?new Date<new Date(t.expiresAt):!0}const Lt={micro:{width:320,height:180,format:"jpeg",quality:70},low:{width:640,height:360,format:"jpeg",quality:75},medium:{width:1280,height:720,format:"jpeg",quality:80},high:{width:1920,height:1080,format:"jpeg",quality:85}},qt={format:"mp3",bitrate:192,sampleRate:48e3,channels:2,enableTranscription:!0,whisperModel:"whisper-1",wordTimestamps:!0,temperature:0,enableDiarization:!0,enableSummarization:!0,enableTopics:!0,enableIntents:!0,enableSentiment:!0,enableEntities:!0},Bt={mp3:{mimeType:"audio/mpeg",extension:".mp3",defaultBitrate:192,maxChannels:2,description:"MP3 (MPEG Audio Layer III) - widely supported, good compression"},wav:{mimeType:"audio/wav",extension:".wav",defaultBitrate:1411,maxChannels:8,description:"WAV - lossless, high quality, large file size"},aac:{mimeType:"audio/aac",extension:".aac",defaultBitrate:128,maxChannels:48,description:"AAC - better quality than MP3 at same bitrate"},m4a:{mimeType:"audio/mp4",extension:".m4a",defaultBitrate:128,maxChannels:48,description:"M4A - AAC audio in MP4 container"},flac:{mimeType:"audio/flac",extension:".flac",defaultBitrate:1411,maxChannels:8,description:"FLAC - lossless compression, smaller than WAV"},ogg:{mimeType:"audio/ogg",extension:".ogg",defaultBitrate:128,maxChannels:255,description:"OGG Vorbis - open format, good quality"}},zt={"whisper-1":{maxDuration:25*60,costPerMinute:.006,languages:99,wordTimestamps:!0,description:"OpenAI Whisper API - most compatible"},"whisper-large-v2":{maxDuration:1/0,costPerMinute:.006,languages:99,wordTimestamps:!0,description:"Whisper Large V2 - high accuracy"},"whisper-large-v3":{maxDuration:1/0,costPerMinute:.006,languages:99,wordTimestamps:!0,description:"Whisper Large V3 - latest, best accuracy"}},Wt={minDialogueOverlap:.5,dialogueBuffer:.3,minHighlightDuration:3,maxHighlightDuration:30,minConfidenceScore:60,visualWeight:.35,dialogueWeight:.4,sentimentWeight:.15,topicWeight:.1,preferAction:!0,preferSpeakerChanges:!0,preferPositiveSentiment:!0};function Gt(t,e,i,r){const n=Math.max(t,i),a=Math.min(e,r),s=Math.max(0,a-n),o=Math.max(e-t,r-i),h=o>0?s/o:0;return{duration:s,percentage:h}}function Ht(t){return t>=90?"excellent":t>=75?"high":t>=60?"medium":"low"}function Qt(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60),r=Math.floor(t%60);return[e.toString().padStart(2,"0"),i.toString().padStart(2,"0"),r.toString().padStart(2,"0")].join(":")}function Yt(t){const e=t.trim();if(e.length===0)return!1;const i=e[e.length-1];return[".","!","?"].includes(i)}function Jt(t,e){const i=e.visualWeight+e.dialogueWeight+e.sentimentWeight+e.topicWeight;if(i===0)return 0;const r=(t.visual*e.visualWeight+t.dialogue*e.dialogueWeight+t.sentiment*e.sentimentWeight+t.topic*e.topicWeight)/i;return Math.min(100,Math.max(0,r))}function Xt(t){return{action:"#FF6B6B",dialogue:"#4ECDC4",reaction:"#FFD93D",transition:"#95E1D3",establishing:"#6C5CE7",climax:"#FF4757",resolution:"#2ECC71","b-roll":"#95A5A6",custom:"#A29BFE"}[t]||"#95A5A6"}function Kt(t){return{action:"⚡",dialogue:"💬",reaction:"😮",transition:"🔄",establishing:"🎬",climax:"🎯",resolution:"✨","b-roll":"📹",custom:"⭐"}[t]||"📌"}const ei={containerWidth:800,linesPerCaption:2,fontSize:48,fontFamily:"Poppins",color:"#DADADA",appearedColor:"#FFFFFF",activeColor:"#50FF12",activeFillColor:"#7E12FF",backgroundColor:"transparent",borderWidth:5,borderColor:"#000000",textAlign:"center"};function ti(t){return t.length?t.map((e,i)=>{var n,a,s,o,h;const r=[`Reference ${i+1}: ${e.metadata.title||"Untitled"} (${e.type})`];return e.metadata.description&&r.push(` Description: ${e.metadata.description}`),(n=e.metadata.tags)!=null&&n.length&&r.push(` Tags: ${e.metadata.tags.join(", ")}`),e.analysis.status==="completed"&&(e.analysis.mood&&r.push(` Mood: ${e.analysis.mood}`),(a=e.analysis.colors)!=null&&a.length&&r.push(` Colors: ${e.analysis.colors.slice(0,5).join(", ")}`),(s=e.analysis.keywords)!=null&&s.length&&r.push(` Keywords: ${e.analysis.keywords.slice(0,10).join(", ")}`),(o=e.analysis.objects)!=null&&o.length&&r.push(` Objects: ${e.analysis.objects.slice(0,10).join(", ")}`),(h=e.analysis.scenes)!=null&&h.length&&r.push(` Scenes: ${e.analysis.scenes.slice(0,5).join(", ")}`),e.analysis.transcriptSummary&&r.push(` Audio: ${e.analysis.transcriptSummary.slice(0,200)}...`),e.analysis.description&&r.push(` AI Description: ${e.analysis.description}`)),e.intent&&r.push(` Usage: ${e.intent}`),e.notes&&r.push(` Notes: ${e.notes}`),r.join(`
|
|
2
2
|
`)}).join(`
|
|
3
3
|
|
|
4
4
|
`):""}function ii(t){const{status:e}=t.analysis;return e==="pending"||e==="failed"}function ri(t){if(!t.length)return 100;const e=t.filter(i=>i.analysis.status==="completed"||i.analysis.status==="skipped").length;return Math.round(e/t.length*100)}class $ extends Error{constructor(e,i,r,n=!1,a){super(e),this.code=i,this.provider=r,this.retryable=n,this.details=a,this.name="ProviderError"}}class ni extends ${constructor(e,i){super(`Provider quota exceeded for ${e}`,"QUOTA_EXCEEDED",e,!1,i),this.name="ProviderQuotaError"}}class Fe extends ${constructor(e,i){super(`Rate limit exceeded for ${e}`,"RATE_LIMITED",e,!0,{retryAfter:i}),this.name="ProviderRateLimitError"}}class Le extends ${constructor(e,i){super(`Authentication failed for ${e}`,"AUTH_FAILED",e,!1,i),this.name="ProviderAuthError"}}class ai extends ${constructor(e,i){super(`Request timeout for ${e} after ${i}ms`,"TIMEOUT",e,!0,{timeout:i}),this.name="ProviderTimeoutError"}}class si extends ${constructor(e,i){super(`Validation failed for ${e}: ${i.join(", ")}`,"VALIDATION_FAILED",e,!1,{errors:i}),this.name="ProviderValidationError"}}class oi{constructor(e){me(this,"config");me(this,"retryCount",0);this.config=e}async executeWithRetry(e,i){var o,h,p,x;const r=((o=this.config.retry)==null?void 0:o.maxAttempts)||3,n=((h=this.config.retry)==null?void 0:h.backoffMultiplier)||2,a=((p=this.config.retry)==null?void 0:p.maxDelay)||3e4;let s;for(let I=0;I<r;I++)try{return this.retryCount=I,await e()}catch(M){if(s=M,M instanceof $&&!M.retryable)throw M;if(I<r-1){const sr=Math.min(Math.pow(n,I)*1e3,a);M instanceof Fe&&((x=M.details)!=null&&x.retryAfter)?await this.delay(M.details.retryAfter*1e3):await this.delay(sr)}}throw s||new $(`Failed after ${r} attempts`,"MAX_RETRIES",i,!1)}delay(e){return new Promise(i=>setTimeout(i,e))}validateCredentials(){if(!this.config.apiKey&&!this.config.endpoint)throw new Le("unknown",{message:"No API key or endpoint configured"})}}class di{constructor(){me(this,"providers",new Map)}register(e,i){this.providers.set(e,i)}get(e){return this.providers.get(e)}list(){return Array.from(this.providers.keys())}has(e){return this.providers.has(e)}remove(e){return this.providers.delete(e)}getByType(e){return Array.from(this.providers.values()).filter(i=>i.type===e)}}class ci extends Error{constructor(e,i,r,n,a){super(i),this.code=e,this.provider=r,this.statusCode=n,this.details=a,this.name="GenAIException"}}function ui(t){let e=t.content;if(t.attachments&&t.attachments.length>0){const i=t.attachments.map(r=>{let n=`[${r.type.toUpperCase()}: ${r.name||"Untitled"}]`;return r.description&&(n+=` - ${r.description}`),r.transcription&&(n+=`
|