Comparing version 0.0.18 to 0.0.19
@@ -1,2 +0,2 @@ | ||
var __create=Object.create,__defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __markAsModule=target=>__defProp(target,"__esModule",{value:!0});var __commonJS=(cb,mod)=>function(){return mod||(0,cb[Object.keys(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports},__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__reExport=(target,module2,desc)=>{if(module2&&typeof module2=="object"||typeof module2=="function")for(let key of __getOwnPropNames(module2))!__hasOwnProp.call(target,key)&&key!=="default"&&__defProp(target,key,{get:()=>module2[key],enumerable:!(desc=__getOwnPropDesc(module2,key))||desc.enumerable});return target},__toModule=module2=>__reExport(__markAsModule(__defProp(module2!=null?__create(__getProtoOf(module2)):{},"default",module2&&module2.__esModule&&"default"in module2?{get:()=>module2.default,enumerable:!0}:{value:module2,enumerable:!0})),module2);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var require_tslib=__commonJS({"node_modules/rxjs/node_modules/tslib/tslib.js"(exports,module2){var __extends2,__assign2,__rest2,__decorate2,__param2,__metadata2,__awaiter2,__generator2,__exportStar2,__values2,__read2,__spread2,__spreadArrays2,__spreadArray2,__await2,__asyncGenerator2,__asyncDelegator2,__asyncValues2,__makeTemplateObject2,__importStar2,__importDefault2,__classPrivateFieldGet2,__classPrivateFieldSet2,__createBinding2;(function(factory){var root=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(exports2){factory(createExporter(root,createExporter(exports2)))}):typeof module2=="object"&&typeof module2.exports=="object"?factory(createExporter(root,createExporter(module2.exports))):factory(createExporter(root));function createExporter(exports2,previous){return exports2!==root&&(typeof Object.create=="function"?Object.defineProperty(exports2,"__esModule",{value:!0}):exports2.__esModule=!0),function(id,v){return exports2[id]=previous?previous(id,v):v}}})(function(exporter){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])};__extends2=function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)},__assign2=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__rest2=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},__decorate2=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},__param2=function(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}},__metadata2=function(metadataKey,metadataValue){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(metadataKey,metadataValue)},__awaiter2=function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator2=function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=op[0]&2?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[op[0]&2,t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(t=_.trys,!(t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}},__exportStar2=function(m,o){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(o,p)&&__createBinding2(o,m,p)},__createBinding2=Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m[k]}})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]},__values2=function(o){var s=typeof Symbol=="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")},__read2=function(o,n){var m=typeof Symbol=="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar},__spread2=function(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read2(arguments[i]));return ar},__spreadArrays2=function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r},__spreadArray2=function(to,from){for(var i=0,il=from.length,j=to.length;i<il;i++,j++)to[j]=from[i];return to},__await2=function(v){return this instanceof __await2?(this.v=v,this):new __await2(v)},__asyncGenerator2=function(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})})}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await2?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}},__asyncDelegator2=function(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await2(o[n](v)),done:n==="return"}:f?f(v):v}:f}},__asyncValues2=function(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values2=="function"?__values2(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v2){resolve({value:v2,done:d})},reject)}},__makeTemplateObject2=function(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked};var __setModuleDefault=Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v};__importStar2=function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding2(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault2=function(mod){return mod&&mod.__esModule?mod:{default:mod}},__classPrivateFieldGet2=function(receiver,privateMap){if(!privateMap.has(receiver))throw new TypeError("attempted to get private field on non-instance");return privateMap.get(receiver)},__classPrivateFieldSet2=function(receiver,privateMap,value){if(!privateMap.has(receiver))throw new TypeError("attempted to set private field on non-instance");return privateMap.set(receiver,value),value},exporter("__extends",__extends2),exporter("__assign",__assign2),exporter("__rest",__rest2),exporter("__decorate",__decorate2),exporter("__param",__param2),exporter("__metadata",__metadata2),exporter("__awaiter",__awaiter2),exporter("__generator",__generator2),exporter("__exportStar",__exportStar2),exporter("__createBinding",__createBinding2),exporter("__values",__values2),exporter("__read",__read2),exporter("__spread",__spread2),exporter("__spreadArrays",__spreadArrays2),exporter("__spreadArray",__spreadArray2),exporter("__await",__await2),exporter("__asyncGenerator",__asyncGenerator2),exporter("__asyncDelegator",__asyncDelegator2),exporter("__asyncValues",__asyncValues2),exporter("__makeTemplateObject",__makeTemplateObject2),exporter("__importStar",__importStar2),exporter("__importDefault",__importDefault2),exporter("__classPrivateFieldGet",__classPrivateFieldGet2),exporter("__classPrivateFieldSet",__classPrivateFieldSet2)})}});__markAsModule(exports);__export(exports,{FilmstripOrientation:()=>FilmstripOrientation,Framo:()=>Framo,FramoImageExtension:()=>FramoImageExtension,FramoVideoExtension:()=>FramoVideoExtension});var ERROR_MESSAGES={FRAMO_NOT_INITIALIZED:"Framo has not been initialized. Please call initializeFramo before using any of the features",MEDIAINFO_COULD_NOT_LOAD:"Unable to fetch total frames: MediaInfo could not load",MEDIAINFO_COULD_NOT_ANALYZE_VIDEO:"Unable to analyze video",NO_FRAMERATE_IN_MEDIAINFO:"No framerate in mediainfo",COULD_EXTRACT_FRAMERATE_PROPERLY:"Could not extract framerate number properly"};var import_tslib=__toModule(require_tslib()),{__extends,__assign,__rest,__decorate,__param,__metadata,__awaiter,__generator,__exportStar,__createBinding,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault,__classPrivateFieldGet,__classPrivateFieldSet}=import_tslib.default;function isFunction(value){return typeof value=="function"}function createErrorClass(createImpl){var _super=function(instance){Error.call(instance),instance.stack=new Error().stack},ctorFunc=createImpl(_super);return ctorFunc.prototype=Object.create(Error.prototype),ctorFunc.prototype.constructor=ctorFunc,ctorFunc}var UnsubscriptionError=createErrorClass(function(_super){return function(errors){_super(this),this.message=errors?errors.length+` errors occurred during unsubscription: | ||
var __create=Object.create,__defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __markAsModule=target=>__defProp(target,"__esModule",{value:!0});var __commonJS=(cb,mod)=>function(){return mod||(0,cb[Object.keys(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports},__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__reExport=(target,module2,desc)=>{if(module2&&typeof module2=="object"||typeof module2=="function")for(let key of __getOwnPropNames(module2))!__hasOwnProp.call(target,key)&&key!=="default"&&__defProp(target,key,{get:()=>module2[key],enumerable:!(desc=__getOwnPropDesc(module2,key))||desc.enumerable});return target},__toModule=module2=>__reExport(__markAsModule(__defProp(module2!=null?__create(__getProtoOf(module2)):{},"default",module2&&module2.__esModule&&"default"in module2?{get:()=>module2.default,enumerable:!0}:{value:module2,enumerable:!0})),module2);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var require_tslib=__commonJS({"node_modules/rxjs/node_modules/tslib/tslib.js"(exports,module2){var __extends2,__assign2,__rest2,__decorate2,__param2,__metadata2,__awaiter2,__generator2,__exportStar2,__values2,__read2,__spread2,__spreadArrays2,__spreadArray2,__await2,__asyncGenerator2,__asyncDelegator2,__asyncValues2,__makeTemplateObject2,__importStar2,__importDefault2,__classPrivateFieldGet2,__classPrivateFieldSet2,__createBinding2;(function(factory){var root=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(exports2){factory(createExporter(root,createExporter(exports2)))}):typeof module2=="object"&&typeof module2.exports=="object"?factory(createExporter(root,createExporter(module2.exports))):factory(createExporter(root));function createExporter(exports2,previous){return exports2!==root&&(typeof Object.create=="function"?Object.defineProperty(exports2,"__esModule",{value:!0}):exports2.__esModule=!0),function(id,v){return exports2[id]=previous?previous(id,v):v}}})(function(exporter){var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])};__extends2=function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)},__assign2=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__rest2=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},__decorate2=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},__param2=function(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}},__metadata2=function(metadataKey,metadataValue){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(metadataKey,metadataValue)},__awaiter2=function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator2=function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=op[0]&2?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[op[0]&2,t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(t=_.trys,!(t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}},__exportStar2=function(m,o){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(o,p)&&__createBinding2(o,m,p)},__createBinding2=Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m[k]}})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]},__values2=function(o){var s=typeof Symbol=="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")},__read2=function(o,n){var m=typeof Symbol=="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar},__spread2=function(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read2(arguments[i]));return ar},__spreadArrays2=function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r},__spreadArray2=function(to,from){for(var i=0,il=from.length,j=to.length;i<il;i++,j++)to[j]=from[i];return to},__await2=function(v){return this instanceof __await2?(this.v=v,this):new __await2(v)},__asyncGenerator2=function(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})})}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await2?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}},__asyncDelegator2=function(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await2(o[n](v)),done:n==="return"}:f?f(v):v}:f}},__asyncValues2=function(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values2=="function"?__values2(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v2){resolve({value:v2,done:d})},reject)}},__makeTemplateObject2=function(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked};var __setModuleDefault=Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v};__importStar2=function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding2(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault2=function(mod){return mod&&mod.__esModule?mod:{default:mod}},__classPrivateFieldGet2=function(receiver,privateMap){if(!privateMap.has(receiver))throw new TypeError("attempted to get private field on non-instance");return privateMap.get(receiver)},__classPrivateFieldSet2=function(receiver,privateMap,value){if(!privateMap.has(receiver))throw new TypeError("attempted to set private field on non-instance");return privateMap.set(receiver,value),value},exporter("__extends",__extends2),exporter("__assign",__assign2),exporter("__rest",__rest2),exporter("__decorate",__decorate2),exporter("__param",__param2),exporter("__metadata",__metadata2),exporter("__awaiter",__awaiter2),exporter("__generator",__generator2),exporter("__exportStar",__exportStar2),exporter("__createBinding",__createBinding2),exporter("__values",__values2),exporter("__read",__read2),exporter("__spread",__spread2),exporter("__spreadArrays",__spreadArrays2),exporter("__spreadArray",__spreadArray2),exporter("__await",__await2),exporter("__asyncGenerator",__asyncGenerator2),exporter("__asyncDelegator",__asyncDelegator2),exporter("__asyncValues",__asyncValues2),exporter("__makeTemplateObject",__makeTemplateObject2),exporter("__importStar",__importStar2),exporter("__importDefault",__importDefault2),exporter("__classPrivateFieldGet",__classPrivateFieldGet2),exporter("__classPrivateFieldSet",__classPrivateFieldSet2)})}});__markAsModule(exports);__export(exports,{FilmstripOrientation:()=>FilmstripOrientation,Framo:()=>Framo,FramoImageExtension:()=>FramoImageExtension,FramoVideoExtension:()=>FramoVideoExtension,Presets:()=>Presets});var ERROR_MESSAGES={FRAMO_NOT_INITIALIZED:"Framo has not been initialized. Please call initializeFramo before using any of the features",MEDIAINFO_COULD_NOT_LOAD:"Unable to fetch total frames: MediaInfo could not load",MEDIAINFO_COULD_NOT_ANALYZE_VIDEO:"Unable to analyze video",NO_FRAMERATE_IN_MEDIAINFO:"No framerate in mediainfo",COULD_EXTRACT_FRAMERATE_PROPERLY:"Could not extract framerate number properly"};var import_tslib=__toModule(require_tslib()),{__extends,__assign,__rest,__decorate,__param,__metadata,__awaiter,__generator,__exportStar,__createBinding,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault,__classPrivateFieldGet,__classPrivateFieldSet}=import_tslib.default;function isFunction(value){return typeof value=="function"}function createErrorClass(createImpl){var _super=function(instance){Error.call(instance),instance.stack=new Error().stack},ctorFunc=createImpl(_super);return ctorFunc.prototype=Object.create(Error.prototype),ctorFunc.prototype.constructor=ctorFunc,ctorFunc}var UnsubscriptionError=createErrorClass(function(_super){return function(errors){_super(this),this.message=errors?errors.length+` errors occurred during unsubscription: | ||
`+errors.map(function(err,i){return i+1+") "+err.toString()}).join(` | ||
@@ -3,0 +3,0 @@ `):"",this.name="UnsubscriptionError",this.errors=errors}});function arrRemove(arr,item){if(arr){var index=arr.indexOf(item);0<=index&&arr.splice(index,1)}}var Subscription=function(){function Subscription2(initialTeardown){this.initialTeardown=initialTeardown,this.closed=!1,this._parentage=null,this._teardowns=null}return Subscription2.prototype.unsubscribe=function(){var e_1,_a,e_2,_b,errors;if(!this.closed){this.closed=!0;var _parentage=this._parentage;if(_parentage)if(this._parentage=null,Array.isArray(_parentage))try{for(var _parentage_1=__values(_parentage),_parentage_1_1=_parentage_1.next();!_parentage_1_1.done;_parentage_1_1=_parentage_1.next()){var parent_1=_parentage_1_1.value;parent_1.remove(this)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{_parentage_1_1&&!_parentage_1_1.done&&(_a=_parentage_1.return)&&_a.call(_parentage_1)}finally{if(e_1)throw e_1.error}}else _parentage.remove(this);var initialTeardown=this.initialTeardown;if(isFunction(initialTeardown))try{initialTeardown()}catch(e){errors=e instanceof UnsubscriptionError?e.errors:[e]}var _teardowns=this._teardowns;if(_teardowns){this._teardowns=null;try{for(var _teardowns_1=__values(_teardowns),_teardowns_1_1=_teardowns_1.next();!_teardowns_1_1.done;_teardowns_1_1=_teardowns_1.next()){var teardown_1=_teardowns_1_1.value;try{execTeardown(teardown_1)}catch(err){errors=errors!=null?errors:[],err instanceof UnsubscriptionError?errors=__spreadArray(__spreadArray([],__read(errors)),__read(err.errors)):errors.push(err)}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{_teardowns_1_1&&!_teardowns_1_1.done&&(_b=_teardowns_1.return)&&_b.call(_teardowns_1)}finally{if(e_2)throw e_2.error}}}if(errors)throw new UnsubscriptionError(errors)}},Subscription2.prototype.add=function(teardown){var _a;if(teardown&&teardown!==this)if(this.closed)execTeardown(teardown);else{if(teardown instanceof Subscription2){if(teardown.closed||teardown._hasParent(this))return;teardown._addParent(this)}(this._teardowns=(_a=this._teardowns)!==null&&_a!==void 0?_a:[]).push(teardown)}},Subscription2.prototype._hasParent=function(parent){var _parentage=this._parentage;return _parentage===parent||Array.isArray(_parentage)&&_parentage.includes(parent)},Subscription2.prototype._addParent=function(parent){var _parentage=this._parentage;this._parentage=Array.isArray(_parentage)?(_parentage.push(parent),_parentage):_parentage?[_parentage,parent]:parent},Subscription2.prototype._removeParent=function(parent){var _parentage=this._parentage;_parentage===parent?this._parentage=null:Array.isArray(_parentage)&&arrRemove(_parentage,parent)},Subscription2.prototype.remove=function(teardown){var _teardowns=this._teardowns;_teardowns&&arrRemove(_teardowns,teardown),teardown instanceof Subscription2&&teardown._removeParent(this)},Subscription2.EMPTY=function(){var empty=new Subscription2;return empty.closed=!0,empty}(),Subscription2}();var EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(value){return value instanceof Subscription||value&&"closed"in value&&isFunction(value.remove)&&isFunction(value.add)&&isFunction(value.unsubscribe)}function execTeardown(teardown){isFunction(teardown)?teardown():teardown.unsubscribe()}var config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var timeoutProvider={setTimeout:function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var delegate=timeoutProvider.delegate;return((delegate==null?void 0:delegate.setTimeout)||setTimeout).apply(void 0,__spreadArray([],__read(args)))},clearTimeout:function(handle){var delegate=timeoutProvider.delegate;return((delegate==null?void 0:delegate.clearTimeout)||clearTimeout)(handle)},delegate:void 0};function reportUnhandledError(err){timeoutProvider.setTimeout(function(){var onUnhandledError=config.onUnhandledError;if(onUnhandledError)onUnhandledError(err);else throw err})}function noop(){}var COMPLETE_NOTIFICATION=function(){return createNotification("C",void 0,void 0)}();function errorNotification(error){return createNotification("E",void 0,error)}function nextNotification(value){return createNotification("N",value,void 0)}function createNotification(kind,value,error){return{kind,value,error}}var Subscriber=function(_super){__extends(Subscriber2,_super);function Subscriber2(destination){var _this=_super.call(this)||this;return _this.isStopped=!1,destination?(_this.destination=destination,isSubscription(destination)&&destination.add(_this)):_this.destination=EMPTY_OBSERVER,_this}return Subscriber2.create=function(next,error,complete){return new SafeSubscriber(next,error,complete)},Subscriber2.prototype.next=function(value){this.isStopped?handleStoppedNotification(nextNotification(value),this):this._next(value)},Subscriber2.prototype.error=function(err){this.isStopped?handleStoppedNotification(errorNotification(err),this):(this.isStopped=!0,this._error(err))},Subscriber2.prototype.complete=function(){this.isStopped?handleStoppedNotification(COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},Subscriber2.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,_super.prototype.unsubscribe.call(this),this.destination=null)},Subscriber2.prototype._next=function(value){this.destination.next(value)},Subscriber2.prototype._error=function(err){try{this.destination.error(err)}finally{this.unsubscribe()}},Subscriber2.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Subscriber2}(Subscription);var SafeSubscriber=function(_super){__extends(SafeSubscriber2,_super);function SafeSubscriber2(observerOrNext,error,complete){var _this=_super.call(this)||this,next;if(isFunction(observerOrNext))next=observerOrNext;else if(observerOrNext){next=observerOrNext.next,error=observerOrNext.error,complete=observerOrNext.complete;var context_1;_this&&config.useDeprecatedNextContext?(context_1=Object.create(observerOrNext),context_1.unsubscribe=function(){return _this.unsubscribe()}):context_1=observerOrNext,next=next==null?void 0:next.bind(context_1),error=error==null?void 0:error.bind(context_1),complete=complete==null?void 0:complete.bind(context_1)}return _this.destination={next:next?wrapForErrorHandling(next,_this):noop,error:wrapForErrorHandling(error!=null?error:defaultErrorHandler,_this),complete:complete?wrapForErrorHandling(complete,_this):noop},_this}return SafeSubscriber2}(Subscriber);function wrapForErrorHandling(handler,instance){return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];try{handler.apply(void 0,__spreadArray([],__read(args)))}catch(err){if(config.useDeprecatedSynchronousErrorHandling)if(instance._syncErrorHack_isSubscribing)instance.__syncError=err;else throw err;else reportUnhandledError(err)}}}function defaultErrorHandler(err){throw err}function handleStoppedNotification(notification,subscriber){var onStoppedNotification=config.onStoppedNotification;onStoppedNotification&&timeoutProvider.setTimeout(function(){return onStoppedNotification(notification,subscriber)})}var EMPTY_OBSERVER={closed:!0,next:noop,error:defaultErrorHandler,complete:noop};var observable=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function identity(x){return x}function pipeFromArray(fns){return fns.length===0?identity:fns.length===1?fns[0]:function(input){return fns.reduce(function(prev,fn){return fn(prev)},input)}}var Observable=function(){function Observable2(subscribe){subscribe&&(this._subscribe=subscribe)}return Observable2.prototype.lift=function(operator){var observable2=new Observable2;return observable2.source=this,observable2.operator=operator,observable2},Observable2.prototype.subscribe=function(observerOrNext,error,complete){var subscriber=isSubscriber(observerOrNext)?observerOrNext:new SafeSubscriber(observerOrNext,error,complete);if(config.useDeprecatedSynchronousErrorHandling)this._deprecatedSyncErrorSubscribe(subscriber);else{var _a=this,operator=_a.operator,source=_a.source;subscriber.add(operator?operator.call(subscriber,source):source?this._subscribe(subscriber):this._trySubscribe(subscriber))}return subscriber},Observable2.prototype._deprecatedSyncErrorSubscribe=function(subscriber){var localSubscriber=subscriber;localSubscriber._syncErrorHack_isSubscribing=!0;var operator=this.operator;if(operator)subscriber.add(operator.call(subscriber,this.source));else try{subscriber.add(this._subscribe(subscriber))}catch(err){localSubscriber.__syncError=err}for(var dest=localSubscriber;dest;){if("__syncError"in dest)try{throw dest.__syncError}finally{subscriber.unsubscribe()}dest=dest.destination}localSubscriber._syncErrorHack_isSubscribing=!1},Observable2.prototype._trySubscribe=function(sink){try{return this._subscribe(sink)}catch(err){sink.error(err)}},Observable2.prototype.forEach=function(next,promiseCtor){var _this=this;return promiseCtor=getPromiseCtor(promiseCtor),new promiseCtor(function(resolve,reject){var subscription;subscription=_this.subscribe(function(value){try{next(value)}catch(err){reject(err),subscription==null||subscription.unsubscribe()}},reject,resolve)})},Observable2.prototype._subscribe=function(subscriber){var _a;return(_a=this.source)===null||_a===void 0?void 0:_a.subscribe(subscriber)},Observable2.prototype[observable]=function(){return this},Observable2.prototype.pipe=function(){for(var operations=[],_i=0;_i<arguments.length;_i++)operations[_i]=arguments[_i];return operations.length?pipeFromArray(operations)(this):this},Observable2.prototype.toPromise=function(promiseCtor){var _this=this;return promiseCtor=getPromiseCtor(promiseCtor),new promiseCtor(function(resolve,reject){var value;_this.subscribe(function(x){return value=x},function(err){return reject(err)},function(){return resolve(value)})})},Observable2.create=function(subscribe){return new Observable2(subscribe)},Observable2}();function getPromiseCtor(promiseCtor){var _a;return(_a=promiseCtor!=null?promiseCtor:config.Promise)!==null&&_a!==void 0?_a:Promise}function isObserver(value){return value&&isFunction(value.next)&&isFunction(value.error)&&isFunction(value.complete)}function isSubscriber(value){return value&&value instanceof Subscriber||isObserver(value)&&isSubscription(value)}var ObjectUnsubscribedError=createErrorClass(function(_super){return function(){_super(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Subject=function(_super){__extends(Subject2,_super);function Subject2(){var _this=_super.call(this)||this;return _this.closed=!1,_this.observers=[],_this.isStopped=!1,_this.hasError=!1,_this.thrownError=null,_this}return Subject2.prototype.lift=function(operator){var subject=new AnonymousSubject(this,this);return subject.operator=operator,subject},Subject2.prototype._throwIfClosed=function(){if(this.closed)throw new ObjectUnsubscribedError},Subject2.prototype.next=function(value){var e_1,_a;if(this._throwIfClosed(),!this.isStopped){var copy=this.observers.slice();try{for(var copy_1=__values(copy),copy_1_1=copy_1.next();!copy_1_1.done;copy_1_1=copy_1.next()){var observer=copy_1_1.value;observer.next(value)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{copy_1_1&&!copy_1_1.done&&(_a=copy_1.return)&&_a.call(copy_1)}finally{if(e_1)throw e_1.error}}}},Subject2.prototype.error=function(err){if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=err;for(var observers=this.observers;observers.length;)observers.shift().error(err)}},Subject2.prototype.complete=function(){if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;for(var observers=this.observers;observers.length;)observers.shift().complete()}},Subject2.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(Subject2.prototype,"observed",{get:function(){var _a;return((_a=this.observers)===null||_a===void 0?void 0:_a.length)>0},enumerable:!1,configurable:!0}),Subject2.prototype._trySubscribe=function(subscriber){return this._throwIfClosed(),_super.prototype._trySubscribe.call(this,subscriber)},Subject2.prototype._subscribe=function(subscriber){return this._throwIfClosed(),this._checkFinalizedStatuses(subscriber),this._innerSubscribe(subscriber)},Subject2.prototype._innerSubscribe=function(subscriber){var _a=this,hasError=_a.hasError,isStopped=_a.isStopped,observers=_a.observers;return hasError||isStopped?EMPTY_SUBSCRIPTION:(observers.push(subscriber),new Subscription(function(){return arrRemove(observers,subscriber)}))},Subject2.prototype._checkFinalizedStatuses=function(subscriber){var _a=this,hasError=_a.hasError,thrownError=_a.thrownError,isStopped=_a.isStopped;hasError?subscriber.error(thrownError):isStopped&&subscriber.complete()},Subject2.prototype.asObservable=function(){var observable2=new Observable;return observable2.source=this,observable2},Subject2.create=function(destination,source){return new AnonymousSubject(destination,source)},Subject2}(Observable);var AnonymousSubject=function(_super){__extends(AnonymousSubject2,_super);function AnonymousSubject2(destination,source){var _this=_super.call(this)||this;return _this.destination=destination,_this.source=source,_this}return AnonymousSubject2.prototype.next=function(value){var _a,_b;(_b=(_a=this.destination)===null||_a===void 0?void 0:_a.next)===null||_b===void 0||_b.call(_a,value)},AnonymousSubject2.prototype.error=function(err){var _a,_b;(_b=(_a=this.destination)===null||_a===void 0?void 0:_a.error)===null||_b===void 0||_b.call(_a,err)},AnonymousSubject2.prototype.complete=function(){var _a,_b;(_b=(_a=this.destination)===null||_a===void 0?void 0:_a.complete)===null||_b===void 0||_b.call(_a)},AnonymousSubject2.prototype._subscribe=function(subscriber){var _a,_b;return(_b=(_a=this.source)===null||_a===void 0?void 0:_a.subscribe(subscriber))!==null&&_b!==void 0?_b:EMPTY_SUBSCRIPTION},AnonymousSubject2}(Subject);var ScriptNames;(function(ScriptNames2){ScriptNames2.FFMPEG="ffmpeg",ScriptNames2.MEDIAINFO="mediainfo"})(ScriptNames||(ScriptNames={}));var ScriptStore=[{name:ScriptNames.FFMPEG,src:"https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js"},{name:ScriptNames.MEDIAINFO,src:"https://unpkg.com/mediainfo.js/dist/mediainfo.min.js"}];var LoadStatus;(function(LoadStatus2){LoadStatus2.AlreadyLoaded="Already Loaded",LoadStatus2.Loaded="Loaded"})(LoadStatus||(LoadStatus={}));var ScriptService=class{constructor(){this.scripts={};ScriptStore.forEach(script=>{this.scripts[script.name]={loaded:!1,src:script.src}})}load(...scripts){let promises=[];return scripts.forEach(script=>promises.push(this.loadScript(script))),Promise.all(promises)}loadScript(name){return new Promise(resolve=>{if(this.scripts[name].loaded){let response={script:name,loaded:!0,status:LoadStatus.AlreadyLoaded};resolve(response)}else{let script=document.createElement("script");script.type="text/javascript",script.src=this.scripts[name].src,script.onload=()=>{this.scripts[name].loaded=!0;let response={script:name,loaded:!0,status:LoadStatus.Loaded};resolve(response)},script.onerror=error=>{console.error(error);let response={script:name,loaded:!1,status:LoadStatus.Loaded};resolve(response)},document.getElementsByTagName("head")[0].appendChild(script)}})}};var scripService=new ScriptService,FfmpegService=class extends EventTarget{constructor(){super(...arguments);this.isReady=!1;this.progress=new Subject;this.ready=new Subject;this.initializeFramo=()=>__async(this,null,function*(){yield this.initializeFfmpeg(),yield this.initializeMediaInfo(),this.isReady=!0,this.emitReadyState()});this.initializeFfmpeg=()=>__async(this,null,function*(){yield scripService.loadScript(ScriptNames.FFMPEG),this.ffmpeg=FFmpeg.createFFmpeg({log:!0}),yield this.ffmpeg.load(),this.initializeProgressForwarding()});this.initializeMediaInfo=()=>__async(this,null,function*(){try{yield scripService.loadScript(ScriptNames.MEDIAINFO);let opts={chunkSize:256*1024,coverData:!1,format:"object"};this.mediainfo=yield new MediaInfo(opts)}catch(error){throw new Error(`${ERROR_MESSAGES.MEDIAINFO_COULD_NOT_LOAD}: ${error}`)}});this.fetchFile=(filename,file)=>__async(this,null,function*(){let fileAsUint8Array=yield FFmpeg.fetchFile(file);return yield this.ffmpeg.FS("writeFile",filename,fileAsUint8Array),new Blob([fileAsUint8Array])});this.fetchFiles=(files,filenames)=>{let filePromises=[];return files.forEach((file,index)=>{filePromises.push(this.fetchFile(filenames[index],file))}),filePromises};this.emitReadyState=()=>{this.ready.next()};this.getMediaInfo=fileBlob=>__async(this,null,function*(){let getSize=()=>fileBlob.size,readChunk=(chunkSize,offset)=>new Promise((resolve,reject)=>{let reader=new FileReader;reader.onload=event=>{var _a;((_a=event.target)==null?void 0:_a.error)&&reject(event.target.error),resolve(new Uint8Array(event.target.result))},reader.readAsArrayBuffer(fileBlob.slice(offset,offset+chunkSize))});try{return yield this.mediainfo.analyzeData(getSize,readChunk)}catch(error){throw new Error(ERROR_MESSAGES.MEDIAINFO_COULD_NOT_ANALYZE_VIDEO)}});this.getMediaInfos=fileBlobs=>{let mediaInfos=[];return fileBlobs.forEach(blob=>{mediaInfos.push(this.getMediaInfo(blob))}),mediaInfos}}static getInstance(){return FfmpegService.instance||(FfmpegService.instance=new FfmpegService),FfmpegService.instance}initializeProgressForwarding(){this.ffmpeg.setProgress(progress=>{this.progress.next(progress)})}};var FilmstripOrientation;(function(FilmstripOrientation2){FilmstripOrientation2.HORIZONTAL="horizontal",FilmstripOrientation2.VERTICAL="vertical"})(FilmstripOrientation||(FilmstripOrientation={}));var Utility=class{static getScale(dimensions){var _a,_b;return!dimensions.height&&!dimensions.width?"":`scale=${(_a=dimensions.width)!=null?_a:-2}:${(_b=dimensions.height)!=null?_b:-2}`}static getFrameCount(mediainfoResult){var _a,_b,_c;return(_c=parseInt((_b=(_a=mediainfoResult.media)==null?void 0:_a.track[0])==null?void 0:_b.FrameCount,10))!=null?_c:0}static getVideoDuration(mediainfoResult){var _a,_b,_c;return(_c=parseFloat((_b=(_a=mediainfoResult.media)==null?void 0:_a.track[0])==null?void 0:_b.Duration))!=null?_c:0}static getOutputFilename(index,extension){return`out_${index}_${Date.now()}.${extension}`}static getFilmstripTileString(totalFramesInFilmstrip,config2){let tileString="tile=";return config2.orientation===FilmstripOrientation.HORIZONTAL?tileString+=`${totalFramesInFilmstrip}x1`:tileString+=`1x${totalFramesInFilmstrip}`,config2.padding&&(tileString+=`:padding=${config2.padding}`),config2.margin&&(tileString+=`:margin=${config2.margin}`),config2.color&&(tileString+=`:color=${config2.color}`),config2.initPadding&&(tileString+=`:init_padding=${config2.initPadding}`),tileString}static getFilenameWithPadding(index,prefix,totalDigitsInFilename2,extension){let filenumber=index.toString().padStart(totalDigitsInFilename2,"0");return`${prefix}_${filenumber}.${extension}`}};var FilmstripService=class{constructor(){this.ffmpegService=FfmpegService.getInstance();this.makeFilmstrip=config2=>__async(this,null,function*(){try{let fileBlob=yield this.ffmpegService.fetchFile(config2.filename,config2.file),mediainfo=yield this.ffmpegService.getMediaInfo(fileBlob),{parameters,outputFilename}=this.getParameters(config2,mediainfo);yield this.ffmpegService.ffmpeg.run(...parameters);let data=this.ffmpegService.ffmpeg.FS("readFile",outputFilename);return new Blob([data.buffer])}catch(error){throw new Error(error)}});this.getParameters=(config2,mediainfo)=>{let auxillaryParameters=["-y"],parametersResponse={parameters:[],outputFilename:""};return parametersResponse=this.getTimeIntervalBasedParameters(config2,mediainfo),{parameters:[...parametersResponse.parameters,...auxillaryParameters],outputFilename:parametersResponse.outputFilename}};this.getTimeIntervalBasedParameters=(config2,mediainfo)=>{let outputFilename=Utility.getOutputFilename(1,config2.outputExtension),duration=Utility.getVideoDuration(mediainfo),totalFramesInFilmstrip=Math.floor(duration/config2.timeInterval),selectTime=`select=not(mod(n\\,${config2.timeInterval})),`,scale=config2.resolution?`${Utility.getScale(config2.resolution)},`:"",tiles=Utility.getFilmstripTileString(totalFramesInFilmstrip,config2),vfString=`${selectTime}${scale}${tiles}`,inParameters=["-i",config2.filename,"-frames","1","-vf",vfString],outParameters=[outputFilename];return{parameters:[...inParameters,...outParameters],outputFilename}}}static getInstance(){return FilmstripService.instance||(FilmstripService.instance=new FilmstripService),FilmstripService.instance}};var outputFilePrefix="out",outputFileDigits=6,FrameExtractorService=class{constructor(){this.ffmpegService=FfmpegService.getInstance();this.extractFrames=config2=>__async(this,null,function*(){try{let fileBlob=yield this.ffmpegService.fetchFile(config2.filename,config2.file),{parameters,outputFilenames}=yield this.getParameters(config2,fileBlob);return yield this.ffmpegService.ffmpeg.run(...parameters),outputFilenames.map(filename=>{let data=this.ffmpegService.ffmpeg.FS("readFile",filename);return new Blob([data.buffer])})}catch(error){throw new Error(error)}})}static getInstance(){return FrameExtractorService.instance||(FrameExtractorService.instance=new FrameExtractorService),FrameExtractorService.instance}getParameters(config2,fileBlob){return __async(this,null,function*(){let auxillaryParameters=["-y"],parametersResponse={parameters:[],outputFilenames:[]};return config2.timePoints?parametersResponse=this.getTimeBasedParameters(config2):config2.timeInterval&&(parametersResponse=yield this.getIntervalBasedParameters(config2,fileBlob)),{parameters:[...parametersResponse.parameters,...auxillaryParameters],outputFilenames:parametersResponse.outputFilenames}})}getTimeBasedParameters(config2){var _a;let inParameters=[],outParameters=[],outputFilenames=[],scale=config2.resolution?Utility.getScale(config2.resolution):"";return(_a=config2.timePoints)==null||_a.forEach((timePoint,index)=>{inParameters.push(...this.getSingleTimeBasedParameter(timePoint,config2.filename));let outputFilename=Utility.getOutputFilename(index,config2.outputExtension);outputFilenames.push(outputFilename),outParameters.push(...this.getOutputMappingParameter(index,outputFilename,scale))}),{parameters:[...inParameters,...outParameters],outputFilenames}}getSingleTimeBasedParameter(time,filename){return["-ss",`${time}`,"-i",filename]}getOutputMappingParameter(index,outputFilename,scale){let outputMapping=["-map",`${index}:v`,"-frames:v","1"];return scale&&outputMapping.push("-vf",scale),outputMapping.push(outputFilename),outputMapping}getIntervalBasedParameters(config2,fileBlob){return __async(this,null,function*(){let mediainfo=yield this.ffmpegService.getMediaInfo(fileBlob),videoDuration=Utility.getVideoDuration(mediainfo),frameCount=Utility.getFrameCount(mediainfo);console.log(frameCount);let interval=config2.timeInterval,rate=(1/interval).toFixed(2),scale=config2.resolution?Utility.getScale(config2.resolution):"",inParameters=this.getInParametersForIntervalBasedExtraction(config2.filename,rate,scale),outParameters=[`out_%0${outputFileDigits}d.${config2.outputExtension}`],outputFilenames=[];for(let i=interval,j=1;i<=videoDuration;i+=interval,j++){let outputFilename=Utility.getFilenameWithPadding(j,"out",outputFileDigits,config2.outputExtension);outputFilenames.push(outputFilename)}return{parameters:[...inParameters,...outParameters],outputFilenames}})}getOutputFilenamesForIntervalBasedParameters(interval,videoDuration,extension){let filenames=[],numberOfFrames=videoDuration/interval;for(let i=1;i<=numberOfFrames;i++){let filenumber=i.toString().padStart(outputFileDigits,"0");filenames.push(`${outputFilePrefix}_${filenumber}.${extension}`)}return filenames}getInParametersForIntervalBasedExtraction(filename,rate,scale){let inParameters=["-i",filename,"-vf"];return scale?inParameters.push(`fps=${rate},${scale}`):inParameters.push(`fps=${rate}`),inParameters}};var FramoImageExtension;(function(FramoImageExtension2){FramoImageExtension2.JPEG="jpeg",FramoImageExtension2.JPG="jpg",FramoImageExtension2.PNG="png",FramoImageExtension2.BMP="bmp"})(FramoImageExtension||(FramoImageExtension={}));var FramoVideoExtension;(function(FramoVideoExtension2){FramoVideoExtension2.MP4="mp4",FramoVideoExtension2.WEBM="webm"})(FramoVideoExtension||(FramoVideoExtension={}));var Presets;(function(Presets2){Presets2.ULTRAFAST="ultrafast",Presets2.SUPERFAST="superfast",Presets2.VERYFAST="veryfast",Presets2.FASTER="faster",Presets2.FAST="fast",Presets2.MEDIUM="medium",Presets2.SLOW="slow",Presets2.SLOWER="slower",Presets2.VERYSLOW="veryslow"})(Presets||(Presets={}));var totalDigitsInFilename=6,outputFPS=30,FrameStitcherService=class{constructor(){this.ffmpegService=FfmpegService.getInstance();this.stitchFrames=config2=>__async(this,null,function*(){try{let inputFilenames=config2.files.map((_,index)=>Utility.getFilenameWithPadding(index,"in",totalDigitsInFilename,config2.inputExtension)),inputFilenameTemplate=`in_%0${totalDigitsInFilename}d.${config2.inputExtension}`;yield Promise.all(this.ffmpegService.fetchFiles(config2.files,inputFilenames));let{parameters,outputFilename}=this.getParameters(config2,inputFilenameTemplate);yield this.ffmpegService.ffmpeg.run(...parameters);let data=this.ffmpegService.ffmpeg.FS("readFile",outputFilename);return new Blob([data.buffer])}catch(error){throw new Error(error)}});this.getParameters=(config2,inputFilenameTemplate)=>{var _a,_b;let outputFilename=`out.${config2.videoExtension}`,framerate=config2.frameDuration?(1/config2.frameDuration).toFixed(2):outputFPS,inParameters=["-framerate",`${framerate}`,"-i",inputFilenameTemplate,"-r",`${outputFPS}`,"-pix_fmt","yuv420p","-preset",(_b=(_a=config2.extras)==null?void 0:_a.preset)!=null?_b:Presets.SUPERFAST],outParameters=[outputFilename],auxillaryParameters=["-y"];return{parameters:[...inParameters,...outParameters,...auxillaryParameters],outputFilename}}}static getInstance(){return FrameStitcherService.instance||(FrameStitcherService.instance=new FrameStitcherService),FrameStitcherService.instance}};var Main=class{constructor(){this.ffmpegService=FfmpegService.getInstance();this.frameExtractorService=FrameExtractorService.getInstance();this.filmstripService=FilmstripService.getInstance();this.frameStitcherService=FrameStitcherService.getInstance();this.initializeFramo=()=>this.ffmpegService.initializeFramo();this.extractFrames=config2=>this.frameExtractorService.extractFrames(config2);this.makeFilmstrip=config2=>this.filmstripService.makeFilmstrip(config2);this.stitchFrames=config2=>this.frameStitcherService.stitchFrames(config2)}initializationGuard(){if(!this.ffmpegService.isReady)throw new Error(ERROR_MESSAGES.FRAMO_NOT_INITIALIZED);return this}};var Framo=class{constructor(){this._ffmpegService=FfmpegService.getInstance();this._main=new Main;this.initializeFramo=()=>this._main.initializeFramo();this.extractFrames=config2=>this._main.initializationGuard().extractFrames(config2);this.makeFilmstrip=config2=>this._main.initializationGuard().makeFilmstrip(config2);this.stitchFrames=config2=>this._main.initializationGuard().stitchFrames(config2);this.progress=this._ffmpegService.progress;this.ready=this._ffmpegService.ready}}; |
import { FilmstripOrientation, FilmstripRequestConfig } from "./models/filmstrip.model"; | ||
import { ExtractFramesRequestConfig } from "./models/frame-extractor.model"; | ||
import { StitchFramesRequestConfig } from "./models/frame-stitcher.model"; | ||
import { FramoImageExtension, FramoVideoExtension, Progress } from "./models/generic.model"; | ||
export { ExtractFramesRequestConfig as FrameRequestConfig, FramoImageExtension, FramoVideoExtension, Progress, FilmstripOrientation, FilmstripRequestConfig, StitchFramesRequestConfig }; | ||
import { FramoImageExtension, FramoResolution, FramoSupplementaryConfig, FramoVideoExtension, Presets, Progress } from "./models/generic.model"; | ||
export { ExtractFramesRequestConfig, FramoImageExtension, FramoVideoExtension, Progress, FilmstripOrientation, FilmstripRequestConfig, StitchFramesRequestConfig, FramoSupplementaryConfig, Presets, FramoResolution }; | ||
export declare class Framo { | ||
@@ -7,0 +7,0 @@ private _ffmpegService; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Framo = exports.FilmstripOrientation = exports.FramoVideoExtension = exports.FramoImageExtension = void 0; | ||
exports.Framo = exports.Presets = exports.FilmstripOrientation = exports.FramoVideoExtension = exports.FramoImageExtension = void 0; | ||
const main_1 = require("./main"); | ||
@@ -10,2 +10,3 @@ const filmstrip_model_1 = require("./models/filmstrip.model"); | ||
Object.defineProperty(exports, "FramoVideoExtension", { enumerable: true, get: function () { return generic_model_1.FramoVideoExtension; } }); | ||
Object.defineProperty(exports, "Presets", { enumerable: true, get: function () { return generic_model_1.Presets; } }); | ||
const ffmpeg_service_1 = require("./services/ffmpeg.service"); | ||
@@ -12,0 +13,0 @@ class Framo { |
#!/usr/bin/env node | ||
export declare const extractFrames: (config: import("./browser").FrameRequestConfig) => Promise<Blob[]>; | ||
export declare const extractFrames: (config: import("./browser").ExtractFramesRequestConfig) => Promise<Blob[]>; |
{ | ||
"name": "framo", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Glorious media processing right in your browser with Typescript support", | ||
@@ -30,3 +30,3 @@ "author": "Aditya Krishnan <adityakrshnn@gmail.com>", | ||
"bd": "npm run build && npm run esbuild-browser:dev && yalc push", | ||
"bp": "npm run lint && npm run build && npm run esbuild-browser && npm run docs", | ||
"bp": "npm run lint && npm run build && npm run esbuild-browser && npm run docs && yalc push", | ||
"esbuild-browser": "esbuild src/browser.ts --bundle --minify-whitespace --minify-syntax --target=es6 --format=cjs --outfile=dist/esbuild/browser.js", | ||
@@ -33,0 +33,0 @@ "esbuild-browser:dev": "esbuild src/browser.ts --bundle --target=es6 --format=cjs --outfile=dist/esbuild/browser.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109802
1043