PageSourceSearch

https://desk.bigvu.tv/chunk-JU73QFWT.js

js bigvu.tv collected 2026-10-01 10:24:44 UTC 27,172 bytes, 6 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="83ea5e4c-13c6-5e49-b118-ab8cb3f89067")}catch(e){}}();
3import{a as De}from"./chunk-N3LX3THL.js";import{a as Ne}from"./chunk-FEYFR4YX.js";import{a as J,b as X}from"./chunk-KYKGDHNG.js";import{Fb as Me,Gb as tt,be as Fe,ce as st,db as Ue,eb as et,l as Ee,m as Ae,n as Oe}from"./chunk-EHJF6UKK.js";import{U as H,V as we,Y as ke,Z as Ke,ba as Le,ca as je,d as Pe,e as Je,k as W,l as Xe,q as Y,r as Ze}from"./chunk-7XEC5R2G.js";import{s as xe,t as Qe}from"./chunk-OV4F6N7I.js";import{A as q,D as j,l as Ce}from"./chunk-W7MJW6UT.js";import{$a as de,Ca as _,Gd as Te,Ib as V,Ja as ne,Jb as pe,Lc as ve,Nb as he,Nc as ye,Ob as fe,Ta as ae,Va as ce,Wa as le,Zc as Ie,Zd as x,_c as _e,ec as me,fb as ue,gd as Re,h as oe,hc as K,ic as ge,kb as G,lc as Se,ra as He,tc as B,uc as z,vc as Q,xa as N,zc as be}from"./chunk-7RQO36LL.js";import{a as F,b as re,m as D}from"./chunk-7Q6MBNO6.js";var U=function(c){return c[c.PROJECTS_VIDEO_IMPORT=0]="PROJECTS_VIDEO_IMPORT",c[c.PROJECTS_STORY_THUMBNAIL=1]="PROJECTS_STORY_THUMBNAIL",c[c.LIBRARY_ASSETS=2]="LIBRARY_ASSETS",c[c.SCRIPT_STORY_TAKE=3]="SCRIPT_STORY_TAKE",c[c.SCRIPT_STORY_THUMBNAIL=4]="SCRIPT_STORY_THUMBNAIL",c}(U||{});x();He();x();var y=function(c){return c.UPLOADING="uploading",c.TRANSCODING="transcoding",c.COMPLETE="completed",c.ERROR="error",c.FAILED="failed",c}(y||{});Je();Oe();j();x();et();Oe();function it(c,at){if(c&1){let f=be();B(0,"button",7),ve("click",function(){ce(f);let h=ye();return le(h.dismiss())}),z()}}var Be=(()=>{class c{constructor(f){this.spinnerService=f,this._ERROR_STATUSES=[y.FAILED,y.ERROR],this._DISPLAYABLE_STATUSES=Object.keys(y),this._DISMISS_TIMEOUT_MS=15*1e3,this.TRANSCODING_SPINNER="transcoding-spinner",this.onStateChange=p=>{if(p){let{id:h,context:l,name:s,progress:r,status:a}=p;this.id=h,this.context=l,this.status=this._ERROR_STATUSES.includes(a)?y.ERROR:a,this.progress=r,this.name=this._DISPLAYABLE_STATUSES.includes(this.status)?`${s} - ${a}`:s,this.status===y.TRANSCODING?(this.showDismissButton=!1,this.spinnerService.spin(this.TRANSCODING_SPINNER,!0)):this.status===y.COMPLETE&&(this.showDismissButton=!0,this.spinnerService.stop(this.TRANSCODING_SPINNER),this._startDismissSequence())}},this.dismiss=()=>{this.onDismiss.emit({context:this.context,stateId:this.id})},this._startDismissSequence=()=>{setTimeout(()=>{this.dismiss()},this._DISMISS_TIMEOUT_MS)},this.onDismiss=new ue,this.showDismissButton=!0}ngOnInit(){this.state$.subscribe(this.onStateChange)}static{this.\u0275fac=function(p){return new(p||c)(pe(Ue))}}static{this.\u0275cmp=ne({type:c,selectors:[["upload-progress-bar"]],inputs:{state$:"state$"},outputs:{onDismiss:"onDismiss"},standalone:!0,features:[Re],decls:10,vars:7,consts:[[1,"details-container"],[1,"name"],[1,"progress-bar-container"],[1,"upload-progress-indicator"],[1,"dismiss-button-container"],["aria-label","Dismiss",3,"click",4,"ngIf"],[3,"name"],["aria-label","Dismiss",3,"click"]],template:function(p,h){p&1&&(B(0,"div")(1,"div",0)(2,"div",1),Ie(3),z(),B(4,"div",2),Q(5,"div",3),z()(),B(6,"div",4),me(7,it,1,0,"button",5),B(8,"ngx-spinner",6),Q(9,"lottie-loader"),z()()()),p&2&&(Se("upload-progress-bar-component "+h.status),V(3),_e(h.name),V(2),ge("width",h.progress,"%"),V(2),K("ngIf",h.showDismissButton),V(),K("name",h.TRANSCODING_SPINNER))},dependencies:[Ce,Ae,Ee,Pe],styles:[".upload-progress-bar-component[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%;padding:8px;background-color:#7b8db10a;border-radius:6px}.upload-progress-bar-component[_ngcontent-%COMP%]   .details-container[_ngcontent-%COMP%]{width:80%;display:flex;flex-direction:column;gap:6px}.upload-progress-bar-component[_ngcontent-%COMP%]   .details-container[_ngcontent-%COMP%]   .name[_ngcontent-%COMP%]{width:80%;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3.upload-progress-bar-component[_ngcontent-%COMP%]   .dismiss-button-container[_ngcontent-%COMP%]{width:20px;height:20px;border-radius:100%;position:relative}.upload-progress-bar-component.error[_ngcontent-%COMP%]   .dismiss-button-container[_ngcontent-%COMP%]{background-color:#ff4d5b}.upload-progress-bar-component[_ngcontent-%COMP%]   .dismiss-button-container[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;background-image:url(/img/exit-icon.svg);background-position:center;background-size:contain;background-repeat:no-repeat}.upload-progress-bar-component.complete[_ngcontent-%COMP%]   .dismiss-button-container[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{background-image:url(/img/green-checkmark.svg)}.upload-progress-bar-component.error[_ngcontent-%COMP%]   .dismiss-button-container[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{filter:brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(7409%) hue-rotate(112deg) brightness(120%) contrast(120%)}.upload-progress-bar-component[_ngcontent-%COMP%]   .details-container[_ngcontent-%COMP%]   .progress-bar-container[_ngcontent-%COMP%]{width:100%;height:6px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgb(0 0 0 / 10%);box-shadow:inset 0 1px 2px #0000001a}.upload-progress-indicator[_ngcontent-%COMP%]{height:100%;background-color:#00abfe}.upload-progress-bar-component.complete[_ngcontent-%COMP%]   .upload-progress-indicator[_ngcontent-%COMP%]{background-color:#00d096}.upload-progress-bar-component.error[_ngcontent-%COMP%]   .upload-progress-indicator[_ngcontent-%COMP%]{background-color:#ff4d5b}  .upload-progress-bar-component .dismiss-button-container ngx-spinner lottie-loader ng-lottie div{width:20px!important;height:20px!important}"]})}}return c})();var Ve="upload-progress-bars-container";j();x();x();x();var ze=(()=>{class c{constructor(f,p,h){this.componentFactoryResolver=f,this.applicationRef=p,this.injector=h,this.loadComponent=(l,s,r,a,m=!1)=>{let g=l.createComponent(s);if(r&&this._setComponentInputs(g,r),a&&this._setComponentOutputs(g,a),g.changeDetectorRef.detectChanges(),r){let I=this._createSimpleChanges(r);g.instance.ngOnChanges&&g.instance.ngOnChanges(I)}return g.instance.ngOnInit&&!m&&g.instance.ngOnInit(),g},this.appendToElement=(l,s,r,a)=>{let m=this.componentFactoryResolver.resolveComponentFactory(s).create(this.injector);r&&this._setComponentInputs(m,r),a&&this._setComponentOutputs(m,a);let g=m.hostView;this.applicationRef.attachView(g);let I=g.rootNodes[0],e=document.getElementById(l);return e&&e.appendChild(I),m},this.unloadComponent=(l,s=[])=>{l&&(l.changeDetectorRef.detach(),this._clearComponent(l,s))},this.unloadComponentFromElement=(l,s=[])=>{l&&(this.applicationRef.detachView(l.hostView),this._clearComponent(l,s))},this._setComponentInputs=(l,s)=>{s.forEach(r=>{l.instance[r.key]=r.value})},this._setComponentOutputs=(l,s)=>{let r=[];s.forEach(a=>{let m=l.instance[a.key].subscribe(g=>a.subscriber(g));r.push(m)}),this._setComponentOnDestroy(l,r)},this._clearComponent=(l,s=[])=>{s.forEach(r=>r.unsubscribe()),l.destroy()},this._setComponentOnDestroy=(l,s)=>{l.onDestroy(()=>{s.forEach(r=>r.unsubscribe())})}}_createSimpleChanges(f){let p={};return f.forEach(h=>{p[h.key]=new ae(void 0,h.value,!0)}),p}static{this.\u0275fac=function(p){return new(p||c)(_(he),_(Te),_(de))}}static{this.\u0275prov=N({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();we();var qe=(()=>{class c{constructor(f,p,h,l){this.dynamicLoadingService=f,this.rendererFactory=p,this.notifier=h,this.platformId=l,this.getState=s=>(this._validate(s),this._store.get(s)),this.add=(s,r)=>{this._validate(s,r);let a=this._createStateTuple(r),m=this._store.get(s);return m?m.push(a):this._store.set(s,[a]),a.observable},this.setState=(s,r)=>{this._validate(s,r);let{id:a,status:m,progress:g,entity:I}=r,e=this._findStateTuple(s,a);if(e){r.isCancellable=I&&m===y.UPLOADING&&g<100||m===y.ERROR||m===y.FAILED;let t=F(F({},e.subject.getValue()),r);e.subject.next(t)}else throw new Error("State not initialized for the given context")}
3,this.moveToBackground=()=>{this._store.size>0&&this._getAllStateTuples().forEach(r=>{let{subject:a,observable:m}=r,g=a.getValue().id;this._loadUploadProgressBar(g,m)})},this.cancel=(s,r=!0)=>{let{context:a,stateId:m}=s||{};this._validate(a);let g=this._findStateTuple(a,m);if(g){let I=g.subject.getValue(),{entity:e,status:t,cancelUploadFunction:i}=I;t!==y.ERROR&&t!==y.FAILED&&e&&e.abort&&(i&&i?.cancel(),this.notifier.info("Upload cancelled")),r&&this.clear(a,m)}},this.clear=(s,r)=>{this._validate(s);let a=this._store.get(s);if(a){let m=a.findIndex(g=>g.subject.getValue().id===r);m>-1&&(a.splice(m,1),a.length===0&&this._store.delete(s),this.clearProgressBar(r))}},this.clearProgressBar=s=>{let r=this._progressBarComponentRefs.get(s);r&&(this.dynamicLoadingService.unloadComponentFromElement(r),this._progressBarComponentRefs.delete(s))},this._setEventListeners=()=>{q(this.platformId)||(this.beforeUnloadListener=this._renderer.listen("window","beforeunload",s=>{this._store.size>0&&(s.preventDefault(),s.returnValue="You have on-going upload processes")}))},this._getAllStateTuples=()=>{let s=[];return this._store&&this._store.forEach(r=>{s.push(...r)}),s},this._loadUploadProgressBar=(s,r)=>{if(this._progressBarComponentRefs.has(s))return;let a=this.dynamicLoadingService.appendToElement(Ve,Be,[{key:"state$",value:r}],[{key:"onDismiss",subscriber:this.cancel}]);this._progressBarComponentRefs.set(s,a)},this._findStateTuple=(s,r)=>{let a=this._store.get(s);if(a)return a.find(m=>m.subject.getValue().id===r)},this._createStateTuple=s=>{let r=new oe(s);return{subject:r,observable:r.asObservable()}},this._validate=(s,r=null)=>{if(!this._isValidContext(s))throw new Error("The context you've provided is either undefined or its value doesn't exist");if(r!==null&&!this._isValidState(r))throw new Error("The state you've provided is either undefined or its missing important attibutes")},this._isValidContext=s=>s!=null&&Object.values(U).includes(s),this._isValidState=s=>s!==void 0&&this._isValidContext(s.context)&&s.id!==void 0&&typeof s.id=="string",this._store=new Map([]),this._progressBarComponentRefs=new Map([]),this._renderer=this.rendererFactory.createRenderer(null,null),this._setEventListeners()}ngOnDestroy(){this.beforeUnloadListener&&(this.beforeUnloadListener(),this.beforeUnloadListener=null)}static{this.\u0275fac=function(p){return new(p||c)(_(ze),_(fe),_(H),_(G))}}static{this.\u0275prov=N({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();x();Xe();Ze();j();x();tt();st();je();Qe();we();Ke();var te="canceled",Zt=(()=>{class c{constructor(f,p,h,l,s,r,a,m,g,I){this.deskManager=f,this.eventService=p,this.adminRequestService=h,this.uploadStateService=l,this.filesUtilityService=s,this.notifier=r,this.assetsRepo=a,this.taskProgressService=m,this.websocketService=g,this.platformId=I,this.partSize=5*1024*1024,this.MAXSIZE={image:10*1024*1024,video:512*1024*1024,audio:128*1024*1024,font:2*1024*1024,logo:2*1024*1024,thumbnail:2*1024*1024},this.uploadMailingList=(e,t,i)=>{if(!this.fileIsUploadable(e))return;this.notifier.info("Uploading imported mailing list ...");let o=this.parseStorageParams(t);return this.uploadToAmazonWrapper({file:e,storageParams:o,mime:e.type,onSuccessCallback:d=>this.onMailingListSuccess(d,i),onErrorCallback:d=>this.onMailingListError(d,i),onProgressCallback:d=>this.onMailingListProgress(d,i)})},this.onMailingListSuccess=(e,t)=>(t&&t({status:"complete"}),Promise.resolve()),this.onMailingListError=(e,t)=>(t&&t({status:"error"}),Promise.reject(e)),this.onMailingListProgress=(e,t)=>(t&&t({status:"error"}),e),this.uploadProfileImage=(e,t)=>{let i=e.split(",")[0].match(/:(.*?);/)[1];return this.urlToFile(e,i,t).then(o=>this.uploadAsset({name:t,assetType:"image",file:o,defaultLevel:"desk",deskId:this.deskManager.getSelectedWorkspaceId(),subType:"profile",id:0}))},this.onUploadGeneratedImage=(e,t,i,o,d)=>this.urlToFile(e,t,i).then(n=>this.uploadAsset({name:i,assetType:d,file:n,defaultLevel:"desk",subType:o,deskId:this.deskManager.getSelectedWorkspaceId(),id:0})),this.waitForUploadStatus=(e,t,i,o,d)=>{this.websocketService.connect();let n=e?.assetId,u=this.taskProgressService.getProgressDataForEntity(n).subscribe(S=>{if(S?.status==="completed"||S?.taskStatus==="completed"){u.unsubscribe(),v.unsubscribe();let E=new W().useRoot(new Y().sortBy(J.CREATED_AT).sortDirection(X.DOWN).assetIds([n])).build();this.assetsRepo.pullAssetsList(E).then(L=>{t&&t(L?.result?.[0]),o&&this.notifier.success(o)})}}),v=this.taskProgressService.taskFailed$.subscribe(S=>
3{(S.entityId===n||S.entityIds?.includes(n))&&(u.unsubscribe(),v.unsubscribe(),i&&i(),d&&this.notifier.error(d))});return{unsubscribe:()=>{u.unsubscribe(),v.unsubscribe()}}},this.waitForBatchUploadStatus=(e,t,i,o,d)=>{this.websocketService.connect();let n=e.map(S=>S.assetId),u=[],v=[];return n.forEach(S=>{let E=this.taskProgressService.getProgressDataForEntity(S).subscribe(T=>{if(T?.status==="completed"||T?.taskStatus==="completed"){let w=new W().useRoot(new Y().sortBy(J.CREATED_AT).sortDirection(X.DOWN).assetIds([S])).build();this.assetsRepo.pullAssetsList(w).then(k=>{let R=k.result[0];u.find(M=>M.assetId===S)||u.push(R),u.length===n.length&&(v.forEach(M=>M.unsubscribe()),i&&i(u),o&&this.notifier.success(o))})}}),L=this.taskProgressService.taskFailed$.subscribe(T=>{(T.entityId===S||T.entityIds?.includes(S))&&(v.forEach(w=>w.unsubscribe()),t&&t(S),d&&this.notifier.error(d))});v.push(E,L)}),{unsubscribe:()=>{v.forEach(S=>S.unsubscribe())}}},this.onAttachGeneratedAIAsset=(e,t,i,o)=>{let d={url:e,title:i,fileType:t,subTypes:o,level:"desk",deskId:this.deskManager.getSelectedWorkspaceId(),source:["AI"],tags:["ai"]};return this.adminRequestService.attachAsset(d).then(n=>new Promise((u,v)=>{this.waitForUploadStatus(n,()=>D(this,null,function*(){let S=yield this.assetsRepo.getAssetById([n.assetId]);u(S.result[0])}),()=>{v(new Error(`Failed to upload generated ${t} asset url: ${e}`))})})).catch(n=>(console.error("Attach goes wrong ",n),Promise.reject(n)))},this.dataURItoBlob=(e,t)=>{if(q(this.platformId))return;let i;e.split(",")[0].indexOf("base64")>=0?i=window.atob(e.split(",")[1]):i=unescape(e.split(",")[1]);let o=t,d=new Uint8Array(i.length);for(let n=0;n<i.length;n++)d[n]=i.charCodeAt(n);return new Blob([d],{type:o})},this.setUploadableThumbnail=(e,t)=>D(this,null,function*(){return new Promise((i,o)=>
3{if(e.type.indexOf("font")!==-1||e.type===""&&e.name.split(".").pop().toLowerCase()==="ttf")t.src="font",i(null);else{let d=new FileReader;d.onload=n=>D(this,null,function*(){try{let u=n.target.result;if(u.indexOf("image")>-1)t.src=u;else if(u.indexOf("video")>-1){let v=yield this.filesUtilityService.createVideoThumbnail(e);t.src=URL.createObjectURL(v)}i(null)}catch(u){o(u)}}),d.onerror=n=>{o(n)},d.readAsDataURL(e)}})}),this.blobToFile=(e,t)=>(e.lastModifiedDate=new Date,e.name=t,e),this.uploadImportedVideo=e=>D(this,null,function*(){this.notifier.info("Uploading imported video ...");let t=e.file.type.split(";")[0],i={storyId:e.storyId,file:e.file,defaultLevel:e.defaultLevel,deskId:e.deskId,progressCallback:e.progressCallback,context:e.context,id:e.id,onUploadFinishCallback:e.onUploadFinishCallback};try{let o=yield this.adminRequestService.getVideoImportStorageParameters(e.storyId,e.deskId,t||e.file.type,e.file.name,e.folderId);if(o){let d=this.parseStorageParams(o);return this.uploadToAmazonWrapper({file:e.file,storageParams:d,mime:t||e.file.type,onProgressCallback:n=>this.onVideoImportProgress(n,i),onSuccessCallback:n=>this.onVideoImportSuccess(n,i),onErrorCallback:n=>this.onVideoImportError(n,i),cancelUploadFunction:e.cancelUploadFunction})}else return this.onVideoImportError()}catch(o){if(o.responseJSON.code==="10001/1")throw new Error(o);return this.onVideoImportError(o)}}),this.uploadToAmazonWrapper=e=>this.uploadToAmazon(e.file,e.mime,e.storageParams,t=>{let i=t;i.id=e.id,e.onProgressCallback(i)},e.cancelUploadFunction).then(t=>{if(t===te)return Promise.resolve(null);let i=t;return i.id=e.id,e.onSuccessCallback(i)}).catch(t=>e.onErrorCallback(t)),this.onVideoImportSuccess=(e,t)=>{let i=e||null;return this.eventService.log(this.eventService.events.assets.importVideo,{deskId:t.deskId,defaultLevel:t.defaultLevel,storyId:i?i.storyId:null}),t.progressCallback?t.progressCallback({status:"complete",story:i}):t.context!==void 0&&this.uploadStateService.setState(t.context,{id:t.id,context:t.context,status:y.COMPLETE,entity:i,onReadyCallback:t.onUploadFinishCallback}),Promise.resolve(i)},this.onVideoImportError=(e,t)=>(t?.progressCallback?t.progressCallback({status:"error"}):t?.context!==void 0&&this.uploadStateService.setState(t.context,{id:t.id,context:t.context,status:y.ERROR}),this.eventService.log(this.eventService.events.assets.importVideoError,{deskId:t?.deskId,defaultLevel:t?.defaultLevel,assetType:"video"}),Promise.reject(e)),this.onVideoImportProgress=(e,t)=>(t&&t.progressCallback?t.progressCallback(e):t.context!==void 0&&this.uploadStateService.setState(t.context,{context:t.context,id:t.id,status:e.status,progress:e.progress,entity:e.xhr}),e),this.uploadPixabayImage=(e,t,i)=>{let o=e.mediaUrl.replace(/_960\./,"_640.");return new Promise((d,n)=>{let u=new Image;u.crossOrigin="Anonymous",u.onload=()=>{let v=document.createElement("CANVAS"),S=v.getContext("2d");v.height=u.height,v.width=u.width,S.drawImage(u,0,0);let E=v.toDataURL(t,1),L=this.dataURItoBlob(E,t),T=this.blobToFile(L,t),w=this.uploadAsset({name:e.externalId.toString(),assetType:"image",file:T,defaultLevel:void 0,deskId:this.deskManager.getSelectedWorkspaceId(),subType:i,credit:e.userName,source:[e.externalUrl],id:0}).then(k=>k).catch(k=>{n(k)});d(w)},u.src=o,u.onerror=()=>{n("error uploading")},(u.complete||u.complete===void 0)&&(u.src=o)})},this.uploadAsset=e=>{if(!this.fileIsUploadable(e.file))return;this.notifier.info("Uploading asset ...");let t=this.getMime(e.file,e.assetType,e.subType),i=this.adaptAssetType(t,e.assetType,e.subType),o=this.adaptAssetSubType(e.subType);this.eventService.log(this.eventService.events.assets.upload,{deskId:e.deskId,defaultLevel:e.defaultLevel,assetType:e.subType||e.assetType,fileSize:parseFloat((e.file.size/(1024*1024)).toFixed(2))});let d=e.defaultLevel==="system"?this.adminRequestService.adminRequestStorageParameters:this.adminRequestService.requestStorageParameters,n=e.storageRequestPromise?e.storageRequestPromise():d.call(this.adminRequestService,e.name,i,t,e.deskId,e.defaultLevel,e.credit,e.source,e.folderId,e.tags,o),u;return n.then(v=>v?(u=this.parseStorageParams(v),this.uploadToAmazonWrapper({file:e.file,storageParams:u,mime:t,onSuccessCallback:S=>this.onAssetUploadSuccess(S,e,u),onErrorCallback:S=>this.onAssetUploadError(S,e),onProgressCallback:S=>this.onAssetUploadProgress(S,e),id:e.id,cancelUploadFunction:e.cancelUploadFunction}
3)):this.onAssetUploadError()).catch(v=>this.onAssetUploadError(v))},this.uploadAssetWithoutSavingToLibrary=e=>{if(this.fileIsUploadable(e.file))return this.notifier.info("Uploading asset ..."),this._uploadAssetToS3(e)},this.uploadVideoImportToS3=e=>this._uploadAssetToS3(e),this._uploadAssetToS3=e=>{let t=this.getMime(e.file,e?.assetType,e?.subType),i=this.adaptAssetType(t,e?.assetType,e?.subType);this.eventService.log(this.eventService.events.assets.upload,{assetType:"video",fileSize:parseFloat((e.file.size/(1024*1024)).toFixed(2))});let o=this.adminRequestService.requestStorageParametersShortened(i,t),d;return o.then(n=>n?(d=this.parseStorageParams(n),this.uploadToAmazonWrapper({file:e.file,storageParams:d,mime:t,onSuccessCallback:u=>this.onAssetUploadSuccess(u,e,d),onErrorCallback:u=>this.onAssetUploadError(u,e),onProgressCallback:u=>this.onAssetUploadProgress(u,e),id:e.id,cancelUploadFunction:e.cancelUploadFunction})):this.onAssetUploadError()).catch(n=>(e.cancelUploadFunction.cancel(e.id),this.onAssetUploadError(n)))},this.onAssetUploadSuccess=(e,t,i)=>{if(this.websocketService.connect(),t&&!t.immediateResponseFromServer){t.progressCallback?t.progressCallback({id:e.id,status:"transcoding"}):t.context!==void 0&&this.uploadStateService.setState(t.context,F({id:t.id,context:t.context,status:y.TRANSCODING},t.context===U.LIBRARY_ASSETS?{progress:50}:{}));let o=e?.assetId||null;return this.eventService.log(this.eventService.events.assets.uploadComplete,{deskId:t.deskId,defaultLevel:t.defaultLevel,assetType:t.assetType,assetId:o,fileSize:parseFloat((t.file.size/(1024*1024)).toFixed(2))}),t.context!==void 0&&this.uploadStateService.setState(t.context,{id:t.id,context:t.context,status:y.TRANSCODING,entity:{assetId:o}}),this.waitForAssetCompletion(e,t.progressCallback,t.context,t.id)}else return t.context!==void 0&&this.uploadStateService.setState(t.context,{id:t.id,context:t.context,status:y.COMPLETE}),Promise.resolve({s3Url:e.url,json:t,response:e})},this.onAssetUploadError=(e,t)=>{if(t&&!t.immediateResponseFromServer){t.progressCallback?t.progressCallback({status:"error"}):t.context!==void 0&&this.uploadStateService.setState(t.context,{id:t.id,context:t.context,status:y.ERROR});let i=null;e.target&&(i=e.target.responseText?JSON.parse(e.target.responseText):null),this.eventService.log(this.eventService.events.assets.uploadError,{deskId:t.deskId,defaultLevel:t.defaultLevel,assetType:t.assetType,assetId:i})}return this.notifier.clearAll(),this.notifier.error("Error uploading, please try again"),Promise.reject(e)},this.onAssetUploadProgress=(e,t)=>(t&&t.progressCallback?t.progressCallback(e):t.context!==void 0&&this.uploadStateService.setState(t.context,{context:t.context,id:t.id,status:e.status,progress:t.context===U.LIBRARY_ASSETS?Math.round((e.progress||0)/2):e.progress,entity:e.xhr}),e),this.uploadToAmazon=(e,t,i,o,d)=>{let n=!1,u=()=>{n=!0};return d&&(d.cancel=u),new Promise((v,S)=>{try{let E=this.readPolicyCondition(i,"success_action_redirect"),L=this.readPolicyCondition(i,"part_upload_request"),T=Math.ceil(e.size/this.partSize),w=[],k=0,R=new XMLHttpRequest,M=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;M===!1&&R.upload.addEventListener("progress",b=>{if(!n)if(b.lengthComputable){let A=k+b.loaded/b.total/T*100;o({status:"uploading",progress:A,xhr:R})}else o({status:"uploading",progress:-1,xhr:R})}),R.addEventListener("load",()=>{n||(k+=100/T)}),R.addEventListener("loadstart",()=>{n||M===!0&&setTimeout(()=>{o({status:"uploading",progress:-1,xhr:R})},100)});let $e=(b,A,P,C)=>{let O=1,We=()=>new Promise(($,Ye)=>{R.open("put",A,!0),R.send(P),R.onload=()=>{let Z=R.getResponseHeader("Etag");$(Z)},R.onerror=Z=>{Ye(Z)}}),ie=()=>We().catch($=>{if(console.error(`XHR request attempt ${O} failed. Error:`,$),O<C)return console.log(`Retrying XHR request for part ${b}`),O++,ie();throw console.error(`Maximum retry count reached for XHR request of part ${b}`),o({status:"uploading",progress:-1,xhr:R}),$});return ie()},Ge=(b,A)=>{let P=1,C=()=>fetch(b).then(O=>{if(!O.ok)throw new Error(`Fetch failed with status: ${O.status}`);return O.json()}).catch(O=>{if(console.error(`Fetch attempt ${P} failed. Error:`,O),P<A)return console.log("Retrying fetch"),P++,C();throw console.error("Maximum retry count reached for fetch"),O});return C()},se=b=>{if(n)return;let A;return this.readFilePart(e,b,this.partSize).then(P=>{if(!n)return A=P,Ge(L+`&partNumber=${b}`,3).then(C=>C).catch(C=>{throw console.log("fetch part failed ",b),C})}).then(P=>{if(!n)return $e(b,P.url,A,3).then(C=>C).catch(C=>{throw console.log("uploadPartXHR failed ",b),C})}).then(P=>{if(!n&&(w.push({etag:P,partNumber:b}),console.log(`Uploaded part ${b} of ${T}`),b<T))return se(b+1)})};se(1).then(()=>
3{if(n)return v(te);let b=E,A=JSON.stringify({parts:w});return fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:A})}).then(b=>{if(!n)return b.json()}).then(b=>{v(n?te:b)}).catch(b=>{console.error(b),S(b)})}catch(E){console.error(E),S(E)}})},this.fileIsUploadable=e=>e?e.type&&(e.type.indexOf("image")!==-1&&e.size>this.MAXSIZE.image||e.type.indexOf("video")!==-1&&e.size>this.MAXSIZE.video)?(this.notifier.info("Your proposed upload exceeds the maximum allowed size"),!1):!0:!1,this.urlToFile=(e,t,i)=>fetch(e).then(function(o){return o.arrayBuffer()}).then(function(o){return new File([o],i,{type:t})}),this.parseStorageParams=e=>{if(q(this.platformId))return;let t=decodeURIComponent(encodeURIComponent(window.atob(e.policyBase64.toString()))),i=JSON.parse(t);return re(F({},e),{base64Json:i})},this.readPolicyCondition=(e,t)=>{let i=e?.base64Json?.conditions;if(Array.isArray(i))return i.find(o=>o&&typeof o=="object"&&t in o)?.[t]},this.getMime=(e,t,i)=>{let o;return t==="font"?o="application/x-font-ttf":t==="document"&&i==="tax"?o="application/pdf":o=e.type?e.type:e[0].type,o},this.getAssetType=e=>e.type.indexOf("font")!==-1||e.type===""&&e.name.split(".").pop().toLowerCase()==="ttf"?"font":e.type.split("/")[0],this.uploadingNotification=null}blobToBase64(f){return new Promise((p,h)=>{let l=new FileReader;l.onloadend=()=>{typeof l.result=="string"?p(l.result):h(new Error("Failed to convert Blob to Base64."))},l.readAsDataURL(f)})}waitForAssetCompletion(f,p,h,l){return new Promise((s,r)=>{this.websocketService.connect();let a=f.assetId,m=this.taskProgressService.getProgressDataForEntity(a).subscribe(I=>{let e=I?.status==="completed"||I?.taskStatus==="completed",t=I?.percent??I?.taskPercent;if(!e&&h===U.LIBRARY_ASSETS&&typeof t=="number"&&this.uploadStateService.setState(h,{id:l,context:h,status:y.TRANSCODING,progress:50+Math.round(t/2)}),e){m.unsubscribe(),g.unsubscribe();let i=new W().useRoot(new Y().sortBy(J.CREATED_AT).sortDirection(X.DOWN).assetIds([a])).build();this.assetsRepo.pullAssetsList(i).then(o=>{let d=o.result.find(n=>n.assetId===a);this.notifier.clearAll(),p?p({id:l,status:"completed",asset:d}):h!==void 0&&this.uploadStateService.setState(h,{id:l,context:h,status:y.COMPLETE,entity:d}),s(d)}).catch(o=>{this.notifier.error("Could not upload the asset"),this.notifier.clearAll(),r(o)})}}),g=this.taskProgressService.taskFailed$.subscribe(I=>{(I.entityId===a||I.entityIds?.includes(a))&&(m.unsubscribe(),g.unsubscribe(),this.notifier.clearAll(),this.notifier.error("Could not upload the asset"),p?p({id:l,status:"failed"}):h!==void 0&&this.uploadStateService.setState(h,{id:l,context:h,status:y.ERROR,entity:f}),r())})})}readFilePart(f,p,h){return D(this,null,function*(){return new Promise((l,s)=>{let r=(p-1)*h,a=Math.min(r+h,f.size),m=f.slice(r,a),g=new FileReader;g.onload=I=>{I.target&&l(I.target.result)},g.onerror=I=>{s(I)},g.readAsArrayBuffer(m)})})}adaptAssetType(f,p,h){let l;return f.indexOf("video")>-1&&h!=="business"?l="video":l=p,l}adaptAssetSubType(f){let p;return f&&Array.isArray(f)?p=f:f&&(p=[f]),p}static{this.\u0275fac=function(p){return new(p||c)(_(Me),_(Fe),_(Le),_(qe),_(xe),_(H),_(Ne),_(De),_(ke),_(G))}}static{this.\u0275prov=N({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();export{Ve as a,ze as b,U as c,y as d,qe as e,Zt as f};
4/**i18n:a22416d48d5d315853b2ff30dd429c3cf66bb88014970864ad6c2ff7ea890e29*/
5
6//# debugId=83ea5e4c-13c6-5e49-b118-ab8cb3f89067

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.