oops-ui 0.0.9 → 0.0.11
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/BackgroundRipple/index.cjs +1 -1
- package/dist/BackgroundRipple/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/styles/common.css +7 -5
- package/dist/styles/common.scss +8 -5
- package/dist/useRipples/index.cjs +1 -1
- package/dist/useRipples/index.mjs +1 -1
- package/package.json +4 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function u(e){return e.endsWith("%")}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,C=new WeakMap,L=new WeakMap,I=new WeakMap,j=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r){var n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(o=n,a=ne),a.add(o),F(n,"defaults",g),F(n,"interactive",n.defaults.interactive),P(n,U,n.defaults.accelerating),P(n,M,n.defaults.resolution),P(n,C,n.defaults.perturbance),F(n,"dropRadius",void 0),F(n,"crossOrigin",""),F(n,"imageUrl",void 0),F(n,"idleFluctuations",!0),P(n,L,void 0),P(n,I,void 0),P(n,j,[]),P(n,B,[]),P(n,W,0),P(n,X,1),P(n,N,void 0),P(n,G,!1),P(n,z,!1),P(n,H,!1),P(n,Y,0),P(n,q,""),F(n,"imageSource",""),F(n,"renderProgram",void 0),P(n,K,void 0),P(n,V,void 0),P(n,J,void 0),P(n,Q,void 0),P(n,Z,void 0),P(n,$,void 0),P(n,ee,Date.now()),P(n,te,n.defaults.raindropsTimeInterval),P(n,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=b(b({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,R(n);var u=n.gl,l=1/O(M,n);k(I,n,new Float32Array([l,l])),k(L,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(O(M,n)*O(M,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,O(M,n),O(M,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),O(j,n).push(p),O(B,n).push(m)}return k(N,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,O(N,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),D(ne,n,de).call(n),D(ne,n,pe).call(n),D(ne,n,me).call(n),D(ne,n,ae).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),k(G,n,!0),k(z,n,!0),k(H,n,!0),D(ne,n,oe).call(n),k(Y,n,requestAnimationFrame((function(){return D(ne,n,se).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(C,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,u=Math.max(o,a);r/=u;var l=new Float32Array([(2*e-o)/u,(a-2*t)/u]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(B,this)[O(W,this)]),Reflect.apply(s,this,[O(j,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,l),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),O(z,this)&&D(ne,this,ce).call(this),D(ne,this,le).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function ue(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function le(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(C,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,ue).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(B,this)[O(W,this)]),Reflect.apply(s,this,[O(j,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):u(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var l=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*l,r=O(Z,this)*l}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,u(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),u(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=u(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=u(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(I,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(I,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=O(L,this).getBoundingClientRect();this.drop(e.pageX-a.left-i,e.pageY-a.top-o,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>s});var i=r(953),o=r.n(i),a=r(982);function s(e){var t=(0,i.useRef)(null);return function(e,t){(0,i.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,a.useRipples)(t,e),e),e.children?o().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,o().createElement("canvas",{ref:t})):o().createElement("canvas",{ref:t})}module.exports["oops-ui"]=n})();
|
|
1
|
+
(()=>{"use strict";var e={982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function l(e){return e.endsWith("%")}function u(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(u,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,C=new WeakMap,L=new WeakMap,I=new WeakMap,j=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r){var n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(o=n,a=ne),a.add(o),F(n,"defaults",g),F(n,"interactive",n.defaults.interactive),P(n,U,n.defaults.accelerating),P(n,M,n.defaults.resolution),P(n,C,n.defaults.perturbance),F(n,"dropRadius",void 0),F(n,"crossOrigin",""),F(n,"imageUrl",void 0),F(n,"idleFluctuations",!0),P(n,L,void 0),P(n,I,void 0),P(n,j,[]),P(n,B,[]),P(n,W,0),P(n,X,1),P(n,N,void 0),P(n,G,!1),P(n,z,!1),P(n,H,!1),P(n,Y,0),P(n,q,""),F(n,"imageSource",""),F(n,"renderProgram",void 0),P(n,K,void 0),P(n,V,void 0),P(n,J,void 0),P(n,Q,void 0),P(n,Z,void 0),P(n,$,void 0),P(n,ee,Date.now()),P(n,te,n.defaults.raindropsTimeInterval),P(n,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=b(b({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,R(n);var l=n.gl,u=1/O(M,n);k(I,n,new Float32Array([u,u])),k(L,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return l.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(O(M,n)*O(M,n)*4):null,h=n.config,d=0;d<2;d++){var p=l.createTexture(),m=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,m),l.bindTexture(l.TEXTURE_2D,p),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,O(M,n),O(M,n),0,l.RGBA,h.type,f),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,p,0),O(j,n).push(p),O(B,n).push(m)}return k(N,n,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,O(N,n)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),D(ne,n,de).call(n),D(ne,n,pe).call(n),D(ne,n,me).call(n),D(ne,n,ae).call(n),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),k(G,n,!0),k(z,n,!0),k(H,n,!0),D(ne,n,oe).call(n),k(Y,n,requestAnimationFrame((function(){return D(ne,n,se).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(C,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,l=Math.max(o,a);r/=l;var u=new Float32Array([(2*e-o)/l,(a-2*t)/l]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(B,this)[O(W,this)]),Reflect.apply(s,this,[O(j,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,u),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,le).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),D(ne,this,ce).call(this),D(ne,this,ue).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function le(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function ue(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(C,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,le).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations&&O(z,this)){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(B,this)[O(W,this)]),Reflect.apply(s,this,[O(j,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,le).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):l(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var u=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*u,r=O(Z,this)*u}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,l(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),l(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=l(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=l(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(I,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(I,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=O(L,this).getBoundingClientRect(),s=e.clientX-a.left-i,l=e.clientY-a.top-o;this.drop(s,l,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>s});var i=r(953),o=r.n(i),a=r(982);function s(e){var t=(0,i.useRef)(null);return function(e,t){(0,i.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,a.useRipples)(t,e),e),e.children?o().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,o().createElement("canvas",{ref:t})):o().createElement("canvas",{ref:t})}module.exports["oops-ui"]=n})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"a-element-inline-style";import*as t from"react";var r={566:(t,r,n)=>{n.d(r,{n:()=>Re});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function u(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function l(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}function U(e,t){return e.get(C(e,t))}function M(e,t,r){return e.set(C(e,t),r),r}function C(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var L=new WeakMap,I=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(i=n,a=ae),a.add(i),k(n,"defaults",b),k(n,"interactive",n.defaults.interactive),A(n,L,n.defaults.accelerating),A(n,I,n.defaults.resolution),A(n,B,n.defaults.perturbance),k(n,"dropRadius",void 0),k(n,"crossOrigin",""),k(n,"imageUrl",void 0),k(n,"idleFluctuations",!0),A(n,W,void 0),A(n,X,void 0),A(n,j,[]),A(n,N,[]),A(n,G,0),A(n,z,1),A(n,H,void 0),A(n,Y,!1),A(n,q,!1),A(n,K,!1),A(n,V,0),A(n,J,""),k(n,"imageSource",""),k(n,"renderProgram",void 0),A(n,Q,void 0),A(n,Z,void 0),A(n,$,void 0),A(n,ee,void 0),A(n,te,void 0),A(n,re,void 0),A(n,ne,Date.now()),A(n,ie,n.defaults.raindropsTimeInterval),A(n,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=w(w({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,x(n);var u=n.gl,l=1/U(I,n);M(X,n,new Float32Array([l,l])),M(W,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(U(I,n)*U(I,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,U(I,n),U(I,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),U(j,n).push(p),U(N,n).push(m)}return M(H,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,U(H,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),C(ae,n,ve).call(n),C(ae,n,ge).call(n),C(ae,n,Ee).call(n),C(ae,n,le).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),M(Y,n,!0),M(q,n,!0),M(K,n,!0),C(ae,n,ue).call(n),M(V,n,requestAnimationFrame((function(){return C(ae,n,ce).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||M(L,this,e)}},{key:"resolution",set:function(e){e<100||e>550||M(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||M(B,this,e)}},{key:"playingState",set:function(e){M(q,this,!1!==e)}},{key:"initialized",get:function(){return U(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||M(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(U(W,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=U(W,this).offsetWidth,a=U(W,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,U(I,this),U(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,U(N,this)[U(G,this)]),Reflect.apply(c,this,[U(j,this)[U(z,this)]]),i.useProgram(U($,this).id),i.uniform2fv(U($,this).locations.center,u),i.uniform1f(U($,this).locations.radius,r),i.uniform1f(U($,this).locations.strength,n),C(ae,this,fe).call(this),C(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=U(W,this).offsetWidth,t=U(W,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=U(W,this);t&&(Object.keys(U(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,U(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),C(ae,this,be).call(this),U(V,this)&&window.cancelAnimationFrame(U(V,this))}},{key:"show",value:function(){M(Y,this,!0),this.canvas.style.visibility="visible",C(ae,this,ye).call(this)}},{key:"hide",value:function(){M(Y,this,!1),this.canvas.style.visibility="hidden",C(ae,this,be).call(this)}},{key:"pause",value:function(){M(q,this,!1)}},{key:"play",value:function(){M(q,this,!0)}},{key:"changePlayingState",value:function(){M(q,this,!U(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,C(ae,this,le).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function ue(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];U(Y,e)&&U(q,e)&&e.interactive&&(M(ne,e,Date.now()),C(ae,e,Te).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};U(oe,this).mousemove=function(r){for(var n=U(L,e);n--;)t(r)},U(oe,this).touchmove=U(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},U(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(U(oe,this)).forEach((function(t){return U(W,e)&&U(W,e).addEventListener(t,U(oe,e)[t],{passive:!0})}))}function le(){var e=this,t=this.gl,r=this.imageUrl||u(U(J,this))||u(window.getComputedStyle(U(W,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,U(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),M(ee,e,n.width),M(te,e,n.height),C(ae,e,ye).call(e)},n.onerror=function(){return C(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else C(ae,this,Ee).call(this)}function ce(){var e=this;U(Y,this)&&(C(ae,this,me).call(this),U(q,this)&&C(ae,this,de).call(this),C(ae,this,he).call(this),M(V,this,requestAnimationFrame((function(){return C(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,U(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[U(Q,this),0]),Reflect.apply(c,this,[U(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,U(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),C(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations){var e=Date.now();e-U(ne,this)>U(ie,this)&&(M(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,U(I,this),U(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,U(N,this)[U(G,this)]),Reflect.apply(c,this,[U(j,this)[U(z,this)]]),t.useProgram(U(Z,this).id),C(ae,this,fe).call(this),C(ae,this,pe).call(this)}function pe(){M(G,this,1-U(G,this)),M(z,this,1-U(z,this))}function me(){var e,t,r,n=window.getComputedStyle(U(W,this)).backgroundSize,i=window.getComputedStyle(U(W,this)).backgroundAttachment,o=(e=window.getComputedStyle(U(W,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:U(W,this).getBoundingClientRect().left,top:U(W,this).getBoundingClientRect().top,width:U(W,this).scrollWidth,height:U(W,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/U(ee,this),a.height/U(te,this));t=U(ee,this)*s,r=U(te,this)*s}else if("contain"==n){var u=Math.min(a.width/U(ee,this),a.height/U(te,this));t=U(ee,this)*u,r=U(te,this)*u}else{var l=n.split(" ");t=l[0]||"",r=l[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=U(ee,this),r=U(te,this)):("auto"==t&&(t=U(ee,this)*(Number(r)/U(te,this))),"auto"==r&&(r=U(te,this)*(Number(t)/U(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(U(W,this).offsetLeft-Number(c))/Number(t),(U(W,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+U(W,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+U(W,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";M($,this,l(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),M(Z,this,l(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(U(Z,this).locations.delta,U(X,this)),this.renderProgram=l("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,U(X,this))}function ge(){var e=this.gl;M(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,U(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,U(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=U(W,this).style.backgroundImage;"none"!=e&&(M(re,this,e),M(J,this,window.getComputedStyle(U(W,this)).backgroundImage),U(W,this).style.backgroundImage="none")}function be(){U(W,this).style.backgroundImage=U(re,this)||""}function Te(e,t,r){var n=window.getComputedStyle(U(W,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=U(W,this).getBoundingClientRect();this.drop(e.pageX-a.left-i,e.pageY-a.top-o,t,r)}function Re(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z:()=>u});var a=i(649),s=i(566);function u(e){var t=(0,a.useRef)(null);return function(e,t){(0,a.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,s.n)(t,e),e),e.children?a.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,a.default.createElement("canvas",{ref:t})):a.default.createElement("canvas",{ref:t})}var l=o.z;export{l as BackgroundRipple};
|
|
1
|
+
import*as e from"a-element-inline-style";import*as t from"react";var r={566:(t,r,n)=>{n.d(r,{n:()=>Re});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function l(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function u(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}function U(e,t){return e.get(C(e,t))}function M(e,t,r){return e.set(C(e,t),r),r}function C(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var L=new WeakMap,I=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(i=n,a=ae),a.add(i),k(n,"defaults",b),k(n,"interactive",n.defaults.interactive),A(n,L,n.defaults.accelerating),A(n,I,n.defaults.resolution),A(n,B,n.defaults.perturbance),k(n,"dropRadius",void 0),k(n,"crossOrigin",""),k(n,"imageUrl",void 0),k(n,"idleFluctuations",!0),A(n,W,void 0),A(n,X,void 0),A(n,j,[]),A(n,N,[]),A(n,G,0),A(n,z,1),A(n,H,void 0),A(n,Y,!1),A(n,q,!1),A(n,K,!1),A(n,V,0),A(n,J,""),k(n,"imageSource",""),k(n,"renderProgram",void 0),A(n,Q,void 0),A(n,Z,void 0),A(n,$,void 0),A(n,ee,void 0),A(n,te,void 0),A(n,re,void 0),A(n,ne,Date.now()),A(n,ie,n.defaults.raindropsTimeInterval),A(n,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=w(w({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,x(n);var l=n.gl,u=1/U(I,n);M(X,n,new Float32Array([u,u])),M(W,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return l.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(U(I,n)*U(I,n)*4):null,h=n.config,d=0;d<2;d++){var p=l.createTexture(),m=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,m),l.bindTexture(l.TEXTURE_2D,p),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,U(I,n),U(I,n),0,l.RGBA,h.type,f),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,p,0),U(j,n).push(p),U(N,n).push(m)}return M(H,n,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,U(H,n)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),C(ae,n,ve).call(n),C(ae,n,ge).call(n),C(ae,n,Ee).call(n),C(ae,n,ue).call(n),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),M(Y,n,!0),M(q,n,!0),M(K,n,!0),C(ae,n,le).call(n),M(V,n,requestAnimationFrame((function(){return C(ae,n,ce).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||M(L,this,e)}},{key:"resolution",set:function(e){e<100||e>550||M(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||M(B,this,e)}},{key:"playingState",set:function(e){M(q,this,!1!==e)}},{key:"initialized",get:function(){return U(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||M(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(U(W,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=U(W,this).offsetWidth,a=U(W,this).offsetHeight,s=Math.max(o,a);r/=s;var l=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,U(I,this),U(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,U(N,this)[U(G,this)]),Reflect.apply(c,this,[U(j,this)[U(z,this)]]),i.useProgram(U($,this).id),i.uniform2fv(U($,this).locations.center,l),i.uniform1f(U($,this).locations.radius,r),i.uniform1f(U($,this).locations.strength,n),C(ae,this,fe).call(this),C(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=U(W,this).offsetWidth,t=U(W,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=U(W,this);t&&(Object.keys(U(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,U(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),C(ae,this,be).call(this),U(V,this)&&window.cancelAnimationFrame(U(V,this))}},{key:"show",value:function(){M(Y,this,!0),this.canvas.style.visibility="visible",C(ae,this,ye).call(this)}},{key:"hide",value:function(){M(Y,this,!1),this.canvas.style.visibility="hidden",C(ae,this,be).call(this)}},{key:"pause",value:function(){M(q,this,!1)}},{key:"play",value:function(){M(q,this,!0)}},{key:"changePlayingState",value:function(){M(q,this,!U(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,C(ae,this,ue).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function le(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];U(Y,e)&&U(q,e)&&e.interactive&&(M(ne,e,Date.now()),C(ae,e,Te).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};U(oe,this).mousemove=function(r){for(var n=U(L,e);n--;)t(r)},U(oe,this).touchmove=U(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},U(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(U(oe,this)).forEach((function(t){return U(W,e)&&U(W,e).addEventListener(t,U(oe,e)[t],{passive:!0})}))}function ue(){var e=this,t=this.gl,r=this.imageUrl||l(U(J,this))||l(window.getComputedStyle(U(W,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,U(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),M(ee,e,n.width),M(te,e,n.height),C(ae,e,ye).call(e)},n.onerror=function(){return C(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else C(ae,this,Ee).call(this)}function ce(){var e=this;U(Y,this)&&(C(ae,this,me).call(this),C(ae,this,de).call(this),C(ae,this,he).call(this),M(V,this,requestAnimationFrame((function(){return C(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,U(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[U(Q,this),0]),Reflect.apply(c,this,[U(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,U(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),C(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations&&U(q,this)){var e=Date.now();e-U(ne,this)>U(ie,this)&&(M(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,U(I,this),U(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,U(N,this)[U(G,this)]),Reflect.apply(c,this,[U(j,this)[U(z,this)]]),t.useProgram(U(Z,this).id),C(ae,this,fe).call(this),C(ae,this,pe).call(this)}function pe(){M(G,this,1-U(G,this)),M(z,this,1-U(z,this))}function me(){var e,t,r,n=window.getComputedStyle(U(W,this)).backgroundSize,i=window.getComputedStyle(U(W,this)).backgroundAttachment,o=(e=window.getComputedStyle(U(W,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:U(W,this).getBoundingClientRect().left,top:U(W,this).getBoundingClientRect().top,width:U(W,this).scrollWidth,height:U(W,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/U(ee,this),a.height/U(te,this));t=U(ee,this)*s,r=U(te,this)*s}else if("contain"==n){var l=Math.min(a.width/U(ee,this),a.height/U(te,this));t=U(ee,this)*l,r=U(te,this)*l}else{var u=n.split(" ");t=u[0]||"",r=u[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=U(ee,this),r=U(te,this)):("auto"==t&&(t=U(ee,this)*(Number(r)/U(te,this))),"auto"==r&&(r=U(te,this)*(Number(t)/U(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(U(W,this).offsetLeft-Number(c))/Number(t),(U(W,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+U(W,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+U(W,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";M($,this,u(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),M(Z,this,u(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(U(Z,this).locations.delta,U(X,this)),this.renderProgram=u("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,U(X,this))}function ge(){var e=this.gl;M(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,U(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,U(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=U(W,this).style.backgroundImage;"none"!=e&&(M(re,this,e),M(J,this,window.getComputedStyle(U(W,this)).backgroundImage),U(W,this).style.backgroundImage="none")}function be(){U(W,this).style.backgroundImage=U(re,this)||""}function Te(e,t,r){var n=window.getComputedStyle(U(W,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=U(W,this).getBoundingClientRect(),s=e.clientX-a.left-i,l=e.clientY-a.top-o;this.drop(s,l,t,r)}function Re(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z:()=>l});var a=i(649),s=i(566);function l(e){var t=(0,a.useRef)(null);return function(e,t){(0,a.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,s.n)(t,e),e),e.children?a.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,a.default.createElement("canvas",{ref:t})):a.default.createElement("canvas",{ref:t})}var u=o.z;export{u as BackgroundRipple};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={805:(e,t,r)=>{r.d(t,{BackgroundRipple:()=>a});var n=r(953),i=r.n(n),o=r(982);function a(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,o.useRipples)(t,e),e),e.children?i().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,i().createElement("canvas",{ref:t})):i().createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{useAnimationFrameId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{useInputIsComposing:()=>i});var n=r(953);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function u(e){return e.endsWith("%")}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,I=new WeakMap,L=new WeakMap,C=new WeakMap,B=new WeakMap,j=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r){var n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(o=n,a=ne),a.add(o),F(n,"defaults",g),F(n,"interactive",n.defaults.interactive),P(n,U,n.defaults.accelerating),P(n,M,n.defaults.resolution),P(n,I,n.defaults.perturbance),F(n,"dropRadius",void 0),F(n,"crossOrigin",""),F(n,"imageUrl",void 0),F(n,"idleFluctuations",!0),P(n,L,void 0),P(n,C,void 0),P(n,B,[]),P(n,j,[]),P(n,W,0),P(n,X,1),P(n,N,void 0),P(n,G,!1),P(n,z,!1),P(n,H,!1),P(n,Y,0),P(n,q,""),F(n,"imageSource",""),F(n,"renderProgram",void 0),P(n,K,void 0),P(n,V,void 0),P(n,J,void 0),P(n,Q,void 0),P(n,Z,void 0),P(n,$,void 0),P(n,ee,Date.now()),P(n,te,n.defaults.raindropsTimeInterval),P(n,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=b(b({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,R(n);var u=n.gl,l=1/O(M,n);k(C,n,new Float32Array([l,l])),k(L,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(O(M,n)*O(M,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,O(M,n),O(M,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),O(B,n).push(p),O(j,n).push(m)}return k(N,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,O(N,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),D(ne,n,de).call(n),D(ne,n,pe).call(n),D(ne,n,me).call(n),D(ne,n,ae).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),k(G,n,!0),k(z,n,!0),k(H,n,!0),D(ne,n,oe).call(n),k(Y,n,requestAnimationFrame((function(){return D(ne,n,se).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(I,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,u=Math.max(o,a);r/=u;var l=new Float32Array([(2*e-o)/u,(a-2*t)/u]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,l),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),O(z,this)&&D(ne,this,ce).call(this),D(ne,this,le).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function ue(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function le(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(B,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(I,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,ue).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):u(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var l=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*l,r=O(Z,this)*l}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,u(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),u(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=u(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=u(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(C,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(C,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=O(L,this).getBoundingClientRect();this.drop(e.pageX-a.left-i,e.pageY-a.top-o,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{useTimeId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>i.BackgroundRipple,useAnimationFrameId:()=>s.useAnimationFrameId,useInputIsComposing:()=>o.useInputIsComposing,useRipples:()=>u.useRipples,useTimeId:()=>a.useTimeId});var i=r(805),o=r(195),a=r(552),s=r(615),u=r(982);module.exports["oops-ui"]=n})();
|
|
1
|
+
(()=>{"use strict";var e={805:(e,t,r)=>{r.d(t,{BackgroundRipple:()=>a});var n=r(953),i=r.n(n),o=r(982);function a(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,o.useRipples)(t,e),e),e.children?i().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,i().createElement("canvas",{ref:t})):i().createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{useAnimationFrameId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{useInputIsComposing:()=>i});var n=r(953);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function u(e){return e.endsWith("%")}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,I=new WeakMap,L=new WeakMap,C=new WeakMap,B=new WeakMap,j=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r){var n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(o=n,a=ne),a.add(o),F(n,"defaults",g),F(n,"interactive",n.defaults.interactive),P(n,U,n.defaults.accelerating),P(n,M,n.defaults.resolution),P(n,I,n.defaults.perturbance),F(n,"dropRadius",void 0),F(n,"crossOrigin",""),F(n,"imageUrl",void 0),F(n,"idleFluctuations",!0),P(n,L,void 0),P(n,C,void 0),P(n,B,[]),P(n,j,[]),P(n,W,0),P(n,X,1),P(n,N,void 0),P(n,G,!1),P(n,z,!1),P(n,H,!1),P(n,Y,0),P(n,q,""),F(n,"imageSource",""),F(n,"renderProgram",void 0),P(n,K,void 0),P(n,V,void 0),P(n,J,void 0),P(n,Q,void 0),P(n,Z,void 0),P(n,$,void 0),P(n,ee,Date.now()),P(n,te,n.defaults.raindropsTimeInterval),P(n,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=b(b({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,R(n);var u=n.gl,l=1/O(M,n);k(C,n,new Float32Array([l,l])),k(L,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(O(M,n)*O(M,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,O(M,n),O(M,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),O(B,n).push(p),O(j,n).push(m)}return k(N,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,O(N,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),D(ne,n,de).call(n),D(ne,n,pe).call(n),D(ne,n,me).call(n),D(ne,n,ae).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),k(G,n,!0),k(z,n,!0),k(H,n,!0),D(ne,n,oe).call(n),k(Y,n,requestAnimationFrame((function(){return D(ne,n,se).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(I,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,u=Math.max(o,a);r/=u;var l=new Float32Array([(2*e-o)/u,(a-2*t)/u]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,l),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),D(ne,this,ce).call(this),D(ne,this,le).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function ue(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function le(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(B,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(I,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,ue).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations&&O(z,this)){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):u(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var l=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*l,r=O(Z,this)*l}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,u(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),u(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=u(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=u(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(C,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(C,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=O(L,this).getBoundingClientRect(),s=e.clientX-a.left-i,u=e.clientY-a.top-o;this.drop(s,u,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{useTimeId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>i.BackgroundRipple,useAnimationFrameId:()=>s.useAnimationFrameId,useInputIsComposing:()=>o.useInputIsComposing,useRipples:()=>u.useRipples,useTimeId:()=>a.useTimeId});var i=r(805),o=r(195),a=r(552),s=r(615),u=r(982);module.exports["oops-ui"]=n})();
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"a-element-inline-style";import*as t from"react";var r={805:(e,t,r)=>{r.d(t,{z:()=>o});var n=r(649),i=r(566);function o(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,i.n)(t,e),e),e.children?n.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,n.default.createElement("canvas",{ref:t})):n.default.createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{M:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{t:()=>i});var n=r(649);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},566:(t,r,n)=>{n.d(r,{n:()=>Te});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function u(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function l(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==R(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function M(e,t){return e.get(L(e,t))}function U(e,t,r){return e.set(L(e,t),r),r}function L(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var C=new WeakMap,I=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(i=n,a=ae),a.add(i),k(n,"defaults",b),k(n,"interactive",n.defaults.interactive),A(n,C,n.defaults.accelerating),A(n,I,n.defaults.resolution),A(n,B,n.defaults.perturbance),k(n,"dropRadius",void 0),k(n,"crossOrigin",""),k(n,"imageUrl",void 0),k(n,"idleFluctuations",!0),A(n,W,void 0),A(n,X,void 0),A(n,j,[]),A(n,N,[]),A(n,G,0),A(n,z,1),A(n,H,void 0),A(n,Y,!1),A(n,q,!1),A(n,K,!1),A(n,V,0),A(n,J,""),k(n,"imageSource",""),k(n,"renderProgram",void 0),A(n,Q,void 0),A(n,Z,void 0),A(n,$,void 0),A(n,ee,void 0),A(n,te,void 0),A(n,re,void 0),A(n,ne,Date.now()),A(n,ie,n.defaults.raindropsTimeInterval),A(n,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=w(w({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,x(n);var u=n.gl,l=1/M(I,n);U(X,n,new Float32Array([l,l])),U(W,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(M(I,n)*M(I,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,M(I,n),M(I,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),M(j,n).push(p),M(N,n).push(m)}return U(H,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,M(H,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),L(ae,n,ve).call(n),L(ae,n,ge).call(n),L(ae,n,Ee).call(n),L(ae,n,le).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),U(Y,n,!0),U(q,n,!0),U(K,n,!0),L(ae,n,ue).call(n),U(V,n,requestAnimationFrame((function(){return L(ae,n,ce).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||U(C,this,e)}},{key:"resolution",set:function(e){e<100||e>550||U(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||U(B,this,e)}},{key:"playingState",set:function(e){U(q,this,!1!==e)}},{key:"initialized",get:function(){return M(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||U(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(M(W,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=M(W,this).offsetWidth,a=M(W,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,M(I,this),M(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),i.useProgram(M($,this).id),i.uniform2fv(M($,this).locations.center,u),i.uniform1f(M($,this).locations.radius,r),i.uniform1f(M($,this).locations.strength,n),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=M(W,this).offsetWidth,t=M(W,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=M(W,this);t&&(Object.keys(M(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,M(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),L(ae,this,be).call(this),M(V,this)&&window.cancelAnimationFrame(M(V,this))}},{key:"show",value:function(){U(Y,this,!0),this.canvas.style.visibility="visible",L(ae,this,ye).call(this)}},{key:"hide",value:function(){U(Y,this,!1),this.canvas.style.visibility="hidden",L(ae,this,be).call(this)}},{key:"pause",value:function(){U(q,this,!1)}},{key:"play",value:function(){U(q,this,!0)}},{key:"changePlayingState",value:function(){U(q,this,!M(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,L(ae,this,le).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function ue(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];M(Y,e)&&M(q,e)&&e.interactive&&(U(ne,e,Date.now()),L(ae,e,Re).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};M(oe,this).mousemove=function(r){for(var n=M(C,e);n--;)t(r)},M(oe,this).touchmove=M(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},M(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(M(oe,this)).forEach((function(t){return M(W,e)&&M(W,e).addEventListener(t,M(oe,e)[t],{passive:!0})}))}function le(){var e=this,t=this.gl,r=this.imageUrl||u(M(J,this))||u(window.getComputedStyle(M(W,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,M(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),U(ee,e,n.width),U(te,e,n.height),L(ae,e,ye).call(e)},n.onerror=function(){return L(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else L(ae,this,Ee).call(this)}function ce(){var e=this;M(Y,this)&&(L(ae,this,me).call(this),M(q,this)&&L(ae,this,de).call(this),L(ae,this,he).call(this),U(V,this,requestAnimationFrame((function(){return L(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,M(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[M(Q,this),0]),Reflect.apply(c,this,[M(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,M(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),L(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations){var e=Date.now();e-M(ne,this)>M(ie,this)&&(U(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,M(I,this),M(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),t.useProgram(M(Z,this).id),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}function pe(){U(G,this,1-M(G,this)),U(z,this,1-M(z,this))}function me(){var e,t,r,n=window.getComputedStyle(M(W,this)).backgroundSize,i=window.getComputedStyle(M(W,this)).backgroundAttachment,o=(e=window.getComputedStyle(M(W,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:M(W,this).getBoundingClientRect().left,top:M(W,this).getBoundingClientRect().top,width:M(W,this).scrollWidth,height:M(W,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*s,r=M(te,this)*s}else if("contain"==n){var u=Math.min(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*u,r=M(te,this)*u}else{var l=n.split(" ");t=l[0]||"",r=l[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=M(ee,this),r=M(te,this)):("auto"==t&&(t=M(ee,this)*(Number(r)/M(te,this))),"auto"==r&&(r=M(te,this)*(Number(t)/M(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(M(W,this).offsetLeft-Number(c))/Number(t),(M(W,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+M(W,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+M(W,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";U($,this,l(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),U(Z,this,l(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(M(Z,this).locations.delta,M(X,this)),this.renderProgram=l("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,M(X,this))}function ge(){var e=this.gl;U(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=M(W,this).style.backgroundImage;"none"!=e&&(U(re,this,e),U(J,this,window.getComputedStyle(M(W,this)).backgroundImage),M(W,this).style.backgroundImage="none")}function be(){M(W,this).style.backgroundImage=M(re,this)||""}function Re(e,t,r){var n=window.getComputedStyle(M(W,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=M(W,this).getBoundingClientRect();this.drop(e.pageX-a.left-i,e.pageY-a.top-o,t,r)}function Te(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{O:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z_:()=>a.z,MM:()=>l.M,t3:()=>s.t,nC:()=>c.n,Oe:()=>u.O});var a=i(805),s=i(195),u=i(552),l=i(615),c=i(566),f=o.z_,h=o.MM,d=o.t3,p=o.nC,m=o.Oe;export{f as BackgroundRipple,h as useAnimationFrameId,d as useInputIsComposing,p as useRipples,m as useTimeId};
|
|
1
|
+
import*as e from"a-element-inline-style";import*as t from"react";var r={805:(e,t,r)=>{r.d(t,{z:()=>o});var n=r(649),i=r(566);function o(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,i.n)(t,e),e),e.children?n.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,n.default.createElement("canvas",{ref:t})):n.default.createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{M:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{t:()=>i});var n=r(649);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},566:(t,r,n)=>{n.d(r,{n:()=>Te});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function u(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function l(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==R(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function M(e,t){return e.get(L(e,t))}function U(e,t,r){return e.set(L(e,t),r),r}function L(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var C=new WeakMap,I=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(i=n,a=ae),a.add(i),k(n,"defaults",b),k(n,"interactive",n.defaults.interactive),A(n,C,n.defaults.accelerating),A(n,I,n.defaults.resolution),A(n,B,n.defaults.perturbance),k(n,"dropRadius",void 0),k(n,"crossOrigin",""),k(n,"imageUrl",void 0),k(n,"idleFluctuations",!0),A(n,W,void 0),A(n,X,void 0),A(n,j,[]),A(n,N,[]),A(n,G,0),A(n,z,1),A(n,H,void 0),A(n,Y,!1),A(n,q,!1),A(n,K,!1),A(n,V,0),A(n,J,""),k(n,"imageSource",""),k(n,"renderProgram",void 0),A(n,Q,void 0),A(n,Z,void 0),A(n,$,void 0),A(n,ee,void 0),A(n,te,void 0),A(n,re,void 0),A(n,ne,Date.now()),A(n,ie,n.defaults.raindropsTimeInterval),A(n,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=w(w({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,x(n);var u=n.gl,l=1/M(I,n);U(X,n,new Float32Array([l,l])),U(W,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(M(I,n)*M(I,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,M(I,n),M(I,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),M(j,n).push(p),M(N,n).push(m)}return U(H,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,M(H,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),L(ae,n,ve).call(n),L(ae,n,ge).call(n),L(ae,n,Ee).call(n),L(ae,n,le).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),U(Y,n,!0),U(q,n,!0),U(K,n,!0),L(ae,n,ue).call(n),U(V,n,requestAnimationFrame((function(){return L(ae,n,ce).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||U(C,this,e)}},{key:"resolution",set:function(e){e<100||e>550||U(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||U(B,this,e)}},{key:"playingState",set:function(e){U(q,this,!1!==e)}},{key:"initialized",get:function(){return M(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||U(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(M(W,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=M(W,this).offsetWidth,a=M(W,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,M(I,this),M(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),i.useProgram(M($,this).id),i.uniform2fv(M($,this).locations.center,u),i.uniform1f(M($,this).locations.radius,r),i.uniform1f(M($,this).locations.strength,n),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=M(W,this).offsetWidth,t=M(W,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=M(W,this);t&&(Object.keys(M(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,M(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),L(ae,this,be).call(this),M(V,this)&&window.cancelAnimationFrame(M(V,this))}},{key:"show",value:function(){U(Y,this,!0),this.canvas.style.visibility="visible",L(ae,this,ye).call(this)}},{key:"hide",value:function(){U(Y,this,!1),this.canvas.style.visibility="hidden",L(ae,this,be).call(this)}},{key:"pause",value:function(){U(q,this,!1)}},{key:"play",value:function(){U(q,this,!0)}},{key:"changePlayingState",value:function(){U(q,this,!M(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,L(ae,this,le).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function ue(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];M(Y,e)&&M(q,e)&&e.interactive&&(U(ne,e,Date.now()),L(ae,e,Re).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};M(oe,this).mousemove=function(r){for(var n=M(C,e);n--;)t(r)},M(oe,this).touchmove=M(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},M(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(M(oe,this)).forEach((function(t){return M(W,e)&&M(W,e).addEventListener(t,M(oe,e)[t],{passive:!0})}))}function le(){var e=this,t=this.gl,r=this.imageUrl||u(M(J,this))||u(window.getComputedStyle(M(W,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,M(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),U(ee,e,n.width),U(te,e,n.height),L(ae,e,ye).call(e)},n.onerror=function(){return L(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else L(ae,this,Ee).call(this)}function ce(){var e=this;M(Y,this)&&(L(ae,this,me).call(this),L(ae,this,de).call(this),L(ae,this,he).call(this),U(V,this,requestAnimationFrame((function(){return L(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,M(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[M(Q,this),0]),Reflect.apply(c,this,[M(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,M(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),L(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations&&M(q,this)){var e=Date.now();e-M(ne,this)>M(ie,this)&&(U(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,M(I,this),M(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),t.useProgram(M(Z,this).id),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}function pe(){U(G,this,1-M(G,this)),U(z,this,1-M(z,this))}function me(){var e,t,r,n=window.getComputedStyle(M(W,this)).backgroundSize,i=window.getComputedStyle(M(W,this)).backgroundAttachment,o=(e=window.getComputedStyle(M(W,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:M(W,this).getBoundingClientRect().left,top:M(W,this).getBoundingClientRect().top,width:M(W,this).scrollWidth,height:M(W,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*s,r=M(te,this)*s}else if("contain"==n){var u=Math.min(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*u,r=M(te,this)*u}else{var l=n.split(" ");t=l[0]||"",r=l[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=M(ee,this),r=M(te,this)):("auto"==t&&(t=M(ee,this)*(Number(r)/M(te,this))),"auto"==r&&(r=M(te,this)*(Number(t)/M(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(M(W,this).offsetLeft-Number(c))/Number(t),(M(W,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+M(W,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+M(W,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";U($,this,l(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),U(Z,this,l(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(M(Z,this).locations.delta,M(X,this)),this.renderProgram=l("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,M(X,this))}function ge(){var e=this.gl;U(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=M(W,this).style.backgroundImage;"none"!=e&&(U(re,this,e),U(J,this,window.getComputedStyle(M(W,this)).backgroundImage),M(W,this).style.backgroundImage="none")}function be(){M(W,this).style.backgroundImage=M(re,this)||""}function Re(e,t,r){var n=window.getComputedStyle(M(W,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=M(W,this).getBoundingClientRect(),s=e.clientX-a.left-i,u=e.clientY-a.top-o;this.drop(s,u,t,r)}function Te(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{O:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z_:()=>a.z,MM:()=>l.M,t3:()=>s.t,nC:()=>c.n,Oe:()=>u.O});var a=i(805),s=i(195),u=i(552),l=i(615),c=i(566),f=o.z_,h=o.MM,d=o.t3,p=o.nC,m=o.Oe;export{f as BackgroundRipple,h as useAnimationFrameId,d as useInputIsComposing,p as useRipples,m as useTimeId};
|
package/dist/styles/common.css
CHANGED
|
@@ -39,9 +39,6 @@ span {
|
|
|
39
39
|
left: auto;
|
|
40
40
|
top: auto;
|
|
41
41
|
box-sizing: border-box;
|
|
42
|
-
margin: 0;
|
|
43
|
-
padding: 0;
|
|
44
|
-
border: 0;
|
|
45
42
|
font: inherit;
|
|
46
43
|
vertical-align: baseline;
|
|
47
44
|
-webkit-user-drag: none;
|
|
@@ -49,8 +46,13 @@ span {
|
|
|
49
46
|
user-select: none;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
body
|
|
53
|
-
|
|
49
|
+
body,
|
|
50
|
+
html {
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
line-height: 1.4rem;
|
|
53
|
+
margin: 0;
|
|
54
|
+
padding: 0;
|
|
55
|
+
border: 0;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
a {
|
package/dist/styles/common.scss
CHANGED
|
@@ -38,9 +38,7 @@ span {
|
|
|
38
38
|
left: auto;
|
|
39
39
|
top: auto;
|
|
40
40
|
box-sizing: border-box;
|
|
41
|
-
|
|
42
|
-
padding: 0;
|
|
43
|
-
border: 0;
|
|
41
|
+
|
|
44
42
|
font: inherit;
|
|
45
43
|
vertical-align: baseline;
|
|
46
44
|
-webkit-user-drag: none;
|
|
@@ -49,8 +47,13 @@ span {
|
|
|
49
47
|
user-select: none;
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
body
|
|
53
|
-
|
|
50
|
+
body,
|
|
51
|
+
html {
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
line-height: 1.4rem;
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
border: 0;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
a {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{useRipples:()=>ye});var i=r(953);const o=require("a-element-inline-style");function a(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function s(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function l(e){return e.endsWith("%")}function c(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,m(n.key),n)}}function p(e,t,r){return t&&h(e.prototype,t),r&&h(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}var v="lmssee_ripper_element_style",g=p((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(v))){var n=this.styleElement;n.id=v,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(c,this,[])})),E={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){A(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,O(n.key),n)}}function w(e,t){if(t&&("object"==b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_=function(){return!!e})()}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function S(e,t,r){F(e,t),t.set(e,r)}function F(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function A(e,t,r){return(t=O(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}function D(e,t){return e.get(U(e,t))}function k(e,t,r){return e.set(U(e,t),r),r}function U(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(E);var M=new WeakMap,C=new WeakMap,L=new WeakMap,I=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,B=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakSet,oe=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=x(t),w(e,_()?Reflect.construct(t,r||[],x(e).constructor):t.apply(e,r))}(this,t,[e]),F(i=n,a=ie),a.add(i),A(n,"defaults",E),A(n,"interactive",n.defaults.interactive),S(n,M,n.defaults.accelerating),S(n,C,n.defaults.resolution),S(n,L,n.defaults.perturbance),A(n,"dropRadius",void 0),A(n,"crossOrigin",""),A(n,"imageUrl",void 0),A(n,"idleFluctuations",!0),S(n,I,void 0),S(n,W,void 0),S(n,X,[]),S(n,j,[]),S(n,B,0),S(n,N,1),S(n,G,void 0),S(n,z,!1),S(n,H,!1),S(n,Y,!1),S(n,q,0),S(n,K,""),A(n,"imageSource",""),A(n,"renderProgram",void 0),S(n,V,void 0),S(n,J,void 0),S(n,Q,void 0),S(n,Z,void 0),S(n,$,void 0),S(n,ee,void 0),S(n,te,Date.now()),S(n,re,n.defaults.raindropsTimeInterval),S(n,ne,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=T(T({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,w(n);var u=n.gl,l=1/D(C,n);k(W,n,new Float32Array([l,l])),k(I,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(D(C,n)*D(C,n)*4):null,h=n.config,p=0;p<2;p++){var d=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,d),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,D(C,n),D(C,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,d,0),D(X,n).push(d),D(j,n).push(m)}return k(G,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,D(G,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),U(ie,n,de).call(n),U(ie,n,me).call(n),U(ie,n,ve).call(n),U(ie,n,se).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),k(z,n,!0),k(H,n,!0),k(Y,n,!0),U(ie,n,ae).call(n),k(q,n,requestAnimationFrame((function(){return U(ie,n,ue).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(M,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(C,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(L,this,e)}},{key:"playingState",set:function(e){k(H,this,!1!==e)}},{key:"initialized",get:function(){return D(Y,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(re,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(D(I,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=D(I,this).offsetWidth,a=D(I,this).offsetHeight,s=Math.max(o,a);r/=s;var l=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,D(C,this),D(C,this)),i.bindFramebuffer(i.FRAMEBUFFER,D(j,this)[D(B,this)]),Reflect.apply(u,this,[D(X,this)[D(N,this)]]),i.useProgram(D(Q,this).id),i.uniform2fv(D(Q,this).locations.center,l),i.uniform1f(D(Q,this).locations.radius,r),i.uniform1f(D(Q,this).locations.strength,n),U(ie,this,le).call(this),U(ie,this,he).call(this)}},{key:"updateSize",value:function(){var e=D(I,this).offsetWidth,t=D(I,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=D(I,this);t&&(Object.keys(D(ne,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,D(ne,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),U(ie,this,Ee).call(this),D(q,this)&&window.cancelAnimationFrame(D(q,this))}},{key:"show",value:function(){k(z,this,!0),this.canvas.style.visibility="visible",U(ie,this,ge).call(this)}},{key:"hide",value:function(){k(z,this,!1),this.canvas.style.visibility="hidden",U(ie,this,Ee).call(this)}},{key:"pause",value:function(){k(H,this,!1)}},{key:"play",value:function(){k(H,this,!0)}},{key:"changePlayingState",value:function(){k(H,this,!D(H,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,U(ie,this,se).call(this)):this[e]=t}}],n&&R(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(g);function ae(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];D(z,e)&&D(H,e)&&e.interactive&&(k(te,e,Date.now()),U(ie,e,be).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};D(ne,this).mousemove=function(r){for(var n=D(M,e);n--;)t(r)},D(ne,this).touchmove=D(ne,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},D(ne,this).mousedown=function(e){return t(e,!0)},Object.keys(D(ne,this)).forEach((function(t){return D(I,e)&&D(I,e).addEventListener(t,D(ne,e)[t],{passive:!0})}))}function se(){var e=this,t=this.gl,r=this.imageUrl||a(D(K,this))||a(window.getComputedStyle(D(I,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,D(V,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Z,e,n.width),k($,e,n.height),U(ie,e,ge).call(e)},n.onerror=function(){return U(ie,e,ve).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else U(ie,this,ve).call(this)}function ue(){var e=this;D(z,this)&&(U(ie,this,pe).call(this),D(H,this)&&U(ie,this,fe).call(this),U(ie,this,ce).call(this),k(q,this,requestAnimationFrame((function(){return U(ie,e,ue).call(e)}))))}function le(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,D(G,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function ce(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(u,this,[D(V,this),0]),Reflect.apply(u,this,[D(X,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,D(L,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),U(ie,this,le).call(this),e.disable(e.BLEND)}function fe(){if(this.idleFluctuations){var e=Date.now();e-D(te,this)>D(re,this)&&(k(te,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,D(C,this),D(C,this)),t.bindFramebuffer(t.FRAMEBUFFER,D(j,this)[D(B,this)]),Reflect.apply(u,this,[D(X,this)[D(N,this)]]),t.useProgram(D(J,this).id),U(ie,this,le).call(this),U(ie,this,he).call(this)}function he(){k(B,this,1-D(B,this)),k(N,this,1-D(N,this))}function pe(){var e,t,r,n=window.getComputedStyle(D(I,this)).backgroundSize,i=window.getComputedStyle(D(I,this)).backgroundAttachment,o=(e=window.getComputedStyle(D(I,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):l(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:D(I,this).getBoundingClientRect().left,top:D(I,this).getBoundingClientRect().top,width:D(I,this).scrollWidth,height:D(I,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/D(Z,this),a.height/D($,this));t=D(Z,this)*s,r=D($,this)*s}else if("contain"==n){var u=Math.min(a.width/D(Z,this),a.height/D($,this));t=D(Z,this)*u,r=D($,this)*u}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,l(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),l(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=D(Z,this),r=D($,this)):("auto"==t&&(t=D(Z,this)*(Number(r)/D($,this))),"auto"==r&&(r=D($,this)*(Number(t)/D(Z,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=l(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=l(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(D(I,this).offsetLeft-Number(f))/Number(t),(D(I,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+D(I,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+D(I,this).clientHeight/Number(r)]);var p=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/p,this.canvas.height/p])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(Q,this,s(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(J,this,s(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(D(J,this).locations.delta,D(W,this)),this.renderProgram=s("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,D(W,this))}function me(){var e=this.gl;k(V,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,D(V,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function ve(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,D(V,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ge(){var e=D(I,this).style.backgroundImage;"none"!=e&&(k(ee,this,e),k(K,this,window.getComputedStyle(D(I,this)).backgroundImage),D(I,this).style.backgroundImage="none")}function Ee(){D(I,this).style.backgroundImage=D(ee,this)||""}function be(e,t,r){var n=window.getComputedStyle(D(I,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=D(I,this).getBoundingClientRect();this.drop(e.pageX-a.left-i,e.pageY-a.top-o,t,r)}function ye(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new oe(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}module.exports["oops-ui"]=n})();
|
|
1
|
+
(()=>{"use strict";var e={953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{useRipples:()=>ye});var i=r(953);const o=require("a-element-inline-style");function a(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function s(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function u(e){return e.endsWith("%")}function c(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,m(n.key),n)}}function d(e,t,r){return t&&h(e.prototype,t),r&&h(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}var v="lmssee_ripper_element_style",g=d((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,"styleElement",document.createElement("style")),p(this,"canvas",void 0),p(this,"gl",void 0),p(this,"config",void 0),p(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),p(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(v))){var n=this.styleElement;n.id=v,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(c,this,[])})),E={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){A(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,O(n.key),n)}}function w(e,t){if(t&&("object"==b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_=function(){return!!e})()}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function S(e,t,r){F(e,t),t.set(e,r)}function F(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function A(e,t,r){return(t=O(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}function D(e,t){return e.get(U(e,t))}function k(e,t,r){return e.set(U(e,t),r),r}function U(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(E);var M=new WeakMap,C=new WeakMap,L=new WeakMap,I=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,B=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakSet,oe=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=x(t),w(e,_()?Reflect.construct(t,r||[],x(e).constructor):t.apply(e,r))}(this,t,[e]),F(i=n,a=ie),a.add(i),A(n,"defaults",E),A(n,"interactive",n.defaults.interactive),S(n,M,n.defaults.accelerating),S(n,C,n.defaults.resolution),S(n,L,n.defaults.perturbance),A(n,"dropRadius",void 0),A(n,"crossOrigin",""),A(n,"imageUrl",void 0),A(n,"idleFluctuations",!0),S(n,I,void 0),S(n,W,void 0),S(n,X,[]),S(n,j,[]),S(n,B,0),S(n,N,1),S(n,G,void 0),S(n,z,!1),S(n,H,!1),S(n,Y,!1),S(n,q,0),S(n,K,""),A(n,"imageSource",""),A(n,"renderProgram",void 0),S(n,V,void 0),S(n,J,void 0),S(n,Q,void 0),S(n,Z,void 0),S(n,$,void 0),S(n,ee,void 0),S(n,te,Date.now()),S(n,re,n.defaults.raindropsTimeInterval),S(n,ne,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=T(T({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,w(n);var l=n.gl,u=1/D(C,n);k(W,n,new Float32Array([u,u])),k(I,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return l.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(D(C,n)*D(C,n)*4):null,h=n.config,d=0;d<2;d++){var p=l.createTexture(),m=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,m),l.bindTexture(l.TEXTURE_2D,p),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,D(C,n),D(C,n),0,l.RGBA,h.type,f),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,p,0),D(X,n).push(p),D(j,n).push(m)}return k(G,n,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,D(G,n)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),U(ie,n,pe).call(n),U(ie,n,me).call(n),U(ie,n,ve).call(n),U(ie,n,se).call(n),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),k(z,n,!0),k(H,n,!0),k(Y,n,!0),U(ie,n,ae).call(n),k(q,n,requestAnimationFrame((function(){return U(ie,n,le).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(M,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(C,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(L,this,e)}},{key:"playingState",set:function(e){k(H,this,!1!==e)}},{key:"initialized",get:function(){return D(Y,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(re,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(D(I,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=D(I,this).offsetWidth,a=D(I,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,D(C,this),D(C,this)),i.bindFramebuffer(i.FRAMEBUFFER,D(j,this)[D(B,this)]),Reflect.apply(l,this,[D(X,this)[D(N,this)]]),i.useProgram(D(Q,this).id),i.uniform2fv(D(Q,this).locations.center,u),i.uniform1f(D(Q,this).locations.radius,r),i.uniform1f(D(Q,this).locations.strength,n),U(ie,this,ue).call(this),U(ie,this,he).call(this)}},{key:"updateSize",value:function(){var e=D(I,this).offsetWidth,t=D(I,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=D(I,this);t&&(Object.keys(D(ne,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,D(ne,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),U(ie,this,Ee).call(this),D(q,this)&&window.cancelAnimationFrame(D(q,this))}},{key:"show",value:function(){k(z,this,!0),this.canvas.style.visibility="visible",U(ie,this,ge).call(this)}},{key:"hide",value:function(){k(z,this,!1),this.canvas.style.visibility="hidden",U(ie,this,Ee).call(this)}},{key:"pause",value:function(){k(H,this,!1)}},{key:"play",value:function(){k(H,this,!0)}},{key:"changePlayingState",value:function(){k(H,this,!D(H,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,U(ie,this,se).call(this)):this[e]=t}}],n&&R(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(g);function ae(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];D(z,e)&&D(H,e)&&e.interactive&&(k(te,e,Date.now()),U(ie,e,be).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};D(ne,this).mousemove=function(r){for(var n=D(M,e);n--;)t(r)},D(ne,this).touchmove=D(ne,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},D(ne,this).mousedown=function(e){return t(e,!0)},Object.keys(D(ne,this)).forEach((function(t){return D(I,e)&&D(I,e).addEventListener(t,D(ne,e)[t],{passive:!0})}))}function se(){var e=this,t=this.gl,r=this.imageUrl||a(D(K,this))||a(window.getComputedStyle(D(I,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,D(V,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Z,e,n.width),k($,e,n.height),U(ie,e,ge).call(e)},n.onerror=function(){return U(ie,e,ve).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else U(ie,this,ve).call(this)}function le(){var e=this;D(z,this)&&(U(ie,this,de).call(this),U(ie,this,fe).call(this),U(ie,this,ce).call(this),k(q,this,requestAnimationFrame((function(){return U(ie,e,le).call(e)}))))}function ue(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,D(G,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function ce(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(l,this,[D(V,this),0]),Reflect.apply(l,this,[D(X,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,D(L,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),U(ie,this,ue).call(this),e.disable(e.BLEND)}function fe(){if(this.idleFluctuations&&D(H,this)){var e=Date.now();e-D(te,this)>D(re,this)&&(k(te,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,D(C,this),D(C,this)),t.bindFramebuffer(t.FRAMEBUFFER,D(j,this)[D(B,this)]),Reflect.apply(l,this,[D(X,this)[D(N,this)]]),t.useProgram(D(J,this).id),U(ie,this,ue).call(this),U(ie,this,he).call(this)}function he(){k(B,this,1-D(B,this)),k(N,this,1-D(N,this))}function de(){var e,t,r,n=window.getComputedStyle(D(I,this)).backgroundSize,i=window.getComputedStyle(D(I,this)).backgroundAttachment,o=(e=window.getComputedStyle(D(I,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):u(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:D(I,this).getBoundingClientRect().left,top:D(I,this).getBoundingClientRect().top,width:D(I,this).scrollWidth,height:D(I,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/D(Z,this),a.height/D($,this));t=D(Z,this)*s,r=D($,this)*s}else if("contain"==n){var l=Math.min(a.width/D(Z,this),a.height/D($,this));t=D(Z,this)*l,r=D($,this)*l}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,u(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),u(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=D(Z,this),r=D($,this)):("auto"==t&&(t=D(Z,this)*(Number(r)/D($,this))),"auto"==r&&(r=D($,this)*(Number(t)/D(Z,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=u(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=u(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(D(I,this).offsetLeft-Number(f))/Number(t),(D(I,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+D(I,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+D(I,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function pe(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(Q,this,s(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(J,this,s(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(D(J,this).locations.delta,D(W,this)),this.renderProgram=s("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,D(W,this))}function me(){var e=this.gl;k(V,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,D(V,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function ve(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,D(V,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ge(){var e=D(I,this).style.backgroundImage;"none"!=e&&(k(ee,this,e),k(K,this,window.getComputedStyle(D(I,this)).backgroundImage),D(I,this).style.backgroundImage="none")}function Ee(){D(I,this).style.backgroundImage=D(ee,this)||""}function be(e,t,r){var n=window.getComputedStyle(D(I,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=D(I,this).getBoundingClientRect(),s=e.clientX-a.left-i,l=e.clientY-a.top-o;this.drop(s,l,t,r)}function ye(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new oe(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}module.exports["oops-ui"]=n})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import*as t from"a-element-inline-style";var r={649:(t,r,n)=>{var i,o;t.exports=(i={useEffect:()=>e.useEffect,useRef:()=>e.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{n:()=>_e});var a=i(649);const s=(u={setStyle:()=>t.setStyle},l={},i.d(l,u),l);var u,l;function c(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function f(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function p(e){return e.endsWith("%")}function d(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function g(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function E(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}var b="lmssee_ripper_element_style",T=g((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),E(this,"styleElement",document.createElement("style")),E(this,"canvas",void 0),E(this,"gl",void 0),E(this,"config",void 0),E(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),E(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(b))){var n=this.styleElement;n.id=b,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(d,this,[])})),R={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){U(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,M(n.key),n)}}function S(e,t){if(t&&("object"==w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function F(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(F=function(){return!!e})()}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function D(e,t,r){k(e,t),t.set(e,r)}function k(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function U(e,t,r){return(t=M(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M(e){var t=function(e){if("object"!=w(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==w(t)?t:t+""}function C(e,t){return e.get(I(e,t))}function L(e,t,r){return e.set(I(e,t),r),r}function I(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(R);var W=new WeakMap,X=new WeakMap,B=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakMap,se=new WeakMap,ue=new WeakSet,le=function(){function e(t,r){var n,i,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(e,t,r){return t=A(t),S(e,F()?Reflect.construct(t,r||[],A(e).constructor):t.apply(e,r))}(this,e,[t]),k(i=n,o=ue),o.add(i),U(n,"defaults",R),U(n,"interactive",n.defaults.interactive),D(n,W,n.defaults.accelerating),D(n,X,n.defaults.resolution),D(n,B,n.defaults.perturbance),U(n,"dropRadius",void 0),U(n,"crossOrigin",""),U(n,"imageUrl",void 0),U(n,"idleFluctuations",!0),D(n,j,void 0),D(n,N,void 0),D(n,G,[]),D(n,z,[]),D(n,H,0),D(n,Y,1),D(n,q,void 0),D(n,K,!1),D(n,V,!1),D(n,J,!1),D(n,Q,0),D(n,Z,""),U(n,"imageSource",""),U(n,"renderProgram",void 0),D(n,$,void 0),D(n,ee,void 0),D(n,te,void 0),D(n,re,void 0),D(n,ne,void 0),D(n,ie,void 0),D(n,oe,Date.now()),D(n,ae,n.defaults.raindropsTimeInterval),D(n,se,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var a=x(x({},n.defaults),r);if(n.interactive=a.interactive,n.resolution=a.resolution,n.perturbance=a.perturbance,n.dropRadius=a.dropRadius,n.crossOrigin=a.crossOrigin,n.imageUrl=a.imageUrl,n.idleFluctuations=a.idleFluctuations,!1===n.initState||null===t.parentElement||null===n.config||null===n.gl)return n.initState=!1,S(n);var u=n.gl,l=1/C(X,n);L(N,n,new Float32Array([l,l])),L(j,n,t.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,s.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(t),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(C(X,n)*C(X,n)*4):null,h=n.config,p=0;p<2;p++){var d=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,d),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,C(X,n),C(X,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,d,0),C(G,n).push(d),C(z,n).push(m)}return L(q,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,C(q,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),I(ue,n,Ee).call(n),I(ue,n,ye).call(n),I(ue,n,be).call(n),I(ue,n,fe).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),L(K,n,!0),L(V,n,!0),L(J,n,!0),I(ue,n,ce).call(n),L(Q,n,requestAnimationFrame((function(){return I(ue,n,he).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}(e,T),t=e,r=[{key:"accelerating",set:function(e){e>100||e<2||L(W,this,e)}},{key:"resolution",set:function(e){e<100||e>550||L(X,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||L(B,this,e)}},{key:"playingState",set:function(e){L(V,this,!1!==e)}},{key:"initialized",get:function(){return C(J,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||L(ae,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(C(j,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=C(j,this).offsetWidth,a=C(j,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,C(X,this),C(X,this)),i.bindFramebuffer(i.FRAMEBUFFER,C(z,this)[C(H,this)]),Reflect.apply(h,this,[C(G,this)[C(Y,this)]]),i.useProgram(C(te,this).id),i.uniform2fv(C(te,this).locations.center,u),i.uniform1f(C(te,this).locations.radius,r),i.uniform1f(C(te,this).locations.strength,n),I(ue,this,pe).call(this),I(ue,this,ve).call(this)}},{key:"updateSize",value:function(){var e=C(j,this).offsetWidth,t=C(j,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=C(j,this);t&&(Object.keys(C(se,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,C(se,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),I(ue,this,Re).call(this),C(Q,this)&&window.cancelAnimationFrame(C(Q,this))}},{key:"show",value:function(){L(K,this,!0),this.canvas.style.visibility="visible",I(ue,this,Te).call(this)}},{key:"hide",value:function(){L(K,this,!1),this.canvas.style.visibility="hidden",I(ue,this,Re).call(this)}},{key:"pause",value:function(){L(V,this,!1)}},{key:"play",value:function(){L(V,this,!0)}},{key:"changePlayingState",value:function(){L(V,this,!C(V,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,I(ue,this,fe).call(this)):this[e]=t}}],r&&P(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function ce(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(K,e)&&C(V,e)&&e.interactive&&(L(oe,e,Date.now()),I(ue,e,we).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};C(se,this).mousemove=function(r){for(var n=C(W,e);n--;)t(r)},C(se,this).touchmove=C(se,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},C(se,this).mousedown=function(e){return t(e,!0)},Object.keys(C(se,this)).forEach((function(t){return C(j,e)&&C(j,e).addEventListener(t,C(se,e)[t],{passive:!0})}))}function fe(){var e=this,t=this.gl,r=this.imageUrl||c(C(Z,this))||c(window.getComputedStyle(C(j,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,C($,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),L(re,e,n.width),L(ne,e,n.height),I(ue,e,Te).call(e)},n.onerror=function(){return I(ue,e,be).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else I(ue,this,be).call(this)}function he(){var e=this;C(K,this)&&(I(ue,this,ge).call(this),C(V,this)&&I(ue,this,me).call(this),I(ue,this,de).call(this),L(Q,this,requestAnimationFrame((function(){return I(ue,e,he).call(e)}))))}function pe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,C(q,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function de(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(h,this,[C($,this),0]),Reflect.apply(h,this,[C(G,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,C(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),I(ue,this,pe).call(this),e.disable(e.BLEND)}function me(){if(this.idleFluctuations){var e=Date.now();e-C(oe,this)>C(ae,this)&&(L(oe,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,C(X,this),C(X,this)),t.bindFramebuffer(t.FRAMEBUFFER,C(z,this)[C(H,this)]),Reflect.apply(h,this,[C(G,this)[C(Y,this)]]),t.useProgram(C(ee,this).id),I(ue,this,pe).call(this),I(ue,this,ve).call(this)}function ve(){L(H,this,1-C(H,this)),L(Y,this,1-C(Y,this))}function ge(){var e,t,r,n=window.getComputedStyle(C(j,this)).backgroundSize,i=window.getComputedStyle(C(j,this)).backgroundAttachment,o=(e=window.getComputedStyle(C(j,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):p(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:C(j,this).getBoundingClientRect().left,top:C(j,this).getBoundingClientRect().top,width:C(j,this).scrollWidth,height:C(j,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/C(re,this),a.height/C(ne,this));t=C(re,this)*s,r=C(ne,this)*s}else if("contain"==n){var u=Math.min(a.width/C(re,this),a.height/C(ne,this));t=C(re,this)*u,r=C(ne,this)*u}else{var l=n.split(" ");t=l[0]||"",r=l[1]||t,p(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),p(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=C(re,this),r=C(ne,this)):("auto"==t&&(t=C(re,this)*(Number(r)/C(ne,this))),"auto"==r&&(r=C(ne,this)*(Number(t)/C(re,this))))}var c=o&&o[0]||"0%",f=o&&o[1]||"0%";c=p(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),f=p(f)?(a.top+(a.height-Number(r))*parseFloat(f)/100).toString():(a.top+parseFloat(f)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(C(j,this).offsetLeft-Number(c))/Number(t),(C(j,this).offsetTop-Number(f))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+C(j,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+C(j,this).clientHeight/Number(r)]);var h=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/h,this.canvas.height/h])}function Ee(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";L(te,this,f(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),L(ee,this,f(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(C(ee,this).locations.delta,C(N,this)),this.renderProgram=f("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,C(N,this))}function ye(){var e=this.gl;L($,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,C($,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function be(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,C($,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function Te(){var e=C(j,this).style.backgroundImage;"none"!=e&&(L(ie,this,e),L(Z,this,window.getComputedStyle(C(j,this)).backgroundImage),C(j,this).style.backgroundImage="none")}function Re(){C(j,this).style.backgroundImage=C(ie,this)||""}function we(e,t,r){var n=window.getComputedStyle(C(j,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=C(j,this).getBoundingClientRect();this.drop(e.pageX-a.left-i,e.pageY-a.top-o,t,r)}function _e(e,t){var r=(0,a.useRef)(null);return(0,a.useEffect)((function(){return r.current=new le(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}var xe=o.n;export{xe as useRipples};
|
|
1
|
+
import*as e from"react";import*as t from"a-element-inline-style";var r={649:(t,r,n)=>{var i,o;t.exports=(i={useEffect:()=>e.useEffect,useRef:()=>e.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{n:()=>_e});var a=i(649);const s=(l={setStyle:()=>t.setStyle},u={},i.d(u,l),u);var l,u;function c(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function f(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function p(e){return e.endsWith("%")}function d(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function g(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function E(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}var b="lmssee_ripper_element_style",T=g((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),E(this,"styleElement",document.createElement("style")),E(this,"canvas",void 0),E(this,"gl",void 0),E(this,"config",void 0),E(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),E(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(b))){var n=this.styleElement;n.id=b,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(d,this,[])})),R={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){U(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,M(n.key),n)}}function S(e,t){if(t&&("object"==w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function F(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(F=function(){return!!e})()}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function D(e,t,r){k(e,t),t.set(e,r)}function k(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function U(e,t,r){return(t=M(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M(e){var t=function(e){if("object"!=w(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==w(t)?t:t+""}function C(e,t){return e.get(I(e,t))}function L(e,t,r){return e.set(I(e,t),r),r}function I(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(R);var W=new WeakMap,X=new WeakMap,B=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakMap,se=new WeakMap,le=new WeakSet,ue=function(){function e(t,r){var n,i,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(e,t,r){return t=A(t),S(e,F()?Reflect.construct(t,r||[],A(e).constructor):t.apply(e,r))}(this,e,[t]),k(i=n,o=le),o.add(i),U(n,"defaults",R),U(n,"interactive",n.defaults.interactive),D(n,W,n.defaults.accelerating),D(n,X,n.defaults.resolution),D(n,B,n.defaults.perturbance),U(n,"dropRadius",void 0),U(n,"crossOrigin",""),U(n,"imageUrl",void 0),U(n,"idleFluctuations",!0),D(n,j,void 0),D(n,N,void 0),D(n,G,[]),D(n,z,[]),D(n,H,0),D(n,Y,1),D(n,q,void 0),D(n,K,!1),D(n,V,!1),D(n,J,!1),D(n,Q,0),D(n,Z,""),U(n,"imageSource",""),U(n,"renderProgram",void 0),D(n,$,void 0),D(n,ee,void 0),D(n,te,void 0),D(n,re,void 0),D(n,ne,void 0),D(n,ie,void 0),D(n,oe,Date.now()),D(n,ae,n.defaults.raindropsTimeInterval),D(n,se,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var a=x(x({},n.defaults),r);if(n.interactive=a.interactive,n.resolution=a.resolution,n.perturbance=a.perturbance,n.dropRadius=a.dropRadius,n.crossOrigin=a.crossOrigin,n.imageUrl=a.imageUrl,n.idleFluctuations=a.idleFluctuations,!1===n.initState||null===t.parentElement||null===n.config||null===n.gl)return n.initState=!1,S(n);var l=n.gl,u=1/C(X,n);L(N,n,new Float32Array([u,u])),L(j,n,t.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,s.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(t),n.config.extensions.forEach((function(e){return l.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(C(X,n)*C(X,n)*4):null,h=n.config,p=0;p<2;p++){var d=l.createTexture(),m=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,m),l.bindTexture(l.TEXTURE_2D,d),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,C(X,n),C(X,n),0,l.RGBA,h.type,f),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,d,0),C(G,n).push(d),C(z,n).push(m)}return L(q,n,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,C(q,n)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),I(le,n,Ee).call(n),I(le,n,ye).call(n),I(le,n,be).call(n),I(le,n,fe).call(n),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),L(K,n,!0),L(V,n,!0),L(J,n,!0),I(le,n,ce).call(n),L(Q,n,requestAnimationFrame((function(){return I(le,n,he).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}(e,T),t=e,r=[{key:"accelerating",set:function(e){e>100||e<2||L(W,this,e)}},{key:"resolution",set:function(e){e<100||e>550||L(X,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||L(B,this,e)}},{key:"playingState",set:function(e){L(V,this,!1!==e)}},{key:"initialized",get:function(){return C(J,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||L(ae,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(C(j,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=C(j,this).offsetWidth,a=C(j,this).offsetHeight,s=Math.max(o,a);r/=s;var l=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,C(X,this),C(X,this)),i.bindFramebuffer(i.FRAMEBUFFER,C(z,this)[C(H,this)]),Reflect.apply(h,this,[C(G,this)[C(Y,this)]]),i.useProgram(C(te,this).id),i.uniform2fv(C(te,this).locations.center,l),i.uniform1f(C(te,this).locations.radius,r),i.uniform1f(C(te,this).locations.strength,n),I(le,this,pe).call(this),I(le,this,ve).call(this)}},{key:"updateSize",value:function(){var e=C(j,this).offsetWidth,t=C(j,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=C(j,this);t&&(Object.keys(C(se,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,C(se,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),I(le,this,Re).call(this),C(Q,this)&&window.cancelAnimationFrame(C(Q,this))}},{key:"show",value:function(){L(K,this,!0),this.canvas.style.visibility="visible",I(le,this,Te).call(this)}},{key:"hide",value:function(){L(K,this,!1),this.canvas.style.visibility="hidden",I(le,this,Re).call(this)}},{key:"pause",value:function(){L(V,this,!1)}},{key:"play",value:function(){L(V,this,!0)}},{key:"changePlayingState",value:function(){L(V,this,!C(V,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,I(le,this,fe).call(this)):this[e]=t}}],r&&P(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function ce(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(K,e)&&C(V,e)&&e.interactive&&(L(oe,e,Date.now()),I(le,e,we).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};C(se,this).mousemove=function(r){for(var n=C(W,e);n--;)t(r)},C(se,this).touchmove=C(se,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},C(se,this).mousedown=function(e){return t(e,!0)},Object.keys(C(se,this)).forEach((function(t){return C(j,e)&&C(j,e).addEventListener(t,C(se,e)[t],{passive:!0})}))}function fe(){var e=this,t=this.gl,r=this.imageUrl||c(C(Z,this))||c(window.getComputedStyle(C(j,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,C($,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),L(re,e,n.width),L(ne,e,n.height),I(le,e,Te).call(e)},n.onerror=function(){return I(le,e,be).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else I(le,this,be).call(this)}function he(){var e=this;C(K,this)&&(I(le,this,ge).call(this),I(le,this,me).call(this),I(le,this,de).call(this),L(Q,this,requestAnimationFrame((function(){return I(le,e,he).call(e)}))))}function pe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,C(q,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function de(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(h,this,[C($,this),0]),Reflect.apply(h,this,[C(G,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,C(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),I(le,this,pe).call(this),e.disable(e.BLEND)}function me(){if(this.idleFluctuations&&C(V,this)){var e=Date.now();e-C(oe,this)>C(ae,this)&&(L(oe,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,C(X,this),C(X,this)),t.bindFramebuffer(t.FRAMEBUFFER,C(z,this)[C(H,this)]),Reflect.apply(h,this,[C(G,this)[C(Y,this)]]),t.useProgram(C(ee,this).id),I(le,this,pe).call(this),I(le,this,ve).call(this)}function ve(){L(H,this,1-C(H,this)),L(Y,this,1-C(Y,this))}function ge(){var e,t,r,n=window.getComputedStyle(C(j,this)).backgroundSize,i=window.getComputedStyle(C(j,this)).backgroundAttachment,o=(e=window.getComputedStyle(C(j,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):p(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:C(j,this).getBoundingClientRect().left,top:C(j,this).getBoundingClientRect().top,width:C(j,this).scrollWidth,height:C(j,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/C(re,this),a.height/C(ne,this));t=C(re,this)*s,r=C(ne,this)*s}else if("contain"==n){var l=Math.min(a.width/C(re,this),a.height/C(ne,this));t=C(re,this)*l,r=C(ne,this)*l}else{var u=n.split(" ");t=u[0]||"",r=u[1]||t,p(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),p(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=C(re,this),r=C(ne,this)):("auto"==t&&(t=C(re,this)*(Number(r)/C(ne,this))),"auto"==r&&(r=C(ne,this)*(Number(t)/C(re,this))))}var c=o&&o[0]||"0%",f=o&&o[1]||"0%";c=p(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),f=p(f)?(a.top+(a.height-Number(r))*parseFloat(f)/100).toString():(a.top+parseFloat(f)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(C(j,this).offsetLeft-Number(c))/Number(t),(C(j,this).offsetTop-Number(f))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+C(j,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+C(j,this).clientHeight/Number(r)]);var h=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/h,this.canvas.height/h])}function Ee(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";L(te,this,f(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),L(ee,this,f(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(C(ee,this).locations.delta,C(N,this)),this.renderProgram=f("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,C(N,this))}function ye(){var e=this.gl;L($,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,C($,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function be(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,C($,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function Te(){var e=C(j,this).style.backgroundImage;"none"!=e&&(L(ie,this,e),L(Z,this,window.getComputedStyle(C(j,this)).backgroundImage),C(j,this).style.backgroundImage="none")}function Re(){C(j,this).style.backgroundImage=C(ie,this)||""}function we(e,t,r){var n=window.getComputedStyle(C(j,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=C(j,this).getBoundingClientRect(),s=e.clientX-a.left-i,l=e.clientY-a.top-o;this.drop(s,l,t,r)}function _e(e,t){var r=(0,a.useRef)(null);return(0,a.useEffect)((function(){return r.current=new ue(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}var xe=o.n;export{xe as useRipples};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oops-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -64,12 +64,8 @@
|
|
|
64
64
|
"require": "./dist/useInputIsComposing/index.cjs",
|
|
65
65
|
"import": "./dist/useInputIsComposing/index.mjs"
|
|
66
66
|
},
|
|
67
|
-
"./
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
"./oopsCss": {
|
|
71
|
-
"style": "./dist/styles/common.css"
|
|
72
|
-
}
|
|
67
|
+
"./scss": "./css/common.scss",
|
|
68
|
+
"./css": "./dist/styles/common.css"
|
|
73
69
|
},
|
|
74
70
|
"publishConfig": {
|
|
75
71
|
"access": "public",
|
|
@@ -127,4 +123,4 @@
|
|
|
127
123
|
"webpack-cli": "^5.1.4",
|
|
128
124
|
"webpack-dev-server": "^5.2.0"
|
|
129
125
|
}
|
|
130
|
-
}
|
|
126
|
+
}
|