@crystaldesign/media-upload 25.14.0-rc.8 → 25.15.0-beta.10
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 344.media-upload.umd.min.js.LICENSE.txt */
|
|
2
|
-
(self.webpackChunkCrystaldesignMediaUpload=self.webpackChunkCrystaldesignMediaUpload||[]).push([[344],{6437:(e,t,n)=>{"use strict";n.d(t,{Z:()=>
|
|
2
|
+
(self.webpackChunkCrystaldesignMediaUpload=self.webpackChunkCrystaldesignMediaUpload||[]).push([[344],{6437:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var a=n(6177),r=n(7514);const i=(0,a.Z)((0,r.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack")},8942:(e,t,n)=>{var a=n(5108),r="undefined"!=typeof Element,i="function"==typeof Map,s="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,a,f,c;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(a=n;0!=a--;)if(!equal(e[a],t[a]))return!1;return!0}if(i&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(c=e.entries();!(a=c.next()).done;)if(!t.has(a.value[0]))return!1;for(c=e.entries();!(a=c.next()).done;)if(!equal(a.value[1],t.get(a.value[0])))return!1;return!0}if(s&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(c=e.entries();!(a=c.next()).done;)if(!t.has(a.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((n=e.length)!=t.length)return!1;for(a=n;0!=a--;)if(e[a]!==t[a])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if((n=(f=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,f[a]))return!1;if(r&&e instanceof Element)return!1;for(a=n;0!=a--;)if(("_owner"!==f[a]&&"__v"!==f[a]&&"__o"!==f[a]||!e.$$typeof)&&!equal(e[f[a]],t[f[a]]))return!1;return!0}return e!=e&&t!=t}e.exports=function isEqual(e,t){try{return equal(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return a.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},4376:(e,t,n)=>{"use strict";n.d(t,{Z:()=>lib_Snowfall});var a=n(7363),r=n(8942);function random(e,t){return Number.isInteger(e)&&Number.isInteger(t)?Math.floor(Math.random()*(t-e+1)+e):Math.random()*(t-e)+e}function lerp(e,t,n){return(1-n)*e+n*t}function getSize(e){return e?{height:e.offsetHeight,width:e.offsetWidth}:{height:0,width:0}}const i=2*Math.PI,s={color:"#dee4fd",radius:[.5,3],speed:[1,3],wind:[-.5,2],changeFrequency:200,rotationSpeed:[-1,1],opacity:[1,1]};class Snowflake{static createSnowflakes(e,t,n){if(!e)return[];const a=[];for(let r=0;r<t;r++)a.push(new Snowflake(e,n));return a}constructor(e,t={}){this.updateConfig(t);const{radius:n,wind:a,speed:r,rotationSpeed:i,opacity:s}=this.config;this.params={x:random(0,e.offsetWidth),y:random(-e.offsetHeight,0),rotation:random(0,360),radius:random(...n),speed:random(...r),wind:random(...a),rotationSpeed:random(...i),nextSpeed:random(...r),nextWind:random(...a),nextRotationSpeed:random(...i),opacity:random(...s),hasNextOpacity:!1},this.framesSinceLastUpdate=0}selectImage(){this.config.images&&this.config.images.length>0?this.image=function randomElement(e){return e[Math.floor(Math.random()*e.length)]}(this.config.images):this.image=void 0}updateConfig(e){const t=this.config;this.config={...s,...e},this.config.changeFrequency=random(this.config.changeFrequency,1.5*this.config.changeFrequency),this.params&&!r(this.config.radius,null==t?void 0:t.radius)&&(this.params.radius=random(...this.config.radius)),r(this.config.images,null==t?void 0:t.images)||this.selectImage(),(null==t?void 0:t.opacity)&&!r(this.config.opacity,null==t?void 0:t.opacity)&&(this.params.hasNextOpacity=!0)}updateTargetParams(){this.params.nextSpeed=random(...this.config.speed),this.params.nextWind=random(...this.config.wind),this.image&&(this.params.nextRotationSpeed=random(...this.config.rotationSpeed))}update(e,t,n=1){const{x:a,y:r,rotation:i,rotationSpeed:s,nextRotationSpeed:o,wind:f,speed:c,nextWind:u,nextSpeed:h,radius:d}=this.params;this.params.x=(a+f*n)%(e+2*d),this.params.x>e+d&&(this.params.x=-d),this.params.y=(r+c*n)%(t+2*d),this.params.y>t+d&&(this.params.hasNextOpacity&&(this.params.opacity=random(...this.config.opacity),this.params.hasNextOpacity=!1),this.params.y=-d),this.image&&(this.params.rotation=(i+s)%360),this.params.speed=lerp(c,h,.01),this.params.wind=lerp(f,u,.01),this.params.rotationSpeed=lerp(s,o,.01),this.framesSinceLastUpdate++>this.config.changeFrequency&&(this.updateTargetParams(),this.framesSinceLastUpdate=0)}getImageOffscreenCanvas(e,t){var n,a;if(e instanceof HTMLImageElement&&e.loading)return e;let r=Snowflake.offscreenCanvases.get(e);if(r||(r={},Snowflake.offscreenCanvases.set(e,r)),!(t in r)){const a=document.createElement("canvas");a.width=t,a.height=t,null===(n=a.getContext("2d"))||void 0===n||n.drawImage(e,0,0,t,t),r[t]=a}return null!==(a=r[t])&&void 0!==a?a:e}drawCircle(e){e.moveTo(this.params.x,this.params.y),e.arc(this.params.x,this.params.y,this.params.radius,0,i)}drawImage(e){const{x:t,y:n,rotation:a,radius:r}=this.params,i=a*Math.PI/180,s=Math.cos(i),o=Math.sin(i);1!==this.params.opacity&&(e.save(),e.globalAlpha=this.params.opacity),e.setTransform(s,o,-o,s,t,n);const f=this.getImageOffscreenCanvas(this.image,r);e.drawImage(f,-r/2,-r/2,r,r),1!==this.params.opacity&&e.restore()}}Snowflake.offscreenCanvases=new WeakMap;const o=Snowflake,f={pointerEvents:"none",backgroundColor:"transparent",position:"absolute",top:0,left:0,width:"100%",height:"100%"};var c,u,__classPrivateFieldGet=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},__classPrivateFieldSet=function(e,t,n,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,n):r?r.value=n:t.set(e,n),n};class SnowfallCanvas{get ctx(){return __classPrivateFieldGet(this,c,"f")}get canvas(){return __classPrivateFieldGet(this,u,"f")}set canvas(e){__classPrivateFieldSet(this,u,e,"f"),__classPrivateFieldSet(this,c,e.getContext("2d"),"f")}constructor(e,t){this.lastUpdate=Date.now(),this.snowflakes=[],c.set(this,void 0),u.set(this,void 0),__classPrivateFieldSet(this,u,e,"f"),__classPrivateFieldSet(this,c,e.getContext("2d"),"f"),this.config={snowflakeCount:150,...s,...t},this.snowflakes=[],this.snowflakes=o.createSnowflakes(e,t.snowflakeCount||150,t),this.play()}updateConfig(e){this.config={...this.config,...e};const t=this.config.snowflakeCount-this.snowflakes.length;t>0&&(this.snowflakes=[...this.snowflakes,...o.createSnowflakes(this.canvas,t,e)]),t<0&&(this.snowflakes=this.snowflakes.slice(0,this.config.snowflakeCount));for(const e of this.snowflakes)e.updateConfig(this.config)}render(e=1){const{ctx:t,canvas:n,snowflakes:a}=this;if(!t||!n)return;const{offsetWidth:r,offsetHeight:i}=n;for(const t of a)t.update(r,i,e);if(t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,r,i),this.config.images&&this.config.images.length>0)for(const e of a)e.drawImage(t);else{t.beginPath();for(const e of a)e.drawCircle(t);t.fillStyle=this.config.color,t.fill()}}loop(){const e=Date.now(),t=Date.now()-this.lastUpdate;this.lastUpdate=e;const n=t/16.666666666666668;this.render(n),this.animationFrame=requestAnimationFrame((()=>this.loop()))}play(){this.loop()}pause(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=void 0)}}c=new WeakMap,u=new WeakMap;function useDeepMemo(e){const[t,n]=(0,a.useState)(e);return function useDeepCompareEffect(e,t){const n=(0,a.useRef)(t);return r(t,n.current)||(n.current=t),(0,a.useEffect)(e,n.current)}((()=>n(e)),[e]),t}const lib_Snowfall=({color:e=s.color,changeFrequency:t=s.changeFrequency,radius:n=s.radius,speed:r=s.speed,wind:i=s.wind,rotationSpeed:o=s.rotationSpeed,opacity:c=s.opacity,snowflakeCount:u=150,images:h,style:d}={})=>{const l=(p=d,(0,a.useMemo)((()=>({...f,...p||{}})),[p]));var p;const m=(0,a.useRef)(null),g=(e=>{const[t,n]=(0,a.useState)(getSize(e.current)),r=(0,a.useCallback)((()=>{e.current&&n(getSize(e.current))}),[e]);return(0,a.useEffect)((()=>{const{ResizeObserver:t}=window;if(e.current){if(r(),"function"==typeof t){const n=new t(r);return n.observe(e.current),()=>n.disconnect()}return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)}}),[e,r]),t})(m),w=useDeepMemo({color:e,changeFrequency:t,radius:n,speed:r,wind:i,rotationSpeed:o,images:h,snowflakeCount:u,opacity:c}),y=(0,a.useRef)(w),v=(0,a.useRef)();return(0,a.useEffect)((()=>(!v.current&&m.current&&(v.current=new SnowfallCanvas(m.current,y.current)),()=>{var e;null===(e=v.current)||void 0===e||e.pause(),v.current=void 0})),[]),(0,a.useEffect)((()=>{v.current&&v.current.updateConfig(w)}),[w]),a.createElement("canvas",{ref:m,height:g.height,width:g.width,style:l,"data-testid":"SnowfallCanvas"})}}}]);
|