2 lines
19 KiB
JavaScript
2 lines
19 KiB
JavaScript
"use strict";(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[955],{3929:(t,e,i)=>{i.d(e,{c:()=>W});var s,o=i(62540),r=i(85959),n=i(48398),h=function(){return h=Object.assign||function(t){for(var e,i=1,s=arguments.length;i<s;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},h.apply(this,arguments)},a={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},p={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},l={width:"20px",height:"20px",position:"absolute",zIndex:1},u={top:h(h({},a),{top:"-5px"}),right:h(h({},p),{left:void 0,right:"-5px"}),bottom:h(h({},a),{top:void 0,bottom:"-5px"}),left:h(h({},p),{left:"-5px"}),topRight:h(h({},l),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:h(h({},l),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:h(h({},l),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:h(h({},l),{left:"-10px",top:"-10px",cursor:"nw-resize"})},d=(0,r.memo)(function(t){var e=t.onResizeStart,i=t.direction,s=t.children,n=t.replaceStyles,a=t.className,p=(0,r.useCallback)(function(t){e(t,i)},[e,i]),l=(0,r.useCallback)(function(t){e(t,i)},[e,i]),d=(0,r.useMemo)(function(){return h(h({position:"absolute",userSelect:"none"},u[i]),null!=n?n:{})},[n,i]);return(0,o.jsx)("div",{className:a||void 0,style:d,onMouseDown:p,onTouchStart:l,children:s})}),c=(s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),f=function(){return f=Object.assign||function(t){for(var e,i=1,s=arguments.length;i<s;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},f.apply(this,arguments)},g={width:"auto",height:"auto"},v=function(t,e,i){return Math.max(Math.min(t,i),e)},w=function(t,e,i){var s=Math.round(t/e);return s*e+i*(s-1)},b=function(t,e){return new RegExp(t,"i").test(e)},z=function(t){return Boolean(t.touches&&t.touches.length)},m=function(t,e,i){void 0===i&&(i=0);var s=e.reduce(function(i,s,o){return Math.abs(s-t)<Math.abs(e[i]-t)?o:i},0),o=Math.abs(e[s]-t);return 0===i||o<i?e[s]:t},y=function(t){return"auto"===(t=t.toString())||t.endsWith("px")||t.endsWith("%")||t.endsWith("vh")||t.endsWith("vw")||t.endsWith("vmax")||t.endsWith("vmin")?t:"".concat(t,"px")},x=function(t,e,i,s){if(t&&"string"==typeof t){if(t.endsWith("px"))return Number(t.replace("px",""));if(t.endsWith("%"))return e*(Number(t.replace("%",""))/100);if(t.endsWith("vw"))return i*(Number(t.replace("vw",""))/100);if(t.endsWith("vh"))return s*(Number(t.replace("vh",""))/100)}return t},S=["as","ref","style","className","grid","gridGap","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"],R="__resizable_base__",W=function(t){function e(e){var i,s,o,r,n=t.call(this,e)||this;return n.ratio=1,n.resizable=null,n.parentLeft=0,n.parentTop=0,n.resizableLeft=0,n.resizableRight=0,n.resizableTop=0,n.resizableBottom=0,n.targetLeft=0,n.targetTop=0,n.delta={width:0,height:0},n.appendBase=function(){if(!n.resizable||!n.window)return null;var t=n.parentNode;if(!t)return null;var e=n.window.document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.transform="scale(0, 0)",e.style.left="0",e.style.flex="0 0 100%",e.classList?e.classList.add(R):e.className+=R,t.appendChild(e),e},n.removeBase=function(t){var e=n.parentNode;e&&e.removeChild(t)},n.state={isResizing:!1,width:null!==(s=null===(i=n.propsSize)||void 0===i?void 0:i.width)&&void 0!==s?s:"auto",height:null!==(r=null===(o=n.propsSize)||void 0===o?void 0:o.height)&&void 0!==r?r:"auto",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},n.onResizeStart=n.onResizeStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n}return c(e,t),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||g},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=0,e=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,o=this.resizable.style.position;"relative"!==o&&(this.resizable.style.position="relative"),t="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,e="auto"!==this.resizable.style.height?this.resizable.offsetHeight:s,this.resizable.style.position=o}return{width:t,height:e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sizeStyle",{get:function(){var t=this,e=this.props.size,i=function(e){var i;if(void 0===t.state[e]||"auto"===t.state[e])return"auto";if(t.propsSize&&t.propsSize[e]&&(null===(i=t.propsSize[e])||void 0===i?void 0:i.toString().endsWith("%"))){if(t.state[e].toString().endsWith("%"))return t.state[e].toString();var s=t.getParentSize(),o=Number(t.state[e].toString().replace("px",""))/s[e]*100;return"".concat(o,"%")}return y(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?y(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?y(e.height):i("height")}},enumerable:!1,configurable:!0}),e.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var t=this.appendBase();if(!t)return{width:0,height:0};var e=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(e=!0,this.parentNode.style.flexWrap="wrap"),t.style.position="relative",t.style.minWidth="100%",t.style.minHeight="100%";var s={width:t.offsetWidth,height:t.offsetHeight};return e&&(this.parentNode.style.flexWrap=i),this.removeBase(t),s},e.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))},e.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))},e.prototype.componentDidMount=function(){if(this.resizable&&this.window){var t=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==t.flexBasis?t.flexBasis:void 0})}},e.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},e.prototype.createSizeForCssProperty=function(t,e){var i=this.propsSize&&this.propsSize[e];return"auto"!==this.state[e]||this.state.original[e]!==t||void 0!==i&&"auto"!==i?t:"auto"},e.prototype.calculateNewMaxFromBoundary=function(t,e){var i,s,o=this.props.boundsByDirection,r=this.state.direction,n=o&&b("left",r),h=o&&b("top",r);if("parent"===this.props.bounds){var a=this.parentNode;a&&(i=n?this.resizableRight-this.parentLeft:a.offsetWidth+(this.parentLeft-this.resizableLeft),s=h?this.resizableBottom-this.parentTop:a.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=n?this.resizableRight:this.window.innerWidth-this.resizableLeft,s=h?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=n?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),s=h?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(t=t&&t<i?t:i),s&&Number.isFinite(s)&&(e=e&&e<s?e:s),{maxWidth:t,maxHeight:e}},e.prototype.calculateNewSizeFromDirection=function(t,e){var i,s=this.props.scale||1,o=(i=this.props.resizeRatio||1,Array.isArray(i)?i:[i,i]),r=o[0],n=o[1],h=this.state,a=h.direction,p=h.original,l=this.props,u=l.lockAspectRatio,d=l.lockAspectRatioExtraHeight,c=l.lockAspectRatioExtraWidth,f=p.width,g=p.height,v=d||0,w=c||0;return b("right",a)&&(f=p.width+(t-p.x)*r/s,u&&(g=(f-w)/this.ratio+v)),b("left",a)&&(f=p.width-(t-p.x)*r/s,u&&(g=(f-w)/this.ratio+v)),b("bottom",a)&&(g=p.height+(e-p.y)*n/s,u&&(f=(g-v)*this.ratio+w)),b("top",a)&&(g=p.height-(e-p.y)*n/s,u&&(f=(g-v)*this.ratio+w)),{newWidth:f,newHeight:g}},e.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,s){var o=this.props,r=o.lockAspectRatio,n=o.lockAspectRatioExtraHeight,h=o.lockAspectRatioExtraWidth,a=void 0===s.width?10:s.width,p=void 0===i.width||i.width<0?t:i.width,l=void 0===s.height?10:s.height,u=void 0===i.height||i.height<0?e:i.height,d=n||0,c=h||0;if(r){var f=(l-d)*this.ratio+c,g=(u-d)*this.ratio+c,w=(a-c)/this.ratio+d,b=(p-c)/this.ratio+d,z=Math.max(a,f),m=Math.min(p,g),y=Math.max(l,w),x=Math.min(u,b);t=v(t,z,m),e=v(e,y,x)}else t=v(t,a,p),e=v(e,l,u);return{newWidth:t,newHeight:e}},e.prototype.setBoundingClientRect=function(){var t=1/(this.props.scale||1);if("parent"===this.props.bounds){var e=this.parentNode;if(e){var i=e.getBoundingClientRect();this.parentLeft=i.left*t,this.parentTop=i.top*t}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*t,this.targetTop=s.top*t}if(this.resizable){var o=this.resizable.getBoundingClientRect(),r=o.left,n=o.top,h=o.right,a=o.bottom;this.resizableLeft=r*t,this.resizableRight=h*t,this.resizableTop=n*t,this.resizableBottom=a*t}},e.prototype.onResizeStart=function(t,e){if(this.resizable&&this.window){var i,s=0,o=0;if(t.nativeEvent&&function(t){return Boolean((t.clientX||0===t.clientX)&&(t.clientY||0===t.clientY))}(t.nativeEvent)?(s=t.nativeEvent.clientX,o=t.nativeEvent.clientY):t.nativeEvent&&z(t.nativeEvent)&&(s=t.nativeEvent.touches[0].clientX,o=t.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(t,e,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 n=this.parentNode;if(n){var h=this.window.getComputedStyle(n).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",i=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var a={original:{x:s,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:f(f({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(a)}},e.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&z(t))try{t.preventDefault(),t.stopPropagation()}catch(t){}var i=this.props,s=i.maxWidth,o=i.maxHeight,r=i.minWidth,h=i.minHeight,a=z(t)?t.touches[0].clientX:t.clientX,p=z(t)?t.touches[0].clientY:t.clientY,l=this.state,u=l.direction,d=l.original,c=l.width,f=l.height,g=this.getParentSize(),v=function(t,e,i,s,o,r,n){return s=x(s,t.width,e,i),o=x(o,t.height,e,i),r=x(r,t.width,e,i),n=x(n,t.height,e,i),{maxWidth:void 0===s?void 0:Number(s),maxHeight:void 0===o?void 0:Number(o),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===n?void 0:Number(n)}}(g,this.window.innerWidth,this.window.innerHeight,s,o,r,h);s=v.maxWidth,o=v.maxHeight,r=v.minWidth,h=v.minHeight;var b=this.calculateNewSizeFromDirection(a,p),y=b.newHeight,S=b.newWidth,R=this.calculateNewMaxFromBoundary(s,o);this.props.snap&&this.props.snap.x&&(S=m(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(y=m(y,this.props.snap.y,this.props.snapGap));var W=this.calculateNewSizeFromAspectRatio(S,y,{width:R.maxWidth,height:R.maxHeight},{width:r,height:h});if(S=W.newWidth,y=W.newHeight,this.props.grid){var E=w(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),k=w(y,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),M=this.props.snapGap||0;S=0===M||Math.abs(E-S)<=M?E:S,y=0===M||Math.abs(k-y)<=M?k:y}var C={width:S-d.width,height:y-d.height};if(this.delta=C,c&&"string"==typeof c)if(c.endsWith("%")){var H=S/g.width*100;S="".concat(H,"%")}else if(c.endsWith("vw")){var N=S/this.window.innerWidth*100;S="".concat(N,"vw")}else if(c.endsWith("vh")){var B=S/this.window.innerHeight*100;S="".concat(B,"vh")}if(f&&"string"==typeof f)if(f.endsWith("%")){H=y/g.height*100;y="".concat(H,"%")}else if(f.endsWith("vw")){N=y/this.window.innerWidth*100;y="".concat(N,"vw")}else if(f.endsWith("vh")){B=y/this.window.innerHeight*100;y="".concat(B,"vh")}var L={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(y,"height")};"row"===this.flexDir?L.flexBasis=L.width:"column"===this.flexDir&&(L.flexBasis=L.height);var P=this.state.width!==L.width,A=this.state.height!==L.height,O=this.state.flexBasis!==L.flexBasis,j=P||A||O;j&&(0,n.flushSync)(function(){e.setState(L)}),this.props.onResize&&j&&this.props.onResize(t,u,this.resizable,C)}},e.prototype.onMouseUp=function(t){var e,i,s=this.state,o=s.isResizing,r=s.direction;s.original;o&&this.resizable&&(this.props.onResizeStop&&this.props.onResizeStop(t,r,this.resizable,this.delta),this.props.size&&this.setState({width:null!==(e=this.props.size.width)&&void 0!==e?e:"auto",height:null!==(i=this.props.size.height)&&void 0!==i?i:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:f(f({},this.state.backgroundStyle),{cursor:"auto"})}))},e.prototype.updateSize=function(t){var e,i;this.setState({width:null!==(e=t.width)&&void 0!==e?e:"auto",height:null!==(i=t.height)&&void 0!==i?i:"auto"})},e.prototype.renderResizer=function(){var t=this,e=this.props,i=e.enable,s=e.handleStyles,r=e.handleClasses,n=e.handleWrapperStyle,h=e.handleWrapperClass,a=e.handleComponent;if(!i)return null;var p=Object.keys(i).map(function(e){return!1!==i[e]?(0,o.jsx)(d,{direction:e,onResizeStart:t.onResizeStart,replaceStyles:s&&s[e],className:r&&r[e],children:a&&a[e]?a[e]:null},e):null});return(0,o.jsx)("div",{className:h,style:n,children:p})},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce(function(e,i){return-1!==S.indexOf(i)||(e[i]=t.props[i]),e},{}),i=f(f(f({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 s=this.props.as||"div";return(0,o.jsxs)(s,f({style:i,className:this.props.className},e,{ref:function(e){e&&(t.resizable=e)},children:[this.state.isResizing&&(0,o.jsx)("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},e.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],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},e}(r.PureComponent)},79724:(t,e,i)=>{i.d(e,{w:()=>a});var s=i(85959);const o="undefined"!=typeof document?s.useLayoutEffect:()=>{};var r;const n=null!==(r=s.useInsertionEffect)&&void 0!==r?r:o;function h(t){const e=(0,s.useRef)(null);return n(()=>{e.current=t},[t]),(0,s.useCallback)((...t)=>{const i=e.current;return null==i?void 0:i(...t)},[])}function a(t){const{ref:e,box:i,onResize:o}=t;let r=h(o);(0,s.useEffect)(()=>{let t=null==e?void 0:e.current;if(t){if(void 0===window.ResizeObserver)return window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)};{const e=new window.ResizeObserver(t=>{t.length&&r()});return e.observe(t,{box:i}),()=>{t&&e.unobserve(t)}}}},[e,i])}},97228:(t,e,i)=>{i.d(e,{F:()=>a,P:()=>n});var s=i(85959),o=i(62540),r=(0,s.createContext)(void 0),n=({children:t,enabled:e=!0,horizontal:i=!0,onSync:n,proportional:h=!0,vertical:a=!0})=>{const p=(0,s.useRef)({}),l=(0,s.useCallback)((t,e)=>!!p.current[e]&&p.current[e].find(e=>e===t),[]),u=(0,s.useCallback)((t,e)=>{const{clientHeight:s,clientWidth:o,scrollHeight:r,scrollLeft:n,scrollTop:p,scrollWidth:l}=t,u=r-s,d=l-o,c=e.scrollHeight-s,f=e.scrollWidth-o;a&&u>0&&(e.scrollTop=h?c*p/u:p),i&&d>0&&(e.scrollLeft=h?f*n/d:n)},[h,a,i]),d=(0,s.useCallback)(t=>{t.onscroll=null},[]),c=(0,s.useCallback)((t,i)=>{t.onscroll=()=>{e&&(window.requestAnimationFrame(()=>{i.forEach(e=>{p.current[e]?.forEach(e=>{t!==e&&(d(e),u(t,e),window.requestAnimationFrame(()=>{const t=Object.keys(p.current).filter(t=>p.current[t].includes(e));c(e,t)}))})})}),n&&n(t))}},[n,d,u,e]),f=(0,s.useCallback)((t,e)=>{e.forEach(e=>{p.current[e]||(p.current[e]=[]),l(t,e)||(p.current[e].length>0&&u(p.current[e][0],t),p.current[e].push(t))}),c(t,e)},[l,u,c]),g=(0,s.useCallback)((t,e)=>{e.forEach(e=>{if(l(t,e)){d(t);const i=p.current[e].indexOf(t);-1!==i&&p.current[e].splice(i,1)}})},[l,d]);return(0,o.jsx)(r.Provider,{value:{registerPane:f,unregisterPane:g},children:s.Children.only(t)})},h=t=>Array.isArray(t)?t:[t],a=({attachTo:t,children:e,enabled:i=!0,group:o="default",innerRef:n})=>{const a=(()=>{const t=(0,s.useContext)(r);if(!t)throw new Error("useScrollSyncContext must be used within a ScrollSyncProvider");return t})(),p=(0,s.useRef)(null),l=(0,s.useRef)(null),u=(0,s.useCallback)(()=>{l.current=t?"function"==typeof t?null:t.current:p.current},[t]);return(0,s.useEffect)(()=>(u(),i&&l.current&&a.registerPane(l.current,h(o)),()=>{i&&l.current&&a.unregisterPane(l.current,h(o))}),[a,i,o,t,u]),t?e:(0,s.cloneElement)(e,{ref:t=>{p.current=t,"function"==typeof n?n(t):n&&t&&(n.current=t)}})}}}]);
|
|
//# sourceMappingURL=955.js.map?_cache=a33e9e6b7ad763d553e9
|