@yoopta/embed 1.9.12-rc → 1.9.13-rc
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.
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getElementClassname as e,UI_HELPERS as t,cx as i,createYooptaPlugin as o,getElementByPath as n,generateId as s}from"@yoopta/editor";import{Transforms as r,Element as a}from"slate";import{jsx as d,jsxs as l}from"react/jsx-runtime";import*as h from"react";import{useState as c,useEffect as p,useRef as u,useMemo as g}from"react";import{flushSync as m}from"react-dom";import{ReactEditor as f,useSelected as v,useReadOnly as b}from"slate-react";function w(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(i[o[n]]=e[o[n]])}return i}function y(e,t,i,o){return new(i||(i=Promise))((function(n,s){function r(e){try{d(o.next(e))}catch(e){s(e)}}function a(e){try{d(o.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((o=o.apply(e,t||[])).next())}))}function x(e,{threshold:t=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[s,r]=c({}),a=s.isIntersecting&&n,d=([e])=>r(e);return p((()=>{const n=null==e?void 0:e.current;if(!window.IntersectionObserver||a||!n)return;const s=new IntersectionObserver(d,{threshold:t,root:i,rootMargin:o});return s.observe(n),()=>s.disconnect()}),[e,t,i,o,a]),s}function z(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var O={root:"ypSFFbjd",iframe:"DQszzmj7",container:"yc58m72J",iframePreview:"DYsS-Bbu",embed:"a1CpYHeG"};z(".ypSFFbjd{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.DQszzmj7{background-color:#fff}.DQszzmj7,.yc58m72J{border-radius:1px;height:100%;pointer-events:auto;width:100%}.DQszzmj7,.DYsS-Bbu,.yc58m72J{left:0;position:absolute;top:0}.DYsS-Bbu{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.a1CpYHeG{height:100%;position:relative;width:100%}");const S=e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`;var N={root:"C8Z8IWw5",iframe:"aGHn-pry",container:"-qZtVrzy",iframePreview:"kmC7RiaF",embed:"srCuArtd"};function j(e){var{providerId:t,url:i}=e;w(e,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:N.root,ref:o},{children:d("div",Object.assign({className:N.container},{children:d("div",Object.assign({className:N.embed},{children:n&&d("iframe",{src:i,frameBorder:0,allowFullScreen:!0,className:N.iframe,height:"450px"})}))}))}))}z(".C8Z8IWw5{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.aGHn-pry{background-color:#fff}.-qZtVrzy,.aGHn-pry{border-radius:1px;height:100%;pointer-events:auto;width:100%}.-qZtVrzy,.aGHn-pry,.kmC7RiaF{left:0;position:absolute;top:0}.kmC7RiaF{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.srCuArtd{height:100%;position:relative;width:100%}");var R={root:"w4l4tKlB",iframe:"cbJcegGv",container:"g8V-uGLl",iframePreview:"hZuYZ7vp",embed:"j6pRoOC1"};z(".w4l4tKlB{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.cbJcegGv{background-color:#fff}.cbJcegGv,.g8V-uGLl{border-radius:1px;height:100%;pointer-events:auto;width:100%}.cbJcegGv,.g8V-uGLl,.hZuYZ7vp{left:0;position:absolute;top:0}.hZuYZ7vp{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.j6pRoOC1{height:100%;position:relative;width:100%}");var E={root:"e3lQDjTT",iframe:"O5Z0OWN-",container:"zxjqcq4y",iframePreview:"_5kC3Lf5J",embed:"ymOgdXs4"};z(".e3lQDjTT{display:flex;height:100%;justify-content:center;min-height:100px;padding-bottom:86%;position:relative;width:100%}.O5Z0OWN-{background-color:#fff}.O5Z0OWN-,.zxjqcq4y{border-radius:1px;height:100%;left:0;pointer-events:auto;position:absolute;top:0;width:100%}._5kC3Lf5J{filter:blur(10px);left:0;object-fit:cover;position:absolute;top:0;transition:opacity .15s ease-in,filter .15s ease-in}.ymOgdXs4{position:relative;width:100%}.ymOgdXs4,.ymOgdXs4>div,.ymOgdXs4>div>div{height:100%}.ymOgdXs4 iframe{height:100%!important;width:100%!important}");var W={root:"sD5QN14F",iframe:"mRrF4hwM",container:"LyyH1fsE",iframePreview:"U9EPxemn",embed:"_4AQiBYad"};z(".sD5QN14F{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.mRrF4hwM{background-color:#fff}.LyyH1fsE,.mRrF4hwM{border-radius:1px;height:100%;pointer-events:auto;width:100%}.LyyH1fsE,.U9EPxemn,.mRrF4hwM{left:0;position:absolute;top:0}.U9EPxemn{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._4AQiBYad{height:100%;position:relative;width:100%}");const H="https://vimeo.com/api/v2/video";var L={root:"zoqyIXwI",iframe:"WgoSECbO",container:"m07CnIxO",iframePreview:"NSr-cxfm",embed:"Cv1rIJbN"};z(".zoqyIXwI{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.WgoSECbO{background-color:#fff}.WgoSECbO,.m07CnIxO{border-radius:1px;height:100%;pointer-events:auto;width:100%}.NSr-cxfm,.WgoSECbO,.m07CnIxO{left:0;position:absolute;top:0}.NSr-cxfm{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.Cv1rIJbN{height:100%;position:relative;width:100%}");var P="HUtGPcJq";z(".HUtGPcJq{margin:20px auto 10px;position:relative}");const C={vimeo:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(`${H}/${t}.json`).then((e=>e.json())).then((e=>s(e[0].thumbnail_medium))).catch((()=>s(null)))}),[t]),d("div",Object.assign({className:W.root,ref:o},{children:d("div",Object.assign({className:W.container},{children:l("div",Object.assign({className:W.embed},{children:[d("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:W.iframePreview,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&d("iframe",Object.assign({title:"Vimeo Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:W.iframe},i))]}))}))}))},youtube:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,s]=c(!1),{isIntersecting:r}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:L.root,ref:o},{children:d("div",Object.assign({className:L.container},{children:l("div",Object.assign({className:L.embed},{children:[d("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:L.iframePreview,style:{opacity:r&&n?0:1,zIndex:r&&n?-1:0}}),r&&d("iframe",Object.assign({title:"Youtube Player",src:`https://www.youtube.com/embed/${t}`,frameBorder:0,onLoad:()=>s(!0),allowFullScreen:!0,className:L.iframe},i))]}))}))}))},dailymotion:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(S(t)).then((e=>e.json())).then((e=>s(e.thumbnail_url))).catch((()=>s(null)))}),[t]),d("div",Object.assign({className:O.root,ref:o},{children:d("div",Object.assign({className:O.container},{children:l("div",Object.assign({className:O.embed},{children:[d("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:O.iframePreview,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&d("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:O.iframe},i))]}))}))}))},twitter:function({providerId:e}){const t=u(null),{isIntersecting:i}=x(t,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{var o;if(!i)return;const n=document.createElement("script");n.src="https://platform.twitter.com/widgets.js",null===(o=t.current)||void 0===o||o.appendChild(n),n.onload=()=>{window.twttr&&window.twttr.widgets.createTweet(e,document.getElementById(e),{align:"center",conversation:"none",dnt:!0,theme:"dark",height:300})}}),[e,i]),d("div",Object.assign({className:E.root,ref:t},{children:d("div",Object.assign({className:E.container},{children:d("div",Object.assign({className:E.embed},{children:d("div",{id:e})}))}))}))},figma:function(e){var{providerId:t,url:i}=e;w(e,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:R.root,ref:o},{children:d("div",Object.assign({className:R.container},{children:d("div",Object.assign({className:R.embed},{children:n&&d("iframe",{src:`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(i)}`,frameBorder:0,allowFullScreen:!0,className:R.iframe,height:"450px"})}))}))}))}};var k,M,B=(k=function(e,t){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},k(e,t)},function(e,t){function i(){this.constructor=e}k(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),I=function(){return I=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},I.apply(this,arguments)},_={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},A={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},V={width:"20px",height:"20px",position:"absolute"},T={top:I(I({},_),{top:"-5px"}),right:I(I({},A),{left:void 0,right:"-5px"}),bottom:I(I({},_),{top:void 0,bottom:"-5px"}),left:I(I({},A),{left:"-5px"}),topRight:I(I({},V),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:I(I({},V),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:I(I({},V),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:I(I({},V),{left:"-10px",top:"-10px",cursor:"nw-resize"})},F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return B(t,e),t.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:I(I({position:"absolute",userSelect:"none"},T[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(h.PureComponent),D=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){function o(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),G=function(){return G=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},G.apply(this,arguments)},U={width:"auto",height:"auto"},Y=function(e,t,i){return Math.max(Math.min(e,i),t)},Z=function(e,t){return Math.round(e/t)*t},q=function(e,t){return new RegExp(e,"i").test(t)},J=function(e){return Boolean(e.touches&&e.touches.length)},X=function(e,t,i){void 0===i&&(i=0);var o=t.reduce((function(i,o,n){return Math.abs(o-e)<Math.abs(t[i]-e)?n:i}),0),n=Math.abs(t[o]-e);return 0===i||n<i?t[o]:e},Q=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},$=function(e,t,i,o){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return i*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return o*(Number(e.replace("vh",""))/100)}return e},K=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],ee="__resizable_base__",te=function(e){function t(t){var i=e.call(this,t)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var e=i.parentNode;if(!e)return null;var t=i.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(ee):t.className+=ee,e.appendChild(t),t},i.removeBase=function(e){var t=i.parentNode;t&&t.removeChild(e)},i.ref=function(e){e&&(i.resizable=e)},i.state={isResizing:!1,width:void 0===(i.propsSize&&i.propsSize.width)?"auto":i.propsSize&&i.propsSize.width,height:void 0===(i.propsSize&&i.propsSize.height)?"auto":i.propsSize&&i.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return D(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||U},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,i=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&e.propsSize[t].toString().endsWith("%")){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var i=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/i[t]*100+"%"}return Q(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?Q(t.width):i("width"),height:t&&void 0!==t.height&&!this.state.isResizing?Q(t.height):i("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var o={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=i),this.removeBase(e),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var i=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==i&&"auto"!==i?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var i,o,n=this.props.boundsByDirection,s=this.state.direction,r=n&&q("left",s),a=n&&q("top",s);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=r?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=r?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=r?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),o=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(e=e&&e<i?e:i),o&&Number.isFinite(o)&&(t=t&&t<o?t:o),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,s=n.direction,r=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=r.width,p=r.height,u=l||0,g=h||0;return q("right",s)&&(c=r.width+(e-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),q("left",s)&&(c=r.width-(e-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),q("bottom",s)&&(p=r.height+(t-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),q("top",s)&&(p=r.height-(t-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,i,o){var n=this.props,s=n.lockAspectRatio,r=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?e:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?t:i.height,p=r||0,u=a||0;if(s){var g=(h-p)*this.ratio+u,m=(c-p)*this.ratio+u,f=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,m),y=Math.max(h,f),x=Math.min(c,v);e=Y(e,b,w),t=Y(t,y,x)}else e=Y(e,d,l),t=Y(t,h,c);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var o=this.resizable.getBoundingClientRect(),n=o.left,s=o.top,r=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=r,this.resizableTop=s,this.resizableBottom=a}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var i,o=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(o=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&J(e.nativeEvent)&&(o=e.nativeEvent.touches[0].clientX,n=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var s=this.window.getComputedStyle(this.resizable);if("auto"!==s.flexBasis){var r=this.parentNode;if(r){var a=this.window.getComputedStyle(r).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=s.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:G(G({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:i};this.setState(d)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&J(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var i=this.props,o=i.maxWidth,n=i.maxHeight,s=i.minWidth,r=i.minHeight,a=J(e)?e.touches[0].clientX:e.clientX,d=J(e)?e.touches[0].clientY:e.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,g=this.getParentSize(),f=function(e,t,i,o,n,s,r){return o=$(o,e.width,t,i),n=$(n,e.height,t,i),s=$(s,e.width,t,i),r=$(r,e.height,t,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===s?void 0:Number(s),minHeight:void 0===r?void 0:Number(r)}}(g,this.window.innerWidth,this.window.innerHeight,o,n,s,r);o=f.maxWidth,n=f.maxHeight,s=f.minWidth,r=f.minHeight;var v=this.calculateNewSizeFromDirection(a,d),b=v.newHeight,w=v.newWidth,y=this.calculateNewMaxFromBoundary(o,n);this.props.snap&&this.props.snap.x&&(w=X(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=X(b,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(w,b,{width:y.maxWidth,height:y.maxHeight},{width:s,height:r});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=Z(w,this.props.grid[0]),O=Z(b,this.props.grid[1]),S=this.props.snapGap||0;w=0===S||Math.abs(z-w)<=S?z:w,b=0===S||Math.abs(O-b)<=S?O:b}var N={width:w-c.width,height:b-c.height};if(p&&"string"==typeof p)if(p.endsWith("%"))w=w/g.width*100+"%";else if(p.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(u&&"string"==typeof u)if(u.endsWith("%"))b=b/g.height*100+"%";else if(u.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}var j={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?j.flexBasis=j.width:"column"===this.flexDir&&(j.flexBasis=j.height),m((function(){t.setState(j)})),this.props.onResize&&this.props.onResize(e,h,this.resizable,N)}},t.prototype.onMouseUp=function(e){var t=this.state,i=t.isResizing,o=t.direction,n=t.original;if(i&&this.resizable){var s={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,o,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:G(G({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,i=t.enable,o=t.handleStyles,n=t.handleClasses,s=t.handleWrapperStyle,r=t.handleWrapperClass,a=t.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(t){return!1!==i[t]?h.createElement(F,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:o&&o[t],className:n&&n[t]},a&&a[t]?a[t]:null):null}));return h.createElement("div",{className:r,style:s},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,i){return-1!==K.indexOf(i)||(t[i]=e.props[i]),t}),{}),i=G(G(G({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return h.createElement(o,G({ref:this.ref,style:i,className:this.props.className},t),this.state.isResizing&&h.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(h.PureComponent);function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},ie.apply(this,arguments)}var oe=function(e){return h.createElement("svg",ie({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},e),M||(M=h.createElement("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"})))},ne="_5ZnGUwAU",se="wlwFaZpx",re="Obm15-qh",ae="gJ5-oVLV",de="_6jUel99o",le="HZgHUcV-",he="GF1PbH1g gU1gU-Wq",ce="i7UwLauz",pe="cJSOiHYH";z('._5ZnGUwAU{position:fixed}.wlwFaZpx{background:#fff;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:100%;max-height:420px;max-width:calc(100vw - 24px);min-width:540px}.Obm15-qh{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.Obm15-qh,.gJ5-oVLV{font-size:14px;position:relative}.gJ5-oVLV{align-items:center;background-color:inherit;border:none;border-radius:4px;color:#37352f;cursor:pointer;display:inline-flex;flex-shrink:0;height:100%;line-height:1.2;min-width:0;padding:6px 8px;transition:height 20ms ease-in 0s;user-select:none;white-space:nowrap}._6jUel99o:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.HZgHUcV-{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.gU1gU-Wq{border:1px solid rgba(55,53,47,.16);border-radius:4px;cursor:pointer;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap;width:100%}.GF1PbH1g{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.i2lz5EKx{align-items:center;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2;width:100%}._3cPFLttW{left:0;position:absolute;top:0;visibility:hidden}.i7UwLauz{background:hsla(45,13%,94%,.6);box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1);cursor:text;height:32px;line-height:20px;padding:3px 6px;position:relative}.cJSOiHYH,.i7UwLauz{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.cJSOiHYH{fill:#fff;background:#2383e2;box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1),0 1px 2px hsla(0,0%,6%,.1);color:#fff;cursor:pointer;flex-shrink:0;font-weight:500;height:28px;justify-content:center;line-height:1.2;margin:12px auto 6px;max-width:300px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}');const ue=({onEmbed:e})=>{const[t,i]=c("");return l("div",Object.assign({className:he},{children:[d("input",{type:"text",placeholder:"Paste embed link",value:t,className:ce,onChange:e=>i(e.target.value)}),d("button",Object.assign({type:"button",className:pe,onClick:()=>e(t)},{children:"Embed"}))]}))},ge=({style:e,onEmbed:o,onClose:n})=>l(t.Overlay,Object.assign({onClose:n},{children:[d("div",Object.assign({className:ne,style:e},{children:l("div",Object.assign({className:se},{children:[d("div",Object.assign({className:re},{children:d("button",Object.assign({type:"button",className:i(ae,{[de]:!0})},{children:"Embed link"}))})),d("div",Object.assign({className:le},{children:d(ue,{onEmbed:o})}))]}))})),d("div",{})]}));var me=!1;if("undefined"!=typeof window){var fe={get passive(){me=!0}};window.addEventListener("testPassive",null,fe),window.removeEventListener("testPassive",null,fe)}var ve="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),be=[],we=!1,ye=-1,xe=void 0,ze=void 0,Oe=void 0,Se=function(e){return be.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ne=function(e){var t=e||window.event;return!!Se(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},je=function(e,t){if(e){if(!be.some((function(t){return t.targetElement===e}))){var i={targetElement:e,options:t||{}};be=[].concat(function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}(be),[i]),ve?window.requestAnimationFrame((function(){if(void 0===ze){ze={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,i=e.scrollX,o=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var e=o-window.innerHeight;e&&t>=o&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===Oe){var t=!!e&&!0===e.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(t&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);Oe=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===xe&&(xe=document.body.style.overflow,document.body.style.overflow="hidden")}(t),ve&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(ye=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var i=e.targetTouches[0].clientY-ye;!Se(e.target)&&(t&&0===t.scrollTop&&i>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&i<0?Ne(e):e.stopPropagation())}(t,e)},we||(document.addEventListener("touchmove",Ne,me?{passive:!1}:void 0),we=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},Re=function(e){e?(be=be.filter((function(t){return t.targetElement!==e})),ve&&(e.ontouchstart=null,e.ontouchmove=null,we&&0===be.length&&(document.removeEventListener("touchmove",Ne,me?{passive:!1}:void 0),we=!1)),ve?function(){if(void 0!==ze){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=ze.position,document.body.style.top=ze.top,document.body.style.left=ze.left,window.scrollTo(t,e),ze=void 0}}():(void 0!==Oe&&(document.body.style.paddingRight=Oe,Oe=void 0),void 0!==xe&&(document.body.style.overflow=xe,xe=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},Ee="PoOhS4FU",We="PcGiiPpV",He="iQZH4Lf-";z(".PoOhS4FU{margin:20px 0 10px;user-select:none}.PcGiiPpV,.PoOhS4FU{position:relative;width:100%}.PcGiiPpV{align-items:center;background-color:#efefef;border:none;border-radius:3px;color:rgba(55,53,47,.65);cursor:pointer;display:flex;font-size:14px;overflow:hidden;padding:12px 36px 12px 12px;text-align:left;transition:background-color .1s ease-in}.PcGiiPpV:hover{background-color:#e3e3e3}.iQZH4Lf-{margin-right:8px;user-select:none}");const Le=({element:e,attributes:t,maxSizes:i,children:o,editor:n})=>{const[s,h]=c(null),p=u(null),g=e=>{var t;if(e.stopPropagation(),null!==s)return Re(document.body),void h(null);const i=null===(t=p.current)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+88+20>window.innerHeight,t=!e;console.log({showAtTop:e,showAtBottom:t}),je(document.body,{reserveScrollBarGap:!0}),h({left:i.left,top:e?i.top-88-5:i.top+i.height+5})}};return l("div",Object.assign({className:Ee},t,{contentEditable:!1},{children:[l("div",Object.assign({ref:p},{children:[l("button",Object.assign({className:We,onClick:g},{children:[d(oe,{className:He,width:24,height:24}),d("span",{children:"Click to add embed"})]})),null!==s&&d(ge,{onEmbed:t=>y(void 0,void 0,void 0,(function*(){if(0===t.length)return;const i=(o=t).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":o.includes("twitter")?"twitter":o.includes("figma")?"figma":null;var o;let s=null;"youtube"===i?s=(e=>{const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null})(t):"vimeo"===i?s=(e=>new URL(e).pathname.split("/")[1])(t):"dailymotion"===i?s=(e=>{var t=e.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==t?void 0!==t[4]?t[4]:t[2]:null})(t):"twitter"===i?s=function(e){const t=e.match(/\/status\/(\d+)/);return t?t[1]:null}(t):"figma"===i&&(s=function(e){const t=new URL(e).searchParams,i=t.get("node-id");return t.get("node-id")?i:"unknown"}(t)),console.log({provider:i,providerId:s});try{Re(document.body),h(null);const o={data:Object.assign(Object.assign({},e.data),{url:t,size:{width:e.data.size.width,height:e.data.size.height},provider:i,providerId:s})};r.setNodes(n,o,{at:f.findPath(n,e),match:e=>a.isElement(e)&&"embed"===e.type})}catch(e){Re(document.body),h(null)}})),onClose:g,style:s})]})),o]}))};var Pe={root:"s8SlWwrL",resizer:"OLRmQVp3",dotsOptions:"_5qhGnBQW",loadingState:"_0z3X-ysz",extraMargin:"_9GorNz7R",resizeLib:"_6GzVi0JR",leftResizer:"HLz36qUX OLRmQVp3",rightResizer:"Tv1Fs118 OLRmQVp3",resizeItem:"_33V0MBSa",selectImg:"VdsHNo29",selected:"WARAR91D",loader:"_8VNstZwX",dot:"_92ciCRYx"};z(".s8SlWwrL{cursor:pointer;display:block;position:relative}.s8SlWwrL:hover .OLRmQVp3,.s8SlWwrL:hover ._5qhGnBQW{opacity:1}._0z3X-ysz{pointer-events:none}._9GorNz7R{margin:20px 0 30px}._6GzVi0JR{margin:0 auto}.OLRmQVp3{align-items:center;cursor:col-resize;display:flex;height:100%;justify-content:center;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;width:15px;z-index:1}.HLz36qUX{left:0;top:0}.Tv1Fs118{right:0;top:0}._33V0MBSa{background:hsla(0,0%,6%,.6);border:1px solid hsla(0,0%,100%,.9);border-radius:20px;box-shadow:0 0 0 .5px #fff;height:48px;max-height:50%;opacity:1;transition:opacity .3s ease-in 0s;width:6px}.VdsHNo29{opacity:0}.WARAR91D{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;z-index:81}._8VNstZwX{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._5qhGnBQW{align-items:center;background-color:#eee;border:none;border-radius:2px;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:0;padding:0 4px;position:absolute;right:10px;top:10px;transition:opacity .15s ease-in 0s;width:22px;z-index:1}._92ciCRYx{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");const Ce=265;function ke(e){var o,n,s,h,u;const{element:m,editor:w,plugin:y}=e,x=v(),z=b(),[O,S]=c(null),[N,j]=c({width:(null===(n=null===(o=m.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||750,height:(null===(h=null===(s=m.data)||void 0===s?void 0:s.size)||void 0===h?void 0:h.height)||440});console.log("element",m.data.size);const R=e=>j(Object.assign(Object.assign({},N),e));p((()=>{var e,t,i,o;m.data&&R({width:(null===(t=null===(e=m.data)||void 0===e?void 0:e.size)||void 0===t?void 0:t.width)||750,height:(null===(o=null===(i=m.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||440})}),[null===(u=m.data)||void 0===u?void 0:u.size]);const E=g((()=>{var e,t;return{minWidth:300,size:{width:N.width,height:N.height},maxWidth:(null===(e=y.options)||void 0===e?void 0:e.maxWidth)||800,maxHeight:(null===(t=y.options)||void 0===t?void 0:t.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!z,right:!z},handleStyles:{left:{left:0},right:{right:0}},onResize:(e,t,i)=>{R({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(e,t,i)=>{console.log("image editor editor.children",w.children),console.log("ReactEditor.findPath(editor, element)",f.findPath(w,m)),console.log("element",m),r.setNodes(w,{data:Object.assign(Object.assign({},m.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:f.findPath(w,m),match:e=>a.isElement(e)&&"embed"===e.type})},handleComponent:{left:d("div",Object.assign({contentEditable:!1,className:Pe.leftResizer},{children:d("div",{className:Pe.resizeItem})})),right:d("div",Object.assign({contentEditable:!1,className:Pe.rightResizer},{children:d("div",{className:Pe.resizeItem})}))}}}),[N.width,N.height,w]),W=()=>{Re(document.body),S(null)},H=e=>{var t;if(null==e||e.stopPropagation(),null!==O)return W();const i=null===(t=null==e?void 0:e.currentTarget)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+164+20>window.innerHeight;je(document.body,{reserveScrollBarGap:!0}),S({left:i.right-i.width+Ce>window.innerWidth?window.innerWidth-Ce-i.width:i.right-i.width,top:e?i.top-82-i.height:i.top+i.height+5})}};if(!m.data.url&&!m.data["data-src"]){const{maxWidth:o=750,maxHeight:n=800}=y.options||{};return l("div",Object.assign({className:Pe.root,contentEditable:!1,draggable:!1},{children:[d("div",{className:i(Pe.selectImg,{[Pe.selected]:x})}),d(Le,Object.assign({attributes:e.attributes,element:m,editor:w,maxSizes:{maxWidth:o,maxHeight:n}},{children:!z&&l("div",{children:[l("button",Object.assign({type:"button",className:Pe.dotsOptions,onClick:H},{children:[d("span",{className:Pe.dot}),d("span",{className:Pe.dot}),d("span",{className:Pe.dot})]})),null!==O&&d(t.ElementOptions,{onClose:W,style:O,element:m,onCopy:W,onDelete:W,onDuplicate:W},m.id)]})})),e.children]}),m.id)}return d("div",Object.assign({contentEditable:!1,draggable:!1,className:Pe.root},{children:l(te,Object.assign({},E,{className:Pe.resizeLib},{children:[y.renderer.render(Object.assign(Object.assign({},e),{size:N,isEdit:!0})),d("div",{className:i(Pe.selectImg,{[Pe.selected]:x})}),!z&&l("div",{children:[l("button",Object.assign({type:"button",className:Pe.dotsOptions,onClick:H},{children:[d("span",{className:Pe.dot}),d("span",{className:Pe.dot}),d("span",{className:Pe.dot})]})),null!==O&&d(t.ElementOptions,{onClose:W,style:O,element:m,onCopy:W,onDelete:W,onDuplicate:W},m.id)]})]}))}),m.id)}const Me=o({type:"embed",shortcut:"embed",renderer:{editor:(e,t)=>i=>d(ke,Object.assign({editor:e,plugin:t},i)),render:({attributes:t,element:i,children:o,HTMLAttributes:n,isEdit:s=!1})=>{if(console.log("element RENDER",i.data.size),console.log("is","string"==typeof i.data.provider&&i.data.providerId&&!!C[i.data.provider]),"string"==typeof i.data.provider&&i.data.providerId&&C[i.data.provider]){const r=C[i.data.provider];return l("div",Object.assign({},t,{contentEditable:!1,draggable:!1},n,{style:s?void 0:i.data.size,className:e({element:i,HTMLAttributes:n,className:P})},{children:[d(r,Object.assign({},i.data,{providerId:i.data.providerId})),o]}))}return i.data.url?l("div",Object.assign({},t,{contentEditable:!1,draggable:!1},n,{className:e({element:i,HTMLAttributes:n,className:P}),style:s?void 0:i.data.size},{children:[d(j,Object.assign({},i.data,{providerId:i.data.providerId})),o]})):d("div",{})}},extendEditor(e){const{isVoid:t}=e;return e.isVoid=e=>e.type===Me.getPlugin.type||t(e),e},events:{onKeyDown:(e,{defaultNode:t,hotkeys:i})=>o=>{var s;if("embed"===n(e,null===(s=e.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&e.selection)return i.isEnter(o)?(o.preventDefault(),void r.insertNodes(e,t,{mode:"highest"})):void 0}},defineElement:()=>({id:s(),type:"embed",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"},providerId:null},children:[{text:""}]}),createElement:(e,t)=>{var i;const o=Object.assign(Object.assign({},Me.getPlugin.defineElement()),t);r.setNodes(e,o,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`[embed-url](${e.data.url})\n`},html:{serialize:(e,t)=>{var i,o;return`<iframe src="https://player.vimeo.com/video/807053663?badge=0&byline=0&portrait=0&title=0" frameborder="0" height="${null===(i=e.data.size)||void 0===i?void 0:i.height}" width="${null===(o=e.data.size)||void 0===o?void 0:o.width}" allowfullscreen="" url="https://vimeo.com/807053663" provider="${e.data.provider||""}" />`},deserialize:{nodeName:"IFRAME",parse:e=>({url:e.getAttribute("src"),size:{height:"string"==typeof e.getAttribute("height")?Number(e.getAttribute("height")):"auto",width:"string"==typeof e.getAttribute("width")?Number(e.getAttribute("width")):"auto"}})}}},options:{searchString:"Embed media",displayLabel:"Embed"}});export{Me as default};
|
|
1
|
+
import{getElementClassname as e,UI_HELPERS as t,cx as i,createYooptaPlugin as o,getElementByPath as n,generateId as s}from"@yoopta/editor";import{Transforms as r,Element as a}from"slate";import{jsx as d,jsxs as l}from"react/jsx-runtime";import*as h from"react";import{useState as c,useEffect as p,useRef as u,useMemo as g}from"react";import{flushSync as m}from"react-dom";import{ReactEditor as f,useSelected as v,useReadOnly as b}from"slate-react";function w(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(i[o[n]]=e[o[n]])}return i}function y(e,t,i,o){return new(i||(i=Promise))((function(n,s){function r(e){try{d(o.next(e))}catch(e){s(e)}}function a(e){try{d(o.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((o=o.apply(e,t||[])).next())}))}function x(e,{threshold:t=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[s,r]=c({}),a=s.isIntersecting&&n,d=([e])=>r(e);return p((()=>{const n=null==e?void 0:e.current;if(!window.IntersectionObserver||a||!n)return;const s=new IntersectionObserver(d,{threshold:t,root:i,rootMargin:o});return s.observe(n),()=>s.disconnect()}),[e,t,i,o,a]),s}function z(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var O={root:"ypSFFbjd",iframe:"DQszzmj7",container:"yc58m72J",iframePreview:"DYsS-Bbu",embed:"a1CpYHeG"};z(".ypSFFbjd{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.DQszzmj7{background-color:#fff}.DQszzmj7,.yc58m72J{border-radius:1px;height:100%;pointer-events:auto;width:100%}.DQszzmj7,.DYsS-Bbu,.yc58m72J{left:0;position:absolute;top:0}.DYsS-Bbu{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.a1CpYHeG{height:100%;position:relative;width:100%}");const S=e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`;var N={root:"C8Z8IWw5",iframe:"aGHn-pry",container:"-qZtVrzy",iframePreview:"kmC7RiaF",embed:"srCuArtd"};function j(e){var{providerId:t,url:i}=e;w(e,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:N.root,ref:o},{children:d("div",Object.assign({className:N.container},{children:d("div",Object.assign({className:N.embed},{children:n&&d("iframe",{src:i,frameBorder:0,allowFullScreen:!0,className:N.iframe,height:"450px"})}))}))}))}z(".C8Z8IWw5{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.aGHn-pry{background-color:#fff}.-qZtVrzy,.aGHn-pry{border-radius:1px;height:100%;pointer-events:auto;width:100%}.-qZtVrzy,.aGHn-pry,.kmC7RiaF{left:0;position:absolute;top:0}.kmC7RiaF{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.srCuArtd{height:100%;position:relative;width:100%}");var R={root:"w4l4tKlB",iframe:"cbJcegGv",container:"g8V-uGLl",iframePreview:"hZuYZ7vp",embed:"j6pRoOC1"};z(".w4l4tKlB{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.cbJcegGv{background-color:#fff}.cbJcegGv,.g8V-uGLl{border-radius:1px;height:100%;pointer-events:auto;width:100%}.cbJcegGv,.g8V-uGLl,.hZuYZ7vp{left:0;position:absolute;top:0}.hZuYZ7vp{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.j6pRoOC1{height:100%;position:relative;width:100%}");var E={root:"e3lQDjTT",iframe:"O5Z0OWN-",container:"zxjqcq4y",iframePreview:"_5kC3Lf5J",embed:"ymOgdXs4"};z(".e3lQDjTT{display:flex;justify-content:center;min-height:100px;position:relative;width:100%}.O5Z0OWN-{background-color:#fff;position:absolute}.O5Z0OWN-,.zxjqcq4y{border-radius:1px;height:auto;left:0;pointer-events:auto;top:0;width:100%}._5kC3Lf5J{filter:blur(10px);left:0;object-fit:cover;top:0;transition:opacity .15s ease-in,filter .15s ease-in}.ymOgdXs4{position:relative;width:100%}.ymOgdXs4,.ymOgdXs4>div,.ymOgdXs4>div>div{height:auto}");var W={root:"sD5QN14F",iframe:"mRrF4hwM",container:"LyyH1fsE",iframePreview:"U9EPxemn",embed:"_4AQiBYad"};z(".sD5QN14F{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.mRrF4hwM{background-color:#fff}.LyyH1fsE,.mRrF4hwM{border-radius:1px;height:100%;pointer-events:auto;width:100%}.LyyH1fsE,.U9EPxemn,.mRrF4hwM{left:0;position:absolute;top:0}.U9EPxemn{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._4AQiBYad{height:100%;position:relative;width:100%}");const H="https://vimeo.com/api/v2/video";var L={root:"zoqyIXwI",iframe:"WgoSECbO",container:"m07CnIxO",iframePreview:"NSr-cxfm",embed:"Cv1rIJbN"};z(".zoqyIXwI{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.WgoSECbO{background-color:#fff}.WgoSECbO,.m07CnIxO{border-radius:1px;height:100%;pointer-events:auto;width:100%}.NSr-cxfm,.WgoSECbO,.m07CnIxO{left:0;position:absolute;top:0}.NSr-cxfm{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.Cv1rIJbN{height:100%;position:relative;width:100%}");var P="HUtGPcJq";z(".HUtGPcJq{margin:20px auto 10px;position:relative}");const C={vimeo:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(`${H}/${t}.json`).then((e=>e.json())).then((e=>s(e[0].thumbnail_medium))).catch((()=>s(null)))}),[t]),d("div",Object.assign({className:W.root,ref:o},{children:d("div",Object.assign({className:W.container},{children:l("div",Object.assign({className:W.embed},{children:[d("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:W.iframePreview,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&d("iframe",Object.assign({title:"Vimeo Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:W.iframe},i))]}))}))}))},youtube:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,s]=c(!1),{isIntersecting:r}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:L.root,ref:o},{children:d("div",Object.assign({className:L.container},{children:l("div",Object.assign({className:L.embed},{children:[d("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:L.iframePreview,style:{opacity:r&&n?0:1,zIndex:r&&n?-1:0}}),r&&d("iframe",Object.assign({title:"Youtube Player",src:`https://www.youtube.com/embed/${t}`,frameBorder:0,onLoad:()=>s(!0),allowFullScreen:!0,className:L.iframe},i))]}))}))}))},dailymotion:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(S(t)).then((e=>e.json())).then((e=>s(e.thumbnail_url))).catch((()=>s(null)))}),[t]),d("div",Object.assign({className:O.root,ref:o},{children:d("div",Object.assign({className:O.container},{children:l("div",Object.assign({className:O.embed},{children:[d("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:O.iframePreview,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&d("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:O.iframe},i))]}))}))}))},twitter:function({providerId:e}){const t=u(null),{isIntersecting:i}=x(t,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{var o;if(!i)return;const n=document.createElement("script");n.src="https://platform.twitter.com/widgets.js",null===(o=t.current)||void 0===o||o.appendChild(n),n.onload=()=>{window.twttr&&window.twttr.widgets.createTweet(e,document.getElementById(e),{align:"center",conversation:"none",dnt:!0,theme:"dark",height:500})}}),[e,i]),d("div",Object.assign({className:E.root,ref:t},{children:d("div",Object.assign({className:E.container},{children:d("div",Object.assign({className:E.embed},{children:d("div",{id:e})}))}))}))},figma:function(e){var{providerId:t,url:i}=e;w(e,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:R.root,ref:o},{children:d("div",Object.assign({className:R.container},{children:d("div",Object.assign({className:R.embed},{children:n&&d("iframe",{src:`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(i)}`,frameBorder:0,allowFullScreen:!0,className:R.iframe,height:"450px"})}))}))}))}};var k,M,B=(k=function(e,t){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},k(e,t)},function(e,t){function i(){this.constructor=e}k(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),I=function(){return I=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},I.apply(this,arguments)},_={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},A={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},V={width:"20px",height:"20px",position:"absolute"},T={top:I(I({},_),{top:"-5px"}),right:I(I({},A),{left:void 0,right:"-5px"}),bottom:I(I({},_),{top:void 0,bottom:"-5px"}),left:I(I({},A),{left:"-5px"}),topRight:I(I({},V),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:I(I({},V),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:I(I({},V),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:I(I({},V),{left:"-10px",top:"-10px",cursor:"nw-resize"})},F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return B(t,e),t.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:I(I({position:"absolute",userSelect:"none"},T[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(h.PureComponent),G=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){function o(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),U=function(){return U=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},U.apply(this,arguments)},D={width:"auto",height:"auto"},Y=function(e,t,i){return Math.max(Math.min(e,i),t)},Z=function(e,t){return Math.round(e/t)*t},q=function(e,t){return new RegExp(e,"i").test(t)},J=function(e){return Boolean(e.touches&&e.touches.length)},Q=function(e,t,i){void 0===i&&(i=0);var o=t.reduce((function(i,o,n){return Math.abs(o-e)<Math.abs(t[i]-e)?n:i}),0),n=Math.abs(t[o]-e);return 0===i||n<i?t[o]:e},X=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},$=function(e,t,i,o){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return i*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return o*(Number(e.replace("vh",""))/100)}return e},K=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],ee="__resizable_base__",te=function(e){function t(t){var i=e.call(this,t)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var e=i.parentNode;if(!e)return null;var t=i.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(ee):t.className+=ee,e.appendChild(t),t},i.removeBase=function(e){var t=i.parentNode;t&&t.removeChild(e)},i.ref=function(e){e&&(i.resizable=e)},i.state={isResizing:!1,width:void 0===(i.propsSize&&i.propsSize.width)?"auto":i.propsSize&&i.propsSize.width,height:void 0===(i.propsSize&&i.propsSize.height)?"auto":i.propsSize&&i.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return G(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||D},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,i=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&e.propsSize[t].toString().endsWith("%")){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var i=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/i[t]*100+"%"}return X(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?X(t.width):i("width"),height:t&&void 0!==t.height&&!this.state.isResizing?X(t.height):i("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var o={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=i),this.removeBase(e),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var i=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==i&&"auto"!==i?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var i,o,n=this.props.boundsByDirection,s=this.state.direction,r=n&&q("left",s),a=n&&q("top",s);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=r?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=r?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=r?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),o=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(e=e&&e<i?e:i),o&&Number.isFinite(o)&&(t=t&&t<o?t:o),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,s=n.direction,r=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=r.width,p=r.height,u=l||0,g=h||0;return q("right",s)&&(c=r.width+(e-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),q("left",s)&&(c=r.width-(e-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),q("bottom",s)&&(p=r.height+(t-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),q("top",s)&&(p=r.height-(t-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,i,o){var n=this.props,s=n.lockAspectRatio,r=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?e:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?t:i.height,p=r||0,u=a||0;if(s){var g=(h-p)*this.ratio+u,m=(c-p)*this.ratio+u,f=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,m),y=Math.max(h,f),x=Math.min(c,v);e=Y(e,b,w),t=Y(t,y,x)}else e=Y(e,d,l),t=Y(t,h,c);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var o=this.resizable.getBoundingClientRect(),n=o.left,s=o.top,r=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=r,this.resizableTop=s,this.resizableBottom=a}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var i,o=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(o=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&J(e.nativeEvent)&&(o=e.nativeEvent.touches[0].clientX,n=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var s=this.window.getComputedStyle(this.resizable);if("auto"!==s.flexBasis){var r=this.parentNode;if(r){var a=this.window.getComputedStyle(r).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=s.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:i};this.setState(d)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&J(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var i=this.props,o=i.maxWidth,n=i.maxHeight,s=i.minWidth,r=i.minHeight,a=J(e)?e.touches[0].clientX:e.clientX,d=J(e)?e.touches[0].clientY:e.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,g=this.getParentSize(),f=function(e,t,i,o,n,s,r){return o=$(o,e.width,t,i),n=$(n,e.height,t,i),s=$(s,e.width,t,i),r=$(r,e.height,t,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===s?void 0:Number(s),minHeight:void 0===r?void 0:Number(r)}}(g,this.window.innerWidth,this.window.innerHeight,o,n,s,r);o=f.maxWidth,n=f.maxHeight,s=f.minWidth,r=f.minHeight;var v=this.calculateNewSizeFromDirection(a,d),b=v.newHeight,w=v.newWidth,y=this.calculateNewMaxFromBoundary(o,n);this.props.snap&&this.props.snap.x&&(w=Q(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=Q(b,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(w,b,{width:y.maxWidth,height:y.maxHeight},{width:s,height:r});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=Z(w,this.props.grid[0]),O=Z(b,this.props.grid[1]),S=this.props.snapGap||0;w=0===S||Math.abs(z-w)<=S?z:w,b=0===S||Math.abs(O-b)<=S?O:b}var N={width:w-c.width,height:b-c.height};if(p&&"string"==typeof p)if(p.endsWith("%"))w=w/g.width*100+"%";else if(p.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(u&&"string"==typeof u)if(u.endsWith("%"))b=b/g.height*100+"%";else if(u.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}var j={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?j.flexBasis=j.width:"column"===this.flexDir&&(j.flexBasis=j.height),m((function(){t.setState(j)})),this.props.onResize&&this.props.onResize(e,h,this.resizable,N)}},t.prototype.onMouseUp=function(e){var t=this.state,i=t.isResizing,o=t.direction,n=t.original;if(i&&this.resizable){var s={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,o,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,i=t.enable,o=t.handleStyles,n=t.handleClasses,s=t.handleWrapperStyle,r=t.handleWrapperClass,a=t.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(t){return!1!==i[t]?h.createElement(F,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:o&&o[t],className:n&&n[t]},a&&a[t]?a[t]:null):null}));return h.createElement("div",{className:r,style:s},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,i){return-1!==K.indexOf(i)||(t[i]=e.props[i]),t}),{}),i=U(U(U({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return h.createElement(o,U({ref:this.ref,style:i,className:this.props.className},t),this.state.isResizing&&h.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(h.PureComponent);function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},ie.apply(this,arguments)}var oe=function(e){return h.createElement("svg",ie({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},e),M||(M=h.createElement("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"})))},ne="_5ZnGUwAU",se="wlwFaZpx",re="Obm15-qh",ae="gJ5-oVLV",de="_6jUel99o",le="HZgHUcV-",he="GF1PbH1g gU1gU-Wq",ce="i7UwLauz",pe="cJSOiHYH";z('._5ZnGUwAU{position:fixed}.wlwFaZpx{background:#fff;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:100%;max-height:420px;max-width:calc(100vw - 24px);min-width:540px}.Obm15-qh{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.Obm15-qh,.gJ5-oVLV{font-size:14px;position:relative}.gJ5-oVLV{align-items:center;background-color:inherit;border:none;border-radius:4px;color:#37352f;cursor:pointer;display:inline-flex;flex-shrink:0;height:100%;line-height:1.2;min-width:0;padding:6px 8px;transition:height 20ms ease-in 0s;user-select:none;white-space:nowrap}._6jUel99o:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.HZgHUcV-{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.gU1gU-Wq{border:1px solid rgba(55,53,47,.16);border-radius:4px;cursor:pointer;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap;width:100%}.GF1PbH1g{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.i2lz5EKx{align-items:center;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2;width:100%}._3cPFLttW{left:0;position:absolute;top:0;visibility:hidden}.i7UwLauz{background:hsla(45,13%,94%,.6);box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1);cursor:text;height:32px;line-height:20px;padding:3px 6px;position:relative}.cJSOiHYH,.i7UwLauz{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.cJSOiHYH{fill:#fff;background:#2383e2;box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1),0 1px 2px hsla(0,0%,6%,.1);color:#fff;cursor:pointer;flex-shrink:0;font-weight:500;height:28px;justify-content:center;line-height:1.2;margin:12px auto 6px;max-width:300px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}');const ue=({onEmbed:e})=>{const[t,i]=c("");return l("div",Object.assign({className:he},{children:[d("input",{type:"text",placeholder:"Paste embed link",value:t,className:ce,onChange:e=>i(e.target.value)}),d("button",Object.assign({type:"button",className:pe,onClick:()=>e(t)},{children:"Embed"}))]}))},ge=({style:e,onEmbed:o,onClose:n})=>l(t.Overlay,Object.assign({onClose:n},{children:[d("div",Object.assign({className:ne,style:e},{children:l("div",Object.assign({className:se},{children:[d("div",Object.assign({className:re},{children:d("button",Object.assign({type:"button",className:i(ae,{[de]:!0})},{children:"Embed link"}))})),d("div",Object.assign({className:le},{children:d(ue,{onEmbed:o})}))]}))})),d("div",{})]}));var me=!1;if("undefined"!=typeof window){var fe={get passive(){me=!0}};window.addEventListener("testPassive",null,fe),window.removeEventListener("testPassive",null,fe)}var ve="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),be=[],we=!1,ye=-1,xe=void 0,ze=void 0,Oe=void 0,Se=function(e){return be.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ne=function(e){var t=e||window.event;return!!Se(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},je=function(e,t){if(e){if(!be.some((function(t){return t.targetElement===e}))){var i={targetElement:e,options:t||{}};be=[].concat(function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}(be),[i]),ve?window.requestAnimationFrame((function(){if(void 0===ze){ze={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,i=e.scrollX,o=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var e=o-window.innerHeight;e&&t>=o&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===Oe){var t=!!e&&!0===e.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(t&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);Oe=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===xe&&(xe=document.body.style.overflow,document.body.style.overflow="hidden")}(t),ve&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(ye=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var i=e.targetTouches[0].clientY-ye;!Se(e.target)&&(t&&0===t.scrollTop&&i>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&i<0?Ne(e):e.stopPropagation())}(t,e)},we||(document.addEventListener("touchmove",Ne,me?{passive:!1}:void 0),we=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},Re=function(e){e?(be=be.filter((function(t){return t.targetElement!==e})),ve&&(e.ontouchstart=null,e.ontouchmove=null,we&&0===be.length&&(document.removeEventListener("touchmove",Ne,me?{passive:!1}:void 0),we=!1)),ve?function(){if(void 0!==ze){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=ze.position,document.body.style.top=ze.top,document.body.style.left=ze.left,window.scrollTo(t,e),ze=void 0}}():(void 0!==Oe&&(document.body.style.paddingRight=Oe,Oe=void 0),void 0!==xe&&(document.body.style.overflow=xe,xe=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},Ee="PoOhS4FU",We="PcGiiPpV",He="iQZH4Lf-";z(".PoOhS4FU{margin:20px 0 10px;user-select:none}.PcGiiPpV,.PoOhS4FU{position:relative;width:100%}.PcGiiPpV{align-items:center;background-color:#efefef;border:none;border-radius:3px;color:rgba(55,53,47,.65);cursor:pointer;display:flex;font-size:14px;overflow:hidden;padding:12px 36px 12px 12px;text-align:left;transition:background-color .1s ease-in}.PcGiiPpV:hover{background-color:#e3e3e3}.iQZH4Lf-{margin-right:8px;user-select:none}");const Le=({element:e,attributes:t,maxSizes:i,children:o,editor:n})=>{const[s,h]=c(null),p=u(null),g=e=>{var t;if(e.stopPropagation(),null!==s)return Re(document.body),void h(null);const i=null===(t=p.current)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+88+20>window.innerHeight,t=!e;console.log({showAtTop:e,showAtBottom:t}),je(document.body,{reserveScrollBarGap:!0}),h({left:i.left,top:e?i.top-88-5:i.top+i.height+5})}};return l("div",Object.assign({className:Ee},t,{contentEditable:!1},{children:[l("div",Object.assign({ref:p},{children:[l("button",Object.assign({className:We,onClick:g},{children:[d(oe,{className:He,width:24,height:24}),d("span",{children:"Click to add embed"})]})),null!==s&&d(ge,{onEmbed:t=>y(void 0,void 0,void 0,(function*(){if(0===t.length)return;const i=(o=t).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":o.includes("twitter")?"twitter":o.includes("figma")?"figma":null;var o;let s=null;"youtube"===i?s=(e=>{const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null})(t):"vimeo"===i?s=(e=>new URL(e).pathname.split("/")[1])(t):"dailymotion"===i?s=(e=>{var t=e.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==t?void 0!==t[4]?t[4]:t[2]:null})(t):"twitter"===i?s=function(e){const t=e.match(/\/status\/(\d+)/);return t?t[1]:null}(t):"figma"===i&&(s=function(e){const t=new URL(e).searchParams,i=t.get("node-id");return t.get("node-id")?i:"unknown"}(t)),console.log({provider:i,providerId:s});try{Re(document.body),h(null);const o={data:Object.assign(Object.assign({},e.data),{url:t,size:{width:e.data.size.width,height:e.data.size.height},provider:i,providerId:s})};r.setNodes(n,o,{at:f.findPath(n,e),match:e=>a.isElement(e)&&"embed"===e.type})}catch(e){Re(document.body),h(null)}})),onClose:g,style:s})]})),o]}))};var Pe={root:"s8SlWwrL",resizer:"OLRmQVp3",dotsOptions:"_5qhGnBQW",loadingState:"_0z3X-ysz",extraMargin:"_9GorNz7R",resizeLib:"_6GzVi0JR",leftResizer:"HLz36qUX OLRmQVp3",rightResizer:"Tv1Fs118 OLRmQVp3",resizeItem:"_33V0MBSa",selectImg:"VdsHNo29",selected:"WARAR91D",loader:"_8VNstZwX",dot:"_92ciCRYx"};z(".s8SlWwrL{cursor:pointer;display:block;position:relative}.s8SlWwrL:hover .OLRmQVp3,.s8SlWwrL:hover ._5qhGnBQW{opacity:1}._0z3X-ysz{pointer-events:none}._9GorNz7R{margin:20px 0 30px}._6GzVi0JR{margin:0 auto}.OLRmQVp3{align-items:center;cursor:col-resize;display:flex;height:100%;justify-content:center;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;width:15px;z-index:1}.HLz36qUX{left:0;top:0}.Tv1Fs118{right:0;top:0}._33V0MBSa{background:hsla(0,0%,6%,.6);border:1px solid hsla(0,0%,100%,.9);border-radius:20px;box-shadow:0 0 0 .5px #fff;height:48px;max-height:50%;opacity:1;transition:opacity .3s ease-in 0s;width:6px}.VdsHNo29{opacity:0}.WARAR91D{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;z-index:81}._8VNstZwX{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._5qhGnBQW{align-items:center;background-color:#eee;border:none;border-radius:2px;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:0;padding:0 4px;position:absolute;right:10px;top:10px;transition:opacity .15s ease-in 0s;width:22px;z-index:1}._92ciCRYx{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");const Ce=265;function ke(e){var o,n,s,h,u;const{element:m,editor:w,plugin:y}=e,x=v(),z=b(),[O,S]=c(null),[N,j]=c({width:(null===(n=null===(o=m.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||750,height:(null===(h=null===(s=m.data)||void 0===s?void 0:s.size)||void 0===h?void 0:h.height)||440}),R=e=>j(Object.assign(Object.assign({},N),e));p((()=>{var e,t,i,o;m.data&&R({width:(null===(t=null===(e=m.data)||void 0===e?void 0:e.size)||void 0===t?void 0:t.width)||750,height:(null===(o=null===(i=m.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||440})}),[null===(u=m.data)||void 0===u?void 0:u.size]);const E=g((()=>{var e,t;return{minWidth:300,size:{width:N.width,height:N.height},maxWidth:(null===(e=y.options)||void 0===e?void 0:e.maxWidth)||800,maxHeight:(null===(t=y.options)||void 0===t?void 0:t.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!z,right:!z},handleStyles:{left:{left:0},right:{right:0}},onResize:(e,t,i)=>{R({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(e,t,i)=>{console.log("image editor editor.children",w.children),console.log("ReactEditor.findPath(editor, element)",f.findPath(w,m)),console.log("element",m),r.setNodes(w,{data:Object.assign(Object.assign({},m.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:f.findPath(w,m),match:e=>a.isElement(e)&&"embed"===e.type})},handleComponent:{left:d("div",Object.assign({contentEditable:!1,className:Pe.leftResizer},{children:d("div",{className:Pe.resizeItem})})),right:d("div",Object.assign({contentEditable:!1,className:Pe.rightResizer},{children:d("div",{className:Pe.resizeItem})}))}}}),[N.width,N.height,w]),W=()=>{Re(document.body),S(null)},H=e=>{var t;if(null==e||e.stopPropagation(),null!==O)return W();const i=null===(t=null==e?void 0:e.currentTarget)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+164+20>window.innerHeight;je(document.body,{reserveScrollBarGap:!0}),S({left:i.right-i.width+Ce>window.innerWidth?window.innerWidth-Ce-i.width:i.right-i.width,top:e?i.top-82-i.height:i.top+i.height+5})}};if(!m.data.url&&!m.data["data-src"]){const{maxWidth:o=750,maxHeight:n=800}=y.options||{};return l("div",Object.assign({className:Pe.root,contentEditable:!1,draggable:!1},{children:[d("div",{className:i(Pe.selectImg,{[Pe.selected]:x})}),d(Le,Object.assign({attributes:e.attributes,element:m,editor:w,maxSizes:{maxWidth:o,maxHeight:n}},{children:!z&&l("div",{children:[l("button",Object.assign({type:"button",className:Pe.dotsOptions,onClick:H},{children:[d("span",{className:Pe.dot}),d("span",{className:Pe.dot}),d("span",{className:Pe.dot})]})),null!==O&&d(t.ElementOptions,{onClose:W,style:O,element:m,onCopy:W,onDelete:W,onDuplicate:W},m.id)]})})),e.children]}),m.id)}return d("div",Object.assign({contentEditable:!1,draggable:!1,className:Pe.root},{children:l(te,Object.assign({},E,{className:Pe.resizeLib},{children:[y.renderer.render(Object.assign(Object.assign({},e),{size:N,isEdit:!0})),d("div",{className:i(Pe.selectImg,{[Pe.selected]:x})}),!z&&l("div",{children:[l("button",Object.assign({type:"button",className:Pe.dotsOptions,onClick:H},{children:[d("span",{className:Pe.dot}),d("span",{className:Pe.dot}),d("span",{className:Pe.dot})]})),null!==O&&d(t.ElementOptions,{onClose:W,style:O,element:m,onCopy:W,onDelete:W,onDuplicate:W},m.id)]})]}))}),m.id)}const Me=o({type:"embed",shortcut:"embed",renderer:{editor:(e,t)=>i=>d(ke,Object.assign({editor:e,plugin:t},i)),render:({attributes:t,element:i,children:o,HTMLAttributes:n,isEdit:s=!1})=>{if("string"==typeof i.data.provider&&i.data.providerId&&C[i.data.provider]){const r=C[i.data.provider];return l("div",Object.assign({},t,{contentEditable:!1,draggable:!1},n,{style:s?void 0:i.data.size,className:e({element:i,HTMLAttributes:n,className:P})},{children:[d(r,Object.assign({},i.data,{providerId:i.data.providerId})),o]}))}return i.data.url?l("div",Object.assign({},t,{contentEditable:!1,draggable:!1},n,{className:e({element:i,HTMLAttributes:n,className:P}),style:s?void 0:i.data.size},{children:[d(j,Object.assign({},i.data,{providerId:i.data.providerId})),o]})):d("div",{})}},extendEditor(e){const{isVoid:t}=e;return e.isVoid=e=>e.type===Me.getPlugin.type||t(e),e},events:{onKeyDown:(e,{defaultNode:t,hotkeys:i})=>o=>{var s;if("embed"===n(e,null===(s=e.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&e.selection)return i.isEnter(o)?(o.preventDefault(),void r.insertNodes(e,t,{mode:"highest"})):void 0}},defineElement:()=>({id:s(),type:"embed",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"},providerId:null},children:[{text:""}]}),createElement:(e,t)=>{var i;const o=Object.assign(Object.assign({},Me.getPlugin.defineElement()),t);r.setNodes(e,o,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`[embed-url](${e.data.url})\n`},html:{serialize:(e,t)=>{var i,o;return`<iframe src="https://player.vimeo.com/video/807053663?badge=0&byline=0&portrait=0&title=0" frameborder="0" height="${null===(i=e.data.size)||void 0===i?void 0:i.height}" width="${null===(o=e.data.size)||void 0===o?void 0:o.width}" allowfullscreen="" url="https://vimeo.com/807053663" provider="${e.data.provider||""}" />`},deserialize:{nodeName:"IFRAME",parse:e=>({url:e.getAttribute("src"),size:{height:"string"==typeof e.getAttribute("height")?Number(e.getAttribute("height")):"auto",width:"string"==typeof e.getAttribute("width")?Number(e.getAttribute("width")):"auto"}})}}},options:{searchString:"Embed media",displayLabel:"Embed"}});export{Me as default};
|
package/package.json
CHANGED