@yoopta/video 4.0.0-rc.14 → 4.0.0-rc.15
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,4 +1,4 @@
|
|
|
1
|
-
import{useYooptaEditor as e,useYooptaPluginOptions as t,UI as o,useBlockData as i,useYooptaReadOnly as n,useBlockSelected as r,YooptaPlugin as s,generateId as a}from"@yoopta/editor";import{jsxs as d,jsx as l,Fragment as c}from"react/jsx-runtime";import*as p from"react";import{useState as u,useEffect as h,useRef as f,useLayoutEffect as v,forwardRef as y,createElement as g,useMemo as m}from"react";import*as w from"react-dom";import{flushSync as b,createPortal as x}from"react-dom";function C(e,t){var o={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(o[i[n]]=e[i[n]])}return o}function z(e,t,o,i){return new(o||(o=Promise))((function(n,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))}function S(e,{threshold:t=0,root:o=null,rootMargin:i="0%",freezeOnceVisible:n=!1}={}){const[r,s]=u({}),a=r.isIntersecting&&n,d=([e])=>s(e);return h((()=>{const n=null==e?void 0:e.current;if(!window.IntersectionObserver||a||!n)return;const r=new IntersectionObserver(d,{threshold:t,root:o,rootMargin:i});return r.observe(n),()=>r.disconnect()}),[e,t,o,i,a]),r}"function"==typeof SuppressedError&&SuppressedError;const R={vimeo:function(e){var{videoId:t}=e,o=C(e,["videoId"]);const i=f(null),[n,r]=u(null),[s,a]=u(!1),{isIntersecting:c}=S(i,{freezeOnceVisible:!0,rootMargin:"50%"});return h((()=>{fetch(`https://vimeo.com/api/v2/video/${t}.json`).then((e=>e.json())).then((e=>r(e[0].thumbnail_medium))).catch((()=>r(null)))}),[t]),d("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:c&&s?0:1,zIndex:c&&s?-1:0}}),c&&l("iframe",Object.assign({title:"Video Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},o))]}))},youtube:function(e){var{videoId:t}=e,o=C(e,["videoId"]);const i=f(null),[n,r]=u(!1),{isIntersecting:s}=S(i,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:s&&n?0:1,zIndex:s&&n?-1:0}}),s&&l("iframe",Object.assign({title:"Video Player",src:`https://www.youtube.com/embed/${t}`,frameBorder:0,onLoad:()=>r(!0),allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},o))]}))},dailymotion:function(e){var{videoId:t}=e,o=C(e,["videoId"]);const i=f(null),[n,r]=u(null),[s,a]=u(!1),{isIntersecting:c}=S(i,{freezeOnceVisible:!0,rootMargin:"50%"});return h((()=>{fetch((e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`)(t)).then((e=>e.json())).then((e=>r(e.thumbnail_url))).catch((()=>r(null)))}),[t]),d("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:c&&s?0:1,zIndex:c&&s?-1:0}}),c&&l("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},o))]}))}},_=({width:e,height:t,src:o,settings:i,bgColor:n,poster:r,provider:s,fit:a})=>{const d={backgroundColor:n||"transparent",objectFit:a||"contain"};if(s&&s.id&&s.type&&R[s.type]){const o=R[s.type];return l(o,{videoId:s.id,width:e,height:t})}return l("div",Object.assign({className:"yoo-video-w-full"},{children:o&&l("video",{preload:"metadata",poster:r,src:o,width:e,height:t,onDragStart:e=>e.preventDefault(),className:"yoo-video-object-cover yoo-video-w-full yoo-video-h-full",style:d,playsInline:!0,controls:!0})}))};var E,O=(E=function(e,t){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},E(e,t)},function(e,t){function o(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),k=function(){return k=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},k.apply(this,arguments)},N={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},L={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},j={width:"20px",height:"20px",position:"absolute"},M={top:k(k({},N),{top:"-5px"}),right:k(k({},L),{left:void 0,right:"-5px"}),bottom:k(k({},N),{top:void 0,bottom:"-5px"}),left:k(k({},L),{left:"-5px"}),topRight:k(k({},j),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:k(k({},j),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:k(k({},j),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:k(k({},j),{left:"-10px",top:"-10px",cursor:"nw-resize"})},W=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 O(t,e),t.prototype.render=function(){return p.createElement("div",{className:this.props.className||"",style:k(k({position:"absolute",userSelect:"none"},M[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(p.PureComponent),A=function(){var e=function(t,o){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},e(t,o)};return function(t,o){function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),T=function(){return T=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},T.apply(this,arguments)},B={width:"auto",height:"auto"},P=function(e,t,o){return Math.max(Math.min(e,o),t)},I=function(e,t){return Math.round(e/t)*t},F=function(e,t){return new RegExp(e,"i").test(t)},H=function(e){return Boolean(e.touches&&e.touches.length)},D=function(e,t,o){void 0===o&&(o=0);var i=t.reduce((function(o,i,n){return Math.abs(i-e)<Math.abs(t[o]-e)?n:o}),0),n=Math.abs(t[i]-e);return 0===o||n<o?t[i]:e},V=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"},U=function(e,t,o,i){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 o*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return i*(Number(e.replace("vh",""))/100)}return e},$=["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"],Y="__resizable_base__",X=function(e){function t(t){var o=e.call(this,t)||this;return o.ratio=1,o.resizable=null,o.parentLeft=0,o.parentTop=0,o.resizableLeft=0,o.resizableRight=0,o.resizableTop=0,o.resizableBottom=0,o.targetLeft=0,o.targetTop=0,o.appendBase=function(){if(!o.resizable||!o.window)return null;var e=o.parentNode;if(!e)return null;var t=o.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(Y):t.className+=Y,e.appendChild(t),t},o.removeBase=function(e){var t=o.parentNode;t&&t.removeChild(e)},o.ref=function(e){e&&(o.resizable=e)},o.state={isResizing:!1,width:void 0===(o.propsSize&&o.propsSize.width)?"auto":o.propsSize&&o.propsSize.width,height:void 0===(o.propsSize&&o.propsSize.height)?"auto":o.propsSize&&o.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},o.onResizeStart=o.onResizeStart.bind(o),o.onMouseMove=o.onMouseMove.bind(o),o.onMouseUp=o.onMouseUp.bind(o),o}return A(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||B},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,i=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:o,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:i,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,o=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 o=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/o[t]*100+"%"}return V(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?V(t.width):o("width"),height:t&&void 0!==t.height&&!this.state.isResizing?V(t.height):o("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,o=this.parentNode.style.flexWrap;"wrap"!==o&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var i={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=o),this.removeBase(e),i},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 o=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==o&&"auto"!==o?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var o,i,n=this.props.boundsByDirection,r=this.state.direction,s=n&&F("left",r),a=n&&F("top",r);if("parent"===this.props.bounds){var d=this.parentNode;d&&(o=s?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),i=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(o=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,i=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(o=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),i=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return o&&Number.isFinite(o)&&(e=e&&e<o?e:o),i&&Number.isFinite(i)&&(t=t&&t<i?t:i),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var o=this.props.scale||1,i=this.props.resizeRatio||1,n=this.state,r=n.direction,s=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,c=a.lockAspectRatioExtraWidth,p=s.width,u=s.height,h=l||0,f=c||0;return F("right",r)&&(p=s.width+(e-s.x)*i/o,d&&(u=(p-f)/this.ratio+h)),F("left",r)&&(p=s.width-(e-s.x)*i/o,d&&(u=(p-f)/this.ratio+h)),F("bottom",r)&&(u=s.height+(t-s.y)*i/o,d&&(p=(u-h)*this.ratio+f)),F("top",r)&&(u=s.height-(t-s.y)*i/o,d&&(p=(u-h)*this.ratio+f)),{newWidth:p,newHeight:u}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,o,i){var n=this.props,r=n.lockAspectRatio,s=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===i.width?10:i.width,l=void 0===o.width||o.width<0?e:o.width,c=void 0===i.height?10:i.height,p=void 0===o.height||o.height<0?t:o.height,u=s||0,h=a||0;if(r){var f=(c-u)*this.ratio+h,v=(p-u)*this.ratio+h,y=(d-h)/this.ratio+u,g=(l-h)/this.ratio+u,m=Math.max(d,f),w=Math.min(l,v),b=Math.max(c,y),x=Math.min(p,g);e=P(e,m,w),t=P(t,b,x)}else e=P(e,d,l),t=P(t,c,p);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 o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var i=this.resizable.getBoundingClientRect(),n=i.left,r=i.top,s=i.right,a=i.bottom;this.resizableLeft=n,this.resizableRight=s,this.resizableTop=r,this.resizableBottom=a}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var o,i=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(i=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&H(e.nativeEvent)&&(i=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 r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var a=this.window.getComputedStyle(s).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",o=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:i,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:T(T({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:o};this.setState(d)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&H(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var o=this.props,i=o.maxWidth,n=o.maxHeight,r=o.minWidth,s=o.minHeight,a=H(e)?e.touches[0].clientX:e.clientX,d=H(e)?e.touches[0].clientY:e.clientY,l=this.state,c=l.direction,p=l.original,u=l.width,h=l.height,f=this.getParentSize(),v=function(e,t,o,i,n,r,s){return i=U(i,e.width,t,o),n=U(n,e.height,t,o),r=U(r,e.width,t,o),s=U(s,e.height,t,o),{maxWidth:void 0===i?void 0:Number(i),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===s?void 0:Number(s)}}(f,this.window.innerWidth,this.window.innerHeight,i,n,r,s);i=v.maxWidth,n=v.maxHeight,r=v.minWidth,s=v.minHeight;var y=this.calculateNewSizeFromDirection(a,d),g=y.newHeight,m=y.newWidth,w=this.calculateNewMaxFromBoundary(i,n);this.props.snap&&this.props.snap.x&&(m=D(m,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(g=D(g,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(m,g,{width:w.maxWidth,height:w.maxHeight},{width:r,height:s});if(m=x.newWidth,g=x.newHeight,this.props.grid){var C=I(m,this.props.grid[0]),z=I(g,this.props.grid[1]),S=this.props.snapGap||0;m=0===S||Math.abs(C-m)<=S?C:m,g=0===S||Math.abs(z-g)<=S?z:g}var R={width:m-p.width,height:g-p.height};if(u&&"string"==typeof u)if(u.endsWith("%"))m=m/f.width*100+"%";else if(u.endsWith("vw")){m=m/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){m=m/this.window.innerHeight*100+"vh"}if(h&&"string"==typeof h)if(h.endsWith("%"))g=g/f.height*100+"%";else if(h.endsWith("vw")){g=g/this.window.innerWidth*100+"vw"}else if(h.endsWith("vh")){g=g/this.window.innerHeight*100+"vh"}var _={width:this.createSizeForCssProperty(m,"width"),height:this.createSizeForCssProperty(g,"height")};"row"===this.flexDir?_.flexBasis=_.width:"column"===this.flexDir&&(_.flexBasis=_.height),b((function(){t.setState(_)})),this.props.onResize&&this.props.onResize(e,c,this.resizable,R)}},t.prototype.onMouseUp=function(e){var t=this.state,o=t.isResizing,i=t.direction,n=t.original;if(o&&this.resizable){var r={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,i,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:T(T({},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,o=t.enable,i=t.handleStyles,n=t.handleClasses,r=t.handleWrapperStyle,s=t.handleWrapperClass,a=t.handleComponent;if(!o)return null;var d=Object.keys(o).map((function(t){return!1!==o[t]?p.createElement(W,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:n&&n[t]},a&&a[t]?a[t]:null):null}));return p.createElement("div",{className:s,style:r},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,o){return-1!==$.indexOf(o)||(t[o]=e.props[o]),t}),{}),o=T(T(T({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&&(o.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return p.createElement(i,T({ref:this.ref,style:o,className:this.props.className},t),this.state.isResizing&&p.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}(p.PureComponent);function Z(e){return J(e)?(e.nodeName||"").toLowerCase():"#document"}function G(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function q(e){var t;return null==(t=(J(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function J(e){return e instanceof Node||e instanceof G(e).Node}function K(e){return e instanceof Element||e instanceof G(e).Element}function Q(e){return e instanceof HTMLElement||e instanceof G(e).HTMLElement}function ee(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof G(e).ShadowRoot)}function te(e){const{overflow:t,overflowX:o,overflowY:i,display:n}=se(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!["inline","contents"].includes(n)}function oe(e){return["table","td","th"].includes(Z(e))}function ie(e){const t=ne(),o=se(e);return"none"!==o.transform||"none"!==o.perspective||!!o.containerType&&"normal"!==o.containerType||!t&&!!o.backdropFilter&&"none"!==o.backdropFilter||!t&&!!o.filter&&"none"!==o.filter||["transform","perspective","filter"].some((e=>(o.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(o.contain||"").includes(e)))}function ne(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function re(e){return["html","body","#document"].includes(Z(e))}function se(e){return G(e).getComputedStyle(e)}function ae(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function de(e){if("html"===Z(e))return e;const t=e.assignedSlot||e.parentNode||ee(e)&&e.host||q(e);return ee(t)?t.host:t}function le(e){const t=de(e);return re(t)?e.ownerDocument?e.ownerDocument.body:e.body:Q(t)&&te(t)?t:le(t)}function ce(e,t,o){var i;void 0===t&&(t=[]),void 0===o&&(o=!0);const n=le(e),r=n===(null==(i=e.ownerDocument)?void 0:i.body),s=G(n);return r?t.concat(s,s.visualViewport||[],te(n)?n:[],s.frameElement&&o?ce(s.frameElement):[]):t.concat(n,ce(n,[],o))}const pe=Math.min,ue=Math.max,he=Math.round,fe=e=>({x:e,y:e}),ve={left:"right",right:"left",bottom:"top",top:"bottom"},ye={start:"end",end:"start"};function ge(e,t,o){return ue(e,pe(t,o))}function me(e,t){return"function"==typeof e?e(t):e}function we(e){return e.split("-")[0]}function be(e){return e.split("-")[1]}function xe(e){return"x"===e?"y":"x"}function Ce(e){return"y"===e?"height":"width"}function ze(e){return["top","bottom"].includes(we(e))?"y":"x"}function Se(e){return xe(ze(e))}function Re(e){return e.replace(/start|end/g,(e=>ye[e]))}function _e(e){return e.replace(/left|right|bottom|top/g,(e=>ve[e]))}function Ee(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Oe(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function ke(e,t,o){let{reference:i,floating:n}=e;const r=ze(t),s=Se(t),a=Ce(s),d=we(t),l="y"===r,c=i.x+i.width/2-n.width/2,p=i.y+i.height/2-n.height/2,u=i[a]/2-n[a]/2;let h;switch(d){case"top":h={x:c,y:i.y-n.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:p};break;case"left":h={x:i.x-n.width,y:p};break;default:h={x:i.x,y:i.y}}switch(be(t)){case"start":h[s]-=u*(o&&l?-1:1);break;case"end":h[s]+=u*(o&&l?-1:1)}return h}async function Ne(e,t){var o;void 0===t&&(t={});const{x:i,y:n,platform:r,rects:s,elements:a,strategy:d}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:u=!1,padding:h=0}=me(t,e),f=Ee(h),v=a[u?"floating"===p?"reference":"floating":p],y=Oe(await r.getClippingRect({element:null==(o=await(null==r.isElement?void 0:r.isElement(v)))||o?v:v.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(a.floating)),boundary:l,rootBoundary:c,strategy:d})),g="floating"===p?{...s.floating,x:i,y:n}:s.reference,m=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),w=await(null==r.isElement?void 0:r.isElement(m))&&await(null==r.getScale?void 0:r.getScale(m))||{x:1,y:1},b=Oe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:m,strategy:d}):g);return{top:(y.top-b.top+f.top)/w.y,bottom:(b.bottom-y.bottom+f.bottom)/w.y,left:(y.left-b.left+f.left)/w.x,right:(b.right-y.right+f.right)/w.x}}function Le(e){const t=pe(...e.map((e=>e.left))),o=pe(...e.map((e=>e.top)));return{x:t,y:o,width:ue(...e.map((e=>e.right)))-t,height:ue(...e.map((e=>e.bottom)))-o}}const je=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:n,y:r,placement:s,middlewareData:a}=t,d=await async function(e,t){const{placement:o,platform:i,elements:n}=e,r=await(null==i.isRTL?void 0:i.isRTL(n.floating)),s=we(o),a=be(o),d="y"===ze(o),l=["left","top"].includes(s)?-1:1,c=r&&d?-1:1,p=me(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:f}="number"==typeof p?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),d?{x:h*c,y:u*l}:{x:u*l,y:h*c}}(t,e);return s===(null==(o=a.offset)?void 0:o.placement)&&null!=(i=a.arrow)&&i.alignmentOffset?{}:{x:n+d.x,y:r+d.y,data:{...d,placement:s}}}}};function Me(e){const t=se(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const n=Q(e),r=n?e.offsetWidth:o,s=n?e.offsetHeight:i,a=he(o)!==r||he(i)!==s;return a&&(o=r,i=s),{width:o,height:i,$:a}}function We(e){return K(e)?e:e.contextElement}function Ae(e){const t=We(e);if(!Q(t))return fe(1);const o=t.getBoundingClientRect(),{width:i,height:n,$:r}=Me(t);let s=(r?he(o.width):o.width)/i,a=(r?he(o.height):o.height)/n;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Te=fe(0);function Be(e){const t=G(e);return ne()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Te}function Pe(e,t,o,i){void 0===t&&(t=!1),void 0===o&&(o=!1);const n=e.getBoundingClientRect(),r=We(e);let s=fe(1);t&&(i?K(i)&&(s=Ae(i)):s=Ae(e));const a=function(e,t,o){return void 0===t&&(t=!1),!(!o||t&&o!==G(e))&&t}(r,o,i)?Be(r):fe(0);let d=(n.left+a.x)/s.x,l=(n.top+a.y)/s.y,c=n.width/s.x,p=n.height/s.y;if(r){const e=G(r),t=i&&K(i)?G(i):i;let o=e,n=o.frameElement;for(;n&&i&&t!==o;){const e=Ae(n),t=n.getBoundingClientRect(),i=se(n),r=t.left+(n.clientLeft+parseFloat(i.paddingLeft))*e.x,s=t.top+(n.clientTop+parseFloat(i.paddingTop))*e.y;d*=e.x,l*=e.y,c*=e.x,p*=e.y,d+=r,l+=s,o=G(n),n=o.frameElement}}return Oe({width:c,height:p,x:d,y:l})}const Ie=[":popover-open",":modal"];function Fe(e){return Ie.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function He(e){return Pe(q(e)).left+ae(e).scrollLeft}function De(e,t,o){let i;if("viewport"===t)i=function(e,t){const o=G(e),i=q(e),n=o.visualViewport;let r=i.clientWidth,s=i.clientHeight,a=0,d=0;if(n){r=n.width,s=n.height;const e=ne();(!e||e&&"fixed"===t)&&(a=n.offsetLeft,d=n.offsetTop)}return{width:r,height:s,x:a,y:d}}(e,o);else if("document"===t)i=function(e){const t=q(e),o=ae(e),i=e.ownerDocument.body,n=ue(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=ue(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-o.scrollLeft+He(e);const a=-o.scrollTop;return"rtl"===se(i).direction&&(s+=ue(t.clientWidth,i.clientWidth)-n),{width:n,height:r,x:s,y:a}}(q(e));else if(K(t))i=function(e,t){const o=Pe(e,!0,"fixed"===t),i=o.top+e.clientTop,n=o.left+e.clientLeft,r=Q(e)?Ae(e):fe(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:n*r.x,y:i*r.y}}(t,o);else{const o=Be(e);i={...t,x:t.x-o.x,y:t.y-o.y}}return Oe(i)}function Ve(e,t){const o=de(e);return!(o===t||!K(o)||re(o))&&("fixed"===se(o).position||Ve(o,t))}function Ue(e,t,o){const i=Q(t),n=q(t),r="fixed"===o,s=Pe(e,!0,r,t);let a={scrollLeft:0,scrollTop:0};const d=fe(0);if(i||!i&&!r)if(("body"!==Z(t)||te(n))&&(a=ae(t)),i){const e=Pe(t,!0,r,t);d.x=e.x+t.clientLeft,d.y=e.y+t.clientTop}else n&&(d.x=He(n));return{x:s.left+a.scrollLeft-d.x,y:s.top+a.scrollTop-d.y,width:s.width,height:s.height}}function $e(e,t){return Q(e)&&"fixed"!==se(e).position?t?t(e):e.offsetParent:null}function Ye(e,t){const o=G(e);if(!Q(e)||Fe(e))return o;let i=$e(e,t);for(;i&&oe(i)&&"static"===se(i).position;)i=$e(i,t);return i&&("html"===Z(i)||"body"===Z(i)&&"static"===se(i).position&&!ie(i))?o:i||function(e){let t=de(e);for(;Q(t)&&!re(t);){if(ie(t))return t;t=de(t)}return null}(e)||o}const Xe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:o,offsetParent:i,strategy:n}=e;const r="fixed"===n,s=q(i),a=!!t&&Fe(t.floating);if(i===s||a&&r)return o;let d={scrollLeft:0,scrollTop:0},l=fe(1);const c=fe(0),p=Q(i);if((p||!p&&!r)&&(("body"!==Z(i)||te(s))&&(d=ae(i)),Q(i))){const e=Pe(i);l=Ae(i),c.x=e.x+i.clientLeft,c.y=e.y+i.clientTop}return{width:o.width*l.x,height:o.height*l.y,x:o.x*l.x-d.scrollLeft*l.x+c.x,y:o.y*l.y-d.scrollTop*l.y+c.y}},getDocumentElement:q,getClippingRect:function(e){let{element:t,boundary:o,rootBoundary:i,strategy:n}=e;const r=[..."clippingAncestors"===o?function(e,t){const o=t.get(e);if(o)return o;let i=ce(e,[],!1).filter((e=>K(e)&&"body"!==Z(e))),n=null;const r="fixed"===se(e).position;let s=r?de(e):e;for(;K(s)&&!re(s);){const t=se(s),o=ie(s);o||"fixed"!==t.position||(n=null),(r?!o&&!n:!o&&"static"===t.position&&n&&["absolute","fixed"].includes(n.position)||te(s)&&!o&&Ve(e,s))?i=i.filter((e=>e!==s)):n=t,s=de(s)}return t.set(e,i),i}(t,this._c):[].concat(o),i],s=r[0],a=r.reduce(((e,o)=>{const i=De(t,o,n);return e.top=ue(i.top,e.top),e.right=pe(i.right,e.right),e.bottom=pe(i.bottom,e.bottom),e.left=ue(i.left,e.left),e}),De(t,s,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Ye,getElementRects:async function(e){const t=this.getOffsetParent||Ye,o=this.getDimensions;return{reference:Ue(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await o(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:o}=Me(e);return{width:t,height:o}},getScale:Ae,isElement:K,isRTL:function(e){return"rtl"===se(e).direction}},Ze=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:n}=t,{mainAxis:r=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:o}=e;return{x:t,y:o}}},...d}=me(e,t),l={x:o,y:i},c=await Ne(t,d),p=ze(we(n)),u=xe(p);let h=l[u],f=l[p];if(r){const e="y"===u?"bottom":"right";h=ge(h+c["y"===u?"top":"left"],h,h-c[e])}if(s){const e="y"===p?"bottom":"right";f=ge(f+c["y"===p?"top":"left"],f,f-c[e])}const v=a.fn({...t,[u]:h,[p]:f});return{...v,data:{x:v.x-o,y:v.y-i}}}}},Ge=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:n,middlewareData:r,rects:s,initialPlacement:a,platform:d,elements:l}=t,{mainAxis:c=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:v=!0,...y}=me(e,t);if(null!=(o=r.arrow)&&o.alignmentOffset)return{};const g=we(n),m=we(a)===a,w=await(null==d.isRTL?void 0:d.isRTL(l.floating)),b=u||(m||!v?[_e(a)]:function(e){const t=_e(e);return[Re(e),t,Re(t)]}(a));u||"none"===f||b.push(...function(e,t,o,i){const n=be(e);let r=function(e,t,o){const i=["left","right"],n=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return o?t?n:i:t?i:n;case"left":case"right":return t?r:s;default:return[]}}(we(e),"start"===o,i);return n&&(r=r.map((e=>e+"-"+n)),t&&(r=r.concat(r.map(Re)))),r}(a,v,f,w));const x=[a,...b],C=await Ne(t,y),z=[];let S=(null==(i=r.flip)?void 0:i.overflows)||[];if(c&&z.push(C[g]),p){const e=function(e,t,o){void 0===o&&(o=!1);const i=be(e),n=Se(e),r=Ce(n);let s="x"===n?i===(o?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=_e(s)),[s,_e(s)]}(n,s,w);z.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:n,overflows:z}],!z.every((e=>e<=0))){var R,_;const e=((null==(R=r.flip)?void 0:R.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let o=null==(_=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:_.placement;if(!o)switch(h){case"bestFit":{var E;const e=null==(E=S.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:E[0];e&&(o=e);break}case"initialPlacement":o=a}if(n!==o)return{reset:{placement:o}}}return{}}}},qe=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:i,rects:n,platform:r,strategy:s}=t,{padding:a=2,x:d,y:l}=me(e,t),c=Array.from(await(null==r.getClientRects?void 0:r.getClientRects(i.reference))||[]),p=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),o=[];let i=null;for(let e=0;e<t.length;e++){const n=t[e];!i||n.y-i.y>i.height/2?o.push([n]):o[o.length-1].push(n),i=n}return o.map((e=>Oe(Le(e))))}(c),u=Oe(Le(c)),h=Ee(a);const f=await r.getElementRects({reference:{getBoundingClientRect:function(){if(2===p.length&&p[0].left>p[1].right&&null!=d&&null!=l)return p.find((e=>d>e.left-h.left&&d<e.right+h.right&&l>e.top-h.top&&l<e.bottom+h.bottom))||u;if(p.length>=2){if("y"===ze(o)){const e=p[0],t=p[p.length-1],i="top"===we(o),n=e.top,r=t.bottom,s=i?e.left:t.left,a=i?e.right:t.right;return{top:n,bottom:r,left:s,right:a,width:a-s,height:r-n,x:s,y:n}}const e="left"===we(o),t=ue(...p.map((e=>e.right))),i=pe(...p.map((e=>e.left))),n=p.filter((o=>e?o.left===i:o.right===t)),r=n[0].top,s=n[n.length-1].bottom;return{top:r,bottom:s,left:i,right:t,width:t-i,height:s-r,x:i,y:r}}return u}},floating:i.floating,strategy:s});return n.reference.x!==f.reference.x||n.reference.y!==f.reference.y||n.reference.width!==f.reference.width||n.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},Je=(e,t,o)=>{const i=new Map,n={platform:Xe,...o},r={...n.platform,_c:i};return(async(e,t,o)=>{const{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:s}=o,a=r.filter(Boolean),d=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:c,y:p}=ke(l,i,d),u=i,h={},f=0;for(let o=0;o<a.length;o++){const{name:r,fn:v}=a[o],{x:y,y:g,data:m,reset:w}=await v({x:c,y:p,initialPlacement:i,placement:u,strategy:n,middlewareData:h,rects:l,platform:s,elements:{reference:e,floating:t}});c=null!=y?y:c,p=null!=g?g:p,h={...h,[r]:{...h[r],...m}},w&&f<=50&&(f++,"object"==typeof w&&(w.placement&&(u=w.placement),w.rects&&(l=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:n}):w.rects),({x:c,y:p}=ke(l,u,d))),o=-1)}return{x:c,y:p,placement:u,strategy:n,middlewareData:h}})(e,t,{...n,platform:r})};var Ke="undefined"!=typeof document?v:h;function Qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let o,i,n;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(i=o;0!=i--;)if(!Qe(e[i],t[i]))return!1;return!0}if(n=Object.keys(e),o=n.length,o!==Object.keys(t).length)return!1;for(i=o;0!=i--;)if(!{}.hasOwnProperty.call(t,n[i]))return!1;for(i=o;0!=i--;){const o=n[i];if(("_owner"!==o||!e.$$typeof)&&!Qe(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function et(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tt(e,t){const o=et(e);return Math.round(t*o)/o}function ot(e){const t=p.useRef(e);return Ke((()=>{t.current=e})),t}
|
|
1
|
+
import{useYooptaEditor as e,useYooptaPluginOptions as t,UI as o,useBlockData as i,useYooptaReadOnly as n,useBlockSelected as r,YooptaPlugin as s,generateId as a}from"@yoopta/editor";import{jsxs as d,jsx as l,Fragment as c}from"react/jsx-runtime";import*as p from"react";import{useState as u,useEffect as h,useRef as f,useLayoutEffect as v,forwardRef as y,createElement as g,useMemo as m}from"react";import*as w from"react-dom";import{flushSync as b,createPortal as x}from"react-dom";function C(e,t){var o={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(o[i[n]]=e[i[n]])}return o}function z(e,t,o,i){return new(o||(o=Promise))((function(n,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))}function S(e,{threshold:t=0,root:o=null,rootMargin:i="0%",freezeOnceVisible:n=!1}={}){const[r,s]=u({}),a=r.isIntersecting&&n,d=([e])=>s(e);return h((()=>{const n=null==e?void 0:e.current;if(!window.IntersectionObserver||a||!n)return;const r=new IntersectionObserver(d,{threshold:t,root:o,rootMargin:i});return r.observe(n),()=>r.disconnect()}),[e,t,o,i,a]),r}"function"==typeof SuppressedError&&SuppressedError;const R={vimeo:function(e){var{videoId:t}=e,o=C(e,["videoId"]);const i=f(null),[n,r]=u(null),[s,a]=u(!1),{isIntersecting:c}=S(i,{freezeOnceVisible:!0,rootMargin:"50%"});return h((()=>{fetch(`https://vimeo.com/api/v2/video/${t}.json`).then((e=>e.json())).then((e=>r(e[0].thumbnail_medium))).catch((()=>r(null)))}),[t]),d("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:c&&s?0:1,zIndex:c&&s?-1:0}}),c&&l("iframe",Object.assign({title:"Video Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},o))]}))},youtube:function(e){var{videoId:t}=e,o=C(e,["videoId"]);const i=f(null),[n,r]=u(!1),{isIntersecting:s}=S(i,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:s&&n?0:1,zIndex:s&&n?-1:0}}),s&&l("iframe",Object.assign({title:"Video Player",src:`https://www.youtube.com/embed/${t}`,frameBorder:0,onLoad:()=>r(!0),allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},o))]}))},dailymotion:function(e){var{videoId:t}=e,o=C(e,["videoId"]);const i=f(null),[n,r]=u(null),[s,a]=u(!1),{isIntersecting:c}=S(i,{freezeOnceVisible:!0,rootMargin:"50%"});return h((()=>{fetch((e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`)(t)).then((e=>e.json())).then((e=>r(e.thumbnail_url))).catch((()=>r(null)))}),[t]),d("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:c&&s?0:1,zIndex:c&&s?-1:0}}),c&&l("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},o))]}))}},_=({width:e,height:t,src:o,bgColor:i,poster:n,provider:r,fit:s})=>{const a={backgroundColor:i||"transparent",objectFit:s||"contain"};if(r&&r.id&&r.type&&R[r.type]){const o=R[r.type];return l(o,{videoId:r.id,width:e,height:t})}return l("div",Object.assign({className:"yoo-video-w-full"},{children:o&&l("video",{preload:"metadata",poster:n,src:o,width:e,height:t,onDragStart:e=>e.preventDefault(),className:"yoo-video-object-cover yoo-video-w-full yoo-video-h-full",style:a,playsInline:!0,controls:!0})}))};var E,O=(E=function(e,t){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},E(e,t)},function(e,t){function o(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),k=function(){return k=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},k.apply(this,arguments)},N={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},L={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},j={width:"20px",height:"20px",position:"absolute"},M={top:k(k({},N),{top:"-5px"}),right:k(k({},L),{left:void 0,right:"-5px"}),bottom:k(k({},N),{top:void 0,bottom:"-5px"}),left:k(k({},L),{left:"-5px"}),topRight:k(k({},j),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:k(k({},j),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:k(k({},j),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:k(k({},j),{left:"-10px",top:"-10px",cursor:"nw-resize"})},W=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 O(t,e),t.prototype.render=function(){return p.createElement("div",{className:this.props.className||"",style:k(k({position:"absolute",userSelect:"none"},M[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(p.PureComponent),A=function(){var e=function(t,o){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},e(t,o)};return function(t,o){function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),T=function(){return T=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},T.apply(this,arguments)},B={width:"auto",height:"auto"},P=function(e,t,o){return Math.max(Math.min(e,o),t)},I=function(e,t){return Math.round(e/t)*t},F=function(e,t){return new RegExp(e,"i").test(t)},H=function(e){return Boolean(e.touches&&e.touches.length)},D=function(e,t,o){void 0===o&&(o=0);var i=t.reduce((function(o,i,n){return Math.abs(i-e)<Math.abs(t[o]-e)?n:o}),0),n=Math.abs(t[i]-e);return 0===o||n<o?t[i]:e},V=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"},U=function(e,t,o,i){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 o*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return i*(Number(e.replace("vh",""))/100)}return e},$=["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"],Y="__resizable_base__",X=function(e){function t(t){var o=e.call(this,t)||this;return o.ratio=1,o.resizable=null,o.parentLeft=0,o.parentTop=0,o.resizableLeft=0,o.resizableRight=0,o.resizableTop=0,o.resizableBottom=0,o.targetLeft=0,o.targetTop=0,o.appendBase=function(){if(!o.resizable||!o.window)return null;var e=o.parentNode;if(!e)return null;var t=o.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(Y):t.className+=Y,e.appendChild(t),t},o.removeBase=function(e){var t=o.parentNode;t&&t.removeChild(e)},o.ref=function(e){e&&(o.resizable=e)},o.state={isResizing:!1,width:void 0===(o.propsSize&&o.propsSize.width)?"auto":o.propsSize&&o.propsSize.width,height:void 0===(o.propsSize&&o.propsSize.height)?"auto":o.propsSize&&o.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},o.onResizeStart=o.onResizeStart.bind(o),o.onMouseMove=o.onMouseMove.bind(o),o.onMouseUp=o.onMouseUp.bind(o),o}return A(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||B},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,i=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:o,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:i,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,o=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 o=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/o[t]*100+"%"}return V(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?V(t.width):o("width"),height:t&&void 0!==t.height&&!this.state.isResizing?V(t.height):o("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,o=this.parentNode.style.flexWrap;"wrap"!==o&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var i={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=o),this.removeBase(e),i},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 o=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==o&&"auto"!==o?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var o,i,n=this.props.boundsByDirection,r=this.state.direction,s=n&&F("left",r),a=n&&F("top",r);if("parent"===this.props.bounds){var d=this.parentNode;d&&(o=s?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),i=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(o=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,i=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(o=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),i=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return o&&Number.isFinite(o)&&(e=e&&e<o?e:o),i&&Number.isFinite(i)&&(t=t&&t<i?t:i),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var o=this.props.scale||1,i=this.props.resizeRatio||1,n=this.state,r=n.direction,s=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,c=a.lockAspectRatioExtraWidth,p=s.width,u=s.height,h=l||0,f=c||0;return F("right",r)&&(p=s.width+(e-s.x)*i/o,d&&(u=(p-f)/this.ratio+h)),F("left",r)&&(p=s.width-(e-s.x)*i/o,d&&(u=(p-f)/this.ratio+h)),F("bottom",r)&&(u=s.height+(t-s.y)*i/o,d&&(p=(u-h)*this.ratio+f)),F("top",r)&&(u=s.height-(t-s.y)*i/o,d&&(p=(u-h)*this.ratio+f)),{newWidth:p,newHeight:u}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,o,i){var n=this.props,r=n.lockAspectRatio,s=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===i.width?10:i.width,l=void 0===o.width||o.width<0?e:o.width,c=void 0===i.height?10:i.height,p=void 0===o.height||o.height<0?t:o.height,u=s||0,h=a||0;if(r){var f=(c-u)*this.ratio+h,v=(p-u)*this.ratio+h,y=(d-h)/this.ratio+u,g=(l-h)/this.ratio+u,m=Math.max(d,f),w=Math.min(l,v),b=Math.max(c,y),x=Math.min(p,g);e=P(e,m,w),t=P(t,b,x)}else e=P(e,d,l),t=P(t,c,p);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 o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var i=this.resizable.getBoundingClientRect(),n=i.left,r=i.top,s=i.right,a=i.bottom;this.resizableLeft=n,this.resizableRight=s,this.resizableTop=r,this.resizableBottom=a}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var o,i=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(i=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&H(e.nativeEvent)&&(i=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 r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var a=this.window.getComputedStyle(s).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",o=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:i,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:T(T({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:o};this.setState(d)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&H(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var o=this.props,i=o.maxWidth,n=o.maxHeight,r=o.minWidth,s=o.minHeight,a=H(e)?e.touches[0].clientX:e.clientX,d=H(e)?e.touches[0].clientY:e.clientY,l=this.state,c=l.direction,p=l.original,u=l.width,h=l.height,f=this.getParentSize(),v=function(e,t,o,i,n,r,s){return i=U(i,e.width,t,o),n=U(n,e.height,t,o),r=U(r,e.width,t,o),s=U(s,e.height,t,o),{maxWidth:void 0===i?void 0:Number(i),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===s?void 0:Number(s)}}(f,this.window.innerWidth,this.window.innerHeight,i,n,r,s);i=v.maxWidth,n=v.maxHeight,r=v.minWidth,s=v.minHeight;var y=this.calculateNewSizeFromDirection(a,d),g=y.newHeight,m=y.newWidth,w=this.calculateNewMaxFromBoundary(i,n);this.props.snap&&this.props.snap.x&&(m=D(m,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(g=D(g,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(m,g,{width:w.maxWidth,height:w.maxHeight},{width:r,height:s});if(m=x.newWidth,g=x.newHeight,this.props.grid){var C=I(m,this.props.grid[0]),z=I(g,this.props.grid[1]),S=this.props.snapGap||0;m=0===S||Math.abs(C-m)<=S?C:m,g=0===S||Math.abs(z-g)<=S?z:g}var R={width:m-p.width,height:g-p.height};if(u&&"string"==typeof u)if(u.endsWith("%"))m=m/f.width*100+"%";else if(u.endsWith("vw")){m=m/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){m=m/this.window.innerHeight*100+"vh"}if(h&&"string"==typeof h)if(h.endsWith("%"))g=g/f.height*100+"%";else if(h.endsWith("vw")){g=g/this.window.innerWidth*100+"vw"}else if(h.endsWith("vh")){g=g/this.window.innerHeight*100+"vh"}var _={width:this.createSizeForCssProperty(m,"width"),height:this.createSizeForCssProperty(g,"height")};"row"===this.flexDir?_.flexBasis=_.width:"column"===this.flexDir&&(_.flexBasis=_.height),b((function(){t.setState(_)})),this.props.onResize&&this.props.onResize(e,c,this.resizable,R)}},t.prototype.onMouseUp=function(e){var t=this.state,o=t.isResizing,i=t.direction,n=t.original;if(o&&this.resizable){var r={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,i,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:T(T({},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,o=t.enable,i=t.handleStyles,n=t.handleClasses,r=t.handleWrapperStyle,s=t.handleWrapperClass,a=t.handleComponent;if(!o)return null;var d=Object.keys(o).map((function(t){return!1!==o[t]?p.createElement(W,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:n&&n[t]},a&&a[t]?a[t]:null):null}));return p.createElement("div",{className:s,style:r},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,o){return-1!==$.indexOf(o)||(t[o]=e.props[o]),t}),{}),o=T(T(T({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&&(o.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return p.createElement(i,T({ref:this.ref,style:o,className:this.props.className},t),this.state.isResizing&&p.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}(p.PureComponent);function Z(e){return J(e)?(e.nodeName||"").toLowerCase():"#document"}function G(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function q(e){var t;return null==(t=(J(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function J(e){return e instanceof Node||e instanceof G(e).Node}function K(e){return e instanceof Element||e instanceof G(e).Element}function Q(e){return e instanceof HTMLElement||e instanceof G(e).HTMLElement}function ee(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof G(e).ShadowRoot)}function te(e){const{overflow:t,overflowX:o,overflowY:i,display:n}=se(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!["inline","contents"].includes(n)}function oe(e){return["table","td","th"].includes(Z(e))}function ie(e){const t=ne(),o=se(e);return"none"!==o.transform||"none"!==o.perspective||!!o.containerType&&"normal"!==o.containerType||!t&&!!o.backdropFilter&&"none"!==o.backdropFilter||!t&&!!o.filter&&"none"!==o.filter||["transform","perspective","filter"].some((e=>(o.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(o.contain||"").includes(e)))}function ne(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function re(e){return["html","body","#document"].includes(Z(e))}function se(e){return G(e).getComputedStyle(e)}function ae(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function de(e){if("html"===Z(e))return e;const t=e.assignedSlot||e.parentNode||ee(e)&&e.host||q(e);return ee(t)?t.host:t}function le(e){const t=de(e);return re(t)?e.ownerDocument?e.ownerDocument.body:e.body:Q(t)&&te(t)?t:le(t)}function ce(e,t,o){var i;void 0===t&&(t=[]),void 0===o&&(o=!0);const n=le(e),r=n===(null==(i=e.ownerDocument)?void 0:i.body),s=G(n);return r?t.concat(s,s.visualViewport||[],te(n)?n:[],s.frameElement&&o?ce(s.frameElement):[]):t.concat(n,ce(n,[],o))}const pe=Math.min,ue=Math.max,he=Math.round,fe=e=>({x:e,y:e}),ve={left:"right",right:"left",bottom:"top",top:"bottom"},ye={start:"end",end:"start"};function ge(e,t,o){return ue(e,pe(t,o))}function me(e,t){return"function"==typeof e?e(t):e}function we(e){return e.split("-")[0]}function be(e){return e.split("-")[1]}function xe(e){return"x"===e?"y":"x"}function Ce(e){return"y"===e?"height":"width"}function ze(e){return["top","bottom"].includes(we(e))?"y":"x"}function Se(e){return xe(ze(e))}function Re(e){return e.replace(/start|end/g,(e=>ye[e]))}function _e(e){return e.replace(/left|right|bottom|top/g,(e=>ve[e]))}function Ee(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Oe(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function ke(e,t,o){let{reference:i,floating:n}=e;const r=ze(t),s=Se(t),a=Ce(s),d=we(t),l="y"===r,c=i.x+i.width/2-n.width/2,p=i.y+i.height/2-n.height/2,u=i[a]/2-n[a]/2;let h;switch(d){case"top":h={x:c,y:i.y-n.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:p};break;case"left":h={x:i.x-n.width,y:p};break;default:h={x:i.x,y:i.y}}switch(be(t)){case"start":h[s]-=u*(o&&l?-1:1);break;case"end":h[s]+=u*(o&&l?-1:1)}return h}async function Ne(e,t){var o;void 0===t&&(t={});const{x:i,y:n,platform:r,rects:s,elements:a,strategy:d}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:u=!1,padding:h=0}=me(t,e),f=Ee(h),v=a[u?"floating"===p?"reference":"floating":p],y=Oe(await r.getClippingRect({element:null==(o=await(null==r.isElement?void 0:r.isElement(v)))||o?v:v.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(a.floating)),boundary:l,rootBoundary:c,strategy:d})),g="floating"===p?{...s.floating,x:i,y:n}:s.reference,m=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),w=await(null==r.isElement?void 0:r.isElement(m))&&await(null==r.getScale?void 0:r.getScale(m))||{x:1,y:1},b=Oe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:m,strategy:d}):g);return{top:(y.top-b.top+f.top)/w.y,bottom:(b.bottom-y.bottom+f.bottom)/w.y,left:(y.left-b.left+f.left)/w.x,right:(b.right-y.right+f.right)/w.x}}function Le(e){const t=pe(...e.map((e=>e.left))),o=pe(...e.map((e=>e.top)));return{x:t,y:o,width:ue(...e.map((e=>e.right)))-t,height:ue(...e.map((e=>e.bottom)))-o}}const je=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:n,y:r,placement:s,middlewareData:a}=t,d=await async function(e,t){const{placement:o,platform:i,elements:n}=e,r=await(null==i.isRTL?void 0:i.isRTL(n.floating)),s=we(o),a=be(o),d="y"===ze(o),l=["left","top"].includes(s)?-1:1,c=r&&d?-1:1,p=me(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:f}="number"==typeof p?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),d?{x:h*c,y:u*l}:{x:u*l,y:h*c}}(t,e);return s===(null==(o=a.offset)?void 0:o.placement)&&null!=(i=a.arrow)&&i.alignmentOffset?{}:{x:n+d.x,y:r+d.y,data:{...d,placement:s}}}}};function Me(e){const t=se(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const n=Q(e),r=n?e.offsetWidth:o,s=n?e.offsetHeight:i,a=he(o)!==r||he(i)!==s;return a&&(o=r,i=s),{width:o,height:i,$:a}}function We(e){return K(e)?e:e.contextElement}function Ae(e){const t=We(e);if(!Q(t))return fe(1);const o=t.getBoundingClientRect(),{width:i,height:n,$:r}=Me(t);let s=(r?he(o.width):o.width)/i,a=(r?he(o.height):o.height)/n;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Te=fe(0);function Be(e){const t=G(e);return ne()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Te}function Pe(e,t,o,i){void 0===t&&(t=!1),void 0===o&&(o=!1);const n=e.getBoundingClientRect(),r=We(e);let s=fe(1);t&&(i?K(i)&&(s=Ae(i)):s=Ae(e));const a=function(e,t,o){return void 0===t&&(t=!1),!(!o||t&&o!==G(e))&&t}(r,o,i)?Be(r):fe(0);let d=(n.left+a.x)/s.x,l=(n.top+a.y)/s.y,c=n.width/s.x,p=n.height/s.y;if(r){const e=G(r),t=i&&K(i)?G(i):i;let o=e,n=o.frameElement;for(;n&&i&&t!==o;){const e=Ae(n),t=n.getBoundingClientRect(),i=se(n),r=t.left+(n.clientLeft+parseFloat(i.paddingLeft))*e.x,s=t.top+(n.clientTop+parseFloat(i.paddingTop))*e.y;d*=e.x,l*=e.y,c*=e.x,p*=e.y,d+=r,l+=s,o=G(n),n=o.frameElement}}return Oe({width:c,height:p,x:d,y:l})}const Ie=[":popover-open",":modal"];function Fe(e){return Ie.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function He(e){return Pe(q(e)).left+ae(e).scrollLeft}function De(e,t,o){let i;if("viewport"===t)i=function(e,t){const o=G(e),i=q(e),n=o.visualViewport;let r=i.clientWidth,s=i.clientHeight,a=0,d=0;if(n){r=n.width,s=n.height;const e=ne();(!e||e&&"fixed"===t)&&(a=n.offsetLeft,d=n.offsetTop)}return{width:r,height:s,x:a,y:d}}(e,o);else if("document"===t)i=function(e){const t=q(e),o=ae(e),i=e.ownerDocument.body,n=ue(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=ue(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-o.scrollLeft+He(e);const a=-o.scrollTop;return"rtl"===se(i).direction&&(s+=ue(t.clientWidth,i.clientWidth)-n),{width:n,height:r,x:s,y:a}}(q(e));else if(K(t))i=function(e,t){const o=Pe(e,!0,"fixed"===t),i=o.top+e.clientTop,n=o.left+e.clientLeft,r=Q(e)?Ae(e):fe(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:n*r.x,y:i*r.y}}(t,o);else{const o=Be(e);i={...t,x:t.x-o.x,y:t.y-o.y}}return Oe(i)}function Ve(e,t){const o=de(e);return!(o===t||!K(o)||re(o))&&("fixed"===se(o).position||Ve(o,t))}function Ue(e,t,o){const i=Q(t),n=q(t),r="fixed"===o,s=Pe(e,!0,r,t);let a={scrollLeft:0,scrollTop:0};const d=fe(0);if(i||!i&&!r)if(("body"!==Z(t)||te(n))&&(a=ae(t)),i){const e=Pe(t,!0,r,t);d.x=e.x+t.clientLeft,d.y=e.y+t.clientTop}else n&&(d.x=He(n));return{x:s.left+a.scrollLeft-d.x,y:s.top+a.scrollTop-d.y,width:s.width,height:s.height}}function $e(e,t){return Q(e)&&"fixed"!==se(e).position?t?t(e):e.offsetParent:null}function Ye(e,t){const o=G(e);if(!Q(e)||Fe(e))return o;let i=$e(e,t);for(;i&&oe(i)&&"static"===se(i).position;)i=$e(i,t);return i&&("html"===Z(i)||"body"===Z(i)&&"static"===se(i).position&&!ie(i))?o:i||function(e){let t=de(e);for(;Q(t)&&!re(t);){if(ie(t))return t;t=de(t)}return null}(e)||o}const Xe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:o,offsetParent:i,strategy:n}=e;const r="fixed"===n,s=q(i),a=!!t&&Fe(t.floating);if(i===s||a&&r)return o;let d={scrollLeft:0,scrollTop:0},l=fe(1);const c=fe(0),p=Q(i);if((p||!p&&!r)&&(("body"!==Z(i)||te(s))&&(d=ae(i)),Q(i))){const e=Pe(i);l=Ae(i),c.x=e.x+i.clientLeft,c.y=e.y+i.clientTop}return{width:o.width*l.x,height:o.height*l.y,x:o.x*l.x-d.scrollLeft*l.x+c.x,y:o.y*l.y-d.scrollTop*l.y+c.y}},getDocumentElement:q,getClippingRect:function(e){let{element:t,boundary:o,rootBoundary:i,strategy:n}=e;const r=[..."clippingAncestors"===o?function(e,t){const o=t.get(e);if(o)return o;let i=ce(e,[],!1).filter((e=>K(e)&&"body"!==Z(e))),n=null;const r="fixed"===se(e).position;let s=r?de(e):e;for(;K(s)&&!re(s);){const t=se(s),o=ie(s);o||"fixed"!==t.position||(n=null),(r?!o&&!n:!o&&"static"===t.position&&n&&["absolute","fixed"].includes(n.position)||te(s)&&!o&&Ve(e,s))?i=i.filter((e=>e!==s)):n=t,s=de(s)}return t.set(e,i),i}(t,this._c):[].concat(o),i],s=r[0],a=r.reduce(((e,o)=>{const i=De(t,o,n);return e.top=ue(i.top,e.top),e.right=pe(i.right,e.right),e.bottom=pe(i.bottom,e.bottom),e.left=ue(i.left,e.left),e}),De(t,s,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Ye,getElementRects:async function(e){const t=this.getOffsetParent||Ye,o=this.getDimensions;return{reference:Ue(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await o(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:o}=Me(e);return{width:t,height:o}},getScale:Ae,isElement:K,isRTL:function(e){return"rtl"===se(e).direction}},Ze=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:n}=t,{mainAxis:r=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:o}=e;return{x:t,y:o}}},...d}=me(e,t),l={x:o,y:i},c=await Ne(t,d),p=ze(we(n)),u=xe(p);let h=l[u],f=l[p];if(r){const e="y"===u?"bottom":"right";h=ge(h+c["y"===u?"top":"left"],h,h-c[e])}if(s){const e="y"===p?"bottom":"right";f=ge(f+c["y"===p?"top":"left"],f,f-c[e])}const v=a.fn({...t,[u]:h,[p]:f});return{...v,data:{x:v.x-o,y:v.y-i}}}}},Ge=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:n,middlewareData:r,rects:s,initialPlacement:a,platform:d,elements:l}=t,{mainAxis:c=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:v=!0,...y}=me(e,t);if(null!=(o=r.arrow)&&o.alignmentOffset)return{};const g=we(n),m=we(a)===a,w=await(null==d.isRTL?void 0:d.isRTL(l.floating)),b=u||(m||!v?[_e(a)]:function(e){const t=_e(e);return[Re(e),t,Re(t)]}(a));u||"none"===f||b.push(...function(e,t,o,i){const n=be(e);let r=function(e,t,o){const i=["left","right"],n=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return o?t?n:i:t?i:n;case"left":case"right":return t?r:s;default:return[]}}(we(e),"start"===o,i);return n&&(r=r.map((e=>e+"-"+n)),t&&(r=r.concat(r.map(Re)))),r}(a,v,f,w));const x=[a,...b],C=await Ne(t,y),z=[];let S=(null==(i=r.flip)?void 0:i.overflows)||[];if(c&&z.push(C[g]),p){const e=function(e,t,o){void 0===o&&(o=!1);const i=be(e),n=Se(e),r=Ce(n);let s="x"===n?i===(o?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=_e(s)),[s,_e(s)]}(n,s,w);z.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:n,overflows:z}],!z.every((e=>e<=0))){var R,_;const e=((null==(R=r.flip)?void 0:R.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let o=null==(_=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:_.placement;if(!o)switch(h){case"bestFit":{var E;const e=null==(E=S.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:E[0];e&&(o=e);break}case"initialPlacement":o=a}if(n!==o)return{reset:{placement:o}}}return{}}}},qe=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:i,rects:n,platform:r,strategy:s}=t,{padding:a=2,x:d,y:l}=me(e,t),c=Array.from(await(null==r.getClientRects?void 0:r.getClientRects(i.reference))||[]),p=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),o=[];let i=null;for(let e=0;e<t.length;e++){const n=t[e];!i||n.y-i.y>i.height/2?o.push([n]):o[o.length-1].push(n),i=n}return o.map((e=>Oe(Le(e))))}(c),u=Oe(Le(c)),h=Ee(a);const f=await r.getElementRects({reference:{getBoundingClientRect:function(){if(2===p.length&&p[0].left>p[1].right&&null!=d&&null!=l)return p.find((e=>d>e.left-h.left&&d<e.right+h.right&&l>e.top-h.top&&l<e.bottom+h.bottom))||u;if(p.length>=2){if("y"===ze(o)){const e=p[0],t=p[p.length-1],i="top"===we(o),n=e.top,r=t.bottom,s=i?e.left:t.left,a=i?e.right:t.right;return{top:n,bottom:r,left:s,right:a,width:a-s,height:r-n,x:s,y:n}}const e="left"===we(o),t=ue(...p.map((e=>e.right))),i=pe(...p.map((e=>e.left))),n=p.filter((o=>e?o.left===i:o.right===t)),r=n[0].top,s=n[n.length-1].bottom;return{top:r,bottom:s,left:i,right:t,width:t-i,height:s-r,x:i,y:r}}return u}},floating:i.floating,strategy:s});return n.reference.x!==f.reference.x||n.reference.y!==f.reference.y||n.reference.width!==f.reference.width||n.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},Je=(e,t,o)=>{const i=new Map,n={platform:Xe,...o},r={...n.platform,_c:i};return(async(e,t,o)=>{const{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:s}=o,a=r.filter(Boolean),d=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:c,y:p}=ke(l,i,d),u=i,h={},f=0;for(let o=0;o<a.length;o++){const{name:r,fn:v}=a[o],{x:y,y:g,data:m,reset:w}=await v({x:c,y:p,initialPlacement:i,placement:u,strategy:n,middlewareData:h,rects:l,platform:s,elements:{reference:e,floating:t}});c=null!=y?y:c,p=null!=g?g:p,h={...h,[r]:{...h[r],...m}},w&&f<=50&&(f++,"object"==typeof w&&(w.placement&&(u=w.placement),w.rects&&(l=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:n}):w.rects),({x:c,y:p}=ke(l,u,d))),o=-1)}return{x:c,y:p,placement:u,strategy:n,middlewareData:h}})(e,t,{...n,platform:r})};var Ke="undefined"!=typeof document?v:h;function Qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let o,i,n;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(i=o;0!=i--;)if(!Qe(e[i],t[i]))return!1;return!0}if(n=Object.keys(e),o=n.length,o!==Object.keys(t).length)return!1;for(i=o;0!=i--;)if(!{}.hasOwnProperty.call(t,n[i]))return!1;for(i=o;0!=i--;){const o=n[i];if(("_owner"!==o||!e.$$typeof)&&!Qe(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function et(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tt(e,t){const o=et(e);return Math.round(t*o)/o}function ot(e){const t=p.useRef(e);return Ke((()=>{t.current=e})),t}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
@@ -3,6 +3,6 @@ type VideoComponentProps = Omit<VideoElementProps, 'sizes'> & {
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
};
|
|
6
|
-
declare const VideoComponent: ({ width, height, src,
|
|
6
|
+
declare const VideoComponent: ({ width, height, src, bgColor, poster, provider, fit }: VideoComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export { VideoComponent, VideoComponentProps };
|
|
8
8
|
//# sourceMappingURL=VideoComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoComponent.d.ts","sourceRoot":"","sources":["../../src/ui/VideoComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C,KAAK,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAQF,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"VideoComponent.d.ts","sourceRoot":"","sources":["../../src/ui/VideoComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C,KAAK,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAQF,QAAA,MAAM,cAAc,2DAA4D,mBAAmB,4CAmDlG,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/video",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.15",
|
|
4
4
|
"description": "Video plugin for Yoopta Editor",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@radix-ui/react-icons": "^1.3.0",
|
|
40
40
|
"re-resizable": "^6.9.11"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "ac662ec35e82d7b7379a2608a782808ed94f2ca9"
|
|
43
43
|
}
|