File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/im/v2/component/call-background/dist/call-background.bundle.min.js
Back
this.BX=this.BX||{};this.BX.Messenger=this.BX.Messenger||{};this.BX.Messenger.v2=this.BX.Messenger.v2||{};(function(e,t,i,r,a,s,n,o,l,c,d,u){"use strict";function p(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function g(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?p(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function b(e,t){f(e,t);t.add(e)}function f(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function h(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var k="BX.Messenger.v2.CallBackground.ProgressBar";var v=1024*1024*2;var m=5;var _=new WeakSet;var B=new WeakSet;var y=new WeakSet;var C=new WeakSet;var L=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));b(babelHelpers.assertThisInitialized(i),C);b(babelHelpers.assertThisInitialized(i),y);b(babelHelpers.assertThisInitialized(i),B);b(babelHelpers.assertThisInitialized(i),_);i.setEventNamespace(k);var a=e.container,s=e.uploadState;i.container=a;i.uploadState=s;i.progressBar=new r.Uploader(g(g({},h(babelHelpers.assertThisInitialized(i),_,M).call(babelHelpers.assertThisInitialized(i))),{},{container:a}));h(babelHelpers.assertThisInitialized(i),B,w).call(babelHelpers.assertThisInitialized(i));return i}babelHelpers.createClass(t,[{key:"start",value:function e(){this.progressBar.start();this.update()}},{key:"update",value:function e(){if(this.uploadState.status===o.FileStatus.error){this.progressBar.setProgress(0);this.progressBar.setCancelDisable(false);this.progressBar.setIcon(r.Uploader.icon.error);this.progressBar.setProgressTitle(l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_ERROR"))}else if(this.uploadState.status===o.FileStatus.wait){this.progressBar.setProgress(this.item.state.progress>m?this.item.state.progress:m);this.progressBar.setCancelDisable(true);this.progressBar.setIcon(r.Uploader.icon.cloud);this.progressBar.setProgressTitle(l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_SAVING"))}else if(this.uploadState.progress===100){this.progressBar.setProgress(100)}else if(this.uploadState.progress===-1){this.progressBar.setProgress(10);this.progressBar.setProgressTitle(l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_WAITING"))}else{if(this.uploadState.progress===0){this.progressBar.setIcon(r.Uploader.icon.cancel)}var t=this.uploadState.progress>m?this.uploadState.progress:m;this.progressBar.setProgress(t);if(h(this,y,I).call(this)){this.progressBar.setProgressTitle(l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_LOADING"))}else{var i=this.uploadState.size/100*this.uploadState.progress;this.progressBar.setByteSent(i,this.uploadState.size)}}}},{key:"destroy",value:function e(){this.progressBar.destroy(false)}}]);return t}(c.EventEmitter);function M(){var e=this;return{labels:{loading:l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_LOADING"),completed:l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_COMPLETED"),canceled:l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_CANCELED"),cancelTitle:l.Loc.getMessage("BX_IM_CALL_BG_FILE_UPLOAD_CANCEL_TITLE"),megabyte:l.Loc.getMessage("BX_IM_CALL_BG_FILE_SIZE_MB")},cancelCallback:function t(){e.emit(L.event.cancel)},destroyCallback:function t(){e.emit(L.event.destroy)}}}function w(){if(h(this,y,I).call(this)||h(this,C,S).call(this)){this.progressBar.setProgressTitleVisibility(false)}}function I(){return this.uploadState.size<v}function S(){var e=240;var t=54;return this.container.offsetHeight<=t&&this.container.offsetWidth<e}babelHelpers.defineProperty(L,"event",{cancel:"cancel",destroy:"destroy"});function P(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function H(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?P(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):P(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var T=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id","");babelHelpers.defineProperty(this,"title","");babelHelpers.defineProperty(this,"background","");babelHelpers.defineProperty(this,"preview","");babelHelpers.defineProperty(this,"isVideo",false);babelHelpers.defineProperty(this,"isSupported",true);babelHelpers.defineProperty(this,"isCustom",false);babelHelpers.defineProperty(this,"canRemove",false);babelHelpers.defineProperty(this,"isLoading",false);babelHelpers.defineProperty(this,"uploadState",null);Object.assign(this,t)}babelHelpers.createClass(e,[{key:"setUploadProgress",value:function e(t){this.uploadState.progress=t}},{key:"setUploadError",value:function e(){this.uploadState.status=o.FileStatus.error;this.uploadState.progress=0}},{key:"onUploadComplete",value:function e(t){this.id=t.id;if(this.isVideo){this.background=t.links.download}this.isLoading=false;this.canRemove=true}}],[{key:"createDefaultFromRest",value:function t(i){return new e(H(H({},i),{},{isVideo:i.id.includes(":video"),isCustom:false,canRemove:false,isSupported:true}))}},{key:"createCustomFromRest",value:function t(i){var r=l.Loc.getMessage("BX_IM_CALL_BG_CUSTOM");if(!i.isSupported){r=l.Loc.getMessage("BX_IM_CALL_BG_UNSUPPORTED")}return new e(H(H({},i),{},{title:r,isCustom:true,canRemove:true}))}},{key:"createCustomFromUploaderEvent",value:function t(i){var r=i.id,a=i.filePreview,s=i.file;return new e({id:r,background:a,preview:a,title:l.Loc.getMessage("BX_IM_CALL_BG_CUSTOM"),isVideo:s.type.startsWith("video"),isCustom:true,canRemove:false,isSupported:true,isLoading:true,uploadState:{progress:0,status:o.FileStatus.upload,size:s.size}})}}]);return e}();var E={props:{element:{type:Object,required:true},isSelected:{type:Boolean,required:true}},emits:["click","remove","cancel"],data:function e(){return{}},computed:{background:function e(){return this.element},containerClasses:function e(){var t=[];if(this.isSelected){t.push("--selected")}if(!this.background.isSupported){t.push("--unsupported")}if(this.background.isLoading){t.push("--loading")}return t},imageStyle:function e(){var t="";if(this.background.preview){t="url('".concat(this.background.preview,"')")}return{backgroundImage:t}}},watch:{"background.uploadState.status":function e(){this.getProgressBarManager().update()},"background.uploadState.progress":function e(){this.getProgressBarManager().update()}},mounted:function e(){this.initProgressBar()},beforeUnmount:function e(){this.removeProgressBar()},methods:{initProgressBar:function e(){var t=this;if(!this.background.uploadState||this.background.uploadState.progress===100){return}this.progressBarManager=new L({container:this.$refs["container"],uploadState:this.background.uploadState});this.progressBarManager.subscribe(L.event.cancel,(function(){t.$emit("cancel",t.background)}));this.progressBarManager.subscribe(L.event.destroy,(function(){if(t.progressBar){t.progressBar=null}}));this.progressBarManager.start()},removeProgressBar:function e(){if(!this.progressBarManager){return}this.progressBarManager.destroy()},getProgressBarManager:function e(){return this.progressBarManager},loc:function e(t){return this.$Bitrix.Loc.getMessage(t)}},template:'\n\t\t<div @click="$emit(\'click\')" :class="containerClasses" class="bx-im-call-background__item" ref="container">\n\t\t\t<div :style="imageStyle" class="bx-im-call-background__item_image"></div>\n\t\t\t<div v-if="background.isSupported && background.isVideo" class="bx-im-call-background__item_video"></div>\n\t\t\t<div v-if="!background.isLoading" class="bx-im-call-background__item_title_container">\n\t\t\t\t<span class="bx-im-call-background__item_title">{{background.title}}</span>\n\t\t\t\t<div\n\t\t\t\t\tv-if="background.canRemove"\n\t\t\t\t\t:title="loc(\'BX_IM_CALL_BG_REMOVE\')"\n\t\t\t\t\t@click.stop="$emit(\'remove\')"\n\t\t\t\t\tclass="bx-im-call-background__item_remove"\n\t\t\t\t></div>\n\t\t\t</div>\n\t\t</div>\n\t'};var O=function(){function e(t){babelHelpers.classCallCheck(this,e);var i=e.type.none;var r=e.type.none;var a=l.Loc.getMessage("BX_IM_CALL_BG_ACTION_NONE");if(t===e.type.upload){i=t;r=t;a=l.Loc.getMessage("BX_IM_CALL_BG_ACTION_UPLOAD")}else if(t===e.type.gaussianBlur){i=t;r=t;a=l.Loc.getMessage("BX_IM_CALL_BG_ACTION_BLUR")}else if(t===e.type.blur){i=t;r=t;a=l.Loc.getMessage("BX_IM_CALL_BG_ACTION_BLUR_MAX")}this.id=i;this.background=r;this.title=a}babelHelpers.createClass(e,[{key:"isEmpty",value:function t(){return this.id===e.type.none}},{key:"isBlur",value:function t(){return this.id===e.type.gaussianBlur||this.id===e.type.blur}},{key:"isUpload",value:function t(){return this.id===e.type.upload}}]);return e}();babelHelpers.defineProperty(O,"type",{none:"none",upload:"upload",blur:"blur",gaussianBlur:"gaussianBlur"});var A={props:{element:{type:Object,required:true},isSelected:{type:Boolean,required:true}},data:function e(){return{}},computed:{action:function e(){return this.element},containerClasses:function e(){var t=["--".concat(this.action.id)];if(this.isSelected){t.push("--selected")}return t}},template:'\n\t\t<div :class="containerClasses" class="bx-im-call-background__item --action">\n\t\t\t<div class="bx-im-call-background__action_icon"></div>\n\t\t\t<div class="bx-im-call-background__action_title">\n\t\t\t\t{{ action.title }}\n\t\t\t</div>\n\t\t</div>\n\t'};var D=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id","");babelHelpers.defineProperty(this,"active",true);babelHelpers.defineProperty(this,"mask","");babelHelpers.defineProperty(this,"background","");babelHelpers.defineProperty(this,"preview","");babelHelpers.defineProperty(this,"title","");babelHelpers.defineProperty(this,"isLoading",false);Object.assign(this,t)}babelHelpers.createClass(e,[{key:"isEmpty",value:function e(){return this.id===""}}],[{key:"createEmpty",value:function t(){return new e({active:true,id:"",mask:"",preview:"",background:"",title:l.Loc.getMessage("BX_IM_CALL_BG_NO_MASK_TITLE")})}},{key:"createFromRest",value:function t(i){var r=i.active,a=i.id,s=i.mask,n=i.background,o=i.preview,l=i.title;return new e({active:r,id:a,mask:s,preview:o,background:n,title:l})}}]);return e}();var X={props:{element:{type:Object,required:true},isSelected:{type:Boolean,required:true}},data:function e(){return{}},computed:{mask:function e(){return this.element},containerClasses:function e(){var t=["--".concat(this.mask.id)];if(this.isSelected){t.push("--selected")}if(!this.mask.active){t.push("--inactive")}return t},imageStyle:function e(){var t="";if(this.mask.preview){t="url('".concat(this.mask.preview,"')")}return{backgroundImage:t}}},methods:{loc:function e(t){return this.$Bitrix.Loc.getMessage(t)}},template:'\n\t\t<div :class="containerClasses" class="bx-im-call-background__item --mask">\n\t\t\t<div v-if="!mask.active" class="bx-im-call-background__mask_fade"></div>\n\t\t\t<div class="bx-im-call-background__mask_background"></div>\n\t\t\t<div :style="imageStyle" class="bx-im-call-background__item_image"></div>\n\t\t\t<div v-if="mask.isLoading" class="bx-im-call-background__mask_loading-container">\n\t\t\t\t<div class="bx-im-call-background__mask_loading-icon"></div>\n\t\t\t\t<div class="bx-im-call-background__mask_loading-text">{{ loc(\'BX_IM_CALL_BG_MASK_LOADING\') }}</div>\n\t\t\t</div>\n\t\t\t<div v-else-if="!mask.active" class="bx-im-call-background__mask_soon-container">\n\t\t\t\t<div class="bx-im-call-background__mask_soon-text">{{ loc(\'BX_IM_CALL_BG_MASK_COMING_SOON\') }}</div>\n\t\t\t</div>\n\t\t\t<div v-else class="bx-im-call-background__mask_title">{{ mask.title }}</div>\n\t\t</div>\n\t'};var U={name:"CallBackgroundLoader",data:function e(){return{}},template:'\n\t\t<div class="bx-im-call-background__loader">\n\t\t\t<svg class="bx-desktop-loader-circular" viewBox="25 25 50 50">\n\t\t\t\t<circle class="bx-desktop-loader-path" cx="50" cy="50" r="20" fill="none" stroke-miterlimit="10"/>\n\t\t\t</svg>\n\t\t</div>\n\t'};function x(e,t){F(e,t);t.add(e)}function F(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function G(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var j=new WeakSet;var R=new WeakSet;var N=new WeakSet;var z=function(){function e(t){babelHelpers.classCallCheck(this,e);x(this,N);x(this,R);x(this,j);babelHelpers.defineProperty(this,"limits",{});var i=t.limits,r=t.infoHelperUrlTemplate;G(this,j,V).call(this,i);G(this,R,W).call(this,r)}babelHelpers.createClass(e,[{key:"isLimitedAction",value:function t(i){if(i.isEmpty()||i.isUpload()){return false}return i.isBlur()&&G(this,N,$).call(this,e.limitCode.blur)}},{key:"isLimitedBackground",value:function t(){return G(this,N,$).call(this,e.limitCode.image)}},{key:"showLimitSlider",value:function e(t){window.BX.UI.InfoHelper.show(this.limits[t].articleCode)}}],[{key:"isMaskFeatureAvailable",value:function e(){if(!s.Utils.platform.isBitrixDesktop()){return true}return s.Utils.platform.isDesktopFeatureEnabled(o.DesktopFeature.mask.id)}},{key:"isMaskFeatureSupportedByDesktopVersion",value:function e(){if(!s.Utils.platform.isBitrixDesktop()){return true}return s.Utils.platform.getDesktopVersion()>=o.DesktopFeature.mask.availableFromVersion}},{key:"showHelpArticle",value:function e(t){var i;(i=window.BX.Helper)===null||i===void 0?void 0:i.show("redirect=detail&code=".concat(t))}}]);return e}();function V(e){var t=this;e.forEach((function(e){t.limits[e.id]=e}))}function W(e){if(window.BX.UI.InfoHelper.isInited()){return}window.BX.UI.InfoHelper.init({frameUrlTemplate:e})}function $(e){var t,i;var r=!!((t=this.limits[e])!==null&&t!==void 0&&t.active);var a=!!((i=this.limits[e])!==null&&i!==void 0&&i.articleCode);return r&&a}babelHelpers.defineProperty(z,"limitCode",{blur:"call_blur_background",image:"call_background"});var q={mask:"mask",background:"background"};var K=12398124;var Z={props:{selectedTab:{type:String,required:true}},emits:["tabChange"],data:function e(){return{}},computed:{tabs:function e(){var e=[];if(z.isMaskFeatureAvailable()){e.push({id:q.mask,loc:"BX_IM_CALL_BG_TAB_MASK",isNew:true})}e.push({id:q.background,loc:"BX_IM_CALL_BG_TAB_BG",isNew:false});return e}},methods:{loc:function e(t){return this.$Bitrix.Loc.getMessage(t)}},template:'\n\t\t<div class="bx-im-call-background__tab-panel">\n\t\t\t<div\n\t\t\t\tv-for="tab in tabs"\n\t\t\t\t:key="tab.id"\n\t\t\t\t@click="$emit(\'tabChange\', tab.id)"\n\t\t\t\t:class="{\'--active\': selectedTab === tab.id, \'--new\': tab.isNew}"\n\t\t\t\tclass="bx-im-call-background__tab"\n\t\t\t>\n\t\t\t\t<div v-if="tab.isNew" class="bx-im-call-background__tab_new">{{ loc(\'BX_IM_CALL_BG_TAB_NEW\') }}</div>\n\t\t\t\t<div class="bx-im-call-background__tab_text">{{ loc(tab.loc) }}</div>\n\t\t\t</div>\n\t\t</div>\n\t'};function J(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function Q(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?J(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):J(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var Y=1280;var ee=720;var te={data:function e(){return{noVideo:false}},computed:{videoClasses:function e(){return{"--flipped":BX.Call.Hardware.enableMirroring}}},created:function e(){var t=this;this.initHardware().then((function(){t.getDefaultDevices()}))["catch"]((function(e){console.error("VideoPreview: error initing hardware",e)}))},beforeUnmount:function e(){this.videoStream.getTracks().forEach((function(e){return e.stop()}));this.videoStream=null},methods:{getDefaultDevices:function e(){var t=this;var i={audio:false,video:true};i.video={};i.video.width={ideal:Y};i.video.height={ideal:ee};if(BX.Call.Hardware.defaultCamera){this.selectedCamera=BX.Call.Hardware.defaultCamera;i.video=Q(Q({},i.video),{deviceId:{exact:this.selectedCamera}})}else if(Object.keys(BX.Call.Hardware.cameraList).length===0){console.error("VideoPreview: no camera");return}navigator.mediaDevices.getUserMedia(i).then((function(e){t.videoStream=e;if(e.getVideoTracks().length===0){t.noVideo=true;console.error("VideoPreview: no video tracks");return}if(!t.selectedCamera){t.selectedCamera=e.getVideoTracks()[0].getSettings().deviceId}t.playLocalVideo()}))},playLocalVideo:function e(){d.Logger.warn("VideoPreview: playing local video");this.$refs["video"].volume=0;this.$refs["video"].srcObject=this.videoStream;this.$refs["video"].play()},initHardware:function e(){return BX.Call.Hardware.init()},loc:function e(t){return this.$Bitrix.Loc.getMessage(t)}},template:'\n\t\t<div class="bx-im-call-background__video">\n\t\t\t<div v-if="noVideo" class="bx-im-call-background__no-cam_container">\n\t\t\t\t<div class="bx-im-call-background__no-cam_icon"></div>\n\t\t\t\t<div class="bx-im-call-background__no-cam_title">{{ loc(\'BX_IM_CALL_BG_NO_CAM\') }}</div>\n\t\t\t</div>\n\t\t\t<video v-else :class="videoClasses" ref="video" muted autoplay playsinline></video>\n\t\t</div>\n\t'};var ie=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,[{key:"getElementsList",value:function e(){var t;var i=(t={},babelHelpers.defineProperty(t,o.RestMethod.imCallBackgroundGet,[o.RestMethod.imCallBackgroundGet]),babelHelpers.defineProperty(t,o.RestMethod.imCallMaskGet,[o.RestMethod.imCallMaskGet]),t);return new Promise((function(e,t){n.rest.callBatch(i,(function(i){d.Logger.warn("BackgroundService: getElementsList result",i);var r=i[o.RestMethod.imCallBackgroundGet];var a=i[o.RestMethod.imCallMaskGet];if(r.error()){console.error("BackgroundService: error getting background list",r.error());return t("Error getting background list")}if(a.error()){console.error("BackgroundService: error getting mask list",a.error());return t("Error getting mask list")}return e({backgroundResult:r.data(),maskResult:a.data()})}))}))}},{key:"commitBackground",value:function e(t){return n.rest.callMethod(o.RestMethod.imCallBackgroundCommit,{fileId:t})}},{key:"deleteFile",value:function e(t){return n.rest.callMethod(o.RestMethod.imCallBackgroundDelete,{fileId:t})}}]);return e}();function re(e,t){ae(e,t);t.add(e)}function ae(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function se(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var ne=100*1024*1024;var oe=100;var le=1024*1024;var ce=5e3;var de="custom";var ue="BX.Messenger.v2.CallBackground.UploadManager";var pe=new WeakSet;var ge=new WeakSet;var be=new WeakSet;var fe=new WeakSet;var he=new WeakSet;var ke=new WeakSet;var ve=new WeakSet;var me=new WeakSet;var _e=new WeakSet;var Be=new WeakSet;var ye=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));re(babelHelpers.assertThisInitialized(i),Be);re(babelHelpers.assertThisInitialized(i),_e);re(babelHelpers.assertThisInitialized(i),me);re(babelHelpers.assertThisInitialized(i),ve);re(babelHelpers.assertThisInitialized(i),ke);re(babelHelpers.assertThisInitialized(i),he);re(babelHelpers.assertThisInitialized(i),fe);re(babelHelpers.assertThisInitialized(i),be);re(babelHelpers.assertThisInitialized(i),ge);re(babelHelpers.assertThisInitialized(i),pe);i.setEventNamespace(ue);var r=e.inputNode;i.uploader=new u.Uploader({inputNode:r,generatePreview:true,fileMaxSize:ne});se(babelHelpers.assertThisInitialized(i),pe,Ce).call(babelHelpers.assertThisInitialized(i));return i}babelHelpers.createClass(t,[{key:"setDiskFolderId",value:function e(t){this.diskFolderId=t}},{key:"cancelUpload",value:function e(t){this.uploader.deleteTask(t)}}]);return t}(c.EventEmitter);function Ce(){this.uploader.subscribe("onFileMaxSizeExceeded",se(this,ge,Le).bind(this));this.uploader.subscribe("onSelectFile",se(this,be,Me).bind(this));this.uploader.subscribe("onStartUpload",se(this,fe,we).bind(this));this.uploader.subscribe("onProgress",se(this,he,Ie).bind(this));this.uploader.subscribe("onComplete",se(this,ke,Se).bind(this));this.uploader.subscribe("onUploadFileError",se(this,ve,Pe).bind(this));this.uploader.subscribe("onCreateFileError",se(this,ve,Pe).bind(this))}function Le(e){d.Logger.warn("UploadManager: onFileMaxSizeExceeded",e);var t=e.getData();var i=t.file;var r=l.Loc.getMessage("BX_IM_CALL_BG_FILE_SIZE_EXCEEDED").replace("#LIMIT#",oe).replace("#FILE_NAME#",i.name);se(this,Be,Ee).call(this,r)}function Me(e){d.Logger.warn("UploadManager: onSelectFile",e);var t=e.getData(),i=t.file,r=t.previewData;if(!se(this,_e,Te).call(this,i.type)||!r){var a=l.Loc.getMessage("BX_IM_CALL_BG_UNSUPPORTED_FILE").replace("#FILE_NAME#",i.name);se(this,Be,Ee).call(this,a);return false}se(this,me,He).call(this,i,r)}function we(e){d.Logger.warn("UploadManager: onStartUpload",e);var t=e.getData(),i=t.previewData,r=t.id,a=t.file;var s=URL.createObjectURL(i);this.emit(ye.event.uploadStart,{id:r,filePreview:s,file:a})}function Ie(e){d.Logger.warn("UploadManager: onProgress",e);var t=e.getData(),i=t.id,r=t.progress;this.emit(ye.event.uploadProgress,{id:i,progress:r})}function Se(e){d.Logger.warn("UploadManager: onComplete",e);var t=e.getData(),i=t.id,r=t.result;this.emit(ye.event.uploadComplete,{id:i,fileResult:r.data.file})}function Pe(e){d.Logger.warn("UploadManager: onUploadError",e);var t=e.getData();this.emit(ye.event.uploadError,{id:t.id})}function He(e,t){this.uploader.addTask({taskId:"".concat(de,":").concat(Date.now()),chunkSize:le,fileData:e,fileName:e.name,diskFolderId:this.diskFolderId,generateUniqueName:true,previewBlob:t})}function Te(e){return ye.allowedFileTypes.includes(e)}function Ee(e){BX.UI.Notification.Center.notify({content:e,autoHideDelay:ce})}babelHelpers.defineProperty(ye,"allowedFileTypes",["image/png","image/jpg","image/jpeg","video/avi","video/mp4","video/quicktime"]);babelHelpers.defineProperty(ye,"event",{uploadStart:"uploadStart",uploadProgress:"uploadProgress",uploadComplete:"uploadComplete",uploadError:"uploadError"});var Oe={name:"CallBackground",components:{BackgroundComponent:E,ActionComponent:A,MaskComponent:X,Loader:U,TabPanel:Z,VideoPreview:te},props:{tab:{type:String,default:q.background}},data:function e(){return{selectedTab:"",selectedBackgroundId:"",selectedMaskId:"",loadingItems:true,actions:[],defaultBackgrounds:[],customBackgrounds:[],masks:[],listIsScrolled:false}},computed:{TabId:function e(){return q},backgrounds:function e(){return[].concat(babelHelpers.toConsumableArray(this.customBackgrounds),babelHelpers.toConsumableArray(this.defaultBackgrounds))},containerClasses:function e(){var t=[];if(this.isDesktop){t.push("--desktop")}return t},uploadTypes:function e(){return ye.allowedFileTypes.join(", ")},descriptionText:function e(){var t={"#HIGHLIGHT_START#":'<span class="bx-im-call-background__description_highlight">',"#HIGHLIGHT_END#":"</span>","#BR#":"</br></br>"};if(this.selectedTab===q.mask){return this.loc("BX_IM_CALL_BG_DESCRIPTION_MASK_2",t)}return this.loc("BX_IM_CALL_BG_DESCRIPTION_BG",t)},isDesktop:function e(){return s.Utils.platform.isBitrixDesktop()}},created:function e(){var t=this;this.initSelectedTab();this.getBackgroundService().getElementsList().then((function(e){var i=e.backgroundResult,r=e.maskResult;t.initLimitManager(i);t.initBackgroundList(i);t.uploadManager.setDiskFolderId(i.upload.folderId);var a=!!i.upload.folderId;t.initActions(a);t.initMasks(r);t.initMaskLoadEventHandler();t.initPreviouslySelectedItem();t.loadingItems=false;t.hideLoader()}))["catch"]((function(){t.loadingItems=false}))},mounted:function e(){this.initUploader()},methods:{initSelectedTab:function e(){if(this.tab===q.mask&&!z.isMaskFeatureAvailable()){this.selectedTab=q.background;return}if(this.tab===q.mask&&!z.isMaskFeatureSupportedByDesktopVersion()){this.selectedTab=q.background;z.showHelpArticle(K);return}this.selectedTab=this.tab},initPreviouslySelectedItem:function e(){this.initPreviouslySelectedMask();this.initPreviouslySelectedBackground()},initPreviouslySelectedMask:function e(){if(this.isDesktop){var t=window.BX.desktop.getMask(),i=t.id;var r=this.masks.find((function(e){return e.id===i}));if(!r){r=D.createEmpty()}this.previouslySelectedMask=r;d.Logger.warn("CallBackground: previously selected mask",this.previouslySelectedMask)}else{this.previouslySelectedMask=D.createEmpty()}this.selectedMaskId=this.previouslySelectedMask.id},initPreviouslySelectedBackground:function e(){if(this.isDesktop){var t=window.BX.desktop.getBackgroundImage(),i=t.id;var r=[].concat(babelHelpers.toConsumableArray(this.actions),babelHelpers.toConsumableArray(this.backgrounds));var a=r.find((function(e){return e.id===i}));if(!a){a=new O(O.type.none)}this.previouslySelectedBackground=a;d.Logger.warn("CallBackground: previously selected background",this.previouslySelectedBackground)}else{this.previouslySelectedBackground=new O(O.type.none)}this.selectedBackgroundId=this.previouslySelectedBackground.id},initActions:function e(t){this.actions=[new O(O.type.none)].concat(babelHelpers.toConsumableArray(t?[new O(O.type.upload)]:[]),[new O(O.type.gaussianBlur),new O(O.type.blur)])},initBackgroundList:function e(t){var i=this;this.defaultBackgrounds=[];t.backgrounds["default"].forEach((function(e){i.defaultBackgrounds.push(T.createDefaultFromRest(e))}));this.customBackgrounds=[];t.backgrounds.custom.forEach((function(e){i.customBackgrounds.push(T.createCustomFromRest(e))}))},initLimitManager:function e(t){var i=t.limits,r=t.infoHelperParams;this.limitManager=new z({limits:i,infoHelperUrlTemplate:r.frameUrlTemplate})},initUploader:function e(){var t=this;this.uploadManager=new ye({inputNode:this.$refs["uploadInput"]});this.uploadManager.subscribe(ye.event.uploadStart,(function(e){var i=T.createCustomFromUploaderEvent(e.getData());t.customBackgrounds.unshift(i)}));this.uploadManager.subscribe(ye.event.uploadProgress,(function(e){var i=e.getData(),r=i.id,a=i.progress;var s=t.findCustomBackgroundById(r);if(!s){return}s.setUploadProgress(a)}));this.uploadManager.subscribe(ye.event.uploadComplete,(function(e){var i=e.getData(),r=i.id,a=i.fileResult;var s=t.findCustomBackgroundById(r);if(!s){return}s.onUploadComplete(a);t.onBackgroundClick(s);t.getBackgroundService().commitBackground(s.id)}));this.uploadManager.subscribe(ye.event.uploadError,(function(e){var i=e.getData(),r=i.id;var a=t.findCustomBackgroundById(r);if(!a){return}a.setUploadError()}))},initMasks:function e(t){var i=this;var r=t.masks;this.masks.push(D.createEmpty());r.forEach((function(e){i.masks.push(D.createFromRest(e))}))},initMaskLoadEventHandler:function e(){if(!this.isDesktop){return}this.maskLoadTimeouts={};window.BX.desktop.setCallMaskLoadHandlers(this.onMaskLoad.bind(this))},onActionClick:function e(t){if(this.getLimitManager().isLimitedAction(t)){this.getLimitManager().showLimitSlider(z.limitCode.blur);return}if(t.isUpload()){this.$refs["uploadInput"].click();return}this.selectedBackgroundId=t.id;if(t.isEmpty()){this.removeCallBackground();return}this.selectedMaskId="";this.setCallBlur(t)},onBackgroundClick:function e(t){if(this.getLimitManager().isLimitedBackground()){this.getLimitManager().showLimitSlider(z.limitCode.image);return}if(!t.isSupported||t.isLoading){return}this.selectedBackgroundId=t.id;this.selectedMaskId="";this.setCallBackground(t)},onBackgroundRemove:function e(t){if(t.id===this.selectedBackgroundId){this.selectedBackgroundId=O.type.none;this.removeCallBackground()}if(t.isLoading){this.uploadManager.cancelUpload(t.id)}else{this.getBackgroundService().deleteFile(t.id)}this.customBackgrounds=this.customBackgrounds.filter((function(e){return e.id!==t.id}))},onMaskClick:function e(t){if(!t.active){return}if(t.isEmpty()){this.selectedMaskId=t.id;this.removeCallMask()}this.setCallMask(t)},onSaveButtonClick:function e(){window.close()},onCancelButtonClick:function e(){var t=this;var i=this.previouslySelectedBackground.id!==this.selectedBackgroundId;var r=this.previouslySelectedMask.id!==this.selectedMaskId;if(!i&&!r){window.close();return}var a=Promise.resolve();if(i){a=this.setCallBackground(this.previouslySelectedBackground)}a.then((function(){if(r&&!t.previouslySelectedMask.isEmpty()){t.setCallMask(t.previouslySelectedMask);t.isWaitingForMaskToCancel=true}else if(t.previouslySelectedMask.isEmpty()){t.removeCallMask();window.close()}else{window.close()}}))},onListScroll:function e(t){if(t.target.scrollTop===0){this.listIsScrolled=false;return}this.listIsScrolled=true},onTabChange:function e(t){if(t===q.mask&&!z.isMaskFeatureSupportedByDesktopVersion()){z.showHelpArticle(K);return}this.selectedTab=t},onMaskLoad:function e(t){d.Logger.warn("CallBackground: onMaskLoad",t);if(this.isWaitingForMaskToCancel){window.close();return}var i=this.masks.filter((function(e){return!e.isEmpty()}));var r=i.find((function(e){return t.includes(e.mask)}));d.Logger.warn("CallBackground: loaded mask",r);if(!r){return}clearTimeout(this.maskLoadTimeouts[r.id]);r.isLoading=false;if(this.lastRequestedMaskId===r.id){this.selectedMaskId=r.id}},setCallBackground:function e(t){d.Logger.warn("CallBackground: set background",t);if(!this.isDesktop){return}return window.BX.desktop.setCallBackground(t.id,t.background)},setCallBlur:function e(t){d.Logger.warn("CallBackground: set blur",t);if(!this.isDesktop){return}return window.BX.desktop.setCallBackground(t.id,t.background)},removeCallBackground:function e(){if(!this.isDesktop){return}return window.BX.desktop.setCallBackground(O.type.none,O.type.none)},setCallMask:function e(t){d.Logger.warn("CallBackground: set mask",t);if(!this.isDesktop){return}if(t.isEmpty()){d.Logger.warn("CallBackground: empty mask - removing it");window.BX.desktop.setCallMask();return}this.lastRequestedMaskId=t.id;var i=500;this.maskLoadTimeouts[t.id]=setTimeout((function(){t.isLoading=true}),i);window.BX.desktop.setCallMask(t.id,t.mask,t.background)},removeCallMask:function e(){if(!this.isDesktop){return}window.BX.desktop.setCallMask()},hideLoader:function e(){if(!this.isDesktop){return}window.BX.desktop.hideLoader()},findCustomBackgroundById:function e(t){return this.customBackgrounds.find((function(e){return e.id===t}))},getBackgroundService:function e(){if(!this.backgroundService){this.backgroundService=new ie}return this.backgroundService},getLimitManager:function e(){return this.limitManager},loc:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.$Bitrix.Loc.getMessage(t,i)}},template:'\n\t\t<div :class="{\'--desktop\': isDesktop}" class="bx-im-call-background__scope bx-im-call-background__container">\n\t\t\t<div v-if="loadingItems" class="bx-im-call-background__loader_container">\n\t\t\t\t<Loader />\n\t\t\t</div>\n\t\t\t<div v-else class="bx-im-call-background__content">\n\t\t\t\t<div class="bx-im-call-background__left">\n\t\t\t\t\t<VideoPreview />\n\t\t\t\t\t<div v-html="descriptionText" class="bx-im-call-background__description"></div>\n\t\t\t\t</div>\n\t\t\t\t<div :class="{\'--scrolled\': listIsScrolled}" class="bx-im-call-background__right">\n\t\t\t\t\t<TabPanel :selectedTab="selectedTab" @tabChange="onTabChange" />\n\t\t\t\t\t<div v-if="selectedTab === TabId.background" @scroll="onListScroll" class="bx-im-call-background__list">\n\t\t\t\t\t\t<ActionComponent\n\t\t\t\t\t\t\tv-for="action in actions"\n\t\t\t\t\t\t\t:element="action"\n\t\t\t\t\t\t\t:key="action.id"\n\t\t\t\t\t\t\t:isSelected="selectedBackgroundId === action.id"\n\t\t\t\t\t\t\t@click="onActionClick(action)"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BackgroundComponent\n\t\t\t\t\t\t\tv-for="background in backgrounds"\n\t\t\t\t\t\t\t:element="background"\n\t\t\t\t\t\t\t:key="background.id"\n\t\t\t\t\t\t\t:isSelected="selectedBackgroundId === background.id"\n\t\t\t\t\t\t\t@click="onBackgroundClick(background)"\n\t\t\t\t\t\t\t@cancel="onBackgroundRemove(background)"\n\t\t\t\t\t\t\t@remove="onBackgroundRemove(background)"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div v-else-if="selectedTab === TabId.mask" @scroll="onListScroll" class="bx-im-call-background__list">\n\t\t\t\t\t\t<MaskComponent\n\t\t\t\t\t\t\tv-for="mask in masks"\n\t\t\t\t\t\t\t:element="mask"\n\t\t\t\t\t\t\t:key="mask.id"\n\t\t\t\t\t\t\t:isSelected="selectedMaskId === mask.id"\n\t\t\t\t\t\t\t@click="onMaskClick(mask)"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\t\n\t\t\t</div>\n\t\t\t<div class="bx-im-call-background__button-panel">\n\t\t\t\t<button @click="onSaveButtonClick" :class="{\'ui-btn-wait ui-btn-disabled\': loadingItems}" class="ui-btn ui-btn-success">\n\t\t\t\t\t{{ loc(\'BX_IM_CALL_BG_SAVE\') }}\n\t\t\t\t</button>\n\t\t\t\t<button @click="onCancelButtonClick" class="ui-btn ui-btn-link">\n\t\t\t\t\t{{ loc(\'BX_IM_CALL_BG_CANCEL\') }}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="bx-im-call-background__upload-input">\n\t\t\t<input type="file" :accept="uploadTypes" ref="uploadInput"/>\n\t\t</div>\n\t'};e.CallBackground=Oe})(this.BX.Messenger.v2.Component=this.BX.Messenger.v2.Component||{},BX.UI,BX,BX.ProgressBarJs,BX,BX.Messenger.v2.Lib,BX,BX.Messenger.v2.Const,BX,BX.Event,BX.Messenger.v2.Lib,BX.Messenger.Lib); //# sourceMappingURL=call-background.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.27 |
proxy
|
phpinfo
|
Settings