view x/static/js/6395.f6027b24.chunk.js @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
line wrap: on
line source

"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6395],{66395:(e,t,r)=>{r.d(t,{sk:()=>L,FO:()=>K,Ay:()=>P});var o=r(7552),a=r(87485),n=r(9555),l=r(98360),c=r(29629),s=r(1343),u=r(75785),i=r(40898),f=r(99546);function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var r,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t.indexOf(r=n[o])>=0||(a[r]=e[r]);return a}function g(e){const t=(0,o.useRef)(e),r=(0,o.useRef)((e=>{t.current&&t.current(e)}));return t.current=e,r.current}const m=(e,t=0,r=1)=>e>r?r:e<t?t:e,p=e=>"touches"in e,v=e=>e&&e.ownerDocument.defaultView||self,b=(e,t,r)=>{const o=e.getBoundingClientRect(),a=p(t)?((e,t)=>{for(let r=0;r<e.length;r++)if(e[r].identifier===t)return e[r];return e[0]})(t.touches,r):t;return{left:m((a.pageX-(o.left+v(e).pageXOffset))/o.width),top:m((a.pageY-(o.top+v(e).pageYOffset))/o.height)}},_=e=>{!p(e)&&e.preventDefault()},E=o.memo((e=>{let{onMove:t,onKey:r}=e,a=d(e,["onMove","onKey"]);const n=(0,o.useRef)(null),l=g(t),c=g(r),s=(0,o.useRef)(null),u=(0,o.useRef)(!1),[i,f,m]=(0,o.useMemo)((()=>{const e=e=>{_(e),(p(e)?e.touches.length>0:e.buttons>0)&&n.current?l(b(n.current,e,s.current)):r(!1)},t=()=>r(!1);function r(r){const o=u.current,a=v(n.current),l=r?a.addEventListener:a.removeEventListener;l(o?"touchmove":"mousemove",e),l(o?"touchend":"mouseup",t)}return[({nativeEvent:e})=>{const t=n.current;if(t&&(_(e),!((e,t)=>t&&!p(e))(e,u.current)&&t)){if(p(e)){u.current=!0;const t=e.changedTouches||[];t.length&&(s.current=t[0].identifier)}t.focus(),l(b(t,e,s.current)),r(!0)}},e=>{const t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),c({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},r]}),[c,l]);return(0,o.useEffect)((()=>m),[m]),o.createElement("div",h({},a,{onTouchStart:i,onMouseDown:i,className:"react-colorful__interactive",ref:n,onKeyDown:f,tabIndex:0,role:"slider"}))})),w=e=>e.filter(Boolean).join(" "),x=({className:e,color:t,left:r,top:a=.5})=>{const n=w(["react-colorful__pointer",e]);return o.createElement("div",{className:n,style:{top:100*a+"%",left:100*r+"%"}},o.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},y=(e,t=0,r=Math.pow(10,t))=>Math.round(r*e)/r,C=(Math.PI,({h:e,s:t,v:r,a:o})=>{const a=(200-t)*r/100;return{h:y(e),s:y(a>0&&a<200?t*r/100/(a<=100?a:200-a)*100:0),l:y(a/2),a:y(o,2)}}),k=e=>{const{h:t,s:r,l:o}=C(e);return`hsl(${t}, ${r}%, ${o}%)`},N=e=>{const{h:t,s:r,l:o,a}=C(e);return`hsla(${t}, ${r}%, ${o}%, ${a})`},M=({r:e,g:t,b:r,a:o})=>{const a=Math.max(e,t,r),n=a-Math.min(e,t,r),l=n?a===e?(t-r)/n:a===t?2+(r-e)/n:4+(e-t)/n:0;return{h:y(60*(l<0?l+6:l)),s:y(a?n/a*100:0),v:y(a/255*100),a:o}},$=o.memo((({className:e,hue:t,onChange:r})=>{const a=w(["react-colorful__hue",e]);return o.createElement("div",{className:a},o.createElement(E,{onMove:e=>{r({h:360*e.left})},onKey:e=>{r({h:m(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuetext":y(t)},o.createElement(x,{className:"react-colorful__hue-pointer",left:t/360,color:k({h:t,s:100,v:100,a:1})})))})),O=o.memo((({hsva:e,onChange:t})=>{const r={backgroundColor:k({h:e.h,s:100,v:100,a:1})};return o.createElement("div",{className:"react-colorful__saturation",style:r},o.createElement(E,{onMove:e=>{t({s:100*e.left,v:100-100*e.top})},onKey:r=>{t({s:m(e.s+100*r.left,0,100),v:m(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":`Saturation ${y(e.s)}%, Brightness ${y(e.v)}%`},o.createElement(x,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:k(e)})))}));function j(e,t,r){const a=g(r),[n,l]=(0,o.useState)((()=>e.toHsva(t))),c=(0,o.useRef)({color:t,hsva:n});(0,o.useEffect)((()=>{if(!e.equal(t,c.current.color)){const r=e.toHsva(t);c.current={hsva:r,color:t},l(r)}}),[t,e]),(0,o.useEffect)((()=>{let t;((e,t)=>{if(e===t)return!0;for(const r in e)if(e[r]!==t[r])return!1;return!0})(n,c.current.hsva)||e.equal(t=e.fromHsva(n),c.current.color)||(c.current={hsva:n,color:t},a(t))}),[n,e,a]);const s=(0,o.useCallback)((e=>{l((t=>Object.assign({},t,e)))}),[]);return[n,s]}const R="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;const H=new Map,S=({className:e,hsva:t,onChange:r})=>{const a={backgroundImage:`linear-gradient(90deg, ${N(Object.assign({},t,{a:0}))}, ${N(Object.assign({},t,{a:1}))})`},n=w(["react-colorful__alpha",e]);return o.createElement("div",{className:n},o.createElement("div",{className:"react-colorful__alpha-gradient",style:a}),o.createElement(E,{onMove:e=>{r({a:e.left})},onKey:e=>{r({a:m(t.a+e.left)})},"aria-label":"Alpha","aria-valuetext":`${y(100*t.a)}%`},o.createElement(x,{className:"react-colorful__alpha-pointer",left:t.a,color:N(t)})))},z=e=>{let{className:t,colorModel:a,color:n=a.defaultColor,onChange:l}=e,c=d(e,["className","colorModel","color","onChange"]);const s=(0,o.useRef)(null);var u;u=s,R((()=>{const e=u.current?u.current.ownerDocument:document;if(void 0!==e&&!H.has(e)){const t=e.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',H.set(e,t);const o=r.nc;o&&t.setAttribute("nonce",o),e.head.appendChild(t)}}),[]);const[i,f]=j(a,n,l),g=w(["react-colorful",t]);return o.createElement("div",h({},c,{ref:s,className:g}),o.createElement(O,{hsva:i,onChange:f}),o.createElement($,{hue:i.h,onChange:f}),o.createElement(S,{hsva:i,onChange:f,className:"react-colorful__last-control"}))},A={defaultColor:"rgba(0, 0, 0, 1)",toHsva:e=>{const t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?M({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},fromHsva:e=>{const{r:t,g:r,b:o,a}=(({h:e,s:t,v:r,a:o})=>{e=e/360*6,t/=100,r/=100;const a=Math.floor(e),n=r*(1-t),l=r*(1-(e-a)*t),c=r*(1-(1-e+a)*t),s=a%6;return{r:y(255*[r,l,n,n,c,r][s]),g:y(255*[c,r,r,l,n,n][s]),b:y(255*[n,n,c,r,r,l][s]),a:y(o,2)}})(e);return`rgba(${t}, ${r}, ${o}, ${a})`},equal:(e,t)=>e.replace(/\s/g,"")===t.replace(/\s/g,"")},D=e=>o.createElement(z,h({},e,{colorModel:A})),T=(0,u.n9)()({picker:{position:"relative"},swatches:{display:"flex",padding:12,flexWrap:"wrap"},swatch:{width:24,height:24,margin:4,border:"none",padding:0,cursor:"pointer",outline:"none"}});function K({anchorEl:e,onChange:t,onClose:r,color:a}){return o.createElement(n.Ay,{open:!!e,anchorEl:e,onClose:r},o.createElement(L,{color:a,onChange:t}))}function L({onChange:e,color:t}){const{classes:r}=T(),[n,u]=(0,f.useLocalStorage)("colorPickerPalette","set1"),h=i[n],d=Object.keys(i),[g,m]=(0,o.useState)(t),p=(0,a.M)(t).toRgbString(),v=(0,f.useDebounce)(p,1e3),b=t=>{m(t);try{e((0,a.M)(t).toRgbString())}catch(e){}};return o.createElement("div",{style:{display:"flex",padding:10}},o.createElement("div",{style:{width:200,margin:5}},o.createElement(D,{color:v,onChange:b})),o.createElement("div",{style:{width:200,margin:5}},o.createElement(l.A,{value:n,onChange:e=>{const t=e.target.value;u(t)}},d.map((e=>o.createElement(c.A,{value:e,key:e},e)))),o.createElement("div",{className:r.swatches},h.map(((e,t)=>o.createElement("button",{type:"button",key:`${e}-${t}`,className:r.swatch,style:{background:e},onClick:()=>{b(e)}})))),o.createElement(s.A,{helperText:"Manually set color (hex, rgb, or css color name)",value:g,onChange:e=>{b(e.target.value)}})))}const P=({color:e,onChange:t})=>{const[r,a]=(0,o.useState)(null),{classes:n}=T();return o.createElement("div",{className:n.picker},o.createElement("div",{className:n.swatch,style:{backgroundColor:e},onClick:e=>{a(e.currentTarget)}}),o.createElement(K,{anchorEl:r,onClose:()=>{a(null)},color:e,onChange:t}))}}}]);
//# sourceMappingURL=6395.f6027b24.chunk.js.map