WordPress/wp-includes/js/dist/annotations.min.js
gziolo 6e4458c935 Build: Use hashed/deterministic moduleIDs in webpack config
Props peterwilsoncc, desrosj.
Fixes #53192.


Built from https://develop.svn.wordpress.org/trunk@50940


git-svn-id: http://core.svn.wordpress.org/trunk@50549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-20 12:20:04 +00:00

2 lines
8.3 KiB
JavaScript

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.annotations=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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="./node_modules/@wordpress/annotations/build-module/index.js")}({"./node_modules/@wordpress/annotations/build-module/index.js":function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return j}));var r={};n.r(r),n.d(r,"__experimentalGetAnnotationsForBlock",(function(){return g})),n.d(r,"__experimentalGetAllAnnotationsForBlock",(function(){return b})),n.d(r,"__experimentalGetAnnotationsForRichText",(function(){return x})),n.d(r,"__experimentalGetAnnotations",(function(){return A}));var o={};n.r(o),n.d(o,"__experimentalAddAnnotation",(function(){return y})),n.d(o,"__experimentalRemoveAnnotation",(function(){return w})),n.d(o,"__experimentalUpdateAnnotationRange",(function(){return N})),n.d(o,"__experimentalRemoveAnnotationsBySource",(function(){return T}));var a=n("@wordpress/rich-text"),i=n("@wordpress/i18n");const u="core/annotations";const s={name:"core/annotation",title:Object(i.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(e,{richTextIdentifier:t,blockClientId:n})=>({annotations:e(u).__experimentalGetAnnotationsForRichText(n,t)}),__experimentalCreatePrepareEditableTree:({annotations:e})=>(t,n)=>{if(0===e.length)return t;let r={formats:t,text:n};return r=function(e,t=[]){return t.forEach(t=>{let{start:n,end:r}=t;n>e.text.length&&(n=e.text.length),r>e.text.length&&(r=e.text.length);const o="annotation-text-"+t.source,i="annotation-text-"+t.id;e=Object(a.applyFormat)(e,{type:"core/annotation",attributes:{className:o,id:i}},n,r)}),e}(r,e),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:e=>({removeAnnotation:e(u).__experimentalRemoveAnnotation,updateAnnotationRange:e(u).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:e=>t=>{const n=function(e){const t={};return e.forEach((e,n)=>{(e=(e=e||[]).filter(e=>"core/annotation"===e.type)).forEach(e=>{let{id:r}=e.attributes;r=r.replace("annotation-text-",""),t.hasOwnProperty(r)||(t[r]={start:n}),t[r].end=n+1})}),t}(t),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=e;!function(e,t,{removeAnnotation:n,updateAnnotationRange:r}){e.forEach(e=>{const o=t[e.id];if(!o)return void n(e.id);const{start:a,end:i}=e;a===o.start&&i===o.end||r(e.id,o.start,o.end)})}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:l,...d}=s;Object(a.registerFormatType)(l,d);var c=n("@wordpress/hooks"),p=n("@wordpress/data");Object(c.addFilter)("editor.BlockListBlock","core/annotations",e=>Object(p.withSelect)((e,{clientId:t,className:n})=>({className:e(u).__experimentalGetAnnotationsForBlock(t).map(e=>"is-annotated-by-"+e.source).concat(n).filter(Boolean).join(" ")}))(e));var f=n("lodash");function m(e,t){const n=e.filter(t);return e.length===n.length?e:n}var v=function(e={},t){var n,r;switch(t.type){case"ANNOTATION_ADD":const o=t.blockClientId,a={id:t.id,blockClientId:o,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===a.selector&&(r=a.range,!(Object(f.isNumber)(r.start)&&Object(f.isNumber)(r.end)&&r.start<=r.end)))return e;const i=null!==(n=null==e?void 0:e[o])&&void 0!==n?n:[];return{...e,[o]:[...i,a]};case"ANNOTATION_REMOVE":return Object(f.mapValues)(e,e=>m(e,e=>e.id!==t.annotationId));case"ANNOTATION_UPDATE_RANGE":return Object(f.mapValues)(e,e=>{let n=!1;const r=e.map(e=>e.id===t.annotationId?(n=!0,{...e,range:{start:t.start,end:t.end}}):e);return n?r:e});case"ANNOTATION_REMOVE_SOURCE":return Object(f.mapValues)(e,e=>m(e,e=>e.source!==t.source))}return e},h=n("./node_modules/rememo/es/rememo.js");const _=[],g=Object(h.a)((e,t)=>{var n;return(null!==(n=null==e?void 0:e[t])&&void 0!==n?n:[]).filter(e=>"block"===e.selector)},(e,t)=>{var n;return[null!==(n=null==e?void 0:e[t])&&void 0!==n?n:_]});function b(e,t){var n;return null!==(n=null==e?void 0:e[t])&&void 0!==n?n:_}const x=Object(h.a)((e,t,n)=>{var r;return(null!==(r=null==e?void 0:e[t])&&void 0!==r?r:[]).filter(e=>"range"===e.selector&&n===e.richTextIdentifier).map(e=>{const{range:t,...n}=e;return{...t,...n}})},(e,t)=>{var n;return[null!==(n=null==e?void 0:e[t])&&void 0!==n?n:_]});function A(e){return Object(f.flatMap)(e,e=>e)}var O=n("./node_modules/uuid/dist/esm-browser/v4.js");function y({blockClientId:e,richTextIdentifier:t=null,range:n=null,selector:r="range",source:o="default",id:a=Object(O.a)()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:e,richTextIdentifier:t,source:o,selector:r};return"range"===r&&(i.range=n),i}function w(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function N(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function T(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}const j=Object(p.createReduxStore)(u,{reducer:v,selectors:r,actions:o});Object(p.register)(j)},"./node_modules/rememo/es/rememo.js":function(e,t,n){"use strict";var r,o;function a(e){return[e]}function i(){var e={clear:function(){e.head=null}};return e}function u(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r={},o="undefined"!=typeof WeakMap,t.a=function(e,t){var n,s;function l(){n=o?new WeakMap:i()}function d(){var n,r,o,a,i,l=arguments.length;for(a=new Array(l),o=0;o<l;o++)a[o]=arguments[o];for(i=t.apply(null,a),(n=s(i)).isUniqueByDependants||(n.lastDependants&&!u(i,n.lastDependants,0)&&n.clear(),n.lastDependants=i),r=n.head;r;){if(u(r.args,a,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,a)},a[0]=null,r.args=a,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=a),s=o?function(e){var t,o,a,u,s,l=n,d=!0;for(t=0;t<e.length;t++){if(o=e[t],!(s=o)||"object"!=typeof s){d=!1;break}l.has(o)?l=l.get(o):(a=new WeakMap,l.set(o,a),l=a)}return l.has(r)||((u=i()).isUniqueByDependants=d,l.set(r,u)),l.get(r)}:function(){return n},d.getDependants=t,d.clear=l,l(),d}},"./node_modules/uuid/dist/esm-browser/v4.js":function(e,t,n){"use strict";var r,o=new Uint8Array(16);function a(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var u=function(e){return"string"==typeof e&&i.test(e)},s=[],l=0;l<256;++l)s.push((l+256).toString(16).substr(1));var d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase();if(!u(n))throw TypeError("Stringified UUID is invalid");return n};t.a=function(e,t,n){var r=(e=e||{}).random||(e.rng||a)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return d(r)}},"@wordpress/data":function(e,t){e.exports=window.wp.data},"@wordpress/hooks":function(e,t){e.exports=window.wp.hooks},"@wordpress/i18n":function(e,t){e.exports=window.wp.i18n},"@wordpress/rich-text":function(e,t){e.exports=window.wp.richText},lodash:function(e,t){e.exports=window.lodash}});