diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/js/dist/media-utils.min.js --- a/wp/wp-includes/js/dist/media-utils.min.js Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/js/dist/media-utils.min.js Wed Sep 21 18:19:35 2022 +0200 @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -this.wp=this.wp||{},this.wp.mediaUtils=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=460)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},12:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},14:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(38);var i=n(29),o=n(39);function a(e,t){return Object(r.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}}(e,t)||Object(i.a)(e,t)||Object(o.a)()}},16:function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return r}))},18:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(26);var i=n(35),o=n(29);function a(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||Object(i.a)(e)||Object(o.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},19:function(e,t,n){"use strict";function r(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na)){e.next=23;break}return S({code:"SIZE_ABOVE_LIMIT",message:Object(f.__)("This file exceeds the maximum upload size for this site."),file:P}),e.abrupt("continue",29);case 23:if(!(P.size<=0)){e.next=26;break}return S({code:"EMPTY_FILE",message:Object(f.__)("This file is empty."),file:P}),e.abrupt("continue",29);case 26:_.push(P),y.push({url:Object(E.createBlobURL)(P)}),p(y);case 29:e.next=12;break;case 31:e.next=36;break;case 33:e.prev=33,e.t0=e.catch(10),x.e(e.t0);case 36:return e.prev=36,x.f(),e.finish(36);case 39:M=0;case 40:if(!(M<_.length)){e.next=59;break}return F=_[M],e.prev=42,e.next=45,C(F,i);case 45:G=e.sent,U=k({},Object(u.omit)(G,["alt_text","source_url"]),{alt:G.alt_text,caption:Object(u.get)(G,["caption","raw"],""),title:G.title.raw,url:G.source_url}),h(M,U),e.next=56;break;case 50:e.prev=50,e.t1=e.catch(42),h(M,null),D=void 0,D=Object(u.has)(e.t1,["message"])?Object(u.get)(e.t1,["message"]):Object(f.sprintf)(Object(f.__)("Error while uploading file %s to the media library."),F.name),l({code:"GENERAL",message:D,file:F});case 56:++M,e.next=40;break;case 59:case"end":return e.stop()}}),e,null,[[10,33,36,39],[42,50]])})))).apply(this,arguments)}function C(e,t){var n=new window.FormData;return n.append("file",e,e.name||e.type.replace("/",".")),Object(u.forEach)(t,(function(e,t){return n.append(t,e)})),x()({path:"/wp/v2/media",body:n,method:"POST"})}},5:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))},50:function(e,t,n){"use strict";function r(e,t,n,r,i,o,a){try{var c=e[o](a),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function c(e){r(a,i,o,c,l,"next",e)}function l(e){r(a,i,o,c,l,"throw",e)}c(void 0)}))}}n.d(t,"a",(function(){return i}))}}); \ No newline at end of file +this.wp=this.wp||{},this.wp.mediaUtils=function(e){var t={};function i(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s="Lb+8")}({GRId:function(e,t){e.exports=window.wp.element},"Lb+8":function(e,t,i){"use strict";i.r(t),i.d(t,"MediaUpload",(function(){return h})),i.d(t,"uploadMedia",(function(){return b}));var o=i("YLtl"),r=i("GRId"),l=i("l3Sj");const{wp:a}=window,s=[],n=()=>a.media.view.MediaFrame.Select.extend({featuredImageToolbar(e){this.createSelectToolbar(e,{text:a.media.view.l10n.setFeaturedImage,state:this.options.state})},editState(){const e=this.state("featured-image").get("selection"),t=new a.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){this.on("toolbar:create:featured-image",this.featuredImageToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new a.media.controller.FeaturedImage,new a.media.controller.EditImage({model:this.options.editImage})])}}),d=()=>a.media.view.MediaFrame.Post.extend({galleryToolbar(){const e=this.state().get("editing");this.toolbar.set(new a.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:e?a.media.view.l10n.updateGallery:a.media.view.l10n.insertGallery,priority:80,requires:{library:!0},click(){const e=this.controller,t=e.state();e.close(),t.trigger("update",t.get("library")),e.setState(e.options.state),e.reset()}}}}))},editState(){const e=this.state("gallery").get("selection"),t=new a.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){this.on("toolbar:create:main-gallery",this.galleryToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new a.media.controller.Library({id:"gallery",title:a.media.view.l10n.createGalleryTitle,priority:40,toolbar:"main-gallery",filterable:"uploaded",multiple:"add",editable:!1,library:a.media.query(Object(o.defaults)({type:"image"},this.options.library))}),new a.media.controller.EditImage({model:this.options.editImage}),new a.media.controller.GalleryEdit({library:this.options.selection,editing:this.options.editing,menu:"gallery",displaySettings:!1,multiple:!0}),new a.media.controller.GalleryAdd])}}),p=e=>Object(o.pick)(e,["sizes","mime","type","subtype","id","url","alt","link","caption"]),c=e=>a.media.query({order:"ASC",orderby:"post__in",post__in:e,posts_per_page:-1,query:!0,type:"image"});class m extends r.Component{constructor({allowedTypes:e,gallery:t=!1,unstableFeaturedImageFlow:i=!1,modalClass:o,multiple:r=!1,title:s=Object(l.__)("Select or Upload Media")}){if(super(...arguments),this.openModal=this.openModal.bind(this),this.onOpen=this.onOpen.bind(this),this.onSelect=this.onSelect.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onClose=this.onClose.bind(this),t)this.buildAndSetGalleryFrame();else{const t={title:s,multiple:r};e&&(t.library={type:e}),this.frame=a.media(t)}o&&this.frame.$el.addClass(o),i&&this.buildAndSetFeatureImageFrame(),this.initializeListeners()}initializeListeners(){this.frame.on("select",this.onSelect),this.frame.on("update",this.onUpdate),this.frame.on("open",this.onOpen),this.frame.on("close",this.onClose)}buildAndSetGalleryFrame(){const{addToGallery:e=!1,allowedTypes:t,multiple:i=!1,value:o=s}=this.props;if(o===this.lastGalleryValue)return;let r;this.lastGalleryValue=o,this.frame&&this.frame.remove(),r=e?"gallery-library":o&&o.length?"gallery-edit":"gallery",this.GalleryDetailsMediaFrame||(this.GalleryDetailsMediaFrame=d());const l=c(o),n=new a.media.model.Selection(l.models,{props:l.props.toJSON(),multiple:i});this.frame=new this.GalleryDetailsMediaFrame({mimeType:t,state:r,multiple:i,selection:n,editing:!(!o||!o.length)}),a.media.frame=this.frame,this.initializeListeners()}buildAndSetFeatureImageFrame(){const e=n(),t=c(this.props.value),i=new a.media.model.Selection(t.models,{props:t.props.toJSON()});this.frame=new e({mimeType:this.props.allowedTypes,state:"featured-image",multiple:this.props.multiple,selection:i,editing:!!this.props.value}),a.media.frame=this.frame}componentWillUnmount(){this.frame.remove()}onUpdate(e){const{onSelect:t,multiple:i=!1}=this.props,o=this.frame.state(),r=e||o.get("selection");r&&r.models.length&&t(i?r.models.map(e=>p(e.toJSON())):p(r.models[0].toJSON()))}onSelect(){const{onSelect:e,multiple:t=!1}=this.props,i=this.frame.state().get("selection").toJSON();e(t?i:i[0])}onOpen(){var e;this.updateCollection();if(Array.isArray(this.props.value)?!(null===(e=this.props.value)||void 0===e||!e.length):!!this.props.value){if(!this.props.gallery){const e=this.frame.state().get("selection");Object(o.castArray)(this.props.value).forEach(t=>{e.add(a.media.attachment(t))})}c(Object(o.castArray)(this.props.value)).more()}}onClose(){const{onClose:e}=this.props;e&&e()}updateCollection(){const e=this.frame.content.get();if(e&&e.collection){const t=e.collection;t.toArray().forEach(e=>e.trigger("destroy",e)),t.mirroring._hasMore=!0,t.more()}}openModal(){this.props.gallery&&this.buildAndSetGalleryFrame(),this.frame.open()}render(){return this.props.render({open:this.openModal})}}var h=m,u=i("ywyh"),y=i.n(u),f=i("xTGt");async function b({allowedTypes:e,additionalData:t={},filesList:i,maxUploadFileSize:a,onError:s=o.noop,onFileChange:n,wpAllowedMimeTypes:d=null}){const p=[...i],c=[],m=(e,t)=>{Object(f.revokeBlobURL)(Object(o.get)(c,[e,"url"])),c[e]=t,n(Object(o.compact)(c))},h=t=>!e||Object(o.some)(e,e=>Object(o.includes)(e,"/")?e===t:Object(o.startsWith)(t,e+"/")),u=(y=d)?Object(o.flatMap)(y,(e,t)=>{const[i]=e.split("/"),r=t.split("|");return[e,...Object(o.map)(r,e=>`${i}/${e}`)]}):y;var y;const b=e=>{e.message=[Object(r.createElement)("strong",{key:"filename"},e.file.name),": ",e.message],s(e)},w=[];for(const e of p)u&&e.type&&(O=e.type,!Object(o.includes)(u,O))?b({code:"MIME_TYPE_NOT_ALLOWED_FOR_USER",message:Object(l.__)("Sorry, this file type is not permitted for security reasons."),file:e}):!e.type||h(e.type)?a&&e.size>a?b({code:"SIZE_ABOVE_LIMIT",message:Object(l.__)("This file exceeds the maximum upload size for this site."),file:e}):e.size<=0?b({code:"EMPTY_FILE",message:Object(l.__)("This file is empty."),file:e}):(w.push(e),c.push({url:Object(f.createBlobURL)(e)}),n(c)):b({code:"MIME_TYPE_NOT_SUPPORTED",message:Object(l.__)("Sorry, this file type is not supported here."),file:e});var O;for(let e=0;ei.append(t,e)),y()({path:"/wp/v2/media",body:i,method:"POST"})}},YLtl:function(e,t){e.exports=window.lodash},l3Sj:function(e,t){e.exports=window.wp.i18n},xTGt:function(e,t){e.exports=window.wp.blob},ywyh:function(e,t){e.exports=window.wp.apiFetch}}); \ No newline at end of file