@ckeditor/ckeditor5-uploadcare 48.5.0-alpha.1 → 48.5.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -20,6 +20,6 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x3083bd,Plugin as _0x51ca24}from'@ckeditor/ckeditor5-core';import{IconDropbox as _0x4a1433,IconError as _0x13717d,IconFacebook as _0x315d20,IconGoogleDrive as _0x616648,IconGooglePhotos as _0xe44f4c,IconOneDrive as _0x36800b,IconUploadcareImageEdit as _0x3fb224,IconUploadcareImageUpload as _0x18d282,IconUploadcareLink as _0x3504ed}from'@ckeditor/ckeditor5-icons';import{ButtonView as _0x14f01c,Dialog as _0x1fa73f,DialogViewPosition as _0x96bcbf,FocusCycler as _0x36ae68,IconView as _0xc2e35,MenuBarMenuListItemButtonView as _0x20a35a,Notification as _0x4a71dc,SpinnerView as _0x136c40,View as _0x1f1b00}from'@ckeditor/ckeditor5-ui';import{DomEmitterMixin as _0x208392,FocusTracker as _0x5e1308,ObservableMixin as _0x2f3ec6,createElement as _0xcf6f91,getAncestors as _0x17f081,global as _0x14c7e2,uid as _0x170750}from'@ckeditor/ckeditor5-utils';import{ImageEditing as _0x4b54a8,ImageUploadEditing as _0x2a7711,ImageUploadProgress as _0x490139,ImageUtils as _0x399c00,PictureEditing as _0xd2cc51}from'@ckeditor/ckeditor5-image';import{FileRepository as _0x9bcb1a}from'@ckeditor/ckeditor5-upload';import{info as _0x432016,uploadFile as _0x33a151}from'@uploadcare/upload-client';import*as _0x344c96 from'@uploadcare/file-uploader/web/file-uploader.min.js';function T(_0x38e7c3,_0x248685,_0x47a24d){const t=_0x38e7c3['t'],_0x3f69af=_0x38e7c3['t'];switch(_0x248685){case'local':return{'text':_0x3f69af('Insert'===_0x47a24d?'Upload\x20from\x20computer':'Replace\x20from\x20computer'),'shortText':_0x3f69af('From\x20computer')};case'url':return{'text':'Insert'===_0x47a24d?_0x3f69af('Insert\x20via\x20URL'):t('Replace\x20via\x20URL'),'shortText':_0x3f69af('Via\x20URL')};case'dropbox':return{'text':t('Insert'===_0x47a24d?'Insert\x20with\x20Dropbox':'Replace\x20with\x20Dropbox'),'shortText':t('With\x20Dropbox')};case'facebook':return{'text':t('Insert'===_0x47a24d?'Insert\x20with\x20Facebook':'Replace\x20with\x20Facebook'),'shortText':t('With\x20Facebook')};case'gdrive':return{'text':t('Insert'===_0x47a24d?'Insert\x20with\x20Google\x20Drive':'Replace\x20with\x20Google\x20Drive'),'shortText':t('With\x20Google\x20Drive')};case'gphotos':return{'text':t('Insert'===_0x47a24d?'Insert\x20with\x20Google\x20Photos':'Replace\x20with\x20Google\x20Photos'),'shortText':t('With\x20Google\x20Photos')};case'onedrive':return{'text':t('Insert'===_0x47a24d?'Insert\x20with\x20OneDrive':'Replace\x20with\x20OneDrive'),'shortText':t('With\x20OneDrive')};default:return _0x248685;}}var V=class extends _0x51ca24{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'UploadcareUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x82824=[this['editor']];for(const _0x417cdc of _0x82824){let _0x27be45;for(const _0x21e119 in _0x417cdc){const _0x3bb223=_0x21e119,_0x1ee22a=_0x417cdc[_0x3bb223];if('uploadcareLicenseKeyValid'==_0x1ee22a||'uploadcareLicenseKeyInvalid'==_0x1ee22a||'uploadcareLicenseKeyExpired'==_0x1ee22a||'uploadcareLicenseKeyDomainLimit'==_0x1ee22a||'uploadcareLicenseKeyNotAllowed'==_0x1ee22a||'uploadcareLicenseKeyEvaluationLimit'==_0x1ee22a||'uploadcareLicenseKeyUsageLimit'==_0x1ee22a){delete _0x417cdc[_0x3bb223],_0x27be45=_0x1ee22a,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'uploadcareLicenseKeyInvalid'==_0x27be45&&_0x417cdc['_showLicenseError']('invalid'),'uploadcareLicenseKeyExpired'==_0x27be45&&_0x417cdc['_showLicenseError']('expired'),'uploadcareLicenseKeyDomainLimit'==_0x27be45&&_0x417cdc['_showLicenseError']('domainLimit'),'uploadcareLicenseKeyNotAllowed'==_0x27be45&&_0x417cdc['_showLicenseError']('featureNotAllowed','Uploadcare'),'uploadcareLicenseKeyEvaluationLimit'==_0x27be45&&_0x417cdc['_showLicenseError']('evaluationLimit'),'uploadcareLicenseKeyUsageLimit'==_0x27be45&&_0x417cdc['_showLicenseError']('usageLimit');}},0x3e8);}afterInit(){const {editor:_0x187dd3}=this,_0x6873bb=_0x187dd3['commands']['get']('uploadcare');if(!_0x6873bb)return;const _0x3e9469=this['_normalizeConfigSourceList'](_0x187dd3['config']['get']('uploadcare.uploader.sourceList'))['reduce']((_0x3ad0a1,_0x47bc82)=>{const _0x17c6f7=this['_getIntegrationKey'](_0x47bc82['type']);return _0x3ad0a1[_0x17c6f7]||(_0x3ad0a1[_0x17c6f7]=[]),_0x3ad0a1[_0x17c6f7]['push'](_0x47bc82),_0x3ad0a1;},{});_0x187dd3['plugins']['has']('ImageInsertUI')&&_0x187dd3['commands']['get']('uploadcare')&&Object['entries'](_0x3e9469)['forEach'](([_0x45bb2c,_0x2abee1])=>{_0x187dd3['plugins']['get']('ImageInsertUI')['registerIntegration']({'name':_0x45bb2c,'observable':()=>_0x6873bb,'buttonViewCreator':()=>this['_createToolbarButton'](_0x2abee1),'formViewCreator':()=>this['_createDropdownButtons'](_0x2abee1),'menuBarButtonViewCreator':()=>this['_createMenuBarButtons'](_0x2abee1),'override':'assetManager'!==_0x45bb2c});});}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}_normalizeConfigSourceList(_0x568be6){const {locale:_0x98fd2c}=this['editor'];return _0x568be6['map'](_0x54b13d=>{const _0x30b66f=T(_0x98fd2c,_0x54b13d,'Insert');switch(_0x54b13d){case'local':return{'icon':_0x18d282,'type':'local',..._0x30b66f};case'url':return{'icon':_0x3504ed,'type':'url',..._0x30b66f};case'dropbox':return{'icon':_0x4a1433,'type':'dropbox',..._0x30b66f};case'facebook':return{'icon':_0x315d20,'type':'facebook',..._0x30b66f};case'gdrive':return{'icon':_0x616648,'type':'gdrive',..._0x30b66f};case'gphotos':return{'icon':_0xe44f4c,'type':'gphotos',..._0x30b66f};case'onedrive':return{'icon':_0x36800b,'type':'onedrive',..._0x30b66f};}});}_getIntegrationKey(_0x4d94ff){switch(_0x4d94ff){case'local':return'upload';case'url':return'url';default:return'assetManager';}}_createButton(_0x98dadd,_0x128da8){const _0x42dc1d=this['editor'],_0x220d67=new _0x98dadd(_0x42dc1d['locale']),_0x15a721=_0x42dc1d['commands']['get']('uploadcare');return _0x220d67['bind']('isEnabled')['to'](_0x15a721),_0x220d67['on']('execute',()=>{_0x15a721['execute'](_0x128da8);}),_0x220d67;}_createToolbarButton(_0x4347ab){const {locale:_0x207e91}=this['editor'],_0x57d2e5=this['editor']['plugins']['get']('ImageInsertUI'),_0x213396=_0x4347ab[0x0],_0x10d15a=this['_createButton'](_0x14f01c,_0x213396['type']);return _0x10d15a['icon']=_0x213396['icon'],_0x10d15a['bind']('label')['to'](_0x57d2e5,'isImageSelected',_0x53e280=>T(_0x207e91,_0x213396['type'],_0x53e280?'Replace':'Insert')['text']),_0x10d15a['tooltip']=!0x0,_0x10d15a;}_createDropdownButtons(_0x27cc9d){const {locale:_0x1242d6}=this['editor'],_0x1b4960=this['editor']['plugins']['get']('ImageInsertUI');return _0x27cc9d['map'](_0x340824=>{const _0x4187c4=this['_createButton'](_0x14f01c,_0x340824['type']);return _0x4187c4['withText']=!0x0,_0x4187c4['icon']=_0x340824['icon'],_0x4187c4['bind']('label')['to'](_0x1b4960,'isImageSelected',_0x31339e=>T(_0x1242d6,_0x340824['type'],_0x31339e?'Replace':'Insert')['text']),_0x4187c4;});}_createMenuBarButtons(_0x3b94b6){return _0x3b94b6['map'](_0x828163=>{const _0x1327f7=this['_createButton'](_0x20a35a,_0x828163['type']);return _0x1327f7['icon']=_0x828163['icon'],_0x1327f7['label']=_0x828163['shortText'],_0x1327f7;});}},F=class extends _0x1f1b00{['focusTracker'];['focusCycler'];constructor(_0x230f99){super(_0x230f99),this['focusTracker']=new _0x5e1308(),this['focusCycler']=new _0x36ae68({'focusables':this['createCollection'](),'focusTracker':this['focusTracker']});}getFocusableElement(){return{'tag':'div','attributes':{'aria-hidden':'true','tabindex':'0'},'on':{'focus':this['bindTemplate']['to'](()=>{this['focusCycler']['fire']('forwardCycle');})}};}},$=class extends F{constructor(_0x52cb36,_0x39ce08){super(_0x52cb36),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':[{'tag':'uc-file-uploader-inline','attributes':{'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'uploader-'+_0x39ce08}},this['getFocusableElement']()]});}['focus'](){this['element']['focus']();}};function B(_0x4b2e00,_0x126dd2){const _0x20db23=_0x4b2e00['replace'](/\/$/,'');return{'imageFallbackUrl':_0x4b2e00,'imageSources':[{'srcset':[...[0x140,0x1e0,0x300,0x400,0x4b0,0x640,0x780,0x960]['filter'](_0x5f3dc1=>_0x5f3dc1<_0x126dd2)['map'](_0x321d8f=>_0x20db23+'/-/resize/'+_0x321d8f+'x/\x20'+_0x321d8f+'w'),_0x4b2e00+'\x20'+_0x126dd2+'w']['join'](',\x20'),'sizes':'(max-width:\x20'+_0x126dd2+'px)\x20100vw,\x20'+_0x126dd2+'px','type':'image/webp'}]};}function j(_0xb385f8,_0x4ca3a8,_0x1b31ac){const _0x271951=_0xb385f8['match'](/\/crop\/(\d+)x(\d+)\//);return{'width':_0x271951?parseInt(_0x271951[0x1],0xa):_0x4ca3a8,'height':_0x271951?parseInt(_0x271951[0x2],0xa):_0x1b31ac};}function q(_0x4e0020,_0x301919){const _0x252743=new(_0x208392())(),_0x5a3fea=_0x4e0020['plugins']['get']('ImageUtils'),_0x3c9230=_0x4e0020['editing']['mapper']['toViewElement'](_0x301919),_0x4082ca=_0x5a3fea['findViewImgElement'](_0x3c9230),_0x221dc3=_0x4e0020['editing']['view']['domConverter']['viewToDom'](_0x4082ca),_0x440e86=_0x301919['getAttribute']('width'),_0x4c93f3=_0x301919['getAttribute']('height'),_0x49ab89='image-processing';_0x4e0020['editing']['view']['change'](_0x5c2449=>{_0x5c2449['addClass'](_0x49ab89,_0x3c9230),_0x5c2449['setStyle']('aspect-ratio',_0x440e86+'/'+_0x4c93f3,_0x4082ca);}),_0x252743['listenTo'](_0x221dc3,'load',()=>{_0x252743['stopListening'](_0x221dc3,'load'),_0x4e0020['editing']['view']['change'](_0x51c963=>{_0x51c963['removeClass'](_0x49ab89,_0x3c9230),_0x51c963['removeStyle']('aspect-ratio',_0x4082ca);});});}function M(_0x556b97){if(Array['isArray'](_0x556b97)){const _0x2055ec=_0x556b97['map'](M);return _0x57a6ef=>_0x2055ec['some'](_0x3885d6=>_0x3885d6(_0x57a6ef));}if('origin'==_0x556b97){const _0x3c63a9=_0x14c7e2['window']['location']['origin'];return _0x18ce7b=>new URL(_0x18ce7b,_0x14c7e2['document']['baseURI'])['origin']==_0x3c63a9;}return'function'==typeof _0x556b97?_0x556b97:_0x556b97 instanceof RegExp?_0x6df150=>!(!_0x6df150['match'](_0x556b97)&&!_0x6df150['replace'](/^https?:\/\//,'')['match'](_0x556b97)):()=>!0x1;}function H(_0x713f5f,_0x229228){return _0x17f081(_0x713f5f['target'])['includes'](_0x229228);}const W=/* #__PURE__ -- @preserve */
24
- _0x2f3ec6();var G=class extends W{_editor;['_dialog'];_editing;['_api'];_type=null;['_formView']=null;constructor(_0xd39173,_0x56f0a4,_0x36dd3f){super(),this['_editor']=_0xd39173,this['_editing']=_0x56f0a4,this['_dialog']=_0xd39173['plugins']['get'](_0x1fa73f),this['_api']=_0x56f0a4['ctxElement']['getAPI'](),this['_type']=_0x36dd3f,this['_editing']['configElement']['setAttribute']('source-list',this['_type']),this['_initDialog'](),this['_initListeners'](),this['_api']['initFlow']();}destroy(){this['_formView']&&(this['_formView']['destroy'](),this['_formView']=null),this['_api']&&this['_api']['doneFlow'](),this['stopListening'](),this['stopDelegating']();}_initDialog(){const {locale:_0x2b5060,model:_0x49943c}=this['_editor'],_0x3548e7=_0x49943c['document']['selection']['getSelectedElement'](),_0x51e2c8=_0x3548e7&&(_0x3548e7['is']('element','imageBlock')||_0x3548e7['is']('element','imageInline'));this['_formView']=new $(_0x2b5060,this['_editing']['ucContextId']),this['_dialog']['show']({'id':'uploadCare','icon':_0x18d282,'title':T(_0x2b5060,this['_type'],_0x51e2c8?'Replace':'Insert')['text'],'content':this['_formView'],'position':_0x96bcbf['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_api']['removeAllFiles'](),this['_editor']['editing']['view']['focus'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x1047b1=>!H(_0x1047b1,this['_formView']['element'])}});}_initListeners(){this['_editing']['ctxElement']['addEventListener']('done-click',()=>{const {allEntries:_0x53b735}=this['_api']['getOutputCollectionState']();this['_editor']['model']['change'](_0x4b532d=>{const _0x517cbb=_0x53b735['length'];for(const _0x5c7e8a of _0x53b735){const _0x425031=_0x5c7e8a===_0x53b735[_0x517cbb-0x1],{cdnUrl:_0x294074,fileInfo:_0x5b6336}=_0x5c7e8a;if(!_0x294074||!_0x5b6336)continue;const {width:_0xb56768,height:_0x5438db}=_0x5b6336['imageInfo'],_0x65e29e=j(_0x294074,_0xb56768,_0x5438db),_0x487ae1=B(_0x294074,_0x65e29e['width']),_0x3609d4={'id':_0x5b6336['uuid'],'type':'image','attributes':{'imageDimension':_0x65e29e,..._0x487ae1}};this['_insertAsset'](_0x3609d4,_0x425031,_0x4b532d);}}),this['_dialog']['hide']();}),this['_editing']['ctxElement']['addEventListener']('change',_0x47a1ba=>{'idle'===_0x47a1ba['detail']['status']&&!_0x47a1ba['detail']['allEntries']['length']&&this['_dialog']['isOpen']&&('local'===this['_type']?this['_api']['setCurrentActivity']('start-from'):this['_api']['initFlow']());});}_insertAsset(_0x34308f,_0x4d15a7,_0x1a9bec){const _0x2f3163=this['_editor']['model']['document']['selection'],_0x4c3c0c=_0x2f3163['getSelectedElement'](),_0x2fc8ec=!(!_0x4c3c0c||!_0x4c3c0c['is']('element','imageInline'));_0x1a9bec['removeSelectionAttribute']('linkHref'),this['_insertImage'](_0x34308f,_0x2fc8ec),_0x4d15a7||_0x1a9bec['setSelection'](_0x2f3163['getLastPosition']());}_insertImage(_0x6cf41a,_0x5b1983){const _0x2ee914=this['_editor'],{imageDimension:_0x28c16a,imageFallbackUrl:_0x302df7,imageSources:_0x5d0a83}=_0x6cf41a['attributes'];_0x2ee914['execute']('insertImage',{'imageType':_0x5b1983?'imageInline':null,'source':{'uploadcareImageId':_0x6cf41a['id'],'src':_0x302df7,'sources':_0x5d0a83,..._0x28c16a}});}},z=class extends _0x3083bd{_editing;_controller=null;static get requires(){return[_0x1fa73f,Z];}constructor(_0x57d27b){super(_0x57d27b),this['_editing']=_0x57d27b['plugins']['get'](Z);}['refresh'](){this['isEnabled']=this['_checkEnabled']();}execute(_0x22e452){this['_controller']&&(this['_controller']['destroy'](),this['_controller']=null),this['_controller']=new G(this['editor'],this['_editing'],_0x22e452);}['_checkEnabled'](){return this['editor']['commands']['get']('insertImage')['isEnabled'];}},Q=class{static['upload']({file:_0x129541,..._0xb5f0ef}){return _0x33a151(_0x129541,_0xb5f0ef);}static getInfo(_0x203ad1,_0x15f0c5){return _0x432016(_0x203ad1,_0x15f0c5);}},J=class extends _0x51ca24{static get requires(){return[_0x2a7711,_0x490139,_0x9bcb1a,Z];}static get['pluginName'](){return'UploadcareUploadAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async afterInit(){const _0x28e24a=this['editor'];if(!_0x28e24a['config']['get']('uploadcare'))return;_0x28e24a['plugins']['get'](_0x9bcb1a)['createUploadAdapter']=_0x30293d=>new X(_0x30293d,_0x28e24a),_0x28e24a['plugins']['get'](_0x2a7711)['on']('uploadComplete',(_0x171c29,{imageElement:_0x4fc353,data:_0x301a4a})=>{_0x28e24a['model']['change'](_0x205bc4=>{_0x205bc4['setAttribute']('uploadcareImageId',_0x301a4a['uploadcareImageId'],_0x4fc353);});});}},X=class{['loader'];editor;controller;constructor(_0x1ad2eb,_0x34a053){this['loader']=_0x1ad2eb,this['editor']=_0x34a053,this['controller']=new AbortController();}async['upload'](){const t=this['editor']['t'],_0x4a56f5=await this['loader']['file'];return Q['upload']({'file':_0x4a56f5,'publicKey':this['editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':this['controller']['signal'],'onProgress':_0x3c165e=>{_0x3c165e&&_0x3c165e['isComputable']&&(this['loader']['uploadTotal']=0x1,this['loader']['uploaded']=_0x3c165e['value']);}})['then'](async _0x3b3757=>{const {imageFallbackUrl:_0x3bc8d6,imageSources:_0x6ce925}=B(_0x3b3757['cdnUrl'],_0x3b3757['imageInfo']['width']);return{'uploadcareImageId':_0x3b3757['uuid'],'default':_0x3bc8d6,'sources':_0x6ce925};})['catch'](()=>{const _0x344352=t('Cannot\x20upload\x20file:')+('\x20'+_0x4a56f5['name']+'.');return Promise['reject'](_0x344352);});}abort(){this['controller']['abort']();}},Z=class extends _0x51ca24{_configElement=null;_ctxElement=null;static get['pluginName'](){return'UploadcareEditing';}static get requires(){return[_0xd2cc51,J,_0x1fa73f];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}ucContextId;get configElement(){return this['_configElement'];}get ctxElement(){return this['_ctxElement'];}constructor(_0x3ff1cb){super(_0x3ff1cb),this['ucContextId']=_0x170750();}init(){const _0x5a5cd9=this['editor'];_0x5a5cd9['commands']['add']('uploadcare',new z(_0x5a5cd9));}afterInit(){this['_initSchema'](),this['_initConversion'](),this['_initConfig'](),this['_initCtx'](),this['_initImageProcessingIndicator'](),this['listenTo'](this['editor'],'destroy',()=>{this['_configElement']&&(this['_configElement']['remove'](),this['_configElement']=null),this['_ctxElement']&&(this['_ctxElement']['remove'](),this['_ctxElement']=null);const _0x48dcbc=_0x14c7e2['document']['querySelector']('input[uploadcare-file-input]');_0x48dcbc&&_0x48dcbc['remove']();}),async function(_0x5ad168){const _0x4a45b3='4wieLj6qmWZnpxGN9QYyFhU15kOfCBAHt2slISMXP3vErub8za07VTRoKcdDgJ',_0x10a563=0x793e0,_0x357a46={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x1f3d13(_0x1ee22e){const _0x5e1b55=new window['Promise'](_0x481d3b=>{_0x1ee22e['once']('ready',_0x481d3b);}),_0x3e0057=window['Date']['now'](),_0x9ea60f=_0x1ee22e['config']['get']('licenseKey');async function _0x427bbe(){let _0xc49e68,_0x5cf71e=null,_0x1f0135=null;try{return'GPL'==_0x9ea60f?'NotAllowed':(_0xc49e68=_0x460b47(),_0xc49e68?(_0xc49e68['usageEndpoint']&&(_0x1f0135=_0x5d488a(_0xc49e68['usageEndpoint'],_0xc49e68['jti'])),await _0x37aa0e()?_0x4d07f6()?_0x320201()?'Expired':_0x5d8e59()?('evaluation'==_0xc49e68['licenseType']&&(_0x5cf71e=_0x28a809('EvaluationLimit')),await _0x175863()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x320201(){const _0x5a8cbd=['evaluation','trial']['includes'](_0xc49e68['licenseType'])?_0x3e0057/0x3e8:0xe10*_0x10a563;return _0xc49e68['exp']<_0x5a8cbd;}function _0x4d07f6(){const _0x38374d=_0xc49e68['features'];return!!_0x38374d&&(!!_0x38374d['includes']('*')||!!_0x38374d['includes']('UPLC'));}function _0x5d8e59(){const _0x22bdc9=_0xc49e68['licensedHosts'];if(!_0x22bdc9||0x0==_0x22bdc9['length'])return!0x0;const {hostname:_0x5e5e92}=new URL(window['location']['href']);if(_0x22bdc9['includes'](_0x5e5e92))return!0x0;const _0xe2e865=_0x5e5e92['split']('.');return _0x22bdc9['filter'](_0x5b3d0d=>_0x5b3d0d['includes']('*'))['map'](_0x36e5a7=>_0x36e5a7['split']('.'))['filter'](_0x160f79=>_0x160f79['length']<=_0xe2e865['length'])['map'](_0x5c0e19=>Array(_0xe2e865['length']-_0x5c0e19['length'])['fill']('*'===_0x5c0e19[0x0]?'*':'')['concat'](_0x5c0e19))['some'](_0x1c90c1=>_0xe2e865['every']((_0x368917,_0x35fb71)=>_0x1c90c1[_0x35fb71]===_0x368917||'*'===_0x1c90c1[_0x35fb71]));}function _0x175863(){return _0x5cf71e&&_0x1f0135?new window['Promise']((_0x2e0468,_0x48b40c)=>{_0x5cf71e['then'](_0x2e0468,_0x48b40c),_0x1f0135['then'](_0x5e10ec=>{'Valid'!=_0x5e10ec&&_0x2e0468(_0x5e10ec);},_0x48b40c);}):_0x5cf71e||_0x1f0135||'Valid';}}function _0x5d488a(_0x25d558,_0x2b31f3){return new window['Promise'](_0x1910e7=>{if(_0x2d961f())return _0x1910e7('Valid');_0x51fe35(),_0x1ee22e['decorate']('_sendUsageRequest');let _0x1438d9=!0x1;const _0x1adae2=_0x170750();function _0x1051d8(_0x2a9c02){return!!_0x2a9c02&&('object'==typeof _0x2a9c02||'function'==typeof _0x2a9c02)&&'function'==typeof _0x2a9c02['then']&&'function'==typeof _0x2a9c02['catch'];}function _0x38c4e0(_0x1cb9b7){_0x3cf1f(_0x1cb9b7)['then'](_0x36ffcb=>_0x36ffcb&&'ok'==_0x36ffcb['status']?_0x842a2b(_0x27ddb2(_0x1adae2+_0x2b31f3))!=_0x36ffcb['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x1d2358=>(_0x1e67c9(),_0x1d2358),()=>{const _0x3a2d40=_0x2e4fe9();return null==_0x3a2d40?(_0x1e67c9(),'Valid'):_0x3e0057-_0x3a2d40>0x240c8400?'UsageLimit':'Valid';})['then'](_0x1910e7)['catch'](()=>{_0x1910e7('UsageLimit');});const _0x345404=0x36ee80;function _0x1e67c9(){const _0x3bcd75='llct-'+_0x842a2b(_0x27ddb2(_0x25d558)),_0x1c56d8=_0x1c4503(_0x842a2b(window['Math']['ceil'](_0x3e0057/_0x345404)));window['localStorage']['setItem'](_0x3bcd75,_0x1c56d8);}function _0x2e4fe9(){const _0x6b5c86='llct-'+_0x842a2b(_0x27ddb2(_0x25d558)),_0x3e3248=window['localStorage']['getItem'](_0x6b5c86);return _0x3e3248?window['parseInt'](_0x1c4503(_0x3e3248),0x10)*_0x345404:null;}function _0x3cf1f(_0x18e7bb){return new window['Promise']((_0x51e4d4,_0x18fd41)=>{_0x18e7bb['then'](_0x51e4d4,_0x18fd41),window['setTimeout'](_0x18fd41,0x1d4c0);});}}_0x1ee22e['on']('_sendUsageRequest',(_0x37087f,_0x29919d)=>{if(_0x29919d[0x0]!=_0x25d558)return _0x1910e7('UsageLimit');_0x29919d[0x1]={..._0x29919d[0x1],'requestId':_0x1adae2};},{'priority':'high'}),_0x1ee22e['on']('_sendUsageRequest',_0x4849da=>{_0x1051d8(_0x4849da['return'])&&(_0x1438d9=!0x0,_0x38c4e0(_0x4849da['return']));},{'priority':'low'}),_0x5e1b55['then'](()=>{_0x1438d9||_0x1910e7('UsageLimit');});});function _0x2d961f(){return'auto'==_0x1ee22e['editing']['view']['_overlayModeHint'];}function _0x51fe35(){_0x1ee22e['editing']['view']['_overlayModeHint']='auto';}}function _0x28a809(_0x40d41a){const _0x5e95f9=[new window['Promise'](_0x3ad8d1=>setTimeout(_0x3ad8d1,0x93ecc)),_0x5e1b55['then'](()=>new window['Promise'](_0x2767f8=>{let _0x46fbe0=0x0;_0x1ee22e['model']['on']('applyOperation',(_0x3fa0f9,_0x21b42a)=>{_0x21b42a[0x0]['isDocumentOperation']&&_0x46fbe0++,0x5e8==_0x46fbe0&&(_0x2767f8(),_0x3fa0f9['off']());});}))];return window['Promise']['race'](_0x5e95f9)['then'](()=>_0x40d41a);}async function _0x4de7cf(){await _0x5e1b55,_0x1ee22e['model']['change']=_0x57f3f6,_0x1ee22e['model']['enqueueChange']=_0x57f3f6,_0x1ee22e['enableReadOnlyMode']('model');}function _0x36ef7b(_0x1c74a3){const _0x42f600=_0x2c59d0();_0x1ee22e[_0x42f600]='uploadcareLicenseKey'+_0x1c74a3,'Valid'!=_0x1c74a3&&_0x4de7cf();}function _0x2c59d0(){const _0x33d6f9=window['String'](window['performance']['now']())['replace']('.','');let _0x24e84c='w';for(let _0x39b851=0x0;_0x39b851<_0x33d6f9['length'];_0x39b851+=0x2){let _0x368b09=window['parseInt'](_0x33d6f9['substring'](_0x39b851,_0x39b851+0x2));_0x368b09>=0x3e&&(_0x368b09-=0x3e),_0x24e84c+=_0x4a45b3[_0x368b09];}return _0x24e84c;}function _0x460b47(){const _0x52848c=_0x9ea60f['split']('.');if(0x3!=_0x52848c['length'])return null;return _0x4dde30(_0x52848c[0x1]);function _0x4dde30(_0x7192dd){const _0x3c902d=_0x157388(_0x7192dd);return _0x3c902d&&_0x593100()?_0x3c902d:null;function _0x593100(){const _0x39d6af=_0x3c902d['jti'],_0x3ff528=window['parseInt'](_0x39d6af['substring'](_0x39d6af['length']-0x8),0x10),_0x51d497={..._0x3c902d,'jti':_0x39d6af['substring'](0x0,_0x39d6af['length']-0x8)};return delete _0x51d497['vc'],_0x27ddb2(_0x51d497)==_0x3ff528;}}}async function _0x37aa0e(){let _0x10daad=!0x0;try{const [_0x5cdc30,_0x3c312a,_0x27ee3b]=_0x9ea60f['split']('.');return _0x1f02cf(_0x5cdc30),await _0x49599c(_0x5cdc30,_0x3c312a,_0x27ee3b),_0x10daad;}catch{return!0x1;}function _0x1f02cf(_0x4cacfe){const _0x48ee4b=_0x157388(_0x4cacfe);_0x48ee4b&&'ES256'==_0x48ee4b['alg']||(_0x10daad=!0x1);}async function _0x49599c(_0x572927,_0x493c9a,_0x5e7f28){const _0x31c81d=window['Uint8Array']['from'](_0x585346(_0x5e7f28),_0x33bb07=>_0x33bb07['charCodeAt'](0x0)),_0x29c25f=new window['TextEncoder']()['encode'](_0x572927+'.'+_0x493c9a),_0x2bc675=window['crypto']['subtle'];if(!_0x2bc675)return;const _0x527c3a=await _0x2bc675['importKey']('jwk',_0x357a46,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x2bc675['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x527c3a,_0x31c81d,_0x29c25f)||(_0x10daad=!0x1);}}function _0x157388(_0x4143ac){return _0x4143ac['startsWith']('ey')?JSON['parse'](_0x585346(_0x4143ac)):null;}function _0x585346(_0xb23ce5){return window['atob'](_0xb23ce5['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x27ddb2(_0x5f46a5){let _0x57a110=0x1505;function _0xc23366(_0x497ae0){for(let _0x5d8354=0x0;_0x5d8354<_0x497ae0['length'];_0x5d8354++){const _0x46bbb8=_0x497ae0['charCodeAt'](_0x5d8354);_0x57a110=(_0x57a110<<0x5)+_0x57a110+_0x46bbb8,_0x57a110&=_0x57a110;}}function _0x246df4(_0x1017be){Array['isArray'](_0x1017be)?_0x1017be['forEach'](_0x246df4):_0x1017be&&'object'==typeof _0x1017be?Object['entries'](_0x1017be)['sort']()['forEach'](([_0x98e7be,_0x232ddd])=>{_0xc23366(_0x98e7be),_0x246df4(_0x232ddd);}):_0xc23366(window['String'](_0x1017be));}return _0x246df4(_0x5f46a5),_0x57a110>>>0x0;}function _0x842a2b(_0x562c25){return _0x562c25['toString'](0x10)['padStart'](0x8,'0');}function _0x1c4503(_0x47142c){return _0x47142c['split']('')['reverse']()['join']('');}function _0x57f3f6(){}_0x36ef7b(await _0x427bbe());}_0x1f3d13(_0x5ad168['editor']);}(this);}_initSchema(){const _0x1d54b2=this['editor']['model']['schema'];_0x1d54b2['isRegistered']('imageBlock')&&_0x1d54b2['extend']('imageBlock',{'allowAttributes':['uploadcareImageId']}),_0x1d54b2['isRegistered']('imageInline')&&_0x1d54b2['extend']('imageInline',{'allowAttributes':['uploadcareImageId']});}_initConversion(){const _0x208b58=this['editor'];_0x208b58['conversion']['for']('downcast')['attributeToAttribute']({'model':'uploadcareImageId','view':'data-uc-image-id'}),_0x208b58['conversion']['for']('upcast')['elementToAttribute']({'model':{'key':'uploadcareImageId','value':_0x2d51c8=>_0x2d51c8['getAttribute']('data-uc-image-id')},'view':{'attributes':{'data-uc-image-id':/[a-zA-Z0-9\\-]+/}}});const _0x19138b=_0x208b58['commands']['get']('replaceImageSource');_0x19138b&&this['listenTo'](_0x19138b,'cleanupImage',(_0x30ae32,[_0x5caf68,_0x347977])=>{_0x5caf68['removeAttribute']('uploadcareImageId',_0x347977);});}_initConfig(){const _0x522053=this['editor']['config']['get']('uploadcare.uploader')||{},_0xab396e=this['editor']['config']['get']('uploadcare.pubkey')||'';this['_configElement']=_0xcf6f91(_0x14c7e2['document'],'uc-config',{..._0x522053,'pubkey':_0xab396e,'ctx-name':'uploader-'+this['ucContextId'],'sourceList':'','imgOnly':'true','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage'],'externalSourcesEmbedCss':'\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup\x20{\x20padding:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-menu\x20{\x20gap:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-footer\x20{\x20padding-top:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__separator\x20{\x20margin:\x200;\x20}\x0a\x09\x09\x09'}),this['_configElement']['iconHrefResolver']=_0x2ba088=>{if('closeMax'==_0x2ba088)return'#uc-icon-arrow-down';},_0x14c7e2['document']['body']['appendChild'](this['_configElement']);}_initCtx(){this['_ctxElement']=_0xcf6f91(_0x14c7e2['document'],'uc-upload-ctx-provider',{'ctx-name':'uploader-'+this['ucContextId']}),_0x14c7e2['document']['body']['appendChild'](this['_ctxElement']);}_initImageProcessingIndicator(){const _0x28a5eb=this['editor']['commands']['get']('insertImage');_0x28a5eb&&this['listenTo'](_0x28a5eb,'execute',()=>{const _0x33d6c7=this['editor']['model']['document']['selection']['getSelectedElement']();_0x33d6c7&&_0x33d6c7['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x33d6c7);});});const _0x292932=this['editor']['commands']['get']('uploadcareImageReplace');_0x292932&&this['listenTo'](_0x292932,'execute',()=>{const _0x222e56=this['editor']['model']['document']['selection']['getSelectedElement']();_0x222e56&&_0x222e56['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x222e56);});});}},Y=class extends _0x51ca24{static get requires(){return[Z,V];}static get['pluginName'](){return'Uploadcare';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x34283a){super(_0x34283a),_0x34283a['config']['define']('uploadcare.uploader.sourceList',['local','url']),_0x344c96['defineComponents'](_0x344c96),this['_defineLocale']();}['_defineLocale'](){const _0x204dfe=this['editor']['config']['get']('uploadcare.locale'),_0x41d940=this['editor']['locale']['contentLanguage'];_0x204dfe&&_0x344c96['defineLocale'](_0x41d940,_0x204dfe);}},tt=class extends _0x1f1b00{constructor(_0xfad55d){super(_0xfad55d);const t=_0xfad55d['t'],_0x5ec8ec=this['bindTemplate'],_0x28ab5c=new _0x136c40();_0x28ab5c['isVisible']=!0x0,this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__loading'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__loading-spinner']},'children':[_0x28ab5c,{'text':_0x5ec8ec['to']('imageUploadProgress',_0xdb951a=>t('Loading\x20image...')+'\x20('+(_0xdb951a||0x0)+'%)')}]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},et=class extends _0x1f1b00{constructor(_0x46b809){super(_0x46b809);const t=_0x46b809['t'];this['set']('errorType',null);const _0x5d2816=new _0x14f01c(_0x46b809);_0x5d2816['label']=t({'id':'Try\x20again\x20(Uploadcare)','string':'Try\x20again'}),_0x5d2816['withText']=!0x0,_0x5d2816['class']='ck-button-action',_0x5d2816['on']('execute',()=>{this['fire']('retry');}),_0x5d2816['bind']('isVisible')['to'](this,'errorType',_0x6ae4fd=>'NotFound'!==_0x6ae4fd);const _0xd7a63d=new _0xc2e35();_0xd7a63d['content']=_0x13717d,_0xd7a63d['extendTemplate']({'attributes':{'style':{'width':'50px','height':'50px'}}});const _0x40aa83=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__error'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__error-contents']},'children':[_0xd7a63d,{'tag':'h3','attributes':{'style':{'fontWeight':'bold'}},'children':[{'text':t('Unable\x20to\x20load')}]},{'text':_0x40aa83['to']('errorType',_0x223d72=>t('NotFound'!==_0x223d72?'We\x20were\x20unable\x20to\x20load\x20the\x20image\x20due\x20to\x20network\x20connection\x20issues.':'The\x20image\x20was\x20not\x20found.\x20Its\x20source\x20may\x20have\x20been\x20removed.'))},_0x5d2816]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},it=class extends _0x1f1b00{constructor(_0x53d683,_0x59d6a3){super(_0x53d683);const _0x4b0ef8=this['bindTemplate'];this['set']('imageSrc',''),this['setTemplate']({'tag':'uc-cloud-image-editor','attributes':{..._0x59d6a3,'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'image-edit','cdn-url':_0x4b0ef8['to']('imageSrc')}});}},st=class extends F{_items;['_loadingView'];['_errorView'];_editingView;['_focusableView'];constructor(_0x522f98,_0x574a20,_0x33ee9b){super(_0x522f98),this['_items']=this['createCollection'](),this['_loadingView']=new tt(_0x522f98),this['_errorView']=new et(_0x522f98),this['_editingView']=new it(_0x522f98,_0x33ee9b),this['_focusableView']=new _0x1f1b00(_0x522f98),this['_focusableView']['setTemplate'](this['getFocusableElement']()),this['set']('status',_0x574a20),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':this['_items']}),this['_setView'](),this['once']('render',()=>{this['_waitForImageEditorComponent'](this['element'],_0x2955d1=>{this['_addUploadcareImageEditorListeners'](_0x2955d1);});}),this['on']('change:status',()=>{this['_setView']();}),this['_addErrorViewListeners']();}['focus'](){this['element']['focus']();}_setView(){switch(this['_items']['clear'](),this['status']){case'uploading':this['_items']['add'](this['_loadingView']);break;case'error':this['_items']['add'](this['_errorView']);break;case'ready':this['_items']['addMany']([this['_editingView'],this['_focusableView']]);}}_waitForImageEditorComponent(_0x521b4f,_0x38953f){const _0x5ce08e='uc-cloud-image-editor',_0x25467e=_0x521b4f['querySelector'](_0x5ce08e);if(_0x25467e)return _0x38953f(_0x25467e);const _0x4cec15=new MutationObserver(_0x2df681=>{const _0x97625a=_0x2df681['filter'](_0x538f3f=>_0x538f3f['target']===_0x521b4f&&_0x538f3f['addedNodes']['length']>0x0&&_0x538f3f['addedNodes'][0x0]['nodeName']['toLowerCase']()===_0x5ce08e);_0x97625a['length']&&(_0x4cec15['disconnect'](),_0x38953f(_0x97625a[0x0]['addedNodes'][0x0]));});_0x4cec15['observe'](_0x521b4f,{'childList':!0x0,'subtree':!0x0});}_addUploadcareImageEditorListeners(_0x39c982){_0x39c982['addEventListener']('apply',_0x4ab9c9=>{this['fire']('apply',{'imageSrc':_0x4ab9c9['detail']['cdnUrl']});}),_0x39c982['addEventListener']('cancel',()=>{this['fire']('cancel');});}_addErrorViewListeners(){this['_errorView']['on']('retry',()=>{this['fire']('retry');});}};const nt=/* #__PURE__ -- @preserve */
25
- _0x2f3ec6();var rt=class extends nt{_editor;['_dialog'];_imageElement;['_imageCache'];_controller;_attributes;constructor(_0x4c3e03,_0xa14ce5,_0x2bacc7){super(),this['_editor']=_0x4c3e03,this['_dialog']=_0xa14ce5,this['_imageElement']=_0x2bacc7,this['_imageCache']=this['_editor']['plugins']['get']('UploadcareImageEditUI')['imageCache'],this['_attributes']=this['_editor']['config']['get']('uploadcare.editor')||{},this['set']({'isActive':!0x0,'imageStatus':'ready','imageErrorType':null,'imageId':null,'imageSrc':null,'imageDimension':null,'imageUploadProgress':null}),this['_prepareImage'](),this['_showDialog']();}destroy(){this['isActive']=!0x1,this['stopListening'](),this['stopDelegating'](),'uploading'===this['imageStatus']&&this['_controller']&&this['_controller']['abort']();}async['_prepareImage'](){const _0x3470a0=this['_imageElement'],_0x221387=_0x3470a0['getAttribute']('uploadcareImageId'),_0x44a1d9=_0x3470a0['getAttribute']('src');if(_0x221387)await this['_loadImageInfo'](_0x221387,_0x44a1d9);else{if(this['_imageCache']['has'](_0x44a1d9)){const _0x555ed2=this['_imageCache']['get'](_0x44a1d9);this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x555ed2['url'],this['imageDimension']=_0x555ed2['dimension'],this['imageId']=_0x555ed2['id'];}else this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),await this['_uploadImage'](this['_imageElement'],this['_controller']);}}['_showDialog'](){const {locale:_0x9bc542}=this['_editor'],t=_0x9bc542['t'],_0xd93d96=new st(_0x9bc542,this['imageStatus'],this['_attributes']);_0xd93d96['bind']('status')['to'](this,'imageStatus'),_0xd93d96['_loadingView']['bind']('imageUploadProgress')['to'](this,'imageUploadProgress'),_0xd93d96['_editingView']['bind']('imageSrc')['to'](this,'imageSrc'),_0xd93d96['_errorView']['bind']('errorType')['to'](this,'imageErrorType'),this['_addEditViewListeners'](_0xd93d96,this['_imageElement']),this['_dialog']['show']({'id':'uploadcareImageEdit','icon':_0x3fb224,'title':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'}),'content':_0xd93d96,'position':_0x96bcbf['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{_0xd93d96['focus']();},'onHide':()=>{_0xd93d96['destroy'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x26bfd4=>!H(_0x26bfd4,_0xd93d96['element'])}});}['_loadImageInfo'](_0x1554ae,_0x464c3d){return Q['getInfo'](_0x1554ae,{'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl')})['then'](_0x47424a=>{const {width:_0x590d59,height:_0x2b843b}=_0x47424a['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x464c3d,this['imageDimension']={'width':_0x590d59,'height':_0x2b843b},this['imageId']=_0x1554ae;})['catch'](_0x565ffd=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x565ffd['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}['_uploadImage'](_0x232a7b,_0x2b0ebd){return this['_getImageAsFile'](_0x232a7b)['then'](_0x15dc69=>Q['upload']({'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['_editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':_0x2b0ebd['signal'],'file':_0x15dc69,'onProgress':_0x30af94=>{_0x30af94&&_0x30af94['isComputable']&&(this['imageUploadProgress']=Math['ceil'](0x64*_0x30af94['value']));}}))['then'](_0x57e9cc=>{const {width:_0x17f60c,height:_0x2fc4c6}=_0x57e9cc['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x57e9cc['cdnUrl'],this['imageDimension']={'width':_0x17f60c,'height':_0x2fc4c6},this['imageId']=_0x57e9cc['uuid'],this['imageUploadProgress']=null;const _0xae827b=_0x232a7b['getAttribute']('src');this['_imageCache']['set'](_0xae827b,{'id':_0x57e9cc['uuid'],'url':_0x57e9cc['cdnUrl'],'dimension':this['imageDimension']});})['catch'](_0x12fa11=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x12fa11['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}_addEditViewListeners(_0x325cd6,_0xd89e07){_0x325cd6['on']('apply',(_0x2ba99b,_0x44ce53)=>{this['_replaceImage'](_0xd89e07,_0x44ce53['imageSrc'],this['imageId']),this['_dialog']['hide']();}),_0x325cd6['on']('retry',()=>{this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),this['_uploadImage'](this['_imageElement'],this['_controller']);}),_0x325cd6['on']('cancel',()=>{this['_dialog']['hide']();});}['_replaceImage'](_0x62504,_0x3950a8,_0x1140ac){const _0x496dfc=this['_editor'],{width:_0x2026fd,height:_0x5b94bb}=j(_0x3950a8,this['imageDimension']['width'],this['imageDimension']['height']),{imageFallbackUrl:_0x3f19ef,imageSources:_0x3ca6ef}=B(_0x3950a8,_0x2026fd);_0x496dfc['model']['change'](_0x568f25=>{if('$graveyard'!==_0x62504['root']['rootName'])_0x568f25['setSelection'](_0x62504,'on'),_0x496dfc['execute']('uploadcareImageReplace',{...Object['fromEntries'](_0x62504['getAttributes']()),'uploadcareImageId':_0x1140ac,'src':_0x3f19ef,'sources':_0x3ca6ef,'width':_0x2026fd,'height':_0x5b94bb},_0x62504);else{_0x496dfc['execute']('insertImage',{'imageType':_0x62504['is']('element','imageInline')?'imageInline':null,'source':{...Object['fromEntries'](_0x62504['getAttributes']()),'uploadcareImageId':_0x1140ac,'src':_0x3f19ef,'sources':_0x3ca6ef,'width':_0x2026fd,'height':_0x5b94bb}});const _0x3e4c02=_0x62504['getChildren']();_0x62504=_0x496dfc['model']['document']['selection']['getSelectedElement']();for(const _0x3c543b of _0x3e4c02)_0x568f25['append'](_0x568f25['cloneElement'](_0x3c543b),_0x62504);}_0x568f25['setSelection'](_0x62504,'on');});}async _getImageAsFile(_0x19728d){const _0x35a0f4=_0x14c7e2['window'],_0x174624=_0x14c7e2['document']['location']['href'],_0x1bc9c3=new _0x35a0f4['URL'](_0x19728d['getAttribute']('src'),_0x174624);if('data:'===_0x1bc9c3['protocol']){const _0x3f3d8f=_0x1bc9c3['href']['split'](','),_0x4f53fa=_0x3f3d8f[0x0]['match'](/:(.*?);/)[0x1],_0x69946d=_0x4f53fa['split']('/')[0x1],_0x306d70=_0x35a0f4['atob'](_0x3f3d8f[_0x3f3d8f['length']-0x1]);let _0x20b3b3=_0x306d70['length'];const _0x1dbb35=new _0x35a0f4['Uint8Array'](_0x20b3b3);for(;_0x20b3b3--;)_0x1dbb35[_0x20b3b3]=_0x306d70['charCodeAt'](_0x20b3b3);return new _0x35a0f4['File']([_0x1dbb35],'image.'+_0x69946d,{'type':_0x4f53fa});}const _0x24084b=_0x1bc9c3['href']['split']('/'),_0xa0c70f=_0x24084b[_0x24084b['length']-0x1],_0x266c83=_0xa0c70f['split']('.')[0x1];return _0x35a0f4['fetch'](_0x1bc9c3['href'])['then'](_0x232f73=>_0x232f73['clone']()['blob']())['then'](_0xa99163=>new _0x35a0f4['File']([_0xa99163],_0xa0c70f,{'type':'image/'+_0x266c83}));}},at=class extends _0x3083bd{imageEditController;static get requires(){return[_0x1fa73f];}_isEditable;constructor(_0xdf9128){super(_0xdf9128),this['imageEditController']=void 0x0,this['_isEditable']=function(_0xb15376){const _0x15eabf=M(_0xb15376);return _0xe15f02=>!(!_0xe15f02||!_0xe15f02['is']('element','imageBlock')&&!_0xe15f02['is']('element','imageInline'))&&(!!_0xe15f02['hasAttribute']('uploadcareImageId')||!!_0xe15f02['hasAttribute']('src')&&_0x15eabf(_0xe15f02['getAttribute']('src')));}(_0xdf9128['config']['get']('uploadcare.allowExternalImagesEditing')||[]),this['set']({'isActive':!0x1});}['refresh'](){const _0x3cef18=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=this['_isEditable'](_0x3cef18);}execute(){this['imageEditController']&&(this['unbind']('isActive'),this['imageEditController']=void 0x0);const _0x280d0c=this['editor']['model']['document']['selection']['getSelectedElement']();_0x280d0c&&(_0x280d0c['is']('element','imageBlock')||_0x280d0c['is']('element','imageInline'))&&(this['imageEditController']=new rt(this['editor'],this['editor']['plugins']['get'](_0x1fa73f),_0x280d0c),this['bind']('isActive')['to'](this['imageEditController'],'isActive'));}},ot=class extends _0x3083bd{['refresh'](){const _0x21face=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=Boolean(_0x21face&&(_0x21face['is']('element','imageBlock')||_0x21face['is']('element','imageInline')));}execute(_0x1c7ec9){const _0x44107c=this['editor']['model']['document']['selection']['getSelectedElement']();this['editor']['model']['change'](_0x457f1d=>{_0x457f1d['setAttributes'](_0x1c7ec9,_0x44107c),_0x457f1d['removeAttribute']('srcset',_0x44107c),_0x457f1d['removeAttribute']('sizes',_0x44107c);});}},ct=class extends _0x51ca24{static get['pluginName'](){return'UploadcareImageEditEditing';}static get requires(){return[Z,_0x4a71dc,_0x399c00,_0x4b54a8];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x40a13f}=this;_0x40a13f['commands']['add']('uploadcareImageEdit',new at(_0x40a13f)),_0x40a13f['commands']['add']('uploadcareImageReplace',new ot(_0x40a13f));}},lt=class extends _0x51ca24{['_imageCache']=new Map();static get['pluginName'](){return'UploadcareImageEditUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['imageCache'](){return this['_imageCache'];}init(){const _0x410904=this['editor'];_0x410904['ui']['componentFactory']['add']('uploadcareImageEdit',_0x43bbb7=>{const _0x2a7253=_0x410904['commands']['get']('uploadcareImageEdit'),_0x1fd75e=new _0x14f01c(_0x43bbb7),t=_0x43bbb7['t'];return _0x1fd75e['set']({'icon':_0x3fb224,'tooltip':!0x0,'label':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'})}),_0x1fd75e['bind']('isEnabled')['to'](_0x2a7253),_0x1fd75e['bind']('isOn')['to'](_0x2a7253,'isActive'),this['listenTo'](_0x1fd75e,'execute',()=>{_0x410904['execute']('uploadcareImageEdit'),_0x410904['editing']['view']['focus']();}),_0x1fd75e;}),this['_initConfig']();}_initConfig(){const _0x472cd6=_0xcf6f91(document,'uc-config',{'ctx-name':'image-edit','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage']});document['body']['appendChild'](_0x472cd6),this['listenTo'](this['editor'],'destroy',()=>{_0x472cd6['remove']();});}},ut=class extends _0x51ca24{static get['pluginName'](){return'UploadcareImageEdit';}static get requires(){return[ct,lt];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{Y as Uploadcare,z as UploadcareCommand,Z as UploadcareEditing,ut as UploadcareImageEdit,at as UploadcareImageEditCommand,ct as UploadcareImageEditEditing,lt as UploadcareImageEditUI,V as UploadcareUI,J as UploadcareUploadAdapter};
23
+ import{Command as _0x2d908d,Plugin as _0x1594fc}from'@ckeditor/ckeditor5-core';import{IconDropbox as _0xd39baa,IconError as _0xb8adc0,IconFacebook as _0x20e493,IconGoogleDrive as _0x416b49,IconGooglePhotos as _0x422914,IconOneDrive as _0x4755ad,IconUploadcareImageEdit as _0x32e80d,IconUploadcareImageUpload as _0x3b153f,IconUploadcareLink as _0x39d534}from'@ckeditor/ckeditor5-icons';import{ButtonView as _0x26e63d,Dialog as _0x531a28,DialogViewPosition as _0x5742fb,FocusCycler as _0x105754,IconView as _0x3e6674,MenuBarMenuListItemButtonView as _0x40efc3,Notification as _0xe18045,SpinnerView as _0x1d9f35,View as _0x2aa73e}from'@ckeditor/ckeditor5-ui';import{DomEmitterMixin as _0x4de12d,FocusTracker as _0x289570,ObservableMixin as _0x3f9395,createElement as _0x5826df,getAncestors as _0x51f3a4,global as _0x453ce0,uid as _0x567d01}from'@ckeditor/ckeditor5-utils';import{ImageEditing as _0x24949a,ImageUploadEditing as _0x51b74d,ImageUploadProgress as _0x67328a,ImageUtils as _0x5b6677,PictureEditing as _0xa8ed96}from'@ckeditor/ckeditor5-image';import{FileRepository as _0x3aa330}from'@ckeditor/ckeditor5-upload';import{info as _0x56a459,uploadFile as _0x311fc6}from'@uploadcare/upload-client';import*as _0x2c4d4c from'@uploadcare/file-uploader/web/file-uploader.min.js';function T(_0x58e7d6,_0x2c7365,_0xf4fdcd){const t=_0x58e7d6['t'],_0x1a7217=_0x58e7d6['t'];switch(_0x2c7365){case'local':return{'text':_0x1a7217('Insert'===_0xf4fdcd?'Upload\x20from\x20computer':'Replace\x20from\x20computer'),'shortText':_0x1a7217('From\x20computer')};case'url':return{'text':'Insert'===_0xf4fdcd?_0x1a7217('Insert\x20via\x20URL'):t('Replace\x20via\x20URL'),'shortText':_0x1a7217('Via\x20URL')};case'dropbox':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Dropbox':'Replace\x20with\x20Dropbox'),'shortText':t('With\x20Dropbox')};case'facebook':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Facebook':'Replace\x20with\x20Facebook'),'shortText':t('With\x20Facebook')};case'gdrive':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Google\x20Drive':'Replace\x20with\x20Google\x20Drive'),'shortText':t('With\x20Google\x20Drive')};case'gphotos':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Google\x20Photos':'Replace\x20with\x20Google\x20Photos'),'shortText':t('With\x20Google\x20Photos')};case'onedrive':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20OneDrive':'Replace\x20with\x20OneDrive'),'shortText':t('With\x20OneDrive')};default:return _0x2c7365;}}var V=class extends _0x1594fc{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'UploadcareUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x288c45=[this['editor']];for(const _0x3611b1 of _0x288c45){let _0xe875f0;for(const _0x33a00f in _0x3611b1){const _0x25b93a=_0x33a00f,_0x5f02be=_0x3611b1[_0x25b93a];if('uploadcareLicenseKeyValid'==_0x5f02be||'uploadcareLicenseKeyInvalid'==_0x5f02be||'uploadcareLicenseKeyExpired'==_0x5f02be||'uploadcareLicenseKeyDomainLimit'==_0x5f02be||'uploadcareLicenseKeyNotAllowed'==_0x5f02be||'uploadcareLicenseKeyEvaluationLimit'==_0x5f02be||'uploadcareLicenseKeyUsageLimit'==_0x5f02be){delete _0x3611b1[_0x25b93a],_0xe875f0=_0x5f02be,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'uploadcareLicenseKeyInvalid'==_0xe875f0&&_0x3611b1['_showLicenseError']('invalid'),'uploadcareLicenseKeyExpired'==_0xe875f0&&_0x3611b1['_showLicenseError']('expired'),'uploadcareLicenseKeyDomainLimit'==_0xe875f0&&_0x3611b1['_showLicenseError']('domainLimit'),'uploadcareLicenseKeyNotAllowed'==_0xe875f0&&_0x3611b1['_showLicenseError']('featureNotAllowed','Uploadcare'),'uploadcareLicenseKeyEvaluationLimit'==_0xe875f0&&_0x3611b1['_showLicenseError']('evaluationLimit'),'uploadcareLicenseKeyUsageLimit'==_0xe875f0&&_0x3611b1['_showLicenseError']('usageLimit');}},0x3e8);}afterInit(){const {editor:_0x27c109}=this,_0x5bf107=_0x27c109['commands']['get']('uploadcare');if(!_0x5bf107)return;const _0x5ea2f1=this['_normalizeConfigSourceList'](_0x27c109['config']['get']('uploadcare.uploader.sourceList'))['reduce']((_0x39cbd1,_0x383af8)=>{const _0x34d0d2=this['_getIntegrationKey'](_0x383af8['type']);return _0x39cbd1[_0x34d0d2]||(_0x39cbd1[_0x34d0d2]=[]),_0x39cbd1[_0x34d0d2]['push'](_0x383af8),_0x39cbd1;},{});_0x27c109['plugins']['has']('ImageInsertUI')&&_0x27c109['commands']['get']('uploadcare')&&Object['entries'](_0x5ea2f1)['forEach'](([_0x2193c9,_0x4a0344])=>{_0x27c109['plugins']['get']('ImageInsertUI')['registerIntegration']({'name':_0x2193c9,'observable':()=>_0x5bf107,'buttonViewCreator':()=>this['_createToolbarButton'](_0x4a0344),'formViewCreator':()=>this['_createDropdownButtons'](_0x4a0344),'menuBarButtonViewCreator':()=>this['_createMenuBarButtons'](_0x4a0344),'override':'assetManager'!==_0x2193c9});});}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}_normalizeConfigSourceList(_0x42b789){const {locale:_0x28e707}=this['editor'];return _0x42b789['map'](_0x546fa7=>{const _0x2c5fe8=T(_0x28e707,_0x546fa7,'Insert');switch(_0x546fa7){case'local':return{'icon':_0x3b153f,'type':'local',..._0x2c5fe8};case'url':return{'icon':_0x39d534,'type':'url',..._0x2c5fe8};case'dropbox':return{'icon':_0xd39baa,'type':'dropbox',..._0x2c5fe8};case'facebook':return{'icon':_0x20e493,'type':'facebook',..._0x2c5fe8};case'gdrive':return{'icon':_0x416b49,'type':'gdrive',..._0x2c5fe8};case'gphotos':return{'icon':_0x422914,'type':'gphotos',..._0x2c5fe8};case'onedrive':return{'icon':_0x4755ad,'type':'onedrive',..._0x2c5fe8};}});}_getIntegrationKey(_0x49a73a){switch(_0x49a73a){case'local':return'upload';case'url':return'url';default:return'assetManager';}}_createButton(_0x406a37,_0x1bcc48){const _0x71d368=this['editor'],_0x35a3b8=new _0x406a37(_0x71d368['locale']),_0x68476d=_0x71d368['commands']['get']('uploadcare');return _0x35a3b8['bind']('isEnabled')['to'](_0x68476d),_0x35a3b8['on']('execute',()=>{_0x68476d['execute'](_0x1bcc48);}),_0x35a3b8;}_createToolbarButton(_0x3583b2){const {locale:_0x4a657b}=this['editor'],_0x438e3f=this['editor']['plugins']['get']('ImageInsertUI'),_0x3b79f3=_0x3583b2[0x0],_0x1636bf=this['_createButton'](_0x26e63d,_0x3b79f3['type']);return _0x1636bf['icon']=_0x3b79f3['icon'],_0x1636bf['bind']('label')['to'](_0x438e3f,'isImageSelected',_0x34e5f8=>T(_0x4a657b,_0x3b79f3['type'],_0x34e5f8?'Replace':'Insert')['text']),_0x1636bf['tooltip']=!0x0,_0x1636bf;}_createDropdownButtons(_0x496483){const {locale:_0x589d91}=this['editor'],_0x4fa7be=this['editor']['plugins']['get']('ImageInsertUI');return _0x496483['map'](_0x531dd3=>{const _0x2d36b7=this['_createButton'](_0x26e63d,_0x531dd3['type']);return _0x2d36b7['withText']=!0x0,_0x2d36b7['icon']=_0x531dd3['icon'],_0x2d36b7['bind']('label')['to'](_0x4fa7be,'isImageSelected',_0x12a049=>T(_0x589d91,_0x531dd3['type'],_0x12a049?'Replace':'Insert')['text']),_0x2d36b7;});}_createMenuBarButtons(_0x4ccdc3){return _0x4ccdc3['map'](_0x4c743a=>{const _0x267088=this['_createButton'](_0x40efc3,_0x4c743a['type']);return _0x267088['icon']=_0x4c743a['icon'],_0x267088['label']=_0x4c743a['shortText'],_0x267088;});}},F=class extends _0x2aa73e{['focusTracker'];['focusCycler'];constructor(_0x54d45a){super(_0x54d45a),this['focusTracker']=new _0x289570(),this['focusCycler']=new _0x105754({'focusables':this['createCollection'](),'focusTracker':this['focusTracker']});}getFocusableElement(){return{'tag':'div','attributes':{'aria-hidden':'true','tabindex':'0'},'on':{'focus':this['bindTemplate']['to'](()=>{this['focusCycler']['fire']('forwardCycle');})}};}},$=class extends F{constructor(_0x3a1deb,_0x1a26a7){super(_0x3a1deb),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':[{'tag':'uc-file-uploader-inline','attributes':{'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'uploader-'+_0x1a26a7}},this['getFocusableElement']()]});}['focus'](){this['element']['focus']();}};function B(_0x164445,_0x1911a4){const _0x2a383a=_0x164445['replace'](/\/$/,'');return{'imageFallbackUrl':_0x164445,'imageSources':[{'srcset':[...[0x140,0x1e0,0x300,0x400,0x4b0,0x640,0x780,0x960]['filter'](_0x19ab65=>_0x19ab65<_0x1911a4)['map'](_0xa8223d=>_0x2a383a+'/-/resize/'+_0xa8223d+'x/\x20'+_0xa8223d+'w'),_0x164445+'\x20'+_0x1911a4+'w']['join'](',\x20'),'sizes':'(max-width:\x20'+_0x1911a4+'px)\x20100vw,\x20'+_0x1911a4+'px','type':'image/webp'}]};}function j(_0x1c07c3,_0x2316c1,_0x132d39){const _0xee5fa=_0x1c07c3['match'](/\/crop\/(\d+)x(\d+)\//);return{'width':_0xee5fa?parseInt(_0xee5fa[0x1],0xa):_0x2316c1,'height':_0xee5fa?parseInt(_0xee5fa[0x2],0xa):_0x132d39};}function q(_0x4c3b5f,_0x2655bb){const _0x1d273e=new(_0x4de12d())(),_0x53ea17=_0x4c3b5f['plugins']['get']('ImageUtils'),_0x38fb94=_0x4c3b5f['editing']['mapper']['toViewElement'](_0x2655bb),_0x592ef1=_0x53ea17['findViewImgElement'](_0x38fb94),_0x4adc49=_0x4c3b5f['editing']['view']['domConverter']['viewToDom'](_0x592ef1),_0x38a495=_0x2655bb['getAttribute']('width'),_0x52205b=_0x2655bb['getAttribute']('height'),_0x2ecd09='image-processing';_0x4c3b5f['editing']['view']['change'](_0x1093e8=>{_0x1093e8['addClass'](_0x2ecd09,_0x38fb94),_0x1093e8['setStyle']('aspect-ratio',_0x38a495+'/'+_0x52205b,_0x592ef1);}),_0x1d273e['listenTo'](_0x4adc49,'load',()=>{_0x1d273e['stopListening'](_0x4adc49,'load'),_0x4c3b5f['editing']['view']['change'](_0xe1ff90=>{_0xe1ff90['removeClass'](_0x2ecd09,_0x38fb94),_0xe1ff90['removeStyle']('aspect-ratio',_0x592ef1);});});}function M(_0x14d7e5){if(Array['isArray'](_0x14d7e5)){const _0x4e7182=_0x14d7e5['map'](M);return _0x5024ad=>_0x4e7182['some'](_0x1019ba=>_0x1019ba(_0x5024ad));}if('origin'==_0x14d7e5){const _0x22b7bc=_0x453ce0['window']['location']['origin'];return _0x5f5475=>new URL(_0x5f5475,_0x453ce0['document']['baseURI'])['origin']==_0x22b7bc;}return'function'==typeof _0x14d7e5?_0x14d7e5:_0x14d7e5 instanceof RegExp?_0x4e76b5=>!(!_0x4e76b5['match'](_0x14d7e5)&&!_0x4e76b5['replace'](/^https?:\/\//,'')['match'](_0x14d7e5)):()=>!0x1;}function H(_0x3a4b4d,_0x5724d1){return _0x51f3a4(_0x3a4b4d['target'])['includes'](_0x5724d1);}const W=/* #__PURE__ -- @preserve */
24
+ _0x3f9395();var G=class extends W{_editor;['_dialog'];_editing;['_api'];_type=null;['_formView']=null;constructor(_0x50523e,_0x324a7b,_0x19753b){super(),this['_editor']=_0x50523e,this['_editing']=_0x324a7b,this['_dialog']=_0x50523e['plugins']['get'](_0x531a28),this['_api']=_0x324a7b['ctxElement']['getAPI'](),this['_type']=_0x19753b,this['_editing']['configElement']['setAttribute']('source-list',this['_type']),this['_initDialog'](),this['_initListeners'](),this['_api']['initFlow']();}destroy(){this['_formView']&&(this['_formView']['destroy'](),this['_formView']=null),this['_api']&&this['_api']['doneFlow'](),this['stopListening'](),this['stopDelegating']();}_initDialog(){const {locale:_0x542f38,model:_0x2ff382}=this['_editor'],_0x4fd7e7=_0x2ff382['document']['selection']['getSelectedElement'](),_0x76bbbe=_0x4fd7e7&&(_0x4fd7e7['is']('element','imageBlock')||_0x4fd7e7['is']('element','imageInline'));this['_formView']=new $(_0x542f38,this['_editing']['ucContextId']),this['_dialog']['show']({'id':'uploadCare','icon':_0x3b153f,'title':T(_0x542f38,this['_type'],_0x76bbbe?'Replace':'Insert')['text'],'content':this['_formView'],'position':_0x5742fb['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_api']['removeAllFiles'](),this['_editor']['editing']['view']['focus'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x22ecf5=>!H(_0x22ecf5,this['_formView']['element'])}});}_initListeners(){this['_editing']['ctxElement']['addEventListener']('done-click',()=>{const {allEntries:_0x48cc52}=this['_api']['getOutputCollectionState']();this['_editor']['model']['change'](_0x1ab0e8=>{const _0xdb85=_0x48cc52['length'];for(const _0xaf19cb of _0x48cc52){const _0x37e3a0=_0xaf19cb===_0x48cc52[_0xdb85-0x1],{cdnUrl:_0x370c23,fileInfo:_0x1bf8fe}=_0xaf19cb;if(!_0x370c23||!_0x1bf8fe)continue;const {width:_0x1b385c,height:_0x1e7d47}=_0x1bf8fe['imageInfo'],_0x5db448=j(_0x370c23,_0x1b385c,_0x1e7d47),_0x186b06=B(_0x370c23,_0x5db448['width']),_0x5d707c={'id':_0x1bf8fe['uuid'],'type':'image','attributes':{'imageDimension':_0x5db448,..._0x186b06}};this['_insertAsset'](_0x5d707c,_0x37e3a0,_0x1ab0e8);}}),this['_dialog']['hide']();}),this['_editing']['ctxElement']['addEventListener']('change',_0x1c51a4=>{'idle'===_0x1c51a4['detail']['status']&&!_0x1c51a4['detail']['allEntries']['length']&&this['_dialog']['isOpen']&&('local'===this['_type']?this['_api']['setCurrentActivity']('start-from'):this['_api']['initFlow']());});}_insertAsset(_0x21c164,_0x58dc57,_0x4a5048){const _0x53c43b=this['_editor']['model']['document']['selection'],_0x9e3abb=_0x53c43b['getSelectedElement'](),_0x284c63=!(!_0x9e3abb||!_0x9e3abb['is']('element','imageInline'));_0x4a5048['removeSelectionAttribute']('linkHref'),this['_insertImage'](_0x21c164,_0x284c63),_0x58dc57||_0x4a5048['setSelection'](_0x53c43b['getLastPosition']());}_insertImage(_0x47f07a,_0x537387){const _0x21a1fd=this['_editor'],{imageDimension:_0x3bb4fa,imageFallbackUrl:_0x24a15,imageSources:_0x5ed030}=_0x47f07a['attributes'];_0x21a1fd['execute']('insertImage',{'imageType':_0x537387?'imageInline':null,'source':{'uploadcareImageId':_0x47f07a['id'],'src':_0x24a15,'sources':_0x5ed030,..._0x3bb4fa}});}},z=class extends _0x2d908d{_editing;_controller=null;static get requires(){return[_0x531a28,Z];}constructor(_0x58e7a6){super(_0x58e7a6),this['_editing']=_0x58e7a6['plugins']['get'](Z);}['refresh'](){this['isEnabled']=this['_checkEnabled']();}execute(_0x38cb33){this['_controller']&&(this['_controller']['destroy'](),this['_controller']=null),this['_controller']=new G(this['editor'],this['_editing'],_0x38cb33);}['_checkEnabled'](){return this['editor']['commands']['get']('insertImage')['isEnabled'];}},Q=class{static['upload']({file:_0x2a32b6,..._0x35df36}){return _0x311fc6(_0x2a32b6,_0x35df36);}static getInfo(_0x68ae8a,_0x3b2313){return _0x56a459(_0x68ae8a,_0x3b2313);}},J=class extends _0x1594fc{static get requires(){return[_0x51b74d,_0x67328a,_0x3aa330,Z];}static get['pluginName'](){return'UploadcareUploadAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async afterInit(){const _0x995d84=this['editor'];if(!_0x995d84['config']['get']('uploadcare'))return;_0x995d84['plugins']['get'](_0x3aa330)['createUploadAdapter']=_0x1dcf45=>new X(_0x1dcf45,_0x995d84),_0x995d84['plugins']['get'](_0x51b74d)['on']('uploadComplete',(_0x1b67d7,{imageElement:_0x59aeec,data:_0x333ee7})=>{_0x995d84['model']['change'](_0x5971e4=>{_0x5971e4['setAttribute']('uploadcareImageId',_0x333ee7['uploadcareImageId'],_0x59aeec);});});}},X=class{['loader'];editor;controller;constructor(_0x51e7aa,_0x4c264f){this['loader']=_0x51e7aa,this['editor']=_0x4c264f,this['controller']=new AbortController();}async['upload'](){const t=this['editor']['t'],_0x44beaf=await this['loader']['file'];return Q['upload']({'file':_0x44beaf,'publicKey':this['editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':this['controller']['signal'],'onProgress':_0x545bff=>{_0x545bff&&_0x545bff['isComputable']&&(this['loader']['uploadTotal']=0x1,this['loader']['uploaded']=_0x545bff['value']);}})['then'](async _0xba1719=>{const {imageFallbackUrl:_0x689981,imageSources:_0x1ab018}=B(_0xba1719['cdnUrl'],_0xba1719['imageInfo']['width']);return{'uploadcareImageId':_0xba1719['uuid'],'default':_0x689981,'sources':_0x1ab018};})['catch'](()=>{const _0x389214=t('Cannot\x20upload\x20file:')+('\x20'+_0x44beaf['name']+'.');return Promise['reject'](_0x389214);});}abort(){this['controller']['abort']();}},Z=class extends _0x1594fc{_configElement=null;_ctxElement=null;static get['pluginName'](){return'UploadcareEditing';}static get requires(){return[_0xa8ed96,J,_0x531a28];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}ucContextId;get configElement(){return this['_configElement'];}get ctxElement(){return this['_ctxElement'];}constructor(_0x21900f){super(_0x21900f),this['ucContextId']=_0x567d01();}init(){const _0x2c2183=this['editor'];_0x2c2183['commands']['add']('uploadcare',new z(_0x2c2183));}afterInit(){this['_initSchema'](),this['_initConversion'](),this['_initConfig'](),this['_initCtx'](),this['_initImageProcessingIndicator'](),this['listenTo'](this['editor'],'destroy',()=>{this['_configElement']&&(this['_configElement']['remove'](),this['_configElement']=null),this['_ctxElement']&&(this['_ctxElement']['remove'](),this['_ctxElement']=null);const _0x15922a=_0x453ce0['document']['querySelector']('input[uploadcare-file-input]');_0x15922a&&_0x15922a['remove']();}),async function(_0x332149){const _0x2feeae='4wieLj6qmWZnpxGN9QYyFhU15kOfCBAHt2slISMXP3vErub8za07VTRoKcdDgJ',_0x1a83df=0x79410,_0x1d8b11={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x2899f6(_0x3048ba){const _0x142acf=new window['Promise'](_0x2f1e99=>{_0x3048ba['once']('ready',_0x2f1e99);}),_0x3760aa=window['Date']['now'](),_0xab435d=_0x3048ba['config']['get']('licenseKey');async function _0x5e0874(){let _0x2d7112,_0x466ab3=null,_0x54df0a=null;try{return'GPL'==_0xab435d?'NotAllowed':(_0x2d7112=_0x275563(),_0x2d7112?(_0x2d7112['usageEndpoint']&&(_0x54df0a=_0x4a53fc(_0x2d7112['usageEndpoint'],_0x2d7112['jti'])),await _0x5eb163()?_0x26611c()?_0x2c2521()?'Expired':_0xc76363()?('evaluation'==_0x2d7112['licenseType']&&(_0x466ab3=_0x6a76ad('EvaluationLimit')),await _0x4bef9b()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x2c2521(){const _0x22ad8e=['evaluation','trial']['includes'](_0x2d7112['licenseType'])?_0x3760aa/0x3e8:0xe10*_0x1a83df;return _0x2d7112['exp']<_0x22ad8e;}function _0x26611c(){const _0x4f8e4c=_0x2d7112['features'];return!!_0x4f8e4c&&(!!_0x4f8e4c['includes']('*')||!!_0x4f8e4c['includes']('UPLC'));}function _0xc76363(){const _0x13b1fe=_0x2d7112['licensedHosts'];if(!_0x13b1fe||0x0==_0x13b1fe['length'])return!0x0;const {hostname:_0x182324}=new URL(window['location']['href']);if(_0x13b1fe['includes'](_0x182324))return!0x0;const _0x2cd053=_0x182324['split']('.');return _0x13b1fe['filter'](_0x4edb30=>_0x4edb30['includes']('*'))['map'](_0x270123=>_0x270123['split']('.'))['filter'](_0x444e4e=>_0x444e4e['length']<=_0x2cd053['length'])['map'](_0x17869d=>Array(_0x2cd053['length']-_0x17869d['length'])['fill']('*'===_0x17869d[0x0]?'*':'')['concat'](_0x17869d))['some'](_0x42f74c=>_0x2cd053['every']((_0x60e52d,_0x2f3894)=>_0x42f74c[_0x2f3894]===_0x60e52d||'*'===_0x42f74c[_0x2f3894]));}function _0x4bef9b(){return _0x466ab3&&_0x54df0a?new window['Promise']((_0x2671d8,_0x33acb0)=>{_0x466ab3['then'](_0x2671d8,_0x33acb0),_0x54df0a['then'](_0x2a22a5=>{'Valid'!=_0x2a22a5&&_0x2671d8(_0x2a22a5);},_0x33acb0);}):_0x466ab3||_0x54df0a||'Valid';}}function _0x4a53fc(_0x358934,_0x2a93a4){return new window['Promise'](_0x52fdd5=>{if(_0x558772())return _0x52fdd5('Valid');_0x45b5ee(),_0x3048ba['decorate']('_sendUsageRequest');let _0x55f092=!0x1;const _0x155341=_0x567d01();function _0x3e8e43(_0x7d3734){return!!_0x7d3734&&('object'==typeof _0x7d3734||'function'==typeof _0x7d3734)&&'function'==typeof _0x7d3734['then']&&'function'==typeof _0x7d3734['catch'];}function _0x320178(_0x4ff9d0){_0x479785(_0x4ff9d0)['then'](_0x2d872c=>_0x2d872c&&'ok'==_0x2d872c['status']?_0xab485b(_0x3ee3c9(_0x155341+_0x2a93a4))!=_0x2d872c['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xb1cb24=>(_0x35565e(),_0xb1cb24),()=>{const _0x45ff5e=_0x52edd0();return null==_0x45ff5e?(_0x35565e(),'Valid'):_0x3760aa-_0x45ff5e>0x240c8400?'UsageLimit':'Valid';})['then'](_0x52fdd5)['catch'](()=>{_0x52fdd5('UsageLimit');});const _0x3e3ec3=0x36ee80;function _0x35565e(){const _0x29a5cc='llct-'+_0xab485b(_0x3ee3c9(_0x358934)),_0xdbcd74=_0x38ccfb(_0xab485b(window['Math']['ceil'](_0x3760aa/_0x3e3ec3)));window['localStorage']['setItem'](_0x29a5cc,_0xdbcd74);}function _0x52edd0(){const _0x566fe0='llct-'+_0xab485b(_0x3ee3c9(_0x358934)),_0x3c8fab=window['localStorage']['getItem'](_0x566fe0);return _0x3c8fab?window['parseInt'](_0x38ccfb(_0x3c8fab),0x10)*_0x3e3ec3:null;}function _0x479785(_0x13cb40){return new window['Promise']((_0x22216c,_0x4a94d0)=>{_0x13cb40['then'](_0x22216c,_0x4a94d0),window['setTimeout'](_0x4a94d0,0x1d4c0);});}}_0x3048ba['on']('_sendUsageRequest',(_0x4bd8eb,_0x53785f)=>{if(_0x53785f[0x0]!=_0x358934)return _0x52fdd5('UsageLimit');_0x53785f[0x1]={..._0x53785f[0x1],'requestId':_0x155341};},{'priority':'high'}),_0x3048ba['on']('_sendUsageRequest',_0x4cf11b=>{_0x3e8e43(_0x4cf11b['return'])&&(_0x55f092=!0x0,_0x320178(_0x4cf11b['return']));},{'priority':'low'}),_0x142acf['then'](()=>{_0x55f092||_0x52fdd5('UsageLimit');});});function _0x558772(){return'auto'==_0x3048ba['editing']['view']['_overlayModeHint'];}function _0x45b5ee(){_0x3048ba['editing']['view']['_overlayModeHint']='auto';}}function _0x6a76ad(_0x457cf8){const _0x7205ea=[new window['Promise'](_0x27c2f2=>setTimeout(_0x27c2f2,0x93ecc)),_0x142acf['then'](()=>new window['Promise'](_0x220786=>{let _0x4d134d=0x0;_0x3048ba['model']['on']('applyOperation',(_0xe9037c,_0x39a1a9)=>{_0x39a1a9[0x0]['isDocumentOperation']&&_0x4d134d++,0x5e8==_0x4d134d&&(_0x220786(),_0xe9037c['off']());});}))];return window['Promise']['race'](_0x7205ea)['then'](()=>_0x457cf8);}async function _0x31e80c(){await _0x142acf,_0x3048ba['model']['change']=_0x3ba162,_0x3048ba['model']['enqueueChange']=_0x3ba162,_0x3048ba['enableReadOnlyMode']('model');}function _0x2cb9e5(_0x5bd659){const _0x4732d0=_0x3274e6();_0x3048ba[_0x4732d0]='uploadcareLicenseKey'+_0x5bd659,'Valid'!=_0x5bd659&&_0x31e80c();}function _0x3274e6(){const _0x43fdee=window['String'](window['performance']['now']())['replace']('.','');let _0x582e89='w';for(let _0x582dc7=0x0;_0x582dc7<_0x43fdee['length'];_0x582dc7+=0x2){let _0x4ab231=window['parseInt'](_0x43fdee['substring'](_0x582dc7,_0x582dc7+0x2));_0x4ab231>=0x3e&&(_0x4ab231-=0x3e),_0x582e89+=_0x2feeae[_0x4ab231];}return _0x582e89;}function _0x275563(){const _0x21f619=_0xab435d['split']('.');if(0x3!=_0x21f619['length'])return null;return _0x48c427(_0x21f619[0x1]);function _0x48c427(_0x5bd968){const _0x412497=_0x848a2f(_0x5bd968);return _0x412497&&_0x4bd73e()?_0x412497:null;function _0x4bd73e(){const _0x54e649=_0x412497['jti'],_0x2addc6=window['parseInt'](_0x54e649['substring'](_0x54e649['length']-0x8),0x10),_0x127ac3={..._0x412497,'jti':_0x54e649['substring'](0x0,_0x54e649['length']-0x8)};return delete _0x127ac3['vc'],_0x3ee3c9(_0x127ac3)==_0x2addc6;}}}async function _0x5eb163(){let _0x4b2845=!0x0;try{const [_0xf25769,_0x328b90,_0x3c7afe]=_0xab435d['split']('.');return _0x53d3ae(_0xf25769),await _0x1870d4(_0xf25769,_0x328b90,_0x3c7afe),_0x4b2845;}catch{return!0x1;}function _0x53d3ae(_0xf92512){const _0x3494a3=_0x848a2f(_0xf92512);_0x3494a3&&'ES256'==_0x3494a3['alg']||(_0x4b2845=!0x1);}async function _0x1870d4(_0x2ad7d0,_0x5b9f6d,_0x59c8d7){const _0x14db82=window['Uint8Array']['from'](_0x58577f(_0x59c8d7),_0x1bf694=>_0x1bf694['charCodeAt'](0x0)),_0x43f8c5=new window['TextEncoder']()['encode'](_0x2ad7d0+'.'+_0x5b9f6d),_0xbff50=window['crypto']['subtle'];if(!_0xbff50)return;const _0x5540de=await _0xbff50['importKey']('jwk',_0x1d8b11,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0xbff50['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x5540de,_0x14db82,_0x43f8c5)||(_0x4b2845=!0x1);}}function _0x848a2f(_0x356756){return _0x356756['startsWith']('ey')?JSON['parse'](_0x58577f(_0x356756)):null;}function _0x58577f(_0x57e075){return window['atob'](_0x57e075['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x3ee3c9(_0x59e97b){let _0x4d03d2=0x1505;function _0x5ecb24(_0x7716f1){for(let _0xc13167=0x0;_0xc13167<_0x7716f1['length'];_0xc13167++){const _0x38c553=_0x7716f1['charCodeAt'](_0xc13167);_0x4d03d2=(_0x4d03d2<<0x5)+_0x4d03d2+_0x38c553,_0x4d03d2&=_0x4d03d2;}}function _0x2bd818(_0x5c236e){Array['isArray'](_0x5c236e)?_0x5c236e['forEach'](_0x2bd818):_0x5c236e&&'object'==typeof _0x5c236e?Object['entries'](_0x5c236e)['sort']()['forEach'](([_0x3ca0ef,_0x2fe14f])=>{_0x5ecb24(_0x3ca0ef),_0x2bd818(_0x2fe14f);}):_0x5ecb24(window['String'](_0x5c236e));}return _0x2bd818(_0x59e97b),_0x4d03d2>>>0x0;}function _0xab485b(_0xf0f892){return _0xf0f892['toString'](0x10)['padStart'](0x8,'0');}function _0x38ccfb(_0x5aad4c){return _0x5aad4c['split']('')['reverse']()['join']('');}function _0x3ba162(){}_0x2cb9e5(await _0x5e0874());}_0x2899f6(_0x332149['editor']);}(this);}_initSchema(){const _0x52dbdf=this['editor']['model']['schema'];_0x52dbdf['isRegistered']('imageBlock')&&_0x52dbdf['extend']('imageBlock',{'allowAttributes':['uploadcareImageId']}),_0x52dbdf['isRegistered']('imageInline')&&_0x52dbdf['extend']('imageInline',{'allowAttributes':['uploadcareImageId']});}_initConversion(){const _0x5451bc=this['editor'];_0x5451bc['conversion']['for']('downcast')['attributeToAttribute']({'model':'uploadcareImageId','view':'data-uc-image-id'}),_0x5451bc['conversion']['for']('upcast')['elementToAttribute']({'model':{'key':'uploadcareImageId','value':_0x34966e=>_0x34966e['getAttribute']('data-uc-image-id')},'view':{'attributes':{'data-uc-image-id':/[a-zA-Z0-9\\-]+/}}});const _0x539eb9=_0x5451bc['commands']['get']('replaceImageSource');_0x539eb9&&this['listenTo'](_0x539eb9,'cleanupImage',(_0x590912,[_0x15d703,_0x4fa669])=>{_0x15d703['removeAttribute']('uploadcareImageId',_0x4fa669);});}_initConfig(){const _0x408fb9=this['editor']['config']['get']('uploadcare.uploader')||{},_0x5bf186=this['editor']['config']['get']('uploadcare.pubkey')||'';this['_configElement']=_0x5826df(_0x453ce0['document'],'uc-config',{..._0x408fb9,'pubkey':_0x5bf186,'ctx-name':'uploader-'+this['ucContextId'],'sourceList':'','imgOnly':'true','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage'],'externalSourcesEmbedCss':'\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup\x20{\x20padding:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-menu\x20{\x20gap:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-footer\x20{\x20padding-top:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__separator\x20{\x20margin:\x200;\x20}\x0a\x09\x09\x09'}),this['_configElement']['iconHrefResolver']=_0x4e72f8=>{if('closeMax'==_0x4e72f8)return'#uc-icon-arrow-down';},_0x453ce0['document']['body']['appendChild'](this['_configElement']);}_initCtx(){this['_ctxElement']=_0x5826df(_0x453ce0['document'],'uc-upload-ctx-provider',{'ctx-name':'uploader-'+this['ucContextId']}),_0x453ce0['document']['body']['appendChild'](this['_ctxElement']);}_initImageProcessingIndicator(){const _0x59ded9=this['editor']['commands']['get']('insertImage');_0x59ded9&&this['listenTo'](_0x59ded9,'execute',()=>{const _0x279ab9=this['editor']['model']['document']['selection']['getSelectedElement']();_0x279ab9&&_0x279ab9['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x279ab9);});});const _0x4e8c87=this['editor']['commands']['get']('uploadcareImageReplace');_0x4e8c87&&this['listenTo'](_0x4e8c87,'execute',()=>{const _0x24fb74=this['editor']['model']['document']['selection']['getSelectedElement']();_0x24fb74&&_0x24fb74['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x24fb74);});});}},Y=class extends _0x1594fc{static get requires(){return[Z,V];}static get['pluginName'](){return'Uploadcare';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xf1e5da){super(_0xf1e5da),_0xf1e5da['config']['define']('uploadcare.uploader.sourceList',['local','url']),_0x2c4d4c['defineComponents'](_0x2c4d4c),this['_defineLocale']();}['_defineLocale'](){const _0x2b83e9=this['editor']['config']['get']('uploadcare.locale'),_0x16dfa2=this['editor']['locale']['contentLanguage'];_0x2b83e9&&_0x2c4d4c['defineLocale'](_0x16dfa2,_0x2b83e9);}},tt=class extends _0x2aa73e{constructor(_0xc9abc9){super(_0xc9abc9);const t=_0xc9abc9['t'],_0x10825d=this['bindTemplate'],_0x451883=new _0x1d9f35();_0x451883['isVisible']=!0x0,this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__loading'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__loading-spinner']},'children':[_0x451883,{'text':_0x10825d['to']('imageUploadProgress',_0x2fa8c1=>t('Loading\x20image...')+'\x20('+(_0x2fa8c1||0x0)+'%)')}]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},et=class extends _0x2aa73e{constructor(_0x2b8815){super(_0x2b8815);const t=_0x2b8815['t'];this['set']('errorType',null);const _0x3de88e=new _0x26e63d(_0x2b8815);_0x3de88e['label']=t({'id':'Try\x20again\x20(Uploadcare)','string':'Try\x20again'}),_0x3de88e['withText']=!0x0,_0x3de88e['class']='ck-button-action',_0x3de88e['on']('execute',()=>{this['fire']('retry');}),_0x3de88e['bind']('isVisible')['to'](this,'errorType',_0x4ba674=>'NotFound'!==_0x4ba674);const _0x301bce=new _0x3e6674();_0x301bce['content']=_0xb8adc0,_0x301bce['extendTemplate']({'attributes':{'style':{'width':'50px','height':'50px'}}});const _0x393e2b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__error'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__error-contents']},'children':[_0x301bce,{'tag':'h3','attributes':{'style':{'fontWeight':'bold'}},'children':[{'text':t('Unable\x20to\x20load')}]},{'text':_0x393e2b['to']('errorType',_0xfb20cf=>t('NotFound'!==_0xfb20cf?'We\x20were\x20unable\x20to\x20load\x20the\x20image\x20due\x20to\x20network\x20connection\x20issues.':'The\x20image\x20was\x20not\x20found.\x20Its\x20source\x20may\x20have\x20been\x20removed.'))},_0x3de88e]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},it=class extends _0x2aa73e{constructor(_0x46304f,_0x4f5ada){super(_0x46304f);const _0x3dc22a=this['bindTemplate'];this['set']('imageSrc',''),this['setTemplate']({'tag':'uc-cloud-image-editor','attributes':{..._0x4f5ada,'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'image-edit','cdn-url':_0x3dc22a['to']('imageSrc')}});}},st=class extends F{_items;['_loadingView'];['_errorView'];_editingView;['_focusableView'];constructor(_0xce09b5,_0x3b5297,_0x3a6a50){super(_0xce09b5),this['_items']=this['createCollection'](),this['_loadingView']=new tt(_0xce09b5),this['_errorView']=new et(_0xce09b5),this['_editingView']=new it(_0xce09b5,_0x3a6a50),this['_focusableView']=new _0x2aa73e(_0xce09b5),this['_focusableView']['setTemplate'](this['getFocusableElement']()),this['set']('status',_0x3b5297),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':this['_items']}),this['_setView'](),this['once']('render',()=>{this['_waitForImageEditorComponent'](this['element'],_0x2fea12=>{this['_addUploadcareImageEditorListeners'](_0x2fea12);});}),this['on']('change:status',()=>{this['_setView']();}),this['_addErrorViewListeners']();}['focus'](){this['element']['focus']();}_setView(){switch(this['_items']['clear'](),this['status']){case'uploading':this['_items']['add'](this['_loadingView']);break;case'error':this['_items']['add'](this['_errorView']);break;case'ready':this['_items']['addMany']([this['_editingView'],this['_focusableView']]);}}_waitForImageEditorComponent(_0x244090,_0x3eac1e){const _0x52961d='uc-cloud-image-editor',_0x2f72b3=_0x244090['querySelector'](_0x52961d);if(_0x2f72b3)return _0x3eac1e(_0x2f72b3);const _0x3aae54=new MutationObserver(_0x4f1a0c=>{const _0x5c16d7=_0x4f1a0c['filter'](_0x1cdabd=>_0x1cdabd['target']===_0x244090&&_0x1cdabd['addedNodes']['length']>0x0&&_0x1cdabd['addedNodes'][0x0]['nodeName']['toLowerCase']()===_0x52961d);_0x5c16d7['length']&&(_0x3aae54['disconnect'](),_0x3eac1e(_0x5c16d7[0x0]['addedNodes'][0x0]));});_0x3aae54['observe'](_0x244090,{'childList':!0x0,'subtree':!0x0});}_addUploadcareImageEditorListeners(_0x168a3a){_0x168a3a['addEventListener']('apply',_0x1362b8=>{this['fire']('apply',{'imageSrc':_0x1362b8['detail']['cdnUrl']});}),_0x168a3a['addEventListener']('cancel',()=>{this['fire']('cancel');});}_addErrorViewListeners(){this['_errorView']['on']('retry',()=>{this['fire']('retry');});}};const nt=/* #__PURE__ -- @preserve */
25
+ _0x3f9395();var rt=class extends nt{_editor;['_dialog'];_imageElement;['_imageCache'];_controller;_attributes;constructor(_0x59cdce,_0x38cc61,_0x1b3036){super(),this['_editor']=_0x59cdce,this['_dialog']=_0x38cc61,this['_imageElement']=_0x1b3036,this['_imageCache']=this['_editor']['plugins']['get']('UploadcareImageEditUI')['imageCache'],this['_attributes']=this['_editor']['config']['get']('uploadcare.editor')||{},this['set']({'isActive':!0x0,'imageStatus':'ready','imageErrorType':null,'imageId':null,'imageSrc':null,'imageDimension':null,'imageUploadProgress':null}),this['_prepareImage'](),this['_showDialog']();}destroy(){this['isActive']=!0x1,this['stopListening'](),this['stopDelegating'](),'uploading'===this['imageStatus']&&this['_controller']&&this['_controller']['abort']();}async['_prepareImage'](){const _0x16af33=this['_imageElement'],_0x163d51=_0x16af33['getAttribute']('uploadcareImageId'),_0x2f4f6b=_0x16af33['getAttribute']('src');if(_0x163d51)await this['_loadImageInfo'](_0x163d51,_0x2f4f6b);else{if(this['_imageCache']['has'](_0x2f4f6b)){const _0x5acc1d=this['_imageCache']['get'](_0x2f4f6b);this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x5acc1d['url'],this['imageDimension']=_0x5acc1d['dimension'],this['imageId']=_0x5acc1d['id'];}else this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),await this['_uploadImage'](this['_imageElement'],this['_controller']);}}['_showDialog'](){const {locale:_0x409730}=this['_editor'],t=_0x409730['t'],_0x467ba2=new st(_0x409730,this['imageStatus'],this['_attributes']);_0x467ba2['bind']('status')['to'](this,'imageStatus'),_0x467ba2['_loadingView']['bind']('imageUploadProgress')['to'](this,'imageUploadProgress'),_0x467ba2['_editingView']['bind']('imageSrc')['to'](this,'imageSrc'),_0x467ba2['_errorView']['bind']('errorType')['to'](this,'imageErrorType'),this['_addEditViewListeners'](_0x467ba2,this['_imageElement']),this['_dialog']['show']({'id':'uploadcareImageEdit','icon':_0x32e80d,'title':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'}),'content':_0x467ba2,'position':_0x5742fb['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{_0x467ba2['focus']();},'onHide':()=>{_0x467ba2['destroy'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0xdbb3f5=>!H(_0xdbb3f5,_0x467ba2['element'])}});}['_loadImageInfo'](_0xd140a9,_0x3de96e){return Q['getInfo'](_0xd140a9,{'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl')})['then'](_0x59efa4=>{const {width:_0x5aa136,height:_0x4d30aa}=_0x59efa4['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x3de96e,this['imageDimension']={'width':_0x5aa136,'height':_0x4d30aa},this['imageId']=_0xd140a9;})['catch'](_0x11a3e9=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x11a3e9['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}['_uploadImage'](_0x24658a,_0x4f31a1){return this['_getImageAsFile'](_0x24658a)['then'](_0x652132=>Q['upload']({'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['_editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':_0x4f31a1['signal'],'file':_0x652132,'onProgress':_0x26b66d=>{_0x26b66d&&_0x26b66d['isComputable']&&(this['imageUploadProgress']=Math['ceil'](0x64*_0x26b66d['value']));}}))['then'](_0x4561e8=>{const {width:_0x1c992b,height:_0x67d5a2}=_0x4561e8['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x4561e8['cdnUrl'],this['imageDimension']={'width':_0x1c992b,'height':_0x67d5a2},this['imageId']=_0x4561e8['uuid'],this['imageUploadProgress']=null;const _0x3a2bc5=_0x24658a['getAttribute']('src');this['_imageCache']['set'](_0x3a2bc5,{'id':_0x4561e8['uuid'],'url':_0x4561e8['cdnUrl'],'dimension':this['imageDimension']});})['catch'](_0x43c4d0=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x43c4d0['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}_addEditViewListeners(_0x3ba259,_0x5ad5e7){_0x3ba259['on']('apply',(_0x516b3a,_0x4b13b0)=>{this['_replaceImage'](_0x5ad5e7,_0x4b13b0['imageSrc'],this['imageId']),this['_dialog']['hide']();}),_0x3ba259['on']('retry',()=>{this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),this['_uploadImage'](this['_imageElement'],this['_controller']);}),_0x3ba259['on']('cancel',()=>{this['_dialog']['hide']();});}['_replaceImage'](_0x22e31a,_0x175ed1,_0x1212c9){const _0x3fa8f7=this['_editor'],{width:_0x5caa8c,height:_0x3df3a6}=j(_0x175ed1,this['imageDimension']['width'],this['imageDimension']['height']),{imageFallbackUrl:_0x35c8a0,imageSources:_0x569ff0}=B(_0x175ed1,_0x5caa8c);_0x3fa8f7['model']['change'](_0x16e61f=>{if('$graveyard'!==_0x22e31a['root']['rootName'])_0x16e61f['setSelection'](_0x22e31a,'on'),_0x3fa8f7['execute']('uploadcareImageReplace',{...Object['fromEntries'](_0x22e31a['getAttributes']()),'uploadcareImageId':_0x1212c9,'src':_0x35c8a0,'sources':_0x569ff0,'width':_0x5caa8c,'height':_0x3df3a6},_0x22e31a);else{_0x3fa8f7['execute']('insertImage',{'imageType':_0x22e31a['is']('element','imageInline')?'imageInline':null,'source':{...Object['fromEntries'](_0x22e31a['getAttributes']()),'uploadcareImageId':_0x1212c9,'src':_0x35c8a0,'sources':_0x569ff0,'width':_0x5caa8c,'height':_0x3df3a6}});const _0x212c24=_0x22e31a['getChildren']();_0x22e31a=_0x3fa8f7['model']['document']['selection']['getSelectedElement']();for(const _0x39053a of _0x212c24)_0x16e61f['append'](_0x16e61f['cloneElement'](_0x39053a),_0x22e31a);}_0x16e61f['setSelection'](_0x22e31a,'on');});}async _getImageAsFile(_0x1e2998){const _0x4e052e=_0x453ce0['window'],_0x41887c=_0x453ce0['document']['location']['href'],_0x4628c1=new _0x4e052e['URL'](_0x1e2998['getAttribute']('src'),_0x41887c);if('data:'===_0x4628c1['protocol']){const _0x47523e=_0x4628c1['href']['split'](','),_0x283da3=_0x47523e[0x0]['match'](/:(.*?);/)[0x1],_0x1b73cb=_0x283da3['split']('/')[0x1],_0x4be325=_0x4e052e['atob'](_0x47523e[_0x47523e['length']-0x1]);let _0x3c30e3=_0x4be325['length'];const _0x112f21=new _0x4e052e['Uint8Array'](_0x3c30e3);for(;_0x3c30e3--;)_0x112f21[_0x3c30e3]=_0x4be325['charCodeAt'](_0x3c30e3);return new _0x4e052e['File']([_0x112f21],'image.'+_0x1b73cb,{'type':_0x283da3});}const _0x5f2843=_0x4628c1['href']['split']('/'),_0x3a6ac9=_0x5f2843[_0x5f2843['length']-0x1],_0x7dec3f=_0x3a6ac9['split']('.')[0x1];return _0x4e052e['fetch'](_0x4628c1['href'])['then'](_0x44feb1=>_0x44feb1['clone']()['blob']())['then'](_0x5007e0=>new _0x4e052e['File']([_0x5007e0],_0x3a6ac9,{'type':'image/'+_0x7dec3f}));}},at=class extends _0x2d908d{imageEditController;static get requires(){return[_0x531a28];}_isEditable;constructor(_0xe7aef2){super(_0xe7aef2),this['imageEditController']=void 0x0,this['_isEditable']=function(_0x514e0d){const _0x15f0bd=M(_0x514e0d);return _0x281ca4=>!(!_0x281ca4||!_0x281ca4['is']('element','imageBlock')&&!_0x281ca4['is']('element','imageInline'))&&(!!_0x281ca4['hasAttribute']('uploadcareImageId')||!!_0x281ca4['hasAttribute']('src')&&_0x15f0bd(_0x281ca4['getAttribute']('src')));}(_0xe7aef2['config']['get']('uploadcare.allowExternalImagesEditing')||[]),this['set']({'isActive':!0x1});}['refresh'](){const _0x332722=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=this['_isEditable'](_0x332722);}execute(){this['imageEditController']&&(this['unbind']('isActive'),this['imageEditController']=void 0x0);const _0x1041ec=this['editor']['model']['document']['selection']['getSelectedElement']();_0x1041ec&&(_0x1041ec['is']('element','imageBlock')||_0x1041ec['is']('element','imageInline'))&&(this['imageEditController']=new rt(this['editor'],this['editor']['plugins']['get'](_0x531a28),_0x1041ec),this['bind']('isActive')['to'](this['imageEditController'],'isActive'));}},ot=class extends _0x2d908d{['refresh'](){const _0xc8b125=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=Boolean(_0xc8b125&&(_0xc8b125['is']('element','imageBlock')||_0xc8b125['is']('element','imageInline')));}execute(_0x1cacc5){const _0x169cd6=this['editor']['model']['document']['selection']['getSelectedElement']();this['editor']['model']['change'](_0x3b6a96=>{_0x3b6a96['setAttributes'](_0x1cacc5,_0x169cd6),_0x3b6a96['removeAttribute']('srcset',_0x169cd6),_0x3b6a96['removeAttribute']('sizes',_0x169cd6);});}},ct=class extends _0x1594fc{static get['pluginName'](){return'UploadcareImageEditEditing';}static get requires(){return[Z,_0xe18045,_0x5b6677,_0x24949a];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x3e0994}=this;_0x3e0994['commands']['add']('uploadcareImageEdit',new at(_0x3e0994)),_0x3e0994['commands']['add']('uploadcareImageReplace',new ot(_0x3e0994));}},lt=class extends _0x1594fc{['_imageCache']=new Map();static get['pluginName'](){return'UploadcareImageEditUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['imageCache'](){return this['_imageCache'];}init(){const _0x2d8ee2=this['editor'];_0x2d8ee2['ui']['componentFactory']['add']('uploadcareImageEdit',_0x2e4ad2=>{const _0x343f10=_0x2d8ee2['commands']['get']('uploadcareImageEdit'),_0x1c0a74=new _0x26e63d(_0x2e4ad2),t=_0x2e4ad2['t'];return _0x1c0a74['set']({'icon':_0x32e80d,'tooltip':!0x0,'label':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'})}),_0x1c0a74['bind']('isEnabled')['to'](_0x343f10),_0x1c0a74['bind']('isOn')['to'](_0x343f10,'isActive'),this['listenTo'](_0x1c0a74,'execute',()=>{_0x2d8ee2['execute']('uploadcareImageEdit'),_0x2d8ee2['editing']['view']['focus']();}),_0x1c0a74;}),this['_initConfig']();}_initConfig(){const _0x15beec=_0x5826df(document,'uc-config',{'ctx-name':'image-edit','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage']});document['body']['appendChild'](_0x15beec),this['listenTo'](this['editor'],'destroy',()=>{_0x15beec['remove']();});}},ut=class extends _0x1594fc{static get['pluginName'](){return'UploadcareImageEdit';}static get requires(){return[ct,lt];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{Y as Uploadcare,z as UploadcareCommand,Z as UploadcareEditing,ut as UploadcareImageEdit,at as UploadcareImageEditCommand,ct as UploadcareImageEditEditing,lt as UploadcareImageEditUI,V as UploadcareUI,J as UploadcareUploadAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-uploadcare",
3
- "version": "48.5.0-alpha.1",
3
+ "version": "48.5.0-alpha.3",
4
4
  "description": "Uploadcare feature for CKEditor 5.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -38,13 +38,13 @@
38
38
  "dist/translations/*.umd.js"
39
39
  ],
40
40
  "dependencies": {
41
- "@ckeditor/ckeditor5-core": "48.5.0-alpha.1",
42
- "@ckeditor/ckeditor5-engine": "48.5.0-alpha.1",
43
- "@ckeditor/ckeditor5-icons": "48.5.0-alpha.1",
44
- "@ckeditor/ckeditor5-image": "48.5.0-alpha.1",
45
- "@ckeditor/ckeditor5-ui": "48.5.0-alpha.1",
46
- "@ckeditor/ckeditor5-upload": "48.5.0-alpha.1",
47
- "@ckeditor/ckeditor5-utils": "48.5.0-alpha.1",
41
+ "@ckeditor/ckeditor5-core": "48.5.0-alpha.3",
42
+ "@ckeditor/ckeditor5-engine": "48.5.0-alpha.3",
43
+ "@ckeditor/ckeditor5-icons": "48.5.0-alpha.3",
44
+ "@ckeditor/ckeditor5-image": "48.5.0-alpha.3",
45
+ "@ckeditor/ckeditor5-ui": "48.5.0-alpha.3",
46
+ "@ckeditor/ckeditor5-upload": "48.5.0-alpha.3",
47
+ "@ckeditor/ckeditor5-utils": "48.5.0-alpha.3",
48
48
  "@uploadcare/file-uploader": "1.29.0",
49
49
  "@uploadcare/upload-client": "6.14.3"
50
50
  },