1function _mergeNamespaces(n, m) { 2 for (var i = 0; i < m.length; i++) { 3 const e = m[i]; 4 if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) { 5 if (k !== 'default' && !(k in n)) { 6 const d = Object.getOwnPropertyDescriptor(e, k); 7 if (d) { 8 Object.defineProperty(n, k, d.get ? d : { 9 enumerable: true, 10 get: () => e[k] 11 }); 12 } 13 } 14 } } 15 } 16 return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' })); 17} 18 19true&&(function polyfill() { 20 const relList = document.createElement("link").relList; 21 if (relList && relList.supports && relList.supports("modulepreload")) { 22 return; 23 } 24 for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { 25 processPreload(link); 26 } 27 new MutationObserver((mutations) => { 28 for (const mutation of mutations) { 29 if (mutation.type !== "childList") { 30 continue; 31 } 32 for (const node of mutation.addedNodes) { 33 if (node.tagName === "LINK" && node.rel === "modulepreload") 34 processPreload(node); 35 } 36 } 37 }).observe(document, { childList: true, subtree: true }); 38 function getFetchOpts(link) { 39 const fetchOpts = {}; 40 if (link.integrity) fetchOpts.integrity = link.integrity; 41 if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; 42 if (link.crossOrigin === "use-credentials") 43 fetchOpts.credentials = "include"; 44 else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; 45 else fetchOpts.credentials = "same-origin"; 46 return fetchOpts; 47 } 48 function processPreload(link) { 49 if (link.ep) 50 return; 51 link.ep = true; 52 const fetchOpts = getFetchOpts(link); 53 fetch(link.href, fetchOpts); 54 } 55}()); 56 57var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 58 59function getDefaultExportFromCjs (x) { 60 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; 61} 62 63var jsxRuntime = {exports: {}}; 64 65var reactJsxRuntime_production_min = {}; 66 67var react = {exports: {}}; 68 69var react_production_min = {}; 70 71/** 72 * @license React 73 * react.production.min.js 74 * 75 * Copyright (c) Facebook, Inc. and its affiliates. 76 * 77 * This source code is licensed under the MIT license found in the 78 * LICENSE file in the root directory of this source tree. 79 */ 80var l$2=Symbol.for("react.element"),n$3=Symbol.for("react.portal"),p$4=Symbol.for("react.fragment"),q$3=Symbol.for("react.strict_mode"),r$2=Symbol.for("react.profiler"),t$2=Symbol.for("react.provider"),u$1=Symbol.for("react.context"),v$3=Symbol.for("react.forward_ref"),w$3=Symbol.for("react.suspense"),x$2=Symbol.for("react.memo"),y$2=Symbol.for("react.lazy"),z$2=Symbol.iterator;function A$2(a){if(null===a||"object"!==typeof a)return null;a=z$2&&a[z$2]||a["@@iterator"];return "function"===typeof a?a:null} 81var B$1={isMounted:function(){return false},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$2=Object.assign,D$2={};function E$1(a,b,e){this.props=a;this.context=b;this.refs=D$2;this.updater=e||B$1;}E$1.prototype.isReactComponent={}; 82E$1.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E$1.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F$1(){}F$1.prototype=E$1.prototype;function G$1(a,b,e){this.props=a;this.context=b;this.refs=D$2;this.updater=e||B$1;}var H$1=G$1.prototype=new F$1; 83H$1.constructor=G$1;C$2(H$1,E$1.prototype);H$1.isPureReactComponent=true;var I$2=Array.isArray,J$1=Object.prototype.hasOwnProperty,K$2={current:null},L$2={key:true,ref:true,__self:true,__source:true}; 84function M$1(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J$1.call(b,d)&&!L$2.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g) void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l$2,type:a,key:k,ref:h,props:c,_owner:K$2.current}} 85function N$1(a,b){return {$$typeof:l$2,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}
vendor: 37,318 bytes, lines 85-237
85function O$1(a){return "object"===typeof a&&null!==a&&a.$$typeof===l$2}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P$1=/\/+/g;function Q$2(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)} 86function R$1(a,b,e,d,c){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=false;if(null===a)h=true;else switch(k){case "string":case "number":h=true;break;case "object":switch(a.$$typeof){case l$2:case n$3:h=true;}}if(h)return h=a,c=c(h),a=""===d?"."+Q$2(h,0):d,I$2(c)?(e="",null!=a&&(e=a.replace(P$1,"$&/")+"/"),R$1(c,b,e,"",function(a){return a})):null!=c&&(O$1(c)&&(c=N$1(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P$1,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I$2(a))for(var g=0;g<a.length;g++){k= 87a[g];var f=d+Q$2(k,g);h+=R$1(k,b,e,f,c);}else if(f=A$2(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q$2(k,g++),h+=R$1(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h} 88function S$2(a,b,e){if(null==a)return a;var d=[],c=0;R$1(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T$2(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;} 89var U$2={current:null},V$2={transition:null},W$2={ReactCurrentDispatcher:U$2,ReactCurrentBatchConfig:V$2,ReactCurrentOwner:K$2};function X$2(){throw Error("act(...) is not supported in production builds of React.");} 90react_production_min.Children={map:S$2,forEach:function(a,b,e){S$2(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S$2(a,function(){b++;});return b},toArray:function(a){return S$2(a,function(a){return a})||[]},only:function(a){if(!O$1(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E$1;react_production_min.Fragment=p$4;react_production_min.Profiler=r$2;react_production_min.PureComponent=G$1;react_production_min.StrictMode=q$3;react_production_min.Suspense=w$3; 91react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W$2;react_production_min.act=X$2; 92react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C$2({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){ void 0!==b.ref&&(k=b.ref,h=K$2.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J$1.call(b,f)&&!L$2.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f); 93for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l$2,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u$1,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t$2,_context:a};return a.Consumer=a};react_production_min.createElement=M$1;react_production_min.createFactory=function(a){var b=M$1.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}}; 94react_production_min.forwardRef=function(a){return {$$typeof:v$3,render:a}};react_production_min.isValidElement=O$1;react_production_min.lazy=function(a){return {$$typeof:y$2,_payload:{_status:-1,_result:a},_init:T$2}};react_production_min.memo=function(a,b){return {$$typeof:x$2,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V$2.transition;V$2.transition={};try{a();}finally{V$2.transition=b;}};react_production_min.unstable_act=X$2;react_production_min.useCallback=function(a,b){return U$2.current.useCallback(a,b)};react_production_min.useContext=function(a){return U$2.current.useContext(a)}; 95react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U$2.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U$2.current.useEffect(a,b)};react_production_min.useId=function(){return U$2.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U$2.current.useImperativeHandle(a,b,e)};react_production_min.useInsertionEffect=function(a,b){return U$2.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U$2.current.useLayoutEffect(a,b)}; 96react_production_min.useMemo=function(a,b){return U$2.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U$2.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U$2.current.useRef(a)};react_production_min.useState=function(a){return U$2.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U$2.current.useSyncExternalStore(a,b,e)};react_production_min.useTransition=function(){return U$2.current.useTransition()};react_production_min.version="18.3.1"; 97 98{ 99 react.exports = react_production_min; 100} 101 102var reactExports = react.exports; 103const e$2 = /*@__PURE__*/getDefaultExportFromCjs(reactExports); 104 105const React = /*#__PURE__*/_mergeNamespaces({ 106 __proto__: null, 107 default: e$2 108}, [reactExports]); 109 110/** 111 * @license React 112 * react-jsx-runtime.production.min.js 113 * 114 * Copyright (c) Facebook, Inc. and its affiliates. 115 * 116 * This source code is licensed under the MIT license found in the 117 * LICENSE file in the root directory of this source tree. 118 */ 119var f$2=reactExports,k$1=Symbol.for("react.element"),l$1=Symbol.for("react.fragment"),m$3=Object.prototype.hasOwnProperty,n$2=f$2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$3={key:true,ref:true,__self:true,__source:true}; 120function q$2(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m$3.call(a,b)&&!p$3.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k$1,type:c,key:e,ref:h,props:d,_owner:n$2.current}}reactJsxRuntime_production_min.Fragment=l$1;reactJsxRuntime_production_min.jsx=q$2;reactJsxRuntime_production_min.jsxs=q$2; 121 122{ 123 jsxRuntime.exports = reactJsxRuntime_production_min; 124} 125 126var jsxRuntimeExports = jsxRuntime.exports; 127 128var client = {}; 129 130var reactDom = {exports: {}}; 131 132var reactDom_production_min = {}; 133 134var scheduler = {exports: {}}; 135 136var scheduler_production_min = {}; 137 138/** 139 * @license React 140 * scheduler.production.min.js 141 * 142 * Copyright (c) Facebook, Inc. and its affiliates. 143 * 144 * This source code is licensed under the MIT license found in the 145 * LICENSE file in the root directory of this source tree. 146 */ 147 148(function (exports) { 149function f(a,b){var c=a.length;a.push(b);a:for(;0<c;){var d=c-1>>>1,e=a[d];if(0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length,w=e>>>1;d<w;){var m=2*(d+1)-1,C=a[m],n=m+1,x=a[n];if(0>g(C,c))n<e&&0>g(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(n<e&&0>g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b} 150 function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()};}else {var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q};}var r=[],t=[],u=1,v=null,y=3,z=false,A=false,B=false,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null; 151 "undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t);}}function H(a){B=false;G(a);if(!A)if(null!==h(r))A=true,I(J);else {var b=h(t);null!==b&&K(H,b.startTime-a);}} 152 function J(a,b){A=false;B&&(B=false,E(L),L=-1);z=true;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if("function"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?v.callback=e:v===h(r)&&k(r);G(b);}else k(r);v=h(r);}if(null!==v)var w=!0;else {var m=h(t);null!==m&&K(H,m.startTime-b);w=!1;}return w}finally{v=null,y=c,z=false;}}var N=false,O=null,L=-1,P=5,Q=-1; 153 function M(){return exports.unstable_now()-Q<P?false:true}function R(){if(null!==O){var a=exports.unstable_now();Q=a;var b=true;try{b=O(!0,a);}finally{b?S():(N=false,O=null);}}else N=false;}var S;if("function"===typeof F)S=function(){F(R);};else if("undefined"!==typeof MessageChannel){var T=new MessageChannel,U=T.port2;T.port1.onmessage=R;S=function(){U.postMessage(null);};}else S=function(){D(R,0);};function I(a){O=a;N||(N=true,S());}function K(a,b){L=D(function(){a(exports.unstable_now());},b);} 154 exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null;};exports.unstable_continueExecution=function(){A||z||(A=true,I(J));}; 155 exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<a?Math.floor(1E3/a):5;};exports.unstable_getCurrentPriorityLevel=function(){return y};exports.unstable_getFirstCallbackNode=function(){return h(r)};exports.unstable_next=function(a){switch(y){case 1:case 2:case 3:var b=3;break;default:b=y;}var c=y;y=b;try{return a()}finally{y=c;}};exports.unstable_pauseExecution=function(){}; 156 exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3;}var c=y;y=a;try{return b()}finally{y=c;}}; 157 exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3;}e=c+e;a={id:u++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=true,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=true,I(J)));return a}; 158 exports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c;}}}; 159} (scheduler_production_min)); 160 161{ 162 scheduler.exports = scheduler_production_min; 163} 164 165var schedulerExports = scheduler.exports; 166 167/** 168 * @license React 169 * react-dom.production.min.js 170 * 171 * Copyright (c) Facebook, Inc. and its affiliates. 172 * 173 * This source code is licensed under the MIT license found in the 174 * LICENSE file in the root directory of this source tree. 175 */ 176var aa=reactExports,ca=schedulerExports;function p$2(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var da=new Set,ea={};function fa(a,b){ha(a,b);ha(a+"Capture",b);} 177function ha(a,b){ea[a]=b;for(a=0;a<b.length;a++)da.add(b[a]);} 178var ia=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),ja=Object.prototype.hasOwnProperty,ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la= 179{},ma={};function oa(a){if(ja.call(ma,a))return true;if(ja.call(la,a))return false;if(ka.test(a))return ma[a]=true;la[a]=true;return false}function pa(a,b,c,d){if(null!==c&&0===c.type)return false;switch(typeof b){case "function":case "symbol":return true;case "boolean":if(d)return false;if(null!==c)return !c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return "data-"!==a&&"aria-"!==a;default:return false}} 180function qa(a,b,c,d){if(null===b||"undefined"===typeof b||pa(a,b,c,d))return true;if(d)return false;if(null!==c)switch(c.type){case 3:return !b;case 4:return false===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return false}function v$2(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g;}var z$1={}; 181"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){z$1[a]=new v$2(a,0,false,a,null,false,false);});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];z$1[b]=new v$2(b,1,false,a[1],null,false,false);});["contentEditable","draggable","spellCheck","value"].forEach(function(a){z$1[a]=new v$2(a,2,false,a.toLowerCase(),null,false,false);}); 182["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){z$1[a]=new v$2(a,2,false,a,null,false,false);});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){z$1[a]=new v$2(a,3,false,a.toLowerCase(),null,false,false);}); 183["checked","multiple","muted","selected"].forEach(function(a){z$1[a]=new v$2(a,3,true,a,null,false,false);});["capture","download"].forEach(function(a){z$1[a]=new v$2(a,4,false,a,null,false,false);});["cols","rows","size","span"].forEach(function(a){z$1[a]=new v$2(a,6,false,a,null,false,false);});["rowSpan","start"].forEach(function(a){z$1[a]=new v$2(a,5,false,a.toLowerCase(),null,false,false);});var ra=/[\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()} 184"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(ra, 185sa);z$1[b]=new v$2(b,1,false,a,null,false,false);});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(ra,sa);z$1[b]=new v$2(b,1,false,a,"http://www.w3.org/1999/xlink",false,false);});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(ra,sa);z$1[b]=new v$2(b,1,false,a,"http://www.w3.org/XML/1998/namespace",false,false);});["tabIndex","crossOrigin"].forEach(function(a){z$1[a]=new v$2(a,1,false,a.toLowerCase(),null,false,false);}); 186z$1.xlinkHref=new v$2("xlinkHref",1,false,"xlink:href","http://www.w3.org/1999/xlink",true,false);["src","href","action","formAction"].forEach(function(a){z$1[a]=new v$2(a,1,false,a.toLowerCase(),null,true,true);}); 187function ta(a,b,c,d){var e=z$1.hasOwnProperty(b)?z$1[b]:null;if(null!==e?0!==e.type:d||!(2<b.length)||"o"!==b[0]&&"O"!==b[0]||"n"!==b[1]&&"N"!==b[1])qa(b,c,e,d)&&(c=null),d||null===e?oa(b)&&(null===c?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=null===c?3===e.type?false:"":c:(b=e.attributeName,d=e.attributeNamespace,null===c?a.removeAttribute(b):(e=e.type,c=3===e||4===e&&true===c?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c)));} 188var ua=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,va=Symbol.for("react.element"),wa=Symbol.for("react.portal"),ya=Symbol.for("react.fragment"),za=Symbol.for("react.strict_mode"),Aa=Symbol.for("react.profiler"),Ba=Symbol.for("react.provider"),Ca=Symbol.for("react.context"),Da=Symbol.for("react.forward_ref"),Ea=Symbol.for("react.suspense"),Fa=Symbol.for("react.suspense_list"),Ga=Symbol.for("react.memo"),Ha=Symbol.for("react.lazy");var Ia=Symbol.for("react.offscreen");var Ja=Symbol.iterator;function Ka(a){if(null===a||"object"!==typeof a)return null;a=Ja&&a[Ja]||a["@@iterator"];return "function"===typeof a?a:null}var A$1=Object.assign,La;function Ma(a){if(void 0===La)try{throw Error();}catch(c){var b=c.stack.trim().match(/\n( *(at )?)/);La=b&&b[1]||"";}return "\n"+La+a}var Na=false; 189function Oa(a,b){if(!a||Na)return "";Na=true;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(b)if(b=function(){throw Error();},Object.defineProperty(b.prototype,"props",{set:function(){throw Error();}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(b,[]);}catch(l){var d=l;}Reflect.construct(a,[],b);}else {try{b.call();}catch(l){d=l;}a.call(b.prototype);}else {try{throw Error();}catch(l){d=l;}a();}}catch(l){if(l&&d&&"string"===typeof l.stack){for(var e=l.stack.split("\n"), 190f=d.stack.split("\n"),g=e.length-1,h=f.length-1;1<=g&&0<=h&&e[g]!==f[h];)h--;for(;1<=g&&0<=h;g--,h--)if(e[g]!==f[h]){if(1!==g||1!==h){do if(g--,h--,0>h||e[g]!==f[h]){var k="\n"+e[g].replace(" at new "," at ");a.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=false,Error.prepareStackTrace=c;}return (a=a?a.displayName||a.name:"")?Ma(a):""} 191function Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return a=Oa(a.type,false),a;case 11:return a=Oa(a.type.render,false),a;case 1:return a=Oa(a.type,true),a;default:return ""}} 192function Qa(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case ya:return "Fragment";case wa:return "Portal";case Aa:return "Profiler";case za:return "StrictMode";case Ea:return "Suspense";case Fa:return "SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case Ca:return (a.displayName||"Context")+".Consumer";case Ba:return (a._context.displayName||"Context")+".Provider";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName|| 193b.name||"",a=""!==a?"ForwardRef("+a+")":"ForwardRef");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||"Memo";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null} 194function Ra(a){var b=a.type;switch(a.tag){case 24:return "Cache";case 9:return (b.displayName||"Context")+".Consumer";case 10:return (b._context.displayName||"Context")+".Provider";case 18:return "DehydratedFragment";case 11:return a=b.render,a=a.displayName||a.name||"",b.displayName||(""!==a?"ForwardRef("+a+")":"ForwardRef");case 7:return "Fragment";case 5:return b;case 4:return "Portal";case 3:return "Root";case 6:return "Text";case 16:return Qa(b);case 8:return b===za?"StrictMode":"Mode";case 22:return "Offscreen"; 195case 12:return "Profiler";case 21:return "Scope";case 13:return "Suspense";case 19:return "SuspenseList";case 25:return "TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof b)return b.displayName||b.name||null;if("string"===typeof b)return b}return null}function Sa(a){switch(typeof a){case "boolean":case "number":case "string":case "undefined":return a;case "object":return a;default:return ""}} 196function Ta(a){var b=a.type;return (a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)} 197function Ua(a){var b=Ta(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:true,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a);}});Object.defineProperty(a,b,{enumerable:c.enumerable});return {getValue:function(){return d},setValue:function(a){d=""+a;},stopTracking:function(){a._valueTracker= 198null;delete a[b];}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a));}function Wa(a){if(!a)return false;var b=a._valueTracker;if(!b)return true;var c=b.getValue();var d="";a&&(d=Ta(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),true):false}function Xa(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}} 199function Ya(a,b){var c=b.checked;return A$1({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value};}function ab(a,b){b=b.checked;null!=b&&ta(a,"checked",b,false);} 200function bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c;}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?cb(a,b.type,c):b.hasOwnProperty("defaultValue")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked);} 201function db(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b;}c=a.name;""!==c&&(a.name="");a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c);} 202function cb(a,b,c){if("number"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c);}var eb=Array.isArray; 203function fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e<c.length;e++)b["$"+c[e]]=true;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=true);}else {c=""+Sa(c);b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=true;d&&(a[e].defaultSelected=true);return}null!==b||a[e].disabled||(b=a[e]);}null!==b&&(b.selected=true);}} 204function gb(a,b){if(null!=b.dangerouslySetInnerHTML)throw Error(p$2(91));return A$1({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function hb(a,b){var c=b.value;if(null==c){c=b.children;b=b.defaultValue;if(null!=c){if(null!=b)throw Error(p$2(92));if(eb(c)){if(1<c.length)throw Error(p$2(93));c=c[0];}b=c;}null==b&&(b="");c=b;}a._wrapperState={initialValue:Sa(c)};} 205function ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=""+d);}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&""!==b&&null!==b&&(a.value=b);}function kb(a){switch(a){case "svg":return "http://www.w3.org/2000/svg";case "math":return "http://www.w3.org/1998/Math/MathML";default:return "http://www.w3.org/1999/xhtml"}} 206function lb(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?kb(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a} 207var mb,nb=function(a){return "undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)});}:a}(function(a,b){if("http://www.w3.org/2000/svg"!==a.namespaceURI||"innerHTML"in a)a.innerHTML=b;else {mb=mb||document.createElement("div");mb.innerHTML="<svg>"+b.valueOf().toString()+"</svg>";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild);}}); 208function ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b;} 209var pb={animationIterationCount:true,aspectRatio:true,borderImageOutset:true,borderImageSlice:true,borderImageWidth:true,boxFlex:true,boxFlexGroup:true,boxOrdinalGroup:true,columnCount:true,columns:true,flex:true,flexGrow:true,flexPositive:true,flexShrink:true,flexNegative:true,flexOrder:true,gridArea:true,gridRow:true,gridRowEnd:true,gridRowSpan:true,gridRowStart:true,gridColumn:true,gridColumnEnd:true,gridColumnSpan:true,gridColumnStart:true,fontWeight:true,lineClamp:true,lineHeight:true,opacity:true,order:true,orphans:true,tabSize:true,widows:true,zIndex:true, 210zoom:true,fillOpacity:true,floodOpacity:true,stopOpacity:true,strokeDasharray:true,strokeDashoffset:true,strokeMiterlimit:true,strokeOpacity:true,strokeWidth:true},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a];});});function rb(a,b,c){return null==b||"boolean"===typeof b||""===b?"":c||"number"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(""+b).trim():b+"px"} 211function sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--"),e=rb(c,b[c],d);"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e;}}var tb=A$1({menuitem:true},{area:true,base:true,br:true,col:true,embed:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true}); 212function ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p$2(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p$2(60));if("object"!==typeof b.dangerouslySetInnerHTML||!("__html"in b.dangerouslySetInnerHTML))throw Error(p$2(61));}if(null!=b.style&&"object"!==typeof b.style)throw Error(p$2(62));}} 213function vb(a,b){if(-1===a.indexOf("-"))return "string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return false;default:return true}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null; 214function Bb(a){if(a=Cb(a)){if("function"!==typeof yb)throw Error(p$2(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b));}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a;}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a<b.length;a++)Bb(b[a]);}}function Gb(a,b){return a(b)}function Hb(){}var Ib=false;function Jb(a,b,c){if(Ib)return a(b,c);Ib=true;try{return Gb(a,b,c)}finally{if(Ib=false,null!==zb||null!==Ab)Hb(),Fb();}} 215function Kb(a,b){var c=a.stateNode;if(null===c)return null;var d=Db(c);if(null===d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":case "onMouseEnter":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=false;}if(a)return null;if(c&&"function"!== 216typeof c)throw Error(p$2(231,b,typeof c));return c}var Lb=false;if(ia)try{var Mb={};Object.defineProperty(Mb,"passive",{get:function(){Lb=!0;}});window.addEventListener("test",Mb,Mb);window.removeEventListener("test",Mb,Mb);}catch(a){Lb=false;}function Nb(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l);}catch(m){this.onError(m);}}var Ob=false,Pb=null,Qb=false,Rb=null,Sb={onError:function(a){Ob=true;Pb=a;}};function Tb(a,b,c,d,e,f,g,h,k){Ob=false;Pb=null;Nb.apply(Sb,arguments);} 217function Ub(a,b,c,d,e,f,g,h,k){Tb.apply(this,arguments);if(Ob){if(Ob){var l=Pb;Ob=false;Pb=null;}else throw Error(p$2(198));Qb||(Qb=true,Rb=l);}}function Vb(a){var b=a,c=a;if(a.alternate)for(;b.return;)b=b.return;else {a=b;do b=a,0!==(b.flags&4098)&&(c=b.return),a=b.return;while(a)}return 3===b.tag?c:null}function Wb(a){if(13===a.tag){var b=a.memoizedState;null===b&&(a=a.alternate,null!==a&&(b=a.memoizedState));if(null!==b)return b.dehydrated}return null}function Xb(a){if(Vb(a)!==a)throw Error(p$2(188));} 218function Yb(a){var b=a.alternate;if(!b){b=Vb(a);if(null===b)throw Error(p$2(188));return b!==a?null:a}for(var c=a,d=b;;){var e=c.return;if(null===e)break;var f=e.alternate;if(null===f){d=e.return;if(null!==d){c=d;continue}break}if(e.child===f.child){for(f=e.child;f;){if(f===c)return Xb(e),a;if(f===d)return Xb(e),b;f=f.sibling;}throw Error(p$2(188));}if(c.return!==d.return)c=e,d=f;else {for(var g=false,h=e.child;h;){if(h===c){g=true;c=e;d=f;break}if(h===d){g=true;d=e;c=f;break}h=h.sibling;}if(!g){for(h=f.child;h;){if(h=== 219c){g=true;c=f;d=e;break}if(h===d){g=true;d=f;c=e;break}h=h.sibling;}if(!g)throw Error(p$2(189));}}if(c.alternate!==d)throw Error(p$2(190));}if(3!==c.tag)throw Error(p$2(188));return c.stateNode.current===c?a:b}function Zb(a){a=Yb(a);return null!==a?$b(a):null}function $b(a){if(5===a.tag||6===a.tag)return a;for(a=a.child;null!==a;){var b=$b(a);if(null!==b)return b;a=a.sibling;}return null} 220var ac=ca.unstable_scheduleCallback,bc=ca.unstable_cancelCallback,cc=ca.unstable_shouldYield,dc=ca.unstable_requestPaint,B=ca.unstable_now,ec=ca.unstable_getCurrentPriorityLevel,fc=ca.unstable_ImmediatePriority,gc=ca.unstable_UserBlockingPriority,hc=ca.unstable_NormalPriority,ic=ca.unstable_LowPriority,jc=ca.unstable_IdlePriority,kc=null,lc=null;function mc(a){if(lc&&"function"===typeof lc.onCommitFiberRoot)try{lc.onCommitFiberRoot(kc,a,void 0,128===(a.current.flags&128));}catch(b){}} 221var oc=Math.clz32?Math.clz32:nc,pc=Math.log,qc=Math.LN2;function nc(a){a>>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304; 222function tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824; 223default:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)));}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0<b;)c=31-oc(b),e=1<<c,d|=a[c],b&=~e;return d} 224function vc(a,b){switch(a){case 1:case 2:case 4:return b+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return b+5E3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return -1;case 134217728:case 268435456:case 536870912:case 1073741824:return -1;default:return -1}} 225function wc(a,b){for(var c=a.suspendedLanes,d=a.pingedLanes,e=a.expirationTimes,f=a.pendingLanes;0<f;){var g=31-oc(f),h=1<<g,k=e[g];if(-1===k){if(0===(h&c)||0!==(h&d))e[g]=vc(h,b);}else k<=b&&(a.expiredLanes|=h);f&=~h;}}function xc(a){a=a.pendingLanes&-1073741825;return 0!==a?a:a&1073741824?1073741824:0}function yc(){var a=rc;rc<<=1;0===(rc&4194240)&&(rc=64);return a}function zc(a){for(var b=[],c=0;31>c;c++)b.push(a);return b} 226function Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c;}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0<c;){var e=31-oc(c),f=1<<e;b[e]=0;d[e]=-1;a[e]=-1;c&=~f;}} 227function Cc(a,b){var c=a.entangledLanes|=b;for(a=a.entanglements;c;){var d=31-oc(c),e=1<<d;e&b|a[d]&b&&(a[d]|=b);c&=~e;}}var C$1=0;function Dc(a){a&=-a;return 1<a?4<a?0!==(a&268435455)?16:536870912:4:1}var Ec,Fc,Gc,Hc,Ic,Jc=false,Kc=[],Lc=null,Mc=null,Nc=null,Oc=new Map,Pc=new Map,Qc=[],Rc="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" "); 228function Sc(a,b){switch(a){case "focusin":case "focusout":Lc=null;break;case "dragenter":case "dragleave":Mc=null;break;case "mouseover":case "mouseout":Nc=null;break;case "pointerover":case "pointerout":Oc.delete(b.pointerId);break;case "gotpointercapture":case "lostpointercapture":Pc.delete(b.pointerId);}} 229function Tc(a,b,c,d,e,f){if(null===a||a.nativeEvent!==f)return a={blockedOn:b,domEventName:c,eventSystemFlags:d,nativeEvent:f,targetContainers:[e]},null!==b&&(b=Cb(b),null!==b&&Fc(b)),a;a.eventSystemFlags|=d;b=a.targetContainers;null!==e&&-1===b.indexOf(e)&&b.push(e);return a} 230function Uc(a,b,c,d,e){switch(b){case "focusin":return Lc=Tc(Lc,a,b,c,d,e),true;case "dragenter":return Mc=Tc(Mc,a,b,c,d,e),true;case "mouseover":return Nc=Tc(Nc,a,b,c,d,e),true;case "pointerover":var f=e.pointerId;Oc.set(f,Tc(Oc.get(f)||null,a,b,c,d,e));return true;case "gotpointercapture":return f=e.pointerId,Pc.set(f,Tc(Pc.get(f)||null,a,b,c,d,e)),true}return false} 231function Vc(a){var b=Wc(a.target);if(null!==b){var c=Vb(b);if(null!==c)if(b=c.tag,13===b){if(b=Wb(c),null!==b){a.blockedOn=b;Ic(a.priority,function(){Gc(c);});return}}else if(3===b&&c.stateNode.current.memoizedState.isDehydrated){a.blockedOn=3===c.tag?c.stateNode.containerInfo:null;return}}a.blockedOn=null;} 232function Xc(a){if(null!==a.blockedOn)return false;for(var b=a.targetContainers;0<b.length;){var c=Yc(a.domEventName,a.eventSystemFlags,b[0],a.nativeEvent);if(null===c){c=a.nativeEvent;var d=new c.constructor(c.type,c);wb=d;c.target.dispatchEvent(d);wb=null;}else return b=Cb(c),null!==b&&Fc(b),a.blockedOn=c,false;b.shift();}return true}function Zc(a,b,c){Xc(a)&&c.delete(b);}function $c(){Jc=false;null!==Lc&&Xc(Lc)&&(Lc=null);null!==Mc&&Xc(Mc)&&(Mc=null);null!==Nc&&Xc(Nc)&&(Nc=null);Oc.forEach(Zc);Pc.forEach(Zc);} 233function ad(a,b){a.blockedOn===b&&(a.blockedOn=null,Jc||(Jc=true,ca.unstable_scheduleCallback(ca.unstable_NormalPriority,$c)));} 234function bd(a){function b(b){return ad(b,a)}if(0<Kc.length){ad(Kc[0],a);for(var c=1;c<Kc.length;c++){var d=Kc[c];d.blockedOn===a&&(d.blockedOn=null);}}null!==Lc&&ad(Lc,a);null!==Mc&&ad(Mc,a);null!==Nc&&ad(Nc,a);Oc.forEach(b);Pc.forEach(b);for(c=0;c<Qc.length;c++)d=Qc[c],d.blockedOn===a&&(d.blockedOn=null);for(;0<Qc.length&&(c=Qc[0],null===c.blockedOn);)Vc(c),null===c.blockedOn&&Qc.shift();}var cd=ua.ReactCurrentBatchConfig,dd=true; 235function ed(a,b,c,d){var e=C$1,f=cd.transition;cd.transition=null;try{C$1=1,fd(a,b,c,d);}finally{C$1=e,cd.transition=f;}}function gd(a,b,c,d){var e=C$1,f=cd.transition;cd.transition=null;try{C$1=4,fd(a,b,c,d);}finally{C$1=e,cd.transition=f;}} 236function fd(a,b,c,d){if(dd){var e=Yc(a,b,c,d);if(null===e)hd(a,b,d,id$2,c),Sc(a,d);else if(Uc(e,a,b,c,d))d.stopPropagation();else if(Sc(a,d),b&4&&-1<Rc.indexOf(a)){for(;null!==e;){var f=Cb(e);null!==f&&Ec(f);f=Yc(a,b,c,d);null===f&&hd(a,b,d,id$2,c);if(f===e)break;e=f;}null!==e&&d.stopPropagation();}else hd(a,b,d,null,c);}}var id$2=null; 237function Yc(a,b,c,d){id$2=null;a=xb(d);a=Wc(a);if(null!==a)if(b=Vb(a),null===b)a=null;else if(c=b.tag,13===c){a=Wb(b);if(null!==a)return a;a=null;}else if(3===c){if(b.stateNode.current.memoizedState.isDehydrated)return 3===b.tag?b.stateNode.containerInfo:null;a=null;}else b!==a&&(a=null);id$2=a;return null}
238function jd(a){switch(a){case "cancel":case "click":case "close":case "contextmenu":case "copy":case "cut":case "auxclick":case "dblclick":case "dragend":case "dragstart":case "drop":case "focusin":case "focusout":case "input":case "invalid":case "keydown":case "keypress":case "keyup":case "mousedown":case "mouseup":case "paste":case "pause":case "play":case "pointercancel":case "pointerdown":case "pointerup":case "ratechange":case "reset":case "resize":case "seeked":case "submit":case "touchcancel":case "touchend":case "touchstart":case "volumechange":case "change":case "selectionchange":case "textInput":case "compositionstart":case "compositionend":case "compositionupdate":case "beforeblur":case "afterblur":case "beforeinput":case "blur":case "fullscreenchange":case "focus":case "hashchange":case "popstate":case "select":case "selectstart":return 1;case "drag":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "mousemove":case "mouseout":case "mouseover":case "pointermove":case "pointerout":case "pointerover":case "scroll":case "toggle":case "touchmove":case "wheel":case "mouseenter":case "mouseleave":case "pointerenter":case "pointerleave":return 4; 239case "message":switch(ec()){case fc:return 1;case gc:return 4;case hc:case ic:return 16;case jc:return 536870912;default:return 16}default:return 16}}var kd=null,ld=null,md=null;
vendor: 105,267 bytes, lines 239-480
239function nd(){if(md)return md;var a,b=ld,c=b.length,d,e="value"in kd?kd.value:kd.textContent,f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);return md=e.slice(a,1<d?1-d:void 0)} 240function od(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0}function pd(){return true}function qd(){return false} 241function rd(a){function b(b,d,e,f,g){this._reactName=b;this._targetInst=e;this.type=d;this.nativeEvent=f;this.target=g;this.currentTarget=null;for(var c in a)a.hasOwnProperty(c)&&(b=a[c],this[c]=b?b(f):f[c]);this.isDefaultPrevented=(null!=f.defaultPrevented?f.defaultPrevented:false===f.returnValue)?pd:qd;this.isPropagationStopped=qd;return this}A$1(b.prototype,{preventDefault:function(){this.defaultPrevented=true;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&& 242(a.returnValue=false),this.isDefaultPrevented=pd);},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=true),this.isPropagationStopped=pd);},persist:function(){},isPersistent:pd});return b} 243var sd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=rd(sd),ud=A$1({},sd,{view:0,detail:0}),vd=rd(ud),wd,xd,yd,Ad=A$1({},ud,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zd,button:0,buttons:0,relatedTarget:function(a){return void 0===a.relatedTarget?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){if("movementX"in 244a)return a.movementX;a!==yd&&(yd&&"mousemove"===a.type?(wd=a.screenX-yd.screenX,xd=a.screenY-yd.screenY):xd=wd=0,yd=a);return wd},movementY:function(a){return "movementY"in a?a.movementY:xd}}),Bd=rd(Ad),Cd=A$1({},Ad,{dataTransfer:0}),Dd=rd(Cd),Ed=A$1({},ud,{relatedTarget:0}),Fd=rd(Ed),Gd=A$1({},sd,{animationName:0,elapsedTime:0,pseudoElement:0}),Hd=rd(Gd),Id=A$1({},sd,{clipboardData:function(a){return "clipboardData"in a?a.clipboardData:window.clipboardData}}),Jd=rd(Id),Kd=A$1({},sd,{data:0}),Ld=rd(Kd),Md={Esc:"Escape", 245Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7", 246119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pd(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=Od[a])?!!b[a]:false}function zd(){return Pd} 247var Qd=A$1({},ud,{key:function(a){if(a.key){var b=Md[a.key]||a.key;if("Unidentified"!==b)return b}return "keypress"===a.type?(a=od(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?Nd[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zd,charCode:function(a){return "keypress"===a.type?od(a):0},keyCode:function(a){return "keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return "keypress"=== 248a.type?od(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),Rd=rd(Qd),Sd=A$1({},Ad,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Td=rd(Sd),Ud=A$1({},ud,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zd}),Vd=rd(Ud),Wd=A$1({},sd,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xd=rd(Wd),Yd=A$1({},Ad,{deltaX:function(a){return "deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0}, 249deltaY:function(a){return "deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),Zd=rd(Yd),$d=[9,13,27,32],ae=ia&&"CompositionEvent"in window,be=null;ia&&"documentMode"in document&&(be=document.documentMode);var ce=ia&&"TextEvent"in window&&!be,de=ia&&(!ae||be&&8<be&&11>=be),ee=String.fromCharCode(32),fe=false; 250function ge(a,b){switch(a){case "keyup":return -1!==$d.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "focusout":return true;default:return false}}function he(a){a=a.detail;return "object"===typeof a&&"data"in a?a.data:null}var ie=false;function je(a,b){switch(a){case "compositionend":return he(b);case "keypress":if(32!==b.which)return null;fe=true;return ee;case "textInput":return a=b.data,a===ee&&fe?null:a;default:return null}} 251function ke(a,b){if(ie)return "compositionend"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=false,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1<b.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "compositionend":return de&&"ko"!==b.locale?null:b.data;default:return null}} 252var le={color:true,date:true,datetime:true,"datetime-local":true,email:true,month:true,number:true,password:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true};function me(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return "input"===b?!!le[a.type]:"textarea"===b?true:false}function ne(a,b,c,d){Eb(d);b=oe(b,"onChange");0<b.length&&(c=new td("onChange","change",null,c,d),a.push({event:c,listeners:b}));}var pe=null,qe=null;function re(a){se(a,0);}function te(a){var b=ue(a);if(Wa(b))return a} 253function ve(a,b){if("change"===a)return b}var we=false;if(ia){var xe;if(ia){var ye="oninput"in document;if(!ye){var ze=document.createElement("div");ze.setAttribute("oninput","return;");ye="function"===typeof ze.oninput;}xe=ye;}else xe=false;we=xe&&(!document.documentMode||9<document.documentMode);}function Ae(){pe&&(pe.detachEvent("onpropertychange",Be),qe=pe=null);}function Be(a){if("value"===a.propertyName&&te(qe)){var b=[];ne(b,qe,a,xb(a));Jb(re,b);}} 254function Ce(a,b,c){"focusin"===a?(Ae(),pe=b,qe=c,pe.attachEvent("onpropertychange",Be)):"focusout"===a&&Ae();}function De(a){if("selectionchange"===a||"keyup"===a||"keydown"===a)return te(qe)}function Ee(a,b){if("click"===a)return te(b)}function Fe(a,b){if("input"===a||"change"===a)return te(b)}function Ge(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var He="function"===typeof Object.is?Object.is:Ge; 255function Ie(a,b){if(He(a,b))return true;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return false;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return false;for(d=0;d<c.length;d++){var e=c[d];if(!ja.call(b,e)||!He(a[e],b[e]))return false}return true}function Je(a){for(;a&&a.firstChild;)a=a.firstChild;return a} 256function Ke(a,b){var c=Je(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=b)return {node:c,offset:b-a};a=d;}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode;}c=void 0;}c=Je(c);}}function Le(a,b){return a&&b?a===b?true:a&&3===a.nodeType?false:b&&3===b.nodeType?Le(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):false:false} 257function Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c="string"===typeof b.contentWindow.location.href;}catch(d){c=false;}if(c)a=b.contentWindow;else break;b=Xa(a.document);}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)} 258function Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),"selectionStart"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c, 259d);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)));}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});"function"===typeof c.focus&&c.focus();for(c=0;c<b.length;c++)a=b[c],a.element.scrollLeft=a.left,a.element.scrollTop=a.top;}} 260var Pe=ia&&"documentMode"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=false; 261function Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,"selectionStart"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,"onSelect"),0<d.length&&(b=new td("onSelect","select",null,b,c),a.push({event:b,listeners:d}),b.target=Qe)));} 262function Ve(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var We={animationend:Ve("Animation","AnimationEnd"),animationiteration:Ve("Animation","AnimationIteration"),animationstart:Ve("Animation","AnimationStart"),transitionend:Ve("Transition","TransitionEnd")},Xe={},Ye={}; 263ia&&(Ye=document.createElement("div").style,"AnimationEvent"in window||(delete We.animationend.animation,delete We.animationiteration.animation,delete We.animationstart.animation),"TransitionEvent"in window||delete We.transitionend.transition);function Ze(a){if(Xe[a])return Xe[a];if(!We[a])return a;var b=We[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Ye)return Xe[a]=b[c];return a}var $e=Ze("animationend"),af=Ze("animationiteration"),bf=Ze("animationstart"),cf=Ze("transitionend"),df=new Map,ef="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" "); 264function ff(a,b){df.set(a,b);fa(b,[a]);}for(var gf=0;gf<ef.length;gf++){var hf=ef[gf],jf=hf.toLowerCase(),kf=hf[0].toUpperCase()+hf.slice(1);ff(jf,"on"+kf);}ff($e,"onAnimationEnd");ff(af,"onAnimationIteration");ff(bf,"onAnimationStart");ff("dblclick","onDoubleClick");ff("focusin","onFocus");ff("focusout","onBlur");ff(cf,"onTransitionEnd");ha("onMouseEnter",["mouseout","mouseover"]);ha("onMouseLeave",["mouseout","mouseover"]);ha("onPointerEnter",["pointerout","pointerover"]); 265ha("onPointerLeave",["pointerout","pointerover"]);fa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));fa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));fa("onBeforeInput",["compositionend","keypress","textInput","paste"]);fa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));fa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")); 266fa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),mf=new Set("cancel close invalid load scroll toggle".split(" ").concat(lf)); 267function nf(a,b,c){var d=a.type||"unknown-event";a.currentTarget=c;Ub(d,b,void 0,a);a.currentTarget=null;} 268function se(a,b){b=0!==(b&4);for(var c=0;c<a.length;c++){var d=a[c],e=d.event;d=d.listeners;a:{var f=void 0;if(b)for(var g=d.length-1;0<=g;g--){var h=d[g],k=h.instance,l=h.currentTarget;h=h.listener;if(k!==f&&e.isPropagationStopped())break a;nf(e,h,l);f=k;}else for(g=0;g<d.length;g++){h=d[g];k=h.instance;l=h.currentTarget;h=h.listener;if(k!==f&&e.isPropagationStopped())break a;nf(e,h,l);f=k;}}}if(Qb)throw a=Rb,Qb=false,Rb=null,a;} 269function D$1(a,b){var c=b[of];void 0===c&&(c=b[of]=new Set);var d=a+"__bubble";c.has(d)||(pf(b,a,2,false),c.add(d));}function qf(a,b,c){var d=0;b&&(d|=4);pf(c,a,d,b);}var rf="_reactListening"+Math.random().toString(36).slice(2);function sf(a){if(!a[rf]){a[rf]=true;da.forEach(function(b){"selectionchange"!==b&&(mf.has(b)||qf(b,false,a),qf(b,true,a));});var b=9===a.nodeType?a:a.ownerDocument;null===b||b[rf]||(b[rf]=true,qf("selectionchange",false,b));}} 270function pf(a,b,c,d){switch(jd(b)){case 1:var e=ed;break;case 4:e=gd;break;default:e=fd;}c=e.bind(null,b,c,a);e=void 0;!Lb||"touchstart"!==b&&"touchmove"!==b&&"wheel"!==b||(e=true);d?void 0!==e?a.addEventListener(b,c,{capture:true,passive:e}):a.addEventListener(b,c,true):void 0!==e?a.addEventListener(b,c,{passive:e}):a.addEventListener(b,c,false);} 271function hd(a,b,c,d,e){var f=d;if(0===(b&1)&&0===(b&2)&&null!==d)a:for(;;){if(null===d)return;var g=d.tag;if(3===g||4===g){var h=d.stateNode.containerInfo;if(h===e||8===h.nodeType&&h.parentNode===e)break;if(4===g)for(g=d.return;null!==g;){var k=g.tag;if(3===k||4===k)if(k=g.stateNode.containerInfo,k===e||8===k.nodeType&&k.parentNode===e)return;g=g.return;}for(;null!==h;){g=Wc(h);if(null===g)return;k=g.tag;if(5===k||6===k){d=f=g;continue a}h=h.parentNode;}}d=d.return;}Jb(function(){var d=f,e=xb(c),g=[]; 272a:{var h=df.get(a);if(void 0!==h){var k=td,n=a;switch(a){case "keypress":if(0===od(c))break a;case "keydown":case "keyup":k=Rd;break;case "focusin":n="focus";k=Fd;break;case "focusout":n="blur";k=Fd;break;case "beforeblur":case "afterblur":k=Fd;break;case "click":if(2===c.button)break a;case "auxclick":case "dblclick":case "mousedown":case "mousemove":case "mouseup":case "mouseout":case "mouseover":case "contextmenu":k=Bd;break;case "drag":case "dragend":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "dragstart":case "drop":k= 273Dd;break;case "touchcancel":case "touchend":case "touchmove":case "touchstart":k=Vd;break;case $e:case af:case bf:k=Hd;break;case cf:k=Xd;break;case "scroll":k=vd;break;case "wheel":k=Zd;break;case "copy":case "cut":case "paste":k=Jd;break;case "gotpointercapture":case "lostpointercapture":case "pointercancel":case "pointerdown":case "pointermove":case "pointerout":case "pointerover":case "pointerup":k=Td;}var t=0!==(b&4),J=!t&&"scroll"===a,x=t?null!==h?h+"Capture":null:h;t=[];for(var w=d,u;null!== 274w;){u=w;var F=u.stateNode;5===u.tag&&null!==F&&(u=F,null!==x&&(F=Kb(w,x),null!=F&&t.push(tf(w,F,u))));if(J)break;w=w.return;}0<t.length&&(h=new k(h,n,null,c,e),g.push({event:h,listeners:t}));}}if(0===(b&7)){a:{h="mouseover"===a||"pointerover"===a;k="mouseout"===a||"pointerout"===a;if(h&&c!==wb&&(n=c.relatedTarget||c.fromElement)&&(Wc(n)||n[uf]))break a;if(k||h){h=e.window===e?e:(h=e.ownerDocument)?h.defaultView||h.parentWindow:window;if(k){if(n=c.relatedTarget||c.toElement,k=d,n=n?Wc(n):null,null!== 275n&&(J=Vb(n),n!==J||5!==n.tag&&6!==n.tag))n=null;}else k=null,n=d;if(k!==n){t=Bd;F="onMouseLeave";x="onMouseEnter";w="mouse";if("pointerout"===a||"pointerover"===a)t=Td,F="onPointerLeave",x="onPointerEnter",w="pointer";J=null==k?h:ue(k);u=null==n?h:ue(n);h=new t(F,w+"leave",k,c,e);h.target=J;h.relatedTarget=u;F=null;Wc(e)===d&&(t=new t(x,w+"enter",n,c,e),t.target=u,t.relatedTarget=J,F=t);J=F;if(k&&n)b:{t=k;x=n;w=0;for(u=t;u;u=vf(u))w++;u=0;for(F=x;F;F=vf(F))u++;for(;0<w-u;)t=vf(t),w--;for(;0<u-w;)x= 276vf(x),u--;for(;w--;){if(t===x||null!==x&&t===x.alternate)break b;t=vf(t);x=vf(x);}t=null;}else t=null;null!==k&&wf(g,h,k,t,false);null!==n&&null!==J&&wf(g,J,n,t,true);}}}a:{h=d?ue(d):window;k=h.nodeName&&h.nodeName.toLowerCase();if("select"===k||"input"===k&&"file"===h.type)var na=ve;else if(me(h))if(we)na=Fe;else {na=De;var xa=Ce;}else (k=h.nodeName)&&"input"===k.toLowerCase()&&("checkbox"===h.type||"radio"===h.type)&&(na=Ee);if(na&&(na=na(a,d))){ne(g,na,c,e);break a}xa&&xa(a,h,d);"focusout"===a&&(xa=h._wrapperState)&& 277xa.controlled&&"number"===h.type&&cb(h,"number",h.value);}xa=d?ue(d):window;switch(a){case "focusin":if(me(xa)||"true"===xa.contentEditable)Qe=xa,Re=d,Se=null;break;case "focusout":Se=Re=Qe=null;break;case "mousedown":Te=true;break;case "contextmenu":case "mouseup":case "dragend":Te=false;Ue(g,c,e);break;case "selectionchange":if(Pe)break;case "keydown":case "keyup":Ue(g,c,e);}var $a;if(ae)b:{switch(a){case "compositionstart":var ba="onCompositionStart";break b;case "compositionend":ba="onCompositionEnd"; 278break b;case "compositionupdate":ba="onCompositionUpdate";break b}ba=void 0;}else ie?ge(a,c)&&(ba="onCompositionEnd"):"keydown"===a&&229===c.keyCode&&(ba="onCompositionStart");ba&&(de&&"ko"!==c.locale&&(ie||"onCompositionStart"!==ba?"onCompositionEnd"===ba&&ie&&($a=nd()):(kd=e,ld="value"in kd?kd.value:kd.textContent,ie=true)),xa=oe(d,ba),0<xa.length&&(ba=new Ld(ba,a,null,c,e),g.push({event:ba,listeners:xa}),$a?ba.data=$a:($a=he(c),null!==$a&&(ba.data=$a))));if($a=ce?je(a,c):ke(a,c))d=oe(d,"onBeforeInput"), 2790<d.length&&(e=new Ld("onBeforeInput","beforeinput",null,c,e),g.push({event:e,listeners:d}),e.data=$a);}se(g,b);});}function tf(a,b,c){return {instance:a,listener:b,currentTarget:c}}function oe(a,b){for(var c=b+"Capture",d=[];null!==a;){var e=a,f=e.stateNode;5===e.tag&&null!==f&&(e=f,f=Kb(a,c),null!=f&&d.unshift(tf(a,f,e)),f=Kb(a,b),null!=f&&d.push(tf(a,f,e)));a=a.return;}return d}function vf(a){if(null===a)return null;do a=a.return;while(a&&5!==a.tag);return a?a:null} 280function wf(a,b,c,d,e){for(var f=b._reactName,g=[];null!==c&&c!==d;){var h=c,k=h.alternate,l=h.stateNode;if(null!==k&&k===d)break;5===h.tag&&null!==l&&(h=l,e?(k=Kb(c,f),null!=k&&g.unshift(tf(c,k,h))):e||(k=Kb(c,f),null!=k&&g.push(tf(c,k,h))));c=c.return;}0!==g.length&&a.push({event:b,listeners:g});}var xf=/\r\n?/g,yf=/\u0000|\uFFFD/g;function zf(a){return ("string"===typeof a?a:""+a).replace(xf,"\n").replace(yf,"")}function Af(a,b,c){b=zf(b);if(zf(a)!==b&&c)throw Error(p$2(425));}function Bf(){} 281var Cf=null,Df=null;function Ef(a,b){return "textarea"===a||"noscript"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html} 282var Ff="function"===typeof setTimeout?setTimeout:void 0,Gf="function"===typeof clearTimeout?clearTimeout:void 0,Hf="function"===typeof Promise?Promise:void 0,Jf="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof Hf?function(a){return Hf.resolve(null).then(a).catch(If)}:Ff;function If(a){setTimeout(function(){throw a;});} 283function Kf(a,b){var c=b,d=0;do{var e=c.nextSibling;a.removeChild(c);if(e&&8===e.nodeType)if(c=e.data,"/$"===c){if(0===d){a.removeChild(e);bd(b);return}d--;}else "$"!==c&&"$?"!==c&&"$!"!==c||d++;c=e;}while(c);bd(b);}function Lf(a){for(;null!=a;a=a.nextSibling){var b=a.nodeType;if(1===b||3===b)break;if(8===b){b=a.data;if("$"===b||"$!"===b||"$?"===b)break;if("/$"===b)return null}}return a} 284function Mf(a){a=a.previousSibling;for(var b=0;a;){if(8===a.nodeType){var c=a.data;if("$"===c||"$!"===c||"$?"===c){if(0===b)return a;b--;}else "/$"===c&&b++;}a=a.previousSibling;}return null}var Nf=Math.random().toString(36).slice(2),Of="__reactFiber$"+Nf,Pf="__reactProps$"+Nf,uf="__reactContainer$"+Nf,of="__reactEvents$"+Nf,Qf="__reactListeners$"+Nf,Rf="__reactHandles$"+Nf; 285function Wc(a){var b=a[Of];if(b)return b;for(var c=a.parentNode;c;){if(b=c[uf]||c[Of]){c=b.alternate;if(null!==b.child||null!==c&&null!==c.child)for(a=Mf(a);null!==a;){if(c=a[Of])return c;a=Mf(a);}return b}a=c;c=a.parentNode;}return null}function Cb(a){a=a[Of]||a[uf];return !a||5!==a.tag&&6!==a.tag&&13!==a.tag&&3!==a.tag?null:a}function ue(a){if(5===a.tag||6===a.tag)return a.stateNode;throw Error(p$2(33));}function Db(a){return a[Pf]||null}var Sf=[],Tf=-1;function Uf(a){return {current:a}} 286function E(a){0>Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--);}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b;}var Vf={},H=Uf(Vf),Wf=Uf(false),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e} 287function Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H);}function ag(a,b,c){if(H.current!==Vf)throw Error(p$2(168));G(H,b);G(Wf,c);}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p$2(108,Ra(a)||"Unknown",e));return A$1({},c,d)} 288function cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return true}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p$2(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c);}var eg=null,fg=false,gg=false;function hg(a){null===eg?eg=[a]:eg.push(a);}function ig(a){fg=true;hg(a);} 289function jg(){if(!gg&&null!==eg){gg=true;var a=0,b=C$1;try{var c=eg;for(C$1=1;a<c.length;a++){var d=c[a];do d=d(!0);while(null!==d)}eg=null;fg=!1;}catch(e){throw null!==eg&&(eg=eg.slice(a+1)),ac(fc,jg),e;}finally{C$1=b,gg=false;}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(a,b){kg[lg++]=ng;kg[lg++]=mg;mg=a;ng=b;} 290function ug(a,b,c){og[pg++]=rg;og[pg++]=sg;og[pg++]=qg;qg=a;var d=rg;a=sg;var e=32-oc(d)-1;d&=~(1<<e);c+=1;var f=32-oc(b)+e;if(30<f){var g=e-e%5;f=(d&(1<<g)-1).toString(32);d>>=g;e-=g;rg=1<<32-oc(b)+e|c<<e|d;sg=f+a;}else rg=1<<f|c<<e|d,sg=a;}function vg(a){null!==a.return&&(tg(a,1),ug(a,1,0));}function wg(a){for(;a===mg;)mg=kg[--lg],kg[lg]=null,ng=kg[--lg],kg[lg]=null;for(;a===qg;)qg=og[--pg],og[pg]=null,sg=og[--pg],og[pg]=null,rg=og[--pg],og[pg]=null;}var xg=null,yg=null,I$1=false,zg=null; 291function Ag(a,b){var c=Bg(5,null,null,0);c.elementType="DELETED";c.stateNode=b;c.return=a;b=a.deletions;null===b?(a.deletions=[c],a.flags|=16):b.push(c);} 292function Cg(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,xg=a,yg=Lf(b.firstChild),true):false;case 6:return b=""===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,xg=a,yg=null,true):false;case 13:return b=8!==b.nodeType?null:b,null!==b?(c=null!==qg?{id:rg,overflow:sg}:null,a.memoizedState={dehydrated:b,treeContext:c,retryLane:1073741824},c=Bg(18,null,null,0),c.stateNode=b,c.return=a,a.child=c,xg=a,yg= 293null,true):false;default:return false}}function Dg(a){return 0!==(a.mode&1)&&0===(a.flags&128)}function Eg(a){if(I$1){var b=yg;if(b){var c=b;if(!Cg(a,b)){if(Dg(a))throw Error(p$2(418));b=Lf(c.nextSibling);var d=xg;b&&Cg(a,b)?Ag(d,c):(a.flags=a.flags&-4097|2,I$1=false,xg=a);}}else {if(Dg(a))throw Error(p$2(418));a.flags=a.flags&-4097|2;I$1=false;xg=a;}}}function Fg(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;xg=a;} 294function Gg(a){if(a!==xg)return false;if(!I$1)return Fg(a),I$1=true,false;var b;(b=3!==a.tag)&&!(b=5!==a.tag)&&(b=a.type,b="head"!==b&&"body"!==b&&!Ef(a.type,a.memoizedProps));if(b&&(b=yg)){if(Dg(a))throw Hg(),Error(p$2(418));for(;b;)Ag(a,b),b=Lf(b.nextSibling);}Fg(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(p$2(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if("/$"===c){if(0===b){yg=Lf(a.nextSibling);break a}b--;}else "$"!==c&&"$!"!==c&&"$?"!==c||b++;}a=a.nextSibling;}yg= 295null;}}else yg=xg?Lf(a.stateNode.nextSibling):null;return true}function Hg(){for(var a=yg;a;)a=Lf(a.nextSibling);}function Ig(){yg=xg=null;I$1=false;}function Jg(a){null===zg?zg=[a]:zg.push(a);}var Kg=ua.ReactCurrentBatchConfig; 296function Lg(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;if(c){if(1!==c.tag)throw Error(p$2(309));var d=c.stateNode;}if(!d)throw Error(p$2(147,a));var e=d,f=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===f)return b.ref;b=function(a){var b=e.refs;null===a?delete b[f]:b[f]=a;};b._stringRef=f;return b}if("string"!==typeof a)throw Error(p$2(284));if(!c._owner)throw Error(p$2(290,a));}return a} 297function Mg(a,b){a=Object.prototype.toString.call(b);throw Error(p$2(31,"[object Object]"===a?"object with keys {"+Object.keys(b).join(", ")+"}":a));}function Ng(a){var b=a._init;return b(a._payload)} 298function Og(a){function b(b,c){if(a){var d=b.deletions;null===d?(b.deletions=[c],b.flags|=16):d.push(c);}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b){a=Pg(a,b);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return b.flags|=1048576,c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.flags|=2,c):d;b.flags|=2;return c}function g(b){a&& 299null===b.alternate&&(b.flags|=2);return b}function h(a,b,c,d){if(null===b||6!==b.tag)return b=Qg(c,a.mode,d),b.return=a,b;b=e(b,c);b.return=a;return b}function k(a,b,c,d){var f=c.type;if(f===ya)return m(a,b,c.props.children,d,c.key);if(null!==b&&(b.elementType===f||"object"===typeof f&&null!==f&&f.$$typeof===Ha&&Ng(f)===b.type))return d=e(b,c.props),d.ref=Lg(a,b,c),d.return=a,d;d=Rg(c.type,c.key,c.props,null,a.mode,d);d.ref=Lg(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||4!==b.tag|| 300b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=Sg(c,a.mode,d),b.return=a,b;b=e(b,c.children||[]);b.return=a;return b}function m(a,b,c,d,f){if(null===b||7!==b.tag)return b=Tg(c,a.mode,d,f),b.return=a,b;b=e(b,c);b.return=a;return b}function q(a,b,c){if("string"===typeof b&&""!==b||"number"===typeof b)return b=Qg(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case va:return c=Rg(b.type,b.key,b.props,null,a.mode,c), 301c.ref=Lg(a,null,b),c.return=a,c;case wa:return b=Sg(b,a.mode,c),b.return=a,b;case Ha:var d=b._init;return q(a,d(b._payload),c)}if(eb(b)||Ka(b))return b=Tg(b,a.mode,c,null),b.return=a,b;Mg(a,b);}return null}function r(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c&&""!==c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case va:return c.key===e?k(a,b,c,d):null;case wa:return c.key===e?l(a,b,c,d):null;case Ha:return e=c._init,r(a, 302b,e(c._payload),d)}if(eb(c)||Ka(c))return null!==e?null:m(a,b,c,d,null);Mg(a,c);}return null}function y(a,b,c,d,e){if("string"===typeof d&&""!==d||"number"===typeof d)return a=a.get(c)||null,h(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case va:return a=a.get(null===d.key?c:d.key)||null,k(b,a,d,e);case wa:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e);case Ha:var f=d._init;return y(a,b,c,f(d._payload),e)}if(eb(d)||Ka(d))return a=a.get(c)||null,m(b,a,d,e,null);Mg(b,d);}return null} 303function n(e,g,h,k){for(var l=null,m=null,u=g,w=g=0,x=null;null!==u&&w<h.length;w++){u.index>w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x;}if(w===h.length)return c(e,u),I$1&&tg(e,w),l;if(null===u){for(;w<h.length;w++)u=q(e,h[w],k),null!==u&&(g=f(u,g,w),null===m?l=u:m.sibling=u,m=u);I$1&&tg(e,w);return l}for(u=d(e,u);w<h.length;w++)x=y(u,e,w,h[w],k),null!==x&&(a&&null!==x.alternate&&u.delete(null=== 304x.key?w:x.key),g=f(x,g,w),null===m?l=x:m.sibling=x,m=x);a&&u.forEach(function(a){return b(e,a)});I$1&&tg(e,w);return l}function t(e,g,h,k){var l=Ka(h);if("function"!==typeof l)throw Error(p$2(150));h=l.call(h);if(null==h)throw Error(p$2(151));for(var u=l=null,m=g,w=g=0,x=null,n=h.next();null!==m&&!n.done;w++,n=h.next()){m.index>w?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x;}if(n.done)return c(e, 305m),I$1&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I$1&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I$1&&tg(e,w);return l}function J(a,d,f,h){"object"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if("object"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k= 306f.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||"object"===typeof k&&null!==k&&k.$$typeof===Ha&&Ng(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Lg(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling;}f.type===ya?(d=Tg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Rg(f.type,f.key,f.props,null,a.mode,h),h.ref=Lg(a,d,f),h.return=a,a=h);}return g(a);case wa:a:{for(l=f.key;null!== 307d;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else {c(a,d);break}else b(a,d);d=d.sibling;}d=Sg(f,a.mode,h);d.return=a;a=d;}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);Mg(a,f);}return "string"===typeof f&&""!==f||"number"===typeof f?(f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d): 308(c(a,d),d=Qg(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Ug=Og(true),Vg=Og(false),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null;}function ah(a){var b=Wg.current;E(Wg);a._currentValue=b;}function bh(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return;}} 309function ch(a,b){Xg=a;Zg=Yg=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(dh=true),a.firstContext=null);}function eh(a){var b=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:b,next:null},null===Yg){if(null===Xg)throw Error(p$2(308));Yg=a;Xg.dependencies={lanes:0,firstContext:a};}else Yg=Yg.next=a;return b}var fh=null;function gh(a){null===fh?fh=[a]:fh.push(a);} 310function hh(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,gh(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ih(a,d)}function ih(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var jh=false;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null};} 311function lh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects});}function mh(a,b){return {eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}} 312function nh(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(K$1&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ih(a,c)}e=d.interleaved;null===e?(b.next=b,gh(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ih(a,c)}function oh(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c);}} 313function ph(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next;}while(null!==c);null===f?e=f=b:f=f.next=b;}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next= 314b;c.lastBaseUpdate=b;} 315function qh(a,b,c,d){var e=a.updateQueue;jh=false;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k));}if(null!==f){var q=e.baseState;g=0;m=l=k=null;h=f;do{var r=h.lane,y=h.eventTime;if((d&r)===r){null!==m&&(m=m.next={eventTime:y,lane:0,tag:h.tag,payload:h.payload,callback:h.callback, 316next:null});a:{var n=a,t=h;r=b;y=c;switch(t.tag){case 1:n=t.payload;if("function"===typeof n){q=n.call(y,q,r);break a}q=n;break a;case 3:n.flags=n.flags&-65537|128;case 0:n=t.payload;r="function"===typeof n?n.call(y,q,r):n;if(null===r||void 0===r)break a;q=A$1({},q,r);break a;case 2:jh=true;}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=[h]:r.push(h));}else y={eventTime:y,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=y,k=q):m=m.next=y,g|=r; 317h=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null;}while(1);null===m&&(k=q);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);rh|=g;a.lanes=g;a.memoizedState=q;}} 318function sh(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;b<a.length;b++){var d=a[b],e=d.callback;if(null!==e){d.callback=null;d=c;if("function"!==typeof e)throw Error(p$2(191,e));e.call(d);}}}var th={},uh=Uf(th),vh$1=Uf(th),wh=Uf(th);function xh(a){if(a===th)throw Error(p$2(174));return a} 319function yh(a,b){G(wh,b);G(vh$1,a);G(uh,th);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:lb(null,"");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=lb(b,a);}E(uh);G(uh,b);}function zh(){E(uh);E(vh$1);E(wh);}function Ah(a){xh(wh.current);var b=xh(uh.current);var c=lb(b,a.type);b!==c&&(G(vh$1,a),G(uh,c));}function Bh(a){vh$1.current===a&&(E(uh),E(vh$1));}var L$1=Uf(0); 320function Ch(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||"$?"===c.data||"$!"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}return null}var Dh=[]; 321function Eh(){for(var a=0;a<Dh.length;a++)Dh[a]._workInProgressVersionPrimary=null;Dh.length=0;}var Fh=ua.ReactCurrentDispatcher,Gh=ua.ReactCurrentBatchConfig,Hh=0,M=null,N=null,O=null,Ih=false,Jh=false,Kh=0,Lh=0;function P(){throw Error(p$2(321));}function Mh(a,b){if(null===b)return false;for(var c=0;c<b.length&&c<a.length;c++)if(!He(a[c],b[c]))return false;return true} 322function Nh(a,b,c,d,e,f){Hh=f;M=b;b.memoizedState=null;b.updateQueue=null;b.lanes=0;Fh.current=null===a||null===a.memoizedState?Oh:Ph;a=c(d,e);if(Jh){f=0;do{Jh=false;Kh=0;if(25<=f)throw Error(p$2(301));f+=1;O=N=null;b.updateQueue=null;Fh.current=Qh;a=c(d,e);}while(Jh)}Fh.current=Rh;b=null!==N&&null!==N.next;Hh=0;O=N=M=null;Ih=false;if(b)throw Error(p$2(300));return a}function Sh(){var a=0!==Kh;Kh=0;return a} 323function Th(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===O?M.memoizedState=O=a:O=O.next=a;return O}function Uh(){if(null===N){var a=M.alternate;a=null!==a?a.memoizedState:null;}else a=N.next;var b=null===O?M.memoizedState:O.next;if(null!==b)O=b,N=a;else {if(null===a)throw Error(p$2(310));N=a;a={memoizedState:N.memoizedState,baseState:N.baseState,baseQueue:N.baseQueue,queue:N.queue,next:null};null===O?M.memoizedState=O=a:O=O.next=a;}return O} 324function Vh(a,b){return "function"===typeof b?b(a):b} 325function Wh(a){var b=Uh(),c=b.queue;if(null===c)throw Error(p$2(311));c.lastRenderedReducer=a;var d=N,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g;}d.baseQueue=e=f;c.pending=null;}if(null!==e){f=e.next;d=d.baseState;var h=g=null,k=null,l=f;do{var m=l.lane;if((Hh&m)===m)null!==k&&(k=k.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),d=l.hasEagerState?l.eagerState:a(d,l.action);else {var q={lane:m,action:l.action,hasEagerState:l.hasEagerState, 326eagerState:l.eagerState,next:null};null===k?(h=k=q,g=d):k=k.next=q;M.lanes|=m;rh|=m;}l=l.next;}while(null!==l&&l!==f);null===k?g=d:k.next=h;He(d,b.memoizedState)||(dh=true);b.memoizedState=d;b.baseState=g;b.baseQueue=k;c.lastRenderedState=d;}a=c.interleaved;if(null!==a){e=a;do f=e.lane,M.lanes|=f,rh|=f,e=e.next;while(e!==a)}else null===e&&(c.lanes=0);return [b.memoizedState,c.dispatch]} 327function Xh(a){var b=Uh(),c=b.queue;if(null===c)throw Error(p$2(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(dh=true);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f;}return [f,d]}function Yh(){} 328function Zh(a,b){var c=M,d=Uh(),e=b(),f=!He(d.memoizedState,e);f&&(d.memoizedState=e,dh=true);d=d.queue;$h(ai.bind(null,c,d,a),[a]);if(d.getSnapshot!==b||f||null!==O&&O.memoizedState.tag&1){c.flags|=2048;bi(9,ci.bind(null,c,d,e,b),void 0,null);if(null===Q$1)throw Error(p$2(349));0!==(Hh&30)||di(c,b,e);}return e}function di(a,b,c){a.flags|=16384;a={getSnapshot:b,value:c};b=M.updateQueue;null===b?(b={lastEffect:null,stores:null},M.updateQueue=b,b.stores=[a]):(c=b.stores,null===c?b.stores=[a]:c.push(a));} 329function ci(a,b,c,d){b.value=c;b.getSnapshot=d;ei(b)&&fi(a);}function ai(a,b,c){return c(function(){ei(b)&&fi(a);})}function ei(a){var b=a.getSnapshot;a=a.value;try{var c=b();return !He(a,c)}catch(d){return true}}function fi(a){var b=ih(a,1);null!==b&&gi(b,a,1,-1);} 330function hi(a){var b=Th();"function"===typeof a&&(a=a());b.memoizedState=b.baseState=a;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vh,lastRenderedState:a};b.queue=a;a=a.dispatch=ii.bind(null,M,a);return [b.memoizedState,a]} 331function bi(a,b,c,d){a={tag:a,create:b,destroy:c,deps:d,next:null};b=M.updateQueue;null===b?(b={lastEffect:null,stores:null},M.updateQueue=b,b.lastEffect=a.next=a):(c=b.lastEffect,null===c?b.lastEffect=a.next=a:(d=c.next,c.next=a,a.next=d,b.lastEffect=a));return a}function ji(){return Uh().memoizedState}function ki(a,b,c,d){var e=Th();M.flags|=a;e.memoizedState=bi(1|b,c,void 0,void 0===d?null:d);} 332function li(a,b,c,d){var e=Uh();d=void 0===d?null:d;var f=void 0;if(null!==N){var g=N.memoizedState;f=g.destroy;if(null!==d&&Mh(d,g.deps)){e.memoizedState=bi(b,c,f,d);return}}M.flags|=a;e.memoizedState=bi(1|b,c,f,d);}function mi(a,b){return ki(8390656,8,a,b)}function $h(a,b){return li(2048,8,a,b)}function ni(a,b){return li(4,2,a,b)}function oi(a,b){return li(4,4,a,b)} 333function pi(a,b){if("function"===typeof b)return a=a(),b(a),function(){b(null);};if(null!==b&&void 0!==b)return a=a(),b.current=a,function(){b.current=null;}}function qi(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return li(4,4,pi.bind(null,b,a),c)}function ri(){}function si(a,b){var c=Uh();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Mh(b,d[1]))return d[0];c.memoizedState=[a,b];return a} 334function ti(a,b){var c=Uh();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Mh(b,d[1]))return d[0];a=a();c.memoizedState=[a,b];return a}function ui(a,b,c){if(0===(Hh&21))return a.baseState&&(a.baseState=false,dh=true),a.memoizedState=c;He(c,b)||(c=yc(),M.lanes|=c,rh|=c,a.baseState=true);return b}function vi(a,b){var c=C$1;C$1=0!==c&&4>c?c:4;a(true);var d=Gh.transition;Gh.transition={};try{a(!1),b();}finally{C$1=c,Gh.transition=d;}}function wi(){return Uh().memoizedState} 335function xi(a,b,c){var d=yi(a);c={lane:d,action:c,hasEagerState:false,eagerState:null,next:null};if(zi(a))Ai(b,c);else if(c=hh(a,b,c,d),null!==c){var e=R();gi(c,a,d,e);Bi(c,b,d);}} 336function ii(a,b,c){var d=yi(a),e={lane:d,action:c,hasEagerState:false,eagerState:null,next:null};if(zi(a))Ai(b,e);else {var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,gh(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=hh(a,b,e,d);null!==c&&(e=R(),gi(c,a,d,e),Bi(c,b,d));}} 337function zi(a){var b=a.alternate;return a===M||null!==b&&b===M}function Ai(a,b){Jh=Ih=true;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b;}function Bi(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c);}} 338var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:false},Oh={readContext:eh,useCallback:function(a,b){Th().memoizedState=[a,void 0===b?null:b];return a},useContext:eh,useEffect:mi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ki(4194308, 3394,pi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ki(4194308,4,a,b)},useInsertionEffect:function(a,b){return ki(4,2,a,b)},useMemo:function(a,b){var c=Th();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Th();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=xi.bind(null,M,a);return [d.memoizedState,a]},useRef:function(a){var b= 340Th();a={current:a};return b.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(false),b=a[0];a=vi.bind(null,a[1]);Th().memoizedState=a;return [b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=M,e=Th();if(I$1){if(void 0===c)throw Error(p$2(407));c=c();}else {c=b();if(null===Q$1)throw Error(p$2(349));0!==(Hh&30)||di(d,b,c);}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;mi(ai.bind(null,d, 341f,a),[a]);d.flags|=2048;bi(9,ci.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Th(),b=Q$1.identifierPrefix;if(I$1){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=":"+b+"R"+c;c=Kh++;0<c&&(b+="H"+c.toString(32));b+=":";}else c=Lh++,b=":"+b+"r"+c.toString(32)+":";return a.memoizedState=b},unstable_isNewReconciler:false},Ph={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Wh,useRef:ji,useState:function(){return Wh(Vh)}, 342useDebugValue:ri,useDeferredValue:function(a){var b=Uh();return ui(b,N.memoizedState,a)},useTransition:function(){var a=Wh(Vh)[0],b=Uh().memoizedState;return [a,b]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:false},Qh={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Xh,useRef:ji,useState:function(){return Xh(Vh)},useDebugValue:ri,useDeferredValue:function(a){var b=Uh();return null=== 343N?b.memoizedState=a:ui(b,N.memoizedState,a)},useTransition:function(){var a=Xh(Vh)[0],b=Uh().memoizedState;return [a,b]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:false};function Ci(a,b){if(a&&a.defaultProps){b=A$1({},b);a=a.defaultProps;for(var c in a) void 0===b[c]&&(b[c]=a[c]);return b}return b}function Di(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:A$1({},b,c);a.memoizedState=c;0===a.lanes&&(a.updateQueue.baseState=c);} 344var Ei={isMounted:function(a){return (a=a._reactInternals)?Vb(a)===a:false},enqueueSetState:function(a,b,c){a=a._reactInternals;var d=R(),e=yi(a),f=mh(d,e);f.payload=b;void 0!==c&&null!==c&&(f.callback=c);b=nh(a,f,e);null!==b&&(gi(b,a,e,d),oh(b,a,e));},enqueueReplaceState:function(a,b,c){a=a._reactInternals;var d=R(),e=yi(a),f=mh(d,e);f.tag=1;f.payload=b;void 0!==c&&null!==c&&(f.callback=c);b=nh(a,f,e);null!==b&&(gi(b,a,e,d),oh(b,a,e));},enqueueForceUpdate:function(a,b){a=a._reactInternals;var c=R(),d= 345yi(a),e=mh(c,d);e.tag=2;void 0!==b&&null!==b&&(e.callback=b);b=nh(a,e,d);null!==b&&(gi(b,a,d,c),oh(b,a,d));}};function Fi(a,b,c,d,e,f,g){a=a.stateNode;return "function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!Ie(c,d)||!Ie(e,f):true} 346function Gi(a,b,c){var d=false,e=Vf;var f=b.contextType;"object"===typeof f&&null!==f?f=eh(f):(e=Zf(b)?Xf:H.current,d=b.contextTypes,f=(d=null!==d&&void 0!==d)?Yf(a,e):Vf);b=new b(c,f);a.memoizedState=null!==b.state&&void 0!==b.state?b.state:null;b.updater=Ei;a.stateNode=b;b._reactInternals=a;d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=e,a.__reactInternalMemoizedMaskedChildContext=f);return b} 347function Hi(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Ei.enqueueReplaceState(b,b.state,null);} 348function Ii(a,b,c,d){var e=a.stateNode;e.props=c;e.state=a.memoizedState;e.refs={};kh(a);var f=b.contextType;"object"===typeof f&&null!==f?e.context=eh(f):(f=Zf(b)?Xf:H.current,e.context=Yf(a,f));e.state=a.memoizedState;f=b.getDerivedStateFromProps;"function"===typeof f&&(Di(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||(b=e.state, 349"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Ei.enqueueReplaceState(e,e.state,null),qh(a,c,e,d),e.state=a.memoizedState);"function"===typeof e.componentDidMount&&(a.flags|=4194308);}function Ji(a,b){try{var c="",d=b;do c+=Pa(d),d=d.return;while(d);var e=c;}catch(f){e="\nError generating stack: "+f.message+"\n"+f.stack;}return {value:a,source:b,stack:e,digest:null}} 350function Ki(a,b,c){return {value:a,source:null,stack:null!=c?c:null,digest:null!=b?b:null}}function Li(a,b){try{console.error(b.value);}catch(c){setTimeout(function(){throw c;});}}var Mi="function"===typeof WeakMap?WeakMap:Map;function Ni(a,b,c){c=mh(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Oi||(Oi=true,Pi=d);Li(a,b);};return c} 351function Qi(a,b,c){c=mh(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){return d(e)};c.callback=function(){Li(a,b);};}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){Li(a,b);"function"!==typeof d&&(null===Ri?Ri=new Set([this]):Ri.add(this));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""});});return c} 352function Si(a,b,c){var d=a.pingCache;if(null===d){d=a.pingCache=new Mi;var e=new Set;d.set(b,e);}else e=d.get(b),void 0===e&&(e=new Set,d.set(b,e));e.has(c)||(e.add(c),a=Ti.bind(null,a,b,c),b.then(a,a));}function Ui(a){do{var b;if(b=13===a.tag)b=a.memoizedState,b=null!==b?null!==b.dehydrated?true:false:true;if(b)return a;a=a.return;}while(null!==a);return null} 353function Vi(a,b,c,d,e){if(0===(a.mode&1))return a===b?a.flags|=65536:(a.flags|=128,c.flags|=131072,c.flags&=-52805,1===c.tag&&(null===c.alternate?c.tag=17:(b=mh(-1,1),b.tag=2,nh(c,b,1))),c.lanes|=1),a;a.flags|=65536;a.lanes=e;return a}var Wi=ua.ReactCurrentOwner,dh=false;function Xi(a,b,c,d){b.child=null===a?Vg(b,null,c,d):Ug(b,a.child,c,d);} 354function Yi(a,b,c,d,e){c=c.render;var f=b.ref;ch(b,e);d=Nh(a,b,c,d,f,e);c=Sh();if(null!==a&&!dh)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Zi(a,b,e);I$1&&c&&vg(b);b.flags|=1;Xi(a,b,d,e);return b.child} 355function $i(a,b,c,d,e){if(null===a){var f=c.type;if("function"===typeof f&&!aj(f)&&void 0===f.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=f,bj(a,b,f,d,e);a=Rg(c.type,null,d,b,b.mode,e);a.ref=b.ref;a.return=b;return b.child=a}f=a.child;if(0===(a.lanes&e)){var g=f.memoizedProps;c=c.compare;c=null!==c?c:Ie;if(c(g,d)&&a.ref===b.ref)return Zi(a,b,e)}b.flags|=1;a=Pg(f,d);a.ref=b.ref;a.return=b;return b.child=a} 356function bj(a,b,c,d,e){if(null!==a){var f=a.memoizedProps;if(Ie(f,d)&&a.ref===b.ref)if(dh=false,b.pendingProps=d=f,0!==(a.lanes&e))0!==(a.flags&131072)&&(dh=true);else return b.lanes=a.lanes,Zi(a,b,e)}return cj(a,b,c,d,e)} 357function dj(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if("hidden"===d.mode)if(0===(b.mode&1))b.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(ej,fj),fj|=c;else {if(0===(c&1073741824))return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a,cachePool:null,transitions:null},b.updateQueue=null,G(ej,fj),fj|=a,null;b.memoizedState={baseLanes:0,cachePool:null,transitions:null};d=null!==f?f.baseLanes:c;G(ej,fj);fj|=d;}else null!== 358f?(d=f.baseLanes|c,b.memoizedState=null):d=c,G(ej,fj),fj|=d;Xi(a,b,e,c);return b.child}function gj(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=512,b.flags|=2097152;}function cj(a,b,c,d,e){var f=Zf(c)?Xf:H.current;f=Yf(b,f);ch(b,e);c=Nh(a,b,c,d,f,e);d=Sh();if(null!==a&&!dh)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Zi(a,b,e);I$1&&d&&vg(b);b.flags|=1;Xi(a,b,c,e);return b.child} 359function hj(a,b,c,d,e){if(Zf(c)){var f=true;cg(b);}else f=false;ch(b,e);if(null===b.stateNode)ij(a,b),Gi(b,c,d),Ii(b,c,d,e),d=true;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;"object"===typeof l&&null!==l?l=eh(l):(l=Zf(c)?Xf:H.current,l=Yf(b,l));var m=c.getDerivedStateFromProps,q="function"===typeof m||"function"===typeof g.getSnapshotBeforeUpdate;q||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps|| 360(h!==d||k!==l)&&Hi(b,g,d,l);jh=false;var r=b.memoizedState;g.state=r;qh(b,d,g,e);k=b.memoizedState;h!==d||r!==k||Wf.current||jh?("function"===typeof m&&(Di(b,c,m,d),k=b.memoizedState),(h=jh||Fi(b,c,h,d,r,k,l))?(q||"function"!==typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===typeof g.componentDidMount&&(b.flags|=4194308)): 361("function"===typeof g.componentDidMount&&(b.flags|=4194308),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):("function"===typeof g.componentDidMount&&(b.flags|=4194308),d=false);}else {g=b.stateNode;lh(a,b);h=b.memoizedProps;l=b.type===b.elementType?h:Ci(b.type,h);g.props=l;q=b.pendingProps;r=g.context;k=c.contextType;"object"===typeof k&&null!==k?k=eh(k):(k=Zf(c)?Xf:H.current,k=Yf(b,k));var y=c.getDerivedStateFromProps;(m="function"===typeof y||"function"===typeof g.getSnapshotBeforeUpdate)|| 362"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==q||r!==k)&&Hi(b,g,d,k);jh=false;r=b.memoizedState;g.state=r;qh(b,d,g,e);var n=b.memoizedState;h!==q||r!==n||Wf.current||jh?("function"===typeof y&&(Di(b,c,y,d),n=b.memoizedState),(l=jh||Fi(b,c,l,d,r,n,k)||false)?(m||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,n,k),"function"===typeof g.UNSAFE_componentWillUpdate&& 363g.UNSAFE_componentWillUpdate(d,n,k)),"function"===typeof g.componentDidUpdate&&(b.flags|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=1024)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),b.memoizedProps=d,b.memoizedState=n),g.props=d,g.state=n,g.context=k,d=l):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&r=== 364a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),d=false);}return jj(a,b,c,d,f,e)} 365function jj(a,b,c,d,e,f){gj(a,b);var g=0!==(b.flags&128);if(!d&&!g)return e&&dg(b,c,false),Zi(a,b,f);d=b.stateNode;Wi.current=b;var h=g&&"function"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=Ug(b,a.child,null,f),b.child=Ug(b,null,h,f)):Xi(a,b,h,f);b.memoizedState=d.state;e&&dg(b,c,true);return b.child}function kj(a){var b=a.stateNode;b.pendingContext?ag(a,b.pendingContext,b.pendingContext!==b.context):b.context&&ag(a,b.context,false);yh(a,b.containerInfo);} 366function lj(a,b,c,d,e){Ig();Jg(e);b.flags|=256;Xi(a,b,c,d);return b.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(a){return {baseLanes:a,cachePool:null,transitions:null}} 367function oj(a,b,c){var d=b.pendingProps,e=L$1.current,f=false,g=0!==(b.flags&128),h;(h=g)||(h=null!==a&&null===a.memoizedState?false:0!==(e&2));if(h)f=true,b.flags&=-129;else if(null===a||null!==a.memoizedState)e|=1;G(L$1,e&1);if(null===a){Eg(b);a=b.memoizedState;if(null!==a&&(a=a.dehydrated,null!==a))return 0===(b.mode&1)?b.lanes=1:"$!"===a.data?b.lanes=8:b.lanes=1073741824,null;g=d.children;a=d.fallback;return f?(d=b.mode,f=b.child,g={mode:"hidden",children:g},0===(d&1)&&null!==f?(f.childLanes=0,f.pendingProps= 368g):f=pj(g,d,0,null),a=Tg(a,d,c,null),f.return=b,a.return=b,f.sibling=a,b.child=f,b.child.memoizedState=nj(c),b.memoizedState=mj,a):qj(b,g)}e=a.memoizedState;if(null!==e&&(h=e.dehydrated,null!==h))return rj(a,b,g,d,h,e,c);if(f){f=d.fallback;g=b.mode;e=a.child;h=e.sibling;var k={mode:"hidden",children:d.children};0===(g&1)&&b.child!==e?(d=b.child,d.childLanes=0,d.pendingProps=k,b.deletions=null):(d=Pg(e,k),d.subtreeFlags=e.subtreeFlags&14680064);null!==h?f=Pg(h,f):(f=Tg(f,g,c,null),f.flags|=2);f.return= 369b;d.return=b;d.sibling=f;b.child=d;d=f;f=b.child;g=a.child.memoizedState;g=null===g?nj(c):{baseLanes:g.baseLanes|c,cachePool:null,transitions:g.transitions};f.memoizedState=g;f.childLanes=a.childLanes&~c;b.memoizedState=mj;return d}f=a.child;a=f.sibling;d=Pg(f,{mode:"visible",children:d.children});0===(b.mode&1)&&(d.lanes=c);d.return=b;d.sibling=null;null!==a&&(c=b.deletions,null===c?(b.deletions=[a],b.flags|=16):c.push(a));b.child=d;b.memoizedState=null;return d} 370function qj(a,b){b=pj({mode:"visible",children:b},a.mode,0,null);b.return=a;return a.child=b}function sj(a,b,c,d){null!==d&&Jg(d);Ug(b,a.child,null,c);a=qj(b,b.pendingProps.children);a.flags|=2;b.memoizedState=null;return a} 371function rj(a,b,c,d,e,f,g){if(c){if(b.flags&256)return b.flags&=-257,d=Ki(Error(p$2(422))),sj(a,b,g,d);if(null!==b.memoizedState)return b.child=a.child,b.flags|=128,null;f=d.fallback;e=b.mode;d=pj({mode:"visible",children:d.children},e,0,null);f=Tg(f,e,g,null);f.flags|=2;d.return=b;f.return=b;d.sibling=f;b.child=d;0!==(b.mode&1)&&Ug(b,a.child,null,g);b.child.memoizedState=nj(g);b.memoizedState=mj;return f}if(0===(b.mode&1))return sj(a,b,g,null);if("$!"===e.data){d=e.nextSibling&&e.nextSibling.dataset; 372if(d)var h=d.dgst;d=h;f=Error(p$2(419));d=Ki(f,d,void 0);return sj(a,b,g,d)}h=0!==(g&a.childLanes);if(dh||h){d=Q$1;if(null!==d){switch(g&-g){case 4:e=2;break;case 16:e=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:e=32;break;case 536870912:e=268435456;break;default:e=0;}e=0!==(e&(d.suspendedLanes|g))?0:e; 3730!==e&&e!==f.retryLane&&(f.retryLane=e,ih(a,e),gi(d,a,e,-1));}tj();d=Ki(Error(p$2(421)));return sj(a,b,g,d)}if("$?"===e.data)return b.flags|=128,b.child=a.child,b=uj.bind(null,a),e._reactRetry=b,null;a=f.treeContext;yg=Lf(e.nextSibling);xg=b;I$1=true;zg=null;null!==a&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=a.id,sg=a.overflow,qg=b);b=qj(b,d.children);b.flags|=4096;return b}function vj(a,b,c){a.lanes|=b;var d=a.alternate;null!==d&&(d.lanes|=b);bh(a.return,b,c);} 374function wj(a,b,c,d,e){var f=a.memoizedState;null===f?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e}:(f.isBackwards=b,f.rendering=null,f.renderingStartTime=0,f.last=d,f.tail=c,f.tailMode=e);} 375function xj(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;Xi(a,b,d.children,c);d=L$1.current;if(0!==(d&2))d=d&1|2,b.flags|=128;else {if(null!==a&&0!==(a.flags&128))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&vj(a,c,b);else if(19===a.tag)vj(a,c,b);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return;}a.sibling.return=a.return;a=a.sibling;}d&=1;}G(L$1,d);if(0===(b.mode&1))b.memoizedState= 376null;else switch(e){case "forwards":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===Ch(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);wj(b,false,e,c,f);break;case "backwards":c=null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===Ch(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a;}wj(b,true,c,null,f);break;case "together":wj(b,false,null,null,void 0);break;default:b.memoizedState=null;}return b.child} 377function ij(a,b){0===(b.mode&1)&&null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);}function Zi(a,b,c){null!==a&&(b.dependencies=a.dependencies);rh|=b.lanes;if(0===(c&b.childLanes))return null;if(null!==a&&b.child!==a.child)throw Error(p$2(153));if(null!==b.child){a=b.child;c=Pg(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=Pg(a,a.pendingProps),c.return=b;c.sibling=null;}return b.child} 378function yj(a,b,c){switch(b.tag){case 3:kj(b);Ig();break;case 5:Ah(b);break;case 1:Zf(b.type)&&cg(b);break;case 4:yh(b,b.stateNode.containerInfo);break;case 10:var d=b.type._context,e=b.memoizedProps.value;G(Wg,d._currentValue);d._currentValue=e;break;case 13:d=b.memoizedState;if(null!==d){if(null!==d.dehydrated)return G(L$1,L$1.current&1),b.flags|=128,null;if(0!==(c&b.child.childLanes))return oj(a,b,c);G(L$1,L$1.current&1);a=Zi(a,b,c);return null!==a?a.sibling:null}G(L$1,L$1.current&1);break;case 19:d=0!==(c& 379b.childLanes);if(0!==(a.flags&128)){if(d)return xj(a,b,c);b.flags|=128;}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);G(L$1,L$1.current);if(d)break;else return null;case 22:case 23:return b.lanes=0,dj(a,b,c)}return Zi(a,b,c)}var zj,Aj,Bj,Cj; 380zj=function(a,b){for(var c=b.child;null!==c;){if(5===c.tag||6===c.tag)a.appendChild(c.stateNode);else if(4!==c.tag&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;}c.sibling.return=c.return;c=c.sibling;}};Aj=function(){}; 381Bj=function(a,b,c,d){var e=a.memoizedProps;if(e!==d){a=b.stateNode;xh(uh.current);var f=null;switch(c){case "input":e=Ya(a,e);d=Ya(a,d);f=[];break;case "select":e=A$1({},e,{value:void 0});d=A$1({},d,{value:void 0});f=[];break;case "textarea":e=gb(a,e);d=gb(a,d);f=[];break;default:"function"!==typeof e.onClick&&"function"===typeof d.onClick&&(a.onclick=Bf);}ub(c,d);var g;c=null;for(l in e)if(!d.hasOwnProperty(l)&&e.hasOwnProperty(l)&&null!=e[l])if("style"===l){var h=e[l];for(g in h)h.hasOwnProperty(g)&& 382(c||(c={}),c[g]="");}else "dangerouslySetInnerHTML"!==l&&"children"!==l&&"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(ea.hasOwnProperty(l)?f||(f=[]):(f=f||[]).push(l,null));for(l in d){var k=d[l];h=null!=e?e[l]:void 0;if(d.hasOwnProperty(l)&&k!==h&&(null!=k||null!=h))if("style"===l)if(h){for(g in h)!h.hasOwnProperty(g)||k&&k.hasOwnProperty(g)||(c||(c={}),c[g]="");for(g in k)k.hasOwnProperty(g)&&h[g]!==k[g]&&(c||(c={}),c[g]=k[g]);}else c||(f||(f=[]),f.push(l, 383c)),c=k;else "dangerouslySetInnerHTML"===l?(k=k?k.__html:void 0,h=h?h.__html:void 0,null!=k&&h!==k&&(f=f||[]).push(l,k)):"children"===l?"string"!==typeof k&&"number"!==typeof k||(f=f||[]).push(l,""+k):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&(ea.hasOwnProperty(l)?(null!=k&&"onScroll"===l&&D$1("scroll",a),f||h===k||(f=[])):(f=f||[]).push(l,k));}c&&(f=f||[]).push("style",c);var l=f;if(b.updateQueue=l)b.flags|=4;}};Cj=function(a,b,c,d){c!==d&&(b.flags|=4);}; 384function Dj(a,b){if(!I$1)switch(a.tailMode){case "hidden":b=a.tail;for(var c=null;null!==b;)null!==b.alternate&&(c=b),b=b.sibling;null===c?a.tail=null:c.sibling=null;break;case "collapsed":c=a.tail;for(var d=null;null!==c;)null!==c.alternate&&(d=c),c=c.sibling;null===d?b||null===a.tail?a.tail=null:a.tail.sibling=null:d.sibling=null;}} 385function S$1(a){var b=null!==a.alternate&&a.alternate.child===a.child,c=0,d=0;if(b)for(var e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=e.subtreeFlags&14680064,d|=e.flags&14680064,e.return=a,e=e.sibling;else for(e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=e.subtreeFlags,d|=e.flags,e.return=a,e=e.sibling;a.subtreeFlags|=d;a.childLanes=c;return b} 386function Ej(a,b,c){var d=b.pendingProps;wg(b);switch(b.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S$1(b),null;case 1:return Zf(b.type)&&$f(),S$1(b),null;case 3:d=b.stateNode;zh();E(Wf);E(H);Eh();d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null);if(null===a||null===a.child)Gg(b)?b.flags|=4:null===a||a.memoizedState.isDehydrated&&0===(b.flags&256)||(b.flags|=1024,null!==zg&&(Fj(zg),zg=null));Aj(a,b);S$1(b);return null;case 5:Bh(b);var e=xh(wh.current); 387c=b.type;if(null!==a&&null!=b.stateNode)Bj(a,b,c,d,e),a.ref!==b.ref&&(b.flags|=512,b.flags|=2097152);else {if(!d){if(null===b.stateNode)throw Error(p$2(166));S$1(b);return null}a=xh(uh.current);if(Gg(b)){d=b.stateNode;c=b.type;var f=b.memoizedProps;d[Of]=b;d[Pf]=f;a=0!==(b.mode&1);switch(c){case "dialog":D$1("cancel",d);D$1("close",d);break;case "iframe":case "object":case "embed":D$1("load",d);break;case "video":case "audio":for(e=0;e<lf.length;e++)D$1(lf[e],d);break;case "source":D$1("error",d);break;case "img":case "image":case "link":D$1("error", 388d);D$1("load",d);break;case "details":D$1("toggle",d);break;case "input":Za(d,f);D$1("invalid",d);break;case "select":d._wrapperState={wasMultiple:!!f.multiple};D$1("invalid",d);break;case "textarea":hb(d,f),D$1("invalid",d);}ub(c,f);e=null;for(var g in f)if(f.hasOwnProperty(g)){var h=f[g];"children"===g?"string"===typeof h?d.textContent!==h&&(true!==f.suppressHydrationWarning&&Af(d.textContent,h,a),e=["children",h]):"number"===typeof h&&d.textContent!==""+h&&(true!==f.suppressHydrationWarning&&Af(d.textContent, 389h,a),e=["children",""+h]):ea.hasOwnProperty(g)&&null!=h&&"onScroll"===g&&D$1("scroll",d);}switch(c){case "input":Va(d);db(d,f,true);break;case "textarea":Va(d);jb(d);break;case "select":case "option":break;default:"function"===typeof f.onClick&&(d.onclick=Bf);}d=e;b.updateQueue=d;null!==d&&(b.flags|=4);}else {g=9===e.nodeType?e:e.ownerDocument;"http://www.w3.org/1999/xhtml"===a&&(a=kb(c));"http://www.w3.org/1999/xhtml"===a?"script"===c?(a=g.createElement("div"),a.innerHTML="<script>\x3c/script>",a=a.removeChild(a.firstChild)): 390"string"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),"select"===c&&(g=a,d.multiple?g.multiple=true:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;zj(a,b,false,false);b.stateNode=a;a:{g=vb(c,d);switch(c){case "dialog":D$1("cancel",a);D$1("close",a);e=d;break;case "iframe":case "object":case "embed":D$1("load",a);e=d;break;case "video":case "audio":for(e=0;e<lf.length;e++)D$1(lf[e],a);e=d;break;case "source":D$1("error",a);e=d;break;case "img":case "image":case "link":D$1("error", 391a);D$1("load",a);e=d;break;case "details":D$1("toggle",a);e=d;break;case "input":Za(a,d);e=Ya(a,d);D$1("invalid",a);break;case "option":e=d;break;case "select":a._wrapperState={wasMultiple:!!d.multiple};e=A$1({},d,{value:void 0});D$1("invalid",a);break;case "textarea":hb(a,d);e=gb(a,d);D$1("invalid",a);break;default:e=d;}ub(c,e);h=e;for(f in h)if(h.hasOwnProperty(f)){var k=h[f];"style"===f?sb(a,k):"dangerouslySetInnerHTML"===f?(k=k?k.__html:void 0,null!=k&&nb(a,k)):"children"===f?"string"===typeof k?("textarea"!== 392c||""!==k)&&ob(a,k):"number"===typeof k&&ob(a,""+k):"suppressContentEditableWarning"!==f&&"suppressHydrationWarning"!==f&&"autoFocus"!==f&&(ea.hasOwnProperty(f)?null!=k&&"onScroll"===f&&D$1("scroll",a):null!=k&&ta(a,f,k,g));}switch(c){case "input":Va(a);db(a,d,false);break;case "textarea":Va(a);jb(a);break;case "option":null!=d.value&&a.setAttribute("value",""+Sa(d.value));break;case "select":a.multiple=!!d.multiple;f=d.value;null!=f?fb(a,!!d.multiple,f,false):null!=d.defaultValue&&fb(a,!!d.multiple,d.defaultValue, 393true);break;default:"function"===typeof e.onClick&&(a.onclick=Bf);}switch(c){case "button":case "input":case "select":case "textarea":d=!!d.autoFocus;break a;case "img":d=true;break a;default:d=false;}}d&&(b.flags|=4);}null!==b.ref&&(b.flags|=512,b.flags|=2097152);}S$1(b);return null;case 6:if(a&&null!=b.stateNode)Cj(a,b,a.memoizedProps,d);else {if("string"!==typeof d&&null===b.stateNode)throw Error(p$2(166));c=xh(wh.current);xh(uh.current);if(Gg(b)){d=b.stateNode;c=b.memoizedProps;d[Of]=b;if(f=d.nodeValue!==c)if(a= 394xg,null!==a)switch(a.tag){case 3:Af(d.nodeValue,c,0!==(a.mode&1));break;case 5:true!==a.memoizedProps.suppressHydrationWarning&&Af(d.nodeValue,c,0!==(a.mode&1));}f&&(b.flags|=4);}else d=(9===c.nodeType?c:c.ownerDocument).createTextNode(d),d[Of]=b,b.stateNode=d;}S$1(b);return null;case 13:E(L$1);d=b.memoizedState;if(null===a||null!==a.memoizedState&&null!==a.memoizedState.dehydrated){if(I$1&&null!==yg&&0!==(b.mode&1)&&0===(b.flags&128))Hg(),Ig(),b.flags|=98560,f=false;else if(f=Gg(b),null!==d&&null!==d.dehydrated){if(null=== 395a){if(!f)throw Error(p$2(318));f=b.memoizedState;f=null!==f?f.dehydrated:null;if(!f)throw Error(p$2(317));f[Of]=b;}else Ig(),0===(b.flags&128)&&(b.memoizedState=null),b.flags|=4;S$1(b);f=false;}else null!==zg&&(Fj(zg),zg=null),f=true;if(!f)return b.flags&65536?b:null}if(0!==(b.flags&128))return b.lanes=c,b;d=null!==d;d!==(null!==a&&null!==a.memoizedState)&&d&&(b.child.flags|=8192,0!==(b.mode&1)&&(null===a||0!==(L$1.current&1)?0===T$1&&(T$1=3):tj()));null!==b.updateQueue&&(b.flags|=4);S$1(b);return null;case 4:return zh(), 396Aj(a,b),null===a&&sf(b.stateNode.containerInfo),S$1(b),null;case 10:return ah(b.type._context),S$1(b),null;case 17:return Zf(b.type)&&$f(),S$1(b),null;case 19:E(L$1);f=b.memoizedState;if(null===f)return S$1(b),null;d=0!==(b.flags&128);g=f.rendering;if(null===g)if(d)Dj(f,false);else {if(0!==T$1||null!==a&&0!==(a.flags&128))for(a=b.child;null!==a;){g=Ch(a);if(null!==g){b.flags|=128;Dj(f,false);d=g.updateQueue;null!==d&&(b.updateQueue=d,b.flags|=4);b.subtreeFlags=0;d=c;for(c=b.child;null!==c;)f=c,a=d,f.flags&=14680066, 397g=f.alternate,null===g?(f.childLanes=0,f.lanes=a,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=g.childLanes,f.lanes=g.lanes,f.child=g.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=g.memoizedProps,f.memoizedState=g.memoizedState,f.updateQueue=g.updateQueue,f.type=g.type,a=g.dependencies,f.dependencies=null===a?null:{lanes:a.lanes,firstContext:a.firstContext}),c=c.sibling;G(L$1,L$1.current&1|2);return b.child}a= 398a.sibling;}null!==f.tail&&B()>Gj&&(b.flags|=128,d=true,Dj(f,false),b.lanes=4194304);}else {if(!d)if(a=Ch(g),null!==a){if(b.flags|=128,d=true,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dj(f,true),null===f.tail&&"hidden"===f.tailMode&&!g.alternate&&!I$1)return S$1(b),null}else 2*B()-f.renderingStartTime>Gj&&1073741824!==c&&(b.flags|=128,d=true,Dj(f,false),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g);}if(null!==f.tail)return b=f.tail,f.rendering= 399b,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=L$1.current,G(L$1,d?c&1|2:c&1),b;S$1(b);return null;case 22:case 23:return Hj(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(fj&1073741824)&&(S$1(b),b.subtreeFlags&6&&(b.flags|=8192)):S$1(b),null;case 24:return null;case 25:return null}throw Error(p$2(156,b.tag));} 400function Ij(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return zh(),E(Wf),E(H),Eh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Bh(b),null;case 13:E(L$1);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p$2(340));Ig();}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(L$1),null;case 4:return zh(),null;case 10:return ah(b.type._context),null;case 22:case 23:return Hj(), 401null;case 24:return null;default:return null}}var Jj=false,U$1=false,Kj="function"===typeof WeakSet?WeakSet:Set,V$1=null;function Lj(a,b){var c=a.ref;if(null!==c)if("function"===typeof c)try{c(null);}catch(d){W$1(a,b,d);}else c.current=null;}function Mj(a,b,c){try{c();}catch(d){W$1(a,b,d);}}var Nj=false; 402function Oj(a,b){Cf=dd;a=Me();if(Ne(a)){if("selectionStart"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType;}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+= 403q.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y;}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode;}q=y;}c=-1===h||-1===k?null:{start:h,end:k};}else c=null;}c=c||{start:0,end:0};}else c=null;Df={focusedElem:a,selectionRange:c};dd=false;for(V$1=b;null!==V$1;)if(b=V$1,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V$1=a;else for(;null!==V$1;){b=V$1;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break; 404case 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Ci(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w;}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent="":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$2(163));}}catch(F){W$1(b,b.return,F);}a=b.sibling;if(null!==a){a.return=b.return;V$1=a;break}V$1=b.return;}n=Nj;Nj=false;return n} 405function Pj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Mj(b,c,f);}e=e.next;}while(e!==d)}}function Qj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d();}c=c.next;}while(c!==b)}}function Rj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c;}"function"===typeof b?b(a):b.current=a;}} 406function Sj(a){var b=a.alternate;null!==b&&(a.alternate=null,Sj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null;}function Tj(a){return 5===a.tag||3===a.tag||4===a.tag} 407function Uj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Tj(a.return))return null;a=a.return;}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child;}if(!(a.flags&2))return a.stateNode}} 408function Vj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Vj(a,b,c),a=a.sibling;null!==a;)Vj(a,b,c),a=a.sibling;} 409function Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling;}var X$1=null,Xj=false;function Yj(a,b,c){for(c=c.child;null!==c;)Zj(a,b,c),c=c.sibling;} 410function Zj(a,b,c){if(lc&&"function"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c);}catch(h){}switch(c.tag){case 5:U$1||Lj(c,b);case 6:var d=X$1,e=Xj;X$1=null;Yj(a,b,c);X$1=d;Xj=e;null!==X$1&&(Xj?(a=X$1,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X$1.removeChild(c.stateNode));break;case 18:null!==X$1&&(Xj?(a=X$1,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X$1,c.stateNode));break;case 4:d=X$1;e=Xj;X$1=c.stateNode.containerInfo;Xj=true; 411Yj(a,b,c);X$1=d;Xj=e;break;case 0:case 11:case 14:case 15:if(!U$1&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Mj(c,b,g):0!==(f&4)&&Mj(c,b,g));e=e.next;}while(e!==d)}Yj(a,b,c);break;case 1:if(!U$1&&(Lj(c,b),d=c.stateNode,"function"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount();}catch(h){W$1(c,b,h);}Yj(a,b,c);break;case 21:Yj(a,b,c);break;case 22:c.mode&1?(U$1=(d=U$1)||null!== 412c.memoizedState,Yj(a,b,c),U$1=d):Yj(a,b,c);break;default:Yj(a,b,c);}}function ak(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Kj);b.forEach(function(b){var d=bk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d));});}} 413function ck(a,b){var c=b.deletions;if(null!==c)for(var d=0;d<c.length;d++){var e=c[d];try{var f=a,g=b,h=g;a:for(;null!==h;){switch(h.tag){case 5:X$1=h.stateNode;Xj=!1;break a;case 3:X$1=h.stateNode.containerInfo;Xj=!0;break a;case 4:X$1=h.stateNode.containerInfo;Xj=!0;break a}h=h.return;}if(null===X$1)throw Error(p$2(160));Zj(f,g,e);X$1=null;Xj=!1;var k=e.alternate;null!==k&&(k.return=null);e.return=null;}catch(l){W$1(e,b,l);}}if(b.subtreeFlags&12854)for(b=b.child;null!==b;)dk(b,a),b=b.sibling;} 414function dk(a,b){var c=a.alternate,d=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:ck(b,a);ek(a);if(d&4){try{Pj(3,a,a.return),Qj(3,a);}catch(t){W$1(a,a.return,t);}try{Pj(5,a,a.return);}catch(t){W$1(a,a.return,t);}}break;case 1:ck(b,a);ek(a);d&512&&null!==c&&Lj(c,c.return);break;case 5:ck(b,a);ek(a);d&512&&null!==c&&Lj(c,c.return);if(a.flags&32){var e=a.stateNode;try{ob(e,"");}catch(t){W$1(a,a.return,t);}}if(d&4&&(e=a.stateNode,null!=e)){var f=a.memoizedProps,g=null!==c?c.memoizedProps:f,h=a.type,k=a.updateQueue; 415a.updateQueue=null;if(null!==k)try{"input"===h&&"radio"===f.type&&null!=f.name&&ab(e,f);vb(h,g);var l=vb(h,f);for(g=0;g<k.length;g+=2){var m=k[g],q=k[g+1];"style"===m?sb(e,q):"dangerouslySetInnerHTML"===m?nb(e,q):"children"===m?ob(e,q):ta(e,m,q,l);}switch(h){case "input":bb(e,f);break;case "textarea":ib(e,f);break;case "select":var r=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=!!f.multiple;var y=f.value;null!=y?fb(e,!!f.multiple,y,!1):r!==!!f.multiple&&(null!=f.defaultValue?fb(e,!!f.multiple, 416f.defaultValue,!0):fb(e,!!f.multiple,f.multiple?[]:"",!1));}e[Pf]=f;}catch(t){W$1(a,a.return,t);}}break;case 6:ck(b,a);ek(a);if(d&4){if(null===a.stateNode)throw Error(p$2(162));e=a.stateNode;f=a.memoizedProps;try{e.nodeValue=f;}catch(t){W$1(a,a.return,t);}}break;case 3:ck(b,a);ek(a);if(d&4&&null!==c&&c.memoizedState.isDehydrated)try{bd(b.containerInfo);}catch(t){W$1(a,a.return,t);}break;case 4:ck(b,a);ek(a);break;case 13:ck(b,a);ek(a);e=a.child;e.flags&8192&&(f=null!==e.memoizedState,e.stateNode.isHidden=f,!f|| 417null!==e.alternate&&null!==e.alternate.memoizedState||(fk=B()));d&4&&ak(a);break;case 22:m=null!==c&&null!==c.memoizedState;a.mode&1?(U$1=(l=U$1)||m,ck(b,a),U$1=l):ck(b,a);ek(a);if(d&8192){l=null!==a.memoizedState;if((a.stateNode.isHidden=l)&&!m&&0!==(a.mode&1))for(V$1=a,m=a.child;null!==m;){for(q=V$1=m;null!==V$1;){r=V$1;y=r.child;switch(r.tag){case 0:case 11:case 14:case 15:Pj(4,r,r.return);break;case 1:Lj(r,r.return);var n=r.stateNode;if("function"===typeof n.componentWillUnmount){d=r;c=r.return;try{b=d,n.props= 418b.memoizedProps,n.state=b.memoizedState,n.componentWillUnmount();}catch(t){W$1(d,c,t);}}break;case 5:Lj(r,r.return);break;case 22:if(null!==r.memoizedState){gk(q);continue}}null!==y?(y.return=r,V$1=y):gk(q);}m=m.sibling;}a:for(m=null,q=a;;){if(5===q.tag){if(null===m){m=q;try{e=q.stateNode,l?(f=e.style,"function"===typeof f.setProperty?f.setProperty("display","none","important"):f.display="none"):(h=q.stateNode,k=q.memoizedProps.style,g=void 0!==k&&null!==k&&k.hasOwnProperty("display")?k.display:null,h.style.display= 419rb("display",g));}catch(t){W$1(a,a.return,t);}}}else if(6===q.tag){if(null===m)try{q.stateNode.nodeValue=l?"":q.memoizedProps;}catch(t){W$1(a,a.return,t);}}else if((22!==q.tag&&23!==q.tag||null===q.memoizedState||q===a)&&null!==q.child){q.child.return=q;q=q.child;continue}if(q===a)break a;for(;null===q.sibling;){if(null===q.return||q.return===a)break a;m===q&&(m=null);q=q.return;}m===q&&(m=null);q.sibling.return=q.return;q=q.sibling;}}break;case 19:ck(b,a);ek(a);d&4&&ak(a);break;case 21:break;default:ck(b, 420a),ek(a);}}function ek(a){var b=a.flags;if(b&2){try{a:{for(var c=a.return;null!==c;){if(Tj(c)){var d=c;break a}c=c.return;}throw Error(p$2(160));}switch(d.tag){case 5:var e=d.stateNode;d.flags&32&&(ob(e,""),d.flags&=-33);var f=Uj(a);Wj(a,f,e);break;case 3:case 4:var g=d.stateNode.containerInfo,h=Uj(a);Vj(a,h,g);break;default:throw Error(p$2(161));}}catch(k){W$1(a,a.return,k);}a.flags&=-3;}b&4096&&(a.flags&=-4097);}function hk(a,b,c){V$1=a;ik(a);} 421function ik(a,b,c){for(var d=0!==(a.mode&1);null!==V$1;){var e=V$1,f=e.child;if(22===e.tag&&d){var g=null!==e.memoizedState||Jj;if(!g){var h=e.alternate,k=null!==h&&null!==h.memoizedState||U$1;h=Jj;var l=U$1;Jj=g;if((U$1=k)&&!l)for(V$1=e;null!==V$1;)g=V$1,k=g.child,22===g.tag&&null!==g.memoizedState?jk(e):null!==k?(k.return=g,V$1=k):jk(e);for(;null!==f;)V$1=f,ik(f),f=f.sibling;V$1=e;Jj=h;U$1=l;}kk(a);}else 0!==(e.subtreeFlags&8772)&&null!==f?(f.return=e,V$1=f):kk(a);}} 422function kk(a){for(;null!==V$1;){var b=V$1;if(0!==(b.flags&8772)){var c=b.alternate;try{if(0!==(b.flags&8772))switch(b.tag){case 0:case 11:case 15:U$1||Qj(5,b);break;case 1:var d=b.stateNode;if(b.flags&4&&!U$1)if(null===c)d.componentDidMount();else {var e=b.elementType===b.type?c.memoizedProps:Ci(b.type,c.memoizedProps);d.componentDidUpdate(e,c.memoizedState,d.__reactInternalSnapshotBeforeUpdate);}var f=b.updateQueue;null!==f&&sh(b,f,d);break;case 3:var g=b.updateQueue;if(null!==g){c=null;if(null!==b.child)switch(b.child.tag){case 5:c= 423b.child.stateNode;break;case 1:c=b.child.stateNode;}sh(b,g,c);}break;case 5:var h=b.stateNode;if(null===c&&b.flags&4){c=h;var k=b.memoizedProps;switch(b.type){case "button":case "input":case "select":case "textarea":k.autoFocus&&c.focus();break;case "img":k.src&&(c.src=k.src);}}break;case 6:break;case 4:break;case 12:break;case 13:if(null===b.memoizedState){var l=b.alternate;if(null!==l){var m=l.memoizedState;if(null!==m){var q=m.dehydrated;null!==q&&bd(q);}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break; 424default:throw Error(p$2(163));}U$1||b.flags&512&&Rj(b);}catch(r){W$1(b,b.return,r);}}if(b===a){V$1=null;break}c=b.sibling;if(null!==c){c.return=b.return;V$1=c;break}V$1=b.return;}}function gk(a){for(;null!==V$1;){var b=V$1;if(b===a){V$1=null;break}var c=b.sibling;if(null!==c){c.return=b.return;V$1=c;break}V$1=b.return;}} 425function jk(a){for(;null!==V$1;){var b=V$1;try{switch(b.tag){case 0:case 11:case 15:var c=b.return;try{Qj(4,b);}catch(k){W$1(b,c,k);}break;case 1:var d=b.stateNode;if("function"===typeof d.componentDidMount){var e=b.return;try{d.componentDidMount();}catch(k){W$1(b,e,k);}}var f=b.return;try{Rj(b);}catch(k){W$1(b,f,k);}break;case 5:var g=b.return;try{Rj(b);}catch(k){W$1(b,g,k);}}}catch(k){W$1(b,b.return,k);}if(b===a){V$1=null;break}var h=b.sibling;if(null!==h){h.return=b.return;V$1=h;break}V$1=b.return;}} 426var lk=Math.ceil,mk=ua.ReactCurrentDispatcher,nk=ua.ReactCurrentOwner,ok=ua.ReactCurrentBatchConfig,K$1=0,Q$1=null,Y$1=null,Z$1=0,fj=0,ej=Uf(0),T$1=0,pk=null,rh=0,qk=0,rk=0,sk=null,tk=null,fk=0,Gj=Infinity,uk=null,Oi=false,Pi=null,Ri=null,vk=false,wk=null,xk=0,yk=0,zk=null,Ak=-1,Bk=0;function R(){return 0!==(K$1&6)?B():-1!==Ak?Ak:Ak=B()} 427function yi(a){if(0===(a.mode&1))return 1;if(0!==(K$1&2)&&0!==Z$1)return Z$1&-Z$1;if(null!==Kg.transition)return 0===Bk&&(Bk=yc()),Bk;a=C$1;if(0!==a)return a;a=window.event;a=void 0===a?16:jd(a.type);return a}function gi(a,b,c,d){if(50<yk)throw yk=0,zk=null,Error(p$2(185));Ac(a,c,d);if(0===(K$1&2)||a!==Q$1)a===Q$1&&(0===(K$1&2)&&(qk|=c),4===T$1&&Ck(a,Z$1)),Dk(a,d),1===c&&0===K$1&&0===(b.mode&1)&&(Gj=B()+500,fg&&jg());} 428function Dk(a,b){var c=a.callbackNode;wc(a,b);var d=uc(a,a===Q$1?Z$1:0);if(0===d)null!==c&&bc(c),a.callbackNode=null,a.callbackPriority=0;else if(b=d&-d,a.callbackPriority!==b){null!=c&&bc(c);if(1===b)0===a.tag?ig(Ek.bind(null,a)):hg(Ek.bind(null,a)),Jf(function(){0===(K$1&6)&&jg();}),c=null;else {switch(Dc(d)){case 1:c=fc;break;case 4:c=gc;break;case 16:c=hc;break;case 536870912:c=jc;break;default:c=hc;}c=Fk(c,Gk.bind(null,a));}a.callbackPriority=b;a.callbackNode=c;}} 429function Gk(a,b){Ak=-1;Bk=0;if(0!==(K$1&6))throw Error(p$2(327));var c=a.callbackNode;if(Hk()&&a.callbackNode!==c)return null;var d=uc(a,a===Q$1?Z$1:0);if(0===d)return null;if(0!==(d&30)||0!==(d&a.expiredLanes)||b)b=Ik(a,d);else {b=d;var e=K$1;K$1|=2;var f=Jk();if(Q$1!==a||Z$1!==b)uk=null,Gj=B()+500,Kk(a,b);do try{Lk();break}catch(h){Mk(a,h);}while(1);$g();mk.current=f;K$1=e;null!==Y$1?b=0:(Q$1=null,Z$1=0,b=T$1);}if(0!==b){2===b&&(e=xc(a),0!==e&&(d=e,b=Nk(a,e)));if(1===b)throw c=pk,Kk(a,0),Ck(a,d),Dk(a,B()),c;if(6===b)Ck(a,d); 430else {e=a.current.alternate;if(0===(d&30)&&!Ok$1(e)&&(b=Ik(a,d),2===b&&(f=xc(a),0!==f&&(d=f,b=Nk(a,f))),1===b))throw c=pk,Kk(a,0),Ck(a,d),Dk(a,B()),c;a.finishedWork=e;a.finishedLanes=d;switch(b){case 0:case 1:throw Error(p$2(345));case 2:Pk(a,tk,uk);break;case 3:Ck(a,d);if((d&130023424)===d&&(b=fk+500-B(),10<b)){if(0!==uc(a,0))break;e=a.suspendedLanes;if((e&d)!==d){R();a.pingedLanes|=a.suspendedLanes&e;break}a.timeoutHandle=Ff(Pk.bind(null,a,tk,uk),b);break}Pk(a,tk,uk);break;case 4:Ck(a,d);if((d&4194240)=== 431d)break;b=a.eventTimes;for(e=-1;0<d;){var g=31-oc(d);f=1<<g;g=b[g];g>e&&(e=g);d&=~f;}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lk(d/1960))-d;if(10<d){a.timeoutHandle=Ff(Pk.bind(null,a,tk,uk),d);break}Pk(a,tk,uk);break;case 5:Pk(a,tk,uk);break;default:throw Error(p$2(329));}}}Dk(a,B());return a.callbackNode===c?Gk.bind(null,a):null} 432function Nk(a,b){var c=sk;a.current.memoizedState.isDehydrated&&(Kk(a,b).flags|=256);a=Ik(a,b);2!==a&&(b=tk,tk=c,null!==b&&Fj(b));return a}function Fj(a){null===tk?tk=a:tk.push.apply(tk,a);} 433function Ok$1(a){for(var b=a;;){if(b.flags&16384){var c=b.updateQueue;if(null!==c&&(c=c.stores,null!==c))for(var d=0;d<c.length;d++){var e=c[d],f=e.getSnapshot;e=e.value;try{if(!He(f(),e))return !1}catch(g){return false}}}c=b.child;if(b.subtreeFlags&16384&&null!==c)c.return=b,b=c;else {if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return true;b=b.return;}b.sibling.return=b.return;b=b.sibling;}}return true} 434function Ck(a,b){b&=~rk;b&=~qk;a.suspendedLanes|=b;a.pingedLanes&=~b;for(a=a.expirationTimes;0<b;){var c=31-oc(b),d=1<<c;a[c]=-1;b&=~d;}}function Ek(a){if(0!==(K$1&6))throw Error(p$2(327));Hk();var b=uc(a,0);if(0===(b&1))return Dk(a,B()),null;var c=Ik(a,b);if(0!==a.tag&&2===c){var d=xc(a);0!==d&&(b=d,c=Nk(a,d));}if(1===c)throw c=pk,Kk(a,0),Ck(a,b),Dk(a,B()),c;if(6===c)throw Error(p$2(345));a.finishedWork=a.current.alternate;a.finishedLanes=b;Pk(a,tk,uk);Dk(a,B());return null} 435function Qk(a,b){var c=K$1;K$1|=1;try{return a(b)}finally{K$1=c,0===K$1&&(Gj=B()+500,fg&&jg());}}function Rk(a){null!==wk&&0===wk.tag&&0===(K$1&6)&&Hk();var b=K$1;K$1|=1;var c=ok.transition,d=C$1;try{if(ok.transition=null,C$1=1,a)return a()}finally{C$1=d,ok.transition=c,K$1=b,0===(K$1&6)&&jg();}}function Hj(){fj=ej.current;E(ej);} 436function Kk(a,b){a.finishedWork=null;a.finishedLanes=0;var c=a.timeoutHandle;-1!==c&&(a.timeoutHandle=-1,Gf(c));if(null!==Y$1)for(c=Y$1.return;null!==c;){var d=c;wg(d);switch(d.tag){case 1:d=d.type.childContextTypes;null!==d&&void 0!==d&&$f();break;case 3:zh();E(Wf);E(H);Eh();break;case 5:Bh(d);break;case 4:zh();break;case 13:E(L$1);break;case 19:E(L$1);break;case 10:ah(d.type._context);break;case 22:case 23:Hj();}c=c.return;}Q$1=a;Y$1=a=Pg(a.current,null);Z$1=fj=b;T$1=0;pk=null;rk=qk=rh=0;tk=sk=null;if(null!==fh){for(b= 4370;b<fh.length;b++)if(c=fh[b],d=c.interleaved,null!==d){c.interleaved=null;var e=d.next,f=c.pending;if(null!==f){var g=f.next;f.next=e;d.next=g;}c.pending=d;}fh=null;}return a} 438function Mk(a,b){do{var c=Y$1;try{$g();Fh.current=Rh;if(Ih){for(var d=M.memoizedState;null!==d;){var e=d.queue;null!==e&&(e.pending=null);d=d.next;}Ih=!1;}Hh=0;O=N=M=null;Jh=!1;Kh=0;nk.current=null;if(null===c||null===c.return){T$1=1;pk=b;Y$1=null;break}a:{var f=a,g=c.return,h=c,k=b;b=Z$1;h.flags|=32768;if(null!==k&&"object"===typeof k&&"function"===typeof k.then){var l=k,m=h,q=m.tag;if(0===(m.mode&1)&&(0===q||11===q||15===q)){var r=m.alternate;r?(m.updateQueue=r.updateQueue,m.memoizedState=r.memoizedState, 439m.lanes=r.lanes):(m.updateQueue=null,m.memoizedState=null);}var y=Ui(g);if(null!==y){y.flags&=-257;Vi(y,g,h,f,b);y.mode&1&&Si(f,l,b);b=y;k=l;var n=b.updateQueue;if(null===n){var t=new Set;t.add(k);b.updateQueue=t;}else n.add(k);break a}else {if(0===(b&1)){Si(f,l,b);tj();break a}k=Error(p$2(426));}}else if(I$1&&h.mode&1){var J=Ui(g);if(null!==J){0===(J.flags&65536)&&(J.flags|=256);Vi(J,g,h,f,b);Jg(Ji(k,h));break a}}f=k=Ji(k,h);4!==T$1&&(T$1=2);null===sk?sk=[f]:sk.push(f);f=g;do{switch(f.tag){case 3:f.flags|=65536; 440b&=-b;f.lanes|=b;var x=Ni(f,k,b);ph(f,x);break a;case 1:h=k;var w=f.type,u=f.stateNode;if(0===(f.flags&128)&&("function"===typeof w.getDerivedStateFromError||null!==u&&"function"===typeof u.componentDidCatch&&(null===Ri||!Ri.has(u)))){f.flags|=65536;b&=-b;f.lanes|=b;var F=Qi(f,h,b);ph(f,F);break a}}f=f.return;}while(null!==f)}Sk(c);}catch(na){b=na;Y$1===c&&null!==c&&(Y$1=c=c.return);continue}break}while(1)}function Jk(){var a=mk.current;mk.current=Rh;return null===a?Rh:a} 441function tj(){if(0===T$1||3===T$1||2===T$1)T$1=4;null===Q$1||0===(rh&268435455)&&0===(qk&268435455)||Ck(Q$1,Z$1);}function Ik(a,b){var c=K$1;K$1|=2;var d=Jk();if(Q$1!==a||Z$1!==b)uk=null,Kk(a,b);do try{Tk();break}catch(e){Mk(a,e);}while(1);$g();K$1=c;mk.current=d;if(null!==Y$1)throw Error(p$2(261));Q$1=null;Z$1=0;return T$1}function Tk(){for(;null!==Y$1;)Uk(Y$1);}function Lk(){for(;null!==Y$1&&!cc();)Uk(Y$1);}function Uk(a){var b=Vk(a.alternate,a,fj);a.memoizedProps=a.pendingProps;null===b?Sk(a):Y$1=b;nk.current=null;} 442function Sk(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&32768)){if(c=Ej(c,b,fj),null!==c){Y$1=c;return}}else {c=Ij(c,b);if(null!==c){c.flags&=32767;Y$1=c;return}if(null!==a)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else {T$1=6;Y$1=null;return}}b=b.sibling;if(null!==b){Y$1=b;return}Y$1=b=a;}while(null!==b);0===T$1&&(T$1=5);}function Pk(a,b,c){var d=C$1,e=ok.transition;try{ok.transition=null,C$1=1,Wk(a,b,c,d);}finally{ok.transition=e,C$1=d;}return null} 443function Wk(a,b,c,d){do Hk();while(null!==wk);if(0!==(K$1&6))throw Error(p$2(327));c=a.finishedWork;var e=a.finishedLanes;if(null===c)return null;a.finishedWork=null;a.finishedLanes=0;if(c===a.current)throw Error(p$2(177));a.callbackNode=null;a.callbackPriority=0;var f=c.lanes|c.childLanes;Bc(a,f);a===Q$1&&(Y$1=Q$1=null,Z$1=0);0===(c.subtreeFlags&2064)&&0===(c.flags&2064)||vk||(vk=true,Fk(hc,function(){Hk();return null}));f=0!==(c.flags&15990);if(0!==(c.subtreeFlags&15990)||f){f=ok.transition;ok.transition=null; 444var g=C$1;C$1=1;var h=K$1;K$1|=4;nk.current=null;Oj(a,c);dk(c,a);Oe(Df);dd=!!Cf;Df=Cf=null;a.current=c;hk(c);dc();K$1=h;C$1=g;ok.transition=f;}else a.current=c;vk&&(vk=false,wk=a,xk=e);f=a.pendingLanes;0===f&&(Ri=null);mc(c.stateNode);Dk(a,B());if(null!==b)for(d=a.onRecoverableError,c=0;c<b.length;c++)e=b[c],d(e.value,{componentStack:e.stack,digest:e.digest});if(Oi)throw Oi=false,a=Pi,Pi=null,a;0!==(xk&1)&&0!==a.tag&&Hk();f=a.pendingLanes;0!==(f&1)?a===zk?yk++:(yk=0,zk=a):yk=0;jg();return null} 445function Hk(){if(null!==wk){var a=Dc(xk),b=ok.transition,c=C$1;try{ok.transition=null;C$1=16>a?16:a;if(null===wk)var d=!1;else {a=wk;wk=null;xk=0;if(0!==(K$1&6))throw Error(p$2(331));var e=K$1;K$1|=4;for(V$1=a.current;null!==V$1;){var f=V$1,g=f.child;if(0!==(V$1.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;k<h.length;k++){var l=h[k];for(V$1=l;null!==V$1;){var m=V$1;switch(m.tag){case 0:case 11:case 15:Pj(8,m,f);}var q=m.child;if(null!==q)q.return=m,V$1=q;else for(;null!==V$1;){m=V$1;var r=m.sibling,y=m.return;Sj(m);if(m=== 446l){V$1=null;break}if(null!==r){r.return=y;V$1=r;break}V$1=y;}}}var n=f.alternate;if(null!==n){var t=n.child;if(null!==t){n.child=null;do{var J=t.sibling;t.sibling=null;t=J;}while(null!==t)}}V$1=f;}}if(0!==(f.subtreeFlags&2064)&&null!==g)g.return=f,V$1=g;else b:for(;null!==V$1;){f=V$1;if(0!==(f.flags&2048))switch(f.tag){case 0:case 11:case 15:Pj(9,f,f.return);}var x=f.sibling;if(null!==x){x.return=f.return;V$1=x;break b}V$1=f.return;}}var w=a.current;for(V$1=w;null!==V$1;){g=V$1;var u=g.child;if(0!==(g.subtreeFlags&2064)&&null!== 447u)u.return=g,V$1=u;else b:for(g=w;null!==V$1;){h=V$1;if(0!==(h.flags&2048))try{switch(h.tag){case 0:case 11:case 15:Qj(9,h);}}catch(na){W$1(h,h.return,na);}if(h===g){V$1=null;break b}var F=h.sibling;if(null!==F){F.return=h.return;V$1=F;break b}V$1=h.return;}}K$1=e;jg();if(lc&&"function"===typeof lc.onPostCommitFiberRoot)try{lc.onPostCommitFiberRoot(kc,a);}catch(na){}d=!0;}return d}finally{C$1=c,ok.transition=b;}}return false}function Xk(a,b,c){b=Ji(c,b);b=Ni(a,b,1);a=nh(a,b,1);b=R();null!==a&&(Ac(a,1,b),Dk(a,b));} 448function W$1(a,b,c){if(3===a.tag)Xk(a,a,c);else for(;null!==b;){if(3===b.tag){Xk(b,a,c);break}else if(1===b.tag){var d=b.stateNode;if("function"===typeof b.type.getDerivedStateFromError||"function"===typeof d.componentDidCatch&&(null===Ri||!Ri.has(d))){a=Ji(c,a);a=Qi(b,a,1);b=nh(b,a,1);a=R();null!==b&&(Ac(b,1,a),Dk(b,a));break}}b=b.return;}} 449function Ti(a,b,c){var d=a.pingCache;null!==d&&d.delete(b);b=R();a.pingedLanes|=a.suspendedLanes&c;Q$1===a&&(Z$1&c)===c&&(4===T$1||3===T$1&&(Z$1&130023424)===Z$1&&500>B()-fk?Kk(a,0):rk|=c);Dk(a,b);}function Yk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=R();a=ih(a,b);null!==a&&(Ac(a,b,c),Dk(a,c));}function uj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Yk(a,c);} 450function bk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p$2(314));}null!==d&&d.delete(b);Yk(a,c);}var Vk; 451Vk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)dh=true;else {if(0===(a.lanes&c)&&0===(b.flags&128))return dh=false,yj(a,b,c);dh=0!==(a.flags&131072)?true:false;}else dh=false,I$1&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;ij(a,b);a=b.pendingProps;var e=Yf(b,H.current);ch(b,c);e=Nh(null,b,d,a,e,c);var f=Sh();b.flags|=1;"object"===typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue= 452null,Zf(d)?(f=true,cg(b)):f=false,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,kh(b),e.updater=Ei,b.stateNode=e,e._reactInternals=b,Ii(b,d,a,c),b=jj(null,b,d,true,f,c)):(b.tag=0,I$1&&f&&vg(b),Xi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{ij(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Zk(d);a=Ci(d,a);switch(e){case 0:b=cj(null,b,d,a,c);break a;case 1:b=hj(null,b,d,a,c);break a;case 11:b=Yi(null,b,d,a,c);break a;case 14:b=$i(null,b,d,Ci(d.type,a),c);break a}throw Error(p$2(306, 453d,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),cj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),hj(a,b,d,e,c);case 3:a:{kj(b);if(null===a)throw Error(p$2(387));d=b.pendingProps;f=b.memoizedState;e=f.element;lh(a,b);qh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:false,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState= 454f,b.memoizedState=f,b.flags&256){e=Ji(Error(p$2(423)),b);b=lj(a,b,d,c,e);break a}else if(d!==e){e=Ji(Error(p$2(424)),b);b=lj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I$1=true,zg=null,c=Vg(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else {Ig();if(d===e){b=Zi(a,b,c);break a}Xi(a,b,d,c);}b=b.child;}return b;case 5:return Ah(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32), 455gj(a,b),Xi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return oj(a,b,c);case 4:return yh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Ug(b,null,d,c):Xi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),Yi(a,b,d,e,c);case 7:return Xi(a,b,b.pendingProps,c),b.child;case 8:return Xi(a,b,b.pendingProps.children,c),b.child;case 12:return Xi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps; 456g=e.value;G(Wg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=Zi(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=mh(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k;}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);bh(f.return, 457c,b);h.lanes|=c;break}k=k.next;}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p$2(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);bh(g,c,b);g=f.sibling;}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return;}f=g;}Xi(a,b,e.children,c);b=b.child;}return b;case 9:return e=b.type,d=b.pendingProps.children,ch(b,c),e=eh(e),d=d(e),b.flags|=1,Xi(a,b,d,c), 458b.child;case 14:return d=b.type,e=Ci(d,b.pendingProps),e=Ci(d.type,e),$i(a,b,d,e,c);case 15:return bj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),ij(a,b),b.tag=1,Zf(d)?(a=true,cg(b)):a=false,ch(b,c),Gi(b,d,e),Ii(b,d,e,c),jj(null,b,d,true,a,c);case 19:return xj(a,b,c);case 22:return dj(a,b,c)}throw Error(p$2(156,b.tag));};function Fk(a,b){return ac(a,b)} 459function $k(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null;}function Bg(a,b,c,d){return new $k(a,b,c,d)}function aj(a){a=a.prototype;return !(!a||!a.isReactComponent)} 460function Zk(a){if("function"===typeof a)return aj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2} 461function Pg(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext}; 462c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c} 463function Rg(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)aj(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ya:return Tg(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return pj(c,e,f,b);default:if("object"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11; 464break a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p$2(130,null==a?a:typeof a,""));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Tg(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function pj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:false};return a}function Qg(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a} 465function Sg(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b} 466function al(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData= 467null;}function bl(a,b,c,d,e,f,g,h,k){a=new al(a,b,c,h,k);1===b?(b=1,true===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};kh(f);return a}function cl(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return {$$typeof:wa,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}} 468function dl(a){if(!a)return Vf;a=a._reactInternals;a:{if(Vb(a)!==a||1!==a.tag)throw Error(p$2(170));var b=a;do{switch(b.tag){case 3:b=b.stateNode.context;break a;case 1:if(Zf(b.type)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}}b=b.return;}while(null!==b);throw Error(p$2(171));}if(1===a.tag){var c=a.type;if(Zf(c))return bg(a,c,b)}return b} 469function el(a,b,c,d,e,f,g,h,k){a=bl(c,d,true,a,e,f,g,h,k);a.context=dl(null);c=a.current;d=R();e=yi(c);f=mh(d,e);f.callback=void 0!==b&&null!==b?b:null;nh(c,f,e);a.current.lanes=e;Ac(a,e,d);Dk(a,d);return a}function fl(a,b,c,d){var e=b.current,f=R(),g=yi(e);c=dl(c);null===b.context?b.context=c:b.pendingContext=c;b=mh(f,g);b.payload={element:a};d=void 0===d?null:d;null!==d&&(b.callback=d);a=nh(e,b,g);null!==a&&(gi(a,e,g,f),oh(a,e,g));return g} 470function gl(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function hl(a,b){a=a.memoizedState;if(null!==a&&null!==a.dehydrated){var c=a.retryLane;a.retryLane=0!==c&&c<b?c:b;}}function il(a,b){hl(a,b);(a=a.alternate)&&hl(a,b);}function jl(){return null}var kl="function"===typeof reportError?reportError:function(a){console.error(a);};function ll(a){this._internalRoot=a;} 471ml.prototype.render=ll.prototype.render=function(a){var b=this._internalRoot;if(null===b)throw Error(p$2(409));fl(a,b,null,null);};ml.prototype.unmount=ll.prototype.unmount=function(){var a=this._internalRoot;if(null!==a){this._internalRoot=null;var b=a.containerInfo;Rk(function(){fl(null,a,null,null);});b[uf]=null;}};function ml(a){this._internalRoot=a;} 472ml.prototype.unstable_scheduleHydration=function(a){if(a){var b=Hc();a={blockedOn:null,target:a,priority:b};for(var c=0;c<Qc.length&&0!==b&&b<Qc[c].priority;c++);Qc.splice(c,0,a);0===c&&Vc(a);}};function nl(a){return !(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType)}function ol(a){return !(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}function pl(){} 473function ql(a,b,c,d,e){if(e){if("function"===typeof d){var f=d;d=function(){var a=gl(g);f.call(a);};}var g=el(b,d,a,0,null,false,false,"",pl);a._reactRootContainer=g;a[uf]=g.current;sf(8===a.nodeType?a.parentNode:a);Rk();return g}for(;e=a.lastChild;)a.removeChild(e);if("function"===typeof d){var h=d;d=function(){var a=gl(k);h.call(a);};}var k=bl(a,0,false,null,null,false,false,"",pl);a._reactRootContainer=k;a[uf]=k.current;sf(8===a.nodeType?a.parentNode:a);Rk(function(){fl(b,k,c,d);});return k} 474function rl(a,b,c,d,e){var f=c._reactRootContainer;if(f){var g=f;if("function"===typeof e){var h=e;e=function(){var a=gl(g);h.call(a);};}fl(b,g,a,e);}else g=ql(c,b,a,e,d);return gl(g)}Ec=function(a){switch(a.tag){case 3:var b=a.stateNode;if(b.current.memoizedState.isDehydrated){var c=tc(b.pendingLanes);0!==c&&(Cc(b,c|1),Dk(b,B()),0===(K$1&6)&&(Gj=B()+500,jg()));}break;case 13:Rk(function(){var b=ih(a,1);if(null!==b){var c=R();gi(b,a,1,c);}}),il(a,1);}}; 475Fc=function(a){if(13===a.tag){var b=ih(a,134217728);if(null!==b){var c=R();gi(b,a,134217728,c);}il(a,134217728);}};Gc=function(a){if(13===a.tag){var b=yi(a),c=ih(a,b);if(null!==c){var d=R();gi(c,a,b,d);}il(a,b);}};Hc=function(){return C$1};Ic=function(a,b){var c=C$1;try{return C$1=a,b()}finally{C$1=c;}}; 476yb=function(a,b,c){switch(b){case "input":bb(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=c.parentNode;c=c.querySelectorAll("input[name="+JSON.stringify(""+b)+'][type="radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=Db(d);if(!e)throw Error(p$2(90));Wa(d);bb(d,e);}}}break;case "textarea":ib(a,c);break;case "select":b=c.value,null!=b&&fb(a,!!c.multiple,b,false);}};Gb=Qk;Hb=Rk; 477var sl={usingClientEntryPoint:false,Events:[Cb,ue,Db,Eb,Fb,Qk]},tl={findFiberByHostInstance:Wc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"}; 478var ul={bundleType:tl.bundleType,version:tl.version,rendererPackageName:tl.rendererPackageName,rendererConfig:tl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ua.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){a=Zb(a);return null===a?null:a.stateNode},findFiberByHostInstance:tl.findFiberByHostInstance|| 479jl,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var vl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vl.isDisabled&&vl.supportsFiber)try{kc=vl.inject(ul),lc=vl;}catch(a){}}reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sl; 480reactDom_production_min.createPortal=function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!nl(b))throw Error(p$2(200));return cl(a,b,null,c)};reactDom_production_min.createRoot=function(a,b){if(!nl(a))throw Error(p$2(299));var c=false,d="",e=kl;null!==b&&void 0!==b&&(true===b.unstable_strictMode&&(c=true),void 0!==b.identifierPrefix&&(d=b.identifierPrefix),void 0!==b.onRecoverableError&&(e=b.onRecoverableError));b=bl(a,1,false,null,null,c,false,d,e);a[uf]=b.current;sf(8===a.nodeType?a.parentNode:a);return new ll(b)};
481reactDom_production_min.findDOMNode=function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternals;if(void 0===b){if("function"===typeof a.render)throw Error(p$2(188));a=Object.keys(a).join(",");throw Error(p$2(268,a));}a=Zb(b);a=null===a?null:a.stateNode;return a};reactDom_production_min.flushSync=function(a){return Rk(a)};reactDom_production_min.hydrate=function(a,b,c){if(!ol(b))throw Error(p$2(200));return rl(null,a,b,true,c)}; 482reactDom_production_min.hydrateRoot=function(a,b,c){if(!nl(a))throw Error(p$2(405));var d=null!=c&&c.hydratedSources||null,e=false,f="",g=kl;null!==c&&void 0!==c&&(true===c.unstable_strictMode&&(e=true),void 0!==c.identifierPrefix&&(f=c.identifierPrefix),void 0!==c.onRecoverableError&&(g=c.onRecoverableError));b=el(b,null,a,1,null!=c?c:null,e,false,f,g);a[uf]=b.current;sf(a);if(d)for(a=0;a<d.length;a++)c=d[a],e=c._getVersion,e=e(c._source),null==b.mutableSourceEagerHydrationData?b.mutableSourceEagerHydrationData=[c,e]:b.mutableSourceEagerHydrationData.push(c, 483e);return new ml(b)};reactDom_production_min.render=function(a,b,c){if(!ol(b))throw Error(p$2(200));return rl(null,a,b,false,c)};reactDom_production_min.unmountComponentAtNode=function(a){if(!ol(a))throw Error(p$2(40));return a._reactRootContainer?(Rk(function(){rl(null,null,a,!1,function(){a._reactRootContainer=null;a[uf]=null;});}),true):false};reactDom_production_min.unstable_batchedUpdates=Qk; 484reactDom_production_min.unstable_renderSubtreeIntoContainer=function(a,b,c,d){if(!ol(c))throw Error(p$2(200));if(null==a||void 0===a._reactInternals)throw Error(p$2(38));return rl(a,b,c,false,d)};reactDom_production_min.version="18.3.1-next-f1338f8080-20240426"; 485 486function checkDCE() { 487 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") { 488 return; 489 } 490 try { 491 __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); 492 } catch (err) { 493 console.error(err); 494 } 495} 496{ 497 checkDCE(); 498 reactDom.exports = reactDom_production_min; 499} 500 501var reactDomExports = reactDom.exports; 502const ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports); 503 504const ReactDOM$1 = /*#__PURE__*/_mergeNamespaces({ 505 __proto__: null, 506 default: ReactDOM 507}, [reactDomExports]); 508 509var m$2 = reactDomExports; 510{ 511 client.createRoot = m$2.createRoot; 512 client.hydrateRoot = m$2.hydrateRoot; 513} 514 515/** 516 * @remix-run/router v1.18.0 517 * 518 * Copyright (c) Remix Software Inc. 519 * 520 * This source code is licensed under the MIT license found in the 521 * LICENSE.md file in the root directory of this source tree. 522 * 523 * @license MIT 524 */ 525function _extends$3() { 526 _extends$3 = Object.assign ? Object.assign.bind() : function (target) { 527 for (var i = 1; i < arguments.length; i++) { 528 var source = arguments[i]; 529 for (var key in source) { 530 if (Object.prototype.hasOwnProperty.call(source, key)) { 531 target[key] = source[key]; 532 } 533 } 534 } 535 return target; 536 }; 537 return _extends$3.apply(this, arguments); 538} 539 540//////////////////////////////////////////////////////////////////////////////// 541//#region Types and Constants 542//////////////////////////////////////////////////////////////////////////////// 543/** 544 * Actions represent the type of change to a location value. 545 */ 546var Action; 547(function (Action) { 548 /** 549 * A POP indicates a change to an arbitrary index in the history stack, such 550 * as a back or forward navigation. It does not describe the direction of the 551 * navigation, only that the current index changed. 552 * 553 * Note: This is the default action for newly created history objects. 554 */ 555 Action["Pop"] = "POP"; 556 /** 557 * A PUSH indicates a new entry being added to the history stack, such as when 558 * a link is clicked and a new page loads. When this happens, all subsequent 559 * entries in the stack are lost. 560 */ 561 Action["Push"] = "PUSH"; 562 /** 563 * A REPLACE indicates the entry at the current index in the history stack 564 * being replaced by a new one. 565 */ 566 Action["Replace"] = "REPLACE"; 567})(Action || (Action = {})); 568const PopStateEventType = "popstate"; 569/** 570 * Browser history stores the location in regular URLs. This is the standard for 571 * most web apps, but it requires some configuration on the server to ensure you 572 * serve the same app at multiple URLs. 573 * 574 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory 575 */ 576function createBrowserHistory(options) { 577 if (options === void 0) { 578 options = {}; 579 } 580 function createBrowserLocation(window, globalHistory) { 581 let { 582 pathname, 583 search, 584 hash 585 } = window.location; 586 return createLocation("", { 587 pathname, 588 search, 589 hash 590 }, 591 // state defaults to `null` because `window.history.state` does 592 globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default"); 593 } 594 function createBrowserHref(window, to) { 595 return typeof to === "string" ? to : createPath(to); 596 } 597 return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options); 598} 599function invariant$1(value, message) { 600 if (value === false || value === null || typeof value === "undefined") { 601 throw new Error(message); 602 } 603} 604function warning(cond, message) { 605 if (!cond) { 606 // eslint-disable-next-line no-console 607 if (typeof console !== "undefined") console.warn(message); 608 try { 609 // Welcome to debugging history! 610 // 611 // This error is thrown as a convenience, so you can more easily 612 // find the source for a warning that appears in the console by 613 // enabling "pause on exceptions" in your JavaScript debugger. 614 throw new Error(message); 615 // eslint-disable-next-line no-empty 616 } catch (e) {} 617 } 618} 619function createKey() { 620 return Math.random().toString(36).substr(2, 8); 621} 622/** 623 * For browser-based histories, we combine the state and key into an object 624 */ 625function getHistoryState(location, index) { 626 return { 627 usr: location.state, 628 key: location.key, 629 idx: index 630 }; 631} 632/** 633 * Creates a Location object with a unique key from the given Path 634 */ 635function createLocation(current, to, state, key) { 636 if (state === void 0) { 637 state = null; 638 } 639 let location = _extends$3({ 640 pathname: typeof current === "string" ? current : current.pathname, 641 search: "", 642 hash: "" 643 }, typeof to === "string" ? parsePath(to) : to, { 644 state, 645 // TODO: This could be cleaned up. push/replace should probably just take 646 // full Locations now and avoid the need to run through this flow at all 647 // But that's a pretty big refactor to the current test suite so going to 648 // keep as is for the time being and just let any incoming keys take precedence 649 key: to && to.key || key || createKey() 650 }); 651 return location; 652} 653/** 654 * Creates a string URL path from the given pathname, search, and hash components. 655 */ 656function createPath(_ref) { 657 let { 658 pathname = "/", 659 search = "", 660 hash = "" 661 } = _ref; 662 if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search; 663 if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash; 664 return pathname; 665} 666/** 667 * Parses a string URL path into its separate pathname, search, and hash components. 668 */ 669function parsePath(path) { 670 let parsedPath = {}; 671 if (path) { 672 let hashIndex = path.indexOf("#"); 673 if (hashIndex >= 0) { 674 parsedPath.hash = path.substr(hashIndex); 675 path = path.substr(0, hashIndex); 676 } 677 let searchIndex = path.indexOf("?"); 678 if (searchIndex >= 0) { 679 parsedPath.search = path.substr(searchIndex); 680 path = path.substr(0, searchIndex); 681 } 682 if (path) { 683 parsedPath.pathname = path; 684 } 685 } 686 return parsedPath; 687} 688function getUrlBasedHistory(getLocation, createHref, validateLocation, options) { 689 if (options === void 0) { 690 options = {}; 691 } 692 let { 693 window = document.defaultView, 694 v5Compat = false 695 }
vendor: 4,552 bytes, lines 695-836
695 = options; 696 let globalHistory = window.history; 697 let action = Action.Pop; 698 let listener = null; 699 let index = getIndex(); 700 // Index should only be null when we initialize. If not, it's because the 701 // user called history.pushState or history.replaceState directly, in which 702 // case we should log a warning as it will result in bugs. 703 if (index == null) { 704 index = 0; 705 globalHistory.replaceState(_extends$3({}, globalHistory.state, { 706 idx: index 707 }), ""); 708 } 709 function getIndex() { 710 let state = globalHistory.state || { 711 idx: null 712 }; 713 return state.idx; 714 } 715 function handlePop() { 716 action = Action.Pop; 717 let nextIndex = getIndex(); 718 let delta = nextIndex == null ? null : nextIndex - index; 719 index = nextIndex; 720 if (listener) { 721 listener({ 722 action, 723 location: history.location, 724 delta 725 }); 726 } 727 } 728 function push(to, state) { 729 action = Action.Push; 730 let location = createLocation(history.location, to, state); 731 index = getIndex() + 1; 732 let historyState = getHistoryState(location, index); 733 let url = history.createHref(location); 734 // try...catch because iOS limits us to 100 pushState calls :/ 735 try { 736 globalHistory.pushState(historyState, "", url); 737 } catch (error) { 738 // If the exception is because `state` can't be serialized, let that throw 739 // outwards just like a replace call would so the dev knows the cause 740 // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps 741 // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal 742 if (error instanceof DOMException && error.name === "DataCloneError") { 743 throw error; 744 } 745 // They are going to lose state here, but there is no real 746 // way to warn them about it since the page will refresh... 747 window.location.assign(url); 748 } 749 if (v5Compat && listener) { 750 listener({ 751 action, 752 location: history.location, 753 delta: 1 754 }); 755 } 756 } 757 function replace(to, state) { 758 action = Action.Replace; 759 let location = createLocation(history.location, to, state); 760 index = getIndex(); 761 let historyState = getHistoryState(location, index); 762 let url = history.createHref(location); 763 globalHistory.replaceState(historyState, "", url); 764 if (v5Compat && listener) { 765 listener({ 766 action, 767 location: history.location, 768 delta: 0 769 }); 770 } 771 } 772 function createURL(to) { 773 // window.location.origin is "null" (the literal string value) in Firefox 774 // under certain conditions, notably when serving from a local HTML file 775 // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297 776 let base = window.location.origin !== "null" ? window.location.origin : window.location.href; 777 let href = typeof to === "string" ? to : createPath(to); 778 // Treating this as a full URL will strip any trailing spaces so we need to 779 // pre-encode them since they might be part of a matching splat param from 780 // an ancestor route 781 href = href.replace(/ $/, "%20"); 782 invariant$1(base, "No window.location.(origin|href) available to create URL for href: " + href); 783 return new URL(href, base); 784 } 785 let history = { 786 get action() { 787 return action; 788 }, 789 get location() { 790 return getLocation(window, globalHistory); 791 }, 792 listen(fn) { 793 if (listener) { 794 throw new Error("A history only accepts one active listener"); 795 } 796 window.addEventListener(PopStateEventType, handlePop); 797 listener = fn; 798 return () => { 799 window.removeEventListener(PopStateEventType, handlePop); 800 listener = null; 801 }; 802 }, 803 createHref(to) { 804 return createHref(window, to); 805 }, 806 createURL, 807 encodeLocation(to) { 808 // Encode a Location the same way window.location would 809 let url = createURL(to); 810 return { 811 pathname: url.pathname, 812 search: url.search, 813 hash: url.hash 814 }; 815 }, 816 push, 817 replace, 818 go(n) { 819 return globalHistory.go(n); 820 } 821 }; 822 return history; 823} 824//#endregion 825 826var ResultType; 827(function (ResultType) { 828 ResultType["data"] = "data"; 829 ResultType["deferred"] = "deferred"; 830 ResultType["redirect"] = "redirect"; 831 ResultType["error"] = "error"; 832})(ResultType || (ResultType = {})); 833const immutableRouteKeys = new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]); 834function isIndexRoute(route) { 835 return route.index === true; 836}
vendor: 4,070 bytes, lines 837-943
837// Walk the route tree generating unique IDs where necessary, so we are working 838// solely with AgnosticDataRouteObject's within the Router 839function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) { 840 if (parentPath === void 0) { 841 parentPath = []; 842 } 843 if (manifest === void 0) { 844 manifest = {}; 845 } 846 return routes.map((route, index) => { 847 let treePath = [...parentPath, String(index)]; 848 let id = typeof route.id === "string" ? route.id : treePath.join("-"); 849 invariant$1(route.index !== true || !route.children, "Cannot specify children on an index route"); 850 invariant$1(!manifest[id], "Found a route id collision on id \"" + id + "\". Route " + "id's must be globally unique within Data Router usages"); 851 if (isIndexRoute(route)) { 852 let indexRoute = _extends$3({}, route, mapRouteProperties(route), { 853 id 854 }); 855 manifest[id] = indexRoute; 856 return indexRoute; 857 } else { 858 let pathOrLayoutRoute = _extends$3({}, route, mapRouteProperties(route), { 859 id, 860 children: undefined 861 }); 862 manifest[id] = pathOrLayoutRoute; 863 if (route.children) { 864 pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest); 865 } 866 return pathOrLayoutRoute; 867 } 868 }); 869} 870/** 871 * Matches the given routes to a location and returns the match data. 872 * 873 * @see https://reactrouter.com/utils/match-routes 874 */ 875function matchRoutes(routes, locationArg, basename) { 876 if (basename === void 0) { 877 basename = "/"; 878 } 879 return matchRoutesImpl(routes, locationArg, basename, false); 880} 881function matchRoutesImpl(routes, locationArg, basename, allowPartial) { 882 let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; 883 let pathname = stripBasename(location.pathname || "/", basename); 884 if (pathname == null) { 885 return null; 886 } 887 let branches = flattenRoutes(routes); 888 rankRouteBranches(branches); 889 let matches = null; 890 for (let i = 0; matches == null && i < branches.length; ++i) { 891 // Incoming pathnames are generally encoded from either window.location 892 // or from router.navigate, but we want to match against the unencoded 893 // paths in the route definitions. Memory router locations won't be 894 // encoded here but there also shouldn't be anything to decode so this 895 // should be a safe operation. This avoids needing matchRoutes to be 896 // history-aware. 897 let decoded = decodePath(pathname); 898 matches = matchRouteBranch(branches[i], decoded, allowPartial); 899 } 900 return matches; 901} 902function convertRouteMatchToUiMatch(match, loaderData) { 903 let { 904 route, 905 pathname, 906 params 907 } = match; 908 return { 909 id: route.id, 910 pathname, 911 params, 912 data: loaderData[route.id], 913 handle: route.handle 914 }; 915} 916function flattenRoutes(routes, branches, parentsMeta, parentPath) { 917 if (branches === void 0) { 918 branches = []; 919 } 920 if (parentsMeta === void 0) { 921 parentsMeta = []; 922 } 923 if (parentPath === void 0) { 924 parentPath = ""; 925 } 926 let flattenRoute = (route, index, relativePath) => { 927 let meta = { 928 relativePath: relativePath === undefined ? route.path || "" : relativePath, 929 caseSensitive: route.caseSensitive === true, 930 childrenIndex: index, 931 route 932 }; 933 if (meta.relativePath.startsWith("/")) { 934 invariant$1(meta.relativePath.startsWith(parentPath), "Absolute route path \"" + meta.relativePath + "\" nested under path " + ("\"" + parentPath + "\" is not valid. An absolute child route path ") + "must start with the combined path of all its parent routes."); 935 meta.relativePath = meta.relativePath.slice(parentPath.length); 936 } 937 let path = joinPaths([parentPath, meta.relativePath]); 938 let routesMeta = parentsMeta.concat(meta); 939 // Add the children before adding this route to the array, so we traverse the 940 // route tree depth-first and child routes appear before their parents in 941 // the "flattened" version. 942 if (route.children && route.children.length > 0) { 943 invariant$1
vendor: 5,832 bytes, lines 943-1096
943( 944 // Our types know better, but runtime JS may not! 945 // @ts-expect-error 946 route.index !== true, "Index routes must not have child routes. Please remove " + ("all child routes from route path \"" + path + "\".")); 947 flattenRoutes(route.children, branches, routesMeta, path); 948 } 949 // Routes without a path shouldn't ever match by themselves unless they are 950 // index routes, so don't add them to the list of possible branches. 951 if (route.path == null && !route.index) { 952 return; 953 } 954 branches.push({ 955 path, 956 score: computeScore(path, route.index), 957 routesMeta 958 }); 959 }; 960 routes.forEach((route, index) => { 961 var _route$path; 962 // coarse-grain check for optional params 963 if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) { 964 flattenRoute(route, index); 965 } else { 966 for (let exploded of explodeOptionalSegments(route.path)) { 967 flattenRoute(route, index, exploded); 968 } 969 } 970 }); 971 return branches; 972} 973/** 974 * Computes all combinations of optional path segments for a given path, 975 * excluding combinations that are ambiguous and of lower priority. 976 * 977 * For example, `/one/:two?/three/:four?/:five?` explodes to: 978 * - `/one/three` 979 * - `/one/:two/three` 980 * - `/one/three/:four` 981 * - `/one/three/:five` 982 * - `/one/:two/three/:four` 983 * - `/one/:two/three/:five` 984 * - `/one/three/:four/:five` 985 * - `/one/:two/three/:four/:five` 986 */ 987function explodeOptionalSegments(path) { 988 let segments = path.split("/"); 989 if (segments.length === 0) return []; 990 let [first, ...rest] = segments; 991 // Optional path segments are denoted by a trailing `?` 992 let isOptional = first.endsWith("?"); 993 // Compute the corresponding required segment: `foo?` -> `foo` 994 let required = first.replace(/\?$/, ""); 995 if (rest.length === 0) { 996 // Intepret empty string as omitting an optional segment 997 // `["one", "", "three"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three` 998 return isOptional ? [required, ""] : [required]; 999 } 1000 let restExploded = explodeOptionalSegments(rest.join("/")); 1001 let result = []; 1002 // All child paths with the prefix. Do this for all children before the 1003 // optional version for all children, so we get consistent ordering where the 1004 // parent optional aspect is preferred as required. Otherwise, we can get 1005 // child sections interspersed where deeper optional segments are higher than 1006 // parent optional segments, where for example, /:two would explode _earlier_ 1007 // then /:one. By always including the parent as required _for all children_ 1008 // first, we avoid this issue 1009 result.push(...restExploded.map(subpath => subpath === "" ? required : [required, subpath].join("/"))); 1010 // Then, if this is an optional value, add all child versions without 1011 if (isOptional) { 1012 result.push(...restExploded); 1013 } 1014 // for absolute paths, ensure `/` instead of empty segment 1015 return result.map(exploded => path.startsWith("/") && exploded === "" ? "/" : exploded); 1016} 1017function rankRouteBranches(branches) { 1018 branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first 1019 : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex))); 1020} 1021const paramRe = /^:[\w-]+$/; 1022const dynamicSegmentValue = 3; 1023const indexRouteValue = 2; 1024const emptySegmentValue = 1; 1025const staticSegmentValue = 10; 1026const splatPenalty = -2; 1027const isSplat = s => s === "*"; 1028function computeScore(path, index) { 1029 let segments = path.split("/"); 1030 let initialScore = segments.length; 1031 if (segments.some(isSplat)) { 1032 initialScore += splatPenalty; 1033 } 1034 if (index) { 1035 initialScore += indexRouteValue; 1036 } 1037 return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore); 1038} 1039function compareIndexes(a, b) { 1040 let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]); 1041 return siblings ? 1042 // If two routes are siblings, we should try to match the earlier sibling 1043 // first. This allows people to have fine-grained control over the matching 1044 // behavior by simply putting routes with identical paths in the order they 1045 // want them tried. 1046 a[a.length - 1] - b[b.length - 1] : 1047 // Otherwise, it doesn't really make sense to rank non-siblings by index, 1048 // so they sort equally. 1049 0; 1050} 1051function matchRouteBranch(branch, pathname, allowPartial) { 1052 if (allowPartial === void 0) { 1053 allowPartial = false; 1054 } 1055 let { 1056 routesMeta 1057 } = branch; 1058 let matchedParams = {}; 1059 let matchedPathname = "/"; 1060 let matches = []; 1061 for (let i = 0; i < routesMeta.length; ++i) { 1062 let meta = routesMeta[i]; 1063 let end = i === routesMeta.length - 1; 1064 let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/"; 1065 let match = matchPath({ 1066 path: meta.relativePath, 1067 caseSensitive: meta.caseSensitive, 1068 end 1069 }, remainingPathname); 1070 let route = meta.route; 1071 if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) { 1072 match = matchPath({ 1073 path: meta.relativePath, 1074 caseSensitive: meta.caseSensitive, 1075 end: false 1076 }, remainingPathname); 1077 } 1078 if (!match) { 1079 return null; 1080 } 1081 Object.assign(matchedParams, match.params); 1082 matches.push({ 1083 // TODO: Can this as be avoided? 1084 params: matchedParams, 1085 pathname: joinPaths([matchedPathname, match.pathname]), 1086 pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])), 1087 route 1088 }); 1089 if (match.pathnameBase !== "/") { 1090 matchedPathname = joinPaths([matchedPathname, match.pathnameBase]); 1091 } 1092 } 1093 return matches; 1094} 1095/** 1096 *
vendor: 15,587 bytes, lines 1096-1484
1096Performs pattern matching on a URL pathname and returns information about 1097 * the match. 1098 * 1099 * @see https://reactrouter.com/utils/match-path 1100 */ 1101function matchPath(pattern, pathname) { 1102 if (typeof pattern === "string") { 1103 pattern = { 1104 path: pattern, 1105 caseSensitive: false, 1106 end: true 1107 }; 1108 } 1109 let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end); 1110 let match = pathname.match(matcher); 1111 if (!match) return null; 1112 let matchedPathname = match[0]; 1113 let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1"); 1114 let captureGroups = match.slice(1); 1115 let params = compiledParams.reduce((memo, _ref, index) => { 1116 let { 1117 paramName, 1118 isOptional 1119 } = _ref; 1120 // We need to compute the pathnameBase here using the raw splat value 1121 // instead of using params["*"] later because it will be decoded then 1122 if (paramName === "*") { 1123 let splatValue = captureGroups[index] || ""; 1124 pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); 1125 } 1126 const value = captureGroups[index]; 1127 if (isOptional && !value) { 1128 memo[paramName] = undefined; 1129 } else { 1130 memo[paramName] = (value || "").replace(/%2F/g, "/"); 1131 } 1132 return memo; 1133 }, {}); 1134 return { 1135 params, 1136 pathname: matchedPathname, 1137 pathnameBase, 1138 pattern 1139 }; 1140} 1141function compilePath(path, caseSensitive, end) { 1142 if (caseSensitive === void 0) { 1143 caseSensitive = false; 1144 } 1145 if (end === void 0) { 1146 end = true; 1147 } 1148 warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), "Route path \"" + path + "\" will be treated as if it were " + ("\"" + path.replace(/\*$/, "/*") + "\" because the `*` character must ") + "always follow a `/` in the pattern. To get rid of this warning, " + ("please change the route path to \"" + path.replace(/\*$/, "/*") + "\".")); 1149 let params = []; 1150 let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below 1151 .replace(/^\/*/, "/") // Make sure it has a leading / 1152 .replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars 1153 .replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => { 1154 params.push({ 1155 paramName, 1156 isOptional: isOptional != null 1157 }); 1158 return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)"; 1159 }); 1160 if (path.endsWith("*")) { 1161 params.push({ 1162 paramName: "*" 1163 }); 1164 regexpSource += path === "*" || path === "/*" ? "(.*)$" // Already matched the initial /, just match the rest 1165 : "(?:\\/(.+)|\\/*)$"; // Don't include the / in params["*"] 1166 } else if (end) { 1167 // When matching to the end, ignore trailing slashes 1168 regexpSource += "\\/*$"; 1169 } else if (path !== "" && path !== "/") { 1170 // If our path is non-empty and contains anything beyond an initial slash, 1171 // then we have _some_ form of path in our regex, so we should expect to 1172 // match only if we find the end of this path segment. Look for an optional 1173 // non-captured trailing slash (to match a portion of the URL) or the end 1174 // of the path (if we've matched to the end). We used to do this with a 1175 // word boundary but that gives false positives on routes like 1176 // /user-preferences since `-` counts as a word boundary. 1177 regexpSource += "(?:(?=\\/|$))"; 1178 } else ; 1179 let matcher = new RegExp(regexpSource, caseSensitive ? undefined : "i"); 1180 return [matcher, params]; 1181} 1182function decodePath(value) { 1183 try { 1184 return value.split("/").map(v => decodeURIComponent(v).replace(/\//g, "%2F")).join("/"); 1185 } catch (error) { 1186 warning(false, "The URL path \"" + value + "\" could not be decoded because it is is a " + "malformed URL segment. This is probably due to a bad percent " + ("encoding (" + error + ").")); 1187 return value; 1188 } 1189} 1190/** 1191 * @private 1192 */ 1193function stripBasename(pathname, basename) { 1194 if (basename === "/") return pathname; 1195 if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) { 1196 return null; 1197 } 1198 // We want to leave trailing slash behavior in the user's control, so if they 1199 // specify a basename with a trailing slash, we should support it 1200 let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length; 1201 let nextChar = pathname.charAt(startIndex); 1202 if (nextChar && nextChar !== "/") { 1203 // pathname does not start with basename/ 1204 return null; 1205 } 1206 return pathname.slice(startIndex) || "/"; 1207} 1208/** 1209 * Returns a resolved path object relative to the given pathname. 1210 * 1211 * @see https://reactrouter.com/utils/resolve-path 1212 */ 1213function resolvePath(to, fromPathname) { 1214 if (fromPathname === void 0) { 1215 fromPathname = "/"; 1216 } 1217 let { 1218 pathname: toPathname, 1219 search = "", 1220 hash = "" 1221 } = typeof to === "string" ? parsePath(to) : to; 1222 let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname; 1223 return { 1224 pathname, 1225 search: normalizeSearch(search), 1226 hash: normalizeHash(hash) 1227 }; 1228} 1229function resolvePathname(relativePath, fromPathname) { 1230 let segments = fromPathname.replace(/\/+$/, "").split("/"); 1231 let relativeSegments = relativePath.split("/"); 1232 relativeSegments.forEach(segment => { 1233 if (segment === "..") { 1234 // Keep the root "" segment so the pathname starts at / 1235 if (segments.length > 1) segments.pop(); 1236 } else if (segment !== ".") { 1237 segments.push(segment); 1238 } 1239 }); 1240 return segments.length > 1 ? segments.join("/") : "/"; 1241} 1242function getInvalidPathError(char, field, dest, path) { 1243 return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + "a string in <Link to=\"...\"> and the router will parse it for you."; 1244} 1245/** 1246 * @private 1247 * 1248 * When processing relative navigation we want to ignore ancestor routes that 1249 * do not contribute to the path, such that index/pathless layout routes don't 1250 * interfere. 1251 * 1252 * For example, when moving a route element into an index route and/or a 1253 * pathless layout route, relative link behavior contained within should stay 1254 * the same. Both of the following examples should link back to the root: 1255 * 1256 * <Route path="/"> 1257 * <Route path="accounts" element={<Link to=".."}> 1258 * </Route> 1259 * 1260 * <Route path="/"> 1261 * <Route path="accounts"> 1262 * <Route element={<AccountsLayout />}> // <-- Does not contribute 1263 * <Route index element={<Link to=".."} /> // <-- Does not contribute 1264 * </Route 1265 * </Route> 1266 * </Route> 1267 */ 1268function getPathContributingMatches(matches) { 1269 return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0); 1270} 1271// Return the array of pathnames for the current route matches - used to 1272// generate the routePathnames input for resolveTo() 1273function getResolveToMatches(matches, v7_relativeSplatPath) { 1274 let pathMatches = getPathContributingMatches(matches); 1275 // When v7_relativeSplatPath is enabled, use the full pathname for the leaf 1276 // match so we include splat values for "." links. See: 1277 // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329 1278 if (v7_relativeSplatPath) { 1279 return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase); 1280 } 1281 return pathMatches.map(match => match.pathnameBase); 1282} 1283/** 1284 * @private 1285 */ 1286function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) { 1287 if (isPathRelative === void 0) { 1288 isPathRelative = false; 1289 } 1290 let to; 1291 if (typeof toArg === "string") { 1292 to = parsePath(toArg); 1293 } else { 1294 to = _extends$3({}, toArg); 1295 invariant$1(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to)); 1296 invariant$1(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to)); 1297 invariant$1(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to)); 1298 } 1299 let isEmptyPath = toArg === "" || to.pathname === ""; 1300 let toPathname = isEmptyPath ? "/" : to.pathname; 1301 let from; 1302 // Routing is relative to the current pathname if explicitly requested. 1303 // 1304 // If a pathname is explicitly provided in `to`, it should be relative to the 1305 // route context. This is explained in `Note on `<Link to>` values` in our 1306 // migration guide from v5 as a means of disambiguation between `to` values 1307 // that begin with `/` and those that do not. However, this is problematic for 1308 // `to` values that do not provide a pathname. `to` can simply be a search or 1309 // hash string, in which case we should assume that the navigation is relative 1310 // to the current location's pathname and *not* the route pathname. 1311 if (toPathname == null) { 1312 from = locationPathname; 1313 } else { 1314 let routePathnameIndex = routePathnames.length - 1; 1315 // With relative="route" (the default), each leading .. segment means 1316 // "go up one route" instead of "go up one URL segment". This is a key 1317 // difference from how <a href> works and a major reason we call this a 1318 // "to" value instead of a "href". 1319 if (!isPathRelative && toPathname.startsWith("..")) { 1320 let toSegments = toPathname.split("/"); 1321 while (toSegments[0] === "..") { 1322 toSegments.shift(); 1323 routePathnameIndex -= 1; 1324 } 1325 to.pathname = toSegments.join("/"); 1326 } 1327 from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/"; 1328 } 1329 let path = resolvePath(to, from); 1330 // Ensure the pathname has a trailing slash if the original "to" had one 1331 let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/"); 1332 // Or if this was a link to the current path which has a trailing slash 1333 let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/"); 1334 if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) { 1335 path.pathname += "/"; 1336 } 1337 return path; 1338} 1339/** 1340 * @private 1341 */ 1342const joinPaths = paths => paths.join("/").replace(/\/\/+/g, "/"); 1343/** 1344 * @private 1345 */ 1346const normalizePathname = pathname => pathname.replace(/\/+$/, "").replace(/^\/*/, "/"); 1347/** 1348 * @private 1349 */ 1350const normalizeSearch = search => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search; 1351/** 1352 * @private 1353 */ 1354const normalizeHash = hash => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash; 1355/** 1356 * @private 1357 * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies 1358 * 1359 * We don't export the class for public use since it's an implementation 1360 * detail, but we export the interface above so folks can build their own 1361 * abstractions around instances via isRouteErrorResponse() 1362 */ 1363class ErrorResponseImpl { 1364 constructor(status, statusText, data, internal) { 1365 if (internal === void 0) { 1366 internal = false; 1367 } 1368 this.status = status; 1369 this.statusText = statusText || ""; 1370 this.internal = internal; 1371 if (data instanceof Error) { 1372 this.data = data.toString(); 1373 this.error = data; 1374 } else { 1375 this.data = data; 1376 } 1377 } 1378} 1379/** 1380 * Check if the given error is an ErrorResponse generated from a 4xx/5xx 1381 * Response thrown from an action/loader 1382 */ 1383function isRouteErrorResponse(error) { 1384 return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error; 1385} 1386 1387const validMutationMethodsArr = ["post", "put", "patch", "delete"]; 1388const validMutationMethods = new Set(validMutationMethodsArr); 1389const validRequestMethodsArr = ["get", ...validMutationMethodsArr]; 1390const validRequestMethods = new Set(validRequestMethodsArr); 1391const redirectStatusCodes = new Set([301, 302, 303, 307, 308]); 1392const redirectPreserveMethodStatusCodes = new Set([307, 308]); 1393const IDLE_NAVIGATION = { 1394 state: "idle", 1395 location: undefined, 1396 formMethod: undefined, 1397 formAction: undefined, 1398 formEncType: undefined, 1399 formData: undefined, 1400 json: undefined, 1401 text: undefined 1402}; 1403const IDLE_FETCHER = { 1404 state: "idle", 1405 data: undefined, 1406 formMethod: undefined, 1407 formAction: undefined, 1408 formEncType: undefined, 1409 formData: undefined, 1410 json: undefined, 1411 text: undefined 1412}; 1413const IDLE_BLOCKER = { 1414 state: "unblocked", 1415 proceed: undefined, 1416 reset: undefined, 1417 location: undefined 1418}; 1419const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; 1420const defaultMapRouteProperties = route => ({ 1421 hasErrorBoundary: Boolean(route.hasErrorBoundary) 1422}); 1423const TRANSITIONS_STORAGE_KEY = "remix-router-transitions"; 1424//#endregion 1425//////////////////////////////////////////////////////////////////////////////// 1426//#region createRouter 1427//////////////////////////////////////////////////////////////////////////////// 1428/** 1429 * Create a router and listen to history POP navigations 1430 */ 1431function createRouter(init) { 1432 const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : undefined; 1433 const isBrowser = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined"; 1434 const isServer = !isBrowser; 1435 invariant$1(init.routes.length > 0, "You must provide a non-empty routes array to createRouter"); 1436 let mapRouteProperties; 1437 if (init.mapRouteProperties) { 1438 mapRouteProperties = init.mapRouteProperties; 1439 } else if (init.detectErrorBoundary) { 1440 // If they are still using the deprecated version, wrap it with the new API 1441 let detectErrorBoundary = init.detectErrorBoundary; 1442 mapRouteProperties = route => ({ 1443 hasErrorBoundary: detectErrorBoundary(route) 1444 }); 1445 } else { 1446 mapRouteProperties = defaultMapRouteProperties; 1447 } 1448 // Routes keyed by ID 1449 let manifest = {}; 1450 // Routes in tree format for matching 1451 let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest); 1452 let inFlightDataRoutes; 1453 let basename = init.basename || "/"; 1454 let dataStrategyImpl = init.unstable_dataStrategy || defaultDataStrategy; 1455 let patchRoutesOnMissImpl = init.unstable_patchRoutesOnMiss; 1456 // Config driven behavior flags 1457 let future = _extends$3({ 1458 v7_fetcherPersist: false, 1459 v7_normalizeFormMethod: false, 1460 v7_partialHydration: false, 1461 v7_prependBasename: false, 1462 v7_relativeSplatPath: false, 1463 v7_skipActionErrorRevalidation: false 1464 }, init.future); 1465 // Cleanup function for history 1466 let unlistenHistory = null; 1467 // Externally-provided functions to call on all state changes 1468 let subscribers = new Set(); 1469 // Externally-provided object to hold scroll restoration locations during routing 1470 let savedScrollPositions = null; 1471 // Externally-provided function to get scroll restoration keys 1472 let getScrollRestorationKey = null; 1473 // Externally-provided function to get current scroll position 1474 let getScrollPosition = null; 1475 // One-time flag to control the initial hydration scroll restoration. Because 1476 // we don't get the saved positions from <ScrollRestoration /> until _after_ 1477 // the initial render, we need to manually trigger a separate updateState to 1478 // send along the restoreScrollPosition 1479 // Set to true if we have `hydrationData` since we assume we were SSR'd and that 1480 // SSR did the initial scroll restoration. 1481 let initialScrollRestored = init.hydrationData != null; 1482 let initialMatches = matchRoutes(dataRoutes, init.history.location, basename); 1483 let initialErrors = null; 1484 if (initialMatches == null && !patchRoutesOnMissImpl) {
1485 // If we do not match a user-provided-route, fall back to the root 1486 // to allow the error boundary to take over 1487 let error = getInternalRouterError(404, { 1488 pathname: init.history.location.pathname 1489 }); 1490 let { 1491 matches, 1492 route 1493 } = getShortCircuitMatches(dataRoutes); 1494 initialMatches = matches; 1495 initialErrors = { 1496 [route.id]: error 1497 }; 1498 } 1499 // In SPA apps, if the user provided a patchRoutesOnMiss implementation and 1500 // our initial match is a splat route, clear them out so we run through lazy 1501 // discovery on hydration in case there's a more accurate lazy route match. 1502 // In SSR apps (with `hydrationData`), we expect that the server will send 1503 // up the proper matched routes so we don't want to run lazy discovery on 1504 // initial hydration and want to hydrate into the splat route. 1505 if (initialMatches && patchRoutesOnMissImpl && !init.hydrationData) { 1506 let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname); 1507 if (fogOfWar.active) { 1508 initialMatches = null; 1509 } 1510 } 1511 let initialized; 1512 if (!initialMatches) { 1513 // We need to run patchRoutesOnMiss in initialize() 1514 initialized = false; 1515 initialMatches = []; 1516 } else if (initialMatches.some(m => m.route.lazy)) { 1517 // All initialMatches need to be loaded before we're ready. If we have lazy 1518 // functions around still then we'll need to run them in initialize() 1519 initialized = false; 1520 } else if (!initialMatches.some(m => m.route.loader)) { 1521 // If we've got no loaders to run, then we're good to go 1522 initialized = true; 1523 } else if (future.v7_partialHydration) { 1524 // If partial hydration is enabled, we're initialized so long as we were 1525 // provided with hydrationData for every route with a loader, and no loaders 1526 // were marked for explicit hydration 1527 let loaderData = init.hydrationData ? init.hydrationData.loaderData : null; 1528 let errors = init.hydrationData ? init.hydrationData.errors : null; 1529 let isRouteInitialized = m => { 1530 // No loader, nothing to initialize 1531 if (!m.route.loader) { 1532 return true; 1533 } 1534 // Explicitly opting-in to running on hydration 1535 if (typeof m.route.loader === "function" && m.route.loader.hydrate === true) { 1536 return false; 1537 } 1538 // Otherwise, initialized if hydrated with data or an error 1539 return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined; 1540 }; 1541 // If errors exist, don't consider routes below the boundary 1542 if (errors) { 1543 let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined); 1544 initialized = initialMatches.slice(0, idx + 1).every(isRouteInitialized); 1545 } else { 1546 initialized = initialMatches.every(isRouteInitialized); 1547 } 1548 } else { 1549 // Without partial hydration - we're initialized if we were provided any 1550 // hydrationData - which is expected to be complete 1551 initialized = init.hydrationData != null; 1552 } 1553 let router; 1554 let state = { 1555 historyAction: init.history.action, 1556 location: init.history.location, 1557 matches: initialMatches, 1558 initialized, 1559 navigation: IDLE_NAVIGATION, 1560 // Don't restore on initial updateState() if we were SSR'd 1561 restoreScrollPosition: init.hydrationData != null ? false : null, 1562 preventScrollReset: false, 1563 revalidation: "idle", 1564 loaderData: init.hydrationData && init.hydrationData.loaderData || {}, 1565 actionData: init.hydrationData && init.hydrationData.actionData || null, 1566 errors: init.hydrationData && init.hydrationData.errors || initialErrors, 1567 fetchers: new Map(), 1568 blockers: new Map() 1569 }; 1570 // -- Stateful internal variables to manage navigations -- 1571 // Current navigation in progress (to be committed in completeNavigation) 1572 let pendingAction = Action.Pop; 1573 // Should the current navigation prevent the scroll reset if scroll cannot 1574 // be restored? 1575 let pendingPreventScrollReset = false; 1576 // AbortController for the active navigation 1577 let pendingNavigationController; 1578 // Should the current navigation enable document.startViewTransition? 1579 let pendingViewTransitionEnabled = false;
vendor: 32,139 bytes, lines 1580-2321
1580 // Store applied view transitions so we can apply them on POP 1581 let appliedViewTransitions = new Map(); 1582 // Cleanup function for persisting applied transitions to sessionStorage 1583 let removePageHideEventListener = null; 1584 // We use this to avoid touching history in completeNavigation if a 1585 // revalidation is entirely uninterrupted 1586 let isUninterruptedRevalidation = false; 1587 // Use this internal flag to force revalidation of all loaders: 1588 // - submissions (completed or interrupted) 1589 // - useRevalidator() 1590 // - X-Remix-Revalidate (from redirect) 1591 let isRevalidationRequired = false; 1592 // Use this internal array to capture routes that require revalidation due 1593 // to a cancelled deferred on action submission 1594 let cancelledDeferredRoutes = []; 1595 // Use this internal array to capture fetcher loads that were cancelled by an 1596 // action navigation and require revalidation 1597 let cancelledFetcherLoads = []; 1598 // AbortControllers for any in-flight fetchers 1599 let fetchControllers = new Map(); 1600 // Track loads based on the order in which they started 1601 let incrementingLoadId = 0; 1602 // Track the outstanding pending navigation data load to be compared against 1603 // the globally incrementing load when a fetcher load lands after a completed 1604 // navigation 1605 let pendingNavigationLoadId = -1; 1606 // Fetchers that triggered data reloads as a result of their actions 1607 let fetchReloadIds = new Map(); 1608 // Fetchers that triggered redirect navigations 1609 let fetchRedirectIds = new Set(); 1610 // Most recent href/match for fetcher.load calls for fetchers 1611 let fetchLoadMatches = new Map(); 1612 // Ref-count mounted fetchers so we know when it's ok to clean them up 1613 let activeFetchers = new Map(); 1614 // Fetchers that have requested a delete when using v7_fetcherPersist, 1615 // they'll be officially removed after they return to idle 1616 let deletedFetchers = new Set(); 1617 // Store DeferredData instances for active route matches. When a 1618 // route loader returns defer() we stick one in here. Then, when a nested 1619 // promise resolves we update loaderData. If a new navigation starts we 1620 // cancel active deferreds for eliminated routes. 1621 let activeDeferreds = new Map(); 1622 // Store blocker functions in a separate Map outside of router state since 1623 // we don't need to update UI state if they change 1624 let blockerFunctions = new Map(); 1625 // Map of pending patchRoutesOnMiss() promises (keyed by path/matches) so 1626 // that we only kick them off once for a given combo 1627 let pendingPatchRoutes = new Map(); 1628 // Flag to ignore the next history update, so we can revert the URL change on 1629 // a POP navigation that was blocked by the user without touching router state 1630 let ignoreNextHistoryUpdate = false; 1631 // Initialize the router, all side effects should be kicked off from here. 1632 // Implemented as a Fluent API for ease of: 1633 // let router = createRouter(init).initialize(); 1634 function initialize() { 1635 // If history informs us of a POP navigation, start the navigation but do not update 1636 // state. We'll update our own state once the navigation completes 1637 unlistenHistory = init.history.listen(_ref => { 1638 let { 1639 action: historyAction, 1640 location, 1641 delta 1642 } = _ref; 1643 // Ignore this event if it was just us resetting the URL from a 1644 // blocked POP navigation 1645 if (ignoreNextHistoryUpdate) { 1646 ignoreNextHistoryUpdate = false; 1647 return; 1648 } 1649 warning(blockerFunctions.size === 0 || delta != null, "You are trying to use a blocker on a POP navigation to a location " + "that was not created by @remix-run/router. This will fail silently in " + "production. This can happen if you are navigating outside the router " + "via `window.history.pushState`/`window.location.hash` instead of using " + "router navigation APIs. This can also happen if you are using " + "createHashRouter and the user manually changes the URL."); 1650 let blockerKey = shouldBlockNavigation({ 1651 currentLocation: state.location, 1652 nextLocation: location, 1653 historyAction 1654 }); 1655 if (blockerKey && delta != null) { 1656 // Restore the URL to match the current UI, but don't update router state 1657 ignoreNextHistoryUpdate = true; 1658 init.history.go(delta * -1); 1659 // Put the blocker into a blocked state 1660 updateBlocker(blockerKey, { 1661 state: "blocked", 1662 location, 1663 proceed() { 1664 updateBlocker(blockerKey, { 1665 state: "proceeding", 1666 proceed: undefined, 1667 reset: undefined, 1668 location 1669 }); 1670 // Re-do the same POP navigation we just blocked 1671 init.history.go(delta); 1672 }, 1673 reset() { 1674 let blockers = new Map(state.blockers); 1675 blockers.set(blockerKey, IDLE_BLOCKER); 1676 updateState({ 1677 blockers 1678 }); 1679 } 1680 }); 1681 return; 1682 } 1683 return startNavigation(historyAction, location); 1684 }); 1685 if (isBrowser) { 1686 // FIXME: This feels gross. How can we cleanup the lines between 1687 // scrollRestoration/appliedTransitions persistance? 1688 restoreAppliedTransitions(routerWindow, appliedViewTransitions); 1689 let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions); 1690 routerWindow.addEventListener("pagehide", _saveAppliedTransitions); 1691 removePageHideEventListener = () => routerWindow.removeEventListener("pagehide", _saveAppliedTransitions); 1692 } 1693 // Kick off initial data load if needed. Use Pop to avoid modifying history 1694 // Note we don't do any handling of lazy here. For SPA's it'll get handled 1695 // in the normal navigation flow. For SSR it's expected that lazy modules are 1696 // resolved prior to router creation since we can't go into a fallbackElement 1697 // UI for SSR'd apps 1698 if (!state.initialized) { 1699 startNavigation(Action.Pop, state.location, { 1700 initialHydration: true 1701 }); 1702 } 1703 return router; 1704 } 1705 // Clean up a router and it's side effects 1706 function dispose() { 1707 if (unlistenHistory) { 1708 unlistenHistory(); 1709 } 1710 if (removePageHideEventListener) { 1711 removePageHideEventListener(); 1712 } 1713 subscribers.clear(); 1714 pendingNavigationController && pendingNavigationController.abort(); 1715 state.fetchers.forEach((_, key) => deleteFetcher(key)); 1716 state.blockers.forEach((_, key) => deleteBlocker(key)); 1717 } 1718 // Subscribe to state updates for the router 1719 function subscribe(fn) { 1720 subscribers.add(fn); 1721 return () => subscribers.delete(fn); 1722 } 1723 // Update our state and notify the calling context of the change 1724 function updateState(newState, opts) { 1725 if (opts === void 0) { 1726 opts = {}; 1727 } 1728 state = _extends$3({}, state, newState); 1729 // Prep fetcher cleanup so we can tell the UI which fetcher data entries 1730 // can be removed 1731 let completedFetchers = []; 1732 let deletedFetchersKeys = []; 1733 if (future.v7_fetcherPersist) { 1734 state.fetchers.forEach((fetcher, key) => { 1735 if (fetcher.state === "idle") { 1736 if (deletedFetchers.has(key)) { 1737 // Unmounted from the UI and can be totally removed 1738 deletedFetchersKeys.push(key); 1739 } else { 1740 // Returned to idle but still mounted in the UI, so semi-remains for 1741 // revalidations and such 1742 completedFetchers.push(key); 1743 } 1744 } 1745 }); 1746 } 1747 // Iterate over a local copy so that if flushSync is used and we end up 1748 // removing and adding a new subscriber due to the useCallback dependencies, 1749 // we don't get ourselves into a loop calling the new subscriber immediately 1750 [...subscribers].forEach(subscriber => subscriber(state, { 1751 deletedFetchers: deletedFetchersKeys, 1752 unstable_viewTransitionOpts: opts.viewTransitionOpts, 1753 unstable_flushSync: opts.flushSync === true 1754 })); 1755 // Remove idle fetchers from state since we only care about in-flight fetchers. 1756 if (future.v7_fetcherPersist) { 1757 completedFetchers.forEach(key => state.fetchers.delete(key)); 1758 deletedFetchersKeys.forEach(key => deleteFetcher(key)); 1759 } 1760 } 1761 // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION 1762 // and setting state.[historyAction/location/matches] to the new route. 1763 // - Location is a required param 1764 // - Navigation will always be set to IDLE_NAVIGATION 1765 // - Can pass any other state in newState 1766 function completeNavigation(location, newState, _temp) { 1767 var _location$state, _location$state2; 1768 let { 1769 flushSync 1770 } = _temp === void 0 ? {} : _temp; 1771 // Deduce if we're in a loading/actionReload state: 1772 // - We have committed actionData in the store 1773 // - The current navigation was a mutation submission 1774 // - We're past the submitting state and into the loading state 1775 // - The location being loaded is not the result of a redirect 1776 let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true; 1777 let actionData; 1778 if (newState.actionData) { 1779 if (Object.keys(newState.actionData).length > 0) { 1780 actionData = newState.actionData; 1781 } else { 1782 // Empty actionData -> clear prior actionData due to an action error 1783 actionData = null; 1784 } 1785 } else if (isActionReload) { 1786 // Keep the current data if we're wrapping up the action reload 1787 actionData = state.actionData; 1788 } else { 1789 // Clear actionData on any other completed navigations 1790 actionData = null; 1791 } 1792 // Always preserve any existing loaderData from re-used routes 1793 let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData; 1794 // On a successful navigation we can assume we got through all blockers 1795 // so we can start fresh 1796 let blockers = state.blockers; 1797 if (blockers.size > 0) { 1798 blockers = new Map(blockers); 1799 blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER)); 1800 } 1801 // Always respect the user flag. Otherwise don't reset on mutation 1802 // submission navigations unless they redirect 1803 let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true; 1804 // Commit any in-flight routes at the end of the HMR revalidation "navigation" 1805 if (inFlightDataRoutes) { 1806 dataRoutes = inFlightDataRoutes; 1807 inFlightDataRoutes = undefined; 1808 } 1809 if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) { 1810 init.history.push(location, location.state); 1811 } else if (pendingAction === Action.Replace) { 1812 init.history.replace(location, location.state); 1813 } 1814 let viewTransitionOpts; 1815 // On POP, enable transitions if they were enabled on the original navigation 1816 if (pendingAction === Action.Pop) { 1817 // Forward takes precedence so they behave like the original navigation 1818 let priorPaths = appliedViewTransitions.get(state.location.pathname); 1819 if (priorPaths && priorPaths.has(location.pathname)) { 1820 viewTransitionOpts = { 1821 currentLocation: state.location, 1822 nextLocation: location 1823 }; 1824 } else if (appliedViewTransitions.has(location.pathname)) { 1825 // If we don't have a previous forward nav, assume we're popping back to 1826 // the new location and enable if that location previously enabled 1827 viewTransitionOpts = { 1828 currentLocation: location, 1829 nextLocation: state.location 1830 }; 1831 } 1832 } else if (pendingViewTransitionEnabled) { 1833 // Store the applied transition on PUSH/REPLACE 1834 let toPaths = appliedViewTransitions.get(state.location.pathname); 1835 if (toPaths) { 1836 toPaths.add(location.pathname); 1837 } else { 1838 toPaths = new Set([location.pathname]); 1839 appliedViewTransitions.set(state.location.pathname, toPaths); 1840 } 1841 viewTransitionOpts = { 1842 currentLocation: state.location, 1843 nextLocation: location 1844 }; 1845 } 1846 updateState(_extends$3({}, newState, { 1847 actionData, 1848 loaderData, 1849 historyAction: pendingAction, 1850 location, 1851 initialized: true, 1852 navigation: IDLE_NAVIGATION, 1853 revalidation: "idle", 1854 restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches), 1855 preventScrollReset, 1856 blockers 1857 }), { 1858 viewTransitionOpts, 1859 flushSync: flushSync === true 1860 }); 1861 // Reset stateful navigation vars 1862 pendingAction = Action.Pop; 1863 pendingPreventScrollReset = false; 1864 pendingViewTransitionEnabled = false; 1865 isUninterruptedRevalidation = false; 1866 isRevalidationRequired = false; 1867 cancelledDeferredRoutes = []; 1868 cancelledFetcherLoads = []; 1869 } 1870 // Trigger a navigation event, which can either be a numerical POP or a PUSH 1871 // replace with an optional submission 1872 async function navigate(to, opts) { 1873 if (typeof to === "number") { 1874 init.history.go(to); 1875 return; 1876 } 1877 let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative); 1878 let { 1879 path, 1880 submission, 1881 error 1882 } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts); 1883 let currentLocation = state.location; 1884 let nextLocation = createLocation(state.location, path, opts && opts.state); 1885 // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded 1886 // URL from window.location, so we need to encode it here so the behavior 1887 // remains the same as POP and non-data-router usages. new URL() does all 1888 // the same encoding we'd get from a history.pushState/window.location read 1889 // without having to touch history 1890 nextLocation = _extends$3({}, nextLocation, init.history.encodeLocation(nextLocation)); 1891 let userReplace = opts && opts.replace != null ? opts.replace : undefined; 1892 let historyAction = Action.Push; 1893 if (userReplace === true) { 1894 historyAction = Action.Replace; 1895 } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) { 1896 // By default on submissions to the current location we REPLACE so that 1897 // users don't have to double-click the back button to get to the prior 1898 // location. If the user redirects to a different location from the 1899 // action/loader this will be ignored and the redirect will be a PUSH 1900 historyAction = Action.Replace; 1901 } 1902 let preventScrollReset = opts && "preventScrollReset" in opts ? opts.preventScrollReset === true : undefined; 1903 let flushSync = (opts && opts.unstable_flushSync) === true; 1904 let blockerKey = shouldBlockNavigation({ 1905 currentLocation, 1906 nextLocation, 1907 historyAction 1908 }); 1909 if (blockerKey) { 1910 // Put the blocker into a blocked state 1911 updateBlocker(blockerKey, { 1912 state: "blocked", 1913 location: nextLocation, 1914 proceed() { 1915 updateBlocker(blockerKey, { 1916 state: "proceeding", 1917 proceed: undefined, 1918 reset: undefined, 1919 location: nextLocation 1920 }); 1921 // Send the same navigation through 1922 navigate(to, opts); 1923 }, 1924 reset() { 1925 let blockers = new Map(state.blockers); 1926 blockers.set(blockerKey, IDLE_BLOCKER); 1927 updateState({ 1928 blockers 1929 }); 1930 } 1931 }); 1932 return; 1933 } 1934 return await startNavigation(historyAction, nextLocation, { 1935 submission, 1936 // Send through the formData serialization error if we have one so we can 1937 // render at the right error boundary after we match routes 1938 pendingError: error, 1939 preventScrollReset, 1940 replace: opts && opts.replace, 1941 enableViewTransition: opts && opts.unstable_viewTransition, 1942 flushSync 1943 }); 1944 } 1945 // Revalidate all current loaders. If a navigation is in progress or if this 1946 // is interrupted by a navigation, allow this to "succeed" by calling all 1947 // loaders during the next loader round 1948 function revalidate() { 1949 interruptActiveLoads(); 1950 updateState({ 1951 revalidation: "loading" 1952 }); 1953 // If we're currently submitting an action, we don't need to start a new 1954 // navigation, we'll just let the follow up loader execution call all loaders 1955 if (state.navigation.state === "submitting") { 1956 return; 1957 } 1958 // If we're currently in an idle state, start a new navigation for the current 1959 // action/location and mark it as uninterrupted, which will skip the history 1960 // update in completeNavigation 1961 if (state.navigation.state === "idle") { 1962 startNavigation(state.historyAction, state.location, { 1963 startUninterruptedRevalidation: true 1964 }); 1965 return; 1966 } 1967 // Otherwise, if we're currently in a loading state, just start a new 1968 // navigation to the navigation.location but do not trigger an uninterrupted 1969 // revalidation so that history correctly updates once the navigation completes 1970 startNavigation(pendingAction || state.historyAction, state.navigation.location, { 1971 overrideNavigation: state.navigation 1972 }); 1973 } 1974 // Start a navigation to the given action/location. Can optionally provide a 1975 // overrideNavigation which will override the normalLoad in the case of a redirect 1976 // navigation 1977 async function startNavigation(historyAction, location, opts) { 1978 // Abort any in-progress navigations and start a new one. Unset any ongoing 1979 // uninterrupted revalidations unless told otherwise, since we want this 1980 // new navigation to update history normally 1981 pendingNavigationController && pendingNavigationController.abort(); 1982 pendingNavigationController = null; 1983 pendingAction = historyAction; 1984 isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true; 1985 // Save the current scroll position every time we start a new navigation, 1986 // and track whether we should reset scroll on completion 1987 saveScrollPosition(state.location, state.matches); 1988 pendingPreventScrollReset = (opts && opts.preventScrollReset) === true; 1989 pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true; 1990 let routesToUse = inFlightDataRoutes || dataRoutes; 1991 let loadingNavigation = opts && opts.overrideNavigation; 1992 let matches = matchRoutes(routesToUse, location, basename); 1993 let flushSync = (opts && opts.flushSync) === true; 1994 let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname); 1995 if (fogOfWar.active && fogOfWar.matches) { 1996 matches = fogOfWar.matches; 1997 } 1998 // Short circuit with a 404 on the root error boundary if we match nothing 1999 if (!matches) { 2000 let { 2001 error, 2002 notFoundMatches, 2003 route 2004 } = handleNavigational404(location.pathname); 2005 completeNavigation(location, { 2006 matches: notFoundMatches, 2007 loaderData: {}, 2008 errors: { 2009 [route.id]: error 2010 } 2011 }, { 2012 flushSync 2013 }); 2014 return; 2015 } 2016 // Short circuit if it's only a hash change and not a revalidation or 2017 // mutation submission. 2018 // 2019 // Ignore on initial page loads because since the initial load will always 2020 // be "same hash". For example, on /page#hash and submit a <Form method="post"> 2021 // which will default to a navigation to /page 2022 if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) { 2023 completeNavigation(location, { 2024 matches 2025 }, { 2026 flushSync 2027 }); 2028 return; 2029 } 2030 // Create a controller/Request for this navigation 2031 pendingNavigationController = new AbortController(); 2032 let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission); 2033 let pendingActionResult; 2034 if (opts && opts.pendingError) { 2035 // If we have a pendingError, it means the user attempted a GET submission 2036 // with binary FormData so assign here and skip to handleLoaders. That 2037 // way we handle calling loaders above the boundary etc. It's not really 2038 // different from an actionError in that sense. 2039 pendingActionResult = [findNearestBoundary(matches).route.id, { 2040 type: ResultType.error, 2041 error: opts.pendingError 2042 }]; 2043 } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) { 2044 // Call action if we received an action submission 2045 let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, { 2046 replace: opts.replace, 2047 flushSync 2048 }); 2049 if (actionResult.shortCircuited) { 2050 return; 2051 } 2052 // If we received a 404 from handleAction, it's because we couldn't lazily 2053 // discover the destination route so we don't want to call loaders 2054 if (actionResult.pendingActionResult) { 2055 let [routeId, result] = actionResult.pendingActionResult; 2056 if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) { 2057 pendingNavigationController = null; 2058 completeNavigation(location, { 2059 matches: actionResult.matches, 2060 loaderData: {}, 2061 errors: { 2062 [routeId]: result.error 2063 } 2064 }); 2065 return; 2066 } 2067 } 2068 matches = actionResult.matches || matches; 2069 pendingActionResult = actionResult.pendingActionResult; 2070 loadingNavigation = getLoadingNavigation(location, opts.submission); 2071 flushSync = false; 2072 // No need to do fog of war matching again on loader execution 2073 fogOfWar.active = false; 2074 // Create a GET request for the loaders 2075 request = createClientSideRequest(init.history, request.url, request.signal); 2076 } 2077 // Call loaders 2078 let { 2079 shortCircuited, 2080 matches: updatedMatches, 2081 loaderData, 2082 errors 2083 } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult); 2084 if (shortCircuited) { 2085 return; 2086 } 2087 // Clean up now that the action/loaders have completed. Don't clean up if 2088 // we short circuited because pendingNavigationController will have already 2089 // been assigned to a new controller for the next navigation 2090 pendingNavigationController = null; 2091 completeNavigation(location, _extends$3({ 2092 matches: updatedMatches || matches 2093 }, getActionDataForCommit(pendingActionResult), { 2094 loaderData, 2095 errors 2096 })); 2097 } 2098 // Call the action matched by the leaf route for this navigation and handle 2099 // redirects/errors 2100 async function handleAction(request, location, submission, matches, isFogOfWar, opts) { 2101 if (opts === void 0) { 2102 opts = {}; 2103 } 2104 interruptActiveLoads(); 2105 // Put us in a submitting state 2106 let navigation = getSubmittingNavigation(location, submission); 2107 updateState({ 2108 navigation 2109 }, { 2110 flushSync: opts.flushSync === true 2111 }); 2112 if (isFogOfWar) { 2113 let discoverResult = await discoverRoutes(matches, location.pathname, request.signal); 2114 if (discoverResult.type === "aborted") { 2115 return { 2116 shortCircuited: true 2117 }; 2118 } else if (discoverResult.type === "error") { 2119 let { 2120 boundaryId, 2121 error 2122 } = handleDiscoverRouteError(location.pathname, discoverResult); 2123 return { 2124 matches: discoverResult.partialMatches, 2125 pendingActionResult: [boundaryId, { 2126 type: ResultType.error, 2127 error 2128 }] 2129 }; 2130 } else if (!discoverResult.matches) { 2131 let { 2132 notFoundMatches, 2133 error, 2134 route 2135 } = handleNavigational404(location.pathname); 2136 return { 2137 matches: notFoundMatches, 2138 pendingActionResult: [route.id, { 2139 type: ResultType.error, 2140 error 2141 }] 2142 }; 2143 } else { 2144 matches = discoverResult.matches; 2145 } 2146 } 2147 // Call our action and get the result 2148 let result; 2149 let actionMatch = getTargetMatch(matches, location); 2150 if (!actionMatch.route.action && !actionMatch.route.lazy) { 2151 result = { 2152 type: ResultType.error, 2153 error: getInternalRouterError(405, { 2154 method: request.method, 2155 pathname: location.pathname, 2156 routeId: actionMatch.route.id 2157 }) 2158 }; 2159 } else { 2160 let results = await callDataStrategy("action", request, [actionMatch], matches); 2161 result = results[0]; 2162 if (request.signal.aborted) { 2163 return { 2164 shortCircuited: true 2165 }; 2166 } 2167 } 2168 if (isRedirectResult(result)) { 2169 let replace; 2170 if (opts && opts.replace != null) { 2171 replace = opts.replace; 2172 } else { 2173 // If the user didn't explicity indicate replace behavior, replace if 2174 // we redirected to the exact same location we're currently at to avoid 2175 // double back-buttons 2176 let location = normalizeRedirectLocation(result.response.headers.get("Location"), new URL(request.url), basename); 2177 replace = location === state.location.pathname + state.location.search; 2178 } 2179 await startRedirectNavigation(request, result, { 2180 submission, 2181 replace 2182 }); 2183 return { 2184 shortCircuited: true 2185 }; 2186 } 2187 if (isDeferredResult(result)) { 2188 throw getInternalRouterError(400, { 2189 type: "defer-action" 2190 }); 2191 } 2192 if (isErrorResult(result)) { 2193 // Store off the pending error - we use it to determine which loaders 2194 // to call and will commit it when we complete the navigation 2195 let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id); 2196 // By default, all submissions to the current location are REPLACE 2197 // navigations, but if the action threw an error that'll be rendered in 2198 // an errorElement, we fall back to PUSH so that the user can use the 2199 // back button to get back to the pre-submission form location to try 2200 // again 2201 if ((opts && opts.replace) !== true) { 2202 pendingAction = Action.Push; 2203 } 2204 return { 2205 matches, 2206 pendingActionResult: [boundaryMatch.route.id, result] 2207 }; 2208 } 2209 return { 2210 matches, 2211 pendingActionResult: [actionMatch.route.id, result] 2212 }; 2213 } 2214 // Call all applicable loaders for the given matches, handling redirects, 2215 // errors, etc. 2216 async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) { 2217 // Figure out the right navigation we want to use for data loading 2218 let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission); 2219 // If this was a redirect from an action we don't have a "submission" but 2220 // we have it on the loading navigation so use that if available 2221 let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation); 2222 // If this is an uninterrupted revalidation, we remain in our current idle 2223 // state. If not, we need to switch to our loading state and load data, 2224 // preserving any new action data or existing action data (in the case of 2225 // a revalidation interrupting an actionReload) 2226 // If we have partialHydration enabled, then don't update the state for the 2227 // initial data load since it's not a "navigation" 2228 let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration); 2229 // When fog of war is enabled, we enter our `loading` state earlier so we 2230 // can discover new routes during the `loading` state. We skip this if 2231 // we've already run actions since we would have done our matching already. 2232 // If the children() function threw then, we want to proceed with the 2233 // partial matches it discovered. 2234 if (isFogOfWar) { 2235 if (shouldUpdateNavigationState) { 2236 let actionData = getUpdatedActionData(pendingActionResult); 2237 updateState(_extends$3({ 2238 navigation: loadingNavigation 2239 }, actionData !== undefined ? { 2240 actionData 2241 } : {}), { 2242 flushSync 2243 }); 2244 } 2245 let discoverResult = await discoverRoutes(matches, location.pathname, request.signal); 2246 if (discoverResult.type === "aborted") { 2247 return { 2248 shortCircuited: true 2249 }; 2250 } else if (discoverResult.type === "error") { 2251 let { 2252 boundaryId, 2253 error 2254 } = handleDiscoverRouteError(location.pathname, discoverResult); 2255 return { 2256 matches: discoverResult.partialMatches, 2257 loaderData: {}, 2258 errors: { 2259 [boundaryId]: error 2260 } 2261 }; 2262 } else if (!discoverResult.matches) { 2263 let { 2264 error, 2265 notFoundMatches, 2266 route 2267 } = handleNavigational404(location.pathname); 2268 return { 2269 matches: notFoundMatches, 2270 loaderData: {}, 2271 errors: { 2272 [route.id]: error 2273 } 2274 }; 2275 } else { 2276 matches = discoverResult.matches; 2277 } 2278 } 2279 let routesToUse = inFlightDataRoutes || dataRoutes; 2280 let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult); 2281 // Cancel pending deferreds for no-longer-matched routes or routes we're 2282 // about to reload. Note that if this is an action reload we would have 2283 // already cancelled all pending deferreds so this would be a no-op 2284 cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId)); 2285 pendingNavigationLoadId = ++incrementingLoadId; 2286 // Short circuit if we have no loaders to run 2287 if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) { 2288 let updatedFetchers = markFetchRedirectsDone(); 2289 completeNavigation(location, _extends$3({ 2290 matches, 2291 loaderData: {}, 2292 // Commit pending error if we're short circuiting 2293 errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { 2294 [pendingActionResult[0]]: pendingActionResult[1].error 2295 } : null 2296 }, getActionDataForCommit(pendingActionResult), updatedFetchers ? { 2297 fetchers: new Map(state.fetchers) 2298 } : {}), { 2299 flushSync 2300 }); 2301 return { 2302 shortCircuited: true 2303 }; 2304 } 2305 if (shouldUpdateNavigationState) { 2306 let updates = {}; 2307 if (!isFogOfWar) { 2308 // Only update navigation/actionNData if we didn't already do it above 2309 updates.navigation = loadingNavigation; 2310 let actionData = getUpdatedActionData(pendingActionResult); 2311 if (actionData !== undefined) { 2312 updates.actionData = actionData; 2313 } 2314 } 2315 if (revalidatingFetchers.length > 0) { 2316 updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers); 2317 } 2318 updateState(updates, { 2319 flushSync 2320 }); 2321 }
2322 revalidatingFetchers.forEach(rf => { 2323 if (fetchControllers.has(rf.key)) { 2324 abortFetcher(rf.key); 2325 } 2326 if (rf.controller) { 2327 // Fetchers use an independent AbortController so that aborting a fetcher 2328 // (via deleteFetcher) does not abort the triggering navigation that 2329 // triggered the revalidation 2330 fetchControllers.set(rf.key, rf.controller); 2331 } 2332 }); 2333 // Proxy navigation abort through to revalidation fetchers 2334 let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key)); 2335 if (pendingNavigationController) { 2336 pendingNavigationController.signal.addEventListener("abort", abortPendingFetchRevalidations); 2337 } 2338 let { 2339 loaderResults, 2340 fetcherResults 2341 } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request); 2342 if (request.signal.aborted) { 2343 return { 2344 shortCircuited: true 2345 }; 2346 } 2347 // Clean up _after_ loaders have completed. Don't clean up if we short 2348 // circuited because fetchControllers would have been aborted and 2349 // reassigned to new controllers for the next navigation 2350 if (pendingNavigationController) { 2351 pendingNavigationController.signal.removeEventListener("abort", abortPendingFetchRevalidations); 2352 } 2353 revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key)); 2354 // If any loaders returned a redirect Response, start a new REPLACE navigation 2355 let redirect = findRedirect([...loaderResults, ...fetcherResults]); 2356 if (redirect) { 2357 if (redirect.idx >= matchesToLoad.length) { 2358 // If this redirect came from a fetcher make sure we mark it in 2359 // fetchRedirectIds so it doesn't get revalidated on the next set of 2360 // loader executions 2361 let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key; 2362 fetchRedirectIds.add(fetcherKey); 2363 } 2364 await startRedirectNavigation(request, redirect.result, { 2365 replace 2366 }); 2367 return { 2368 shortCircuited: true 2369 }; 2370 } 2371 // Process and commit output from loaders 2372 let { 2373 loaderData, 2374 errors 2375 } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds); 2376 // Wire up subscribers to update loaderData as promises settle 2377 activeDeferreds.forEach((deferredData, routeId) => { 2378 deferredData.subscribe(aborted => { 2379 // Note: No need to updateState here since the TrackedPromise on 2380 // loaderData is stable across resolve/reject 2381 // Remove this instance if we were aborted or if promises have settled 2382 if (aborted || deferredData.done) { 2383 activeDeferreds.delete(routeId); 2384 } 2385 }); 2386 }); 2387 // During partial hydration, preserve SSR errors for routes that don't re-run 2388 if (future.v7_partialHydration && initialHydration && state.errors) { 2389 Object.entries(state.errors).filter(_ref2 => { 2390 let [id] = _ref2; 2391 return !matchesToLoad.some(m => m.route.id === id); 2392 }
vendor: 8,881 bytes, lines 2392-2603
2392).forEach(_ref3 => { 2393 let [routeId, error] = _ref3; 2394 errors = Object.assign(errors || {}, { 2395 [routeId]: error 2396 }); 2397 }); 2398 } 2399 let updatedFetchers = markFetchRedirectsDone(); 2400 let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId); 2401 let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0; 2402 return _extends$3({ 2403 matches, 2404 loaderData, 2405 errors 2406 }, shouldUpdateFetchers ? { 2407 fetchers: new Map(state.fetchers) 2408 } : {}); 2409 } 2410 function getUpdatedActionData(pendingActionResult) { 2411 if (pendingActionResult && !isErrorResult(pendingActionResult[1])) { 2412 // This is cast to `any` currently because `RouteData`uses any and it 2413 // would be a breaking change to use any. 2414 // TODO: v7 - change `RouteData` to use `unknown` instead of `any` 2415 return { 2416 [pendingActionResult[0]]: pendingActionResult[1].data 2417 }; 2418 } else if (state.actionData) { 2419 if (Object.keys(state.actionData).length === 0) { 2420 return null; 2421 } else { 2422 return state.actionData; 2423 } 2424 } 2425 } 2426 function getUpdatedRevalidatingFetchers(revalidatingFetchers) { 2427 revalidatingFetchers.forEach(rf => { 2428 let fetcher = state.fetchers.get(rf.key); 2429 let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined); 2430 state.fetchers.set(rf.key, revalidatingFetcher); 2431 }); 2432 return new Map(state.fetchers); 2433 } 2434 // Trigger a fetcher load/submit for the given fetcher key 2435 function fetch(key, routeId, href, opts) { 2436 if (isServer) { 2437 throw new Error("router.fetch() was called during the server render, but it shouldn't be. " + "You are likely calling a useFetcher() method in the body of your component. " + "Try moving it to a useEffect or a callback."); 2438 } 2439 if (fetchControllers.has(key)) abortFetcher(key); 2440 let flushSync = (opts && opts.unstable_flushSync) === true; 2441 let routesToUse = inFlightDataRoutes || dataRoutes; 2442 let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative); 2443 let matches = matchRoutes(routesToUse, normalizedPath, basename); 2444 let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath); 2445 if (fogOfWar.active && fogOfWar.matches) { 2446 matches = fogOfWar.matches; 2447 } 2448 if (!matches) { 2449 setFetcherError(key, routeId, getInternalRouterError(404, { 2450 pathname: normalizedPath 2451 }), { 2452 flushSync 2453 }); 2454 return; 2455 } 2456 let { 2457 path, 2458 submission, 2459 error 2460 } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts); 2461 if (error) { 2462 setFetcherError(key, routeId, error, { 2463 flushSync 2464 }); 2465 return; 2466 } 2467 let match = getTargetMatch(matches, path); 2468 pendingPreventScrollReset = (opts && opts.preventScrollReset) === true; 2469 if (submission && isMutationMethod(submission.formMethod)) { 2470 handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, submission); 2471 return; 2472 } 2473 // Store off the match so we can call it's shouldRevalidate on subsequent 2474 // revalidations 2475 fetchLoadMatches.set(key, { 2476 routeId, 2477 path 2478 }); 2479 handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, submission); 2480 } 2481 // Call the action for the matched fetcher.submit(), and then handle redirects, 2482 // errors, and revalidation 2483 async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, submission) { 2484 interruptActiveLoads(); 2485 fetchLoadMatches.delete(key); 2486 function detectAndHandle405Error(m) { 2487 if (!m.route.action && !m.route.lazy) { 2488 let error = getInternalRouterError(405, { 2489 method: submission.formMethod, 2490 pathname: path, 2491 routeId: routeId 2492 }); 2493 setFetcherError(key, routeId, error, { 2494 flushSync 2495 }); 2496 return true; 2497 } 2498 return false; 2499 } 2500 if (!isFogOfWar && detectAndHandle405Error(match)) { 2501 return; 2502 } 2503 // Put this fetcher into it's submitting state 2504 let existingFetcher = state.fetchers.get(key); 2505 updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), { 2506 flushSync 2507 }); 2508 let abortController = new AbortController(); 2509 let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission); 2510 if (isFogOfWar) { 2511 let discoverResult = await discoverRoutes(requestMatches, path, fetchRequest.signal); 2512 if (discoverResult.type === "aborted") { 2513 return; 2514 } else if (discoverResult.type === "error") { 2515 let { 2516 error 2517 } = handleDiscoverRouteError(path, discoverResult); 2518 setFetcherError(key, routeId, error, { 2519 flushSync 2520 }); 2521 return; 2522 } else if (!discoverResult.matches) { 2523 setFetcherError(key, routeId, getInternalRouterError(404, { 2524 pathname: path 2525 }), { 2526 flushSync 2527 }); 2528 return; 2529 } else { 2530 requestMatches = discoverResult.matches; 2531 match = getTargetMatch(requestMatches, path); 2532 if (detectAndHandle405Error(match)) { 2533 return; 2534 } 2535 } 2536 } 2537 // Call the action for the fetcher 2538 fetchControllers.set(key, abortController); 2539 let originatingLoadId = incrementingLoadId; 2540 let actionResults = await callDataStrategy("action", fetchRequest, [match], requestMatches); 2541 let actionResult = actionResults[0]; 2542 if (fetchRequest.signal.aborted) { 2543 // We can delete this so long as we weren't aborted by our own fetcher 2544 // re-submit which would have put _new_ controller is in fetchControllers 2545 if (fetchControllers.get(key) === abortController) { 2546 fetchControllers.delete(key); 2547 } 2548 return; 2549 } 2550 // When using v7_fetcherPersist, we don't want errors bubbling up to the UI 2551 // or redirects processed for unmounted fetchers so we just revert them to 2552 // idle 2553 if (future.v7_fetcherPersist && deletedFetchers.has(key)) { 2554 if (isRedirectResult(actionResult) || isErrorResult(actionResult)) { 2555 updateFetcherState(key, getDoneFetcher(undefined)); 2556 return; 2557 } 2558 // Let SuccessResult's fall through for revalidation 2559 } else { 2560 if (isRedirectResult(actionResult)) { 2561 fetchControllers.delete(key); 2562 if (pendingNavigationLoadId > originatingLoadId) { 2563 // A new navigation was kicked off after our action started, so that 2564 // should take precedence over this redirect navigation. We already 2565 // set isRevalidationRequired so all loaders for the new route should 2566 // fire unless opted out via shouldRevalidate 2567 updateFetcherState(key, getDoneFetcher(undefined)); 2568 return; 2569 } else { 2570 fetchRedirectIds.add(key); 2571 updateFetcherState(key, getLoadingFetcher(submission)); 2572 return startRedirectNavigation(fetchRequest, actionResult, { 2573 fetcherSubmission: submission 2574 }); 2575 } 2576 } 2577 // Process any non-redirect errors thrown 2578 if (isErrorResult(actionResult)) { 2579 setFetcherError(key, routeId, actionResult.error); 2580 return; 2581 } 2582 } 2583 if (isDeferredResult(actionResult)) { 2584 throw getInternalRouterError(400, { 2585 type: "defer-action" 2586 }); 2587 } 2588 // Start the data load for current matches, or the next location if we're 2589 // in the middle of a navigation 2590 let nextLocation = state.navigation.location || state.location; 2591 let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal); 2592 let routesToUse = inFlightDataRoutes || dataRoutes; 2593 let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches; 2594 invariant$1(matches, "Didn't find any matches after fetcher action"); 2595 let loadId = ++incrementingLoadId; 2596 fetchReloadIds.set(key, loadId); 2597 let loadFetcher = getLoadingFetcher(submission, actionResult.data); 2598 state.fetchers.set(key, loadFetcher); 2599 let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]); 2600 // Put all revalidating fetchers into the loading state, except for the 2601 // current fetcher which we want to keep in it's current loading state which 2602 // contains it's action submission info + action data 2603 revalidatingFetchers.filter(rf =>
2603 rf.key !== key).forEach(rf => { 2604 let staleKey = rf.key; 2605 let existingFetcher = state.fetchers.get(staleKey); 2606 let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined); 2607 state.fetchers.set(staleKey, revalidatingFetcher); 2608 if (fetchControllers.has(staleKey)) { 2609 abortFetcher(staleKey); 2610 } 2611 if (rf.controller) { 2612 fetchControllers.set(staleKey, rf.controller); 2613 } 2614 }); 2615 updateState({ 2616 fetchers: new Map(state.fetchers) 2617 }); 2618 let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key)); 2619 abortController.signal.addEventListener("abort", abortPendingFetchRevalidations); 2620 let { 2621 loaderResults, 2622 fetcherResults 2623 } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest); 2624 if (abortController.signal.aborted) { 2625 return; 2626 } 2627 abortController.signal.removeEventListener("abort", abortPendingFetchRevalidations); 2628 fetchReloadIds.delete(key); 2629 fetchControllers.delete(key); 2630 revalidatingFetchers.forEach(r => fetchControllers.delete(r.key)); 2631 let redirect = findRedirect([...loaderResults, ...fetcherResults]); 2632 if (redirect) { 2633 if (redirect.idx >= matchesToLoad.length) { 2634 // If this redirect came from a fetcher make sure we mark it in 2635 // fetchRedirectIds so it doesn't get revalidated on the next set of 2636 // loader executions 2637 let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key; 2638 fetchRedirectIds.add(fetcherKey); 2639 } 2640 return startRedirectNavigation(revalidationRequest, redirect.result); 2641 } 2642 // Process and commit output from loaders 2643 let { 2644 loaderData, 2645 errors 2646 } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds); 2647 // Since we let revalidations complete even if the submitting fetcher was 2648 // deleted, only put it back to idle if it hasn't been deleted 2649 if (state.fetchers.has(key)) { 2650 let doneFetcher = getDoneFetcher(actionResult.data); 2651 state.fetchers.set(key, doneFetcher); 2652 } 2653 abortStaleFetchLoads(loadId); 2654 // If we are currently in a navigation loading state and this fetcher is 2655 // more recent than the navigation, we want the newer data so abort the 2656 // navigation and complete it with the fetcher data 2657 if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) { 2658 invariant$1(pendingAction, "Expected pending action"); 2659 pendingNavigationController && pendingNavigationController.abort(); 2660 completeNavigation(state.navigation.location, { 2661 matches, 2662 loaderData, 2663 errors, 2664 fetchers: new Map(state.fetchers) 2665 }); 2666 } else { 2667 // otherwise just update with the fetcher data, preserving any existing 2668 // loaderData for loaders that did not need to reload. We have to 2669 // manually merge here since we aren't going through completeNavigation 2670 updateState({ 2671 errors, 2672 loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors), 2673 fetchers: new Map(state.fetchers) 2674 }); 2675 isRevalidationRequired = false; 2676 } 2677 } 2678 // Call the matched loader for fetcher.load(), handling redirects, errors, etc. 2679 async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, submission) { 2680 let existingFetcher = state.fetchers.get(key); 2681 updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), { 2682 flushSync 2683 }); 2684 let abortController = new AbortController(); 2685 let fetchRequest = createClientSideRequest(init.history, path, abortController.signal); 2686 if (isFogOfWar) { 2687 let discoverResult = await discoverRoutes(matches, path, fetchRequest.signal); 2688 if (discoverResult.type === "aborted") { 2689 return; 2690 } else if (discoverResult.type === "error") { 2691 let { 2692 error 2693 } = handleDiscoverRouteError(path, discoverResult); 2694 setFetcherError(key, routeId, error, { 2695 flushSync 2696 }); 2697 return; 2698 } else if (!discoverResult.matches) { 2699 setFetcherError(key, routeId, getInternalRouterError(404, { 2700 pathname: path 2701 }), { 2702 flushSync 2703 }); 2704 return; 2705 } else { 2706 matches = discoverResult.matches; 2707 match = getTargetMatch(matches, path); 2708 } 2709 } 2710 // Call the loader for this fetcher route match 2711 fetchControllers.set(key, abortController); 2712 let originatingLoadId = incrementingLoadId; 2713 let results = await callDataStrategy("loader", fetchRequest, [match], matches); 2714 let result = results[0]; 2715 // Deferred isn't supported for fetcher loads, await everything and treat it 2716 // as a normal load. resolveDeferredData will return undefined if this 2717 // fetcher gets aborted, so we just leave result untouched and short circuit 2718 // below if that happens 2719 if (isDeferredResult(result)) { 2720 result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result; 2721 } 2722 // We can delete this so long as we weren't aborted by our our own fetcher
vendor: 4,376 bytes, lines 2723-2828
2723 // re-load which would have put _new_ controller is in fetchControllers 2724 if (fetchControllers.get(key) === abortController) { 2725 fetchControllers.delete(key); 2726 } 2727 if (fetchRequest.signal.aborted) { 2728 return; 2729 } 2730 // We don't want errors bubbling up or redirects followed for unmounted 2731 // fetchers, so short circuit here if it was removed from the UI 2732 if (deletedFetchers.has(key)) { 2733 updateFetcherState(key, getDoneFetcher(undefined)); 2734 return; 2735 } 2736 // If the loader threw a redirect Response, start a new REPLACE navigation 2737 if (isRedirectResult(result)) { 2738 if (pendingNavigationLoadId > originatingLoadId) { 2739 // A new navigation was kicked off after our loader started, so that 2740 // should take precedence over this redirect navigation 2741 updateFetcherState(key, getDoneFetcher(undefined)); 2742 return; 2743 } else { 2744 fetchRedirectIds.add(key); 2745 await startRedirectNavigation(fetchRequest, result); 2746 return; 2747 } 2748 } 2749 // Process any non-redirect errors thrown 2750 if (isErrorResult(result)) { 2751 setFetcherError(key, routeId, result.error); 2752 return; 2753 } 2754 invariant$1(!isDeferredResult(result), "Unhandled fetcher deferred data"); 2755 // Put the fetcher back into an idle state 2756 updateFetcherState(key, getDoneFetcher(result.data)); 2757 } 2758 /** 2759 * Utility function to handle redirects returned from an action or loader. 2760 * Normally, a redirect "replaces" the navigation that triggered it. So, for 2761 * example: 2762 * 2763 * - user is on /a 2764 * - user clicks a link to /b 2765 * - loader for /b redirects to /c 2766 * 2767 * In a non-JS app the browser would track the in-flight navigation to /b and 2768 * then replace it with /c when it encountered the redirect response. In 2769 * the end it would only ever update the URL bar with /c. 2770 * 2771 * In client-side routing using pushState/replaceState, we aim to emulate 2772 * this behavior and we also do not update history until the end of the 2773 * navigation (including processed redirects). This means that we never 2774 * actually touch history until we've processed redirects, so we just use 2775 * the history action from the original navigation (PUSH or REPLACE). 2776 */ 2777 async function startRedirectNavigation(request, redirect, _temp2) { 2778 let { 2779 submission, 2780 fetcherSubmission, 2781 replace 2782 } = _temp2 === void 0 ? {} : _temp2; 2783 if (redirect.response.headers.has("X-Remix-Revalidate")) { 2784 isRevalidationRequired = true; 2785 } 2786 let location = redirect.response.headers.get("Location"); 2787 invariant$1(location, "Expected a Location header on the redirect Response"); 2788 location = normalizeRedirectLocation(location, new URL(request.url), basename); 2789 let redirectLocation = createLocation(state.location, location, { 2790 _isRedirect: true 2791 }); 2792 if (isBrowser) { 2793 let isDocumentReload = false; 2794 if (redirect.response.headers.has("X-Remix-Reload-Document")) { 2795 // Hard reload if the response contained X-Remix-Reload-Document 2796 isDocumentReload = true; 2797 } else if (ABSOLUTE_URL_REGEX$1.test(location)) { 2798 const url = init.history.createURL(location); 2799 isDocumentReload = 2800 // Hard reload if it's an absolute URL to a new origin 2801 url.origin !== routerWindow.location.origin || 2802 // Hard reload if it's an absolute URL that does not match our basename 2803 stripBasename(url.pathname, basename) == null; 2804 } 2805 if (isDocumentReload) { 2806 if (replace) { 2807 routerWindow.location.replace(location); 2808 } else { 2809 routerWindow.location.assign(location); 2810 } 2811 return; 2812 } 2813 } 2814 // There's no need to abort on redirects, since we don't detect the 2815 // redirect until the action/loaders have settled 2816 pendingNavigationController = null; 2817 let redirectHistoryAction = replace === true ? Action.Replace : Action.Push; 2818 // Use the incoming submission if provided, fallback on the active one in 2819 // state.navigation 2820 let { 2821 formMethod, 2822 formAction, 2823 formEncType 2824 } = state.navigation; 2825 if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) { 2826 submission = getSubmissionFromNavigation(state.navigation); 2827 } 2828 // If this was a 307/308 submission we want to preserve the HTTP method and
2829 // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the 2830 // redirected location 2831 let activeSubmission = submission || fetcherSubmission; 2832 if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) { 2833 await startNavigation(redirectHistoryAction, redirectLocation, { 2834 submission: _extends$3({}, activeSubmission, { 2835 formAction: location 2836 }), 2837 // Preserve this flag across redirects 2838 preventScrollReset: pendingPreventScrollReset 2839 }); 2840 } else { 2841 // If we have a navigation submission, we will preserve it through the 2842 // redirect navigation 2843 let overrideNavigation = getLoadingNavigation(redirectLocation, submission); 2844 await startNavigation(redirectHistoryAction, redirectLocation, { 2845 overrideNavigation, 2846 // Send fetcher submissions through for shouldRevalidate 2847 fetcherSubmission, 2848 // Preserve this flag across redirects 2849 preventScrollReset: pendingPreventScrollReset 2850 }); 2851 } 2852 } 2853 // Utility wrapper for calling dataStrategy client-side without having to 2854 // pass around the manifest, mapRouteProperties, etc. 2855 async function callDataStrategy(type, request, matchesToLoad, matches) { 2856 try { 2857 let results = await callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties); 2858 return await Promise.all(results.map((result, i) => { 2859 if (isRedirectHandlerResult(result)) { 2860 let response = result.result; 2861 return { 2862 type: ResultType.redirect, 2863 response: normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].route.id, matches, basename, future.v7_relativeSplatPath) 2864 }; 2865 } 2866 return convertHandlerResultToDataResult(result); 2867 })); 2868 } catch (e) { 2869 // If the outer dataStrategy method throws, just return the error for all 2870 // matches - and it'll naturally bubble to the root 2871 return matchesToLoad.map(() => ({ 2872 type: ResultType.error, 2873 error: e 2874 })); 2875 } 2876 } 2877 async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) { 2878 let [loaderResults, ...fetcherResults] = await Promise.all([matchesToLoad.length ? callDataStrategy("loader", request, matchesToLoad, matches) : [], ...fetchersToLoad.map(f => { 2879 if (f.matches && f.match && f.controller) { 2880 let fetcherRequest = createClientSideRequest(init.history, f.path, f.controller.signal); 2881 return callDataStrategy("loader", fetcherRequest, [f.match], f.matches).then(r => r[0]); 2882 } else { 2883 return Promise.resolve({ 2884 type: ResultType.error, 2885 error: getInternalRouterError(404, { 2886 pathname: f.path 2887 }) 2888 }); 2889 } 2890 })]); 2891 await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]); 2892 return { 2893 loaderResults, 2894 fetcherResults 2895 }; 2896 } 2897 function interruptActiveLoads() { 2898 // Every interruption triggers a revalidation 2899 isRevalidationRequired = true; 2900 // Cancel pending route-level deferreds and mark cancelled routes for 2901 // revalidation 2902 cancelledDeferredRoutes.push(...cancelActiveDeferreds()); 2903 // Abort in-flight fetcher loads 2904 fetchLoadMatches.forEach((_, key) => { 2905 if (fetchControllers.has(key)) { 2906 cancelledFetcherLoads.push(key); 2907 abortFetcher(key); 2908 } 2909 }); 2910 } 2911 function updateFetcherState(key, fetcher, opts) { 2912 if (opts === void 0) { 2913 opts = {}; 2914 } 2915 state.fetchers.set(key, fetcher); 2916 updateState({ 2917 fetchers: new Map(state.fetchers) 2918 }, { 2919 flushSync: (opts && opts.flushSync) === true 2920 }); 2921 } 2922 function setFetcherError(key, routeId, error, opts) { 2923 if (opts === void 0) { 2924 opts = {}; 2925 }
2926 let boundaryMatch = findNearestBoundary(state.matches, routeId); 2927 deleteFetcher(key); 2928 updateState({ 2929 errors: { 2930 [boundaryMatch.route.id]: error 2931 }, 2932 fetchers: new Map(state.fetchers) 2933 }, { 2934 flushSync: (opts && opts.flushSync) === true 2935 }); 2936 } 2937 function getFetcher(key) { 2938 if (future.v7_fetcherPersist) { 2939 activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1); 2940 // If this fetcher was previously marked for deletion, unmark it since we 2941 // have a new instance 2942 if (deletedFetchers.has(key)) { 2943 deletedFetchers.delete(key); 2944 } 2945 } 2946 return state.fetchers.get(key) || IDLE_FETCHER; 2947 } 2948 function deleteFetcher(key) { 2949 let fetcher = state.fetchers.get(key); 2950 // Don't abort the controller if this is a deletion of a fetcher.submit() 2951 // in it's loading phase since - we don't want to abort the corresponding 2952 // revalidation and want them to complete and land 2953 if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) { 2954 abortFetcher(key); 2955 } 2956 fetchLoadMatches.delete(key); 2957 fetchReloadIds.delete(key); 2958 fetchRedirectIds.delete(key); 2959 deletedFetchers.delete(key); 2960 state.fetchers.delete(key); 2961 } 2962 function deleteFetcherAndUpdateState(key) { 2963 if (future.v7_fetcherPersist) { 2964 let count = (activeFetchers.get(key) || 0) - 1; 2965 if (count <= 0) { 2966 activeFetchers.delete(key); 2967 deletedFetchers.add(key); 2968 } else { 2969 activeFetchers.set(key, count); 2970 } 2971 } else { 2972 deleteFetcher(key); 2973 } 2974 updateState({ 2975 fetchers: new Map(state.fetchers) 2976 }); 2977 } 2978 function abortFetcher(key) {
vendor: 4,710 bytes, lines 2979-3104
2979 let controller = fetchControllers.get(key); 2980 invariant$1(controller, "Expected fetch controller: " + key); 2981 controller.abort(); 2982 fetchControllers.delete(key); 2983 } 2984 function markFetchersDone(keys) { 2985 for (let key of keys) { 2986 let fetcher = getFetcher(key); 2987 let doneFetcher = getDoneFetcher(fetcher.data); 2988 state.fetchers.set(key, doneFetcher); 2989 } 2990 } 2991 function markFetchRedirectsDone() { 2992 let doneKeys = []; 2993 let updatedFetchers = false; 2994 for (let key of fetchRedirectIds) { 2995 let fetcher = state.fetchers.get(key); 2996 invariant$1(fetcher, "Expected fetcher: " + key); 2997 if (fetcher.state === "loading") { 2998 fetchRedirectIds.delete(key); 2999 doneKeys.push(key); 3000 updatedFetchers = true; 3001 } 3002 } 3003 markFetchersDone(doneKeys); 3004 return updatedFetchers; 3005 } 3006 function abortStaleFetchLoads(landedId) { 3007 let yeetedKeys = []; 3008 for (let [key, id] of fetchReloadIds) { 3009 if (id < landedId) { 3010 let fetcher = state.fetchers.get(key); 3011 invariant$1(fetcher, "Expected fetcher: " + key); 3012 if (fetcher.state === "loading") { 3013 abortFetcher(key); 3014 fetchReloadIds.delete(key); 3015 yeetedKeys.push(key); 3016 } 3017 } 3018 } 3019 markFetchersDone(yeetedKeys); 3020 return yeetedKeys.length > 0; 3021 } 3022 function getBlocker(key, fn) { 3023 let blocker = state.blockers.get(key) || IDLE_BLOCKER; 3024 if (blockerFunctions.get(key) !== fn) { 3025 blockerFunctions.set(key, fn); 3026 } 3027 return blocker; 3028 } 3029 function deleteBlocker(key) { 3030 state.blockers.delete(key); 3031 blockerFunctions.delete(key); 3032 } 3033 // Utility function to update blockers, ensuring valid state transitions 3034 function updateBlocker(key, newBlocker) { 3035 let blocker = state.blockers.get(key) || IDLE_BLOCKER; 3036 // Poor mans state machine :) 3037 // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM 3038 invariant$1(blocker.state === "unblocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "proceeding" || blocker.state === "blocked" && newBlocker.state === "unblocked" || blocker.state === "proceeding" && newBlocker.state === "unblocked", "Invalid blocker state transition: " + blocker.state + " -> " + newBlocker.state); 3039 let blockers = new Map(state.blockers); 3040 blockers.set(key, newBlocker); 3041 updateState({ 3042 blockers 3043 }); 3044 } 3045 function shouldBlockNavigation(_ref4) { 3046 let { 3047 currentLocation, 3048 nextLocation, 3049 historyAction 3050 } = _ref4; 3051 if (blockerFunctions.size === 0) { 3052 return; 3053 } 3054 // We ony support a single active blocker at the moment since we don't have 3055 // any compelling use cases for multi-blocker yet 3056 if (blockerFunctions.size > 1) { 3057 warning(false, "A router only supports one blocker at a time"); 3058 } 3059 let entries = Array.from(blockerFunctions.entries()); 3060 let [blockerKey, blockerFunction] = entries[entries.length - 1]; 3061 let blocker = state.blockers.get(blockerKey); 3062 if (blocker && blocker.state === "proceeding") { 3063 // If the blocker is currently proceeding, we don't need to re-check 3064 // it and can let this navigation continue 3065 return; 3066 } 3067 // At this point, we know we're unblocked/blocked so we need to check the 3068 // user-provided blocker function 3069 if (blockerFunction({ 3070 currentLocation, 3071 nextLocation, 3072 historyAction 3073 })) { 3074 return blockerKey; 3075 } 3076 } 3077 function handleNavigational404(pathname) { 3078 let error = getInternalRouterError(404, { 3079 pathname 3080 }); 3081 let routesToUse = inFlightDataRoutes || dataRoutes; 3082 let { 3083 matches, 3084 route 3085 } = getShortCircuitMatches(routesToUse); 3086 // Cancel all pending deferred on 404s since we don't keep any routes 3087 cancelActiveDeferreds(); 3088 return { 3089 notFoundMatches: matches, 3090 route, 3091 error 3092 }; 3093 } 3094 function handleDiscoverRouteError(pathname, discoverResult) { 3095 return { 3096 boundaryId: findNearestBoundary(discoverResult.partialMatches).route.id, 3097 error: getInternalRouterError(400, { 3098 type: "route-discovery", 3099 pathname, 3100 message: discoverResult.error != null && "message" in discoverResult.error ? discoverResult.error : String(discoverResult.error) 3101 }) 3102 }; 3103 } 3104 function cancelActiveDeferreds(predicate) {
3105 let cancelledRouteIds = []; 3106 activeDeferreds.forEach((dfd, routeId) => { 3107 if (!predicate || predicate(routeId)) { 3108 // Cancel the deferred - but do not remove from activeDeferreds here - 3109 // we rely on the subscribers to do that so our tests can assert proper 3110 // cleanup via _internalActiveDeferreds 3111 dfd.cancel(); 3112 cancelledRouteIds.push(routeId); 3113 activeDeferreds.delete(routeId); 3114 } 3115 }); 3116 return cancelledRouteIds; 3117 } 3118 // Opt in to capturing and reporting scroll positions during navigations, 3119 // used by the <ScrollRestoration> component 3120 function enableScrollRestoration(positions, getPosition, getKey) { 3121 savedScrollPositions = positions; 3122 getScrollPosition = getPosition; 3123 getScrollRestorationKey = getKey || null; 3124 // Perform initial hydration scroll restoration, since we miss the boat on 3125 // the initial updateState() because we've not yet rendered <ScrollRestoration/> 3126 // and therefore have no savedScrollPositions available 3127 if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) { 3128 initialScrollRestored = true; 3129 let y = getSavedScrollPosition(state.location, state.matches); 3130 if (y != null) { 3131 updateState({ 3132 restoreScrollPosition: y 3133 }); 3134 } 3135 } 3136 return () => { 3137 savedScrollPositions = null; 3138 getScrollPosition = null; 3139 getScrollRestorationKey = null; 3140 }; 3141 } 3142 function getScrollKey(location, matches) { 3143 if (getScrollRestorationKey) { 3144 let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData))); 3145 return key || location.key; 3146 } 3147 return location.key; 3148 } 3149 function saveScrollPosition(location, matches) { 3150 if (savedScrollPositions && getScrollPosition) { 3151 let key = getScrollKey(location, matches); 3152 savedScrollPositions[key] = getScrollPosition(); 3153 } 3154 } 3155 function getSavedScrollPosition(location, matches) { 3156 if (savedScrollPositions) { 3157 let key = getScrollKey(location, matches); 3158 let y = savedScrollPositions[key]; 3159 if (typeof y === "number") { 3160 return y; 3161 } 3162 } 3163 return null; 3164 } 3165 function checkFogOfWar(matches, routesToUse, pathname) { 3166 if (patchRoutesOnMissImpl) { 3167 if (!matches) { 3168 let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true); 3169 return { 3170 active: true, 3171 matches: fogMatches || [] 3172 }; 3173 } else { 3174 let leafRoute = matches[matches.length - 1].route; 3175 if (leafRoute.path && (leafRoute.path === "*" || leafRoute.path.endsWith("/*"))) { 3176 // If we matched a splat, it might only be because we haven't yet fetched 3177 // the children that would match with a higher score, so let's fetch 3178 // around and find out 3179 let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true); 3180 return { 3181 active: true, 3182 matches: partialMatches 3183 }; 3184 } 3185 } 3186 } 3187 return { 3188 active: false, 3189 matches: null 3190 }; 3191 } 3192 async function discoverRoutes(matches, pathname, signal) { 3193 let partialMatches = matches; 3194 let route = partialMatches.length > 0 ? partialMatches[partialMatches.length - 1].route : null; 3195 while (true) { 3196 let isNonHMR = inFlightDataRoutes == null; 3197 let routesToUse = inFlightDataRoutes || dataRoutes; 3198 try { 3199 await loadLazyRouteChildren(patchRoutesOnMissImpl, pathname, partialMatches, routesToUse, manifest, mapRouteProperties, pendingPatchRoutes, signal); 3200 } catch (e) { 3201 return { 3202 type: "error", 3203 error: e, 3204 partialMatches 3205 }; 3206 } finally { 3207 // If we are not in the middle of an HMR revalidation and we changed the 3208 // routes, provide a new identity so when we `updateState` at the end of 3209 // this navigation/fetch `router.routes` will be a new identity and 3210 // trigger a re-run of memoized `router.routes` dependencies. 3211 // HMR will already update the identity and reflow when it lands 3212 // `inFlightDataRoutes` in `completeNavigation` 3213 if (isNonHMR) { 3214 dataRoutes = [...dataRoutes]; 3215 } 3216 } 3217 if (signal.aborted) { 3218 return { 3219 type: "aborted" 3220 }; 3221 }
3222 let newMatches = matchRoutes(routesToUse, pathname, basename); 3223 let matchedSplat = false; 3224 if (newMatches) { 3225 let leafRoute = newMatches[newMatches.length - 1].route; 3226 if (leafRoute.index) { 3227 // If we found an index route, we can stop 3228 return { 3229 type: "success", 3230 matches: newMatches 3231 }; 3232 } 3233 if (leafRoute.path && leafRoute.path.length > 0) { 3234 if (leafRoute.path === "*") { 3235 // If we found a splat route, we can't be sure there's not a 3236 // higher-scoring route down some partial matches trail so we need 3237 // to check that out 3238 matchedSplat = true; 3239 } else { 3240 // If we found a non-splat route, we can stop 3241 return { 3242 type: "success", 3243 matches: newMatches 3244 }; 3245 } 3246 } 3247 } 3248 let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true); 3249 // If we are no longer partially matching anything, this was either a 3250 // legit splat match above, or it's a 404. Also avoid loops if the 3251 // second pass results in the same partial matches 3252 if (!newPartialMatches || partialMatches.map(m => m.route.id).join("-") === newPartialMatches.map(m => m.route.id).join("-")) { 3253 return { 3254 type: "success", 3255 matches: matchedSplat ? newMatches : null 3256 }; 3257 } 3258 partialMatches = newPartialMatches; 3259 route = partialMatches[partialMatches.length - 1].route; 3260 if (route.path === "*") { 3261 // The splat is still our most accurate partial, so run with it 3262 return { 3263 type: "success", 3264 matches: partialMatches 3265 }; 3266 } 3267 } 3268 } 3269 function _internalSetRoutes(newRoutes) { 3270 manifest = {}; 3271 inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest); 3272 } 3273 function patchRoutes(routeId, children) { 3274 let isNonHMR = inFlightDataRoutes == null; 3275 let routesToUse = inFlightDataRoutes || dataRoutes; 3276 patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties); 3277 // If we are not in the middle of an HMR revalidation and we changed the 3278 // routes, provide a new identity and trigger a reflow via `updateState` 3279 // to re-run memoized `router.routes` dependencies. 3280 // HMR will already update the identity and reflow when it lands 3281 // `inFlightDataRoutes` in `completeNavigation` 3282 if (isNonHMR) { 3283 dataRoutes = [...dataRoutes]; 3284 updateState({}); 3285 } 3286 } 3287 router = { 3288 get basename() { 3289 return basename; 3290 }, 3291 get future() { 3292 return future; 3293 }, 3294 get state() { 3295 return state; 3296 }, 3297 get routes() { 3298 return dataRoutes; 3299 }, 3300 get window() { 3301 return routerWindow; 3302 }, 3303 initialize, 3304 subscribe, 3305 enableScrollRestoration, 3306 navigate, 3307 fetch, 3308 revalidate, 3309 // Passthrough to history-aware createHref used by useHref so we get proper 3310 // hash-aware URLs in DOM paths 3311 createHref: to => init.history.createHref(to), 3312 encodeLocation: to => init.history.encodeLocation(to), 3313 getFetcher, 3314 deleteFetcher: deleteFetcherAndUpdateState, 3315 dispose, 3316 getBlocker, 3317 deleteBlocker, 3318 patchRoutes, 3319 _internalFetchControllers: fetchControllers, 3320 _internalActiveDeferreds: activeDeferreds, 3321 // TODO: Remove setRoutes, it's temporary to avoid dealing with 3322 // updating the tree while validating the update algorithm. 3323 _internalSetRoutes 3324 }; 3325 return router; 3326} 3327function isSubmissionNavigation(opts) { 3328 return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== undefined); 3329} 3330function normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) { 3331 let contextualMatches; 3332 let activeRouteMatch; 3333 if (fromRouteId) { 3334 // Grab matches up to the calling route so our route-relative logic is 3335 // relative to the correct source route 3336 contextualMatches = []; 3337 for (let match of matches) { 3338 contextualMatches.push(match); 3339 if (match.route.id === fromRouteId) { 3340 activeRouteMatch = match; 3341 break; 3342 } 3343 } 3344 } else { 3345 contextualMatches = matches; 3346 activeRouteMatch = matches[matches.length - 1]; 3347 } 3348 // Resolve the relative path 3349 let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, base
vendor: 5,296 bytes, lines 3349-3495
3349name) || location.pathname, relative === "path"); 3350 // When `to` is not specified we inherit search/hash from the current 3351 // location, unlike when to="." and we just inherit the path. 3352 // See https://github.com/remix-run/remix/issues/927 3353 if (to == null) { 3354 path.search = location.search; 3355 path.hash = location.hash; 3356 } 3357 // Add an ?index param for matched index routes if we don't already have one 3358 if ((to == null || to === "" || to === ".") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) { 3359 path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; 3360 } 3361 // If we're operating within a basename, prepend it to the pathname. If 3362 // this is a root navigation, then just use the raw basename which allows 3363 // the basename to have full control over the presence of a trailing slash 3364 // on root actions 3365 if (prependBasename && basename !== "/") { 3366 path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); 3367 } 3368 return createPath(path); 3369} 3370// Normalize navigation options by converting formMethod=GET formData objects to 3371// URLSearchParams so they behave identically to links with query params 3372function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) { 3373 // Return location verbatim on non-submission navigations 3374 if (!opts || !isSubmissionNavigation(opts)) { 3375 return { 3376 path 3377 }; 3378 } 3379 if (opts.formMethod && !isValidMethod(opts.formMethod)) { 3380 return { 3381 path, 3382 error: getInternalRouterError(405, { 3383 method: opts.formMethod 3384 }) 3385 }; 3386 } 3387 let getInvalidBodyError = () => ({ 3388 path, 3389 error: getInternalRouterError(400, { 3390 type: "invalid-body" 3391 }) 3392 }); 3393 // Create a Submission on non-GET navigations 3394 let rawFormMethod = opts.formMethod || "get"; 3395 let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase(); 3396 let formAction = stripHashFromPath(path); 3397 if (opts.body !== undefined) { 3398 if (opts.formEncType === "text/plain") { 3399 // text only support POST/PUT/PATCH/DELETE submissions 3400 if (!isMutationMethod(formMethod)) { 3401 return getInvalidBodyError(); 3402 } 3403 let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ? 3404 // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data 3405 Array.from(opts.body.entries()).reduce((acc, _ref5) => { 3406 let [name, value] = _ref5; 3407 return "" + acc + name + "=" + value + "\n"; 3408 }, "") : String(opts.body); 3409 return { 3410 path, 3411 submission: { 3412 formMethod, 3413 formAction, 3414 formEncType: opts.formEncType, 3415 formData: undefined, 3416 json: undefined, 3417 text 3418 } 3419 }; 3420 } else if (opts.formEncType === "application/json") { 3421 // json only supports POST/PUT/PATCH/DELETE submissions 3422 if (!isMutationMethod(formMethod)) { 3423 return getInvalidBodyError(); 3424 } 3425 try { 3426 let json = typeof opts.body === "string" ? JSON.parse(opts.body) : opts.body; 3427 return { 3428 path, 3429 submission: { 3430 formMethod, 3431 formAction, 3432 formEncType: opts.formEncType, 3433 formData: undefined, 3434 json, 3435 text: undefined 3436 } 3437 }; 3438 } catch (e) { 3439 return getInvalidBodyError(); 3440 } 3441 } 3442 } 3443 invariant$1(typeof FormData === "function", "FormData is not available in this environment"); 3444 let searchParams; 3445 let formData; 3446 if (opts.formData) { 3447 searchParams = convertFormDataToSearchParams(opts.formData); 3448 formData = opts.formData; 3449 } else if (opts.body instanceof FormData) { 3450 searchParams = convertFormDataToSearchParams(opts.body); 3451 formData = opts.body; 3452 } else if (opts.body instanceof URLSearchParams) { 3453 searchParams = opts.body; 3454 formData = convertSearchParamsToFormData(searchParams); 3455 } else if (opts.body == null) { 3456 searchParams = new URLSearchParams(); 3457 formData = new FormData(); 3458 } else { 3459 try { 3460 searchParams = new URLSearchParams(opts.body); 3461 formData = convertSearchParamsToFormData(searchParams); 3462 } catch (e) { 3463 return getInvalidBodyError(); 3464 } 3465 } 3466 let submission = { 3467 formMethod, 3468 formAction, 3469 formEncType: opts && opts.formEncType || "application/x-www-form-urlencoded", 3470 formData, 3471 json: undefined, 3472 text: undefined 3473 }; 3474 if (isMutationMethod(submission.formMethod)) { 3475 return { 3476 path, 3477 submission 3478 }; 3479 } 3480 // Flatten submission onto URLSearchParams for GET submissions 3481 let parsedPath = parsePath(path); 3482 // On GET navigation submissions we can drop the ?index param from the 3483 // resulting location since all loaders will run. But fetcher GET submissions 3484 // only run a single loader so we need to preserve any incoming ?index params 3485 if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) { 3486 searchParams.append("index", ""); 3487 } 3488 parsedPath.search = "?" + searchParams; 3489 return { 3490 path: createPath(parsedPath), 3491 submission 3492 }; 3493} 3494// Filter out all routes below any caught error as they aren't going to 3495// render so we don't need to load them
3496function getLoaderMatchesUntilBoundary(matches, boundaryId) { 3497 let boundaryMatches = matches; 3498 if (boundaryId) { 3499 let index = matches.findIndex(m => m.route.id === boundaryId); 3500 if (index >= 0) { 3501 boundaryMatches = matches.slice(0, index); 3502 } 3503 } 3504 return boundaryMatches; 3505} 3506function getMatchesToLoad(history, state, matches, submission, location, isInitialLoad, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) { 3507 let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined; 3508 let currentUrl = history.createURL(state.location); 3509 let nextUrl = history.createURL(location); 3510 // Pick navigation matches that are net-new or qualify for revalidation 3511 let boundaryId = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[0] : undefined; 3512 let boundaryMatches = boundaryId ? getLoaderMatchesUntilBoundary(matches, boundaryId) : matches; 3513 // Don't revalidate loaders by default after action 4xx/5xx responses 3514 // when the flag is enabled. They can still opt-into revalidation via 3515 // `shouldRevalidate` via `actionResult` 3516 let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined; 3517 let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400; 3518 let navigationMatches = boundaryMatches.filter((match, index) => { 3519 let { 3520 route 3521 } = match; 3522 if (route.lazy) { 3523 // We haven't loaded this route yet so we don't know if it's got a loader! 3524 return true; 3525 } 3526 if (route.loader == null) { 3527 return false; 3528 } 3529 if (isInitialLoad) { 3530 if (typeof route.loader !== "function" || route.loader.hydrate) { 3531 return true; 3532 } 3533 return state.loaderData[route.id] === undefined && ( 3534 // Don't re-run if the loader ran and threw an error 3535 !state.errors || state.errors[route.id] === undefined); 3536 } 3537 // Always call the loader on new route instances and pending defer cancellations 3538 if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) { 3539 return true; 3540 } 3541 // This is the default implementation for when we revalidate. If the route 3542 // provides it's own implementation, then we give them full control but 3543 // provide this value so they can leverage it if needed after they check 3544 // their own specific use cases 3545 let currentRouteMatch = state.matches[index]; 3546 let nextRouteMatch = match; 3547 return shouldRevalidateLoader(match, _extends$3({ 3548 currentUrl, 3549 currentParams: currentRouteMatch.params, 3550 nextUrl, 3551 nextParams: nextRouteMatch.params 3552 }, submission, { 3553 actionResult, 3554 actionStatus, 3555 defaultShouldRevalidate: shouldSkipRevalidation ? false : 3556 // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate 3557 isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || 3558 // Search params affect all loaders 3559 currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch) 3560 })); 3561 }); 3562 // Pick fetcher.loads that need to be revalidated 3563 let revalidatingFetchers = []; 3564 fetchLoadMatches.forEach((f, key) => { 3565 // Don't revalidate: 3566 // - on initial load (shouldn't be any fetchers then anyway) 3567 // - if fetcher won't be present in the subsequent render 3568 // - no longer matches the URL (v7_fetcherPersist=false) 3569 // - was unmounted but persisted due to v7_fetcherPersist=true 3570 if (isInitialLoad || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) { 3571 return; 3572 } 3573 let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
3574 // If the fetcher path no longer matches, push it in with null matches so 3575 // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is 3576 // currently only a use-case for Remix HMR where the route tree can change 3577 // at runtime and remove a route previously loaded via a fetcher 3578 if (!fetcherMatches) { 3579 revalidatingFetchers.push({ 3580 key, 3581 routeId: f.routeId, 3582 path: f.path, 3583 matches: null, 3584 match: null, 3585 controller: null 3586 }); 3587 return; 3588 } 3589 // Revalidating fetchers are decoupled from the route matches since they 3590 // load from a static href. They revalidate based on explicit revalidation 3591 // (submission, useRevalidator, or X-Remix-Revalidate) 3592 let fetcher = state.fetchers.get(key); 3593 let fetcherMatch = getTargetMatch(fetcherMatches, f.path); 3594 let shouldRevalidate = false; 3595 if (fetchRedirectIds.has(key)) { 3596 // Never trigger a revalidation of an actively redirecting fetcher 3597 shouldRevalidate = false; 3598 } else if (cancelledFetcherLoads.includes(key)) { 3599 // Always revalidate if the fetcher was cancelled 3600 shouldRevalidate = true; 3601 } else if (fetcher && fetcher.state !== "idle" && fetcher.data === undefined) { 3602 // If the fetcher hasn't ever completed loading yet, then this isn't a 3603 // revalidation, it would just be a brand new load if an explicit 3604 // revalidation is required 3605 shouldRevalidate = isRevalidationRequired; 3606 } else { 3607 // Otherwise fall back on any user-defined shouldRevalidate, defaulting 3608 // to explicit revalidations only 3609 shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends$3({ 3610 currentUrl, 3611 currentParams: state.matches[state.matches.length - 1].params, 3612 nextUrl, 3613 nextParams: matches[matches.length - 1].params 3614 }, submission, { 3615 actionResult, 3616 actionStatus, 3617 defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired 3618 })); 3619 } 3620 if (shouldRevalidate) { 3621 revalidatingFetchers.push({ 3622 key, 3623 routeId: f.routeId, 3624 path: f.path, 3625 matches: fetcherMatches, 3626 match: fetcherMatch, 3627 controller: new AbortController() 3628 }); 3629 } 3630 }); 3631 return [navigationMatches, revalidatingFetchers]; 3632} 3633function isNewLoader(currentLoaderData, currentMatch, match) { 3634 let isNew = 3635 // [a] -> [a, b] 3636 !currentMatch || 3637 // [a, b] -> [a, c] 3638 match.route.id !== currentMatch.route.id; 3639 // Handle the case that we don't have data for a re-used route, potentially 3640 // from a prior error or from a cancelled pending deferred 3641 let isMissingData = currentLoaderData[match.route.id] === undefined; 3642 // Always load if this is a net-new route or we don't yet have data 3643 return isNew || isMissingData; 3644} 3645function isNewRouteInstance(currentMatch, match) { 3646 let currentPath = currentMatch.route.path; 3647 return ( 3648 // param change for this match, /users/123 -> /users/456 3649 currentMatch.pathname !== match.pathname || 3650 // splat param changed, which is not present in match.path 3651 // e.g. /files/images/avatar.jpg -> files/finances.xls 3652 currentPath != null && currentPath.endsWith("*") && currentMatch.params["*"] !== match.params["*"] 3653 ); 3654} 3655function shouldRevalidateLoader(loaderMatch, arg) { 3656 if (loaderMatch.route.shouldRevalidate) { 3657 let routeChoice = loaderMatch.route.shouldRevalidate(arg); 3658 if (typeof routeChoice === "boolean") { 3659 return routeChoice; 3660 } 3661 } 3662 return arg.defaultShouldRevalidate; 3663} 3664/** 3665 * Idempotent utility to execute patchRoutesOnMiss() to lazily load route 3666 * definitions and update the routes/routeManifest 3667 */ 3668async function loadLazyRouteChildren(patchRoutesOnMissImpl, path, matches, routes, manifest, mapRouteProperties, pendingRouteChildren, signal) { 3669 let key = [path, ...matches.map(m => m.route.id)].join("-"); 3670 try { 3671 let pending = pendingRouteChildren.get(key); 3672 if (!pending) { 3673 pending = patchRoutesOnMissImpl({ 3674 path, 3675 matches, 3676 patch: (routeId, children) => { 3677 if (!signal.aborted) { 3678 patchRoutesImpl(routeId, children, routes, manifest, mapRouteProperties); 3679 } 3680 } 3681 }); 3682 pendingRouteChildren.set(key, pending); 3683 } 3684 if (pending && isPromise(pending)) { 3685 await pending; 3686 } 3687 } finally { 3688 pendingRouteChildren.delete(key); 3689 } 3690} 3691function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) { 3692 if (routeId) { 3693 var _route$children; 3694 let route = manifest[routeId]; 3695 invariant$1(route, "No route found to patch children into: routeId = " + routeId); 3696 let dataChildren = convertRoutesToDataRoutes(children, mapRouteProperties, [routeId, "patch", String(((_route$children = route.children) == null ? void 0 : _route$children.length) || "0")], manifest); 3697 if (route.children) { 3698 route.children.push(...dataChildren); 3699 } else { 3700 route.children = dataChildren; 3701 } 3702 } else { 3703 let dataChildren = convertRoutesToDataRoutes(children, mapRouteProperties, ["patch", String(routesToUse.length || "0")], manifest); 3704 routesToUse.push(...dataChildren); 3705 } 3706} 3707/** 3708 * Execute route.lazy() methods to lazily load route modules (loader, action, 3709 * shouldRevalidate) and update the routeManifest in place which shares objects 3710 * with dataRoutes so those get updated as well. 3711 */ 3712async function loadLazyRouteModule(route, mapRouteProperties, manifest) { 3713 if (!route.lazy) { 3714 return; 3715 } 3716 let lazyRoute = await route.lazy(); 3717 // If the lazy route function was executed and removed by another parallel 3718 // call then we can return - first lazy() to finish wins because the return 3719 // value of lazy is expected to be static 3720 if (!route.lazy) { 3721 return; 3722 } 3723 let routeToUpdate = manifest[route.id]; 3724 invariant$1(routeToUpdate, "No route found in manifest"); 3725 // Update the route in place. This should be safe because there's no way 3726 // we could yet be sitting on this route as we can't get there without 3727 // resolving lazy() first. 3728 // 3729 // This is different than the HMR "update" use-case where we may actively be 3730 // on the route being updated. The main concern boils down to "does this 3731 // mutation affect any ongoing navigations or any current state.matches 3732 // values?". If not, it should be safe to update in place. 3733 let routeUpdates = {}; 3734 for (let lazyRouteProperty in lazyRoute) { 3735 let staticRouteValue = routeToUpdate[lazyRouteProperty]; 3736 let isPropertyStaticallyDefined = staticRouteValue !== undefined && 3737 // This property isn't static since it should always be updated based 3738 // on the route updates 3739 lazyRouteProperty !== "hasErrorBoundary"; 3740 warning(!isPropertyStaticallyDefined, "Route \"" + routeToUpdate.id + "\" has a static property \"" + lazyRouteProperty + "\" " + "defined but its lazy function is also returning a value for this property. " + ("The lazy route property \"" + lazyRouteProperty + "\" will be ignored.")); 3741 if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) { 3742 routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty]; 3743 } 3744 } 3745 // Mutate the route with the provided updates. Do this first so we pass 3746 // the updated version to mapRouteProperties 3747 Object.assign(routeToUpdate, routeUpdates); 3748 // Mutate the `hasErrorBoundary` property on the route based on the route 3749 // updates and remove the `lazy` function so we don't resolve the lazy 3750 // route again. 3751 Object.assign(routeToUpdate, _extends$3({}, mapRouteProperties(routeToUpdate), { 3752 lazy: undefined 3753 })); 3754} 3755// Default implementation of `dataStrategy` which fetches all loaders in parallel 3756function defaultDataStrategy(opts) { 3757 return Promise.all(opts.matches.map(m => m.resolve())); 3758} 3759async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext) { 3760 let routeIdsToLoad = matchesToLoad.reduce((acc, m) => acc.add(m.route.id), new Set()); 3761 let loadedMatches = new Set(); 3762 // Send all matches here to allow for a middleware-type implementation. 3763 // handler will be a no-op for unneeded routes and we filter those results 3764 // back out below. 3765 let results = await dataStrategyImpl({ 3766 matches: matches.map(match => { 3767 let shouldLoad = routeIdsToLoad.has(match.route.id); 3768 // `resolve` encapsulates the route.lazy, executing the 3769 // loader/action, and mapping return values/thrown errors to a 3770 // HandlerResult. Users can pass a callback to take fine-grained control 3771 // over the execution of the loader/action 3772 let resolve = handlerOverride => { 3773 loadedMatches.add(match.route.id); 3774 return shouldLoad ? callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, requestContext) : Promise.resolve({ 3775 type: ResultType.data, 3776 result: undefined 3777 }); 3778 }; 3779 return _extends$3({}, match, { 3780 shouldLoad, 3781 resolve 3782 }); 3783 }), 3784 request, 3785 params: matches[0].params, 3786 context: requestContext 3787 }); 3788 // Throw if any loadRoute implementations not called since they are what 3789 // ensures a route is fully loaded
3790 matches.forEach(m => invariant$1(loadedMatches.has(m.route.id), "`match.resolve()` was not called for route id \"" + m.route.id + "\". " + "You must call `match.resolve()` on every match passed to " + "`dataStrategy` to ensure all routes are properly loaded.")); 3791 // Filter out any middleware-only matches for which we didn't need to run handlers 3792 return results.filter((_, i) => routeIdsToLoad.has(matches[i].route.id)); 3793} 3794// Default logic for calling a loader/action is the user has no specified a dataStrategy 3795async function callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, staticContext) { 3796 let result; 3797 let onReject; 3798 let runHandler = handler => { 3799 // Setup a promise we can race against so that abort signals short circuit 3800 let reject; 3801 // This will never resolve so safe to type it as Promise<HandlerResult> to 3802 // satisfy the function return value 3803 let abortPromise = new Promise((_, r) => reject = r); 3804 onReject = () => reject(); 3805 request.signal.addEventListener("abort", onReject); 3806 let actualHandler = ctx => { 3807 if (typeof handler !== "function") { 3808 return Promise.reject(new Error("You cannot call the handler for a route which defines a boolean " + ("\"" + type + "\" [routeId: " + match.route.id + "]"))); 3809 } 3810 return handler({ 3811 request, 3812 params: match.params, 3813 context: staticContext 3814 }, ...(ctx !== undefined ? [ctx] : [])); 3815 }; 3816 let handlerPromise; 3817 if (handlerOverride) { 3818 handlerPromise = handlerOverride(ctx => actualHandler(ctx)); 3819 } else { 3820 handlerPromise = (async () => { 3821 try { 3822 let val = await actualHandler(); 3823 return { 3824 type: "data", 3825 result: val 3826 }; 3827 } catch (e) { 3828 return { 3829 type: "error", 3830 result: e 3831 }; 3832 } 3833 })(); 3834 } 3835 return Promise.race([handlerPromise, abortPromise]); 3836 }; 3837 try { 3838 let handler = match.route[type]; 3839 if (match.route.lazy) { 3840 if (handler) { 3841 // Run statically defined handler in parallel with lazy() 3842 let handlerError; 3843 let [value] = await Promise.all([ 3844 // If the handler throws, don't let it immediately bubble out, 3845 // since we need to let the lazy() execution finish so we know if this 3846 // route has a boundary that can handle the error 3847 runHandler(handler).catch(e => { 3848 handlerError = e; 3849 }), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]); 3850 if (handlerError !== undefined) { 3851 throw handlerError; 3852 } 3853 result = value; 3854 } else { 3855 // Load lazy route module, then run any returned handler 3856 await loadLazyRouteModule(match.route, mapRouteProperties, manifest); 3857 handler = match.route[type]; 3858 if (handler) { 3859 // Handler still runs even if we got interrupted to maintain consistency 3860 // with un-abortable behavior of handler execution on non-lazy or 3861 // previously-lazy-loaded routes 3862 result = await runHandler(handler); 3863 } else if (type === "action") { 3864 let url = new URL(request.url); 3865 let pathname = url.pathname + url.search; 3866 throw getInternalRouterError(405, { 3867 method: request.method, 3868 pathname, 3869 routeId: match.route.id 3870 }); 3871 } else { 3872 // lazy() route has no loader to run. Short circuit here so we don't 3873 // hit the invariant below that errors on returning undefined. 3874 return { 3875 type: ResultType.data, 3876 result: undefined 3877 }; 3878 } 3879 } 3880 } else if (!handler) { 3881 let url = new URL(request.url); 3882 let pathname = url.pathname + url.search; 3883 throw getInternalRouterError(404, { 3884 pathname 3885 }); 3886 } else { 3887 result = await runHandler(handler); 3888 } 3889 invariant$1(result.result !== undefined, "You defined " + (type === "action" ? "an action" : "a loader") + " for route " + ("\"" + match.route.id + "\" but didn't return anything from your `" + type + "` ") + "function. Please return a value or `null`."); 3890 } catch (e) {
vendor: 23,972 bytes, lines 3891-4592
3891 // We should already be catching and converting normal handler executions to 3892 // HandlerResults and returning them, so anything that throws here is an 3893 // unexpected error we still need to wrap 3894 return { 3895 type: ResultType.error, 3896 result: e 3897 }; 3898 } finally { 3899 if (onReject) { 3900 request.signal.removeEventListener("abort", onReject); 3901 } 3902 } 3903 return result; 3904} 3905async function convertHandlerResultToDataResult(handlerResult) { 3906 let { 3907 result, 3908 type, 3909 status 3910 } = handlerResult; 3911 if (isResponse$1(result)) { 3912 let data; 3913 try { 3914 let contentType = result.headers.get("Content-Type"); 3915 // Check between word boundaries instead of startsWith() due to the last 3916 // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type 3917 if (contentType && /\bapplication\/json\b/.test(contentType)) { 3918 if (result.body == null) { 3919 data = null; 3920 } else { 3921 data = await result.json(); 3922 } 3923 } else { 3924 data = await result.text(); 3925 } 3926 } catch (e) { 3927 return { 3928 type: ResultType.error, 3929 error: e 3930 }; 3931 } 3932 if (type === ResultType.error) { 3933 return { 3934 type: ResultType.error, 3935 error: new ErrorResponseImpl(result.status, result.statusText, data), 3936 statusCode: result.status, 3937 headers: result.headers 3938 }; 3939 } 3940 return { 3941 type: ResultType.data, 3942 data, 3943 statusCode: result.status, 3944 headers: result.headers 3945 }; 3946 } 3947 if (type === ResultType.error) { 3948 return { 3949 type: ResultType.error, 3950 error: result, 3951 statusCode: isRouteErrorResponse(result) ? result.status : status 3952 }; 3953 } 3954 if (isDeferredData(result)) { 3955 var _result$init, _result$init2; 3956 return { 3957 type: ResultType.deferred, 3958 deferredData: result, 3959 statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status, 3960 headers: ((_result$init2 = result.init) == null ? void 0 : _result$init2.headers) && new Headers(result.init.headers) 3961 }; 3962 } 3963 return { 3964 type: ResultType.data, 3965 data: result, 3966 statusCode: status 3967 }; 3968} 3969// Support relative routing in internal redirects 3970function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) { 3971 let location = response.headers.get("Location"); 3972 invariant$1(location, "Redirects returned/thrown from loaders/actions must have a Location header"); 3973 if (!ABSOLUTE_URL_REGEX$1.test(location)) { 3974 let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1); 3975 location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath); 3976 response.headers.set("Location", location); 3977 } 3978 return response; 3979} 3980function normalizeRedirectLocation(location, currentUrl, basename) { 3981 if (ABSOLUTE_URL_REGEX$1.test(location)) { 3982 // Strip off the protocol+origin for same-origin + same-basename absolute redirects 3983 let normalizedLocation = location; 3984 let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation); 3985 let isSameBasename = stripBasename(url.pathname, basename) != null; 3986 if (url.origin === currentUrl.origin && isSameBasename) { 3987 return url.pathname + url.search + url.hash; 3988 } 3989 } 3990 return location; 3991} 3992// Utility method for creating the Request instances for loaders/actions during 3993// client-side navigations and fetches. During SSR we will always have a 3994// Request instance from the static handler (query/queryRoute) 3995function createClientSideRequest(history, location, signal, submission) { 3996 let url = history.createURL(stripHashFromPath(location)).toString(); 3997 let init = { 3998 signal 3999 }; 4000 if (submission && isMutationMethod(submission.formMethod)) { 4001 let { 4002 formMethod, 4003 formEncType 4004 } = submission; 4005 // Didn't think we needed this but it turns out unlike other methods, patch 4006 // won't be properly normalized to uppercase and results in a 405 error. 4007 // See: https://fetch.spec.whatwg.org/#concept-method 4008 init.method = formMethod.toUpperCase(); 4009 if (formEncType === "application/json") { 4010 init.headers = new Headers({ 4011 "Content-Type": formEncType 4012 }); 4013 init.body = JSON.stringify(submission.json); 4014 } else if (formEncType === "text/plain") { 4015 // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) 4016 init.body = submission.text; 4017 } else if (formEncType === "application/x-www-form-urlencoded" && submission.formData) { 4018 // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) 4019 init.body = convertFormDataToSearchParams(submission.formData); 4020 } else { 4021 // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) 4022 init.body = submission.formData; 4023 } 4024 } 4025 return new Request(url, init); 4026} 4027function convertFormDataToSearchParams(formData) { 4028 let searchParams = new URLSearchParams(); 4029 for (let [key, value] of formData.entries()) { 4030 // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs 4031 searchParams.append(key, typeof value === "string" ? value : value.name); 4032 } 4033 return searchParams; 4034} 4035function convertSearchParamsToFormData(searchParams) { 4036 let formData = new FormData(); 4037 for (let [key, value] of searchParams.entries()) { 4038 formData.append(key, value); 4039 } 4040 return formData; 4041} 4042function processRouteLoaderData(matches, matchesToLoad, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) { 4043 // Fill in loaderData/errors from our loaders 4044 let loaderData = {}; 4045 let errors = null; 4046 let statusCode; 4047 let foundError = false; 4048 let loaderHeaders = {}; 4049 let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined; 4050 // Process loader results into state.loaderData/state.errors 4051 results.forEach((result, index) => { 4052 let id = matchesToLoad[index].route.id; 4053 invariant$1(!isRedirectResult(result), "Cannot handle redirect results in processLoaderData"); 4054 if (isErrorResult(result)) { 4055 let error = result.error; 4056 // If we have a pending action error, we report it at the highest-route 4057 // that throws a loader error, and then clear it out to indicate that 4058 // it was consumed 4059 if (pendingError !== undefined) { 4060 error = pendingError; 4061 pendingError = undefined; 4062 } 4063 errors = errors || {}; 4064 { 4065 // Look upwards from the matched route for the closest ancestor error 4066 // boundary, defaulting to the root match. Prefer higher error values 4067 // if lower errors bubble to the same boundary 4068 let boundaryMatch = findNearestBoundary(matches, id); 4069 if (errors[boundaryMatch.route.id] == null) { 4070 errors[boundaryMatch.route.id] = error; 4071 } 4072 } 4073 // Clear our any prior loaderData for the throwing route 4074 loaderData[id] = undefined; 4075 // Once we find our first (highest) error, we set the status code and 4076 // prevent deeper status codes from overriding 4077 if (!foundError) { 4078 foundError = true; 4079 statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500; 4080 } 4081 if (result.headers) { 4082 loaderHeaders[id] = result.headers; 4083 } 4084 } else { 4085 if (isDeferredResult(result)) { 4086 activeDeferreds.set(id, result.deferredData); 4087 loaderData[id] = result.deferredData.data; 4088 // Error status codes always override success status codes, but if all 4089 // loaders are successful we take the deepest status code. 4090 if (result.statusCode != null && result.statusCode !== 200 && !foundError) { 4091 statusCode = result.statusCode; 4092 } 4093 if (result.headers) { 4094 loaderHeaders[id] = result.headers; 4095 } 4096 } else { 4097 loaderData[id] = result.data; 4098 // Error status codes always override success status codes, but if all 4099 // loaders are successful we take the deepest status code. 4100 if (result.statusCode && result.statusCode !== 200 && !foundError) { 4101 statusCode = result.statusCode; 4102 } 4103 if (result.headers) { 4104 loaderHeaders[id] = result.headers; 4105 } 4106 } 4107 } 4108 }); 4109 // If we didn't consume the pending action error (i.e., all loaders 4110 // resolved), then consume it here. Also clear out any loaderData for the 4111 // throwing route 4112 if (pendingError !== undefined && pendingActionResult) { 4113 errors = { 4114 [pendingActionResult[0]]: pendingError 4115 }; 4116 loaderData[pendingActionResult[0]] = undefined; 4117 } 4118 return { 4119 loaderData, 4120 errors, 4121 statusCode: statusCode || 200, 4122 loaderHeaders 4123 }; 4124} 4125function processLoaderData(state, matches, matchesToLoad, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) { 4126 let { 4127 loaderData, 4128 errors 4129 } = processRouteLoaderData(matches, matchesToLoad, results, pendingActionResult, activeDeferreds); 4130 // Process results from our revalidating fetchers 4131 for (let index = 0; index < revalidatingFetchers.length; index++) { 4132 let { 4133 key, 4134 match, 4135 controller 4136 } = revalidatingFetchers[index]; 4137 invariant$1(fetcherResults !== undefined && fetcherResults[index] !== undefined, "Did not find corresponding fetcher result"); 4138 let result = fetcherResults[index]; 4139 // Process fetcher non-redirect errors 4140 if (controller && controller.signal.aborted) { 4141 // Nothing to do for aborted fetchers 4142 continue; 4143 } else if (isErrorResult(result)) { 4144 let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id); 4145 if (!(errors && errors[boundaryMatch.route.id])) { 4146 errors = _extends$3({}, errors, { 4147 [boundaryMatch.route.id]: result.error 4148 }); 4149 } 4150 state.fetchers.delete(key); 4151 } else if (isRedirectResult(result)) { 4152 // Should never get here, redirects should get processed above, but we 4153 // keep this to type narrow to a success result in the else 4154 invariant$1(false, "Unhandled fetcher revalidation redirect"); 4155 } else if (isDeferredResult(result)) { 4156 // Should never get here, deferred data should be awaited for fetchers 4157 // in resolveDeferredResults 4158 invariant$1(false, "Unhandled fetcher deferred data"); 4159 } else { 4160 let doneFetcher = getDoneFetcher(result.data); 4161 state.fetchers.set(key, doneFetcher); 4162 } 4163 } 4164 return { 4165 loaderData, 4166 errors 4167 }; 4168} 4169function mergeLoaderData(loaderData, newLoaderData, matches, errors) { 4170 let mergedLoaderData = _extends$3({}, newLoaderData); 4171 for (let match of matches) { 4172 let id = match.route.id; 4173 if (newLoaderData.hasOwnProperty(id)) { 4174 if (newLoaderData[id] !== undefined) { 4175 mergedLoaderData[id] = newLoaderData[id]; 4176 } 4177 } else if (loaderData[id] !== undefined && match.route.loader) { 4178 // Preserve existing keys not included in newLoaderData and where a loader 4179 // wasn't removed by HMR 4180 mergedLoaderData[id] = loaderData[id]; 4181 } 4182 if (errors && errors.hasOwnProperty(id)) { 4183 // Don't keep any loader data below the boundary 4184 break; 4185 } 4186 } 4187 return mergedLoaderData; 4188} 4189function getActionDataForCommit(pendingActionResult) { 4190 if (!pendingActionResult) { 4191 return {}; 4192 } 4193 return isErrorResult(pendingActionResult[1]) ? { 4194 // Clear out prior actionData on errors 4195 actionData: {} 4196 } : { 4197 actionData: { 4198 [pendingActionResult[0]]: pendingActionResult[1].data 4199 } 4200 }; 4201} 4202// Find the nearest error boundary, looking upwards from the leaf route (or the 4203// route specified by routeId) for the closest ancestor error boundary, 4204// defaulting to the root match 4205function findNearestBoundary(matches, routeId) { 4206 let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches]; 4207 return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0]; 4208} 4209function getShortCircuitMatches(routes) { 4210 // Prefer a root layout route if present, otherwise shim in a route object 4211 let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === "/") || { 4212 id: "__shim-error-route__" 4213 }; 4214 return { 4215 matches: [{ 4216 params: {}, 4217 pathname: "", 4218 pathnameBase: "", 4219 route 4220 }], 4221 route 4222 }; 4223} 4224function getInternalRouterError(status, _temp5) { 4225 let { 4226 pathname, 4227 routeId, 4228 method, 4229 type, 4230 message 4231 } = _temp5 === void 0 ? {} : _temp5; 4232 let statusText = "Unknown Server Error"; 4233 let errorMessage = "Unknown @remix-run/router error"; 4234 if (status === 400) { 4235 statusText = "Bad Request"; 4236 if (type === "route-discovery") { 4237 errorMessage = "Unable to match URL \"" + pathname + "\" - the `unstable_patchRoutesOnMiss()` " + ("function threw the following error:\n" + message); 4238 } else if (method && pathname && routeId) { 4239 errorMessage = "You made a " + method + " request to \"" + pathname + "\" but " + ("did not provide a `loader` for route \"" + routeId + "\", ") + "so there is no way to handle the request."; 4240 } else if (type === "defer-action") { 4241 errorMessage = "defer() is not supported in actions"; 4242 } else if (type === "invalid-body") { 4243 errorMessage = "Unable to encode submission body"; 4244 } 4245 } else if (status === 403) { 4246 statusText = "Forbidden"; 4247 errorMessage = "Route \"" + routeId + "\" does not match URL \"" + pathname + "\""; 4248 } else if (status === 404) { 4249 statusText = "Not Found"; 4250 errorMessage = "No route matches URL \"" + pathname + "\""; 4251 } else if (status === 405) { 4252 statusText = "Method Not Allowed"; 4253 if (method && pathname && routeId) { 4254 errorMessage = "You made a " + method.toUpperCase() + " request to \"" + pathname + "\" but " + ("did not provide an `action` for route \"" + routeId + "\", ") + "so there is no way to handle the request."; 4255 } else if (method) { 4256 errorMessage = "Invalid request method \"" + method.toUpperCase() + "\""; 4257 } 4258 } 4259 return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true); 4260} 4261// Find any returned redirect errors, starting from the lowest match 4262function findRedirect(results) { 4263 for (let i = results.length - 1; i >= 0; i--) { 4264 let result = results[i]; 4265 if (isRedirectResult(result)) { 4266 return { 4267 result, 4268 idx: i 4269 }; 4270 } 4271 } 4272} 4273function stripHashFromPath(path) { 4274 let parsedPath = typeof path === "string" ? parsePath(path) : path; 4275 return createPath(_extends$3({}, parsedPath, { 4276 hash: "" 4277 })); 4278} 4279function isHashChangeOnly(a, b) { 4280 if (a.pathname !== b.pathname || a.search !== b.search) { 4281 return false; 4282 } 4283 if (a.hash === "") { 4284 // /page -> /page#hash 4285 return b.hash !== ""; 4286 } else if (a.hash === b.hash) { 4287 // /page#hash -> /page#hash 4288 return true; 4289 } else if (b.hash !== "") { 4290 // /page#hash -> /page#other 4291 return true; 4292 } 4293 // If the hash is removed the browser will re-perform a request to the server 4294 // /page#hash -> /page 4295 return false; 4296} 4297function isPromise(val) { 4298 return typeof val === "object" && val != null && "then" in val; 4299} 4300function isRedirectHandlerResult(result) { 4301 return isResponse$1(result.result) && redirectStatusCodes.has(result.result.status); 4302} 4303function isDeferredResult(result) { 4304 return result.type === ResultType.deferred; 4305} 4306function isErrorResult(result) { 4307 return result.type === ResultType.error; 4308} 4309function isRedirectResult(result) { 4310 return (result && result.type) === ResultType.redirect; 4311} 4312function isDeferredData(value) { 4313 let deferred = value; 4314 return deferred && typeof deferred === "object" && typeof deferred.data === "object" && typeof deferred.subscribe === "function" && typeof deferred.cancel === "function" && typeof deferred.resolveData === "function"; 4315} 4316function isResponse$1(value) { 4317 return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined"; 4318} 4319function isValidMethod(method) { 4320 return validRequestMethods.has(method.toLowerCase()); 4321} 4322function isMutationMethod(method) { 4323 return validMutationMethods.has(method.toLowerCase()); 4324} 4325async function resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) { 4326 for (let index = 0; index < results.length; index++) { 4327 let result = results[index]; 4328 let match = matchesToLoad[index]; 4329 // If we don't have a match, then we can have a deferred result to do 4330 // anything with. This is for revalidating fetchers where the route was 4331 // removed during HMR 4332 if (!match) { 4333 continue; 4334 } 4335 let currentMatch = currentMatches.find(m => m.route.id === match.route.id); 4336 let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined; 4337 if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) { 4338 // Note: we do not have to touch activeDeferreds here since we race them 4339 // against the signal in resolveDeferredData and they'll get aborted 4340 // there if needed 4341 let signal = signals[index]; 4342 invariant$1(signal, "Expected an AbortSignal for revalidating fetcher deferred result"); 4343 await resolveDeferredData(result, signal, isFetcher).then(result => { 4344 if (result) { 4345 results[index] = result || results[index]; 4346 } 4347 }); 4348 } 4349 } 4350} 4351async function resolveDeferredData(result, signal, unwrap) { 4352 if (unwrap === void 0) { 4353 unwrap = false; 4354 } 4355 let aborted = await result.deferredData.resolveData(signal); 4356 if (aborted) { 4357 return; 4358 } 4359 if (unwrap) { 4360 try { 4361 return { 4362 type: ResultType.data, 4363 data: result.deferredData.unwrappedData 4364 }; 4365 } catch (e) { 4366 // Handle any TrackedPromise._error values encountered while unwrapping 4367 return { 4368 type: ResultType.error, 4369 error: e 4370 }; 4371 } 4372 } 4373 return { 4374 type: ResultType.data, 4375 data: result.deferredData.data 4376 }; 4377} 4378function hasNakedIndexQuery(search) { 4379 return new URLSearchParams(search).getAll("index").some(v => v === ""); 4380} 4381function getTargetMatch(matches, location) { 4382 let search = typeof location === "string" ? parsePath(location).search : location.search; 4383 if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) { 4384 // Return the leaf index route when index is present 4385 return matches[matches.length - 1]; 4386 } 4387 // Otherwise grab the deepest "path contributing" match (ignoring index and 4388 // pathless layout routes) 4389 let pathMatches = getPathContributingMatches(matches); 4390 return pathMatches[pathMatches.length - 1]; 4391} 4392function getSubmissionFromNavigation(navigation) { 4393 let { 4394 formMethod, 4395 formAction, 4396 formEncType, 4397 text, 4398 formData, 4399 json 4400 } = navigation; 4401 if (!formMethod || !formAction || !formEncType) { 4402 return; 4403 } 4404 if (text != null) { 4405 return { 4406 formMethod, 4407 formAction, 4408 formEncType, 4409 formData: undefined, 4410 json: undefined, 4411 text 4412 }; 4413 } else if (formData != null) { 4414 return { 4415 formMethod, 4416 formAction, 4417 formEncType, 4418 formData, 4419 json: undefined, 4420 text: undefined 4421 }; 4422 } else if (json !== undefined) { 4423 return { 4424 formMethod, 4425 formAction, 4426 formEncType, 4427 formData: undefined, 4428 json, 4429 text: undefined 4430 }; 4431 } 4432} 4433function getLoadingNavigation(location, submission) { 4434 if (submission) { 4435 let navigation = { 4436 state: "loading", 4437 location, 4438 formMethod: submission.formMethod, 4439 formAction: submission.formAction, 4440 formEncType: submission.formEncType, 4441 formData: submission.formData, 4442 json: submission.json, 4443 text: submission.text 4444 }; 4445 return navigation; 4446 } else { 4447 let navigation = { 4448 state: "loading", 4449 location, 4450 formMethod: undefined, 4451 formAction: undefined, 4452 formEncType: undefined, 4453 formData: undefined, 4454 json: undefined, 4455 text: undefined 4456 }; 4457 return navigation; 4458 } 4459} 4460function getSubmittingNavigation(location, submission) { 4461 let navigation = { 4462 state: "submitting", 4463 location, 4464 formMethod: submission.formMethod, 4465 formAction: submission.formAction, 4466 formEncType: submission.formEncType, 4467 formData: submission.formData, 4468 json: submission.json, 4469 text: submission.text 4470 }; 4471 return navigation; 4472} 4473function getLoadingFetcher(submission, data) { 4474 if (submission) { 4475 let fetcher = { 4476 state: "loading", 4477 formMethod: submission.formMethod, 4478 formAction: submission.formAction, 4479 formEncType: submission.formEncType, 4480 formData: submission.formData, 4481 json: submission.json, 4482 text: submission.text, 4483 data 4484 }; 4485 return fetcher; 4486 } else { 4487 let fetcher = { 4488 state: "loading", 4489 formMethod: undefined, 4490 formAction: undefined, 4491 formEncType: undefined, 4492 formData: undefined, 4493 json: undefined, 4494 text: undefined, 4495 data 4496 }; 4497 return fetcher; 4498 } 4499} 4500function getSubmittingFetcher(submission, existingFetcher) { 4501 let fetcher = { 4502 state: "submitting", 4503 formMethod: submission.formMethod, 4504 formAction: submission.formAction, 4505 formEncType: submission.formEncType, 4506 formData: submission.formData, 4507 json: submission.json, 4508 text: submission.text, 4509 data: existingFetcher ? existingFetcher.data : undefined 4510 }; 4511 return fetcher; 4512} 4513function getDoneFetcher(data) { 4514 let fetcher = { 4515 state: "idle", 4516 formMethod: undefined, 4517 formAction: undefined, 4518 formEncType: undefined, 4519 formData: undefined, 4520 json: undefined, 4521 text: undefined, 4522 data 4523 }; 4524 return fetcher; 4525} 4526function restoreAppliedTransitions(_window, transitions) { 4527 try { 4528 let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY); 4529 if (sessionPositions) { 4530 let json = JSON.parse(sessionPositions); 4531 for (let [k, v] of Object.entries(json || {})) { 4532 if (v && Array.isArray(v)) { 4533 transitions.set(k, new Set(v || [])); 4534 } 4535 } 4536 } 4537 } catch (e) { 4538 // no-op, use default empty object 4539 } 4540} 4541function persistAppliedTransitions(_window, transitions) { 4542 if (transitions.size > 0) { 4543 let json = {}; 4544 for (let [k, v] of transitions) { 4545 json[k] = [...v]; 4546 } 4547 try { 4548 _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json)); 4549 } catch (error) { 4550 warning(false, "Failed to save applied view transitions in sessionStorage (" + error + ")."); 4551 } 4552 } 4553} 4554 4555/** 4556 * React Router v6.25.0 4557 * 4558 * Copyright (c) Remix Software Inc. 4559 * 4560 * This source code is licensed under the MIT license found in the 4561 * LICENSE.md file in the root directory of this source tree. 4562 * 4563 * @license MIT 4564 */ 4565function _extends$2() { 4566 _extends$2 = Object.assign ? Object.assign.bind() : function(target) { 4567 for (var i = 1; i < arguments.length; i++) { 4568 var source = arguments[i]; 4569 for (var key in source) { 4570 if (Object.prototype.hasOwnProperty.call(source, key)) { 4571 target[key] = source[key]; 4572 } 4573 } 4574 } 4575 return target; 4576 }; 4577 return _extends$2.apply(this, arguments); 4578} 4579const DataRouterContext = /* @__PURE__ */ reactExports.createContext(null); 4580const DataRouterStateContext = /* @__PURE__ */ reactExports.createContext(null); 4581const NavigationContext = /* @__PURE__ */ reactExports.createContext(null); 4582const LocationContext = /* @__PURE__ */ reactExports.createContext(null); 4583const RouteContext = /* @__PURE__ */ reactExports.createContext({ 4584 outlet: null, 4585 matches: [], 4586 isDataRoute: false 4587}); 4588const RouteErrorContext = /* @__PURE__ */ reactExports.createContext(null); 4589function useHref(to, _temp) { 4590 let { 4591 relative 4592 } = _temp === void 0 ? {}
4592 : _temp; 4593 !useInRouterContext() ? invariant$1(false) : void 0; 4594 let { 4595 basename, 4596 navigator 4597 } = reactExports.useContext(NavigationContext); 4598 let { 4599 hash, 4600 pathname, 4601 search 4602 } = useResolvedPath(to, { 4603 relative 4604 }); 4605 let joinedPathname = pathname; 4606 if (basename !== "/") { 4607 joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]); 4608 } 4609 return navigator.createHref({ 4610 pathname: joinedPathname, 4611 search, 4612 hash 4613 }); 4614} 4615function useInRouterContext() { 4616 return reactExports.useContext(LocationContext) != null; 4617} 4618function useLocation() { 4619 !useInRouterContext() ? invariant$1(false) : void 0; 4620 return reactExports.useContext(LocationContext).location; 4621} 4622function useIsomorphicLayoutEffect$1(cb) { 4623 let isStatic = reactExports.useContext(NavigationContext).static; 4624 if (!isStatic) { 4625 reactExports.useLayoutEffect(cb); 4626 } 4627} 4628function useNavigate() { 4629 let { 4630 isDataRoute 4631 } = reactExports.useContext(RouteContext); 4632 return isDataRoute ? useNavigateStable() : useNavigateUnstable(); 4633} 4634function useNavigateUnstable() { 4635 !useInRouterContext() ? invariant$1(false) : void 0; 4636 let dataRouterContext = reactExports.useContext(DataRouterContext); 4637 let { 4638 basename, 4639 future, 4640 navigator 4641 } = reactExports.useContext(NavigationContext); 4642 let { 4643 matches 4644 } = reactExports.useContext(RouteContext); 4645 let { 4646 pathname: locationPathname 4647 } = useLocation(); 4648 let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath)); 4649 let activeRef = reactExports.useRef(false); 4650 useIsomorphicLayoutEffect$1(() => { 4651 activeRef.current = true; 4652 }); 4653 let navigate = reactExports.useCallback(function(to, options) { 4654 if (options === void 0) { 4655 options = {}; 4656 } 4657 if (!activeRef.current) return; 4658 if (typeof to === "number") { 4659 navigator.go(to); 4660 return; 4661 } 4662 let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path"); 4663 if (dataRouterContext == null && basename !== "/") { 4664 path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); 4665 } 4666 (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options); 4667 }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]); 4668 return navigate; 4669} 4670const OutletContext = /* @__PURE__ */ reactExports.createContext(null); 4671function useOutlet(context) { 4672 let outlet = reactExports.useContext(RouteContext).outlet; 4673 if (outlet) { 4674 return /* @__PURE__ */ reactExports.createElement(OutletContext.Provider, { 4675 value: context 4676 }, outlet); 4677 } 4678 return outlet; 4679} 4680function useParams() { 4681 let { 4682 matches 4683 } = reactExports.useContext(RouteContext); 4684 let routeMatch = matches[matches.length - 1]; 4685 return routeMatch ? routeMatch.params : {}; 4686} 4687function useResolvedPath(to, _temp2) { 4688 let { 4689 relative 4690 } = _temp2 === void 0 ? {} : _temp2; 4691 let { 4692 future 4693 } = reactExports.useContext(NavigationContext); 4694 let { 4695 matches 4696 } = reactExports.useContext(RouteContext); 4697 let { 4698 pathname: locationPathname 4699 } = useLocation(); 4700 let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath)); 4701 return reactExports.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]); 4702} 4703function useRoutesImpl(routes, locationArg, dataRouterState, future) { 4704 !useInRouterContext() ? invariant$1(false) : void 0; 4705 let { 4706 navigator 4707 } = reactExports.useContext(NavigationContext); 4708 let { 4709 matches: parentMatches 4710 } = reactExports.useContext(RouteContext); 4711 let routeMatch = parentMatches[parentMatches.length - 1]; 4712 let parentParams = routeMatch ? routeMatch.params : {}; 4713 routeMatch ? routeMatch.pathname : "/"; 4714 let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/"; 4715 routeMatch && routeMatch.route; 4716 let locationFromContext = useLocation(); 4717 let location; 4718 { 4719 location = locationFromContext; 4720 } 4721 let pathname = location.pathname || "/"; 4722 let remainingPathname = pathname; 4723 if (parentPathnameBase !== "/") { 4724 let parentSegments = parentPathnameBase.replace(/^\//, "").split("/"); 4725 let segments = pathname.replace(/^\//, "").split("/"); 4726 remainingPathname = "/" + segments.slice(parentSegments.length).join("/"); 4727 } 4728 let matches = matchRoutes(routes, { 4729 pathname: remainingPathname 4730 }); 4731 let renderedMatches = _renderMatches(matches && matches.map((match) => Object.assign({}, match, { 4732 params: Object.assign({}
4732, parentParams, match.params), 4733 pathname: joinPaths([ 4734 parentPathnameBase, 4735 // Re-encode pathnames that were decoded inside matchRoutes 4736 navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname 4737 ]), 4738 pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([ 4739 parentPathnameBase, 4740 // Re-encode pathnames that were decoded inside matchRoutes 4741 navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase 4742 ]) 4743 })), parentMatches, dataRouterState, future); 4744 return renderedMatches; 4745} 4746function DefaultErrorComponent() { 4747 let error = useRouteError(); 4748 let message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error); 4749 let stack = error instanceof Error ? error.stack : null; 4750 let lightgrey = "rgba(200,200,200, 0.5)"; 4751 let preStyles = { 4752 padding: "0.5rem", 4753 backgroundColor: lightgrey 4754 }; 4755 let devInfo = null; 4756 return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", { 4757 style: { 4758 fontStyle: "italic" 4759 } 4760 }, message), stack ? /* @__PURE__ */ reactExports.createElement("pre", { 4761 style: preStyles 4762 }, stack) : null, devInfo); 4763} 4764const defaultErrorElement = /* @__PURE__ */ reactExports.createElement(DefaultErrorComponent, null); 4765class RenderErrorBoundary extends reactExports.Component { 4766 constructor(props) { 4767 super(props); 4768 this.state = { 4769 location: props.location, 4770 revalidation: props.revalidation, 4771 error: props.error 4772 }; 4773 } 4774 static getDerivedStateFromError(error) { 4775 return { 4776 error 4777 }; 4778 } 4779 static getDerivedStateFromProps(props, state) { 4780 if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") { 4781 return { 4782 error: props.error, 4783 location: props.location, 4784 revalidation: props.revalidation 4785 }; 4786 } 4787 return { 4788 error: props.error !== void 0 ? props.error : state.error, 4789 location: state.location, 4790 revalidation: props.revalidation || state.revalidation 4791 }; 4792 } 4793 componentDidCatch(error, errorInfo) { 4794 console.error("React Router caught the following error during render", error, errorInfo); 4795 } 4796 render() { 4797 return this.state.error !== void 0 ? /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, { 4798 value: this.props.routeContext 4799 }, /* @__PURE__ */ reactExports.createElement(RouteErrorContext.Provider, { 4800 value: this.state.error, 4801 children: this.props.component 4802 })) : this.props.children; 4803 } 4804} 4805function RenderedRoute(_ref) { 4806 let { 4807 routeContext, 4808 match, 4809 children 4810 } = _ref; 4811 let dataRouterContext = reactExports.useContext(DataRouterContext); 4812 if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) { 4813 dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id; 4814 } 4815 return /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, { 4816 value: routeContext 4817 }, children); 4818} 4819function _renderMatches(matches, parentMatches, dataRouterState, future) { 4820 var _dataRouterState2; 4821 if (parentMatches === void 0) { 4822 parentMatches = []; 4823 } 4824 if (dataRouterState === void 0) { 4825 dataRouterState = null; 4826 } 4827 if (future === void 0) { 4828 future = null; 4829 } 4830 if (matches == null) { 4831 var _dataRouterState; 4832 if ((_dataRouterState = dataRouterState) != null && _dataRouterState.errors) { 4833 matches = dataRouterState.matches; 4834 } else { 4835 return null; 4836 } 4837 } 4838 let renderedMatches = matches; 4839 let errors = (_dataRouterState2 = dataRouterState) == null ? void 0 : _dataRouterState2.errors; 4840 if (errors != null) { 4841 let errorIndex = renderedMatches.findIndex((m) => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== void 0); 4842 !(errorIndex >= 0) ? invariant$1(false) : void 0; 4843 renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1)); 4844 } 4845 let renderFallback = false;
4846 let fallbackIndex = -1; 4847 if (dataRouterState && future && future.v7_partialHydration) { 4848 for (let i = 0; i < renderedMatches.length; i++) { 4849 let match = renderedMatches[i]; 4850 if (match.route.HydrateFallback || match.route.hydrateFallbackElement) { 4851 fallbackIndex = i; 4852 } 4853 if (match.route.id) { 4854 let { 4855 loaderData, 4856 errors: errors2 4857 } = dataRouterState; 4858 let needsToRunLoader = match.route.loader && loaderData[match.route.id] === void 0 && (!errors2 || errors2[match.route.id] === void 0); 4859 if (match.route.lazy || needsToRunLoader) { 4860 renderFallback = true; 4861 if (fallbackIndex >= 0) { 4862 renderedMatches = renderedMatches.slice(0, fallbackIndex + 1); 4863 } else { 4864 renderedMatches = [renderedMatches[0]]; 4865 } 4866 break; 4867 } 4868 } 4869 } 4870 } 4871 return renderedMatches.reduceRight((outlet, match, index) => { 4872 let error; 4873 let shouldRenderHydrateFallback = false; 4874 let errorElement = null; 4875 let hydrateFallbackElement = null; 4876 if (dataRouterState) { 4877 error = errors && match.route.id ? errors[match.route.id] : void 0; 4878 errorElement = match.route.errorElement || defaultErrorElement; 4879 if (renderFallback) { 4880 if (fallbackIndex < 0 && index === 0) { 4881 warningOnce("route-fallback"); 4882 shouldRenderHydrateFallback = true; 4883 hydrateFallbackElement = null; 4884 } else if (fallbackIndex === index) { 4885 shouldRenderHydrateFallback = true; 4886 hydrateFallbackElement = match.route.hydrateFallbackElement || null; 4887 } 4888 } 4889 } 4890 let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1)); 4891 let getChildren = () => { 4892 let children; 4893 if (error) { 4894 children = errorElement; 4895 } else if (shouldRenderHydrateFallback) { 4896 children = hydrateFallbackElement; 4897 } else if (match.route.Component) { 4898 children = /* @__PURE__ */ reactExports.createElement(match.route.Component, null); 4899 } else if (match.route.element) { 4900 children = match.route.element; 4901 } else { 4902 children = outlet; 4903 } 4904 return /* @__PURE__ */ reactExports.createElement(RenderedRoute, { 4905 match, 4906 routeContext: { 4907 outlet, 4908 matches: matches2, 4909 isDataRoute: dataRouterState != null 4910 }, 4911 children 4912 }); 4913 }; 4914 return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ reactExports.createElement(RenderErrorBoundary, { 4915 location: dataRouterState.location, 4916 revalidation: dataRouterState.revalidation, 4917 component: errorElement, 4918 error, 4919 children: getChildren(), 4920 routeContext: { 4921 outlet: null, 4922 matches: matches2, 4923 isDataRoute: true 4924 } 4925 }) : getChildren(); 4926 }, null); 4927} 4928var DataRouterHook$1 = /* @__PURE__ */ function(DataRouterHook2) { 4929 DataRouterHook2["UseBlocker"] = "useBlocker"; 4930 DataRouterHook2["UseRevalidator"] = "useRevalidator"; 4931 DataRouterHook2["UseNavigateStable"] = "useNavigate"; 4932 return DataRouterHook2; 4933}(DataRouterHook$1 || {}); 4934var DataRouterStateHook$1 = /* @__PURE__ */ function(DataRouterStateHook2) { 4935 DataRouterStateHook2["UseBlocker"] = "useBlocker"; 4936 DataRouterStateHook2["UseLoaderData"] = "useLoaderData"; 4937 DataRouterStateHook2["UseActionData"] = "useActionData"; 4938 DataRouterStateHook2["UseRouteError"] = "useRouteError"; 4939 DataRouterStateHook2["UseNavigation"] = "useNavigation"; 4940 DataRouterStateHook2["UseRouteLoaderData"] = "useRouteLoaderData"; 4941 DataRouterStateHook2["UseMatches"] = "useMatches"; 4942 DataRouterStateHook2["UseRevalidator"] = "useRevalidator"; 4943 DataRouterStateHook2["UseNavigateStable"] = "useNavigate"; 4944 DataRouterStateHook2["UseRouteId"] = "useRouteId"; 4945 return DataRouterStateHook2; 4946}(DataRouterStateHook$1 || {}); 4947function useDataRouterContext$1(hookName) { 4948 let ctx = reactExports.useContext(DataRouterContext); 4949 !ctx ? invariant$1(false) : void 0; 4950 return ctx; 4951} 4952function useDataRouterState(hookName) { 4953 let state = reactExports.useContext(DataRouterStateContext); 4954 !state ? invariant$1(false) : void 0; 4955 return state; 4956} 4957function useRouteContext(hookName) { 4958 let route = reactExports.useContext(RouteContext); 4959 !route ? invariant$1(false) : void 0; 4960 return route; 4961} 4962function useCurrentRouteId(hookName) { 4963 let route = useRouteContext(); 4964 let thisRoute = route.matches[route.matches.length - 1]; 4965 !thisRoute.route.id ? invariant$1(false) : void 0; 4966 return thisRoute.route.id; 4967} 4968function useRouteError() { 4969 var _state$errors; 4970 let error = reactExports.useContext(RouteErrorContext); 4971 let state = useDataRouterState(); 4972 let routeId = useCurrentRouteId(); 4973 if (error !== void 0) { 4974 return error; 4975 } 4976 return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId]; 4977} 4978function useNavigateStable() { 4979 let { 4980 router 4981 } = useDataRouterContext$1(DataRouterHook$1.UseNavigateStable); 4982 let id = useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable); 4983 let activeRef = reactExports.useRef(false); 4984 useIsomorphicLayoutEffect$1(() => { 4985 activeRef.current = true; 4986 }); 4987 let navigate = reactExports.useCallback(function(to, options) { 4988 if (options === void 0) { 4989 options = {}; 4990 } 4991 if (!activeRef.current) return; 4992 if (typeof to === "number") { 4993 router.navigate(to); 4994 } else { 4995 router.navigate(to, _extends$2({ 4996 fromRouteId: id 4997 }, options)); 4998 } 4999 }, [router, id]); 5000 return navigate; 5001} 5002const alreadyWarned = {}; 5003function warningOnce(key, cond, message) { 5004 if (!alreadyWarned[key]) { 5005 alreadyWarned[key] = true; 5006 } 5007} 5008function Navigate(_ref4) { 5009 let { 5010 to, 5011 replace, 5012 state, 5013 relative 5014 } = _ref4; 5015 !useInRouterContext() ? invariant$1(false) : void 0; 5016 let { 5017 future, 5018 static: isStatic 5019 } = reactExports.useContext(NavigationContext); 5020 let { 5021 matches 5022 } = reactExports.useContext(RouteContext); 5023 let { 5024 pathname: locationPathname 5025 } = useLocation(); 5026 let navigate = useNavigate(); 5027 let path = resolveTo(to, getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path"); 5028 let jsonPath = JSON.stringify(path); 5029 reactExports.useEffect(() => navigate(JSON.parse(jsonPath), { 5030 replace, 5031 state, 5032 relative 5033 }), [navigate, jsonPath, relative, replace, state]); 5034 return null; 5035} 5036function Outlet(props) { 5037 return useOutlet(props.context); 5038} 5039function Router(_ref5) { 5040 let { 5041 basename: basenameProp = "/", 5042 children = null, 5043 location: locationProp, 5044 navigationType = Action.Pop, 5045 navigator, 5046 static: staticProp = false, 5047 future 5048 } = _ref5; 5049 !!useInRouterContext() ? invariant$1(false) : void 0; 5050 let basename = basenameProp.replace(/^\/*/, "/"); 5051 let navigationContext = reactExports.useMemo(() => ({ 5052 basename, 5053 navigator, 5054 static: staticProp, 5055 future: _extends$2({
5056 v7_relativeSplatPath: false 5057 }, future) 5058 }), [basename, future, navigator, staticProp]); 5059 if (typeof locationProp === "string") { 5060 locationProp = parsePath(locationProp); 5061 } 5062 let { 5063 pathname = "/", 5064 search = "", 5065 hash = "", 5066 state = null, 5067 key = "default" 5068 } = locationProp; 5069 let locationContext = reactExports.useMemo(() => { 5070 let trailingPathname = stripBasename(pathname, basename); 5071 if (trailingPathname == null) { 5072 return null; 5073 } 5074 return { 5075 location: { 5076 pathname: trailingPathname, 5077 search, 5078 hash, 5079 state, 5080 key 5081 }, 5082 navigationType 5083 }; 5084 }, [basename, pathname, search, hash, state, key, navigationType]); 5085 if (locationContext == null) { 5086 return null; 5087 } 5088 return /* @__PURE__ */ reactExports.createElement(NavigationContext.Provider, { 5089 value: navigationContext 5090 }, /* @__PURE__ */ reactExports.createElement(LocationContext.Provider, { 5091 children, 5092 value: locationContext 5093 })); 5094} 5095new Promise(() => { 5096}); 5097function mapRouteProperties(route) { 5098 let updates = { 5099 // Note: this check also occurs in createRoutesFromChildren so update 5100 // there if you change this -- please and thank you! 5101 hasErrorBoundary: route.ErrorBoundary != null || route.errorElement != null 5102 }; 5103 if (route.Component) { 5104 Object.assign(updates, { 5105 element: /* @__PURE__ */ reactExports.createElement(route.Component), 5106 Component: void 0 5107 }); 5108 } 5109 if (route.HydrateFallback) { 5110 Object.assign(updates, { 5111 hydrateFallbackElement: /* @__PURE__ */ reactExports.createElement(route.HydrateFallback), 5112 HydrateFallback: void 0 5113 }); 5114 } 5115 if (route.ErrorBoundary) { 5116 Object.assign(updates, { 5117 errorElement: /* @__PURE__ */ reactExports.createElement(route.ErrorBoundary), 5118 ErrorBoundary: void 0 5119 }); 5120 } 5121 return updates; 5122} 5123 5124/** 5125 * React Router DOM v6.25.0 5126 * 5127 * Copyright (c) Remix Software Inc. 5128 * 5129 * This source code is licensed under the MIT license found in the 5130 * LICENSE.md file in the root directory of this source tree. 5131 * 5132 * @license MIT 5133 */ 5134function _extends$1() { 5135 _extends$1 = Object.assign ? Object.assign.bind() : function(target) { 5136 for (var i = 1; i < arguments.length; i++) { 5137 var source = arguments[i]; 5138 for (var key in source) { 5139 if (Object.prototype.hasOwnProperty.call(source, key)) { 5140 target[key] = source[key]; 5141 } 5142 } 5143 } 5144 return target; 5145 }; 5146 return _extends$1.apply(this, arguments); 5147} 5148function _objectWithoutPropertiesLoose$2(source, excluded) { 5149 if (source == null) return {}; 5150 var target = {}; 5151 var sourceKeys = Object.keys(source); 5152 var key, i; 5153 for (i = 0; i < sourceKeys.length; i++) { 5154 key = sourceKeys[i]; 5155 if (excluded.indexOf(key) >= 0) continue; 5156 target[key] = source[key]; 5157 } 5158 return target; 5159} 5160function isModifiedEvent(event) { 5161 return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); 5162} 5163function shouldProcessLinkClick(event, target) { 5164 return event.button === 0 && // Ignore everything but left clicks 5165 (!target || target === "_self") && // Let browser handle "target=_blank" etc. 5166 !isModifiedEvent(event); 5167} 5168function createSearchParams(init) { 5169 if (init === void 0) { 5170 init = ""; 5171 } 5172 return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { 5173 let value = init[key]; 5174 return memo.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]); 5175 }, [])); 5176} 5177function getSearchParamsForLocation(locationSearch, defaultSearchParams) { 5178 let searchParams = createSearchParams(locationSearch); 5179 if (defaultSearchParams) { 5180 defaultSearchParams.forEach((_, key) => { 5181 if (!searchParams.has(key)) { 5182 defaultSearchParams.getAll(key).forEach((value) => { 5183 searchParams.append(key, value); 5184 }); 5185 } 5186 }); 5187 } 5188 return searchParams; 5189} 5190const _excluded$8 = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "unstable_viewTransition"], _excluded2$3 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "unstable_viewTransition", "children"]; 5191const REACT_ROUTER_VERSION = "6"; 5192try { 5193 window.__reactRouterVersion = REACT_ROUTER_VERSION; 5194} catch (e) { 5195} 5196function createBrowserRouter(routes, opts) { 5197 return createRouter({ 5198 basename: void 0 , 5199 future: _extends$1({}, void 0 , {
5200 v7_prependBasename: true 5201 }), 5202 history: createBrowserHistory({ 5203 window: void 0 5204 }), 5205 hydrationData: parseHydrationData(), 5206 routes, 5207 mapRouteProperties: mapRouteProperties, 5208 unstable_dataStrategy: void 0 , 5209 unstable_patchRoutesOnMiss: void 0 , 5210 window: void 0 5211 }).initialize(); 5212} 5213function parseHydrationData() { 5214 var _window; 5215 let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData; 5216 if (state && state.errors) { 5217 state = _extends$1({}, state, { 5218 errors: deserializeErrors(state.errors) 5219 }); 5220 } 5221 return state; 5222} 5223function deserializeErrors(errors) { 5224 if (!errors) return null; 5225 let entries = Object.entries(errors); 5226 let serialized = {}; 5227 for (let [key, val] of entries) { 5228 if (val && val.__type === "RouteErrorResponse") { 5229 serialized[key] = new ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true); 5230 } else if (val && val.__type === "Error") { 5231 if (val.__subType) { 5232 let ErrorConstructor = window[val.__subType]; 5233 if (typeof ErrorConstructor === "function") { 5234 try { 5235 let error = new ErrorConstructor(val.message); 5236 error.stack = ""; 5237 serialized[key] = error; 5238 } catch (e) { 5239 } 5240 } 5241 } 5242 if (serialized[key] == null) { 5243 let error = new Error(val.message); 5244 error.stack = ""; 5245 serialized[key] = error; 5246 } 5247 } else { 5248 serialized[key] = val; 5249 } 5250 } 5251 return serialized; 5252} 5253const ViewTransitionContext = /* @__PURE__ */ reactExports.createContext({ 5254 isTransitioning: false 5255}); 5256const FetchersContext = /* @__PURE__ */ reactExports.createContext(/* @__PURE__ */ new Map()); 5257const START_TRANSITION = "startTransition"; 5258const startTransitionImpl = React[START_TRANSITION]; 5259const FLUSH_SYNC = "flushSync"; 5260const flushSyncImpl = ReactDOM$1[FLUSH_SYNC]; 5261function startTransitionSafe(cb) { 5262 if (startTransitionImpl) { 5263 startTransitionImpl(cb); 5264 } else { 5265 cb(); 5266 } 5267} 5268function flushSyncSafe(cb) { 5269 if (flushSyncImpl) { 5270 flushSyncImpl(cb); 5271 } else { 5272 cb(); 5273 } 5274} 5275class Deferred { 5276 constructor() { 5277 this.status = "pending"; 5278 this.promise = new Promise((resolve, reject) => { 5279 this.resolve = (value) => { 5280 if (this.status === "pending") { 5281 this.status = "resolved"; 5282 resolve(value); 5283 } 5284 }; 5285 this.reject = (reason) => { 5286 if (this.status === "pending") { 5287 this.status = "rejected"; 5288 reject(reason); 5289 } 5290 }; 5291 }); 5292 } 5293} 5294function RouterProvider(_ref) { 5295 let { 5296 fallbackElement, 5297 router, 5298 future 5299 } = _ref; 5300 let [state, setStateImpl] = reactExports.useState(router.state); 5301 let [pendingState, setPendingState] = reactExports.useState(); 5302 let [vtContext, setVtContext] = reactExports.useState({ 5303 isTransitioning: false 5304 }); 5305 let [renderDfd, setRenderDfd] = reactExports.useState(); 5306 let [transition, setTransition] = reactExports.useState(); 5307 let [interruption, setInterruption] = reactExports.useState(); 5308 let fetcherData = reactExports.useRef(/* @__PURE__ */ new Map()); 5309 let { 5310 v7_startTransition 5311 } = future || {}; 5312 let optInStartTransition = reactExports.useCallback((cb) => { 5313 if (v7_startTransition) { 5314 startTransitionSafe(cb); 5315 } else { 5316 cb(); 5317 } 5318 }, [v7_startTransition]); 5319 let setState = reactExports.useCallback((newState, _ref2) => { 5320 let { 5321 deletedFetchers, 5322 unstable_flushSync: flushSync, 5323 unstable_viewTransitionOpts: viewTransitionOpts 5324 } = _ref2; 5325 deletedFetchers.forEach((key) => fetcherData.current.delete(key)); 5326 newState.fetchers.forEach((fetcher, key) => { 5327 if (fetcher.data !== void 0) { 5328 fetcherData.current.set(key, fetcher.data); 5329 } 5330 }); 5331 let isViewTransitionUnavailable = router.window == null || router.window.document == null || typeof router.window.document.startViewTransition !== "function"; 5332 if (!viewTransitionOpts || isViewTransitionUnavailable) { 5333 if (flushSync) { 5334 flushSyncSafe(() => setStateImpl(newState)); 5335 } else { 5336 optInStartTransition(() => setStateImpl(newState)); 5337 } 5338 return; 5339 } 5340 if (flushSync) { 5341 flushSyncSafe(() => { 5342 if (transition) { 5343 renderDfd && renderDfd.resolve(); 5344 transition.skipTransition(); 5345 } 5346 setVtContext({ 5347 isTransitioning: true, 5348 flushSync: true, 5349 currentLocation: viewTransitionOpts.currentLocation, 5350 nextLocation: viewTransitionOpts.nextLocation 5351 }); 5352 }); 5353 let t = router.window.document.startViewTransition(() => { 5354 flushSyncSafe(() => setStateImpl(newState)); 5355 }); 5356 t.finished.finally(() => { 5357 flushSyncSafe(() => { 5358 setRenderDfd(void 0); 5359 setTransition(void 0); 5360 setPendingState(void 0); 5361 setVtContext({ 5362 isTransitioning: false 5363 }); 5364 }); 5365 }); 5366 flushSyncSafe(() => setTransition(t)); 5367 return; 5368 } 5369 if (transition) { 5370 renderDfd && renderDfd.resolve(); 5371 transition.skipTransition(); 5372 setInterruption({ 5373 state: newState, 5374 currentLocation: viewTransitionOpts.currentLocation, 5375 nextLocation: viewTransitionOpts.nextLocation 5376 }); 5377 } else { 5378 setPendingState(newState); 5379 setVtContext({ 5380 isTransitioning: true, 5381 flushSync: false, 5382 currentLocation: viewTransitionOpts.currentLocation, 5383 nextLocation: viewTransitionOpts.nextLocation 5384 }); 5385 } 5386 }, [router.window, transition, renderDfd, fetcherData, optInStartTransition]); 5387 reactExports.useLayoutEffect(() => router.subscribe(setState), [router, setState]); 5388 reactExports.useEffect(() => {
5389 if (vtContext.isTransitioning && !vtContext.flushSync) { 5390 setRenderDfd(new Deferred()); 5391 } 5392 }, [vtContext]); 5393 reactExports.useEffect(() => { 5394 if (renderDfd && pendingState && router.window) { 5395 let newState = pendingState; 5396 let renderPromise = renderDfd.promise; 5397 let transition2 = router.window.document.startViewTransition(async () => { 5398 optInStartTransition(() => setStateImpl(newState)); 5399 await renderPromise; 5400 }); 5401 transition2.finished.finally(() => { 5402 setRenderDfd(void 0); 5403 setTransition(void 0); 5404 setPendingState(void 0); 5405 setVtContext({ 5406 isTransitioning: false 5407 }); 5408 }); 5409 setTransition(transition2); 5410 } 5411 }, [optInStartTransition, pendingState, renderDfd, router.window]); 5412 reactExports.useEffect(() => { 5413 if (renderDfd && pendingState && state.location.key === pendingState.location.key) { 5414 renderDfd.resolve(); 5415 } 5416 }, [renderDfd, transition, state.location, pendingState]); 5417 reactExports.useEffect(() => {
5418 if (!vtContext.isTransitioning && interruption) { 5419 setPendingState(interruption.state); 5420 setVtContext({ 5421 isTransitioning: true, 5422 flushSync: false, 5423 currentLocation: interruption.currentLocation, 5424 nextLocation: interruption.nextLocation 5425 }); 5426 setInterruption(void 0); 5427 } 5428 }, [vtContext.isTransitioning, interruption]); 5429 reactExports.useEffect(() => { 5430 }, []); 5431 let navigator = reactExports.useMemo(() => { 5432 return { 5433 createHref: router.createHref, 5434 encodeLocation: router.encodeLocation, 5435 go: (n) => router.navigate(n), 5436 push: (to, state2, opts) => router.navigate(to, { 5437 state: state2, 5438 preventScrollReset: opts == null ? void 0 : opts.preventScrollReset 5439 }), 5440 replace: (to, state2, opts) => router.navigate(to, { 5441 replace: true, 5442 state: state2, 5443 preventScrollReset: opts == null ? void 0 : opts.preventScrollReset 5444 }) 5445 }; 5446 }, [router]); 5447 let basename = router.basename || "/"; 5448 let dataRouterContext = reactExports.useMemo(() => ({ 5449 router, 5450 navigator, 5451 static: false, 5452 basename 5453 }), [router, navigator, basename]); 5454 return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(DataRouterContext.Provider, { 5455 value: dataRouterContext 5456 }, /* @__PURE__ */ reactExports.createElement(DataRouterStateContext.Provider, { 5457 value: state 5458 }, /* @__PURE__ */ reactExports.createElement(FetchersContext.Provider, { 5459 value: fetcherData.current 5460 }, /* @__PURE__ */ reactExports.createElement(ViewTransitionContext.Provider, { 5461 value: vtContext 5462 }, /* @__PURE__ */ reactExports.createElement(Router, { 5463 basename, 5464 location: state.location, 5465 navigationType: state.historyAction, 5466 navigator, 5467 future: { 5468 v7_relativeSplatPath: router.future.v7_relativeSplatPath 5469 } 5470 }, state.initialized || router.future.v7_partialHydration ? /* @__PURE__ */ reactExports.createElement(DataRoutes, { 5471 routes: router.routes, 5472 future: router.future, 5473 state 5474 }) : fallbackElement))))), null); 5475} 5476function DataRoutes(_ref3) { 5477 let { 5478 routes, 5479 future, 5480 state 5481 } = _ref3; 5482 return useRoutesImpl(routes, void 0, state, future); 5483} 5484const isBrowser$2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; 5485const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; 5486const Link = /* @__PURE__ */ reactExports.forwardRef(function LinkWithRef(_ref7, ref) { 5487 let { 5488 onClick, 5489 relative, 5490 reloadDocument, 5491 replace, 5492 state, 5493 target, 5494 to, 5495 preventScrollReset, 5496 unstable_viewTransition 5497 } = _ref7, rest = _objectWithoutPropertiesLoose$2(_ref7, _excluded$8); 5498 let { 5499 basename 5500 } = reactExports.useContext(NavigationContext); 5501 let absoluteHref; 5502 let isExternal = false; 5503 if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) { 5504 absoluteHref = to; 5505 if (isBrowser$2) { 5506 try { 5507 let currentUrl = new URL(window.location.href); 5508 let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to); 5509 let path = stripBasename(targetUrl.pathname, basename); 5510 if (targetUrl.origin === currentUrl.origin && path != null) { 5511 to = path + targetUrl.search + targetUrl.hash; 5512 } else { 5513 isExternal = true; 5514 } 5515 } catch (e) { 5516 } 5517 } 5518 } 5519 let href = useHref(to, { 5520 relative 5521 }); 5522 let internalOnClick = useLinkClickHandler(to, { 5523 replace, 5524 state, 5525 target, 5526 preventScrollReset, 5527 relative, 5528 unstable_viewTransition 5529 }); 5530 function handleClick(event) { 5531 if (onClick) onClick(event); 5532 if (!event.defaultPrevented) { 5533 internalOnClick(event); 5534 } 5535 } 5536 return ( 5537 // eslint-disable-next-line jsx-a11y/anchor-has-content 5538 /* @__PURE__ */ reactExports.createElement("a", _extends$1({}, rest, { 5539 href: absoluteHref || href, 5540 onClick: isExternal || reloadDocument ? onClick : handleClick, 5541 ref, 5542 target 5543 })) 5544 ); 5545}); 5546const NavLink = /* @__PURE__ */ reactExports.forwardRef(function NavLinkWithRef(_ref8, ref) { 5547 let { 5548 "aria-current": ariaCurrentProp = "page", 5549 caseSensitive = false, 5550 className: classNameProp = "", 5551 end = false, 5552 style: styleProp, 5553 to, 5554 unstable_viewTransition, 5555 children 5556 } = _ref8, rest = _objectWithoutPropertiesLoose$2(_ref8, _excluded2$3); 5557 let path = useResolvedPath(to, { 5558 relative: rest.relative 5559 }); 5560 let location = useLocation(); 5561 let routerState = reactExports.useContext(DataRouterStateContext); 5562 let { 5563 navigator, 5564 basename 5565 } = reactExports.useContext(NavigationContext); 5566 let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static 5567 // eslint-disable-next-line react-hooks/rules-of-hooks 5568 useViewTransitionState(path) && unstable_viewTransition === true; 5569 let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; 5570 let locationPathname = location.pathname; 5571 let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; 5572 if (!caseSensitive) { 5573 locationPathname = locationPathname.toLowerCase(); 5574 nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; 5575 toPathname = toPathname.toLowerCase(); 5576 } 5577 if (nextLocationPathname && basename) { 5578 nextLocationPathname = stripBasename(nextLocationPathname, base
5578name) || nextLocationPathname; 5579 } 5580 const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length; 5581 let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/"; 5582 let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); 5583 let renderProps = { 5584 isActive, 5585 isPending, 5586 isTransitioning 5587 }; 5588 let ariaCurrent = isActive ? ariaCurrentProp : void 0; 5589 let className; 5590 if (typeof classNameProp === "function") { 5591 className = classNameProp(renderProps); 5592 } else { 5593 className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" "); 5594 } 5595 let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp; 5596 return /* @__PURE__ */ reactExports.createElement(Link, _extends$1({}, rest, { 5597 "aria-current": ariaCurrent, 5598 className, 5599 ref, 5600 style, 5601 to, 5602 unstable_viewTransition 5603 }), typeof children === "function" ? children(renderProps) : children); 5604}); 5605var DataRouterHook; 5606(function(DataRouterHook2) { 5607 DataRouterHook2["UseScrollRestoration"] = "useScrollRestoration"; 5608 DataRouterHook2["UseSubmit"] = "useSubmit"; 5609 DataRouterHook2["UseSubmitFetcher"] = "useSubmitFetcher"; 5610 DataRouterHook2["UseFetcher"] = "useFetcher"; 5611 DataRouterHook2["useViewTransitionState"] = "useViewTransitionState"; 5612})(DataRouterHook || (DataRouterHook = {})); 5613var DataRouterStateHook; 5614(function(DataRouterStateHook2) { 5615 DataRouterStateHook2["UseFetcher"] = "useFetcher"; 5616 DataRouterStateHook2["UseFetchers"] = "useFetchers"; 5617 DataRouterStateHook2["UseScrollRestoration"] = "useScrollRestoration"; 5618})(DataRouterStateHook || (DataRouterStateHook = {})); 5619function useDataRouterContext(hookName) { 5620 let ctx = reactExports.useContext(DataRouterContext); 5621 !ctx ? invariant$1(false) : void 0; 5622 return ctx; 5623} 5624function useLinkClickHandler(to, _temp) { 5625 let { 5626 target, 5627 replace: replaceProp, 5628 state, 5629 preventScrollReset, 5630 relative, 5631 unstable_viewTransition 5632 } = _temp === void 0 ? {} : _temp; 5633 let navigate = useNavigate(); 5634 let location = useLocation(); 5635 let path = useResolvedPath(to, { 5636 relative 5637 }); 5638 return reactExports.useCallback((event) => { 5639 if (shouldProcessLinkClick(event, target)) { 5640 event.preventDefault(); 5641 let replace = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path); 5642 navigate(to, { 5643 replace, 5644 state, 5645 preventScrollReset, 5646 relative, 5647 unstable_viewTransition 5648 }); 5649 } 5650 }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, unstable_viewTransition]); 5651} 5652function useSearchParams(defaultInit) { 5653 let defaultSearchParamsRef = reactExports.useRef(createSearchParams(defaultInit)); 5654 let hasSetSearchParamsRef = reactExports.useRef(false); 5655 let location = useLocation(); 5656 let searchParams = reactExports.useMemo(() => ( 5657 // Only merge in the defaults if we haven't yet called setSearchParams. 5658 // Once we call that we want those to take precedence, otherwise you can't 5659 // remove a param with setSearchParams({}) if it has an initial value 5660 getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current) 5661 ), [location.search]); 5662 let navigate = useNavigate(); 5663 let setSearchParams = reactExports.useCallback((nextInit, navigateOptions) => { 5664 const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit); 5665 hasSetSearchParamsRef.current = true; 5666 navigate("?" + newSearchParams, navigateOptions); 5667 }, [navigate, searchParams]); 5668 return [searchParams, setSearchParams]; 5669} 5670function useViewTransitionState(to, opts) { 5671 if (opts === void 0) { 5672 opts = {}; 5673 } 5674 let vtContext = reactExports.useContext(ViewTransitionContext); 5675 !(vtContext != null) ? invariant$1(false) : void 0; 5676 let { 5677 basename 5678 } = useDataRouterContext(DataRouterHook.useViewTransitionState); 5679 let path = useResolvedPath(to, { 5680 relative: opts.relative 5681 });
vendor: 7,221 bytes, lines 5682-5957
5682 if (!vtContext.isTransitioning) { 5683 return false; 5684 } 5685 let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname; 5686 let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname; 5687 return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null; 5688} 5689 5690const SESSION_ID_NAME = "costquest-session-id"; 5691 5692const STATE_ID_NAME = "costquest-state-id"; 5693const SESSION_NDA_NAME = "costquest-nda-signed"; 5694 5695function bind(fn, thisArg) { 5696 return function wrap() { 5697 return fn.apply(thisArg, arguments); 5698 }; 5699} 5700 5701// utils is a library of generic helper functions non-specific to axios 5702 5703const {toString} = Object.prototype; 5704const {getPrototypeOf} = Object; 5705const {iterator, toStringTag} = Symbol; 5706 5707const kindOf = (cache => thing => { 5708 const str = toString.call(thing); 5709 return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); 5710})(Object.create(null)); 5711 5712const kindOfTest = (type) => { 5713 type = type.toLowerCase(); 5714 return (thing) => kindOf(thing) === type 5715}; 5716 5717const typeOfTest = type => thing => typeof thing === type; 5718 5719/** 5720 * Determine if a value is an Array 5721 * 5722 * @param {Object} val The value to test 5723 * 5724 * @returns {boolean} True if value is an Array, otherwise false 5725 */ 5726const {isArray: isArray$1} = Array; 5727 5728/** 5729 * Determine if a value is undefined 5730 * 5731 * @param {*} val The value to test 5732 * 5733 * @returns {boolean} True if the value is undefined, otherwise false 5734 */ 5735const isUndefined = typeOfTest('undefined'); 5736 5737/** 5738 * Determine if a value is a Buffer 5739 * 5740 * @param {*} val The value to test 5741 * 5742 * @returns {boolean} True if value is a Buffer, otherwise false 5743 */ 5744function isBuffer(val) { 5745 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) 5746 && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); 5747} 5748 5749/** 5750 * Determine if a value is an ArrayBuffer 5751 * 5752 * @param {*} val The value to test 5753 * 5754 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 5755 */ 5756const isArrayBuffer = kindOfTest('ArrayBuffer'); 5757 5758 5759/** 5760 * Determine if a value is a view on an ArrayBuffer 5761 * 5762 * @param {*} val The value to test 5763 * 5764 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 5765 */ 5766function isArrayBufferView(val) { 5767 let result; 5768 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 5769 result = ArrayBuffer.isView(val); 5770 } else { 5771 result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); 5772 } 5773 return result; 5774} 5775 5776/** 5777 * Determine if a value is a String 5778 * 5779 * @param {*} val The value to test 5780 * 5781 * @returns {boolean} True if value is a String, otherwise false 5782 */ 5783const isString = typeOfTest('string'); 5784 5785/** 5786 * Determine if a value is a Function 5787 * 5788 * @param {*} val The value to test 5789 * @returns {boolean} True if value is a Function, otherwise false 5790 */ 5791const isFunction = typeOfTest('function'); 5792 5793/** 5794 * Determine if a value is a Number 5795 * 5796 * @param {*} val The value to test 5797 * 5798 * @returns {boolean} True if value is a Number, otherwise false 5799 */ 5800const isNumber$1 = typeOfTest('number'); 5801 5802/** 5803 * Determine if a value is an Object 5804 * 5805 * @param {*} thing The value to test 5806 * 5807 * @returns {boolean} True if value is an Object, otherwise false 5808 */ 5809const isObject$1 = (thing) => thing !== null && typeof thing === 'object'; 5810 5811/** 5812 * Determine if a value is a Boolean 5813 * 5814 * @param {*} thing The value to test 5815 * @returns {boolean} True if value is a Boolean, otherwise false 5816 */ 5817const isBoolean = thing => thing === true || thing === false; 5818 5819/** 5820 * Determine if a value is a plain Object 5821 * 5822 * @param {*} val The value to test 5823 * 5824 * @returns {boolean} True if value is a plain Object, otherwise false 5825 */ 5826const isPlainObject = (val) => { 5827 if (kindOf(val) !== 'object') { 5828 return false; 5829 } 5830 5831 const prototype = getPrototypeOf(val); 5832 return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val); 5833}; 5834 5835/** 5836 * Determine if a value is a Date 5837 * 5838 * @param {*} val The value to test 5839 * 5840 * @returns {boolean} True if value is a Date, otherwise false 5841 */ 5842const isDate = kindOfTest('Date'); 5843 5844/** 5845 * Determine if a value is a File 5846 * 5847 * @param {*} val The value to test 5848 * 5849 * @returns {boolean} True if value is a File, otherwise false 5850 */ 5851const isFile = kindOfTest('File'); 5852 5853/** 5854 * Determine if a value is a Blob 5855 * 5856 * @param {*} val The value to test 5857 * 5858 * @returns {boolean} True if value is a Blob, otherwise false 5859 */ 5860const isBlob = kindOfTest('Blob'); 5861 5862/** 5863 * Determine if a value is a FileList 5864 * 5865 * @param {*} val The value to test 5866 * 5867 * @returns {boolean} True if value is a File, otherwise false 5868 */ 5869const isFileList = kindOfTest('FileList'); 5870 5871/** 5872 * Determine if a value is a Stream 5873 * 5874 * @param {*} val The value to test 5875 * 5876 * @returns {boolean} True if value is a Stream, otherwise false 5877 */ 5878const isStream = (val) => isObject$1(val) && isFunction(val.pipe); 5879 5880/** 5881 * Determine if a value is a FormData 5882 * 5883 * @param {*} thing The value to test 5884 * 5885 * @returns {boolean} True if value is an FormData, otherwise false 5886 */ 5887const isFormData = (thing) => { 5888 let kind; 5889 return thing && ( 5890 (typeof FormData === 'function' && thing instanceof FormData) || ( 5891 isFunction(thing.append) && ( 5892 (kind = kindOf(thing)) === 'formdata' || 5893 // detect form-data instance 5894 (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') 5895 ) 5896 ) 5897 ) 5898}; 5899 5900/** 5901 * Determine if a value is a URLSearchParams object 5902 * 5903 * @param {*} val The value to test 5904 * 5905 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 5906 */ 5907const isURLSearchParams = kindOfTest('URLSearchParams'); 5908 5909const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); 5910 5911/** 5912 * Trim excess whitespace off the beginning and end of a string 5913 * 5914 * @param {String} str The String to trim 5915 * 5916 * @returns {String} The String freed of excess whitespace 5917 */ 5918const trim$1 = (str) => str.trim ? 5919 str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); 5920 5921/** 5922 * Iterate over an Array or an Object invoking a function for each item. 5923 * 5924 * If `obj` is an Array callback will be called passing 5925 * the value, index, and complete array for each item. 5926 * 5927 * If 'obj' is an Object callback will be called passing 5928 * the value, key, and complete object for each property. 5929 * 5930 * @param {Object|Array} obj The object to iterate 5931 * @param {Function} fn The callback to invoke for each item 5932 * 5933 * @param {Boolean} [allOwnKeys = false] 5934 * @returns {any} 5935 */ 5936function forEach(obj, fn, {allOwnKeys = false} = {}) { 5937 // Don't bother if no value provided 5938 if (obj === null || typeof obj === 'undefined') { 5939 return; 5940 } 5941 5942 let i; 5943 let l; 5944 5945 // Force an array if not already something iterable 5946 if (typeof obj !== 'object') { 5947 /*eslint no-param-reassign:0*/ 5948 obj = [obj]; 5949 } 5950 5951 if (isArray$1(obj)) { 5952 // Iterate over array values 5953 for (i = 0, l = obj.length; i < l; i++) { 5954 fn.call(null, obj[i], i, obj); 5955 } 5956 } else { 5957 // Iterate over object keys
vendor: 5,928 bytes, lines 5958-6181
5958 const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); 5959 const len = keys.length; 5960 let key; 5961 5962 for (i = 0; i < len; i++) { 5963 key = keys[i]; 5964 fn.call(null, obj[key], key, obj); 5965 } 5966 } 5967} 5968 5969function findKey(obj, key) { 5970 key = key.toLowerCase(); 5971 const keys = Object.keys(obj); 5972 let i = keys.length; 5973 let _key; 5974 while (i-- > 0) { 5975 _key = keys[i]; 5976 if (key === _key.toLowerCase()) { 5977 return _key; 5978 } 5979 } 5980 return null; 5981} 5982 5983const _global = (() => { 5984 /*eslint no-undef:0*/ 5985 if (typeof globalThis !== "undefined") return globalThis; 5986 return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) 5987})(); 5988 5989const isContextDefined = (context) => !isUndefined(context) && context !== _global; 5990 5991/** 5992 * Accepts varargs expecting each argument to be an object, then 5993 * immutably merges the properties of each object and returns result. 5994 * 5995 * When multiple objects contain the same key the later object in 5996 * the arguments list will take precedence. 5997 * 5998 * Example: 5999 * 6000 * ```js 6001 * var result = merge({foo: 123}, {foo: 456}); 6002 * console.log(result.foo); // outputs 456 6003 * ``` 6004 * 6005 * @param {Object} obj1 Object to merge 6006 * 6007 * @returns {Object} Result of all merge properties 6008 */ 6009function merge(/* obj1, obj2, obj3, ... */) { 6010 const {caseless} = isContextDefined(this) && this || {}; 6011 const result = {}; 6012 const assignValue = (val, key) => { 6013 const targetKey = caseless && findKey(result, key) || key; 6014 if (isPlainObject(result[targetKey]) && isPlainObject(val)) { 6015 result[targetKey] = merge(result[targetKey], val); 6016 } else if (isPlainObject(val)) { 6017 result[targetKey] = merge({}, val); 6018 } else if (isArray$1(val)) { 6019 result[targetKey] = val.slice(); 6020 } else { 6021 result[targetKey] = val; 6022 } 6023 }; 6024 6025 for (let i = 0, l = arguments.length; i < l; i++) { 6026 arguments[i] && forEach(arguments[i], assignValue); 6027 } 6028 return result; 6029} 6030 6031/** 6032 * Extends object a by mutably adding to it the properties of object b. 6033 * 6034 * @param {Object} a The object to be extended 6035 * @param {Object} b The object to copy properties from 6036 * @param {Object} thisArg The object to bind function to 6037 * 6038 * @param {Boolean} [allOwnKeys] 6039 * @returns {Object} The resulting value of object a 6040 */ 6041const extend = (a, b, thisArg, {allOwnKeys}= {}) => { 6042 forEach(b, (val, key) => { 6043 if (thisArg && isFunction(val)) { 6044 a[key] = bind(val, thisArg); 6045 } else { 6046 a[key] = val; 6047 } 6048 }, {allOwnKeys}); 6049 return a; 6050}; 6051 6052/** 6053 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) 6054 * 6055 * @param {string} content with BOM 6056 * 6057 * @returns {string} content value without BOM 6058 */ 6059const stripBOM = (content) => { 6060 if (content.charCodeAt(0) === 0xFEFF) { 6061 content = content.slice(1); 6062 } 6063 return content; 6064}; 6065 6066/** 6067 * Inherit the prototype methods from one constructor into another 6068 * @param {function} constructor 6069 * @param {function} superConstructor 6070 * @param {object} [props] 6071 * @param {object} [descriptors] 6072 * 6073 * @returns {void} 6074 */ 6075const inherits = (constructor, superConstructor, props, descriptors) => { 6076 constructor.prototype = Object.create(superConstructor.prototype, descriptors); 6077 constructor.prototype.constructor = constructor; 6078 Object.defineProperty(constructor, 'super', { 6079 value: superConstructor.prototype 6080 }); 6081 props && Object.assign(constructor.prototype, props); 6082}; 6083 6084/** 6085 * Resolve object with deep prototype chain to a flat object 6086 * @param {Object} sourceObj source object 6087 * @param {Object} [destObj] 6088 * @param {Function|Boolean} [filter] 6089 * @param {Function} [propFilter] 6090 * 6091 * @returns {Object} 6092 */ 6093const toFlatObject = (sourceObj, destObj, filter, propFilter) => { 6094 let props; 6095 let i; 6096 let prop; 6097 const merged = {}; 6098 6099 destObj = destObj || {}; 6100 // eslint-disable-next-line no-eq-null,eqeqeq 6101 if (sourceObj == null) return destObj; 6102 6103 do { 6104 props = Object.getOwnPropertyNames(sourceObj); 6105 i = props.length; 6106 while (i-- > 0) { 6107 prop = props[i]; 6108 if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { 6109 destObj[prop] = sourceObj[prop]; 6110 merged[prop] = true; 6111 } 6112 } 6113 sourceObj = filter !== false && getPrototypeOf(sourceObj); 6114 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); 6115 6116 return destObj; 6117}; 6118 6119/** 6120 * Determines whether a string ends with the characters of a specified string 6121 * 6122 * @param {String} str 6123 * @param {String} searchString 6124 * @param {Number} [position= 0] 6125 * 6126 * @returns {boolean} 6127 */ 6128const endsWith = (str, searchString, position) => { 6129 str = String(str); 6130 if (position === undefined || position > str.length) { 6131 position = str.length; 6132 } 6133 position -= searchString.length; 6134 const lastIndex = str.indexOf(searchString, position); 6135 return lastIndex !== -1 && lastIndex === position; 6136}; 6137 6138 6139/** 6140 * Returns new array from array like object or null if failed 6141 * 6142 * @param {*} [thing] 6143 * 6144 * @returns {?Array} 6145 */ 6146const toArray = (thing) => { 6147 if (!thing) return null; 6148 if (isArray$1(thing)) return thing; 6149 let i = thing.length; 6150 if (!isNumber$1(i)) return null; 6151 const arr = new Array(i); 6152 while (i-- > 0) { 6153 arr[i] = thing[i]; 6154 } 6155 return arr; 6156}; 6157 6158/** 6159 * Checking if the Uint8Array exists and if it does, it returns a function that checks if the 6160 * thing passed in is an instance of Uint8Array 6161 * 6162 * @param {TypedArray} 6163 * 6164 * @returns {Array} 6165 */ 6166// eslint-disable-next-line func-names 6167const isTypedArray = (TypedArray => { 6168 // eslint-disable-next-line func-names 6169 return thing => { 6170 return TypedArray && thing instanceof TypedArray; 6171 }; 6172})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); 6173 6174/** 6175 * For each entry in the object, call the function with the key and value. 6176 * 6177 * @param {Object<any, any>} obj - The object to iterate over. 6178 * @param {Function} fn - The function to call for each entry. 6179 * 6180 * @returns {void} 6181 */
vendor: 7,246 bytes, lines 6182-6488
6182const forEachEntry = (obj, fn) => { 6183 const generator = obj && obj[iterator]; 6184 6185 const _iterator = generator.call(obj); 6186 6187 let result; 6188 6189 while ((result = _iterator.next()) && !result.done) { 6190 const pair = result.value; 6191 fn.call(obj, pair[0], pair[1]); 6192 } 6193}; 6194 6195/** 6196 * It takes a regular expression and a string, and returns an array of all the matches 6197 * 6198 * @param {string} regExp - The regular expression to match against. 6199 * @param {string} str - The string to search. 6200 * 6201 * @returns {Array<boolean>} 6202 */ 6203const matchAll = (regExp, str) => { 6204 let matches; 6205 const arr = []; 6206 6207 while ((matches = regExp.exec(str)) !== null) { 6208 arr.push(matches); 6209 } 6210 6211 return arr; 6212}; 6213 6214/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ 6215const isHTMLForm = kindOfTest('HTMLFormElement'); 6216 6217const toCamelCase = str => { 6218 return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, 6219 function replacer(m, p1, p2) { 6220 return p1.toUpperCase() + p2; 6221 } 6222 ); 6223}; 6224 6225/* Creating a function that will check if an object has a property. */ 6226const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); 6227 6228/** 6229 * Determine if a value is a RegExp object 6230 * 6231 * @param {*} val The value to test 6232 * 6233 * @returns {boolean} True if value is a RegExp object, otherwise false 6234 */ 6235const isRegExp = kindOfTest('RegExp'); 6236 6237const reduceDescriptors = (obj, reducer) => { 6238 const descriptors = Object.getOwnPropertyDescriptors(obj); 6239 const reducedDescriptors = {}; 6240 6241 forEach(descriptors, (descriptor, name) => { 6242 let ret; 6243 if ((ret = reducer(descriptor, name, obj)) !== false) { 6244 reducedDescriptors[name] = ret || descriptor; 6245 } 6246 }); 6247 6248 Object.defineProperties(obj, reducedDescriptors); 6249}; 6250 6251/** 6252 * Makes all methods read-only 6253 * @param {Object} obj 6254 */ 6255 6256const freezeMethods = (obj) => { 6257 reduceDescriptors(obj, (descriptor, name) => { 6258 // skip restricted props in strict mode 6259 if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { 6260 return false; 6261 } 6262 6263 const value = obj[name]; 6264 6265 if (!isFunction(value)) return; 6266 6267 descriptor.enumerable = false; 6268 6269 if ('writable' in descriptor) { 6270 descriptor.writable = false; 6271 return; 6272 } 6273 6274 if (!descriptor.set) { 6275 descriptor.set = () => { 6276 throw Error('Can not rewrite read-only method \'' + name + '\''); 6277 }; 6278 } 6279 }); 6280}; 6281 6282const toObjectSet = (arrayOrString, delimiter) => { 6283 const obj = {}; 6284 6285 const define = (arr) => { 6286 arr.forEach(value => { 6287 obj[value] = true; 6288 }); 6289 }; 6290 6291 isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); 6292 6293 return obj; 6294}; 6295 6296const noop$3 = () => {}; 6297 6298const toFiniteNumber = (value, defaultValue) => { 6299 return value != null && Number.isFinite(value = +value) ? value : defaultValue; 6300}; 6301 6302/** 6303 * If the thing is a FormData object, return true, otherwise return false. 6304 * 6305 * @param {unknown} thing - The thing to check. 6306 * 6307 * @returns {boolean} 6308 */ 6309function isSpecCompliantForm(thing) { 6310 return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]); 6311} 6312 6313const toJSONObject = (obj) => { 6314 const stack = new Array(10); 6315 6316 const visit = (source, i) => { 6317 6318 if (isObject$1(source)) { 6319 if (stack.indexOf(source) >= 0) { 6320 return; 6321 } 6322 6323 if(!('toJSON' in source)) { 6324 stack[i] = source; 6325 const target = isArray$1(source) ? [] : {}; 6326 6327 forEach(source, (value, key) => { 6328 const reducedValue = visit(value, i + 1); 6329 !isUndefined(reducedValue) && (target[key] = reducedValue); 6330 }); 6331 6332 stack[i] = undefined; 6333 6334 return target; 6335 } 6336 } 6337 6338 return source; 6339 }; 6340 6341 return visit(obj, 0); 6342}; 6343 6344const isAsyncFn = kindOfTest('AsyncFunction'); 6345 6346const isThenable = (thing) => 6347 thing && (isObject$1(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); 6348 6349// original code 6350// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34 6351 6352const _setImmediate = ((setImmediateSupported, postMessageSupported) => { 6353 if (setImmediateSupported) { 6354 return setImmediate; 6355 } 6356 6357 return postMessageSupported ? ((token, callbacks) => { 6358 _global.addEventListener("message", ({source, data}) => { 6359 if (source === _global && data === token) { 6360 callbacks.length && callbacks.shift()(); 6361 } 6362 }, false); 6363 6364 return (cb) => { 6365 callbacks.push(cb); 6366 _global.postMessage(token, "*"); 6367 } 6368 })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); 6369})( 6370 typeof setImmediate === 'function', 6371 isFunction(_global.postMessage) 6372); 6373 6374const asap = typeof queueMicrotask !== 'undefined' ? 6375 queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate); 6376 6377// ********************* 6378 6379 6380const isIterable = (thing) => thing != null && isFunction(thing[iterator]); 6381 6382 6383const utils$1 = { 6384 isArray: isArray$1, 6385 isArrayBuffer, 6386 isBuffer, 6387 isFormData, 6388 isArrayBufferView, 6389 isString, 6390 isNumber: isNumber$1, 6391 isBoolean, 6392 isObject: isObject$1, 6393 isPlainObject, 6394 isReadableStream, 6395 isRequest, 6396 isResponse, 6397 isHeaders, 6398 isUndefined, 6399 isDate, 6400 isFile, 6401 isBlob, 6402 isRegExp, 6403 isFunction, 6404 isStream, 6405 isURLSearchParams, 6406 isTypedArray, 6407 isFileList, 6408 forEach, 6409 merge, 6410 extend, 6411 trim: trim$1, 6412 stripBOM, 6413 inherits, 6414 toFlatObject, 6415 kindOf, 6416 kindOfTest, 6417 endsWith, 6418 toArray, 6419 forEachEntry, 6420 matchAll, 6421 isHTMLForm, 6422 hasOwnProperty, 6423 hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection 6424 reduceDescriptors, 6425 freezeMethods, 6426 toObjectSet, 6427 toCamelCase, 6428 noop: noop$3, 6429 toFiniteNumber, 6430 findKey, 6431 global: _global, 6432 isContextDefined, 6433 isSpecCompliantForm, 6434 toJSONObject, 6435 isAsyncFn, 6436 isThenable, 6437 setImmediate: _setImmediate, 6438 asap, 6439 isIterable 6440}; 6441 6442/** 6443 * Create an Error with the specified message, config, error code, request and response. 6444 * 6445 * @param {string} message The error message. 6446 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 6447 * @param {Object} [config] The config. 6448 * @param {Object} [request] The request. 6449 * @param {Object} [response] The response. 6450 * 6451 * @returns {Error} The created error. 6452 */ 6453function AxiosError$1(message, code, config, request, response) { 6454 Error.call(this); 6455 6456 if (Error.captureStackTrace) { 6457 Error.captureStackTrace(this, this.constructor); 6458 } else { 6459 this.stack = (new Error()).stack; 6460 } 6461 6462 this.message = message; 6463 this.name = 'AxiosError'; 6464 code && (this.code = code); 6465 config && (this.config = config); 6466 request && (this.request = request); 6467 if (response) { 6468 this.response = response; 6469 this.status = response.status ? response.status : null; 6470 } 6471} 6472 6473utils$1.inherits(AxiosError$1, Error, { 6474 toJSON: function toJSON() { 6475 return { 6476 // Standard 6477 message: this.message, 6478 name: this.name, 6479 // Microsoft 6480 description: this.description, 6481 number: this.number, 6482 // Mozilla 6483 fileName: this.fileName, 6484 lineNumber: this.lineNumber, 6485 columnNumber: this.columnNumber, 6486 stack: this.stack, 6487 // Axios 6488 config: utils$1.toJSONObject(this.config),
vendor: 6,029 bytes, lines 6489-6702
6489 code: this.code, 6490 status: this.status 6491 }; 6492 } 6493}); 6494 6495const prototype$1 = AxiosError$1.prototype; 6496const descriptors = {}; 6497 6498[ 6499 'ERR_BAD_OPTION_VALUE', 6500 'ERR_BAD_OPTION', 6501 'ECONNABORTED', 6502 'ETIMEDOUT', 6503 'ERR_NETWORK', 6504 'ERR_FR_TOO_MANY_REDIRECTS', 6505 'ERR_DEPRECATED', 6506 'ERR_BAD_RESPONSE', 6507 'ERR_BAD_REQUEST', 6508 'ERR_CANCELED', 6509 'ERR_NOT_SUPPORT', 6510 'ERR_INVALID_URL' 6511// eslint-disable-next-line func-names 6512].forEach(code => { 6513 descriptors[code] = {value: code}; 6514}); 6515 6516Object.defineProperties(AxiosError$1, descriptors); 6517Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); 6518 6519// eslint-disable-next-line func-names 6520AxiosError$1.from = (error, code, config, request, response, customProps) => { 6521 const axiosError = Object.create(prototype$1); 6522 6523 utils$1.toFlatObject(error, axiosError, function filter(obj) { 6524 return obj !== Error.prototype; 6525 }, prop => { 6526 return prop !== 'isAxiosError'; 6527 }); 6528 6529 AxiosError$1.call(axiosError, error.message, code, config, request, response); 6530 6531 axiosError.cause = error; 6532 6533 axiosError.name = error.name; 6534 6535 customProps && Object.assign(axiosError, customProps); 6536 6537 return axiosError; 6538}; 6539 6540// eslint-disable-next-line strict 6541const httpAdapter = null; 6542 6543/** 6544 * Determines if the given thing is a array or js object. 6545 * 6546 * @param {string} thing - The object or array to be visited. 6547 * 6548 * @returns {boolean} 6549 */ 6550function isVisitable(thing) { 6551 return utils$1.isPlainObject(thing) || utils$1.isArray(thing); 6552} 6553 6554/** 6555 * It removes the brackets from the end of a string 6556 * 6557 * @param {string} key - The key of the parameter. 6558 * 6559 * @returns {string} the key without the brackets. 6560 */ 6561function removeBrackets(key) { 6562 return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; 6563} 6564 6565/** 6566 * It takes a path, a key, and a boolean, and returns a string 6567 * 6568 * @param {string} path - The path to the current key. 6569 * @param {string} key - The key of the current object being iterated over. 6570 * @param {string} dots - If true, the key will be rendered with dots instead of brackets. 6571 * 6572 * @returns {string} The path to the current key. 6573 */ 6574function renderKey(path, key, dots) { 6575 if (!path) return key; 6576 return path.concat(key).map(function each(token, i) { 6577 // eslint-disable-next-line no-param-reassign 6578 token = removeBrackets(token); 6579 return !dots && i ? '[' + token + ']' : token; 6580 }).join(dots ? '.' : ''); 6581} 6582 6583/** 6584 * If the array is an array and none of its elements are visitable, then it's a flat array. 6585 * 6586 * @param {Array<any>} arr - The array to check 6587 * 6588 * @returns {boolean} 6589 */ 6590function isFlatArray(arr) { 6591 return utils$1.isArray(arr) && !arr.some(isVisitable); 6592} 6593 6594const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { 6595 return /^is[A-Z]/.test(prop); 6596}); 6597 6598/** 6599 * Convert a data object to FormData 6600 * 6601 * @param {Object} obj 6602 * @param {?Object} [formData] 6603 * @param {?Object} [options] 6604 * @param {Function} [options.visitor] 6605 * @param {Boolean} [options.metaTokens = true] 6606 * @param {Boolean} [options.dots = false] 6607 * @param {?Boolean} [options.indexes = false] 6608 * 6609 * @returns {Object} 6610 **/ 6611 6612/** 6613 * It converts an object into a FormData object 6614 * 6615 * @param {Object<any, any>} obj - The object to convert to form data. 6616 * @param {string} formData - The FormData object to append to. 6617 * @param {Object<string, any>} options 6618 * 6619 * @returns 6620 */ 6621function toFormData$1(obj, formData, options) { 6622 if (!utils$1.isObject(obj)) { 6623 throw new TypeError('target must be an object'); 6624 } 6625 6626 // eslint-disable-next-line no-param-reassign 6627 formData = formData || new (FormData)(); 6628 6629 // eslint-disable-next-line no-param-reassign 6630 options = utils$1.toFlatObject(options, { 6631 metaTokens: true, 6632 dots: false, 6633 indexes: false 6634 }, false, function defined(option, source) { 6635 // eslint-disable-next-line no-eq-null,eqeqeq 6636 return !utils$1.isUndefined(source[option]); 6637 }); 6638 6639 const metaTokens = options.metaTokens; 6640 // eslint-disable-next-line no-use-before-define 6641 const visitor = options.visitor || defaultVisitor; 6642 const dots = options.dots; 6643 const indexes = options.indexes; 6644 const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; 6645 const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); 6646 6647 if (!utils$1.isFunction(visitor)) { 6648 throw new TypeError('visitor must be a function'); 6649 } 6650 6651 function convertValue(value) { 6652 if (value === null) return ''; 6653 6654 if (utils$1.isDate(value)) { 6655 return value.toISOString(); 6656 } 6657 6658 if (!useBlob && utils$1.isBlob(value)) { 6659 throw new AxiosError$1('Blob is not supported. Use a Buffer instead.'); 6660 } 6661 6662 if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { 6663 return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); 6664 } 6665 6666 return value; 6667 } 6668 6669 /** 6670 * Default visitor. 6671 * 6672 * @param {*} value 6673 * @param {String|Number} key 6674 * @param {Array<String|Number>} path 6675 * @this {FormData} 6676 * 6677 * @returns {boolean} return true to visit the each prop of the value recursively 6678 */ 6679 function defaultVisitor(value, key, path) { 6680 let arr = value; 6681 6682 if (value && !path && typeof value === 'object') { 6683 if (utils$1.endsWith(key, '{}')) { 6684 // eslint-disable-next-line no-param-reassign 6685 key = metaTokens ? key : key.slice(0, -2); 6686 // eslint-disable-next-line no-param-reassign 6687 value = JSON.stringify(value); 6688 } else if ( 6689 (utils$1.isArray(value) && isFlatArray(value)) || 6690 ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) 6691 )) { 6692 // eslint-disable-next-line no-param-reassign 6693 key = removeBrackets(key); 6694 6695 arr.forEach(function each(el, index) { 6696 !(utils$1.isUndefined(el) || el === null) && formData.append( 6697 // eslint-disable-next-line no-nested-ternary 6698 indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), 6699 convertValue(el) 6700 ); 6701 }); 6702 return false;
vendor: 5,230 bytes, lines 6703-6929
6703 } 6704 } 6705 6706 if (isVisitable(value)) { 6707 return true; 6708 } 6709 6710 formData.append(renderKey(path, key, dots), convertValue(value)); 6711 6712 return false; 6713 } 6714 6715 const stack = []; 6716 6717 const exposedHelpers = Object.assign(predicates, { 6718 defaultVisitor, 6719 convertValue, 6720 isVisitable 6721 }); 6722 6723 function build(value, path) { 6724 if (utils$1.isUndefined(value)) return; 6725 6726 if (stack.indexOf(value) !== -1) { 6727 throw Error('Circular reference detected in ' + path.join('.')); 6728 } 6729 6730 stack.push(value); 6731 6732 utils$1.forEach(value, function each(el, key) { 6733 const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( 6734 formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers 6735 ); 6736 6737 if (result === true) { 6738 build(el, path ? path.concat(key) : [key]); 6739 } 6740 }); 6741 6742 stack.pop(); 6743 } 6744 6745 if (!utils$1.isObject(obj)) { 6746 throw new TypeError('data must be an object'); 6747 } 6748 6749 build(obj); 6750 6751 return formData; 6752} 6753 6754/** 6755 * It encodes a string by replacing all characters that are not in the unreserved set with 6756 * their percent-encoded equivalents 6757 * 6758 * @param {string} str - The string to encode. 6759 * 6760 * @returns {string} The encoded string. 6761 */ 6762function encode$1(str) { 6763 const charMap = { 6764 '!': '%21', 6765 "'": '%27', 6766 '(': '%28', 6767 ')': '%29', 6768 '~': '%7E', 6769 '%20': '+', 6770 '%00': '\x00' 6771 }; 6772 return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { 6773 return charMap[match]; 6774 }); 6775} 6776 6777/** 6778 * It takes a params object and converts it to a FormData object 6779 * 6780 * @param {Object<string, any>} params - The parameters to be converted to a FormData object. 6781 * @param {Object<string, any>} options - The options object passed to the Axios constructor. 6782 * 6783 * @returns {void} 6784 */ 6785function AxiosURLSearchParams(params, options) { 6786 this._pairs = []; 6787 6788 params && toFormData$1(params, this, options); 6789} 6790 6791const prototype = AxiosURLSearchParams.prototype; 6792 6793prototype.append = function append(name, value) { 6794 this._pairs.push([name, value]); 6795}; 6796 6797prototype.toString = function toString(encoder) { 6798 const _encode = encoder ? function(value) { 6799 return encoder.call(this, value, encode$1); 6800 } : encode$1; 6801 6802 return this._pairs.map(function each(pair) { 6803 return _encode(pair[0]) + '=' + _encode(pair[1]); 6804 }, '').join('&'); 6805}; 6806 6807/** 6808 * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their 6809 * URI encoded counterparts 6810 * 6811 * @param {string} val The value to be encoded. 6812 * 6813 * @returns {string} The encoded value. 6814 */ 6815function encode(val) { 6816 return encodeURIComponent(val). 6817 replace(/%3A/gi, ':'). 6818 replace(/%24/g, '$'). 6819 replace(/%2C/gi, ','). 6820 replace(/%20/g, '+'). 6821 replace(/%5B/gi, '['). 6822 replace(/%5D/gi, ']'); 6823} 6824 6825/** 6826 * Build a URL by appending params to the end 6827 * 6828 * @param {string} url The base of the url (e.g., http://www.google.com) 6829 * @param {object} [params] The params to be appended 6830 * @param {?(object|Function)} options 6831 * 6832 * @returns {string} The formatted url 6833 */ 6834function buildURL(url, params, options) { 6835 /*eslint no-param-reassign:0*/ 6836 if (!params) { 6837 return url; 6838 } 6839 6840 const _encode = options && options.encode || encode; 6841 6842 if (utils$1.isFunction(options)) { 6843 options = { 6844 serialize: options 6845 }; 6846 } 6847 6848 const serializeFn = options && options.serialize; 6849 6850 let serializedParams; 6851 6852 if (serializeFn) { 6853 serializedParams = serializeFn(params, options); 6854 } else { 6855 serializedParams = utils$1.isURLSearchParams(params) ? 6856 params.toString() : 6857 new AxiosURLSearchParams(params, options).toString(_encode); 6858 } 6859 6860 if (serializedParams) { 6861 const hashmarkIndex = url.indexOf("#"); 6862 6863 if (hashmarkIndex !== -1) { 6864 url = url.slice(0, hashmarkIndex); 6865 } 6866 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 6867 } 6868 6869 return url; 6870} 6871 6872class InterceptorManager { 6873 constructor() { 6874 this.handlers = []; 6875 } 6876 6877 /** 6878 * Add a new interceptor to the stack 6879 * 6880 * @param {Function} fulfilled The function to handle `then` for a `Promise` 6881 * @param {Function} rejected The function to handle `reject` for a `Promise` 6882 * 6883 * @return {Number} An ID used to remove interceptor later 6884 */ 6885 use(fulfilled, rejected, options) { 6886 this.handlers.push({ 6887 fulfilled, 6888 rejected, 6889 synchronous: options ? options.synchronous : false, 6890 runWhen: options ? options.runWhen : null 6891 }); 6892 return this.handlers.length - 1; 6893 } 6894 6895 /** 6896 * Remove an interceptor from the stack 6897 * 6898 * @param {Number} id The ID that was returned by `use` 6899 * 6900 * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise 6901 */ 6902 eject(id) { 6903 if (this.handlers[id]) { 6904 this.handlers[id] = null; 6905 } 6906 } 6907 6908 /** 6909 * Clear all interceptors from the stack 6910 * 6911 * @returns {void} 6912 */ 6913 clear() { 6914 if (this.handlers) { 6915 this.handlers = []; 6916 } 6917 } 6918 6919 /** 6920 * Iterate over all the registered interceptors 6921 * 6922 * This method is particularly useful for skipping over any 6923 * interceptors that may have become `null` calling `eject`. 6924 * 6925 * @param {Function} fn The function to call for each interceptor 6926 * 6927 * @returns {void} 6928 */ 6929 forEach(fn) {
6930 utils$1.forEach(this.handlers, function forEachHandler(h) { 6931 if (h !== null) { 6932 fn(h); 6933 } 6934 }); 6935 } 6936} 6937 6938const transitionalDefaults = { 6939 silentJSONParsing: true, 6940 forcedJSONParsing: true, 6941 clarifyTimeoutError: false 6942}; 6943 6944const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; 6945 6946const FormData$1 = typeof FormData !== 'undefined' ? FormData : null; 6947 6948const Blob$1 = typeof Blob !== 'undefined' ? Blob : null; 6949 6950const platform$1 = { 6951 isBrowser: true, 6952 classes: { 6953 URLSearchParams: URLSearchParams$1, 6954 FormData: FormData$1, 6955 Blob: Blob$1 6956 }, 6957 protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] 6958}; 6959 6960const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; 6961 6962const _navigator = typeof navigator === 'object' && navigator || undefined; 6963 6964/** 6965 * Determine if we're running in a standard browser environment 6966 * 6967 * This allows axios to run in a web worker, and react-native. 6968 * Both environments support XMLHttpRequest, but not fully standard globals. 6969 * 6970 * web workers: 6971 * typeof window -> undefined 6972 * typeof document -> undefined 6973 * 6974 * react-native: 6975 * navigator.product -> 'ReactNative' 6976 * nativescript 6977 * navigator.product -> 'NativeScript' or 'NS' 6978 * 6979 * @returns {boolean} 6980 */ 6981const hasStandardBrowserEnv = hasBrowserEnv && 6982 (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0); 6983 6984/** 6985 * Determine if we're running in a standard browser webWorker environment 6986 * 6987 * Although the `isStandardBrowserEnv` method indicates that 6988 * `allows axios to run in a web worker`, the WebWorker will still be 6989 * filtered out due to its judgment standard 6990 * `typeof window !== 'undefined' && typeof document !== 'undefined'`. 6991 * This leads to a problem when axios post `FormData` in webWorker 6992 */ 6993const hasStandardBrowserWebWorkerEnv = (() => { 6994 return ( 6995 typeof WorkerGlobalScope !== 'undefined' && 6996 // eslint-disable-next-line no-undef 6997 self instanceof WorkerGlobalScope && 6998 typeof self.importScripts === 'function' 6999 ); 7000})(); 7001 7002const origin = hasBrowserEnv && window.location.href || 'http://localhost'; 7003 7004const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7005 __proto__: null, 7006 hasBrowserEnv, 7007 hasStandardBrowserEnv, 7008 hasStandardBrowserWebWorkerEnv, 7009 navigator: _navigator, 7010 origin 7011}, Symbol.toStringTag, { value: 'Module' })); 7012 7013const platform = { 7014 ...utils, 7015 ...platform$1 7016}; 7017 7018function toURLEncodedForm(data, options) { 7019 return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({ 7020 visitor: function(value, key, path, helpers) { 7021 if (platform.isNode && utils$1.isBuffer(value)) { 7022 this.append(key, value.toString('base64')); 7023 return false; 7024 } 7025 7026 return helpers.defaultVisitor.apply(this, arguments); 7027 } 7028 }, options)); 7029} 7030 7031/** 7032 * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] 7033 * 7034 * @param {string} name - The name of the property to get. 7035 * 7036 * @returns An array of strings. 7037 */ 7038function parsePropPath(name) { 7039 // foo[x][y][z] 7040 // foo.x.y.z 7041 // foo-x-y-z 7042 // foo x y z 7043 return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { 7044 return match[0] === '[]' ? '' : match[1] || match[0]; 7045 }); 7046} 7047 7048/** 7049 * Convert an array to an object. 7050 * 7051 * @param {Array<any>} arr - The array to convert to an object. 7052 * 7053 * @returns An object with the same keys and values as the array. 7054 */ 7055function arrayToObject(arr) { 7056 const obj = {}; 7057 const keys = Object.keys(arr); 7058 let i; 7059 const len = keys.length; 7060 let key; 7061 for (i = 0; i < len; i++) { 7062 key = keys[i]; 7063 obj[key] = arr[key]; 7064 } 7065 return obj; 7066} 7067 7068/** 7069 * It takes a FormData object and returns a JavaScript object 7070 * 7071 * @param {string} formData The FormData object to convert to JSON. 7072 * 7073 * @returns {Object<string, any> | null} The converted object. 7074 */ 7075function formDataToJSON(formData) { 7076 function buildPath(path, value, target, index) { 7077 let name = path[index++]; 7078 7079 if (name === '__proto__') return true; 7080 7081 const isNumericKey = Number.isFinite(+name); 7082 const isLast = index >= path.length; 7083 name = !name && utils$1.isArray(target) ? target.length : name; 7084 7085 if (isLast) { 7086 if (utils$1.hasOwnProp(target, name)) { 7087 target[name] = [target[name], value]; 7088 } else { 7089 target[name] = value; 7090 } 7091 7092 return !isNumericKey; 7093 } 7094 7095 if (!target[name] || !utils$1.isObject(target[name])) { 7096 target[name] = []; 7097 } 7098 7099 const result = buildPath(path, value, target[name], index); 7100 7101 if (result && utils$1.isArray(target[name])) { 7102 target[name] = arrayToObject(target[name]); 7103 } 7104 7105 return !isNumericKey; 7106 } 7107 7108 if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { 7109 const obj = {}; 7110
vendor: 18,415 bytes, lines 7111-7851
7111 utils$1.forEachEntry(formData, (name, value) => { 7112 buildPath(parsePropPath(name), value, obj, 0); 7113 }); 7114 7115 return obj; 7116 } 7117 7118 return null; 7119} 7120 7121/** 7122 * It takes a string, tries to parse it, and if it fails, it returns the stringified version 7123 * of the input 7124 * 7125 * @param {any} rawValue - The value to be stringified. 7126 * @param {Function} parser - A function that parses a string into a JavaScript object. 7127 * @param {Function} encoder - A function that takes a value and returns a string. 7128 * 7129 * @returns {string} A stringified version of the rawValue. 7130 */ 7131function stringifySafely(rawValue, parser, encoder) { 7132 if (utils$1.isString(rawValue)) { 7133 try { 7134 (parser || JSON.parse)(rawValue); 7135 return utils$1.trim(rawValue); 7136 } catch (e) { 7137 if (e.name !== 'SyntaxError') { 7138 throw e; 7139 } 7140 } 7141 } 7142 7143 return (encoder || JSON.stringify)(rawValue); 7144} 7145 7146const defaults = { 7147 7148 transitional: transitionalDefaults, 7149 7150 adapter: ['xhr', 'http', 'fetch'], 7151 7152 transformRequest: [function transformRequest(data, headers) { 7153 const contentType = headers.getContentType() || ''; 7154 const hasJSONContentType = contentType.indexOf('application/json') > -1; 7155 const isObjectPayload = utils$1.isObject(data); 7156 7157 if (isObjectPayload && utils$1.isHTMLForm(data)) { 7158 data = new FormData(data); 7159 } 7160 7161 const isFormData = utils$1.isFormData(data); 7162 7163 if (isFormData) { 7164 return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; 7165 } 7166 7167 if (utils$1.isArrayBuffer(data) || 7168 utils$1.isBuffer(data) || 7169 utils$1.isStream(data) || 7170 utils$1.isFile(data) || 7171 utils$1.isBlob(data) || 7172 utils$1.isReadableStream(data) 7173 ) { 7174 return data; 7175 } 7176 if (utils$1.isArrayBufferView(data)) { 7177 return data.buffer; 7178 } 7179 if (utils$1.isURLSearchParams(data)) { 7180 headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); 7181 return data.toString(); 7182 } 7183 7184 let isFileList; 7185 7186 if (isObjectPayload) { 7187 if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { 7188 return toURLEncodedForm(data, this.formSerializer).toString(); 7189 } 7190 7191 if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { 7192 const _FormData = this.env && this.env.FormData; 7193 7194 return toFormData$1( 7195 isFileList ? {'files[]': data} : data, 7196 _FormData && new _FormData(), 7197 this.formSerializer 7198 ); 7199 } 7200 } 7201 7202 if (isObjectPayload || hasJSONContentType ) { 7203 headers.setContentType('application/json', false); 7204 return stringifySafely(data); 7205 } 7206 7207 return data; 7208 }], 7209 7210 transformResponse: [function transformResponse(data) { 7211 const transitional = this.transitional || defaults.transitional; 7212 const forcedJSONParsing = transitional && transitional.forcedJSONParsing; 7213 const JSONRequested = this.responseType === 'json'; 7214 7215 if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { 7216 return data; 7217 } 7218 7219 if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { 7220 const silentJSONParsing = transitional && transitional.silentJSONParsing; 7221 const strictJSONParsing = !silentJSONParsing && JSONRequested; 7222 7223 try { 7224 return JSON.parse(data); 7225 } catch (e) { 7226 if (strictJSONParsing) { 7227 if (e.name === 'SyntaxError') { 7228 throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response); 7229 } 7230 throw e; 7231 } 7232 } 7233 } 7234 7235 return data; 7236 }], 7237 7238 /** 7239 * A timeout in milliseconds to abort a request. If set to 0 (default) a 7240 * timeout is not created. 7241 */ 7242 timeout: 0, 7243 7244 xsrfCookieName: 'XSRF-TOKEN', 7245 xsrfHeaderName: 'X-XSRF-TOKEN', 7246 7247 maxContentLength: -1, 7248 maxBodyLength: -1, 7249 7250 env: { 7251 FormData: platform.classes.FormData, 7252 Blob: platform.classes.Blob 7253 }, 7254 7255 validateStatus: function validateStatus(status) { 7256 return status >= 200 && status < 300; 7257 }, 7258 7259 headers: { 7260 common: { 7261 'Accept': 'application/json, text/plain, */*', 7262 'Content-Type': undefined 7263 } 7264 } 7265}; 7266 7267utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { 7268 defaults.headers[method] = {}; 7269}); 7270 7271// RawAxiosHeaders whose duplicates are ignored by node 7272// c.f. https://nodejs.org/api/http.html#http_message_headers 7273const ignoreDuplicateOf = utils$1.toObjectSet([ 7274 'age', 'authorization', 'content-length', 'content-type', 'etag', 7275 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 7276 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 7277 'referer', 'retry-after', 'user-agent' 7278]); 7279 7280/** 7281 * Parse headers into an object 7282 * 7283 * ``` 7284 * Date: Wed, 27 Aug 2014 08:58:49 GMT 7285 * Content-Type: application/json 7286 * Connection: keep-alive 7287 * Transfer-Encoding: chunked 7288 * ``` 7289 * 7290 * @param {String} rawHeaders Headers needing to be parsed 7291 * 7292 * @returns {Object} Headers parsed into an object 7293 */ 7294const parseHeaders = rawHeaders => { 7295 const parsed = {}; 7296 let key; 7297 let val; 7298 let i; 7299 7300 rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { 7301 i = line.indexOf(':'); 7302 key = line.substring(0, i).trim().toLowerCase(); 7303 val = line.substring(i + 1).trim(); 7304 7305 if (!key || (parsed[key] && ignoreDuplicateOf[key])) { 7306 return; 7307 } 7308 7309 if (key === 'set-cookie') { 7310 if (parsed[key]) { 7311 parsed[key].push(val); 7312 } else { 7313 parsed[key] = [val]; 7314 } 7315 } else { 7316 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 7317 } 7318 }); 7319 7320 return parsed; 7321}; 7322 7323const $internals = Symbol('internals'); 7324 7325function normalizeHeader(header) { 7326 return header && String(header).trim().toLowerCase(); 7327} 7328 7329function normalizeValue(value) { 7330 if (value === false || value == null) { 7331 return value; 7332 } 7333 7334 return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); 7335} 7336 7337function parseTokens(str) { 7338 const tokens = Object.create(null); 7339 const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; 7340 let match; 7341 7342 while ((match = tokensRE.exec(str))) { 7343 tokens[match[1]] = match[2]; 7344 } 7345 7346 return tokens; 7347} 7348 7349const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); 7350 7351function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { 7352 if (utils$1.isFunction(filter)) { 7353 return filter.call(this, value, header); 7354 } 7355 7356 if (isHeaderNameFilter) { 7357 value = header; 7358 } 7359 7360 if (!utils$1.isString(value)) return; 7361 7362 if (utils$1.isString(filter)) { 7363 return value.indexOf(filter) !== -1; 7364 } 7365 7366 if (utils$1.isRegExp(filter)) { 7367 return filter.test(value); 7368 } 7369} 7370 7371function formatHeader(header) { 7372 return header.trim() 7373 .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { 7374 return char.toUpperCase() + str; 7375 }); 7376} 7377 7378function buildAccessors(obj, header) { 7379 const accessorName = utils$1.toCamelCase(' ' + header); 7380 7381 ['get', 'set', 'has'].forEach(methodName => { 7382 Object.defineProperty(obj, methodName + accessorName, { 7383 value: function(arg1, arg2, arg3) { 7384 return this[methodName].call(this, header, arg1, arg2, arg3); 7385 }, 7386 configurable: true 7387 }); 7388 }); 7389} 7390 7391let AxiosHeaders$1 = class AxiosHeaders { 7392 constructor(headers) { 7393 headers && this.set(headers); 7394 } 7395 7396 set(header, valueOrRewrite, rewrite) { 7397 const self = this; 7398 7399 function setHeader(_value, _header, _rewrite) { 7400 const lHeader = normalizeHeader(_header); 7401 7402 if (!lHeader) { 7403 throw new Error('header name must be a non-empty string'); 7404 } 7405 7406 const key = utils$1.findKey(self, lHeader); 7407 7408 if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { 7409 self[key || _header] = normalizeValue(_value); 7410 } 7411 } 7412 7413 const setHeaders = (headers, _rewrite) => 7414 utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); 7415 7416 if (utils$1.isPlainObject(header) || header instanceof this.constructor) { 7417 setHeaders(header, valueOrRewrite); 7418 } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { 7419 setHeaders(parseHeaders(header), valueOrRewrite); 7420 } else if (utils$1.isObject(header) && utils$1.isIterable(header)) { 7421 let obj = {}, dest, key; 7422 for (const entry of header) { 7423 if (!utils$1.isArray(entry)) { 7424 throw TypeError('Object iterator must return a key-value pair'); 7425 } 7426 7427 obj[key = entry[0]] = (dest = obj[key]) ? 7428 (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1]; 7429 } 7430 7431 setHeaders(obj, valueOrRewrite); 7432 } else { 7433 header != null && setHeader(valueOrRewrite, header, rewrite); 7434 } 7435 7436 return this; 7437 } 7438 7439 get(header, parser) { 7440 header = normalizeHeader(header); 7441 7442 if (header) { 7443 const key = utils$1.findKey(this, header); 7444 7445 if (key) { 7446 const value = this[key]; 7447 7448 if (!parser) { 7449 return value; 7450 } 7451 7452 if (parser === true) { 7453 return parseTokens(value); 7454 } 7455 7456 if (utils$1.isFunction(parser)) { 7457 return parser.call(this, value, key); 7458 } 7459 7460 if (utils$1.isRegExp(parser)) { 7461 return parser.exec(value); 7462 } 7463 7464 throw new TypeError('parser must be boolean|regexp|function'); 7465 } 7466 } 7467 } 7468 7469 has(header, matcher) { 7470 header = normalizeHeader(header); 7471 7472 if (header) { 7473 const key = utils$1.findKey(this, header); 7474 7475 return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); 7476 } 7477 7478 return false; 7479 } 7480 7481 delete(header, matcher) { 7482 const self = this; 7483 let deleted = false; 7484 7485 function deleteHeader(_header) { 7486 _header = normalizeHeader(_header); 7487 7488 if (_header) { 7489 const key = utils$1.findKey(self, _header); 7490 7491 if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { 7492 delete self[key]; 7493 7494 deleted = true; 7495 } 7496 } 7497 } 7498 7499 if (utils$1.isArray(header)) { 7500 header.forEach(deleteHeader); 7501 } else { 7502 deleteHeader(header); 7503 } 7504 7505 return deleted; 7506 } 7507 7508 clear(matcher) { 7509 const keys = Object.keys(this); 7510 let i = keys.length; 7511 let deleted = false; 7512 7513 while (i--) { 7514 const key = keys[i]; 7515 if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { 7516 delete this[key]; 7517 deleted = true; 7518 } 7519 } 7520 7521 return deleted; 7522 } 7523 7524 normalize(format) { 7525 const self = this; 7526 const headers = {}; 7527 7528 utils$1.forEach(this, (value, header) => { 7529 const key = utils$1.findKey(headers, header); 7530 7531 if (key) { 7532 self[key] = normalizeValue(value); 7533 delete self[header]; 7534 return; 7535 } 7536 7537 const normalized = format ? formatHeader(header) : String(header).trim(); 7538 7539 if (normalized !== header) { 7540 delete self[header]; 7541 } 7542 7543 self[normalized] = normalizeValue(value); 7544 7545 headers[normalized] = true; 7546 }); 7547 7548 return this; 7549 } 7550 7551 concat(...targets) { 7552 return this.constructor.concat(this, ...targets); 7553 } 7554 7555 toJSON(asStrings) { 7556 const obj = Object.create(null); 7557 7558 utils$1.forEach(this, (value, header) => { 7559 value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); 7560 }); 7561 7562 return obj; 7563 } 7564 7565 [Symbol.iterator]() { 7566 return Object.entries(this.toJSON())[Symbol.iterator](); 7567 } 7568 7569 toString() { 7570 return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); 7571 } 7572 7573 getSetCookie() { 7574 return this.get("set-cookie") || []; 7575 } 7576 7577 get [Symbol.toStringTag]() { 7578 return 'AxiosHeaders'; 7579 } 7580 7581 static from(thing) { 7582 return thing instanceof this ? thing : new this(thing); 7583 } 7584 7585 static concat(first, ...targets) { 7586 const computed = new this(first); 7587 7588 targets.forEach((target) => computed.set(target)); 7589 7590 return computed; 7591 } 7592 7593 static accessor(header) { 7594 const internals = this[$internals] = (this[$internals] = { 7595 accessors: {} 7596 }); 7597 7598 const accessors = internals.accessors; 7599 const prototype = this.prototype; 7600 7601 function defineAccessor(_header) { 7602 const lHeader = normalizeHeader(_header); 7603 7604 if (!accessors[lHeader]) { 7605 buildAccessors(prototype, _header); 7606 accessors[lHeader] = true; 7607 } 7608 } 7609 7610 utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); 7611 7612 return this; 7613 } 7614}; 7615 7616AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); 7617 7618// reserved names hotfix 7619utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => { 7620 let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` 7621 return { 7622 get: () => value, 7623 set(headerValue) { 7624 this[mapped] = headerValue; 7625 } 7626 } 7627}); 7628 7629utils$1.freezeMethods(AxiosHeaders$1); 7630 7631/** 7632 * Transform the data for a request or a response 7633 * 7634 * @param {Array|Function} fns A single function or Array of functions 7635 * @param {?Object} response The response object 7636 * 7637 * @returns {*} The resulting transformed data 7638 */ 7639function transformData(fns, response) { 7640 const config = this || defaults; 7641 const context = response || config; 7642 const headers = AxiosHeaders$1.from(context.headers); 7643 let data = context.data; 7644 7645 utils$1.forEach(fns, function transform(fn) { 7646 data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); 7647 }); 7648 7649 headers.normalize(); 7650 7651 return data; 7652} 7653 7654function isCancel$1(value) { 7655 return !!(value && value.__CANCEL__); 7656} 7657 7658/** 7659 * A `CanceledError` is an object that is thrown when an operation is canceled. 7660 * 7661 * @param {string=} message The message. 7662 * @param {Object=} config The config. 7663 * @param {Object=} request The request. 7664 * 7665 * @returns {CanceledError} The created error. 7666 */ 7667function CanceledError$1(message, config, request) { 7668 // eslint-disable-next-line no-eq-null,eqeqeq 7669 AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request); 7670 this.name = 'CanceledError'; 7671} 7672 7673utils$1.inherits(CanceledError$1, AxiosError$1, { 7674 __CANCEL__: true 7675}); 7676 7677/** 7678 * Resolve or reject a Promise based on response status. 7679 * 7680 * @param {Function} resolve A function that resolves the promise. 7681 * @param {Function} reject A function that rejects the promise. 7682 * @param {object} response The response. 7683 * 7684 * @returns {object} The response. 7685 */ 7686function settle(resolve, reject, response) { 7687 const validateStatus = response.config.validateStatus; 7688 if (!response.status || !validateStatus || validateStatus(response.status)) { 7689 resolve(response); 7690 } else { 7691 reject(new AxiosError$1( 7692 'Request failed with status code ' + response.status, 7693 [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], 7694 response.config, 7695 response.request, 7696 response 7697 )); 7698 } 7699} 7700 7701function parseProtocol(url) { 7702 const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); 7703 return match && match[1] || ''; 7704} 7705 7706/** 7707 * Calculate data maxRate 7708 * @param {Number} [samplesCount= 10] 7709 * @param {Number} [min= 1000] 7710 * @returns {Function} 7711 */ 7712function speedometer(samplesCount, min) { 7713 samplesCount = samplesCount || 10; 7714 const bytes = new Array(samplesCount); 7715 const timestamps = new Array(samplesCount); 7716 let head = 0; 7717 let tail = 0; 7718 let firstSampleTS; 7719 7720 min = min !== undefined ? min : 1000; 7721 7722 return function push(chunkLength) { 7723 const now = Date.now(); 7724 7725 const startedAt = timestamps[tail]; 7726 7727 if (!firstSampleTS) { 7728 firstSampleTS = now; 7729 } 7730 7731 bytes[head] = chunkLength; 7732 timestamps[head] = now; 7733 7734 let i = tail; 7735 let bytesCount = 0; 7736 7737 while (i !== head) { 7738 bytesCount += bytes[i++]; 7739 i = i % samplesCount; 7740 } 7741 7742 head = (head + 1) % samplesCount; 7743 7744 if (head === tail) { 7745 tail = (tail + 1) % samplesCount; 7746 } 7747 7748 if (now - firstSampleTS < min) { 7749 return; 7750 } 7751 7752 const passed = startedAt && now - startedAt; 7753 7754 return passed ? Math.round(bytesCount * 1000 / passed) : undefined; 7755 }; 7756} 7757 7758/** 7759 * Throttle decorator 7760 * @param {Function} fn 7761 * @param {Number} freq 7762 * @return {Function} 7763 */ 7764function throttle(fn, freq) { 7765 let timestamp = 0; 7766 let threshold = 1000 / freq; 7767 let lastArgs; 7768 let timer; 7769 7770 const invoke = (args, now = Date.now()) => { 7771 timestamp = now; 7772 lastArgs = null; 7773 if (timer) { 7774 clearTimeout(timer); 7775 timer = null; 7776 } 7777 fn.apply(null, args); 7778 }; 7779 7780 const throttled = (...args) => { 7781 const now = Date.now(); 7782 const passed = now - timestamp; 7783 if ( passed >= threshold) { 7784 invoke(args, now); 7785 } else { 7786 lastArgs = args; 7787 if (!timer) { 7788 timer = setTimeout(() => { 7789 timer = null; 7790 invoke(lastArgs); 7791 }, threshold - passed); 7792 } 7793 } 7794 }; 7795 7796 const flush = () => lastArgs && invoke(lastArgs); 7797 7798 return [throttled, flush]; 7799} 7800 7801const progressEventReducer = (listener, isDownloadStream, freq = 3) => { 7802 let bytesNotified = 0; 7803 const _speedometer = speedometer(50, 250); 7804 7805 return throttle(e => { 7806 const loaded = e.loaded; 7807 const total = e.lengthComputable ? e.total : undefined; 7808 const progressBytes = loaded - bytesNotified; 7809 const rate = _speedometer(progressBytes); 7810 const inRange = loaded <= total; 7811 7812 bytesNotified = loaded; 7813 7814 const data = { 7815 loaded, 7816 total, 7817 progress: total ? (loaded / total) : undefined, 7818 bytes: progressBytes, 7819 rate: rate ? rate : undefined, 7820 estimated: rate && total && inRange ? (total - loaded) / rate : undefined, 7821 event: e, 7822 lengthComputable: total != null, 7823 [isDownloadStream ? 'download' : 'upload']: true 7824 }; 7825 7826 listener(data); 7827 }, freq); 7828}; 7829 7830const progressEventDecorator = (total, throttled) => { 7831 const lengthComputable = total != null; 7832 7833 return [(loaded) => throttled[0]({ 7834 lengthComputable, 7835 total, 7836 loaded 7837 }), throttled[1]]; 7838}; 7839 7840const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args)); 7841 7842const isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => { 7843 url = new URL(url, platform.origin); 7844 7845 return ( 7846 origin.protocol === url.protocol && 7847 origin.host === url.host && 7848 (isMSIE || origin.port === url.port) 7849 ); 7850})( 7851 new URL(platform.origin),
vendor: 22,993 bytes, lines 7852-8630
7852 platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent) 7853) : () => true; 7854 7855const cookies = platform.hasStandardBrowserEnv ? 7856 7857 // Standard browser envs support document.cookie 7858 { 7859 write(name, value, expires, path, domain, secure) { 7860 const cookie = [name + '=' + encodeURIComponent(value)]; 7861 7862 utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); 7863 7864 utils$1.isString(path) && cookie.push('path=' + path); 7865 7866 utils$1.isString(domain) && cookie.push('domain=' + domain); 7867 7868 secure === true && cookie.push('secure'); 7869 7870 document.cookie = cookie.join('; '); 7871 }, 7872 7873 read(name) { 7874 const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 7875 return (match ? decodeURIComponent(match[3]) : null); 7876 }, 7877 7878 remove(name) { 7879 this.write(name, '', Date.now() - 86400000); 7880 } 7881 } 7882 7883 : 7884 7885 // Non-standard browser env (web workers, react-native) lack needed support. 7886 { 7887 write() {}, 7888 read() { 7889 return null; 7890 }, 7891 remove() {} 7892 }; 7893 7894/** 7895 * Determines whether the specified URL is absolute 7896 * 7897 * @param {string} url The URL to test 7898 * 7899 * @returns {boolean} True if the specified URL is absolute, otherwise false 7900 */ 7901function isAbsoluteURL(url) { 7902 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 7903 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 7904 // by any combination of letters, digits, plus, period, or hyphen. 7905 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); 7906} 7907 7908/** 7909 * Creates a new URL by combining the specified URLs 7910 * 7911 * @param {string} baseURL The base URL 7912 * @param {string} relativeURL The relative URL 7913 * 7914 * @returns {string} The combined URL 7915 */ 7916function combineURLs(baseURL, relativeURL) { 7917 return relativeURL 7918 ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') 7919 : baseURL; 7920} 7921 7922/** 7923 * Creates a new URL by combining the baseURL with the requestedURL, 7924 * only when the requestedURL is not already an absolute URL. 7925 * If the requestURL is absolute, this function returns the requestedURL untouched. 7926 * 7927 * @param {string} baseURL The base URL 7928 * @param {string} requestedURL Absolute or relative URL to combine 7929 * 7930 * @returns {string} The combined full path 7931 */ 7932function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) { 7933 let isRelativeUrl = !isAbsoluteURL(requestedURL); 7934 if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) { 7935 return combineURLs(baseURL, requestedURL); 7936 } 7937 return requestedURL; 7938} 7939 7940const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; 7941 7942/** 7943 * Config-specific merge-function which creates a new config-object 7944 * by merging two configuration objects together. 7945 * 7946 * @param {Object} config1 7947 * @param {Object} config2 7948 * 7949 * @returns {Object} New object resulting from merging config2 to config1 7950 */ 7951function mergeConfig$1(config1, config2) { 7952 // eslint-disable-next-line no-param-reassign 7953 config2 = config2 || {}; 7954 const config = {}; 7955 7956 function getMergedValue(target, source, prop, caseless) { 7957 if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { 7958 return utils$1.merge.call({caseless}, target, source); 7959 } else if (utils$1.isPlainObject(source)) { 7960 return utils$1.merge({}, source); 7961 } else if (utils$1.isArray(source)) { 7962 return source.slice(); 7963 } 7964 return source; 7965 } 7966 7967 // eslint-disable-next-line consistent-return 7968 function mergeDeepProperties(a, b, prop , caseless) { 7969 if (!utils$1.isUndefined(b)) { 7970 return getMergedValue(a, b, prop , caseless); 7971 } else if (!utils$1.isUndefined(a)) { 7972 return getMergedValue(undefined, a, prop , caseless); 7973 } 7974 } 7975 7976 // eslint-disable-next-line consistent-return 7977 function valueFromConfig2(a, b) { 7978 if (!utils$1.isUndefined(b)) { 7979 return getMergedValue(undefined, b); 7980 } 7981 } 7982 7983 // eslint-disable-next-line consistent-return 7984 function defaultToConfig2(a, b) { 7985 if (!utils$1.isUndefined(b)) { 7986 return getMergedValue(undefined, b); 7987 } else if (!utils$1.isUndefined(a)) { 7988 return getMergedValue(undefined, a); 7989 } 7990 } 7991 7992 // eslint-disable-next-line consistent-return 7993 function mergeDirectKeys(a, b, prop) { 7994 if (prop in config2) { 7995 return getMergedValue(a, b); 7996 } else if (prop in config1) { 7997 return getMergedValue(undefined, a); 7998 } 7999 } 8000 8001 const mergeMap = { 8002 url: valueFromConfig2, 8003 method: valueFromConfig2, 8004 data: valueFromConfig2, 8005 baseURL: defaultToConfig2, 8006 transformRequest: defaultToConfig2, 8007 transformResponse: defaultToConfig2, 8008 paramsSerializer: defaultToConfig2, 8009 timeout: defaultToConfig2, 8010 timeoutMessage: defaultToConfig2, 8011 withCredentials: defaultToConfig2, 8012 withXSRFToken: defaultToConfig2, 8013 adapter: defaultToConfig2, 8014 responseType: defaultToConfig2, 8015 xsrfCookieName: defaultToConfig2, 8016 xsrfHeaderName: defaultToConfig2, 8017 onUploadProgress: defaultToConfig2, 8018 onDownloadProgress: defaultToConfig2, 8019 decompress: defaultToConfig2, 8020 maxContentLength: defaultToConfig2, 8021 maxBodyLength: defaultToConfig2, 8022 beforeRedirect: defaultToConfig2, 8023 transport: defaultToConfig2, 8024 httpAgent: defaultToConfig2, 8025 httpsAgent: defaultToConfig2, 8026 cancelToken: defaultToConfig2, 8027 socketPath: defaultToConfig2, 8028 responseEncoding: defaultToConfig2, 8029 validateStatus: mergeDirectKeys, 8030 headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true) 8031 }; 8032 8033 utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { 8034 const merge = mergeMap[prop] || mergeDeepProperties; 8035 const configValue = merge(config1[prop], config2[prop], prop); 8036 (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); 8037 }); 8038 8039 return config; 8040} 8041 8042const resolveConfig = (config) => { 8043 const newConfig = mergeConfig$1({}, config); 8044 8045 let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; 8046 8047 newConfig.headers = headers = AxiosHeaders$1.from(headers); 8048 8049 newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer); 8050 8051 // HTTP basic authentication 8052 if (auth) { 8053 headers.set('Authorization', 'Basic ' + 8054 btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) 8055 ); 8056 } 8057 8058 let contentType; 8059 8060 if (utils$1.isFormData(data)) { 8061 if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { 8062 headers.setContentType(undefined); // Let the browser set it 8063 } else if ((contentType = headers.getContentType()) !== false) { 8064 // fix semicolon duplication issue for ReactNative FormData implementation 8065 const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; 8066 headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); 8067 } 8068 } 8069 8070 // Add xsrf header 8071 // This is only done if running in a standard browser environment. 8072 // Specifically not if we're in a web worker, or react-native. 8073 8074 if (platform.hasStandardBrowserEnv) { 8075 withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); 8076 8077 if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { 8078 // Add xsrf header 8079 const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); 8080 8081 if (xsrfValue) { 8082 headers.set(xsrfHeaderName, xsrfValue); 8083 } 8084 } 8085 } 8086 8087 return newConfig; 8088}; 8089 8090const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; 8091 8092const xhrAdapter = isXHRAdapterSupported && function (config) { 8093 return new Promise(function dispatchXhrRequest(resolve, reject) { 8094 const _config = resolveConfig(config); 8095 let requestData = _config.data; 8096 const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); 8097 let {responseType, onUploadProgress, onDownloadProgress} = _config; 8098 let onCanceled; 8099 let uploadThrottled, downloadThrottled; 8100 let flushUpload, flushDownload; 8101 8102 function done() { 8103 flushUpload && flushUpload(); // flush events 8104 flushDownload && flushDownload(); // flush events 8105 8106 _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled); 8107 8108 _config.signal && _config.signal.removeEventListener('abort', onCanceled); 8109 } 8110 8111 let request = new XMLHttpRequest(); 8112 8113 request.open(_config.method.toUpperCase(), _config.url, true); 8114 8115 // Set the request timeout in MS 8116 request.timeout = _config.timeout; 8117 8118 function onloadend() { 8119 if (!request) { 8120 return; 8121 } 8122 // Prepare the response 8123 const responseHeaders = AxiosHeaders$1.from( 8124 'getAllResponseHeaders' in request && request.getAllResponseHeaders() 8125 ); 8126 const responseData = !responseType || responseType === 'text' || responseType === 'json' ? 8127 request.responseText : request.response; 8128 const response = { 8129 data: responseData, 8130 status: request.status, 8131 statusText: request.statusText, 8132 headers: responseHeaders, 8133 config, 8134 request 8135 }; 8136 8137 settle(function _resolve(value) { 8138 resolve(value); 8139 done(); 8140 }, function _reject(err) { 8141 reject(err); 8142 done(); 8143 }, response); 8144 8145 // Clean up request 8146 request = null; 8147 } 8148 8149 if ('onloadend' in request) { 8150 // Use onloadend if available 8151 request.onloadend = onloadend; 8152 } else { 8153 // Listen for ready state to emulate onloadend 8154 request.onreadystatechange = function handleLoad() { 8155 if (!request || request.readyState !== 4) { 8156 return; 8157 } 8158 8159 // The request errored out and we didn't get a response, this will be 8160 // handled by onerror instead 8161 // With one exception: request that using file: protocol, most browsers 8162 // will return status as 0 even though it's a successful request 8163 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 8164 return; 8165 } 8166 // readystate handler is calling before onerror or ontimeout handlers, 8167 // so we should call onloadend on the next 'tick' 8168 setTimeout(onloadend); 8169 }; 8170 } 8171 8172 // Handle browser request cancellation (as opposed to a manual cancellation) 8173 request.onabort = function handleAbort() { 8174 if (!request) { 8175 return; 8176 } 8177 8178 reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request)); 8179 8180 // Clean up request 8181 request = null; 8182 }; 8183 8184 // Handle low level network errors 8185 request.onerror = function handleError() { 8186 // Real errors are hidden from us by the browser 8187 // onerror should only fire if it's a network error 8188 reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request)); 8189 8190 // Clean up request 8191 request = null; 8192 }; 8193 8194 // Handle timeout 8195 request.ontimeout = function handleTimeout() { 8196 let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; 8197 const transitional = _config.transitional || transitionalDefaults; 8198 if (_config.timeoutErrorMessage) { 8199 timeoutErrorMessage = _config.timeoutErrorMessage; 8200 } 8201 reject(new AxiosError$1( 8202 timeoutErrorMessage, 8203 transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, 8204 config, 8205 request)); 8206 8207 // Clean up request 8208 request = null; 8209 }; 8210 8211 // Remove Content-Type if data is undefined 8212 requestData === undefined && requestHeaders.setContentType(null); 8213 8214 // Add headers to the request 8215 if ('setRequestHeader' in request) { 8216 utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { 8217 request.setRequestHeader(key, val); 8218 }); 8219 } 8220 8221 // Add withCredentials to request if needed 8222 if (!utils$1.isUndefined(_config.withCredentials)) { 8223 request.withCredentials = !!_config.withCredentials; 8224 } 8225 8226 // Add responseType to request if needed 8227 if (responseType && responseType !== 'json') { 8228 request.responseType = _config.responseType; 8229 } 8230 8231 // Handle progress if needed 8232 if (onDownloadProgress) { 8233 ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true)); 8234 request.addEventListener('progress', downloadThrottled); 8235 } 8236 8237 // Not all browsers support upload events 8238 if (onUploadProgress && request.upload) { 8239 ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress)); 8240 8241 request.upload.addEventListener('progress', uploadThrottled); 8242 8243 request.upload.addEventListener('loadend', flushUpload); 8244 } 8245 8246 if (_config.cancelToken || _config.signal) { 8247 // Handle cancellation 8248 // eslint-disable-next-line func-names 8249 onCanceled = cancel => { 8250 if (!request) { 8251 return; 8252 } 8253 reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel); 8254 request.abort(); 8255 request = null; 8256 }; 8257 8258 _config.cancelToken && _config.cancelToken.subscribe(onCanceled); 8259 if (_config.signal) { 8260 _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); 8261 } 8262 } 8263 8264 const protocol = parseProtocol(_config.url); 8265 8266 if (protocol && platform.protocols.indexOf(protocol) === -1) { 8267 reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config)); 8268 return; 8269 } 8270 8271 8272 // Send the request 8273 request.send(requestData || null); 8274 }); 8275}; 8276 8277const composeSignals = (signals, timeout) => { 8278 const {length} = (signals = signals ? signals.filter(Boolean) : []); 8279 8280 if (timeout || length) { 8281 let controller = new AbortController(); 8282 8283 let aborted; 8284 8285 const onabort = function (reason) { 8286 if (!aborted) { 8287 aborted = true; 8288 unsubscribe(); 8289 const err = reason instanceof Error ? reason : this.reason; 8290 controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)); 8291 } 8292 }; 8293 8294 let timer = timeout && setTimeout(() => { 8295 timer = null; 8296 onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT)); 8297 }, timeout); 8298 8299 const unsubscribe = () => { 8300 if (signals) { 8301 timer && clearTimeout(timer); 8302 timer = null; 8303 signals.forEach(signal => { 8304 signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort); 8305 }); 8306 signals = null; 8307 } 8308 }; 8309 8310 signals.forEach((signal) => signal.addEventListener('abort', onabort)); 8311 8312 const {signal} = controller; 8313 8314 signal.unsubscribe = () => utils$1.asap(unsubscribe); 8315 8316 return signal; 8317 } 8318}; 8319 8320const streamChunk = function* (chunk, chunkSize) { 8321 let len = chunk.byteLength; 8322 8323 if (len < chunkSize) { 8324 yield chunk; 8325 return; 8326 } 8327 8328 let pos = 0; 8329 let end; 8330 8331 while (pos < len) { 8332 end = pos + chunkSize; 8333 yield chunk.slice(pos, end); 8334 pos = end; 8335 } 8336}; 8337 8338const readBytes = async function* (iterable, chunkSize) { 8339 for await (const chunk of readStream(iterable)) { 8340 yield* streamChunk(chunk, chunkSize); 8341 } 8342}; 8343 8344const readStream = async function* (stream) { 8345 if (stream[Symbol.asyncIterator]) { 8346 yield* stream; 8347 return; 8348 } 8349 8350 const reader = stream.getReader(); 8351 try { 8352 for (;;) { 8353 const {done, value} = await reader.read(); 8354 if (done) { 8355 break; 8356 } 8357 yield value; 8358 } 8359 } finally { 8360 await reader.cancel(); 8361 } 8362}; 8363 8364const trackStream = (stream, chunkSize, onProgress, onFinish) => { 8365 const iterator = readBytes(stream, chunkSize); 8366 8367 let bytes = 0; 8368 let done; 8369 let _onFinish = (e) => { 8370 if (!done) { 8371 done = true; 8372 onFinish && onFinish(e); 8373 } 8374 }; 8375 8376 return new ReadableStream({ 8377 async pull(controller) { 8378 try { 8379 const {done, value} = await iterator.next(); 8380 8381 if (done) { 8382 _onFinish(); 8383 controller.close(); 8384 return; 8385 } 8386 8387 let len = value.byteLength; 8388 if (onProgress) { 8389 let loadedBytes = bytes += len; 8390 onProgress(loadedBytes); 8391 } 8392 controller.enqueue(new Uint8Array(value)); 8393 } catch (err) { 8394 _onFinish(err); 8395 throw err; 8396 } 8397 }, 8398 cancel(reason) { 8399 _onFinish(reason); 8400 return iterator.return(); 8401 } 8402 }, { 8403 highWaterMark: 2 8404 }) 8405}; 8406 8407const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; 8408const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; 8409 8410// used only inside the fetch adapter 8411const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? 8412 ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : 8413 async (str) => new Uint8Array(await new Response(str).arrayBuffer()) 8414); 8415 8416const test$1 = (fn, ...args) => { 8417 try { 8418 return !!fn(...args); 8419 } catch (e) { 8420 return false 8421 } 8422}; 8423 8424const supportsRequestStream = isReadableStreamSupported && test$1(() => { 8425 let duplexAccessed = false; 8426 8427 const hasContentType = new Request(platform.origin, { 8428 body: new ReadableStream(), 8429 method: 'POST', 8430 get duplex() { 8431 duplexAccessed = true; 8432 return 'half'; 8433 }, 8434 }).headers.has('Content-Type'); 8435 8436 return duplexAccessed && !hasContentType; 8437}); 8438 8439const DEFAULT_CHUNK_SIZE = 64 * 1024; 8440 8441const supportsResponseStream = isReadableStreamSupported && 8442 test$1(() => utils$1.isReadableStream(new Response('').body)); 8443 8444 8445const resolvers = { 8446 stream: supportsResponseStream && ((res) => res.body) 8447}; 8448 8449isFetchSupported && (((res) => { 8450 ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { 8451 !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : 8452 (_, config) => { 8453 throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config); 8454 }); 8455 }); 8456})(new Response)); 8457 8458const getBodyLength = async (body) => { 8459 if (body == null) { 8460 return 0; 8461 } 8462 8463 if(utils$1.isBlob(body)) { 8464 return body.size; 8465 } 8466 8467 if(utils$1.isSpecCompliantForm(body)) { 8468 const _request = new Request(platform.origin, { 8469 method: 'POST', 8470 body, 8471 }); 8472 return (await _request.arrayBuffer()).byteLength; 8473 } 8474 8475 if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) { 8476 return body.byteLength; 8477 } 8478 8479 if(utils$1.isURLSearchParams(body)) { 8480 body = body + ''; 8481 } 8482 8483 if(utils$1.isString(body)) { 8484 return (await encodeText(body)).byteLength; 8485 } 8486}; 8487 8488const resolveBodyLength = async (headers, body) => { 8489 const length = utils$1.toFiniteNumber(headers.getContentLength()); 8490 8491 return length == null ? getBodyLength(body) : length; 8492}; 8493 8494const fetchAdapter = isFetchSupported && (async (config) => { 8495 let { 8496 url, 8497 method, 8498 data, 8499 signal, 8500 cancelToken, 8501 timeout, 8502 onDownloadProgress, 8503 onUploadProgress, 8504 responseType, 8505 headers, 8506 withCredentials = 'same-origin', 8507 fetchOptions 8508 } = resolveConfig(config); 8509 8510 responseType = responseType ? (responseType + '').toLowerCase() : 'text'; 8511 8512 let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout); 8513 8514 let request; 8515 8516 const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => { 8517 composedSignal.unsubscribe(); 8518 }); 8519 8520 let requestContentLength; 8521 8522 try { 8523 if ( 8524 onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && 8525 (requestContentLength = await resolveBodyLength(headers, data)) !== 0 8526 ) { 8527 let _request = new Request(url, { 8528 method: 'POST', 8529 body: data, 8530 duplex: "half" 8531 }); 8532 8533 let contentTypeHeader; 8534 8535 if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { 8536 headers.setContentType(contentTypeHeader); 8537 } 8538 8539 if (_request.body) { 8540 const [onProgress, flush] = progressEventDecorator( 8541 requestContentLength, 8542 progressEventReducer(asyncDecorator(onUploadProgress)) 8543 ); 8544 8545 data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush); 8546 } 8547 } 8548 8549 if (!utils$1.isString(withCredentials)) { 8550 withCredentials = withCredentials ? 'include' : 'omit'; 8551 } 8552 8553 // Cloudflare Workers throws when credentials are defined 8554 // see https://github.com/cloudflare/workerd/issues/902 8555 const isCredentialsSupported = "credentials" in Request.prototype; 8556 request = new Request(url, { 8557 ...fetchOptions, 8558 signal: composedSignal, 8559 method: method.toUpperCase(), 8560 headers: headers.normalize().toJSON(), 8561 body: data, 8562 duplex: "half", 8563 credentials: isCredentialsSupported ? withCredentials : undefined 8564 }); 8565 8566 let response = await fetch(request); 8567 8568 const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); 8569 8570 if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) { 8571 const options = {}; 8572 8573 ['status', 'statusText', 'headers'].forEach(prop => { 8574 options[prop] = response[prop]; 8575 }); 8576 8577 const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); 8578 8579 const [onProgress, flush] = onDownloadProgress && progressEventDecorator( 8580 responseContentLength, 8581 progressEventReducer(asyncDecorator(onDownloadProgress), true) 8582 ) || []; 8583 8584 response = new Response( 8585 trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { 8586 flush && flush(); 8587 unsubscribe && unsubscribe(); 8588 }), 8589 options 8590 ); 8591 } 8592 8593 responseType = responseType || 'text'; 8594 8595 let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); 8596 8597 !isStreamResponse && unsubscribe && unsubscribe(); 8598 8599 return await new Promise((resolve, reject) => { 8600 settle(resolve, reject, { 8601 data: responseData, 8602 headers: AxiosHeaders$1.from(response.headers), 8603 status: response.status, 8604 statusText: response.statusText, 8605 config, 8606 request 8607 }); 8608 }) 8609 } catch (err) { 8610 unsubscribe && unsubscribe(); 8611 8612 if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) { 8613 throw Object.assign( 8614 new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request), 8615 { 8616 cause: err.cause || err 8617 } 8618 ) 8619 } 8620 8621 throw AxiosError$1.from(err, err && err.code, config, request); 8622 } 8623}); 8624 8625const knownAdapters = { 8626 http: httpAdapter, 8627 xhr: xhrAdapter, 8628 fetch: fetchAdapter 8629}; 8630
vendor: 9,422 bytes, lines 8631-8972
8631utils$1.forEach(knownAdapters, (fn, value) => { 8632 if (fn) { 8633 try { 8634 Object.defineProperty(fn, 'name', {value}); 8635 } catch (e) { 8636 // eslint-disable-next-line no-empty 8637 } 8638 Object.defineProperty(fn, 'adapterName', {value}); 8639 } 8640}); 8641 8642const renderReason = (reason) => `- ${reason}`; 8643 8644const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; 8645 8646const adapters = { 8647 getAdapter: (adapters) => { 8648 adapters = utils$1.isArray(adapters) ? adapters : [adapters]; 8649 8650 const {length} = adapters; 8651 let nameOrAdapter; 8652 let adapter; 8653 8654 const rejectedReasons = {}; 8655 8656 for (let i = 0; i < length; i++) { 8657 nameOrAdapter = adapters[i]; 8658 let id; 8659 8660 adapter = nameOrAdapter; 8661 8662 if (!isResolvedHandle(nameOrAdapter)) { 8663 adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; 8664 8665 if (adapter === undefined) { 8666 throw new AxiosError$1(`Unknown adapter '${id}'`); 8667 } 8668 } 8669 8670 if (adapter) { 8671 break; 8672 } 8673 8674 rejectedReasons[id || '#' + i] = adapter; 8675 } 8676 8677 if (!adapter) { 8678 8679 const reasons = Object.entries(rejectedReasons) 8680 .map(([id, state]) => `adapter ${id} ` + 8681 (state === false ? 'is not supported by the environment' : 'is not available in the build') 8682 ); 8683 8684 let s = length ? 8685 (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : 8686 'as no adapter specified'; 8687 8688 throw new AxiosError$1( 8689 `There is no suitable adapter to dispatch the request ` + s, 8690 'ERR_NOT_SUPPORT' 8691 ); 8692 } 8693 8694 return adapter; 8695 }, 8696 adapters: knownAdapters 8697}; 8698 8699/** 8700 * Throws a `CanceledError` if cancellation has been requested. 8701 * 8702 * @param {Object} config The config that is to be used for the request 8703 * 8704 * @returns {void} 8705 */ 8706function throwIfCancellationRequested(config) { 8707 if (config.cancelToken) { 8708 config.cancelToken.throwIfRequested(); 8709 } 8710 8711 if (config.signal && config.signal.aborted) { 8712 throw new CanceledError$1(null, config); 8713 } 8714} 8715 8716/** 8717 * Dispatch a request to the server using the configured adapter. 8718 * 8719 * @param {object} config The config that is to be used for the request 8720 * 8721 * @returns {Promise} The Promise to be fulfilled 8722 */ 8723function dispatchRequest(config) { 8724 throwIfCancellationRequested(config); 8725 8726 config.headers = AxiosHeaders$1.from(config.headers); 8727 8728 // Transform request data 8729 config.data = transformData.call( 8730 config, 8731 config.transformRequest 8732 ); 8733 8734 if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { 8735 config.headers.setContentType('application/x-www-form-urlencoded', false); 8736 } 8737 8738 const adapter = adapters.getAdapter(config.adapter || defaults.adapter); 8739 8740 return adapter(config).then(function onAdapterResolution(response) { 8741 throwIfCancellationRequested(config); 8742 8743 // Transform response data 8744 response.data = transformData.call( 8745 config, 8746 config.transformResponse, 8747 response 8748 ); 8749 8750 response.headers = AxiosHeaders$1.from(response.headers); 8751 8752 return response; 8753 }, function onAdapterRejection(reason) { 8754 if (!isCancel$1(reason)) { 8755 throwIfCancellationRequested(config); 8756 8757 // Transform response data 8758 if (reason && reason.response) { 8759 reason.response.data = transformData.call( 8760 config, 8761 config.transformResponse, 8762 reason.response 8763 ); 8764 reason.response.headers = AxiosHeaders$1.from(reason.response.headers); 8765 } 8766 } 8767 8768 return Promise.reject(reason); 8769 }); 8770} 8771 8772const VERSION$1 = "1.9.0"; 8773 8774const validators$1 = {}; 8775 8776// eslint-disable-next-line func-names 8777['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { 8778 validators$1[type] = function validator(thing) { 8779 return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; 8780 }; 8781}); 8782 8783const deprecatedWarnings = {}; 8784 8785/** 8786 * Transitional option validator 8787 * 8788 * @param {function|boolean?} validator - set to false if the transitional option has been removed 8789 * @param {string?} version - deprecated version / removed since version 8790 * @param {string?} message - some message with additional info 8791 * 8792 * @returns {function} 8793 */ 8794validators$1.transitional = function transitional(validator, version, message) { 8795 function formatMessage(opt, desc) { 8796 return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); 8797 } 8798 8799 // eslint-disable-next-line func-names 8800 return (value, opt, opts) => { 8801 if (validator === false) { 8802 throw new AxiosError$1( 8803 formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), 8804 AxiosError$1.ERR_DEPRECATED 8805 ); 8806 } 8807 8808 if (version && !deprecatedWarnings[opt]) { 8809 deprecatedWarnings[opt] = true; 8810 // eslint-disable-next-line no-console 8811 console.warn( 8812 formatMessage( 8813 opt, 8814 ' has been deprecated since v' + version + ' and will be removed in the near future' 8815 ) 8816 ); 8817 } 8818 8819 return validator ? validator(value, opt, opts) : true; 8820 }; 8821}; 8822 8823validators$1.spelling = function spelling(correctSpelling) { 8824 return (value, opt) => { 8825 // eslint-disable-next-line no-console 8826 console.warn(`${opt} is likely a misspelling of ${correctSpelling}`); 8827 return true; 8828 } 8829}; 8830 8831/** 8832 * Assert object's properties type 8833 * 8834 * @param {object} options 8835 * @param {object} schema 8836 * @param {boolean?} allowUnknown 8837 * 8838 * @returns {object} 8839 */ 8840 8841function assertOptions(options, schema, allowUnknown) { 8842 if (typeof options !== 'object') { 8843 throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE); 8844 } 8845 const keys = Object.keys(options); 8846 let i = keys.length; 8847 while (i-- > 0) { 8848 const opt = keys[i]; 8849 const validator = schema[opt]; 8850 if (validator) { 8851 const value = options[opt]; 8852 const result = value === undefined || validator(value, opt, options); 8853 if (result !== true) { 8854 throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE); 8855 } 8856 continue; 8857 } 8858 if (allowUnknown !== true) { 8859 throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION); 8860 } 8861 } 8862} 8863 8864const validator = { 8865 assertOptions, 8866 validators: validators$1 8867}; 8868 8869const validators = validator.validators; 8870 8871/** 8872 * Create a new instance of Axios 8873 * 8874 * @param {Object} instanceConfig The default config for the instance 8875 * 8876 * @return {Axios} A new instance of Axios 8877 */ 8878let Axios$1 = class Axios { 8879 constructor(instanceConfig) { 8880 this.defaults = instanceConfig || {}; 8881 this.interceptors = { 8882 request: new InterceptorManager(), 8883 response: new InterceptorManager() 8884 }; 8885 } 8886 8887 /** 8888 * Dispatch a request 8889 * 8890 * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) 8891 * @param {?Object} config 8892 * 8893 * @returns {Promise} The Promise to be fulfilled 8894 */ 8895 async request(configOrUrl, config) { 8896 try { 8897 return await this._request(configOrUrl, config); 8898 } catch (err) { 8899 if (err instanceof Error) { 8900 let dummy = {}; 8901 8902 Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error()); 8903 8904 // slice off the Error: ... line 8905 const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; 8906 try { 8907 if (!err.stack) { 8908 err.stack = stack; 8909 // match without the 2 top stack lines 8910 } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { 8911 err.stack += '\n' + stack; 8912 } 8913 } catch (e) { 8914 // ignore the case where "stack" is an un-writable property 8915 } 8916 } 8917 8918 throw err; 8919 } 8920 } 8921 8922 _request(configOrUrl, config) { 8923 /*eslint no-param-reassign:0*/ 8924 // Allow for axios('example/url'[, config]) a la fetch API 8925 if (typeof configOrUrl === 'string') { 8926 config = config || {}; 8927 config.url = configOrUrl; 8928 } else { 8929 config = configOrUrl || {}; 8930 } 8931 8932 config = mergeConfig$1(this.defaults, config); 8933 8934 const {transitional, paramsSerializer, headers} = config; 8935 8936 if (transitional !== undefined) { 8937 validator.assertOptions(transitional, { 8938 silentJSONParsing: validators.transitional(validators.boolean), 8939 forcedJSONParsing: validators.transitional(validators.boolean), 8940 clarifyTimeoutError: validators.transitional(validators.boolean) 8941 }, false); 8942 } 8943 8944 if (paramsSerializer != null) { 8945 if (utils$1.isFunction(paramsSerializer)) { 8946 config.paramsSerializer = { 8947 serialize: paramsSerializer 8948 }; 8949 } else { 8950 validator.assertOptions(paramsSerializer, { 8951 encode: validators.function, 8952 serialize: validators.function 8953 }, true); 8954 } 8955 } 8956 8957 // Set config.allowAbsoluteUrls 8958 if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) { 8959 config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls; 8960 } else { 8961 config.allowAbsoluteUrls = true; 8962 } 8963 8964 validator.assertOptions(config, { 8965 baseUrl: validators.spelling('baseURL'), 8966 withXsrfToken: validators.spelling('withXSRFToken') 8967 }, true); 8968 8969 // Set config.method 8970 config.method = (config.method || this.defaults.method || 'get').toLowerCase(); 8971 8972 // Flatten headers
vendor: 5,940 bytes, lines 8973-9215
8973 let contextHeaders = headers && utils$1.merge( 8974 headers.common, 8975 headers[config.method] 8976 ); 8977 8978 headers && utils$1.forEach( 8979 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 8980 (method) => { 8981 delete headers[method]; 8982 } 8983 ); 8984 8985 config.headers = AxiosHeaders$1.concat(contextHeaders, headers); 8986 8987 // filter out skipped interceptors 8988 const requestInterceptorChain = []; 8989 let synchronousRequestInterceptors = true; 8990 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 8991 if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { 8992 return; 8993 } 8994 8995 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; 8996 8997 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); 8998 }); 8999 9000 const responseInterceptorChain = []; 9001 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 9002 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); 9003 }); 9004 9005 let promise; 9006 let i = 0; 9007 let len; 9008 9009 if (!synchronousRequestInterceptors) { 9010 const chain = [dispatchRequest.bind(this), undefined]; 9011 chain.unshift.apply(chain, requestInterceptorChain); 9012 chain.push.apply(chain, responseInterceptorChain); 9013 len = chain.length; 9014 9015 promise = Promise.resolve(config); 9016 9017 while (i < len) { 9018 promise = promise.then(chain[i++], chain[i++]); 9019 } 9020 9021 return promise; 9022 } 9023 9024 len = requestInterceptorChain.length; 9025 9026 let newConfig = config; 9027 9028 i = 0; 9029 9030 while (i < len) { 9031 const onFulfilled = requestInterceptorChain[i++]; 9032 const onRejected = requestInterceptorChain[i++]; 9033 try { 9034 newConfig = onFulfilled(newConfig); 9035 } catch (error) { 9036 onRejected.call(this, error); 9037 break; 9038 } 9039 } 9040 9041 try { 9042 promise = dispatchRequest.call(this, newConfig); 9043 } catch (error) { 9044 return Promise.reject(error); 9045 } 9046 9047 i = 0; 9048 len = responseInterceptorChain.length; 9049 9050 while (i < len) { 9051 promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); 9052 } 9053 9054 return promise; 9055 } 9056 9057 getUri(config) { 9058 config = mergeConfig$1(this.defaults, config); 9059 const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls); 9060 return buildURL(fullPath, config.params, config.paramsSerializer); 9061 } 9062}; 9063 9064// Provide aliases for supported request methods 9065utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 9066 /*eslint func-names:0*/ 9067 Axios$1.prototype[method] = function(url, config) { 9068 return this.request(mergeConfig$1(config || {}, { 9069 method, 9070 url, 9071 data: (config || {}).data 9072 })); 9073 }; 9074}); 9075 9076utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 9077 /*eslint func-names:0*/ 9078 9079 function generateHTTPMethod(isForm) { 9080 return function httpMethod(url, data, config) { 9081 return this.request(mergeConfig$1(config || {}, { 9082 method, 9083 headers: isForm ? { 9084 'Content-Type': 'multipart/form-data' 9085 } : {}, 9086 url, 9087 data 9088 })); 9089 }; 9090 } 9091 9092 Axios$1.prototype[method] = generateHTTPMethod(); 9093 9094 Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true); 9095}); 9096 9097/** 9098 * A `CancelToken` is an object that can be used to request cancellation of an operation. 9099 * 9100 * @param {Function} executor The executor function. 9101 * 9102 * @returns {CancelToken} 9103 */ 9104let CancelToken$1 = class CancelToken { 9105 constructor(executor) { 9106 if (typeof executor !== 'function') { 9107 throw new TypeError('executor must be a function.'); 9108 } 9109 9110 let resolvePromise; 9111 9112 this.promise = new Promise(function promiseExecutor(resolve) { 9113 resolvePromise = resolve; 9114 }); 9115 9116 const token = this; 9117 9118 // eslint-disable-next-line func-names 9119 this.promise.then(cancel => { 9120 if (!token._listeners) return; 9121 9122 let i = token._listeners.length; 9123 9124 while (i-- > 0) { 9125 token._listeners[i](cancel); 9126 } 9127 token._listeners = null; 9128 }); 9129 9130 // eslint-disable-next-line func-names 9131 this.promise.then = onfulfilled => { 9132 let _resolve; 9133 // eslint-disable-next-line func-names 9134 const promise = new Promise(resolve => { 9135 token.subscribe(resolve); 9136 _resolve = resolve; 9137 }).then(onfulfilled); 9138 9139 promise.cancel = function reject() { 9140 token.unsubscribe(_resolve); 9141 }; 9142 9143 return promise; 9144 }; 9145 9146 executor(function cancel(message, config, request) { 9147 if (token.reason) { 9148 // Cancellation has already been requested 9149 return; 9150 } 9151 9152 token.reason = new CanceledError$1(message, config, request); 9153 resolvePromise(token.reason); 9154 }); 9155 } 9156 9157 /** 9158 * Throws a `CanceledError` if cancellation has been requested. 9159 */ 9160 throwIfRequested() { 9161 if (this.reason) { 9162 throw this.reason; 9163 } 9164 } 9165 9166 /** 9167 * Subscribe to the cancel signal 9168 */ 9169 9170 subscribe(listener) { 9171 if (this.reason) { 9172 listener(this.reason); 9173 return; 9174 } 9175 9176 if (this._listeners) { 9177 this._listeners.push(listener); 9178 } else { 9179 this._listeners = [listener]; 9180 } 9181 } 9182 9183 /** 9184 * Unsubscribe from the cancel signal 9185 */ 9186 9187 unsubscribe(listener) { 9188 if (!this._listeners) { 9189 return; 9190 } 9191 const index = this._listeners.indexOf(listener); 9192 if (index !== -1) { 9193 this._listeners.splice(index, 1); 9194 } 9195 } 9196 9197 toAbortSignal() { 9198 const controller = new AbortController(); 9199 9200 const abort = (err) => { 9201 controller.abort(err); 9202 }; 9203 9204 this.subscribe(abort); 9205 9206 controller.signal.unsubscribe = () => this.unsubscribe(abort); 9207 9208 return controller.signal; 9209 } 9210 9211 /** 9212 * Returns an object that contains a new `CancelToken` and a function that, when called, 9213 * cancels the `CancelToken`. 9214 */ 9215 static source() {
9216 let cancel; 9217 const token = new CancelToken(function executor(c) { 9218 cancel = c; 9219 }); 9220 return { 9221 token, 9222 cancel 9223 }; 9224 } 9225}; 9226 9227/** 9228 * Syntactic sugar for invoking a function and expanding an array for arguments. 9229 * 9230 * Common use case would be to use `Function.prototype.apply`. 9231 * 9232 * ```js 9233 * function f(x, y, z) {} 9234 * var args = [1, 2, 3]; 9235 * f.apply(null, args); 9236 * ``` 9237 * 9238 * With `spread` this example can be re-written. 9239 * 9240 * ```js 9241 * spread(function(x, y, z) {})([1, 2, 3]); 9242 * ``` 9243 * 9244 * @param {Function} callback 9245 * 9246 * @returns {Function} 9247 */ 9248function spread$1(callback) { 9249 return function wrap(arr) { 9250 return callback.apply(null, arr); 9251 }; 9252} 9253 9254/** 9255 * Determines whether the payload is an error thrown by Axios 9256 * 9257 * @param {*} payload The value to test 9258 * 9259 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false 9260 */ 9261function isAxiosError$1(payload) { 9262 return utils$1.isObject(payload) && (payload.isAxiosError === true); 9263} 9264 9265const HttpStatusCode$1 = { 9266 Continue: 100, 9267 SwitchingProtocols: 101, 9268 Processing: 102, 9269 EarlyHints: 103, 9270 Ok: 200, 9271 Created: 201, 9272 Accepted: 202, 9273 NonAuthoritativeInformation: 203, 9274 NoContent: 204, 9275 ResetContent: 205, 9276 PartialContent: 206, 9277 MultiStatus: 207, 9278 AlreadyReported: 208, 9279 ImUsed: 226, 9280 MultipleChoices: 300, 9281 MovedPermanently: 301, 9282 Found: 302, 9283 SeeOther: 303, 9284 NotModified: 304, 9285 UseProxy: 305, 9286 Unused: 306, 9287 TemporaryRedirect: 307, 9288 PermanentRedirect: 308, 9289 BadRequest: 400, 9290 Unauthorized: 401, 9291 PaymentRequired: 402, 9292 Forbidden: 403, 9293 NotFound: 404, 9294 MethodNotAllowed: 405, 9295 NotAcceptable: 406, 9296 ProxyAuthenticationRequired: 407, 9297 RequestTimeout: 408, 9298 Conflict: 409, 9299 Gone: 410, 9300 LengthRequired: 411, 9301 PreconditionFailed: 412, 9302 PayloadTooLarge: 413, 9303 UriTooLong: 414, 9304 UnsupportedMediaType: 415, 9305 RangeNotSatisfiable: 416, 9306 ExpectationFailed: 417, 9307 ImATeapot: 418, 9308 MisdirectedRequest: 421, 9309 UnprocessableEntity: 422, 9310 Locked: 423, 9311 FailedDependency: 424, 9312 TooEarly: 425, 9313 UpgradeRequired: 426, 9314 PreconditionRequired: 428, 9315 TooManyRequests: 429, 9316 RequestHeaderFieldsTooLarge: 431, 9317 UnavailableForLegalReasons: 451, 9318 InternalServerError: 500, 9319 NotImplemented: 501, 9320 BadGateway: 502, 9321 ServiceUnavailable: 503, 9322 GatewayTimeout: 504, 9323 HttpVersionNotSupported: 505, 9324 VariantAlsoNegotiates: 506, 9325 InsufficientStorage: 507, 9326 LoopDetected: 508, 9327 NotExtended: 510, 9328 NetworkAuthenticationRequired: 511, 9329}; 9330 9331Object.entries(HttpStatusCode$1).forEach(([key, value]) => { 9332 HttpStatusCode$1[value] = key; 9333}); 9334 9335/** 9336 * Create an instance of Axios 9337 * 9338 * @param {Object} defaultConfig The default config for the instance 9339 * 9340 * @returns {Axios} A new instance of Axios 9341 */ 9342function createInstance$1(defaultConfig) { 9343 const context = new Axios$1(defaultConfig); 9344 const instance = bind(Axios$1.prototype.request, context); 9345 9346 // Copy axios.prototype to instance 9347 utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); 9348 9349 // Copy context to instance 9350 utils$1.extend(instance, context, null, {allOwnKeys: true}); 9351 9352 // Factory for creating new instances 9353 instance.create = function create(instanceConfig) { 9354 return createInstance$1(mergeConfig$1(defaultConfig, instanceConfig)); 9355 }; 9356 9357 return instance; 9358} 9359 9360// Create the default instance to be exported 9361const axios$1 = createInstance$1(defaults); 9362 9363// Expose Axios class to allow class inheritance 9364axios$1.Axios = Axios$1; 9365 9366// Expose Cancel & CancelToken 9367axios$1.CanceledError = CanceledError$1; 9368axios$1.CancelToken = CancelToken$1; 9369axios$1.isCancel = isCancel$1; 9370axios$1.VERSION = VERSION$1; 9371axios$1.toFormData = toFormData$1; 9372 9373// Expose AxiosError class 9374axios$1.AxiosError = AxiosError$1; 9375 9376// alias for CanceledError for backward compatibility 9377axios$1.Cancel = axios$1.CanceledError; 9378 9379// Expose all/spread 9380axios$1.all = function all(promises) { 9381 return Promise.all(promises); 9382}; 9383 9384axios$1.spread = spread$1; 9385 9386// Expose isAxiosError 9387axios$1.isAxiosError = isAxiosError$1; 9388 9389// Expose mergeConfig 9390axios$1.mergeConfig = mergeConfig$1; 9391 9392axios$1.AxiosHeaders = AxiosHeaders$1; 9393 9394axios$1.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); 9395 9396axios$1.getAdapter = adapters.getAdapter; 9397 9398axios$1.HttpStatusCode = HttpStatusCode$1; 9399 9400axios$1.default = axios$1; 9401 9402// This module is intended to unwrap Axios default export as named. 9403// Keep top-level export same with static properties 9404// so that it can keep same with es module or cjs 9405const { 9406 Axios, 9407 AxiosError, 9408 CanceledError, 9409 isCancel, 9410 CancelToken, 9411 VERSION, 9412 all, 9413 Cancel, 9414 isAxiosError, 9415 spread, 9416 toFormData, 9417 AxiosHeaders, 9418 HttpStatusCode, 9419 formToJSON, 9420 getAdapter, 9421 mergeConfig 9422} = axios$1; 9423 9424const __vite_import_meta_env__ = {}; 9425const backendUrlFromEnv = __vite_import_meta_env__?.VITE_BACKEND_URL || void 0; 9426const BACKEND_URL = backendUrlFromEnv ? backendUrlFromEnv : `${window.location.protocol}//api.${window.location.hostname.replace("public.", "")}`; 9427const API_URL = `${BACKEND_URL}`; 9428const API_URLS = { 9429 // auth 9430 LOGIN: `${API_URL}
9430/v1/profile/auth/token/obtain/`, 9431 REGISTRATION: `${API_URL}/v1/profile/user-registration/`, 9432 REFRESH_TOKEN: `${API_URL}/v1/profile/auth/token/refresh/`, 9433 VERIFY_TOKEN: `${API_URL}/v1/profile/auth/token/verify/`, 9434 LOGOUT: `${API_URL}/v1/profile/auth/logout/`, 9435 SOCIAL_LOGIN: `${API_URL}/v1/profile/auth/token/social/google-oauth2/`, 9436 REGISTER_LOGIN: `${API_URL}/v1/profile/auth/token/social/google-oauth2/`, 9437 RESEND_PASSWORD: `${API_URL}/v1/profile/user-resend-password/`, 9438 RESEND_PASSWORD_VERIFY: `${API_URL}/v1/profile/user-resend-password/verify/`, 9439 // profile 9440 PROFILE: `${API_URL}/v1/profile/recieve/`, 9441 BOOK_MEETING: `${API_URL}/v1/profile/book-meeting/`, 9442 WAITLIST: `${API_URL}/v1/profile/waitlist/`, 9443 REMOVE: `${API_URL}/v1/profile/profile/remove/`, 9444 PROFILE_ESTIMATIONS: `${API_URL}/v1/profile/cost-estimate/?limit=100&offset=0`, 9445 PROFILE_BUSINESS: `${API_URL}/v1/profile/business-estimate/?limit=100&offset=0`, 9446 PROFILE_PATENT: `${API_URL}/v1/profile/patent-estimate/?limit=100&offset=0`, 9447 //estimate 9448 SIGN_NDA: `${API_URL}/v1/proposal/user-nda/sign/`, 9449 FEEDBACK: `${API_URL}/v1/proposal/feedback/`, 9450 PROJECT_FILE_DESCRIPTION: `${API_URL}/v2/proposal/cost-estimate/file-project-description/`, 9451 PROJECT_FILE_DESCRIPTION_ASYNC: `${API_URL}/v2/proposal/cost-estimate/file-project-description-async/`, 9452 SAVE_PROJECT_DESCRIPTION: `${API_URL}/v2/proposal/cost-estimate/project-description/`, 9453 SAVE_PROJECT_DESCRIPTION_ASYNC: `${API_URL}/v2/proposal/cost-estimate/project-description-async/`, 9454 TASK_STEP_STATUS: `${API_URL}/v2/proposal/cost-estimate/task-step-status/`, 9455 COST_ESTIMATE: `${API_URL}/v2/proposal/cost-estimate/`, 9456 LANGUAGE: `${API_URL}/v2/proposal/language/`, 9457 GENERATE_ESTIMATE: `${API_URL}/v2/proposal/cost-estimate/generate-estimate/`, 9458 GENERATE_ESTIMATE_ASYNC: `${API_URL}/v2/proposal/cost-estimate/generate-estimate-async/`, 9459 SELECT_FEATURES: `${API_URL}/v2/proposal/cost-estimate/select-features/`, 9460 SHORT_VERSION: `${API_URL}/v2/proposal/cost-estimate/short-version/`, 9461 GENERATE_TARGET_AUDIENCE: `${API_URL}/v2/proposal/cost-estimate/generate-target-audience/`, 9462 DOWNLOAD_ESTIMATE: `${API_URL}/v2/proposal/cost-estimate/download-estimate/`, 9463 SEND_PROPOSAL_ESTIMATE: `${API_URL}/v2/proposal/cost-estimate/send-estimate/`, 9464 //business 9465 CUSTOMER_SEGMENTS: `${API_URL}/v1/business/business-estimate/customer-segments/`, 9466 FILE_CUSTOMER_SEGMENTS: `${API_URL}/v1/business/business-estimate/file-customer-segments/`, 9467 SEGMENTS: `${API_URL}/v1/business/business-estimate/segments/`, 9468 GENERATE_SEGMENT: `${API_URL}/v1/business/business-estimate/generate-segment/`, 9469 UPDATE_SEGMENT: `${API_URL}/v1/business/business-estimate/update-segment/`, 9470 HLC: `${API_URL}/v1/business/business-estimate/high-level-components/`, 9471 USER_STORY: `${API_URL}/v1/business/business-estimate/user-story-and-mvp/`, 9472 USER_STORY_ASYNC: `${API_URL}/v1/business/business-estimate/user-story-and-mvp-async/`, 9473 BUSINESS_TASK_STEP_STATUS: `${API_URL}/v1/business/business-estimate/task-step-status/`, 9474 DOWNLOAD_BLUEPRINT: `${API_URL}/v1/business/business-estimate/download-estimate/`, 9475 BIND_BUSINESS: `${API_URL}/v1/business/business-estimate/bind/`, 9476 SEND_BUSINESS_ESTIMATE: `${API_URL}/v1/business/business-estimate/send-estimate/`, 9477 //patent 9478 CREATE_PATENT: `${API_URL}/v1/patent/patent-estimate/create/`, 9479 PATENT_IMAGE: `${API_URL}/v1/patent/patent-estimate/image/`, 9480 PATENT_MARKERS: `${API_URL}/v1/patent/patent-estimate/image-markers/`, 9481 PATENT_INTERACTIONS: `${API_URL}/v1/patent/patent-estimate/image-markers-interactions/`, 9482 PATENT_AREA: `${API_URL}/v1/patent/patent-estimate/patent-area/`, 9483 PATENT_ABSTRACT: `${API_URL}/v1/patent/patent-estimate/generate-abstract/`, 9484 DOWNLOAD_PATENT: `${API_URL}/v1/patent/patent-estimate/download-estimate/`, 9485 BIND_PATENT: `${API_URL}/v1/patent/patent-estimate/bind/`, 9486 SEND_PATENT_ESTIMATE: `${API_URL}/v1/patent/patent-estimate/send-estimate/` 9487}; 9488 9489const config = { 9490 // eslint-disable-next-line @typescript-eslint/ban-ts-comment 9491 // @ts-ignore 9492 VITE_APPLE_CLIENT_ID: "ai.costquest.si", 9493 // eslint-disable-next-line @typescript-eslint/ban-ts-comment 9494 // @ts-ignore 9495 VITE_GOOGLE_CLIENT_ID: "98231395084-s3gi1oae98aekllnc8crm1v1q642i580.apps.googleusercontent.com"}; 9496 9497const { VITE_GOOGLE_CLIENT_ID, VITE_APPLE_CLIENT_ID} = config; 9498const JWT_ACCESS = "JWT-access"; 9499const JWT_REFRESH = "JWT-refresh"; 9500const GOOGLE_SCOPES = [ 9501 "https://www.googleapis.com/auth/userinfo.email", 9502 "https://www.googleapis.com/auth/userinfo.profile" 9503]; 9504const GOOGLE_AUTH_URI = "https://accounts.google.com/o/oauth2/auth"; 9505const GOOGLE_CLIENT_ID = VITE_GOOGLE_CLIENT_ID; 9506const APPLE_CLIENT_ID = VITE_APPLE_CLIENT_ID; 9507const BASE_URL = window.location.origin || ""; 9508const GOOGLE_REDIRECT_SIGN_UP_URI = `${BASE_URL}/auth/google/signup`; 9509const GOOGLE_REDIRECT_SIGN_IN_URI = `${BASE_URL}/auth/google/signin`; 9510const GOOGLE_AUTH_REQUEST_DATA = { 9511 response_type: "token", 9512 client_id: GOOGLE_CLIENT_ID, 9513 scope: GOOGLE_SCOPES.join(" ") 9514}; 9515const APPLE_AUTH_URI = "https://appleid.apple.com/auth/authorize"; 9516const APPLE_REDIRECT_SIGN_UP_URI = `${BASE_URL}/auth/apple/signup`; 9517const APPLE_REDIRECT_SIGN_IN_URI = `${BASE_URL}/auth/apple/signin`; 9518const APPLE_AUTH_REQUEST_DATA = { 9519 response_type: "code", 9520 client_id: APPLE_CLIENT_ID, 9521 scope: encodeURIComponent("name email"), 9522 response_mode: "query", 9523 state: "123" 9524}; 9525 9526function authRequestInterceptor(config) { 9527 try { 9528 if (config.headers) { 9529 config.headers.Accept = "application/json"; 9530 } 9531 const token = localStorage.getItem(JWT_ACCESS); 9532 if (token) { 9533 config.headers.Authorization = `Bearer ${token}`; 9534 } 9535 ; 9536 return config; 9537 } catch (e) { 9538 throw new axios$1.Cancel(e); 9539 } 9540} 9541const axios = axios$1.create({ 9542 baseURL: API_URL, 9543 headers: { 9544 "Content-Type": "application/json" 9545 }, 9546 withCredentials: true 9547}); 9548axios.interceptors.request.use(authRequestInterceptor); 9549axios.interceptors.response.use(null, async (error) => { 9550 if (error.response && error.response?.status === 401 && !error.config.tokenRefreshed) { 9551 try { 9552 RefreshTokenFunc(); 9553 } catch (e) { 9554 refreshLogoutFunc(); 9555 return Promise.reject(new axios$1.Cancel(e)); 9556 }
9557 return axios({ ...error.config, tokenRefreshed: true }); 9558 } 9559 if (axios$1.isCancel(error) && error.message instanceof RefreshTokenError) { 9560 refreshLogoutFunc(); 9561 } 9562 return Promise.reject(error); 9563}); 9564 9565const AuthContext = reactExports.createContext(null); 9566const RefreshTokenFunc = async () => { 9567 try { 9568 const { data } = await axios.post(API_URLS.REFRESH_TOKEN, { refresh: localStorage.getItem(JWT_REFRESH) }); 9569 localStorage.setItem(JWT_ACCESS, data.access); 9570 } catch (e) { 9571 console.log(e); 9572 throw e; 9573 } 9574}; 9575const refreshLogoutFunc = async () => { 9576 try { 9577 await axios.post(API_URLS.LOGOUT); 9578 } finally { 9579 localStorage.clear(); 9580 window.location.reload(); 9581 } 9582}; 9583const deleteAccauntFunc = async () => { 9584 try { 9585 await axios.delete(API_URLS.REMOVE); 9586 } finally { 9587 localStorage.clear(); 9588 } 9589}; 9590const AuthProvider = ({ children }) => { 9591 const [user, setUser] = reactExports.useState(null); 9592 const [authLoading, setAuthLoading] = reactExports.useState(true); 9593 const authorize = async (isLogin, authData) => { 9594 try { 9595 setAuthLoading(true); 9596 const { data } = await axios.post(isLogin ? API_URLS.LOGIN : API_URLS.REGISTRATION, authData); 9597 setUser({ email: authData.email, isAuth: true }); 9598 localStorage.setItem(JWT_ACCESS, data.access); 9599 localStorage.setItem(JWT_REFRESH, data.refresh); 9600 } catch (e) { 9601 console.log(e); 9602 throw e; 9603 } finally { 9604 setAuthLoading(false); 9605 } 9606 }; 9607 const loginUsingGoogle = (isLogin) => { 9608 location.href = `${GOOGLE_AUTH_URI}?${new URLSearchParams({ 9609 ...GOOGLE_AUTH_REQUEST_DATA, 9610 redirect_uri: isLogin ? GOOGLE_REDIRECT_SIGN_IN_URI : GOOGLE_REDIRECT_SIGN_UP_URI 9611 })}`; 9612 }; 9613 const loginUsingApple = (isLogin) => { 9614 location.href = `${APPLE_AUTH_URI}?${new URLSearchParams({ 9615 ...APPLE_AUTH_REQUEST_DATA, 9616 redirect_uri: isLogin ? APPLE_REDIRECT_SIGN_IN_URI : APPLE_REDIRECT_SIGN_UP_URI 9617 })}`; 9618 }; 9619 const loginWithToken = async (jwtAccess, jwtRefresh) => { 9620 localStorage.setItem(JWT_ACCESS, jwtAccess); 9621 localStorage.setItem(JWT_REFRESH, jwtRefresh); 9622 setUser({ email: "", isAuth: true }); 9623 }; 9624 const logout = async () => { 9625 try { 9626 await axios.post(API_URLS.LOGOUT); 9627 } finally { 9628 setUser(null); 9629 localStorage.clear(); 9630 } 9631 }; 9632 const checkAuth = async () => { 9633 setAuthLoading(true); 9634 try { 9635 const token = localStorage.getItem(JWT_ACCESS); 9636 if (!token) { 9637 setUser(null); 9638 localStorage.removeItem(JWT_ACCESS); 9639 localStorage.removeItem(JWT_REFRESH); 9640 return; 9641 } 9642 const { status } = await axios.post(API_URLS.VERIFY_TOKEN, { 9643 token: localStorage.getItem(JWT_ACCESS) 9644 }); 9645 if (status !== 200) { 9646 await logout(); 9647 return; 9648 } 9649 ; 9650 setUser({ email: "", isAuth: true }); 9651 } catch (err) { 9652 await logout(); 9653 } finally { 9654 setAuthLoading(false); 9655 } 9656 }; 9657 reactExports.useEffect(() => { 9658 checkAuth(); 9659 }, []); 9660 const value = reactExports.useMemo( 9661 () => ({ 9662 user, 9663 authorize, 9664 authLoading, 9665 checkAuth, 9666 logout, 9667 loginUsingGoogle, 9668 loginUsingApple, 9669 loginWithToken, 9670 setUser 9671 }), 9672 [user, authLoading] 9673 ); 9674 return /* @__PURE__ */ jsxRuntimeExports.jsx(AuthContext.Provider, { value, children }); 9675}; 9676const useAuth = () => { 9677 return reactExports.useContext(AuthContext); 9678}; 9679 9680const Guard = ({ children }) => { 9681 const { user, authLoading } = useAuth(); 9682 localStorage.getItem(SESSION_ID_NAME); 9683 localStorage.getItem(STATE_ID_NAME); 9684 return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children }); 9685}; 9686 9687function r$1(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r$1(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r$1(e))&&(n&&(n+=" "),n+=t);return n} 9688 9689const CLASS_PART_SEPARATOR = '-'; 9690function createClassGroupUtils(config) { 9691 const classMap = createClassMap(config); 9692 const { 9693 conflictingClassGroups, 9694 conflictingClassGroupModifiers 9695 } = config; 9696 function getClassGroupId(className) { 9697 const classParts = className.split(CLASS_PART_SEPARATOR); 9698 // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts. 9699 if (classParts[0] === '' && classParts.length !== 1) { 9700 classParts.shift(); 9701 } 9702 return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryPro
vendor: 9,044 bytes, lines 9702-9970
9702perty(className); 9703 } 9704 function getConflictingClassGroupIds(classGroupId, hasPostfixModifier) { 9705 const conflicts = conflictingClassGroups[classGroupId] || []; 9706 if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) { 9707 return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]]; 9708 } 9709 return conflicts; 9710 } 9711 return { 9712 getClassGroupId, 9713 getConflictingClassGroupIds 9714 }; 9715} 9716function getGroupRecursive(classParts, classPartObject) { 9717 if (classParts.length === 0) { 9718 return classPartObject.classGroupId; 9719 } 9720 const currentClassPart = classParts[0]; 9721 const nextClassPartObject = classPartObject.nextPart.get(currentClassPart); 9722 const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined; 9723 if (classGroupFromNextClassPart) { 9724 return classGroupFromNextClassPart; 9725 } 9726 if (classPartObject.validators.length === 0) { 9727 return undefined; 9728 } 9729 const classRest = classParts.join(CLASS_PART_SEPARATOR); 9730 return classPartObject.validators.find(({ 9731 validator 9732 }) => validator(classRest))?.classGroupId; 9733} 9734const arbitraryPropertyRegex = /^\[(.+)\]$/; 9735function getGroupIdForArbitraryProperty(className) { 9736 if (arbitraryPropertyRegex.test(className)) { 9737 const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1]; 9738 const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':')); 9739 if (property) { 9740 // I use two dots here because one dot is used as prefix for class groups in plugins 9741 return 'arbitrary..' + property; 9742 } 9743 } 9744} 9745/** 9746 * Exported for testing only 9747 */ 9748function createClassMap(config) { 9749 const { 9750 theme, 9751 prefix 9752 } = config; 9753 const classMap = { 9754 nextPart: new Map(), 9755 validators: [] 9756 }; 9757 const prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix); 9758 prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => { 9759 processClassesRecursively(classGroup, classMap, classGroupId, theme); 9760 }); 9761 return classMap; 9762} 9763function processClassesRecursively(classGroup, classPartObject, classGroupId, theme) { 9764 classGroup.forEach(classDefinition => { 9765 if (typeof classDefinition === 'string') { 9766 const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition); 9767 classPartObjectToEdit.classGroupId = classGroupId; 9768 return; 9769 } 9770 if (typeof classDefinition === 'function') { 9771 if (isThemeGetter(classDefinition)) { 9772 processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme); 9773 return; 9774 } 9775 classPartObject.validators.push({ 9776 validator: classDefinition, 9777 classGroupId 9778 }); 9779 return; 9780 } 9781 Object.entries(classDefinition).forEach(([key, classGroup]) => { 9782 processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme); 9783 }); 9784 }); 9785} 9786function getPart(classPartObject, path) { 9787 let currentClassPartObject = classPartObject; 9788 path.split(CLASS_PART_SEPARATOR).forEach(pathPart => { 9789 if (!currentClassPartObject.nextPart.has(pathPart)) { 9790 currentClassPartObject.nextPart.set(pathPart, { 9791 nextPart: new Map(), 9792 validators: [] 9793 }); 9794 } 9795 currentClassPartObject = currentClassPartObject.nextPart.get(pathPart); 9796 }); 9797 return currentClassPartObject; 9798} 9799function isThemeGetter(func) { 9800 return func.isThemeGetter; 9801} 9802function getPrefixedClassGroupEntries(classGroupEntries, prefix) { 9803 if (!prefix) { 9804 return classGroupEntries; 9805 } 9806 return classGroupEntries.map(([classGroupId, classGroup]) => { 9807 const prefixedClassGroup = classGroup.map(classDefinition => { 9808 if (typeof classDefinition === 'string') { 9809 return prefix + classDefinition; 9810 } 9811 if (typeof classDefinition === 'object') { 9812 return Object.fromEntries(Object.entries(classDefinition).map(([key, value]) => [prefix + key, value])); 9813 } 9814 return classDefinition; 9815 }); 9816 return [classGroupId, prefixedClassGroup]; 9817 }); 9818} 9819 9820// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance 9821function createLruCache(maxCacheSize) { 9822 if (maxCacheSize < 1) { 9823 return { 9824 get: () => undefined, 9825 set: () => {} 9826 }; 9827 } 9828 let cacheSize = 0; 9829 let cache = new Map(); 9830 let previousCache = new Map(); 9831 function update(key, value) { 9832 cache.set(key, value); 9833 cacheSize++; 9834 if (cacheSize > maxCacheSize) { 9835 cacheSize = 0; 9836 previousCache = cache; 9837 cache = new Map(); 9838 } 9839 } 9840 return { 9841 get(key) { 9842 let value = cache.get(key); 9843 if (value !== undefined) { 9844 return value; 9845 } 9846 if ((value = previousCache.get(key)) !== undefined) { 9847 update(key, value); 9848 return value; 9849 } 9850 }, 9851 set(key, value) { 9852 if (cache.has(key)) { 9853 cache.set(key, value); 9854 } else { 9855 update(key, value); 9856 } 9857 } 9858 }; 9859} 9860const IMPORTANT_MODIFIER = '!'; 9861function createParseClassName(config) { 9862 const { 9863 separator, 9864 experimentalParseClassName 9865 } = config; 9866 const isSeparatorSingleCharacter = separator.length === 1; 9867 const firstSeparatorCharacter = separator[0]; 9868 const separatorLength = separator.length; 9869 // parseClassName inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js 9870 function parseClassName(className) { 9871 const modifiers = []; 9872 let bracketDepth = 0; 9873 let modifierStart = 0; 9874 let postfixModifierPosition; 9875 for (let index = 0; index < className.length; index++) { 9876 let currentCharacter = className[index]; 9877 if (bracketDepth === 0) { 9878 if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) { 9879 modifiers.push(className.slice(modifierStart, index)); 9880 modifierStart = index + separatorLength; 9881 continue; 9882 } 9883 if (currentCharacter === '/') { 9884 postfixModifierPosition = index; 9885 continue; 9886 } 9887 } 9888 if (currentCharacter === '[') { 9889 bracketDepth++; 9890 } else if (currentCharacter === ']') { 9891 bracketDepth--; 9892 } 9893 } 9894 const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart); 9895 const hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER); 9896 const baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier; 9897 const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined; 9898 return { 9899 modifiers, 9900 hasImportantModifier, 9901 baseClassName, 9902 maybePostfixModifierPosition 9903 }; 9904 } 9905 if (experimentalParseClassName) { 9906 return function parseClassNameExperimental(className) { 9907 return experimentalParseClassName({ 9908 className, 9909 parseClassName 9910 }); 9911 }; 9912 } 9913 return parseClassName; 9914} 9915/** 9916 * Sorts modifiers according to following schema: 9917 * - Predefined modifiers are sorted alphabetically 9918 * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it 9919 */ 9920function sortModifiers(modifiers) { 9921 if (modifiers.length <= 1) { 9922 return modifiers; 9923 } 9924 const sortedModifiers = []; 9925 let unsortedModifiers = []; 9926 modifiers.forEach(modifier => { 9927 const isArbitraryVariant = modifier[0] === '['; 9928 if (isArbitraryVariant) { 9929 sortedModifiers.push(...unsortedModifiers.sort(), modifier); 9930 unsortedModifiers = []; 9931 } else { 9932 unsortedModifiers.push(modifier); 9933 } 9934 }); 9935 sortedModifiers.push(...unsortedModifiers.sort()); 9936 return sortedModifiers; 9937} 9938function createConfigUtils(config) { 9939 return { 9940 cache: createLruCache(config.cacheSize), 9941 parseClassName: createParseClassName(config), 9942 ...createClassGroupUtils(config) 9943 }; 9944} 9945const SPLIT_CLASSES_REGEX = /\s+/; 9946function mergeClassList(classList, configUtils) { 9947 const { 9948 parseClassName, 9949 getClassGroupId, 9950 getConflictingClassGroupIds 9951 } = configUtils; 9952 /** 9953 * Set of classGroupIds in following format: 9954 * `{importantModifier}{variantModifiers}{classGroupId}` 9955 * @example 'float' 9956 * @example 'hover:focus:bg-color' 9957 * @example 'md:!pr' 9958 */ 9959 const classGroupsInConflict = new Set(); 9960 return classList.trim().split(SPLIT_CLASSES_REGEX).map(originalClassName => { 9961 const { 9962 modifiers, 9963 hasImportantModifier, 9964 baseClassName, 9965 maybePostfixModifierPosition 9966 } = parseClassName(originalClassName); 9967 let hasPostfixModifier = Boolean(maybePostfixModifierPosition); 9968 let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName); 9969 if (!classGroupId) { 9970 if (!hasPostfixModifier
vendor: 62,098 bytes, lines 9970-12214
9970) { 9971 return { 9972 isTailwindClass: false, 9973 originalClassName 9974 }; 9975 } 9976 classGroupId = getClassGroupId(baseClassName); 9977 if (!classGroupId) { 9978 return { 9979 isTailwindClass: false, 9980 originalClassName 9981 }; 9982 } 9983 hasPostfixModifier = false; 9984 } 9985 const variantModifier = sortModifiers(modifiers).join(':'); 9986 const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier; 9987 return { 9988 isTailwindClass: true, 9989 modifierId, 9990 classGroupId, 9991 originalClassName, 9992 hasPostfixModifier 9993 }; 9994 }).reverse() 9995 // Last class in conflict wins, so we need to filter conflicting classes in reverse order. 9996 .filter(parsed => { 9997 if (!parsed.isTailwindClass) { 9998 return true; 9999 } 10000 const { 10001 modifierId, 10002 classGroupId, 10003 hasPostfixModifier 10004 } = parsed; 10005 const classId = modifierId + classGroupId; 10006 if (classGroupsInConflict.has(classId)) { 10007 return false; 10008 } 10009 classGroupsInConflict.add(classId); 10010 getConflictingClassGroupIds(classGroupId, hasPostfixModifier).forEach(group => classGroupsInConflict.add(modifierId + group)); 10011 return true; 10012 }).reverse().map(parsed => parsed.originalClassName).join(' '); 10013} 10014 10015/** 10016 * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better. 10017 * 10018 * Specifically: 10019 * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js 10020 * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts 10021 * 10022 * Original code has MIT license: Copyright (c) Luke Edwards <[email protected]> (lukeed.com) 10023 */ 10024function twJoin() { 10025 let index = 0; 10026 let argument; 10027 let resolvedValue; 10028 let string = ''; 10029 while (index < arguments.length) { 10030 if (argument = arguments[index++]) { 10031 if (resolvedValue = toValue(argument)) { 10032 string && (string += ' '); 10033 string += resolvedValue; 10034 } 10035 } 10036 } 10037 return string; 10038} 10039function toValue(mix) { 10040 if (typeof mix === 'string') { 10041 return mix; 10042 } 10043 let resolvedValue; 10044 let string = ''; 10045 for (let k = 0; k < mix.length; k++) { 10046 if (mix[k]) { 10047 if (resolvedValue = toValue(mix[k])) { 10048 string && (string += ' '); 10049 string += resolvedValue; 10050 } 10051 } 10052 } 10053 return string; 10054} 10055function createTailwindMerge(createConfigFirst, ...createConfigRest) { 10056 let configUtils; 10057 let cacheGet; 10058 let cacheSet; 10059 let functionToCall = initTailwindMerge; 10060 function initTailwindMerge(classList) { 10061 const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst()); 10062 configUtils = createConfigUtils(config); 10063 cacheGet = configUtils.cache.get; 10064 cacheSet = configUtils.cache.set; 10065 functionToCall = tailwindMerge; 10066 return tailwindMerge(classList); 10067 } 10068 function tailwindMerge(classList) { 10069 const cachedResult = cacheGet(classList); 10070 if (cachedResult) { 10071 return cachedResult; 10072 } 10073 const result = mergeClassList(classList, configUtils); 10074 cacheSet(classList, result); 10075 return result; 10076 } 10077 return function callTailwindMerge() { 10078 return functionToCall(twJoin.apply(null, arguments)); 10079 }; 10080} 10081function fromTheme(key) { 10082 const themeGetter = theme => theme[key] || []; 10083 themeGetter.isThemeGetter = true; 10084 return themeGetter; 10085} 10086const arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i; 10087const fractionRegex = /^\d+\/\d+$/; 10088const stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']); 10089const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/; 10090const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/; 10091const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/; 10092// Shadow always begins with x and y offset separated by underscore optionally prepended by inset 10093const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/; 10094const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/; 10095function isLength(value) { 10096 return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value); 10097} 10098function isArbitraryLength(value) { 10099 return getIsArbitraryValue(value, 'length', isLengthOnly); 10100} 10101function isNumber(value) { 10102 return Boolean(value) && !Number.isNaN(Number(value)); 10103} 10104function isArbitraryNumber(value) { 10105 return getIsArbitraryValue(value, 'number', isNumber); 10106} 10107function isInteger(value) { 10108 return Boolean(value) && Number.isInteger(Number(value)); 10109} 10110function isPercent(value) { 10111 return value.endsWith('%') && isNumber(value.slice(0, -1)); 10112} 10113function isArbitraryValue(value) { 10114 return arbitraryValueRegex.test(value); 10115} 10116function isTshirtSize(value) { 10117 return tshirtUnitRegex.test(value); 10118} 10119const sizeLabels = /*#__PURE__*/new Set(['length', 'size', 'percentage']); 10120function isArbitrarySize(value) { 10121 return getIsArbitraryValue(value, sizeLabels, isNever); 10122} 10123function isArbitraryPosition(value) { 10124 return getIsArbitraryValue(value, 'position', isNever); 10125} 10126const imageLabels = /*#__PURE__*/new Set(['image', 'url']); 10127function isArbitraryImage(value) { 10128 return getIsArbitraryValue(value, imageLabels, isImage); 10129} 10130function isArbitraryShadow(value) { 10131 return getIsArbitraryValue(value, '', isShadow); 10132} 10133function isAny() { 10134 return true; 10135} 10136function getIsArbitraryValue(value, label, testValue) { 10137 const result = arbitraryValueRegex.exec(value); 10138 if (result) { 10139 if (result[1]) { 10140 return typeof label === 'string' ? result[1] === label : label.has(result[1]); 10141 } 10142 return testValue(result[2]); 10143 } 10144 return false; 10145} 10146function isLengthOnly(value) { 10147 // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. 10148 // For example, `hsl(0 0% 0%)` would be classified as a length without this check. 10149 // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. 10150 return lengthUnitRegex.test(value) && !colorFunctionRegex.test(value); 10151} 10152function isNever() { 10153 return false; 10154} 10155function isShadow(value) { 10156 return shadowRegex.test(value); 10157} 10158function isImage(value) { 10159 return imageRegex.test(value); 10160} 10161function getDefaultConfig() { 10162 const colors = fromTheme('colors'); 10163 const spacing = fromTheme('spacing'); 10164 const blur = fromTheme('blur'); 10165 const brightness = fromTheme('brightness'); 10166 const borderColor = fromTheme('borderColor'); 10167 const borderRadius = fromTheme('borderRadius'); 10168 const borderSpacing = fromTheme('borderSpacing'); 10169 const borderWidth = fromTheme('borderWidth'); 10170 const contrast = fromTheme('contrast'); 10171 const grayscale = fromTheme('grayscale'); 10172 const hueRotate = fromTheme('hueRotate'); 10173 const invert = fromTheme('invert'); 10174 const gap = fromTheme('gap'); 10175 const gradientColorStops = fromTheme('gradientColorStops'); 10176 const gradientColorStopPositions = fromTheme('gradientColorStopPositions'); 10177 const inset = fromTheme('inset'); 10178 const margin = fromTheme('margin'); 10179 const opacity = fromTheme('opacity'); 10180 const padding = fromTheme('padding'); 10181 const saturate = fromTheme('saturate'); 10182 const scale = fromTheme('scale'); 10183 const sepia = fromTheme('sepia'); 10184 const skew = fromTheme('skew'); 10185 const space = fromTheme('space'); 10186 const translate = fromTheme('translate'); 10187 const getOverscroll = () => ['auto', 'contain', 'none']; 10188 const getOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll']; 10189 const getSpacingWithAutoAndArbitrary = () => ['auto', isArbitraryValue, spacing]; 10190 const getSpacingWithArbitrary = () => [isArbitraryValue, spacing]; 10191 const getLengthWithEmptyAndArbitrary = () => ['', isLength, isArbitraryLength]; 10192 const getNumberWithAutoAndArbitrary = () => ['auto', isNumber, isArbitraryValue]; 10193 const getPositions = () => ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top']; 10194 const getLineStyles = () => ['solid', 'dashed', 'dotted', 'double', 'none']; 10195 const getBlendModes = () => ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity']; 10196 const getAlign = () => ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch']; 10197 const getZeroAndEmpty = () => ['', '0', isArbitraryValue]; 10198 const getBreaks = () => ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column']; 10199 const getNumber = () => [isNumber, isArbitraryNumber]; 10200 const getNumberAndArbitrary = () => [isNumber, isArbitraryValue]; 10201 return { 10202 cacheSize: 500, 10203 separator: ':', 10204 theme: { 10205 colors: [isAny], 10206 spacing: [isLength, isArbitraryLength], 10207 blur: ['none', '', isTshirtSize, isArbitraryValue], 10208 brightness: getNumber(), 10209 borderColor: [colors], 10210 borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryValue], 10211 borderSpacing: getSpacingWithArbitrary(), 10212 borderWidth: getLengthWithEmptyAndArbitrary(), 10213 contrast: getNumber(), 10214 grayscale: getZeroAndEmpty(), 10215 hueRotate: getNumberAndArbitrary(), 10216 invert: getZeroAndEmpty(), 10217 gap: getSpacingWithArbitrary(), 10218 gradientColorStops: [colors], 10219 gradientColorStopPositions: [isPercent, isArbitraryLength], 10220 inset: getSpacingWithAutoAndArbitrary(), 10221 margin: getSpacingWithAutoAndArbitrary(), 10222 opacity: getNumber(), 10223 padding: getSpacingWithArbitrary(), 10224 saturate: getNumber(), 10225 scale: getNumber(), 10226 sepia: getZeroAndEmpty(), 10227 skew: getNumberAndArbitrary(), 10228 space: getSpacingWithArbitrary(), 10229 translate: getSpacingWithArbitrary() 10230 }, 10231 classGroups: { 10232 // Layout 10233 /** 10234 * Aspect Ratio 10235 * @see https://tailwindcss.com/docs/aspect-ratio 10236 */ 10237 aspect: [{ 10238 aspect: ['auto', 'square', 'video', isArbitraryValue] 10239 }], 10240 /** 10241 * Container 10242 * @see https://tailwindcss.com/docs/container 10243 */ 10244 container: ['container'], 10245 /** 10246 * Columns 10247 * @see https://tailwindcss.com/docs/columns 10248 */ 10249 columns: [{ 10250 columns: [isTshirtSize] 10251 }], 10252 /** 10253 * Break After 10254 * @see https://tailwindcss.com/docs/break-after 10255 */ 10256 'break-after': [{ 10257 'break-after': getBreaks() 10258 }], 10259 /** 10260 * Break Before 10261 * @see https://tailwindcss.com/docs/break-before 10262 */ 10263 'break-before': [{ 10264 'break-before': getBreaks() 10265 }], 10266 /** 10267 * Break Inside 10268 * @see https://tailwindcss.com/docs/break-inside 10269 */ 10270 'break-inside': [{ 10271 'break-inside': ['auto', 'avoid', 'avoid-page', 'avoid-column'] 10272 }], 10273 /** 10274 * Box Decoration Break 10275 * @see https://tailwindcss.com/docs/box-decoration-break 10276 */ 10277 'box-decoration': [{ 10278 'box-decoration': ['slice', 'clone'] 10279 }], 10280 /** 10281 * Box Sizing 10282 * @see https://tailwindcss.com/docs/box-sizing 10283 */ 10284 box: [{ 10285 box: ['border', 'content'] 10286 }], 10287 /** 10288 * Display 10289 * @see https://tailwindcss.com/docs/display 10290 */ 10291 display: ['block', 'inline-block', 'inline', 'flex', 'inline-flex', 'table', 'inline-table', 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row-group', 'table-row', 'flow-root', 'grid', 'inline-grid', 'contents', 'list-item', 'hidden'], 10292 /** 10293 * Floats 10294 * @see https://tailwindcss.com/docs/float 10295 */ 10296 float: [{ 10297 float: ['right', 'left', 'none', 'start', 'end'] 10298 }], 10299 /** 10300 * Clear 10301 * @see https://tailwindcss.com/docs/clear 10302 */ 10303 clear: [{ 10304 clear: ['left', 'right', 'both', 'none', 'start', 'end'] 10305 }], 10306 /** 10307 * Isolation 10308 * @see https://tailwindcss.com/docs/isolation 10309 */ 10310 isolation: ['isolate', 'isolation-auto'], 10311 /** 10312 * Object Fit 10313 * @see https://tailwindcss.com/docs/object-fit 10314 */ 10315 'object-fit': [{ 10316 object: ['contain', 'cover', 'fill', 'none', 'scale-down'] 10317 }], 10318 /** 10319 * Object Position 10320 * @see https://tailwindcss.com/docs/object-position 10321 */ 10322 'object-position': [{ 10323 object: [...getPositions(), isArbitraryValue] 10324 }], 10325 /** 10326 * Overflow 10327 * @see https://tailwindcss.com/docs/overflow 10328 */ 10329 overflow: [{ 10330 overflow: getOverflow() 10331 }], 10332 /** 10333 * Overflow X 10334 * @see https://tailwindcss.com/docs/overflow 10335 */ 10336 'overflow-x': [{ 10337 'overflow-x': getOverflow() 10338 }], 10339 /** 10340 * Overflow Y 10341 * @see https://tailwindcss.com/docs/overflow 10342 */ 10343 'overflow-y': [{ 10344 'overflow-y': getOverflow() 10345 }], 10346 /** 10347 * Overscroll Behavior 10348 * @see https://tailwindcss.com/docs/overscroll-behavior 10349 */ 10350 overscroll: [{ 10351 overscroll: getOverscroll() 10352 }], 10353 /** 10354 * Overscroll Behavior X 10355 * @see https://tailwindcss.com/docs/overscroll-behavior 10356 */ 10357 'overscroll-x': [{ 10358 'overscroll-x': getOverscroll() 10359 }], 10360 /** 10361 * Overscroll Behavior Y 10362 * @see https://tailwindcss.com/docs/overscroll-behavior 10363 */ 10364 'overscroll-y': [{ 10365 'overscroll-y': getOverscroll() 10366 }], 10367 /** 10368 * Position 10369 * @see https://tailwindcss.com/docs/position 10370 */ 10371 position: ['static', 'fixed', 'absolute', 'relative', 'sticky'], 10372 /** 10373 * Top / Right / Bottom / Left 10374 * @see https://tailwindcss.com/docs/top-right-bottom-left 10375 */ 10376 inset: [{ 10377 inset: [inset] 10378 }], 10379 /** 10380 * Right / Left 10381 * @see https://tailwindcss.com/docs/top-right-bottom-left 10382 */ 10383 'inset-x': [{ 10384 'inset-x': [inset] 10385 }], 10386 /** 10387 * Top / Bottom 10388 * @see https://tailwindcss.com/docs/top-right-bottom-left 10389 */ 10390 'inset-y': [{ 10391 'inset-y': [inset] 10392 }], 10393 /** 10394 * Start 10395 * @see https://tailwindcss.com/docs/top-right-bottom-left 10396 */ 10397 start: [{ 10398 start: [inset] 10399 }], 10400 /** 10401 * End 10402 * @see https://tailwindcss.com/docs/top-right-bottom-left 10403 */ 10404 end: [{ 10405 end: [inset] 10406 }], 10407 /** 10408 * Top 10409 * @see https://tailwindcss.com/docs/top-right-bottom-left 10410 */ 10411 top: [{ 10412 top: [inset] 10413 }], 10414 /** 10415 * Right 10416 * @see https://tailwindcss.com/docs/top-right-bottom-left 10417 */ 10418 right: [{ 10419 right: [inset] 10420 }], 10421 /** 10422 * Bottom 10423 * @see https://tailwindcss.com/docs/top-right-bottom-left 10424 */ 10425 bottom: [{ 10426 bottom: [inset] 10427 }], 10428 /** 10429 * Left 10430 * @see https://tailwindcss.com/docs/top-right-bottom-left 10431 */ 10432 left: [{ 10433 left: [inset] 10434 }], 10435 /** 10436 * Visibility 10437 * @see https://tailwindcss.com/docs/visibility 10438 */ 10439 visibility: ['visible', 'invisible', 'collapse'], 10440 /** 10441 * Z-Index 10442 * @see https://tailwindcss.com/docs/z-index 10443 */ 10444 z: [{ 10445 z: ['auto', isInteger, isArbitraryValue] 10446 }], 10447 // Flexbox and Grid 10448 /** 10449 * Flex Basis 10450 * @see https://tailwindcss.com/docs/flex-basis 10451 */ 10452 basis: [{ 10453 basis: getSpacingWithAutoAndArbitrary() 10454 }], 10455 /** 10456 * Flex Direction 10457 * @see https://tailwindcss.com/docs/flex-direction 10458 */ 10459 'flex-direction': [{ 10460 flex: ['row', 'row-reverse', 'col', 'col-reverse'] 10461 }], 10462 /** 10463 * Flex Wrap 10464 * @see https://tailwindcss.com/docs/flex-wrap 10465 */ 10466 'flex-wrap': [{ 10467 flex: ['wrap', 'wrap-reverse', 'nowrap'] 10468 }], 10469 /** 10470 * Flex 10471 * @see https://tailwindcss.com/docs/flex 10472 */ 10473 flex: [{ 10474 flex: ['1', 'auto', 'initial', 'none', isArbitraryValue] 10475 }], 10476 /** 10477 * Flex Grow 10478 * @see https://tailwindcss.com/docs/flex-grow 10479 */ 10480 grow: [{ 10481 grow: getZeroAndEmpty() 10482 }], 10483 /** 10484 * Flex Shrink 10485 * @see https://tailwindcss.com/docs/flex-shrink 10486 */ 10487 shrink: [{ 10488 shrink: getZeroAndEmpty() 10489 }], 10490 /** 10491 * Order 10492 * @see https://tailwindcss.com/docs/order 10493 */ 10494 order: [{ 10495 order: ['first', 'last', 'none', isInteger, isArbitraryValue] 10496 }], 10497 /** 10498 * Grid Template Columns 10499 * @see https://tailwindcss.com/docs/grid-template-columns 10500 */ 10501 'grid-cols': [{ 10502 'grid-cols': [isAny] 10503 }], 10504 /** 10505 * Grid Column Start / End 10506 * @see https://tailwindcss.com/docs/grid-column 10507 */ 10508 'col-start-end': [{ 10509 col: ['auto', { 10510 span: ['full', isInteger, isArbitraryValue] 10511 }, isArbitraryValue] 10512 }], 10513 /** 10514 * Grid Column Start 10515 * @see https://tailwindcss.com/docs/grid-column 10516 */ 10517 'col-start': [{ 10518 'col-start': getNumberWithAutoAndArbitrary() 10519 }], 10520 /** 10521 * Grid Column End 10522 * @see https://tailwindcss.com/docs/grid-column 10523 */ 10524 'col-end': [{ 10525 'col-end': getNumberWithAutoAndArbitrary() 10526 }], 10527 /** 10528 * Grid Template Rows 10529 * @see https://tailwindcss.com/docs/grid-template-rows 10530 */ 10531 'grid-rows': [{ 10532 'grid-rows': [isAny] 10533 }], 10534 /** 10535 * Grid Row Start / End 10536 * @see https://tailwindcss.com/docs/grid-row 10537 */ 10538 'row-start-end': [{ 10539 row: ['auto', { 10540 span: [isInteger, isArbitraryValue] 10541 }, isArbitraryValue] 10542 }], 10543 /** 10544 * Grid Row Start 10545 * @see https://tailwindcss.com/docs/grid-row 10546 */ 10547 'row-start': [{ 10548 'row-start': getNumberWithAutoAndArbitrary() 10549 }], 10550 /** 10551 * Grid Row End 10552 * @see https://tailwindcss.com/docs/grid-row 10553 */ 10554 'row-end': [{ 10555 'row-end': getNumberWithAutoAndArbitrary() 10556 }], 10557 /** 10558 * Grid Auto Flow 10559 * @see https://tailwindcss.com/docs/grid-auto-flow 10560 */ 10561 'grid-flow': [{ 10562 'grid-flow': ['row', 'col', 'dense', 'row-dense', 'col-dense'] 10563 }], 10564 /** 10565 * Grid Auto Columns 10566 * @see https://tailwindcss.com/docs/grid-auto-columns 10567 */ 10568 'auto-cols': [{ 10569 'auto-cols': ['auto', 'min', 'max', 'fr', isArbitraryValue] 10570 }], 10571 /** 10572 * Grid Auto Rows 10573 * @see https://tailwindcss.com/docs/grid-auto-rows 10574 */ 10575 'auto-rows': [{ 10576 'auto-rows': ['auto', 'min', 'max', 'fr', isArbitraryValue] 10577 }], 10578 /** 10579 * Gap 10580 * @see https://tailwindcss.com/docs/gap 10581 */ 10582 gap: [{ 10583 gap: [gap] 10584 }], 10585 /** 10586 * Gap X 10587 * @see https://tailwindcss.com/docs/gap 10588 */ 10589 'gap-x': [{ 10590 'gap-x': [gap] 10591 }], 10592 /** 10593 * Gap Y 10594 * @see https://tailwindcss.com/docs/gap 10595 */ 10596 'gap-y': [{ 10597 'gap-y': [gap] 10598 }], 10599 /** 10600 * Justify Content 10601 * @see https://tailwindcss.com/docs/justify-content 10602 */ 10603 'justify-content': [{ 10604 justify: ['normal', ...getAlign()] 10605 }], 10606 /** 10607 * Justify Items 10608 * @see https://tailwindcss.com/docs/justify-items 10609 */ 10610 'justify-items': [{ 10611 'justify-items': ['start', 'end', 'center', 'stretch'] 10612 }], 10613 /** 10614 * Justify Self 10615 * @see https://tailwindcss.com/docs/justify-self 10616 */ 10617 'justify-self': [{ 10618 'justify-self': ['auto', 'start', 'end', 'center', 'stretch'] 10619 }], 10620 /** 10621 * Align Content 10622 * @see https://tailwindcss.com/docs/align-content 10623 */ 10624 'align-content': [{ 10625 content: ['normal', ...getAlign(), 'baseline'] 10626 }], 10627 /** 10628 * Align Items 10629 * @see https://tailwindcss.com/docs/align-items 10630 */ 10631 'align-items': [{ 10632 items: ['start', 'end', 'center', 'baseline', 'stretch'] 10633 }], 10634 /** 10635 * Align Self 10636 * @see https://tailwindcss.com/docs/align-self 10637 */ 10638 'align-self': [{ 10639 self: ['auto', 'start', 'end', 'center', 'stretch', 'baseline'] 10640 }], 10641 /** 10642 * Place Content 10643 * @see https://tailwindcss.com/docs/place-content 10644 */ 10645 'place-content': [{ 10646 'place-content': [...getAlign(), 'baseline'] 10647 }], 10648 /** 10649 * Place Items 10650 * @see https://tailwindcss.com/docs/place-items 10651 */ 10652 'place-items': [{ 10653 'place-items': ['start', 'end', 'center', 'baseline', 'stretch'] 10654 }], 10655 /** 10656 * Place Self 10657 * @see https://tailwindcss.com/docs/place-self 10658 */ 10659 'place-self': [{ 10660 'place-self': ['auto', 'start', 'end', 'center', 'stretch'] 10661 }], 10662 // Spacing 10663 /** 10664 * Padding 10665 * @see https://tailwindcss.com/docs/padding 10666 */ 10667 p: [{ 10668 p: [padding] 10669 }], 10670 /** 10671 * Padding X 10672 * @see https://tailwindcss.com/docs/padding 10673 */ 10674 px: [{ 10675 px: [padding] 10676 }], 10677 /** 10678 * Padding Y 10679 * @see https://tailwindcss.com/docs/padding 10680 */ 10681 py: [{ 10682 py: [padding] 10683 }], 10684 /** 10685 * Padding Start 10686 * @see https://tailwindcss.com/docs/padding 10687 */ 10688 ps: [{ 10689 ps: [padding] 10690 }], 10691 /** 10692 * Padding End 10693 * @see https://tailwindcss.com/docs/padding 10694 */ 10695 pe: [{ 10696 pe: [padding] 10697 }], 10698 /** 10699 * Padding Top 10700 * @see https://tailwindcss.com/docs/padding 10701 */ 10702 pt: [{ 10703 pt: [padding] 10704 }], 10705 /** 10706 * Padding Right 10707 * @see https://tailwindcss.com/docs/padding 10708 */ 10709 pr: [{ 10710 pr: [padding] 10711 }], 10712 /** 10713 * Padding Bottom 10714 * @see https://tailwindcss.com/docs/padding 10715 */ 10716 pb: [{ 10717 pb: [padding] 10718 }], 10719 /** 10720 * Padding Left 10721 * @see https://tailwindcss.com/docs/padding 10722 */ 10723 pl: [{ 10724 pl: [padding] 10725 }], 10726 /** 10727 * Margin 10728 * @see https://tailwindcss.com/docs/margin 10729 */ 10730 m: [{ 10731 m: [margin] 10732 }], 10733 /** 10734 * Margin X 10735 * @see https://tailwindcss.com/docs/margin 10736 */ 10737 mx: [{ 10738 mx: [margin] 10739 }], 10740 /** 10741 * Margin Y 10742 * @see https://tailwindcss.com/docs/margin 10743 */ 10744 my: [{ 10745 my: [margin] 10746 }], 10747 /** 10748 * Margin Start 10749 * @see https://tailwindcss.com/docs/margin 10750 */ 10751 ms: [{ 10752 ms: [margin] 10753 }], 10754 /** 10755 * Margin End 10756 * @see https://tailwindcss.com/docs/margin 10757 */ 10758 me: [{ 10759 me: [margin] 10760 }], 10761 /** 10762 * Margin Top 10763 * @see https://tailwindcss.com/docs/margin 10764 */ 10765 mt: [{ 10766 mt: [margin] 10767 }], 10768 /** 10769 * Margin Right 10770 * @see https://tailwindcss.com/docs/margin 10771 */ 10772 mr: [{ 10773 mr: [margin] 10774 }], 10775 /** 10776 * Margin Bottom 10777 * @see https://tailwindcss.com/docs/margin 10778 */ 10779 mb: [{ 10780 mb: [margin] 10781 }], 10782 /** 10783 * Margin Left 10784 * @see https://tailwindcss.com/docs/margin 10785 */ 10786 ml: [{ 10787 ml: [margin] 10788 }], 10789 /** 10790 * Space Between X 10791 * @see https://tailwindcss.com/docs/space 10792 */ 10793 'space-x': [{ 10794 'space-x': [space] 10795 }], 10796 /** 10797 * Space Between X Reverse 10798 * @see https://tailwindcss.com/docs/space 10799 */ 10800 'space-x-reverse': ['space-x-reverse'], 10801 /** 10802 * Space Between Y 10803 * @see https://tailwindcss.com/docs/space 10804 */ 10805 'space-y': [{ 10806 'space-y': [space] 10807 }], 10808 /** 10809 * Space Between Y Reverse 10810 * @see https://tailwindcss.com/docs/space 10811 */ 10812 'space-y-reverse': ['space-y-reverse'], 10813 // Sizing 10814 /** 10815 * Width 10816 * @see https://tailwindcss.com/docs/width 10817 */ 10818 w: [{ 10819 w: ['auto', 'min', 'max', 'fit', 'svw', 'lvw', 'dvw', isArbitraryValue, spacing] 10820 }], 10821 /** 10822 * Min-Width 10823 * @see https://tailwindcss.com/docs/min-width 10824 */ 10825 'min-w': [{ 10826 'min-w': [isArbitraryValue, spacing, 'min', 'max', 'fit'] 10827 }], 10828 /** 10829 * Max-Width 10830 * @see https://tailwindcss.com/docs/max-width 10831 */ 10832 'max-w': [{ 10833 'max-w': [isArbitraryValue, spacing, 'none', 'full', 'min', 'max', 'fit', 'prose', { 10834 screen: [isTshirtSize] 10835 }, isTshirtSize] 10836 }], 10837 /** 10838 * Height 10839 * @see https://tailwindcss.com/docs/height 10840 */ 10841 h: [{ 10842 h: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] 10843 }], 10844 /** 10845 * Min-Height 10846 * @see https://tailwindcss.com/docs/min-height 10847 */ 10848 'min-h': [{ 10849 'min-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] 10850 }], 10851 /** 10852 * Max-Height 10853 * @see https://tailwindcss.com/docs/max-height 10854 */ 10855 'max-h': [{ 10856 'max-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh'] 10857 }], 10858 /** 10859 * Size 10860 * @see https://tailwindcss.com/docs/size 10861 */ 10862 size: [{ 10863 size: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit'] 10864 }], 10865 // Typography 10866 /** 10867 * Font Size 10868 * @see https://tailwindcss.com/docs/font-size 10869 */ 10870 'font-size': [{ 10871 text: ['base', isTshirtSize, isArbitraryLength] 10872 }], 10873 /** 10874 * Font Smoothing 10875 * @see https://tailwindcss.com/docs/font-smoothing 10876 */ 10877 'font-smoothing': ['antialiased', 'subpixel-antialiased'], 10878 /** 10879 * Font Style 10880 * @see https://tailwindcss.com/docs/font-style 10881 */ 10882 'font-style': ['italic', 'not-italic'], 10883 /** 10884 * Font Weight 10885 * @see https://tailwindcss.com/docs/font-weight 10886 */ 10887 'font-weight': [{ 10888 font: ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black', isArbitraryNumber] 10889 }], 10890 /** 10891 * Font Family 10892 * @see https://tailwindcss.com/docs/font-family 10893 */ 10894 'font-family': [{ 10895 font: [isAny] 10896 }], 10897 /** 10898 * Font Variant Numeric 10899 * @see https://tailwindcss.com/docs/font-variant-numeric 10900 */ 10901 'fvn-normal': ['normal-nums'], 10902 /** 10903 * Font Variant Numeric 10904 * @see https://tailwindcss.com/docs/font-variant-numeric 10905 */ 10906 'fvn-ordinal': ['ordinal'], 10907 /** 10908 * Font Variant Numeric 10909 * @see https://tailwindcss.com/docs/font-variant-numeric 10910 */ 10911 'fvn-slashed-zero': ['slashed-zero'], 10912 /** 10913 * Font Variant Numeric 10914 * @see https://tailwindcss.com/docs/font-variant-numeric 10915 */ 10916 'fvn-figure': ['lining-nums', 'oldstyle-nums'], 10917 /** 10918 * Font Variant Numeric 10919 * @see https://tailwindcss.com/docs/font-variant-numeric 10920 */ 10921 'fvn-spacing': ['proportional-nums', 'tabular-nums'], 10922 /** 10923 * Font Variant Numeric 10924 * @see https://tailwindcss.com/docs/font-variant-numeric 10925 */ 10926 'fvn-fraction': ['diagonal-fractions', 'stacked-fractons'], 10927 /** 10928 * Letter Spacing 10929 * @see https://tailwindcss.com/docs/letter-spacing 10930 */ 10931 tracking: [{ 10932 tracking: ['tighter', 'tight', 'normal', 'wide', 'wider', 'widest', isArbitraryValue] 10933 }], 10934 /** 10935 * Line Clamp 10936 * @see https://tailwindcss.com/docs/line-clamp 10937 */ 10938 'line-clamp': [{ 10939 'line-clamp': ['none', isNumber, isArbitraryNumber] 10940 }], 10941 /** 10942 * Line Height 10943 * @see https://tailwindcss.com/docs/line-height 10944 */ 10945 leading: [{ 10946 leading: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose', isLength, isArbitraryValue] 10947 }], 10948 /** 10949 * List Style Image 10950 * @see https://tailwindcss.com/docs/list-style-image 10951 */ 10952 'list-image': [{ 10953 'list-image': ['none', isArbitraryValue] 10954 }], 10955 /** 10956 * List Style Type 10957 * @see https://tailwindcss.com/docs/list-style-type 10958 */ 10959 'list-style-type': [{ 10960 list: ['none', 'disc', 'decimal', isArbitraryValue] 10961 }], 10962 /** 10963 * List Style Position 10964 * @see https://tailwindcss.com/docs/list-style-position 10965 */ 10966 'list-style-position': [{ 10967 list: ['inside', 'outside'] 10968 }], 10969 /** 10970 * Placeholder Color 10971 * @deprecated since Tailwind CSS v3.0.0 10972 * @see https://tailwindcss.com/docs/placeholder-color 10973 */ 10974 'placeholder-color': [{ 10975 placeholder: [colors] 10976 }], 10977 /** 10978 * Placeholder Opacity 10979 * @see https://tailwindcss.com/docs/placeholder-opacity 10980 */ 10981 'placeholder-opacity': [{ 10982 'placeholder-opacity': [opacity] 10983 }], 10984 /** 10985 * Text Alignment 10986 * @see https://tailwindcss.com/docs/text-align 10987 */ 10988 'text-alignment': [{ 10989 text: ['left', 'center', 'right', 'justify', 'start', 'end'] 10990 }], 10991 /** 10992 * Text Color 10993 * @see https://tailwindcss.com/docs/text-color 10994 */ 10995 'text-color': [{ 10996 text: [colors] 10997 }], 10998 /** 10999 * Text Opacity 11000 * @see https://tailwindcss.com/docs/text-opacity 11001 */ 11002 'text-opacity': [{ 11003 'text-opacity': [opacity] 11004 }], 11005 /** 11006 * Text Decoration 11007 * @see https://tailwindcss.com/docs/text-decoration 11008 */ 11009 'text-decoration': ['underline', 'overline', 'line-through', 'no-underline'], 11010 /** 11011 * Text Decoration Style 11012 * @see https://tailwindcss.com/docs/text-decoration-style 11013 */ 11014 'text-decoration-style': [{ 11015 decoration: [...getLineStyles(), 'wavy'] 11016 }], 11017 /** 11018 * Text Decoration Thickness 11019 * @see https://tailwindcss.com/docs/text-decoration-thickness 11020 */ 11021 'text-decoration-thickness': [{ 11022 decoration: ['auto', 'from-font', isLength, isArbitraryLength] 11023 }], 11024 /** 11025 * Text Underline Offset 11026 * @see https://tailwindcss.com/docs/text-underline-offset 11027 */ 11028 'underline-offset': [{ 11029 'underline-offset': ['auto', isLength, isArbitraryValue] 11030 }], 11031 /** 11032 * Text Decoration Color 11033 * @see https://tailwindcss.com/docs/text-decoration-color 11034 */ 11035 'text-decoration-color': [{ 11036 decoration: [colors] 11037 }], 11038 /** 11039 * Text Transform 11040 * @see https://tailwindcss.com/docs/text-transform 11041 */ 11042 'text-transform': ['uppercase', 'lowercase', 'capitalize', 'normal-case'], 11043 /** 11044 * Text Overflow 11045 * @see https://tailwindcss.com/docs/text-overflow 11046 */ 11047 'text-overflow': ['truncate', 'text-ellipsis', 'text-clip'], 11048 /** 11049 * Text Wrap 11050 * @see https://tailwindcss.com/docs/text-wrap 11051 */ 11052 'text-wrap': [{ 11053 text: ['wrap', 'nowrap', 'balance', 'pretty'] 11054 }], 11055 /** 11056 * Text Indent 11057 * @see https://tailwindcss.com/docs/text-indent 11058 */ 11059 indent: [{ 11060 indent: getSpacingWithArbitrary() 11061 }], 11062 /** 11063 * Vertical Alignment 11064 * @see https://tailwindcss.com/docs/vertical-align 11065 */ 11066 'vertical-align': [{ 11067 align: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super', isArbitraryValue] 11068 }], 11069 /** 11070 * Whitespace 11071 * @see https://tailwindcss.com/docs/whitespace 11072 */ 11073 whitespace: [{ 11074 whitespace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'] 11075 }], 11076 /** 11077 * Word Break 11078 * @see https://tailwindcss.com/docs/word-break 11079 */ 11080 break: [{ 11081 break: ['normal', 'words', 'all', 'keep'] 11082 }], 11083 /** 11084 * Hyphens 11085 * @see https://tailwindcss.com/docs/hyphens 11086 */ 11087 hyphens: [{ 11088 hyphens: ['none', 'manual', 'auto'] 11089 }], 11090 /** 11091 * Content 11092 * @see https://tailwindcss.com/docs/content 11093 */ 11094 content: [{ 11095 content: ['none', isArbitraryValue] 11096 }], 11097 // Backgrounds 11098 /** 11099 * Background Attachment 11100 * @see https://tailwindcss.com/docs/background-attachment 11101 */ 11102 'bg-attachment': [{ 11103 bg: ['fixed', 'local', 'scroll'] 11104 }], 11105 /** 11106 * Background Clip 11107 * @see https://tailwindcss.com/docs/background-clip 11108 */ 11109 'bg-clip': [{ 11110 'bg-clip': ['border', 'padding', 'content', 'text'] 11111 }], 11112 /** 11113 * Background Opacity 11114 * @deprecated since Tailwind CSS v3.0.0 11115 * @see https://tailwindcss.com/docs/background-opacity 11116 */ 11117 'bg-opacity': [{ 11118 'bg-opacity': [opacity] 11119 }], 11120 /** 11121 * Background Origin 11122 * @see https://tailwindcss.com/docs/background-origin 11123 */ 11124 'bg-origin': [{ 11125 'bg-origin': ['border', 'padding', 'content'] 11126 }], 11127 /** 11128 * Background Position 11129 * @see https://tailwindcss.com/docs/background-position 11130 */ 11131 'bg-position': [{ 11132 bg: [...getPositions(), isArbitraryPosition] 11133 }], 11134 /** 11135 * Background Repeat 11136 * @see https://tailwindcss.com/docs/background-repeat 11137 */ 11138 'bg-repeat': [{ 11139 bg: ['no-repeat', { 11140 repeat: ['', 'x', 'y', 'round', 'space'] 11141 }] 11142 }], 11143 /** 11144 * Background Size 11145 * @see https://tailwindcss.com/docs/background-size 11146 */ 11147 'bg-size': [{ 11148 bg: ['auto', 'cover', 'contain', isArbitrarySize] 11149 }], 11150 /** 11151 * Background Image 11152 * @see https://tailwindcss.com/docs/background-image 11153 */ 11154 'bg-image': [{ 11155 bg: ['none', { 11156 'gradient-to': ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl'] 11157 }, isArbitraryImage] 11158 }], 11159 /** 11160 * Background Color 11161 * @see https://tailwindcss.com/docs/background-color 11162 */ 11163 'bg-color': [{ 11164 bg: [colors] 11165 }], 11166 /** 11167 * Gradient Color Stops From Position 11168 * @see https://tailwindcss.com/docs/gradient-color-stops 11169 */ 11170 'gradient-from-pos': [{ 11171 from: [gradientColorStopPositions] 11172 }], 11173 /** 11174 * Gradient Color Stops Via Position 11175 * @see https://tailwindcss.com/docs/gradient-color-stops 11176 */ 11177 'gradient-via-pos': [{ 11178 via: [gradientColorStopPositions] 11179 }], 11180 /** 11181 * Gradient Color Stops To Position 11182 * @see https://tailwindcss.com/docs/gradient-color-stops 11183 */ 11184 'gradient-to-pos': [{ 11185 to: [gradientColorStopPositions] 11186 }], 11187 /** 11188 * Gradient Color Stops From 11189 * @see https://tailwindcss.com/docs/gradient-color-stops 11190 */ 11191 'gradient-from': [{ 11192 from: [gradientColorStops] 11193 }], 11194 /** 11195 * Gradient Color Stops Via 11196 * @see https://tailwindcss.com/docs/gradient-color-stops 11197 */ 11198 'gradient-via': [{ 11199 via: [gradientColorStops] 11200 }], 11201 /** 11202 * Gradient Color Stops To 11203 * @see https://tailwindcss.com/docs/gradient-color-stops 11204 */ 11205 'gradient-to': [{ 11206 to: [gradientColorStops] 11207 }], 11208 // Borders 11209 /** 11210 * Border Radius 11211 * @see https://tailwindcss.com/docs/border-radius 11212 */ 11213 rounded: [{ 11214 rounded: [borderRadius] 11215 }], 11216 /** 11217 * Border Radius Start 11218 * @see https://tailwindcss.com/docs/border-radius 11219 */ 11220 'rounded-s': [{ 11221 'rounded-s': [borderRadius] 11222 }], 11223 /** 11224 * Border Radius End 11225 * @see https://tailwindcss.com/docs/border-radius 11226 */ 11227 'rounded-e': [{ 11228 'rounded-e': [borderRadius] 11229 }], 11230 /** 11231 * Border Radius Top 11232 * @see https://tailwindcss.com/docs/border-radius 11233 */ 11234 'rounded-t': [{ 11235 'rounded-t': [borderRadius] 11236 }], 11237 /** 11238 * Border Radius Right 11239 * @see https://tailwindcss.com/docs/border-radius 11240 */ 11241 'rounded-r': [{ 11242 'rounded-r': [borderRadius] 11243 }], 11244 /** 11245 * Border Radius Bottom 11246 * @see https://tailwindcss.com/docs/border-radius 11247 */ 11248 'rounded-b': [{ 11249 'rounded-b': [borderRadius] 11250 }], 11251 /** 11252 * Border Radius Left 11253 * @see https://tailwindcss.com/docs/border-radius 11254 */ 11255 'rounded-l': [{ 11256 'rounded-l': [borderRadius] 11257 }], 11258 /** 11259 * Border Radius Start Start 11260 * @see https://tailwindcss.com/docs/border-radius 11261 */ 11262 'rounded-ss': [{ 11263 'rounded-ss': [borderRadius] 11264 }], 11265 /** 11266 * Border Radius Start End 11267 * @see https://tailwindcss.com/docs/border-radius 11268 */ 11269 'rounded-se': [{ 11270 'rounded-se': [borderRadius] 11271 }], 11272 /** 11273 * Border Radius End End 11274 * @see https://tailwindcss.com/docs/border-radius 11275 */ 11276 'rounded-ee': [{ 11277 'rounded-ee': [borderRadius] 11278 }], 11279 /** 11280 * Border Radius End Start 11281 * @see https://tailwindcss.com/docs/border-radius 11282 */ 11283 'rounded-es': [{ 11284 'rounded-es': [borderRadius] 11285 }], 11286 /** 11287 * Border Radius Top Left 11288 * @see https://tailwindcss.com/docs/border-radius 11289 */ 11290 'rounded-tl': [{ 11291 'rounded-tl': [borderRadius] 11292 }], 11293 /** 11294 * Border Radius Top Right 11295 * @see https://tailwindcss.com/docs/border-radius 11296 */ 11297 'rounded-tr': [{ 11298 'rounded-tr': [borderRadius] 11299 }], 11300 /** 11301 * Border Radius Bottom Right 11302 * @see https://tailwindcss.com/docs/border-radius 11303 */ 11304 'rounded-br': [{ 11305 'rounded-br': [borderRadius] 11306 }], 11307 /** 11308 * Border Radius Bottom Left 11309 * @see https://tailwindcss.com/docs/border-radius 11310 */ 11311 'rounded-bl': [{ 11312 'rounded-bl': [borderRadius] 11313 }], 11314 /** 11315 * Border Width 11316 * @see https://tailwindcss.com/docs/border-width 11317 */ 11318 'border-w': [{ 11319 border: [borderWidth] 11320 }], 11321 /** 11322 * Border Width X 11323 * @see https://tailwindcss.com/docs/border-width 11324 */ 11325 'border-w-x': [{ 11326 'border-x': [borderWidth] 11327 }], 11328 /** 11329 * Border Width Y 11330 * @see https://tailwindcss.com/docs/border-width 11331 */ 11332 'border-w-y': [{ 11333 'border-y': [borderWidth] 11334 }], 11335 /** 11336 * Border Width Start 11337 * @see https://tailwindcss.com/docs/border-width 11338 */ 11339 'border-w-s': [{ 11340 'border-s': [borderWidth] 11341 }], 11342 /** 11343 * Border Width End 11344 * @see https://tailwindcss.com/docs/border-width 11345 */ 11346 'border-w-e': [{ 11347 'border-e': [borderWidth] 11348 }], 11349 /** 11350 * Border Width Top 11351 * @see https://tailwindcss.com/docs/border-width 11352 */ 11353 'border-w-t': [{ 11354 'border-t': [borderWidth] 11355 }], 11356 /** 11357 * Border Width Right 11358 * @see https://tailwindcss.com/docs/border-width 11359 */ 11360 'border-w-r': [{ 11361 'border-r': [borderWidth] 11362 }], 11363 /** 11364 * Border Width Bottom 11365 * @see https://tailwindcss.com/docs/border-width 11366 */ 11367 'border-w-b': [{ 11368 'border-b': [borderWidth] 11369 }], 11370 /** 11371 * Border Width Left 11372 * @see https://tailwindcss.com/docs/border-width 11373 */ 11374 'border-w-l': [{ 11375 'border-l': [borderWidth] 11376 }], 11377 /** 11378 * Border Opacity 11379 * @see https://tailwindcss.com/docs/border-opacity 11380 */ 11381 'border-opacity': [{ 11382 'border-opacity': [opacity] 11383 }], 11384 /** 11385 * Border Style 11386 * @see https://tailwindcss.com/docs/border-style 11387 */ 11388 'border-style': [{ 11389 border: [...getLineStyles(), 'hidden'] 11390 }], 11391 /** 11392 * Divide Width X 11393 * @see https://tailwindcss.com/docs/divide-width 11394 */ 11395 'divide-x': [{ 11396 'divide-x': [borderWidth] 11397 }], 11398 /** 11399 * Divide Width X Reverse 11400 * @see https://tailwindcss.com/docs/divide-width 11401 */ 11402 'divide-x-reverse': ['divide-x-reverse'], 11403 /** 11404 * Divide Width Y 11405 * @see https://tailwindcss.com/docs/divide-width 11406 */ 11407 'divide-y': [{ 11408 'divide-y': [borderWidth] 11409 }], 11410 /** 11411 * Divide Width Y Reverse 11412 * @see https://tailwindcss.com/docs/divide-width 11413 */ 11414 'divide-y-reverse': ['divide-y-reverse'], 11415 /** 11416 * Divide Opacity 11417 * @see https://tailwindcss.com/docs/divide-opacity 11418 */ 11419 'divide-opacity': [{ 11420 'divide-opacity': [opacity] 11421 }], 11422 /** 11423 * Divide Style 11424 * @see https://tailwindcss.com/docs/divide-style 11425 */ 11426 'divide-style': [{ 11427 divide: getLineStyles() 11428 }], 11429 /** 11430 * Border Color 11431 * @see https://tailwindcss.com/docs/border-color 11432 */ 11433 'border-color': [{ 11434 border: [borderColor] 11435 }], 11436 /** 11437 * Border Color X 11438 * @see https://tailwindcss.com/docs/border-color 11439 */ 11440 'border-color-x': [{ 11441 'border-x': [borderColor] 11442 }], 11443 /** 11444 * Border Color Y 11445 * @see https://tailwindcss.com/docs/border-color 11446 */ 11447 'border-color-y': [{ 11448 'border-y': [borderColor] 11449 }], 11450 /** 11451 * Border Color Top 11452 * @see https://tailwindcss.com/docs/border-color 11453 */ 11454 'border-color-t': [{ 11455 'border-t': [borderColor] 11456 }], 11457 /** 11458 * Border Color Right 11459 * @see https://tailwindcss.com/docs/border-color 11460 */ 11461 'border-color-r': [{ 11462 'border-r': [borderColor] 11463 }], 11464 /** 11465 * Border Color Bottom 11466 * @see https://tailwindcss.com/docs/border-color 11467 */ 11468 'border-color-b': [{ 11469 'border-b': [borderColor] 11470 }], 11471 /** 11472 * Border Color Left 11473 * @see https://tailwindcss.com/docs/border-color 11474 */ 11475 'border-color-l': [{ 11476 'border-l': [borderColor] 11477 }], 11478 /** 11479 * Divide Color 11480 * @see https://tailwindcss.com/docs/divide-color 11481 */ 11482 'divide-color': [{ 11483 divide: [borderColor] 11484 }], 11485 /** 11486 * Outline Style 11487 * @see https://tailwindcss.com/docs/outline-style 11488 */ 11489 'outline-style': [{ 11490 outline: ['', ...getLineStyles()] 11491 }], 11492 /** 11493 * Outline Offset 11494 * @see https://tailwindcss.com/docs/outline-offset 11495 */ 11496 'outline-offset': [{ 11497 'outline-offset': [isLength, isArbitraryValue] 11498 }], 11499 /** 11500 * Outline Width 11501 * @see https://tailwindcss.com/docs/outline-width 11502 */ 11503 'outline-w': [{ 11504 outline: [isLength, isArbitraryLength] 11505 }], 11506 /** 11507 * Outline Color 11508 * @see https://tailwindcss.com/docs/outline-color 11509 */ 11510 'outline-color': [{ 11511 outline: [colors] 11512 }], 11513 /** 11514 * Ring Width 11515 * @see https://tailwindcss.com/docs/ring-width 11516 */ 11517 'ring-w': [{ 11518 ring: getLengthWithEmptyAndArbitrary() 11519 }], 11520 /** 11521 * Ring Width Inset 11522 * @see https://tailwindcss.com/docs/ring-width 11523 */ 11524 'ring-w-inset': ['ring-inset'], 11525 /** 11526 * Ring Color 11527 * @see https://tailwindcss.com/docs/ring-color 11528 */ 11529 'ring-color': [{ 11530 ring: [colors] 11531 }], 11532 /** 11533 * Ring Opacity 11534 * @see https://tailwindcss.com/docs/ring-opacity 11535 */ 11536 'ring-opacity': [{ 11537 'ring-opacity': [opacity] 11538 }], 11539 /** 11540 * Ring Offset Width 11541 * @see https://tailwindcss.com/docs/ring-offset-width 11542 */ 11543 'ring-offset-w': [{ 11544 'ring-offset': [isLength, isArbitraryLength] 11545 }], 11546 /** 11547 * Ring Offset Color 11548 * @see https://tailwindcss.com/docs/ring-offset-color 11549 */ 11550 'ring-offset-color': [{ 11551 'ring-offset': [colors] 11552 }], 11553 // Effects 11554 /** 11555 * Box Shadow 11556 * @see https://tailwindcss.com/docs/box-shadow 11557 */ 11558 shadow: [{ 11559 shadow: ['', 'inner', 'none', isTshirtSize, isArbitraryShadow] 11560 }], 11561 /** 11562 * Box Shadow Color 11563 * @see https://tailwindcss.com/docs/box-shadow-color 11564 */ 11565 'shadow-color': [{ 11566 shadow: [isAny] 11567 }], 11568 /** 11569 * Opacity 11570 * @see https://tailwindcss.com/docs/opacity 11571 */ 11572 opacity: [{ 11573 opacity: [opacity] 11574 }], 11575 /** 11576 * Mix Blend Mode 11577 * @see https://tailwindcss.com/docs/mix-blend-mode 11578 */ 11579 'mix-blend': [{ 11580 'mix-blend': [...getBlendModes(), 'plus-lighter', 'plus-darker'] 11581 }], 11582 /** 11583 * Background Blend Mode 11584 * @see https://tailwindcss.com/docs/background-blend-mode 11585 */ 11586 'bg-blend': [{ 11587 'bg-blend': getBlendModes() 11588 }], 11589 // Filters 11590 /** 11591 * Filter 11592 * @deprecated since Tailwind CSS v3.0.0 11593 * @see https://tailwindcss.com/docs/filter 11594 */ 11595 filter: [{ 11596 filter: ['', 'none'] 11597 }], 11598 /** 11599 * Blur 11600 * @see https://tailwindcss.com/docs/blur 11601 */ 11602 blur: [{ 11603 blur: [blur] 11604 }], 11605 /** 11606 * Brightness 11607 * @see https://tailwindcss.com/docs/brightness 11608 */ 11609 brightness: [{ 11610 brightness: [brightness] 11611 }], 11612 /** 11613 * Contrast 11614 * @see https://tailwindcss.com/docs/contrast 11615 */ 11616 contrast: [{ 11617 contrast: [contrast] 11618 }], 11619 /** 11620 * Drop Shadow 11621 * @see https://tailwindcss.com/docs/drop-shadow 11622 */ 11623 'drop-shadow': [{ 11624 'drop-shadow': ['', 'none', isTshirtSize, isArbitraryValue] 11625 }], 11626 /** 11627 * Grayscale 11628 * @see https://tailwindcss.com/docs/grayscale 11629 */ 11630 grayscale: [{ 11631 grayscale: [grayscale] 11632 }], 11633 /** 11634 * Hue Rotate 11635 * @see https://tailwindcss.com/docs/hue-rotate 11636 */ 11637 'hue-rotate': [{ 11638 'hue-rotate': [hueRotate] 11639 }], 11640 /** 11641 * Invert 11642 * @see https://tailwindcss.com/docs/invert 11643 */ 11644 invert: [{ 11645 invert: [invert] 11646 }], 11647 /** 11648 * Saturate 11649 * @see https://tailwindcss.com/docs/saturate 11650 */ 11651 saturate: [{ 11652 saturate: [saturate] 11653 }], 11654 /** 11655 * Sepia 11656 * @see https://tailwindcss.com/docs/sepia 11657 */ 11658 sepia: [{ 11659 sepia: [sepia] 11660 }], 11661 /** 11662 * Backdrop Filter 11663 * @deprecated since Tailwind CSS v3.0.0 11664 * @see https://tailwindcss.com/docs/backdrop-filter 11665 */ 11666 'backdrop-filter': [{ 11667 'backdrop-filter': ['', 'none'] 11668 }], 11669 /** 11670 * Backdrop Blur 11671 * @see https://tailwindcss.com/docs/backdrop-blur 11672 */ 11673 'backdrop-blur': [{ 11674 'backdrop-blur': [blur] 11675 }], 11676 /** 11677 * Backdrop Brightness 11678 * @see https://tailwindcss.com/docs/backdrop-brightness 11679 */ 11680 'backdrop-brightness': [{ 11681 'backdrop-brightness': [brightness] 11682 }], 11683 /** 11684 * Backdrop Contrast 11685 * @see https://tailwindcss.com/docs/backdrop-contrast 11686 */ 11687 'backdrop-contrast': [{ 11688 'backdrop-contrast': [contrast] 11689 }], 11690 /** 11691 * Backdrop Grayscale 11692 * @see https://tailwindcss.com/docs/backdrop-grayscale 11693 */ 11694 'backdrop-grayscale': [{ 11695 'backdrop-grayscale': [grayscale] 11696 }], 11697 /** 11698 * Backdrop Hue Rotate 11699 * @see https://tailwindcss.com/docs/backdrop-hue-rotate 11700 */ 11701 'backdrop-hue-rotate': [{ 11702 'backdrop-hue-rotate': [hueRotate] 11703 }], 11704 /** 11705 * Backdrop Invert 11706 * @see https://tailwindcss.com/docs/backdrop-invert 11707 */ 11708 'backdrop-invert': [{ 11709 'backdrop-invert': [invert] 11710 }], 11711 /** 11712 * Backdrop Opacity 11713 * @see https://tailwindcss.com/docs/backdrop-opacity 11714 */ 11715 'backdrop-opacity': [{ 11716 'backdrop-opacity': [opacity] 11717 }], 11718 /** 11719 * Backdrop Saturate 11720 * @see https://tailwindcss.com/docs/backdrop-saturate 11721 */ 11722 'backdrop-saturate': [{ 11723 'backdrop-saturate': [saturate] 11724 }], 11725 /** 11726 * Backdrop Sepia 11727 * @see https://tailwindcss.com/docs/backdrop-sepia 11728 */ 11729 'backdrop-sepia': [{ 11730 'backdrop-sepia': [sepia] 11731 }], 11732 // Tables 11733 /** 11734 * Border Collapse 11735 * @see https://tailwindcss.com/docs/border-collapse 11736 */ 11737 'border-collapse': [{ 11738 border: ['collapse', 'separate'] 11739 }], 11740 /** 11741 * Border Spacing 11742 * @see https://tailwindcss.com/docs/border-spacing 11743 */ 11744 'border-spacing': [{ 11745 'border-spacing': [borderSpacing] 11746 }], 11747 /** 11748 * Border Spacing X 11749 * @see https://tailwindcss.com/docs/border-spacing 11750 */ 11751 'border-spacing-x': [{ 11752 'border-spacing-x': [borderSpacing] 11753 }], 11754 /** 11755 * Border Spacing Y 11756 * @see https://tailwindcss.com/docs/border-spacing 11757 */ 11758 'border-spacing-y': [{ 11759 'border-spacing-y': [borderSpacing] 11760 }], 11761 /** 11762 * Table Layout 11763 * @see https://tailwindcss.com/docs/table-layout 11764 */ 11765 'table-layout': [{ 11766 table: ['auto', 'fixed'] 11767 }], 11768 /** 11769 * Caption Side 11770 * @see https://tailwindcss.com/docs/caption-side 11771 */ 11772 caption: [{ 11773 caption: ['top', 'bottom'] 11774 }], 11775 // Transitions and Animation 11776 /** 11777 * Tranisition Property 11778 * @see https://tailwindcss.com/docs/transition-property 11779 */ 11780 transition: [{ 11781 transition: ['none', 'all', '', 'colors', 'opacity', 'shadow', 'transform', isArbitraryValue] 11782 }], 11783 /** 11784 * Transition Duration 11785 * @see https://tailwindcss.com/docs/transition-duration 11786 */ 11787 duration: [{ 11788 duration: getNumberAndArbitrary() 11789 }], 11790 /** 11791 * Transition Timing Function 11792 * @see https://tailwindcss.com/docs/transition-timing-function 11793 */ 11794 ease: [{ 11795 ease: ['linear', 'in', 'out', 'in-out', isArbitraryValue] 11796 }], 11797 /** 11798 * Transition Delay 11799 * @see https://tailwindcss.com/docs/transition-delay 11800 */ 11801 delay: [{ 11802 delay: getNumberAndArbitrary() 11803 }], 11804 /** 11805 * Animation 11806 * @see https://tailwindcss.com/docs/animation 11807 */ 11808 animate: [{ 11809 animate: ['none', 'spin', 'ping', 'pulse', 'bounce', isArbitraryValue] 11810 }], 11811 // Transforms 11812 /** 11813 * Transform 11814 * @see https://tailwindcss.com/docs/transform 11815 */ 11816 transform: [{ 11817 transform: ['', 'gpu', 'none'] 11818 }], 11819 /** 11820 * Scale 11821 * @see https://tailwindcss.com/docs/scale 11822 */ 11823 scale: [{ 11824 scale: [scale] 11825 }], 11826 /** 11827 * Scale X 11828 * @see https://tailwindcss.com/docs/scale 11829 */ 11830 'scale-x': [{ 11831 'scale-x': [scale] 11832 }], 11833 /** 11834 * Scale Y 11835 * @see https://tailwindcss.com/docs/scale 11836 */ 11837 'scale-y': [{ 11838 'scale-y': [scale] 11839 }], 11840 /** 11841 * Rotate 11842 * @see https://tailwindcss.com/docs/rotate 11843 */ 11844 rotate: [{ 11845 rotate: [isInteger, isArbitraryValue] 11846 }], 11847 /** 11848 * Translate X 11849 * @see https://tailwindcss.com/docs/translate 11850 */ 11851 'translate-x': [{ 11852 'translate-x': [translate] 11853 }], 11854 /** 11855 * Translate Y 11856 * @see https://tailwindcss.com/docs/translate 11857 */ 11858 'translate-y': [{ 11859 'translate-y': [translate] 11860 }], 11861 /** 11862 * Skew X 11863 * @see https://tailwindcss.com/docs/skew 11864 */ 11865 'skew-x': [{ 11866 'skew-x': [skew] 11867 }], 11868 /** 11869 * Skew Y 11870 * @see https://tailwindcss.com/docs/skew 11871 */ 11872 'skew-y': [{ 11873 'skew-y': [skew] 11874 }], 11875 /** 11876 * Transform Origin 11877 * @see https://tailwindcss.com/docs/transform-origin 11878 */ 11879 'transform-origin': [{ 11880 origin: ['center', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'left', 'top-left', isArbitraryValue] 11881 }], 11882 // Interactivity 11883 /** 11884 * Accent Color 11885 * @see https://tailwindcss.com/docs/accent-color 11886 */ 11887 accent: [{ 11888 accent: ['auto', colors] 11889 }], 11890 /** 11891 * Appearance 11892 * @see https://tailwindcss.com/docs/appearance 11893 */ 11894 appearance: [{ 11895 appearance: ['none', 'auto'] 11896 }], 11897 /** 11898 * Cursor 11899 * @see https://tailwindcss.com/docs/cursor 11900 */ 11901 cursor: [{ 11902 cursor: ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'help', 'not-allowed', 'none', 'context-menu', 'progress', 'cell', 'crosshair', 'vertical-text', 'alias', 'copy', 'no-drop', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', isArbitraryValue] 11903 }], 11904 /** 11905 * Caret Color 11906 * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities 11907 */ 11908 'caret-color': [{ 11909 caret: [colors] 11910 }], 11911 /** 11912 * Pointer Events 11913 * @see https://tailwindcss.com/docs/pointer-events 11914 */ 11915 'pointer-events': [{ 11916 'pointer-events': ['none', 'auto'] 11917 }], 11918 /** 11919 * Resize 11920 * @see https://tailwindcss.com/docs/resize 11921 */ 11922 resize: [{ 11923 resize: ['none', 'y', 'x', ''] 11924 }], 11925 /** 11926 * Scroll Behavior 11927 * @see https://tailwindcss.com/docs/scroll-behavior 11928 */ 11929 'scroll-behavior': [{ 11930 scroll: ['auto', 'smooth'] 11931 }], 11932 /** 11933 * Scroll Margin 11934 * @see https://tailwindcss.com/docs/scroll-margin 11935 */ 11936 'scroll-m': [{ 11937 'scroll-m': getSpacingWithArbitrary() 11938 }], 11939 /** 11940 * Scroll Margin X 11941 * @see https://tailwindcss.com/docs/scroll-margin 11942 */ 11943 'scroll-mx': [{ 11944 'scroll-mx': getSpacingWithArbitrary() 11945 }], 11946 /** 11947 * Scroll Margin Y 11948 * @see https://tailwindcss.com/docs/scroll-margin 11949 */ 11950 'scroll-my': [{ 11951 'scroll-my': getSpacingWithArbitrary() 11952 }], 11953 /** 11954 * Scroll Margin Start 11955 * @see https://tailwindcss.com/docs/scroll-margin 11956 */ 11957 'scroll-ms': [{ 11958 'scroll-ms': getSpacingWithArbitrary() 11959 }], 11960 /** 11961 * Scroll Margin End 11962 * @see https://tailwindcss.com/docs/scroll-margin 11963 */ 11964 'scroll-me': [{ 11965 'scroll-me': getSpacingWithArbitrary() 11966 }], 11967 /** 11968 * Scroll Margin Top 11969 * @see https://tailwindcss.com/docs/scroll-margin 11970 */ 11971 'scroll-mt': [{ 11972 'scroll-mt': getSpacingWithArbitrary() 11973 }], 11974 /** 11975 * Scroll Margin Right 11976 * @see https://tailwindcss.com/docs/scroll-margin 11977 */ 11978 'scroll-mr': [{ 11979 'scroll-mr': getSpacingWithArbitrary() 11980 }], 11981 /** 11982 * Scroll Margin Bottom 11983 * @see https://tailwindcss.com/docs/scroll-margin 11984 */ 11985 'scroll-mb': [{ 11986 'scroll-mb': getSpacingWithArbitrary() 11987 }], 11988 /** 11989 * Scroll Margin Left 11990 * @see https://tailwindcss.com/docs/scroll-margin 11991 */ 11992 'scroll-ml': [{ 11993 'scroll-ml': getSpacingWithArbitrary() 11994 }], 11995 /** 11996 * Scroll Padding 11997 * @see https://tailwindcss.com/docs/scroll-padding 11998 */ 11999 'scroll-p': [{ 12000 'scroll-p': getSpacingWithArbitrary() 12001 }], 12002 /** 12003 * Scroll Padding X 12004 * @see https://tailwindcss.com/docs/scroll-padding 12005 */ 12006 'scroll-px': [{ 12007 'scroll-px': getSpacingWithArbitrary() 12008 }], 12009 /** 12010 * Scroll Padding Y 12011 * @see https://tailwindcss.com/docs/scroll-padding 12012 */ 12013 'scroll-py': [{ 12014 'scroll-py': getSpacingWithArbitrary() 12015 }], 12016 /** 12017 * Scroll Padding Start 12018 * @see https://tailwindcss.com/docs/scroll-padding 12019 */ 12020 'scroll-ps': [{ 12021 'scroll-ps': getSpacingWithArbitrary() 12022 }], 12023 /** 12024 * Scroll Padding End 12025 * @see https://tailwindcss.com/docs/scroll-padding 12026 */ 12027 'scroll-pe': [{ 12028 'scroll-pe': getSpacingWithArbitrary() 12029 }], 12030 /** 12031 * Scroll Padding Top 12032 * @see https://tailwindcss.com/docs/scroll-padding 12033 */ 12034 'scroll-pt': [{ 12035 'scroll-pt': getSpacingWithArbitrary() 12036 }], 12037 /** 12038 * Scroll Padding Right 12039 * @see https://tailwindcss.com/docs/scroll-padding 12040 */ 12041 'scroll-pr': [{ 12042 'scroll-pr': getSpacingWithArbitrary() 12043 }], 12044 /** 12045 * Scroll Padding Bottom 12046 * @see https://tailwindcss.com/docs/scroll-padding 12047 */ 12048 'scroll-pb': [{ 12049 'scroll-pb': getSpacingWithArbitrary() 12050 }], 12051 /** 12052 * Scroll Padding Left 12053 * @see https://tailwindcss.com/docs/scroll-padding 12054 */ 12055 'scroll-pl': [{ 12056 'scroll-pl': getSpacingWithArbitrary() 12057 }], 12058 /** 12059 * Scroll Snap Align 12060 * @see https://tailwindcss.com/docs/scroll-snap-align 12061 */ 12062 'snap-align': [{ 12063 snap: ['start', 'end', 'center', 'align-none'] 12064 }], 12065 /** 12066 * Scroll Snap Stop 12067 * @see https://tailwindcss.com/docs/scroll-snap-stop 12068 */ 12069 'snap-stop': [{ 12070 snap: ['normal', 'always'] 12071 }], 12072 /** 12073 * Scroll Snap Type 12074 * @see https://tailwindcss.com/docs/scroll-snap-type 12075 */ 12076 'snap-type': [{ 12077 snap: ['none', 'x', 'y', 'both'] 12078 }], 12079 /** 12080 * Scroll Snap Type Strictness 12081 * @see https://tailwindcss.com/docs/scroll-snap-type 12082 */ 12083 'snap-strictness': [{ 12084 snap: ['mandatory', 'proximity'] 12085 }], 12086 /** 12087 * Touch Action 12088 * @see https://tailwindcss.com/docs/touch-action 12089 */ 12090 touch: [{ 12091 touch: ['auto', 'none', 'manipulation'] 12092 }], 12093 /** 12094 * Touch Action X 12095 * @see https://tailwindcss.com/docs/touch-action 12096 */ 12097 'touch-x': [{ 12098 'touch-pan': ['x', 'left', 'right'] 12099 }], 12100 /** 12101 * Touch Action Y 12102 * @see https://tailwindcss.com/docs/touch-action 12103 */ 12104 'touch-y': [{ 12105 'touch-pan': ['y', 'up', 'down'] 12106 }], 12107 /** 12108 * Touch Action Pinch Zoom 12109 * @see https://tailwindcss.com/docs/touch-action 12110 */ 12111 'touch-pz': ['touch-pinch-zoom'], 12112 /** 12113 * User Select 12114 * @see https://tailwindcss.com/docs/user-select 12115 */ 12116 select: [{ 12117 select: ['none', 'text', 'all', 'auto'] 12118 }], 12119 /** 12120 * Will Change 12121 * @see https://tailwindcss.com/docs/will-change 12122 */ 12123 'will-change': [{ 12124 'will-change': ['auto', 'scroll', 'contents', 'transform', isArbitraryValue] 12125 }], 12126 // SVG 12127 /** 12128 * Fill 12129 * @see https://tailwindcss.com/docs/fill 12130 */ 12131 fill: [{ 12132 fill: [colors, 'none'] 12133 }], 12134 /** 12135 * Stroke Width 12136 * @see https://tailwindcss.com/docs/stroke-width 12137 */ 12138 'stroke-w': [{ 12139 stroke: [isLength, isArbitraryLength, isArbitraryNumber] 12140 }], 12141 /** 12142 * Stroke 12143 * @see https://tailwindcss.com/docs/stroke 12144 */ 12145 stroke: [{ 12146 stroke: [colors, 'none'] 12147 }], 12148 // Accessibility 12149 /** 12150 * Screen Readers 12151 * @see https://tailwindcss.com/docs/screen-readers 12152 */ 12153 sr: ['sr-only', 'not-sr-only'], 12154 /** 12155 * Forced Color Adjust 12156 * @see https://tailwindcss.com/docs/forced-color-adjust 12157 */ 12158 'forced-color-adjust': [{ 12159 'forced-color-adjust': ['auto', 'none'] 12160 }] 12161 }, 12162 conflictingClassGroups: { 12163 overflow: ['overflow-x', 'overflow-y'], 12164 overscroll: ['overscroll-x', 'overscroll-y'], 12165 inset: ['inset-x', 'inset-y', 'start', 'end', 'top', 'right', 'bottom', 'left'], 12166 'inset-x': ['right', 'left'], 12167 'inset-y': ['top', 'bottom'], 12168 flex: ['basis', 'grow', 'shrink'], 12169 gap: ['gap-x', 'gap-y'], 12170 p: ['px', 'py', 'ps', 'pe', 'pt', 'pr', 'pb', 'pl'], 12171 px: ['pr', 'pl'], 12172 py: ['pt', 'pb'], 12173 m: ['mx', 'my', 'ms', 'me', 'mt', 'mr', 'mb', 'ml'], 12174 mx: ['mr', 'ml'], 12175 my: ['mt', 'mb'], 12176 size: ['w', 'h'], 12177 'font-size': ['leading'], 12178 'fvn-normal': ['fvn-ordinal', 'fvn-slashed-zero', 'fvn-figure', 'fvn-spacing', 'fvn-fraction'], 12179 'fvn-ordinal': ['fvn-normal'], 12180 'fvn-slashed-zero': ['fvn-normal'], 12181 'fvn-figure': ['fvn-normal'], 12182 'fvn-spacing': ['fvn-normal'], 12183 'fvn-fraction': ['fvn-normal'], 12184 'line-clamp': ['display', 'overflow'], 12185 rounded: ['rounded-s', 'rounded-e', 'rounded-t', 'rounded-r', 'rounded-b', 'rounded-l', 'rounded-ss', 'rounded-se', 'rounded-ee', 'rounded-es', 'rounded-tl', 'rounded-tr', 'rounded-br', 'rounded-bl'], 12186 'rounded-s': ['rounded-ss', 'rounded-es'], 12187 'rounded-e': ['rounded-se', 'rounded-ee'], 12188 'rounded-t': ['rounded-tl', 'rounded-tr'], 12189 'rounded-r': ['rounded-tr', 'rounded-br'], 12190 'rounded-b': ['rounded-br', 'rounded-bl'], 12191 'rounded-l': ['rounded-tl', 'rounded-bl'], 12192 'border-spacing': ['border-spacing-x', 'border-spacing-y'], 12193 'border-w': ['border-w-s', 'border-w-e', 'border-w-t', 'border-w-r', 'border-w-b', 'border-w-l'], 12194 'border-w-x': ['border-w-r', 'border-w-l'], 12195 'border-w-y': ['border-w-t', 'border-w-b'], 12196 'border-color': ['border-color-t', 'border-color-r', 'border-color-b', 'border-color-l'], 12197 'border-color-x': ['border-color-r', 'border-color-l'], 12198 'border-color-y': ['border-color-t', 'border-color-b'], 12199 'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-ms', 'scroll-me', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'], 12200 'scroll-mx': ['scroll-mr', 'scroll-ml'], 12201 'scroll-my': ['scroll-mt', 'scroll-mb'], 12202 'scroll-p': ['scroll-px', 'scroll-py', 'scroll-ps', 'scroll-pe', 'scroll-pt', 'scroll-pr', 'scroll-pb', 'scroll-pl'], 12203 'scroll-px': ['scroll-pr', 'scroll-pl'], 12204 'scroll-py': ['scroll-pt', 'scroll-pb'], 12205 touch: ['touch-x', 'touch-y', 'touch-pz'], 12206 'touch-x': ['touch'], 12207 'touch-y': ['touch'], 12208 'touch-pz': ['touch'] 12209 }, 12210 conflictingClassGroupModifiers: { 12211 'font-size': ['leading'] 12212 } 12213 }; 12214}
12215const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig); 12216 12217function cn(...inputs) { 12218 return twMerge(clsx(inputs)); 12219} 12220function downloadFileObject(base64String, name) { 12221 const linkSource = base64String; 12222 const downloadLink = document.createElement("a"); 12223 const fileName = name; 12224 downloadLink.href = linkSource; 12225 downloadLink.download = fileName; 12226 downloadLink.click(); 12227} 12228const downloadFileFromLink = async (urlString) => { 12229 const response = await fetch(urlString); 12230 const blob = await response.blob(); 12231 const url = window.URL.createObjectURL(blob); 12232 const link = document.createElement("a"); 12233 link.href = url; 12234 link.setAttribute("download", "Full Project Cost Estimate.pdf"); 12235 document.body.appendChild(link); 12236 link.click(); 12237 document.body.removeChild(link); 12238 window.URL.revokeObjectURL(url); 12239}; 12240const downloadPdf = (session_id) => async () => { 12241 try { 12242 const response = await axios.post( 12243 API_URLS.DOWNLOAD_ESTIMATE, 12244 { 12245 session_id: session_id || localStorage.getItem(SESSION_ID_NAME) 12246 }, 12247 { 12248 responseType: "blob" 12249 // Important for handling binary data 12250 } 12251 ); 12252 const url = window.URL.createObjectURL( 12253 new Blob([response.data], { type: response.headers["Content-Type"] }) 12254 ); 12255 const link = document.createElement("a"); 12256 link.href = url; 12257 const contentDisposition = response.headers["content-disposition"]; 12258 let filename = "Project Cost Estimate.pdf"; 12259 if (contentDisposition) { 12260 const match = contentDisposition.match(/filename="?(.+?)"?$/); 12261 if (match) filename = match[1]; 12262 } 12263 link.setAttribute("download", filename); 12264 document.body.appendChild(link); 12265 link.click(); 12266 link.remove(); 12267 window.URL.revokeObjectURL(url); 12268 } catch (error) { 12269 console.log(error); 12270 return error; 12271 } 12272}; 12273const downloadEstimate = (apiUrl, baseName) => async (session_id) => { 12274 try { 12275 const response = await axios.post( 12276 apiUrl, 12277 { 12278 session_id: session_id || localStorage.getItem(SESSION_ID_NAME) 12279 }, 12280 { 12281 responseType: "blob" 12282 // Important for handling binary data 12283 } 12284 ); 12285 const url = window.URL.createObjectURL( 12286 new Blob([response.data], { type: response.headers["Content-Type"] }) 12287 ); 12288 const link = document.createElement("a"); 12289 link.href = url; 12290 const contentDisposition = response.headers["content-disposition"]; 12291 let filename = baseName; 12292 if (contentDisposition) { 12293 const match = contentDisposition.match(/filename="?(.+?)"?$/); 12294 if (match) filename = match[1]; 12295 } 12296 link.setAttribute("download", filename); 12297 document.body.appendChild(link); 12298 link.click(); 12299 link.remove(); 12300 window.URL.revokeObjectURL(url); 12301 } catch (error) { 12302 console.log(error); 12303 } 12304}; 12305const downloadBusinessEstimate = downloadEstimate( 12306 API_URLS.DOWNLOAD_BLUEPRINT, 12307 "Cost Quest Business estimate.pdf" 12308); 12309const downloadPatentEstimate = downloadEstimate(API_URLS.DOWNLOAD_PATENT, "Cost Quest Patent estimate.pdf"); 12310const downloadBase64File = async (base64, customName) => { 12311 try { 12312 const name = customName || "File.pdf"; 12313 let base64String = base64; 12314 if (base64String.startsWith("JVB")) { 12315 base64String = "data:application/pdf;base64," + base64String; 12316 downloadFileObject(base64String, name); 12317 } else if (base64String.startsWith("data:application/pdf;base64")) { 12318 downloadFileObject(base64String, name); 12319 } else { 12320 console.log("Not a valid Base64 PDF string. Please check"); 12321 } 12322 } catch (error) { 12323 console.log(error); 12324 } 12325}; 12326 12327const VideoJPGUrl = ""+new URL('video.jpg', import.meta.url).href+""; 12328 12329const VideoUrl = ""+new URL('bg-video.mp4', import.meta.url).href+""; 12330 12331const Video = ({ className }) => { 12332 return /* @__PURE__ */ jsxRuntimeExports.jsx("video", { className: cn("h-full w-full", className), autoPlay: true, playsInline: true, loop: true, muted: true, poster: VideoJPGUrl, children: /* @__PURE__ */ jsxRuntimeExports.jsx("source", { src: VideoUrl, type: "video/mp4" }) }); 12333}; 12334 12335const logo = ""+new URL('logo.svg', import.meta.url).href+""; 12336 12337const inputWrapper$3 = "_inputWrapper_41s55_1"; 12338const input$3 = "_input_41s55_1"; 12339const modalBackdrop$3 = "_modalBackdrop_41s55_8"; 12340const modal$1 = "_modal_41s55_8"; 12341const styles$6 = { 12342 inputWrapper: inputWrapper$3, 12343 input: input$3, 12344 modalBackdrop: modalBackdrop$3, 12345 modal: modal$1}; 12346 12347const Feedback = (props) => { 12348 const [info, setInfo] = reactExports.useState({ 12349 name: "", 12350 email: "", 12351 message: "" 12352 }); 12353 const [emailError, setEmailError] = reactExports.useState(false); 12354 const handleInputChange = (e) => { 12355 const { name, value } = e.target; 12356 setEmailError(false); 12357 setInfo((prev) => ({ ...prev, [name]: value })); 12358 }; 12359 const handleSubmit = async () => { 12360 try { 12361 const emailRexex = new RegExp( 12362 "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" 12363 ); 12364 if (!emailRexex.test(info.email)) { 12365 setEmailError(true); 12366 } 12367 await axios.post(API_URLS.FEEDBACK, info); 12368 props.onSubmitData(); 12369 } catch (e) { 12370 console.log(e); 12371 } 12372 }; 12373 return reactDomExports.createPortal(
12374 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$6.modalBackdrop, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$6.modal, children: [ 12375 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "md:hidden shrink-0 p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "dark:block", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, width: "83", alt: "Costquest" }) }) }), 12376 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-6 pl-4 md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "cursor-pointer flex items-center", onClick: props.onCloseDialog, children: [ 12377 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--alt-arrow-left-linear] text-l text-lavender" }), 12378 "Back" 12379 ] }) }), 12380 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-muted p-4", children: [ 12381 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-l font-medium text-grey", children: "Share Your Feedback" }),
12382 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "Let us know how we can improve your experience by sharing your feedback with us." }) 12383 ] }), 12384 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4 p-4", children: [ 12385 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 12386 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "name", className: "text-grey text-xs", children: "Name*" }), 12387 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$6.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 12388 "input", 12389 { 12390 className: styles$6.input, 12391 type: "text", 12392 id: "name", 12393 name: "name", 12394 onChange: handleInputChange, 12395 placeholder: "Enter your name" 12396 } 12397 ) }) 12398 ] }), 12399 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
12400 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "email", className: "text-grey text-xs", children: "Email*" }), 12401 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(styles$6.inputWrapper, emailError && "border-red-500"), children: /* @__PURE__ */ jsxRuntimeExports.jsx( 12402 "input", 12403 { 12404 className: styles$6.input, 12405 type: "email", 12406 id: "email", 12407 name: "email", 12408 onChange: handleInputChange, 12409 placeholder: "[email protected]" 12410 } 12411 ) }) 12412 ] }) 12413 ] }), 12414 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-1 text-grey text-xs whitespace-break-spaces overflow-auto px-4 my-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 12415 "textarea", 12416 { 12417 className: "w-full h-full resize-none p-4 bg-deep rounded-3xl border border-muted outline-none", 12418 placeholder: "Enter your feedback", 12419 name: "message", 12420 onChange: handleInputChange 12421 } 12422 ) }),
12423 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-t border-muted p-4 flex justify-end gap-2", children: [ 12424 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main-outlined hidden md:block", onClick: props.onCloseDialog, children: "Cancel" }), 12425 /* @__PURE__ */ jsxRuntimeExports.jsxs( 12426 "button", 12427 { 12428 disabled: !info.email || !info.name || !info.message, 12429 className: "btn-main w-full md:w-auto", 12430 onClick: handleSubmit, 12431 children: [ 12432 "Send", 12433 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 12434 ] 12435 } 12436 ) 12437 ] }) 12438 ] }) }), 12439 document.body 12440 ); 12441}; 12442 12443const useScrollToTop = () => { 12444 const { pathname } = useLocation(); 12445 reactExports.useEffect(() => { 12446 document.body.scrollTo({ top: 0, behavior: "instant" }); 12447 window.scrollTo(0, 0); 12448 }, [pathname]); 12449}; 12450 12451const BANNER_DISMISSED_KEY = "cq_v2_banner_dismissed"; 12452const AnnouncementBanner = () => { 12453 const [visible, setVisible] = reactExports.useState(() => { 12454 try { 12455 return localStorage.getItem(BANNER_DISMISSED_KEY) !== "1"; 12456 } catch { 12457 return true; 12458 } 12459 }); 12460 if (!visible) return null; 12461 const handleClose = () => { 12462 try { 12463 localStorage.setItem(BANNER_DISMISSED_KEY, "1"); 12464 } catch { 12465 } 12466 setVisible(false); 12467 }; 12468 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative z-30 w-full px-2 pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-gradient before:rounded-2xl rounded-2xl bg-denim/80 flex items-center gap-2 py-2 pl-3 pr-2 md:gap-3 md:pl-5 min-h-[48px] md:min-h-[52px]", children: [ 12469 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-base leading-none shrink-0", "aria-hidden": true, children: "ð" }), 12470 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-1 min-w-0 items-center gap-3", children: [
vendor: 8,896 bytes, lines 12471-12778
12471 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-semibold text-grey whitespace-nowrap md:text-s", children: "CostQuest V2 is coming soon" }), 12472 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden lg:block w-px h-4 bg-lavender/20 shrink-0", "aria-hidden": true }), 12473 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden lg:block text-xs text-textSecondary2 truncate", children: "From idea to launch and beyond: AI Business Blueprint ⢠Patent Drafting ⢠Smarter Estimation" }) 12474 ] }), 12475 /* @__PURE__ */ jsxRuntimeExports.jsxs( 12476 "a", 12477 { 12478 href: "/waitlist", 12479 target: "_blank", 12480 rel: "noreferrer", 12481 className: "btn-outlined shrink-0 text-xxs md:text-xs font-semibold whitespace-nowrap", 12482 children: [ 12483 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Join the waitlist" }), 12484 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none" }) 12485 ] 12486 } 12487 ), 12488 /* @__PURE__ */ jsxRuntimeExports.jsx( 12489 "button", 12490 { 12491 onClick: handleClose, 12492 "aria-label": "Close announcement", 12493 className: "shrink-0 inline-flex items-center justify-center w-8 h-8 rounded-full text-greyGentle hover:text-grey hover:bg-white/5 transition-colors", 12494 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--close-circle-linear] text-xl leading-none" }) 12495 } 12496 ) 12497 ] }) }); 12498}; 12499 12500const defaultIconDimensions = Object.freeze( 12501 { 12502 left: 0, 12503 top: 0, 12504 width: 16, 12505 height: 16 12506 } 12507); 12508const defaultIconTransformations = Object.freeze({ 12509 rotate: 0, 12510 vFlip: false, 12511 hFlip: false 12512}); 12513const defaultIconProps = Object.freeze({ 12514 ...defaultIconDimensions, 12515 ...defaultIconTransformations 12516}); 12517const defaultExtendedIconProps = Object.freeze({ 12518 ...defaultIconProps, 12519 body: "", 12520 hidden: false 12521}); 12522 12523function mergeIconTransformations(obj1, obj2) { 12524 const result = {}; 12525 if (!obj1.hFlip !== !obj2.hFlip) { 12526 result.hFlip = true; 12527 } 12528 if (!obj1.vFlip !== !obj2.vFlip) { 12529 result.vFlip = true; 12530 } 12531 const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4; 12532 if (rotate) { 12533 result.rotate = rotate; 12534 } 12535 return result; 12536} 12537 12538function mergeIconData(parent, child) { 12539 const result = mergeIconTransformations(parent, child); 12540 for (const key in defaultExtendedIconProps) { 12541 if (key in defaultIconTransformations) { 12542 if (key in parent && !(key in result)) { 12543 result[key] = defaultIconTransformations[key]; 12544 } 12545 } else if (key in child) { 12546 result[key] = child[key]; 12547 } else if (key in parent) { 12548 result[key] = parent[key]; 12549 } 12550 } 12551 return result; 12552} 12553 12554function getIconsTree(data, names) { 12555 const icons = data.icons; 12556 const aliases = data.aliases || /* @__PURE__ */ Object.create(null); 12557 const resolved = /* @__PURE__ */ Object.create(null); 12558 function resolve(name) { 12559 if (icons[name]) { 12560 return resolved[name] = []; 12561 } 12562 if (!(name in resolved)) { 12563 resolved[name] = null; 12564 const parent = aliases[name] && aliases[name].parent; 12565 const value = parent && resolve(parent); 12566 if (value) { 12567 resolved[name] = [parent].concat(value); 12568 } 12569 } 12570 return resolved[name]; 12571 } 12572 (Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve); 12573 return resolved; 12574} 12575 12576function internalGetIconData(data, name, tree) { 12577 const icons = data.icons; 12578 const aliases = data.aliases || /* @__PURE__ */ Object.create(null); 12579 let currentProps = {}; 12580 function parse(name2) { 12581 currentProps = mergeIconData( 12582 icons[name2] || aliases[name2], 12583 currentProps 12584 ); 12585 } 12586 parse(name); 12587 tree.forEach(parse); 12588 return mergeIconData(data, currentProps); 12589} 12590 12591function parseIconSet(data, callback) { 12592 const names = []; 12593 if (typeof data !== "object" || typeof data.icons !== "object") { 12594 return names; 12595 } 12596 if (data.not_found instanceof Array) { 12597 data.not_found.forEach((name) => { 12598 callback(name, null); 12599 names.push(name); 12600 }); 12601 } 12602 const tree = getIconsTree(data); 12603 for (const name in tree) { 12604 const item = tree[name]; 12605 if (item) { 12606 callback(name, internalGetIconData(data, name, item)); 12607 names.push(name); 12608 } 12609 } 12610 return names; 12611} 12612 12613const optionalPropertyDefaults = { 12614 provider: "", 12615 aliases: {}, 12616 not_found: {}, 12617 ...defaultIconDimensions 12618}; 12619function checkOptionalProps(item, defaults) { 12620 for (const prop in defaults) { 12621 if (prop in item && typeof item[prop] !== typeof defaults[prop]) { 12622 return false; 12623 } 12624 } 12625 return true; 12626} 12627function quicklyValidateIconSet(obj) { 12628 if (typeof obj !== "object" || obj === null) { 12629 return null; 12630 } 12631 const data = obj; 12632 if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") { 12633 return null; 12634 } 12635 if (!checkOptionalProps(obj, optionalPropertyDefaults)) { 12636 return null; 12637 } 12638 const icons = data.icons; 12639 for (const name in icons) { 12640 const icon = icons[name]; 12641 if ( 12642 // Name cannot be empty 12643 !name || // Must have body 12644 typeof icon.body !== "string" || // Check other props 12645 !checkOptionalProps( 12646 icon, 12647 defaultExtendedIconProps 12648 ) 12649 ) { 12650 return null; 12651 } 12652 } 12653 const aliases = data.aliases || /* @__PURE__ */ Object.create(null); 12654 for (const name in aliases) { 12655 const icon = aliases[name]; 12656 const parent = icon.parent; 12657 if ( 12658 // Name cannot be empty 12659 !name || // Parent must be set and point to existing icon 12660 typeof parent !== "string" || !icons[parent] && !aliases[parent] || // Check other props 12661 !checkOptionalProps( 12662 icon, 12663 defaultExtendedIconProps 12664 ) 12665 ) { 12666 return null; 12667 } 12668 } 12669 return data; 12670} 12671 12672const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/; 12673const stringToIcon = (value, validate, allowSimpleName, provider = "") => { 12674 const colonSeparated = value.split(":"); 12675 if (value.slice(0, 1) === "@") { 12676 if (colonSeparated.length < 2 || colonSeparated.length > 3) { 12677 return null; 12678 } 12679 provider = colonSeparated.shift().slice(1); 12680 } 12681 if (colonSeparated.length > 3 || !colonSeparated.length) { 12682 return null; 12683 } 12684 if (colonSeparated.length > 1) { 12685 const name2 = colonSeparated.pop(); 12686 const prefix = colonSeparated.pop(); 12687 const result = { 12688 // Allow provider without '@': "provider:prefix:name" 12689 provider: colonSeparated.length > 0 ? colonSeparated[0] : provider, 12690 prefix, 12691 name: name2 12692 }; 12693 return validate && !validateIconName(result) ? null : result; 12694 } 12695 const name = colonSeparated[0]; 12696 const dashSeparated = name.split("-"); 12697 if (dashSeparated.length > 1) { 12698 const result = { 12699 provider, 12700 prefix: dashSeparated.shift(), 12701 name: dashSeparated.join("-") 12702 }; 12703 return validate && !validateIconName(result) ? null : result; 12704 } 12705 if (allowSimpleName && provider === "") { 12706 const result = { 12707 provider, 12708 prefix: "", 12709 name 12710 }; 12711 return validate && !validateIconName(result, allowSimpleName) ? null : result; 12712 } 12713 return null; 12714}; 12715const validateIconName = (icon, allowSimpleName) => { 12716 if (!icon) { 12717 return false; 12718 } 12719 return !!// Check prefix: cannot be empty, unless allowSimpleName is enabled 12720 // Check name: cannot be empty 12721 ((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name); 12722}; 12723 12724const dataStorage = /* @__PURE__ */ Object.create(null); 12725function newStorage(provider, prefix) { 12726 return { 12727 provider, 12728 prefix, 12729 icons: /* @__PURE__ */ Object.create(null), 12730 missing: /* @__PURE__ */ new Set() 12731 }; 12732} 12733function getStorage(provider, prefix) { 12734 const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null)); 12735 return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix)); 12736} 12737function addIconSet(storage, data) { 12738 if (!quicklyValidateIconSet(data)) { 12739 return []; 12740 } 12741 return parseIconSet(data, (name, icon) => { 12742 if (icon) { 12743 storage.icons[name] = icon; 12744 } else { 12745 storage.missing.add(name); 12746 } 12747 }); 12748} 12749function addIconToStorage(storage, name, icon) { 12750 try { 12751 if (typeof icon.body === "string") { 12752 storage.icons[name] = { ...icon }; 12753 return true; 12754 } 12755 } catch (err) { 12756 } 12757 return false; 12758} 12759 12760let simpleNames = false; 12761function allowSimpleNames(allow) { 12762 if (typeof allow === "boolean") { 12763 simpleNames = allow; 12764 } 12765 return simpleNames; 12766} 12767function getIconData(name) { 12768 const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name; 12769 if (icon) { 12770 const storage = getStorage(icon.provider, icon.prefix); 12771 const iconName = icon.name; 12772 return storage.icons[iconName] || (storage.missing.has(iconName) ? null : void 0); 12773 } 12774} 12775function addIcon(name, data) { 12776 const icon = stringToIcon(name, true, simpleNames); 12777 if (!icon) { 12778 return false;
12779 } 12780 const storage = getStorage(icon.provider, icon.prefix); 12781 if (data) { 12782 return addIconToStorage(storage, icon.name, data); 12783 } else { 12784 storage.missing.add(icon.name); 12785 return true; 12786 } 12787} 12788function addCollection(data, provider) { 12789 if (typeof data !== "object") { 12790 return false; 12791 } 12792 if (typeof provider !== "string") { 12793 provider = data.provider || ""; 12794 } 12795 if (simpleNames && !provider && !data.prefix) { 12796 let added = false; 12797 if (quicklyValidateIconSet(data)) { 12798 data.prefix = ""; 12799 parseIconSet(data, (name, icon) => { 12800 if (addIcon(name, icon)) { 12801 added = true; 12802 } 12803 }); 12804 } 12805 return added; 12806 } 12807 const prefix = data.prefix; 12808 if (!validateIconName({ 12809 prefix, 12810 name: "a" 12811 })) { 12812 return false; 12813 } 12814 const storage = getStorage(provider, prefix); 12815 return !!addIconSet(storage, data); 12816} 12817 12818const defaultIconSizeCustomisations = Object.freeze({ 12819 width: null, 12820 height: null 12821}); 12822const defaultIconCustomisations = Object.freeze({ 12823 // Dimensions 12824 ...defaultIconSizeCustomisations, 12825 // Transformations 12826 ...defaultIconTransformations 12827}); 12828 12829const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g; 12830const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g; 12831function calculateSize(size, ratio, precision) { 12832 if (ratio === 1) { 12833 return size; 12834 } 12835 precision = precision || 100; 12836 if (typeof size === "number") { 12837 return Math.ceil(size * ratio * precision) / precision; 12838 } 12839 if (typeof size !== "string") { 12840 return size; 12841 } 12842 const oldParts = size.split(unitsSplit); 12843 if (oldParts === null || !oldParts.length) { 12844 return size; 12845 } 12846 const newParts = []; 12847 let code = oldParts.shift(); 12848 let isNumber = unitsTest.test(code); 12849 while (true) { 12850 if (isNumber) { 12851 const num = parseFloat(code); 12852 if (isNaN(num)) { 12853 newParts.push(code); 12854 } else { 12855 newParts.push(Math.ceil(num * ratio * precision) / precision); 12856 } 12857 } else { 12858 newParts.push(code); 12859 } 12860 code = oldParts.shift(); 12861 if (code === void 0) { 12862 return newParts.join(""); 12863 } 12864 isNumber = !isNumber; 12865 } 12866} 12867 12868function splitSVGDefs(content, tag = "defs") { 12869 let defs = ""; 12870 const index = content.indexOf("<" + tag); 12871 while (index >= 0) { 12872 const start = content.indexOf(">", index); 12873 const end = content.indexOf("</" + tag); 12874 if (start === -1 || end === -1) { 12875 break; 12876 } 12877 const endEnd = content.indexOf(">", end); 12878 if (endEnd === -1) { 12879 break; 12880 } 12881 defs += content.slice(start + 1, end).trim(); 12882 content = content.slice(0, index).trim() + content.slice(endEnd + 1); 12883 } 12884 return { 12885 defs, 12886 content 12887 }; 12888} 12889function mergeDefsAndContent(defs, content) { 12890 return defs ? "<defs>" + defs + "</defs>" + content : content; 12891} 12892function wrapSVGContent(body, start, end) { 12893 const split = splitSVGDefs(body); 12894 return mergeDefsAndContent(split.defs, start + split.content + end); 12895} 12896 12897const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none"; 12898function iconToSVG(icon, customisations) { 12899 const fullIcon = { 12900 ...defaultIconProps, 12901 ...icon 12902 }; 12903 const fullCustomisations = { 12904 ...defaultIconCustomisations, 12905 ...customisations 12906 }; 12907 const box = { 12908 left: fullIcon.left, 12909 top: fullIcon.top, 12910 width: fullIcon.width, 12911 height: fullIcon.height 12912 }; 12913 let body = fullIcon.body; 12914 [fullIcon, fullCustomisations].forEach((props) => { 12915 const transformations = []; 12916 const hFlip = props.hFlip; 12917 const vFlip = props.vFlip; 12918 let rotation = props.rotate; 12919 if (hFlip) { 12920 if (vFlip) { 12921 rotation += 2; 12922 } else { 12923 transformations.push( 12924 "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")" 12925 ); 12926 transformations.push("scale(-1 1)"); 12927 box.top = box.left = 0; 12928 } 12929 } else if (vFlip) { 12930 transformations.push( 12931 "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")" 12932 ); 12933 transformations.push("scale(1 -1)"); 12934 box.top = box.left = 0; 12935 } 12936 let tempValue; 12937 if (rotation < 0) { 12938 rotation -= Math.floor(rotation / 4) * 4; 12939 } 12940 rotation = rotation % 4; 12941 switch (rotation) { 12942 case 1: 12943 tempValue = box.height / 2 + box.top; 12944 transformations.unshift( 12945 "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")" 12946 ); 12947 break; 12948 case 2: 12949 transformations.unshift( 12950 "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")" 12951 ); 12952 break; 12953 case 3: 12954 tempValue = box.width / 2 + box.left; 12955 transformations.unshift( 12956 "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")" 12957 ); 12958 break; 12959 } 12960 if (rotation % 2 === 1) { 12961 if (box.left !== box.top) { 12962 tempValue = box.left; 12963 box.left = box.top; 12964 box.top = tempValue; 12965 } 12966 if (box.width !== box.height) { 12967 tempValue = box.width; 12968 box.width = box.height; 12969 box.height = tempValue; 12970 } 12971 } 12972 if (transformations.length) { 12973 body = wrapSVGContent( 12974 body, 12975 '<g transform="' + transformations.join(" ") + '">', 12976 "</g>" 12977 ); 12978 } 12979 }); 12980 const customisationsWidth = fullCustomisations.width; 12981 const customisationsHeight = fullCustomisations.height; 12982 const boxWidth = box.width; 12983 const boxHeight = box.height; 12984 let width; 12985 let height; 12986 if (customisationsWidth === null) { 12987 height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight; 12988 width = calculateSize(height, boxWidth / boxHeight); 12989 } else { 12990 width = customisationsWidth === "auto" ? boxWidth : customisationsWidth; 12991 height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight; 12992 } 12993 const attributes = {}; 12994 const setAttr = (prop, value) => { 12995 if (!isUnsetKeyword(value)) { 12996 attributes[prop] = value.toString(); 12997 } 12998 }; 12999 setAttr("width", width); 13000 setAttr("height", height);
vendor: 9,356 bytes, lines 13001-13363
13001 const viewBox = [box.left, box.top, boxWidth, boxHeight]; 13002 attributes.viewBox = viewBox.join(" "); 13003 return { 13004 attributes, 13005 viewBox, 13006 body 13007 }; 13008} 13009 13010const regex = /\sid="(\S+)"/g; 13011const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16); 13012let counter = 0; 13013function replaceIDs(body, prefix = randomPrefix) { 13014 const ids = []; 13015 let match; 13016 while (match = regex.exec(body)) { 13017 ids.push(match[1]); 13018 } 13019 if (!ids.length) { 13020 return body; 13021 } 13022 const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16); 13023 ids.forEach((id) => { 13024 const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString(); 13025 const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); 13026 body = body.replace( 13027 // Allowed characters before id: [#;"] 13028 // Allowed characters after id: [)"], .[a-z] 13029 new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), 13030 "$1" + newID + suffix + "$3" 13031 ); 13032 }); 13033 body = body.replace(new RegExp(suffix, "g"), ""); 13034 return body; 13035} 13036 13037const storage = /* @__PURE__ */ Object.create(null); 13038function setAPIModule(provider, item) { 13039 storage[provider] = item; 13040} 13041function getAPIModule(provider) { 13042 return storage[provider] || storage[""]; 13043} 13044 13045function createAPIConfig(source) { 13046 let resources; 13047 if (typeof source.resources === "string") { 13048 resources = [source.resources]; 13049 } else { 13050 resources = source.resources; 13051 if (!(resources instanceof Array) || !resources.length) { 13052 return null; 13053 } 13054 } 13055 const result = { 13056 // API hosts 13057 resources, 13058 // Root path 13059 path: source.path || "/", 13060 // URL length limit 13061 maxURL: source.maxURL || 500, 13062 // Timeout before next host is used. 13063 rotate: source.rotate || 750, 13064 // Timeout before failing query. 13065 timeout: source.timeout || 5e3, 13066 // Randomise default API end point. 13067 random: source.random === true, 13068 // Start index 13069 index: source.index || 0, 13070 // Receive data after time out (used if time out kicks in first, then API module sends data anyway). 13071 dataAfterTimeout: source.dataAfterTimeout !== false 13072 }; 13073 return result; 13074} 13075const configStorage = /* @__PURE__ */ Object.create(null); 13076const fallBackAPISources = [ 13077 "https://api.simplesvg.com", 13078 "https://api.unisvg.com" 13079]; 13080const fallBackAPI = []; 13081while (fallBackAPISources.length > 0) { 13082 if (fallBackAPISources.length === 1) { 13083 fallBackAPI.push(fallBackAPISources.shift()); 13084 } else { 13085 if (Math.random() > 0.5) { 13086 fallBackAPI.push(fallBackAPISources.shift()); 13087 } else { 13088 fallBackAPI.push(fallBackAPISources.pop()); 13089 } 13090 } 13091} 13092configStorage[""] = createAPIConfig({ 13093 resources: ["https://api.iconify.design"].concat(fallBackAPI) 13094}); 13095function addAPIProvider(provider, customConfig) { 13096 const config = createAPIConfig(customConfig); 13097 if (config === null) { 13098 return false; 13099 } 13100 configStorage[provider] = config; 13101 return true; 13102} 13103function getAPIConfig(provider) { 13104 return configStorage[provider]; 13105} 13106 13107const detectFetch = () => { 13108 let callback; 13109 try { 13110 callback = fetch; 13111 if (typeof callback === "function") { 13112 return callback; 13113 } 13114 } catch (err) { 13115 } 13116}; 13117let fetchModule = detectFetch(); 13118function calculateMaxLength(provider, prefix) { 13119 const config = getAPIConfig(provider); 13120 if (!config) { 13121 return 0; 13122 } 13123 let result; 13124 if (!config.maxURL) { 13125 result = 0; 13126 } else { 13127 let maxHostLength = 0; 13128 config.resources.forEach((item) => { 13129 const host = item; 13130 maxHostLength = Math.max(maxHostLength, host.length); 13131 }); 13132 const url = prefix + ".json?icons="; 13133 result = config.maxURL - maxHostLength - config.path.length - url.length; 13134 } 13135 return result; 13136} 13137function shouldAbort(status) { 13138 return status === 404; 13139} 13140const prepare = (provider, prefix, icons) => { 13141 const results = []; 13142 const maxLength = calculateMaxLength(provider, prefix); 13143 const type = "icons"; 13144 let item = { 13145 type, 13146 provider, 13147 prefix, 13148 icons: [] 13149 }; 13150 let length = 0; 13151 icons.forEach((name, index) => { 13152 length += name.length + 1; 13153 if (length >= maxLength && index > 0) { 13154 results.push(item); 13155 item = { 13156 type, 13157 provider, 13158 prefix, 13159 icons: [] 13160 }; 13161 length = name.length; 13162 } 13163 item.icons.push(name); 13164 }); 13165 results.push(item); 13166 return results; 13167}; 13168function getPath(provider) { 13169 if (typeof provider === "string") { 13170 const config = getAPIConfig(provider); 13171 if (config) { 13172 return config.path; 13173 } 13174 } 13175 return "/"; 13176} 13177const send = (host, params, callback) => { 13178 if (!fetchModule) { 13179 callback("abort", 424); 13180 return; 13181 } 13182 let path = getPath(params.provider); 13183 switch (params.type) { 13184 case "icons": { 13185 const prefix = params.prefix; 13186 const icons = params.icons; 13187 const iconsList = icons.join(","); 13188 const urlParams = new URLSearchParams({ 13189 icons: iconsList 13190 }); 13191 path += prefix + ".json?" + urlParams.toString(); 13192 break; 13193 } 13194 case "custom": { 13195 const uri = params.uri; 13196 path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri; 13197 break; 13198 } 13199 default: 13200 callback("abort", 400); 13201 return; 13202 } 13203 let defaultError = 503; 13204 fetchModule(host + path).then((response) => { 13205 const status = response.status; 13206 if (status !== 200) { 13207 setTimeout(() => { 13208 callback(shouldAbort(status) ? "abort" : "next", status); 13209 }); 13210 return; 13211 } 13212 defaultError = 501; 13213 return response.json(); 13214 }).then((data) => { 13215 if (typeof data !== "object" || data === null) { 13216 setTimeout(() => { 13217 if (data === 404) { 13218 callback("abort", data); 13219 } else { 13220 callback("next", defaultError); 13221 } 13222 }); 13223 return; 13224 } 13225 setTimeout(() => { 13226 callback("success", data); 13227 }); 13228 }).catch(() => { 13229 callback("next", defaultError); 13230 }); 13231}; 13232const fetchAPIModule = { 13233 prepare, 13234 send 13235}; 13236 13237function sortIcons(icons) { 13238 const result = { 13239 loaded: [], 13240 missing: [], 13241 pending: [] 13242 }; 13243 const storage = /* @__PURE__ */ Object.create(null); 13244 icons.sort((a, b) => { 13245 if (a.provider !== b.provider) { 13246 return a.provider.localeCompare(b.provider); 13247 } 13248 if (a.prefix !== b.prefix) { 13249 return a.prefix.localeCompare(b.prefix); 13250 } 13251 return a.name.localeCompare(b.name); 13252 }); 13253 let lastIcon = { 13254 provider: "", 13255 prefix: "", 13256 name: "" 13257 }; 13258 icons.forEach((icon) => { 13259 if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) { 13260 return; 13261 } 13262 lastIcon = icon; 13263 const provider = icon.provider; 13264 const prefix = icon.prefix; 13265 const name = icon.name; 13266 const providerStorage = storage[provider] || (storage[provider] = /* @__PURE__ */ Object.create(null)); 13267 const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix)); 13268 let list; 13269 if (name in localStorage.icons) { 13270 list = result.loaded; 13271 } else if (prefix === "" || localStorage.missing.has(name)) { 13272 list = result.missing; 13273 } else { 13274 list = result.pending; 13275 } 13276 const item = { 13277 provider, 13278 prefix, 13279 name 13280 }; 13281 list.push(item); 13282 }); 13283 return result; 13284} 13285 13286function removeCallback(storages, id) { 13287 storages.forEach((storage) => { 13288 const items = storage.loaderCallbacks; 13289 if (items) { 13290 storage.loaderCallbacks = items.filter((row) => row.id !== id); 13291 } 13292 }); 13293} 13294function updateCallbacks(storage) { 13295 if (!storage.pendingCallbacksFlag) { 13296 storage.pendingCallbacksFlag = true; 13297 setTimeout(() => { 13298 storage.pendingCallbacksFlag = false; 13299 const items = storage.loaderCallbacks ? storage.loaderCallbacks.slice(0) : []; 13300 if (!items.length) { 13301 return; 13302 } 13303 let hasPending = false; 13304 const provider = storage.provider; 13305 const prefix = storage.prefix; 13306 items.forEach((item) => { 13307 const icons = item.icons; 13308 const oldLength = icons.pending.length; 13309 icons.pending = icons.pending.filter((icon) => { 13310 if (icon.prefix !== prefix) { 13311 return true; 13312 } 13313 const name = icon.name; 13314 if (storage.icons[name]) { 13315 icons.loaded.push({ 13316 provider, 13317 prefix, 13318 name 13319 }); 13320 } else if (storage.missing.has(name)) { 13321 icons.missing.push({ 13322 provider, 13323 prefix, 13324 name 13325 }); 13326 } else { 13327 hasPending = true; 13328 return true; 13329 } 13330 return false; 13331 }); 13332 if (icons.pending.length !== oldLength) { 13333 if (!hasPending) { 13334 removeCallback([storage], item.id); 13335 } 13336 item.callback( 13337 icons.loaded.slice(0), 13338 icons.missing.slice(0), 13339 icons.pending.slice(0), 13340 item.abort 13341 ); 13342 } 13343 }); 13344 }); 13345 } 13346} 13347let idCounter$1 = 0; 13348function storeCallback(callback, icons, pendingSources) { 13349 const id = idCounter$1++; 13350 const abort = removeCallback.bind(null, pendingSources, id); 13351 if (!icons.pending.length) { 13352 return abort; 13353 } 13354 const item = { 13355 id, 13356 icons, 13357 callback, 13358 abort 13359 }; 13360 pendingSources.forEach((storage) => { 13361 (storage.loaderCallbacks || (storage.loaderCallbacks = [])).push(item); 13362 }); 13363 return abort
vendor: 4,126 bytes, lines 13363-13543
13363; 13364} 13365 13366function listToIcons(list, validate = true, simpleNames = false) { 13367 const result = []; 13368 list.forEach((item) => { 13369 const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames) : item; 13370 if (icon) { 13371 result.push(icon); 13372 } 13373 }); 13374 return result; 13375} 13376 13377// src/config.ts 13378var defaultConfig = { 13379 resources: [], 13380 index: 0, 13381 timeout: 2e3, 13382 rotate: 750, 13383 random: false, 13384 dataAfterTimeout: false 13385}; 13386 13387// src/query.ts 13388function sendQuery(config, payload, query, done) { 13389 const resourcesCount = config.resources.length; 13390 const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index; 13391 let resources; 13392 if (config.random) { 13393 let list = config.resources.slice(0); 13394 resources = []; 13395 while (list.length > 1) { 13396 const nextIndex = Math.floor(Math.random() * list.length); 13397 resources.push(list[nextIndex]); 13398 list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1)); 13399 } 13400 resources = resources.concat(list); 13401 } else { 13402 resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex)); 13403 } 13404 const startTime = Date.now(); 13405 let status = "pending"; 13406 let queriesSent = 0; 13407 let lastError; 13408 let timer = null; 13409 let queue = []; 13410 let doneCallbacks = []; 13411 if (typeof done === "function") { 13412 doneCallbacks.push(done); 13413 } 13414 function resetTimer() { 13415 if (timer) { 13416 clearTimeout(timer); 13417 timer = null; 13418 } 13419 } 13420 function abort() { 13421 if (status === "pending") { 13422 status = "aborted"; 13423 } 13424 resetTimer(); 13425 queue.forEach((item) => { 13426 if (item.status === "pending") { 13427 item.status = "aborted"; 13428 } 13429 }); 13430 queue = []; 13431 } 13432 function subscribe(callback, overwrite) { 13433 if (overwrite) { 13434 doneCallbacks = []; 13435 } 13436 if (typeof callback === "function") { 13437 doneCallbacks.push(callback); 13438 } 13439 } 13440 function getQueryStatus() { 13441 return { 13442 startTime, 13443 payload, 13444 status, 13445 queriesSent, 13446 queriesPending: queue.length, 13447 subscribe, 13448 abort 13449 }; 13450 } 13451 function failQuery() { 13452 status = "failed"; 13453 doneCallbacks.forEach((callback) => { 13454 callback(void 0, lastError); 13455 }); 13456 } 13457 function clearQueue() { 13458 queue.forEach((item) => { 13459 if (item.status === "pending") { 13460 item.status = "aborted"; 13461 } 13462 }); 13463 queue = []; 13464 } 13465 function moduleResponse(item, response, data) { 13466 const isError = response !== "success"; 13467 queue = queue.filter((queued) => queued !== item); 13468 switch (status) { 13469 case "pending": 13470 break; 13471 case "failed": 13472 if (isError || !config.dataAfterTimeout) { 13473 return; 13474 } 13475 break; 13476 default: 13477 return; 13478 } 13479 if (response === "abort") { 13480 lastError = data; 13481 failQuery(); 13482 return; 13483 } 13484 if (isError) { 13485 lastError = data; 13486 if (!queue.length) { 13487 if (!resources.length) { 13488 failQuery(); 13489 } else { 13490 execNext(); 13491 } 13492 } 13493 return; 13494 } 13495 resetTimer(); 13496 clearQueue(); 13497 if (!config.random) { 13498 const index = config.resources.indexOf(item.resource); 13499 if (index !== -1 && index !== config.index) { 13500 config.index = index; 13501 } 13502 } 13503 status = "completed"; 13504 doneCallbacks.forEach((callback) => { 13505 callback(data); 13506 }); 13507 } 13508 function execNext() { 13509 if (status !== "pending") { 13510 return; 13511 } 13512 resetTimer(); 13513 const resource = resources.shift(); 13514 if (resource === void 0) { 13515 if (queue.length) { 13516 timer = setTimeout(() => { 13517 resetTimer(); 13518 if (status === "pending") { 13519 clearQueue(); 13520 failQuery(); 13521 } 13522 }, config.timeout); 13523 return; 13524 } 13525 failQuery(); 13526 return; 13527 } 13528 const item = { 13529 status: "pending", 13530 resource, 13531 callback: (status2, data) => { 13532 moduleResponse(item, status2, data); 13533 } 13534 }; 13535 queue.push(item); 13536 queriesSent++; 13537 timer = setTimeout(execNext, config.rotate); 13538 query(resource, payload, item.callback); 13539 } 13540 setTimeout(execNext); 13541 return getQueryStatus; 13542} 13543
vendor: 2,099 bytes, lines 13544-13636
13544// src/index.ts 13545function initRedundancy(cfg) { 13546 const config = { 13547 ...defaultConfig, 13548 ...cfg 13549 }; 13550 let queries = []; 13551 function cleanup() { 13552 queries = queries.filter((item) => item().status === "pending"); 13553 } 13554 function query(payload, queryCallback, doneCallback) { 13555 const query2 = sendQuery( 13556 config, 13557 payload, 13558 queryCallback, 13559 (data, error) => { 13560 cleanup(); 13561 if (doneCallback) { 13562 doneCallback(data, error); 13563 } 13564 } 13565 ); 13566 queries.push(query2); 13567 return query2; 13568 } 13569 function find(callback) { 13570 return queries.find((value) => { 13571 return callback(value); 13572 }) || null; 13573 } 13574 const instance = { 13575 query, 13576 find, 13577 setIndex: (index) => { 13578 config.index = index; 13579 }, 13580 getIndex: () => config.index, 13581 cleanup 13582 }; 13583 return instance; 13584} 13585 13586function emptyCallback$1() { 13587} 13588const redundancyCache = /* @__PURE__ */ Object.create(null); 13589function getRedundancyCache(provider) { 13590 if (!redundancyCache[provider]) { 13591 const config = getAPIConfig(provider); 13592 if (!config) { 13593 return; 13594 } 13595 const redundancy = initRedundancy(config); 13596 const cachedReundancy = { 13597 config, 13598 redundancy 13599 }; 13600 redundancyCache[provider] = cachedReundancy; 13601 } 13602 return redundancyCache[provider]; 13603} 13604function sendAPIQuery(target, query, callback) { 13605 let redundancy; 13606 let send; 13607 if (typeof target === "string") { 13608 const api = getAPIModule(target); 13609 if (!api) { 13610 callback(void 0, 424); 13611 return emptyCallback$1; 13612 } 13613 send = api.send; 13614 const cached = getRedundancyCache(target); 13615 if (cached) { 13616 redundancy = cached.redundancy; 13617 } 13618 } else { 13619 const config = createAPIConfig(target); 13620 if (config) { 13621 redundancy = initRedundancy(config); 13622 const moduleKey = target.resources ? target.resources[0] : ""; 13623 const api = getAPIModule(moduleKey); 13624 if (api) { 13625 send = api.send; 13626 } 13627 } 13628 } 13629 if (!redundancy || !send) { 13630 callback(void 0, 424); 13631 return emptyCallback$1; 13632 } 13633 return redundancy.query(query, send, callback)().abort; 13634} 13635 13636function
13636emptyCallback() { 13637} 13638function loadedNewIcons(storage) { 13639 if (!storage.iconsLoaderFlag) { 13640 storage.iconsLoaderFlag = true; 13641 setTimeout(() => { 13642 storage.iconsLoaderFlag = false; 13643 updateCallbacks(storage); 13644 }); 13645 } 13646} 13647function checkIconNamesForAPI(icons) { 13648 const valid = []; 13649 const invalid = []; 13650 icons.forEach((name) => { 13651 (name.match(matchIconName) ? valid : invalid).push(name); 13652 }); 13653 return { 13654 valid, 13655 invalid 13656 }; 13657} 13658function parseLoaderResponse(storage, icons, data) { 13659 function checkMissing() { 13660 const pending = storage.pendingIcons; 13661 icons.forEach((name) => { 13662 if (pending) { 13663 pending.delete(name); 13664 } 13665 if (!storage.icons[name]) { 13666 storage.missing.add(name); 13667 } 13668 }); 13669 } 13670 if (data && typeof data === "object") { 13671 try { 13672 const parsed = addIconSet(storage, data); 13673 if (!parsed.length) { 13674 checkMissing(); 13675 return; 13676 } 13677 } catch (err) { 13678 console.error(err); 13679 } 13680 } 13681 checkMissing(); 13682 loadedNewIcons(storage); 13683} 13684function parsePossiblyAsyncResponse(response, callback) { 13685 if (response instanceof Promise) { 13686 response.then((data) => { 13687 callback(data); 13688 }).catch(() => { 13689 callback(null); 13690 }); 13691 } else { 13692 callback(response); 13693 } 13694} 13695function loadNewIcons(storage, icons) { 13696 if (!storage.iconsToLoad) { 13697 storage.iconsToLoad = icons; 13698 } else { 13699 storage.iconsToLoad = storage.iconsToLoad.concat(icons).sort(); 13700 } 13701 if (!storage.iconsQueueFlag) { 13702 storage.iconsQueueFlag = true; 13703 setTimeout(() => { 13704 storage.iconsQueueFlag = false; 13705 const { provider, prefix } = storage; 13706 const icons2 = storage.iconsToLoad; 13707 delete storage.iconsToLoad; 13708 if (!icons2 || !icons2.length) { 13709 return; 13710 } 13711 const customIconLoader = storage.loadIcon; 13712 if (storage.loadIcons && (icons2.length > 1 || !customIconLoader)) { 13713 parsePossiblyAsyncResponse( 13714 storage.loadIcons(icons2, prefix, provider), 13715 (data) => { 13716 parseLoaderResponse(storage, icons2, data); 13717 } 13718 ); 13719 return; 13720 } 13721 if (customIconLoader) { 13722 icons2.forEach((name) => { 13723 const response = customIconLoader(name, prefix, provider); 13724 parsePossiblyAsyncResponse(response, (data) => { 13725 const iconSet = data ? { 13726 prefix, 13727 icons: { 13728 [name]: data 13729 } 13730 } : null; 13731 parseLoaderResponse(storage, [name], iconSet); 13732 }); 13733 }); 13734 return; 13735 } 13736 const { valid, invalid } = checkIconNamesForAPI(icons2); 13737 if (invalid.length) { 13738 parseLoaderResponse(storage, invalid, null); 13739 } 13740 if (!valid.length) { 13741 return; 13742 } 13743 const api = prefix.match(matchIconName) ? getAPIModule(provider) : null; 13744 if (!api) { 13745 parseLoaderResponse(storage, valid, null); 13746 return; 13747 } 13748 const params = api.prepare(provider, prefix, valid); 13749 params.forEach((item) => { 13750 sendAPIQuery(provider, item, (data) => { 13751 parseLoaderResponse(storage, item.icons, data); 13752 }); 13753 }); 13754 }); 13755 } 13756} 13757const loadIcons = (icons, callback) => { 13758 const cleanedIcons = listToIcons(icons, true, allowSimpleNames()); 13759 const sortedIcons = sortIcons(cleanedIcons); 13760 if (!sortedIcons.pending.length) {
vendor: 3,204 bytes, lines 13761-13878
13761 let callCallback = true; 13762 if (callback) { 13763 setTimeout(() => { 13764 if (callCallback) { 13765 callback( 13766 sortedIcons.loaded, 13767 sortedIcons.missing, 13768 sortedIcons.pending, 13769 emptyCallback 13770 ); 13771 } 13772 }); 13773 } 13774 return () => { 13775 callCallback = false; 13776 }; 13777 } 13778 const newIcons = /* @__PURE__ */ Object.create(null); 13779 const sources = []; 13780 let lastProvider, lastPrefix; 13781 sortedIcons.pending.forEach((icon) => { 13782 const { provider, prefix } = icon; 13783 if (prefix === lastPrefix && provider === lastProvider) { 13784 return; 13785 } 13786 lastProvider = provider; 13787 lastPrefix = prefix; 13788 sources.push(getStorage(provider, prefix)); 13789 const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null)); 13790 if (!providerNewIcons[prefix]) { 13791 providerNewIcons[prefix] = []; 13792 } 13793 }); 13794 sortedIcons.pending.forEach((icon) => { 13795 const { provider, prefix, name } = icon; 13796 const storage = getStorage(provider, prefix); 13797 const pendingQueue = storage.pendingIcons || (storage.pendingIcons = /* @__PURE__ */ new Set()); 13798 if (!pendingQueue.has(name)) { 13799 pendingQueue.add(name); 13800 newIcons[provider][prefix].push(name); 13801 } 13802 }); 13803 sources.forEach((storage) => { 13804 const list = newIcons[storage.provider][storage.prefix]; 13805 if (list.length) { 13806 loadNewIcons(storage, list); 13807 } 13808 }); 13809 return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback; 13810}; 13811 13812function mergeCustomisations(defaults, item) { 13813 const result = { 13814 ...defaults 13815 }; 13816 for (const key in item) { 13817 const value = item[key]; 13818 const valueType = typeof value; 13819 if (key in defaultIconSizeCustomisations) { 13820 if (value === null || value && (valueType === "string" || valueType === "number")) { 13821 result[key] = value; 13822 } 13823 } else if (valueType === typeof result[key]) { 13824 result[key] = key === "rotate" ? value % 4 : value; 13825 } 13826 } 13827 return result; 13828} 13829 13830const separator = /[\s,]+/; 13831function flipFromString(custom, flip) { 13832 flip.split(separator).forEach((str) => { 13833 const value = str.trim(); 13834 switch (value) { 13835 case "horizontal": 13836 custom.hFlip = true; 13837 break; 13838 case "vertical": 13839 custom.vFlip = true; 13840 break; 13841 } 13842 }); 13843} 13844 13845function rotateFromString(value, defaultValue = 0) { 13846 const units = value.replace(/^-?[0-9.]*/, ""); 13847 function cleanup(value2) { 13848 while (value2 < 0) { 13849 value2 += 4; 13850 } 13851 return value2 % 4; 13852 } 13853 if (units === "") { 13854 const num = parseInt(value); 13855 return isNaN(num) ? 0 : cleanup(num); 13856 } else if (units !== value) { 13857 let split = 0; 13858 switch (units) { 13859 case "%": 13860 split = 25; 13861 break; 13862 case "deg": 13863 split = 90; 13864 } 13865 if (split) { 13866 let num = parseFloat(value.slice(0, value.length - units.length)); 13867 if (isNaN(num)) { 13868 return 0; 13869 } 13870 num = num / split; 13871 return num % 1 === 0 ? cleanup(num) : 0; 13872 } 13873 } 13874 return defaultValue; 13875} 13876 13877function iconToHTML(body, attributes) { 13878 let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
13879 for (const attr in attributes) { 13880 renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"'; 13881 } 13882 return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>"; 13883} 13884 13885function encodeSVGforURL(svg) { 13886 return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " "); 13887} 13888function svgToData(svg) { 13889 return "data:image/svg+xml," + encodeSVGforURL(svg); 13890} 13891function svgToURL(svg) { 13892 return 'url("' + svgToData(svg) + '")'; 13893} 13894 13895let policy; 13896function createPolicy() { 13897 try { 13898 policy = window.trustedTypes.createPolicy("iconify", { 13899 // eslint-disable-next-line @typescript-eslint/no-unsafe-return 13900 createHTML: (s) => s 13901 }); 13902 } catch (err) { 13903 policy = null; 13904 } 13905} 13906function cleanUpInnerHTML(html) { 13907 if (policy === void 0) { 13908 createPolicy(); 13909 } 13910 return policy ? policy.createHTML(html) : html; 13911} 13912 13913const defaultExtendedIconCustomisations = { 13914 ...defaultIconCustomisations, 13915 inline: false, 13916}; 13917 13918/** 13919 * Default SVG attributes 13920 */ 13921const svgDefaults = { 13922 'xmlns': 'http://www.w3.org/2000/svg', 13923 'xmlnsXlink': 'http://www.w3.org/1999/xlink', 13924 'aria-hidden': true, 13925 'role': 'img', 13926}; 13927/** 13928 * Style modes 13929 */ 13930const commonProps = { 13931 display: 'inline-block', 13932}; 13933const monotoneProps = { 13934 backgroundColor: 'currentColor', 13935}; 13936const coloredProps = { 13937 backgroundColor: 'transparent', 13938}; 13939// Dynamically add common props to variables above 13940const propsToAdd = { 13941 Image: 'var(--svg)', 13942 Repeat: 'no-repeat', 13943 Size: '100% 100%', 13944}; 13945const propsToAddTo = { 13946 WebkitMask: monotoneProps, 13947 mask: monotoneProps, 13948 background: coloredProps, 13949}; 13950for (const prefix in propsToAddTo) { 13951 const list = propsToAddTo[prefix]; 13952 for (const prop in propsToAdd) { 13953 list[prefix + prop] = propsToAdd[prop]; 13954 } 13955} 13956/** 13957 * Default values for customisations for inline icon 13958 */ 13959const inlineDefaults = { 13960 ...defaultExtendedIconCustomisations, 13961 inline: true, 13962}; 13963/** 13964 * Fix size: add 'px' to numbers 13965 */ 13966function fixSize(value) { 13967 return value + (value.match(/^[-0-9.]+$/) ? 'px' : ''); 13968} 13969/** 13970 * Render icon 13971 */ 13972const render = ( 13973// Icon must be validated before calling this function 13974icon, 13975// Partial properties 13976props, 13977// Icon name 13978name) => { 13979 // Get default properties 13980 const defaultProps = props.inline 13981 ? inlineDefaults 13982 : defaultExtendedIconCustomisations; 13983 // Get all customisations 13984 const customisations = mergeCustomisations(defaultProps, props); 13985 // Check mode 13986 const mode = props.mode || 'svg'; 13987 // Create style 13988 const style = {}; 13989 const customStyle = props.style || {}; 13990 // Create SVG component properties 13991 const componentProps = { 13992 ...(mode === 'svg' ? svgDefaults : {}), 13993 }; 13994 if (name) { 13995 const iconName = stringToIcon(name, false, true); 13996 if (iconName) { 13997 const classNames = ['iconify']; 13998 const props = [ 13999 'provider', 14000 'prefix', 14001 ]; 14002 for (const prop of props) { 14003 if (iconName[prop]) { 14004 classNames.push('iconify--' + iconName[prop]); 14005 } 14006 } 14007 componentProps.className = classNames.join(' '); 14008 } 14009 } 14010 // Get element properties 14011 for (let key in props) { 14012 const value = props[key]; 14013 if (value === void 0) { 14014 continue; 14015 } 14016 switch (key) { 14017 // Properties to ignore 14018 case 'icon': 14019 case 'style': 14020 case 'children': 14021 case 'onLoad': 14022 case 'mode': 14023 case 'ssr': 14024 break; 14025 // Forward ref 14026 case '_ref': 14027 componentProps.ref = value; 14028 break; 14029 // Merge class names 14030 case 'className': 14031 componentProps[key] = 14032 (componentProps[key] ? componentProps[key] + ' ' : '') + 14033 value; 14034 break; 14035 // Boolean attributes 14036 case 'inline': 14037 case 'hFlip': 14038 case 'vFlip': 14039 customisations[key] = 14040 value === true || value === 'true' || value === 1; 14041 break; 14042 // Flip as string: 'horizontal,vertical' 14043 case 'flip': 14044 if (typeof value === 'string') { 14045 flipFromString(customisations, value); 14046 } 14047 break; 14048 // Color: copy to style 14049 case 'color': 14050 style.color = value; 14051 break; 14052 // Rotation as string 14053 case 'rotate': 14054 if (typeof value === 'string') { 14055 customisations[key] = rotateFromString(value); 14056 } 14057 else if (typeof value === 'number') { 14058 customisations[key] = value; 14059 } 14060 break; 14061 // Remove aria-hidden 14062 case 'ariaHidden': 14063 case 'aria-hidden': 14064 if (value !== true && value !== 'true') { 14065 delete componentProps['aria-hidden']; 14066 } 14067 break; 14068 // Copy missing property if it does not exist in customisations 14069 default: 14070 if (defaultProps[key] === void 0) { 14071 componentProps[key] = value; 14072 } 14073 } 14074 } 14075 // Generate icon 14076 const item = iconToSVG(icon, customisations); 14077 const renderAttribs = item.attributes; 14078 // Inline display 14079 if (customisations.inline) { 14080 style.verticalAlign = '-0.125em'; 14081 } 14082 if (mode === 'svg') { 14083 // Add style 14084 componentProps.style = { 14085 ...style, 14086 ...customStyle, 14087 }; 14088 // Add icon stuff 14089 Object.assign(componentProps, renderAttribs); 14090 // Counter for ids based on "id" property to render icons consistently on server and client 14091 let localCounter = 0; 14092 let id = props.id; 14093 if (typeof id === 'string') { 14094 // Convert '-' to '_' to avoid errors in animations 14095 id = id.replace(/-/g, '_'); 14096 } 14097 // Add icon stuff 14098 componentProps.dangerouslySetInnerHTML = { 14099 __html: cleanUpInnerHTML(replaceIDs(item.body, id ? () => id + 'ID' + localCounter++ : 'iconifyReact')), 14100 }; 14101 return reactExports.createElement('svg', componentProps); 14102 } 14103 // Render <span> with style 14104 const { body, width, height } = icon; 14105 const useMask = mode === 'mask' || 14106 (mode === 'bg' ? false : body.indexOf('currentColor') !== -1); 14107 // Generate SVG 14108 const html = iconToHTML(body, { 14109 ...renderAttribs, 14110 width: width + '', 14111 height: height + '', 14112 }); 14113 // Generate style 14114 componentProps.style = { 14115 ...style,
14116 '--svg': svgToURL(html), 14117 'width': fixSize(renderAttribs.width), 14118 'height': fixSize(renderAttribs.height), 14119 ...commonProps, 14120 ...(useMask ? monotoneProps : coloredProps), 14121 ...customStyle, 14122 }; 14123 return reactExports.createElement('span', componentProps); 14124}; 14125/** 14126 * Initialise stuff 14127 */ 14128// Enable short names 14129allowSimpleNames(true); 14130// Set API module 14131setAPIModule('', fetchAPIModule); 14132/** 14133 * Browser stuff 14134 */ 14135if (typeof document !== 'undefined' && typeof window !== 'undefined') { 14136 const _window = window; 14137 // Load icons from global "IconifyPreload" 14138 if (_window.IconifyPreload !== void 0) { 14139 const preload = _window.IconifyPreload; 14140 const err = 'Invalid IconifyPreload syntax.'; 14141 if (typeof preload === 'object' && preload !== null) { 14142 (preload instanceof Array ? preload : [preload]).forEach((item) => { 14143 try { 14144 if ( 14145 // Check if item is an object and not null/array 14146 typeof item !== 'object' || 14147 item === null || 14148 item instanceof Array || 14149 // Check for 'icons' and 'prefix' 14150 typeof item.icons !== 'object' || 14151 typeof item.prefix !== 'string' || 14152 // Add icon set 14153 !addCollection(item)) { 14154 console.error(err); 14155 } 14156 } 14157 catch (e) { 14158 console.error(err); 14159 } 14160 }); 14161 } 14162 } 14163 // Set API from global "IconifyProviders" 14164 if (_window.IconifyProviders !== void 0) { 14165 const providers = _window.IconifyProviders; 14166 if (typeof providers === 'object' && providers !== null) { 14167 for (let key in providers) { 14168 const err = 'IconifyProviders[' + key + '] is invalid.'; 14169 try { 14170 const value = providers[key]; 14171 if (typeof value !== 'object' || 14172 !value || 14173 value.resources === void 0) { 14174 continue; 14175 } 14176 if (!addAPIProvider(key, value)) { 14177 console.error(err); 14178 } 14179 } 14180 catch (e) { 14181 console.error(err); 14182 } 14183 } 14184 } 14185 } 14186} 14187function IconComponent(props) { 14188 const [mounted, setMounted] = reactExports.useState(!!props.ssr); 14189 const [abort, setAbort] = reactExports.useState({}); 14190 // Get initial state 14191 function getInitialState(mounted) { 14192 if (mounted) { 14193 const name = props.icon; 14194 if (typeof name === 'object') { 14195 // Icon as object 14196 return { 14197 name: '', 14198 data: name, 14199 }; 14200 } 14201 const data = getIconData(name); 14202 if (data) { 14203 return { 14204 name, 14205 data, 14206 }; 14207 } 14208 } 14209 return { 14210 name: '', 14211 }; 14212 } 14213 const [state, setState] = reactExports.useState(getInitialState(!!props.ssr)); 14214 // Cancel loading 14215 function cleanup() { 14216 const callback = abort.callback; 14217 if (callback) { 14218 callback(); 14219 setAbort({}); 14220 } 14221 } 14222 // Change state if it is different 14223 function changeState(newState) { 14224 if (JSON.stringify(state) !== JSON.stringify(newState)) { 14225 cleanup(); 14226 setState(newState); 14227 return true; 14228 } 14229 } 14230 // Update state 14231 function updateState() { 14232 var _a; 14233 const name = props.icon; 14234 if (typeof name === 'object') { 14235 // Icon as object 14236 changeState({ 14237 name: '', 14238 data: name, 14239 }); 14240 return; 14241 } 14242 // New icon or got icon data 14243 const data = getIconData(name); 14244 if (changeState({ 14245 name, 14246 data, 14247 })) { 14248 if (data === undefined) { 14249 // Load icon, update state when done 14250 const callback = loadIcons([name], updateState); 14251 setAbort({ 14252 callback, 14253 }); 14254 } 14255 else if (data) { 14256 // Icon data is available: trigger onLoad callback if present 14257 (_a = props.onLoad) === null || _a === void 0 ? void 0 : _a.call(props, name); 14258 } 14259 } 14260 } 14261 // Mounted state, cleanup for loader 14262 reactExports.useEffect(() => { 14263 setMounted(true); 14264 return cleanup; 14265 }, []); 14266 // Icon changed or component mounted 14267 reactExports.useEffect(() => { 14268 if (mounted) { 14269 updateState(); 14270 } 14271 }, [props.icon, mounted]); 14272 // Render icon 14273 const { name, data } = state; 14274 if (!data) { 14275 return props.children 14276 ? props.children 14277 : reactExports.createElement('span', {}); 14278 } 14279 return render({ 14280 ...defaultIconProps, 14281 ...data, 14282 }, props, name); 14283} 14284/** 14285 * Block icon 14286 * 14287 * @param props - Component properties 14288 */ 14289const Icon = reactExports.forwardRef((props, ref) => IconComponent({ 14290 ...props, 14291 _ref: ref, 14292})); 14293/** 14294 * Inline icon (has negative verticalAlign that makes it behave like icon font) 14295 * 14296 * @param props - Component properties 14297 */ 14298reactExports.forwardRef((props, ref) => IconComponent({ 14299 inline: true, 14300 ...props, 14301 _ref: ref, 14302})); 14303
14304const logoDark = ""+new URL('logo_dark.svg', import.meta.url).href+""; 14305 14306const googleIcon = "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Social%20media%20logo'%3e%3cpath%20id='vector'%20d='M22.501%2012.2332C22.501%2011.3699%2022.4296%2010.7399%2022.2748%2010.0865H12.2153V13.9832H18.12C18.001%2014.9515%2017.3582%2016.4099%2015.9296%2017.3898L15.9096%2017.5203L19.0902%2019.935L19.3106%2019.9565C21.3343%2018.1249%2022.501%2015.4298%2022.501%2012.2332Z'%20fill='%234285F4'/%3e%3cpath%20id='vector_2'%20d='M12.214%2022.5C15.1068%2022.5%2017.5353%2021.5666%2019.3092%2019.9567L15.9282%2017.3899C15.0235%2018.0083%2013.8092%2018.4399%2012.214%2018.4399C9.38069%2018.4399%206.97596%2016.6083%206.11874%2014.0766L5.99309%2014.0871L2.68583%2016.5954L2.64258%2016.7132C4.40446%2020.1433%208.0235%2022.5%2012.214%2022.5Z'%20fill='%2334A853'/%3e%3cpath%20id='vector_3'%20d='M6.12046%2014.0767C5.89428%2013.4234%205.76337%2012.7233%205.76337%2012C5.76337%2011.2767%205.89428%2010.5767%206.10856%209.92337L6.10257%209.78423L2.75386%207.2356L2.64429%207.28667C1.91814%208.71002%201.50146%2010.3084%201.50146%2012C1.50146%2013.6917%201.91814%2015.29%202.64429%2016.7133L6.12046%2014.0767Z'%20fill='%23FBBC05'/%3e%3cpath%20id='vector_4'%20d='M12.2141%205.55997C14.2259%205.55997%2015.583%206.41163%2016.3569%207.12335L19.3807%204.23C17.5236%202.53834%2015.1069%201.5%2012.2141%201.5C8.02353%201.5%204.40447%203.85665%202.64258%207.28662L6.10686%209.92332C6.97598%207.39166%209.38073%205.55997%2012.2141%205.55997Z'%20fill='%23EB4335'/%3e%3c/g%3e%3c/svg%3e"; 14307 14308const modalContainer$1 = "_modalContainer_1bl2q_8"; 14309const modalBackdrop$2 = "_modalBackdrop_1bl2q_20"; 14310const modalBody$1 = "_modalBody_1bl2q_36"; 14311const styles$5 = { 14312 modalContainer: modalContainer$1, 14313 modalBackdrop: modalBackdrop$2, 14314 modalBody: modalBody$1}; 14315 14316const AuthorizationModal = (props) => { 14317 const { onCloseDialog } = props; 14318 const navigate = useNavigate(); 14319 const { authorize, loginUsingGoogle, loginUsingApple, authLoading } = useAuth(); 14320 const formRef = reactExports.useRef(null); 14321 const [isLoginForm, setIsLoginForm] = reactExports.useState(!props.isSignUp); 14322 const [authData, setAuthData] = reactExports.useState({ email: "", password: "" }); 14323 const [errors, setErrors] = reactExports.useState({ email: false, password: false }); 14324 const handleInputChange = (e) => { 14325 const { name, value } = e.target; 14326 setErrors((prev) => ({ ...prev, [name]: false })); 14327 setAuthData((prev) => ({ ...prev, [name]: value })); 14328 }; 14329 const handleSubmit = async (e) => { 14330 e.preventDefault(); 14331 try { 14332 const emailRegex = new RegExp( 14333 "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" 14334 ); 14335 const passwordRegex = new RegExp("^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$"); 14336 if (!emailRegex.test(authData.email)) { 14337 setErrors((prev) => ({ ...prev, email: true })); 14338 return; 14339 } 14340 if (!passwordRegex.test(authData.password)) { 14341 setErrors((prev) => ({ ...prev, password: true })); 14342 return; 14343 } 14344 await authorize(isLoginForm, authData); 14345 if (props.onSubmit) { 14346 props.onSubmit(); 14347 } else { 14348 navigate("/workspace"); 14349 onCloseDialog(); 14350 } 14351 } catch (e2) { 14352 console.log(e2); 14353 } 14354 }; 14355 const onBackdropClick = (e) => { 14356 e.stopPropagation(); 14357 onCloseDialog(); 14358 }; 14359 reactExports.useEffect(() => { 14360 formRef?.current?.reset(); 14361 setErrors({ email: false, password: false }); 14362 setAuthData({ email: "", password: "" }); 14363 }, [isLoginForm]); 14364 return reactDomExports.createPortal( 14365 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$5.modalContainer, children: [
14366 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$5.modalBackdrop, onClick: onBackdropClick }), 14367 /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { className: styles$5.modalBody, ref: formRef, onChange: handleInputChange, onSubmit: handleSubmit, children: [ 14368 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "md:hidden shrink-0 p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "dark:block", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, width: "83", alt: "Costquest" }) }) }), 14369 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-6 pl-4 md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "cursor-pointer flex items-center", onClick: onCloseDialog, children: [ 14370 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--alt-arrow-left-linear] text-l text-lavender" }), 14371 "Back" 14372 ] }) }), 14373 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2 text-center", children: [
14374 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-medium text-grey", children: isLoginForm ? "Sign In" : "Sign Up" }), 14375 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [ 14376 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-block mr-2 text-greyGentle", children: isLoginForm ? "Donât have an account?" : "Already registered?" }), 14377 /* @__PURE__ */ jsxRuntimeExports.jsx( 14378 "button", 14379 { 14380 type: "button", 14381 className: "text-xs font-semibold text-white hover:text-lavender", 14382 onClick: () => setIsLoginForm(!isLoginForm), 14383 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: isLoginForm ? "Sign Up" : "Sign In" }) 14384 } 14385 ) 14386 ] }) 14387 ] }), 14388 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "btn-outlined w-full", onClick: () => loginUsingGoogle(isLoginForm), children: [
14389 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: googleIcon, width: "24", alt: "Google" }), 14390 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-white font-semibold", children: "Continue with Google" }) 14391 ] }) }), 14392 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full gap-1 items-center", children: [ 14393 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "grow h-px bg-muted" }), 14394 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-xs text-greyGentle", children: "Or continue with email" }), 14395 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "grow h-px bg-muted" }) 14396 ] }), 14397 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [ 14398 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 14399 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-semibold text-white", children: "Email*" }),
14400 /* @__PURE__ */ jsxRuntimeExports.jsx( 14401 "input", 14402 { 14403 type: "email", 14404 id: "email", 14405 name: "email", 14406 placeholder: "Enter your email", 14407 className: cn( 14408 "w-full p-4 bg-deep placeholder:text-greyGentle placeholder:font-normal rounded-[40px] border border-deep focus:border-lavender text-xs font-semibold focus:outline-none", 14409 errors.email && "border-red-500" 14410 ) 14411 } 14412 ) 14413 ] }), 14414 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 14415 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-semibold text-white", children: "Password" }), 14416 /* @__PURE__ */ jsxRuntimeExports.jsx( 14417 "input", 14418 { 14419 type: "text", 14420 id: "password", 14421 name: "password", 14422 placeholder: "Enter your password", 14423 className: cn( 14424 "w-full p-4 bg-deep placeholder:text-greyGentle placeholder:font-normal rounded-[40px] border border-deep focus:border-lavender text-xs font-semibold focus:outline-none", 14425 errors.password && "border-red-500" 14426 ) 14427 } 14428 ),
14429 errors.password && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-red-500 pl-4", children: "Must be at least 8 characters. Include uppercase, number, or symbol for a stronger password." }) 14430 ] }), 14431 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "submit", className: "btn-lavender w-full min-h-[33px]", disabled: authLoading, children: authLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "svg-spinners:90-ring-with-bg", width: 17, height: 17 }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-white font-semibold", children: isLoginForm ? "Sign In" : "Sign Up" }) }), 14432 !isLoginForm && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center space-x-1", children: [ 14433 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle", children: "By signing up, you agree to our" }), 14434 /* @__PURE__ */ jsxRuntimeExports.jsx( 14435 NavLink, 14436 { 14437 to: "/terms-of-use", 14438 target: "_blank", 14439 className: "text-xs font-semibold text-white hover:text-lavender", 14440 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Terms of Use" }) 14441 } 14442 ),
14443 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle", children: "and" }), 14444 /* @__PURE__ */ jsxRuntimeExports.jsx( 14445 NavLink, 14446 { 14447 to: "/privacy-policy", 14448 target: "_blank", 14449 className: "text-xs font-semibold text-white hover:text-lavender", 14450 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Privacy Policy." }) 14451 } 14452 ) 14453 ] }) 14454 ] }) 14455 ] }) 14456 ] }), 14457 document.body 14458 ); 14459}; 14460 14461const Header = ({ withActions, isLanding }) => { 14462 const navigate = useNavigate(); 14463 const { user, logout, authLoading, setUser } = useAuth(); 14464 const [isOpen, setIsOpen] = reactExports.useState(false); 14465 const [showLoginModal, setShowLoginModal] = reactExports.useState(false); 14466 const handleNewEstimate = () => { 14467 navigate("/estimation"); 14468 }; 14469 const handleMyProfileClick = () => { 14470 navigate("/workspace"); 14471 }; 14472 const handleAuthModal = () => { 14473 setShowLoginModal(!showLoginModal); 14474 }; 14475 const handleProfileMenuDropdown = () => { 14476 setIsOpen(!isOpen); 14477 }; 14478 const handleDeleteProfileClick = async () => { 14479 await deleteAccauntFunc(); 14480 setUser(null); 14481 navigate("/"); 14482 }; 14483 const sectionStart = reactExports.useRef(null); 14484 const sectionWhy = reactExports.useRef(null); 14485 const sectionFaq = reactExports.useRef(null); 14486 const scrollToSection = (ref) => { 14487 ref.current?.scrollIntoView({ behavior: "smooth" }); 14488 }; 14489 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 14490 "div", 14491 { 14492 className: cn( 14493 "sticky top-0 w-full z-20 shrink-0 p-4 md:py-4 md:px-6 flex items-center justify-between ", 14494 !isLanding && "bg-denim" 14495 ), 14496 children: [
14497 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden dark:block", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai/", target: "_self", rel: "noreferrer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, width: "83", alt: "Costquest" }) }) }), 14498 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "dark:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai/", target: "_self", rel: "noreferrer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logoDark, width: "83", alt: "Costquest", className: "" }) }) }), 14499 withActions && /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main-outlined group", onClick: handleNewEstimate, children: [ 14500 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-semibold", children: "New Estimate" }), 14501 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--magic-stick-3-bold] text-2xl leading-none group-hover:bg-gradient-to-r group-hover:from-redLight group-hover:to-sapphireLight group-active:bg-gradient-to-r group-active:from-redLightTransparent group-active:to-sapphireLightTransparent" }) 14502 ] }), 14503 isLanding && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hidden md:inline-flex p-1 gap-1 rounded-100 border border-lavender/15 bg-white/5", children: [
14504 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-transparent", onClick: () => scrollToSection(sectionStart), children: "Explore Our Tools" }), 14505 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-transparent", onClick: () => scrollToSection(sectionWhy), children: "Why Choose Us?" }), 14506 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-transparent", onClick: () => scrollToSection(sectionFaq), children: "FAQ" }) 14507 ] }), 14508 !user?.isAuth && (!showLoginModal ? /* @__PURE__ */ jsxRuntimeExports.jsx( 14509 "button", 14510 { 14511 className: cn("w-auto", isLanding ? "btn-outlined" : "btn-main-outlined"), 14512 onClick: handleAuthModal, 14513 disabled: authLoading, 14514 children: authLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "svg-spinners:90-ring-with-bg", width: 17, height: 17 }) : "Sign In" 14515 } 14516 ) : /* @__PURE__ */ jsxRuntimeExports.jsx(AuthorizationModal, { onCloseDialog: handleAuthModal })),
14517 user?.isAuth && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [ 14518 /* @__PURE__ */ jsxRuntimeExports.jsxs( 14519 "button", 14520 { 14521 onClick: handleProfileMenuDropdown, 14522 className: cn( 14523 isOpen ? "border-lavender/15" : "border-deepTransparent", 14524 "w-10 h-10 shrink-0 rounded-full inline-flex justify-center items-center bg-deepTransparent border hover:border-lavender/15" 14525 ), 14526 children: [ 14527 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden", children: "User Profile Actions" }), 14528 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--user-bold] text-2xl leading-none text-lavender" }) 14529 ] 14530 } 14531 ), 14532 /* @__PURE__ */ jsxRuntimeExports.jsx( 14533 "div", 14534 { 14535 onClick: handleProfileMenuDropdown, 14536 className: cn("fixed top-0 left-0 z-10 h-screen w-screen hidden", { block: isOpen }) 14537 } 14538 ),
14539 /* @__PURE__ */ jsxRuntimeExports.jsxs( 14540 "div", 14541 { 14542 className: cn( 14543 isOpen ? "opacity-1 visible translate-y-4" : "opacity-0 invisible translate-y-8", 14544 "absolute z-20 top-full right-0 space-y-1 transition-transform p-2 rounded-2xl bg-deep min-w-[190px]" 14545 ), 14546 children: [ 14547 /* @__PURE__ */ jsxRuntimeExports.jsxs( 14548 "button", 14549 { 14550 onClick: handleMyProfileClick, 14551 className: "w-full inline-flex items-center gap-2 rounded-lg py-2 pl-2 pr-4 text-grey hover:bg-muted", 14552 children: [ 14553 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--user-linear] text-xl leading-none text-lavender" }), 14554 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: "My Profile" }) 14555 ] 14556 } 14557 ), 14558 /* @__PURE__ */ jsxRuntimeExports.jsxs( 14559 "button", 14560 { 14561 onClick: handleDeleteProfileClick, 14562 className: "w-full inline-flex items-center gap-2 rounded-lg py-2 pl-2 pr-4 text-grey hover:bg-muted", 14563 children: [
14564 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--user-linear] text-xl leading-none text-lavender" }), 14565 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: "Delete Profile" }) 14566 ] 14567 } 14568 ), 14569 /* @__PURE__ */ jsxRuntimeExports.jsxs( 14570 "button", 14571 { 14572 onClick: logout, 14573 className: "w-full inline-flex items-center gap-2 rounded-lg py-2 pl-2 pr-4 text-grey hover:bg-muted", 14574 children: [ 14575 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--logout-outline] text-xl leading-none text-lavender" }), 14576 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: "Sign Out" }) 14577 ] 14578 } 14579 ) 14580 ] 14581 } 14582 ) 14583 ] }) 14584 ] 14585 } 14586 ); 14587}; 14588 14589const Layout = ({ withActions, isLanding, showVideo = false, showModal }) => { 14590 useScrollToTop(); 14591 const [showFeedbackModal, setShowFeedbackModal] = reactExports.useState(false); 14592 return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 14593 /* @__PURE__ */ jsxRuntimeExports.jsx(AnnouncementBanner, {}), 14594 /* @__PURE__ */ jsxRuntimeExports.jsx(Header, { withActions, isLanding }), 14595 /* @__PURE__ */ jsxRuntimeExports.jsx( 14596 "div", 14597 { 14598 className: cn( 14599 { hidden: !showVideo }, 14600 !isLanding && "dark:block dark:md:hidden", 14601 " overflow-hidden absolute top-0 w-full h-[471px] blur-[12.5px]" 14602 ), 14603 children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute top-0 bottom-0 translate-x-[50vw] w-[490px]", children: [
14604 /* @__PURE__ */ jsxRuntimeExports.jsx(Video, {}), 14605 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-denim/60" }) 14606 ] }) 14607 } 14608 ), 14609 /* @__PURE__ */ jsxRuntimeExports.jsx( 14610 "div", 14611 { 14612 className: cn( 14613 "body-container z-10", 14614 !isLanding && "md:px-6", 14615 showModal && "z-20", 14616 "relative grow flex flex-col" 14617 ), 14618 children: /* @__PURE__ */ jsxRuntimeExports.jsx(Outlet, {}) 14619 } 14620 ), 14621 !showFeedbackModal ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "feedback-btn fixed bottom-12 right-12 z-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: () => setShowFeedbackModal(true), className: "btn-main-circle bg-gray-100 h-14 w-14", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--dialog-2-linear] text-2xl leading-none" }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Feedback, { onCloseDialog: () => setShowFeedbackModal(false), onSubmitData: () => setShowFeedbackModal(false) }) 14622 ] }); 14623}; 14624 14625const ProtectedRoute = ({ children }) => { 14626 const { user, authLoading } = useAuth(); 14627 if (authLoading) { 14628 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-screen w-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "svg-spinners:90-ring-with-bg", width: 46, height: 46 }) }); 14629 } 14630 if (!user?.isAuth) { 14631 return /* @__PURE__ */ jsxRuntimeExports.jsx(Navigate, { to: "/", replace: true }); 14632 } 14633 return children; 14634}; 14635 14636const SuccessSocial = () => { 14637 const navigate = useNavigate(); 14638 const { social } = useParams(); 14639 const [searchParams] = useSearchParams(); 14640 const { loginWithToken } = useAuth(); 14641 const signUp = async () => { 14642 let signUpData; 14643 if (social === "google") { 14644 signUpData = { google_oauth_token: searchParams.get("access_token") }; 14645 } else if (social === "apple") { 14646 const token = searchParams.get("code"); 14647 const user_token = searchParams.get("id_token"); 14648 signUpData = { apple_oauth_token: token, user_token }; 14649 } 14650 return await axios.post(API_URLS.REGISTER_LOGIN, signUpData); 14651 }; 14652 const signIn = async () => { 14653 let signUpData; 14654 if (social === "google") { 14655 signUpData = { google_oauth_token: searchParams.get("access_token") }; 14656 } else if (social === "apple") { 14657 const token = searchParams.get("code"); 14658 const user_token = searchParams.get("id_token"); 14659 signUpData = { apple_oauth_token: token, user_token }; 14660 } 14661 return await axios.post(API_URLS.SOCIAL_LOGIN, signUpData); 14662 }; 14663 const auth = async () => { 14664 try { 14665 const { data } = await (searchParams.get("action") === "signup" ? signUp() : signIn()); 14666 await loginWithToken(data?.access, data?.refresh); 14667 navigate("/workspace"); 14668 } catch (e) { 14669 console.log("error:", e?.response?.details); 14670 navigate("/"); 14671 } 14672 }; 14673 reactExports.useEffect(() => { 14674 auth(); 14675 }, []); 14676 return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}); 14677}; 14678 14679const initialState$1 = { 14680 description: null, 14681 updatedDescription: "", 14682 estimationDataNoRestrictions: null, 14683 estimationDataWithRestrictions: null, 14684 shortVersionHtml: null, 14685 budget_limit: "", 14686 time_limit: "", 14687 descriptionUpdateCount: 0 14688}; 14689 14690const UseAppDataContext = reactExports.createContext({ 14691 appState: initialState$1, 14692 setAppState: (prevState) => prevState 14693}); 14694const AppDataProvider = ({ children }) => { 14695 const loadState = () => { 14696 const savedState = localStorage.getItem(STATE_ID_NAME); 14697 return savedState ? JSON.parse(savedState) : initialState$1; 14698 }; 14699 const [appState, setAppState] = reactExports.useState(loadState); 14700 reactExports.useEffect(() => { 14701 localStorage.setItem(STATE_ID_NAME, JSON.stringify(appState)); 14702 }, [appState]); 14703 const value = reactExports.useMemo( 14704 () => ({ 14705 appState, 14706 setAppState 14707 }), 14708 [appState, setAppState] 14709 ); 14710 return /* @__PURE__ */ jsxRuntimeExports.jsx(UseAppDataContext.Provider, { value, children }); 14711}; 14712const useAppData = () => { 14713 const context = reactExports.useContext(UseAppDataContext); 14714 if (context === void 0) throw new Error("useAppData must be used within UseAppDataContext"); 14715 return context; 14716}; 14717 14718const POLLING_INTERVAL_MS$1 = 1e3; 14719const POLLING_TIMEOUT_MS$1 = 10 * 60 * 1e3; 14720const useAsyncPolling = () => { 14721 const [state, setState] = reactExports.useState({ 14722 data: null, 14723 sessionId: null, 14724 loading: false, 14725 error: null, 14726 progress: null, 14727 featuresPendingReview: null 14728 }); 14729 const pollingRef = reactExports.useRef(null); 14730 const timeoutRef = reactExports.useRef(null); 14731 const abortRef = reactExports.useRef(false); 14732 const lastSessionRef = reactExports.useRef(null); 14733 const lastStageRef = reactExports.useRef("estimate_points"); 14734 const stopPolling = reactExports.useCallback(() => { 14735 if (pollingRef.current) { 14736 clearInterval(pollingRef.current); 14737 pollingRef.current = null; 14738 } 14739 if (timeoutRef.current) { 14740 clearTimeout(timeoutRef.current); 14741 timeoutRef.current = null; 14742 } 14743 }, []); 14744 const pollStatus = reactExports.useCallback(async (sessionId, stage) => { 14745 if (abortRef.current) return; 14746 try { 14747 const { data } = await axios.get( 14748 API_URLS.TASK_STEP_STATUS, 14749 { params: { session_id: sessionId, stage } } 14750 ); 14751 if (abortRef.current) return; 14752 if (data.features_pending_review) { 14753 stopPolling(); 14754 setState((prev) => ({ 14755 ...prev, 14756 sessionId, 14757 loading: false, 14758 error: null, 14759 progress: data.progress ?? prev.progress, 14760 featuresPendingReview: data.features_pending_review ?? null 14761 })); 14762 return; 14763 } 14764 if (data.status === "complete") { 14765 stopPolling(); 14766 setState({ 14767 data: data.response ?? null, 14768 sessionId, 14769 loading: false, 14770 error: null, 14771 progress: data.progress ?? null, 14772 featuresPendingReview: null 14773 }); 14774 } else if (data.status === "failed") { 14775 stopPolling(); 14776 const errorMsg = "Processing failed. Please try again."; 14777 setState({ data: null, sessionId, loading: false, error: errorMsg, progress: data.progress ?? null, featuresPendingReview: null }); 14778 alert(errorMsg); 14779 } else { 14780 setState((prev) => ({ 14781 ...prev, 14782 sessionId, 14783 loading: true, 14784 error: null, 14785 progress: data.progress ?? prev.progress 14786 })); 14787 } 14788 } catch (err) { 14789 if (abortRef.current) return; 14790 stopPolling(); 14791 const errorMsg = "Error while checking status. Please try again."; 14792 setState({ data: null, sessionId, loading: false, error: errorMsg, progress: null, featuresPendingReview: null }); 14793 alert(errorMsg); 14794 } 14795 }, [stopPolling]); 14796 const startPolling = reactExports.useCallback((sessionId, stage) => { 14797 stopPolling(); 14798 pollingRef.current = setInterval(() => { 14799 void pollStatus(sessionId, stage); 14800 }, POLLING_INTERVAL_MS$1); 14801 timeoutRef.current = setTimeout(() => { 14802 stopPolling(); 14803 const errorMsg = "Polling timed out after 5 minutes. Please try again later."; 14804 setState((prev) => ({ ...prev, loading: false, error: errorMsg, featuresPendingReview: null })); 14805 alert(errorMsg); 14806 }, POLLING_TIMEOUT_MS$1); 14807 }, [pollStatus, stopPolling]); 14808 const resumePolling = reactExports.useCallback(() => { 14809 const sessionId = lastSessionRef.current; 14810 const stage = lastStageRef.current; 14811 if (!sessionId) return; 14812 abortRef.current = false;
14813 setState((prev) => ({ ...prev, loading: true, featuresPendingReview: null })); 14814 startPolling(sessionId, stage); 14815 }, [startPolling]); 14816 const startAsync = reactExports.useCallback(async (asyncCall, stage = "estimate_points") => { 14817 abortRef.current = false; 14818 setState({ data: null, sessionId: null, loading: true, error: null, progress: null, featuresPendingReview: null }); 14819 try { 14820 const result = await asyncCall(); 14821 const sessionId = result.session_id; 14822 if (abortRef.current) return; 14823 lastSessionRef.current = sessionId; 14824 lastStageRef.current = stage; 14825 setState((prev) => ({ ...prev, sessionId })); 14826 startPolling(sessionId, stage); 14827 } catch (err) { 14828 if (abortRef.current) return; 14829 const errorMsg = "Failed to start async processing. Please try again."; 14830 setState({ data: null, sessionId: null, loading: false, error: errorMsg, progress: null, featuresPendingReview: null }); 14831 alert(errorMsg); 14832 } 14833 }, [startPolling]); 14834 reactExports.useEffect(() => { 14835 return () => { 14836 abortRef.current = true; 14837 stopPolling(); 14838 }; 14839 }, [stopPolling]); 14840 return { ...state, startAsync, resumePolling }; 14841}; 14842 14843const DesktopBG = () => { 14844 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden md:block absolute bottom-0 left-0 right-0 top-0 bg-denim/60 blur-[12.5px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-0 left-0 translate-y-1/2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Video, {}) }) }); 14845}; 14846 14847const TitleBlock = ({ title, description }) => { 14848 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 14849 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: title }), 14850 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: description }) 14851 ] }); 14852}; 14853 14854const AnimatedBlock = ({ text, opacity, onLoad, index, isLast, loading, status }) => { 14855 const delay = (!isLast ? index + 1 : loading ? 1e3 : 0) * 1e3; 14856 const [isLoading, setIsLoading] = reactExports.useState(status ? status !== "complete" : true); 14857 const hasRealStatus = Boolean(status); 14858 reactExports.useEffect(() => { 14859 if (hasRealStatus) { 14860 setIsLoading(status === "started" || status === "in_progress"); 14861 return; 14862 } 14863 let timer = null; 14864 if (delay) { 14865 timer = setTimeout(() => { 14866 setIsLoading(false); 14867 onLoad?.(); 14868 }, delay); 14869 } 14870 return () => { 14871 if (timer) { 14872 clearTimeout(timer); 14873 } 14874 }; 14875 }, [delay, hasRealStatus, onLoad, status]); 14876 const iconClassName = (() => { 14877 if (status === "complete") { 14878 return "icon-[solar--check-circle-bold]"; 14879 } 14880 if (status === "failed") { 14881 return "icon-[solar--close-circle-bold]"; 14882 } 14883 if (status === "started" || status === "in_progress") { 14884 return "icon-[svg-spinners--tadpole]"; 14885 } 14886 if (status === "not_triggered") { 14887 return "icon-[solar--clock-circle-linear]"; 14888 } 14889 return isLoading ? "icon-[svg-spinners--tadpole]" : "icon-[solar--check-circle-bold]"; 14890 })(); 14891 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("p-4 rounded-2xl bg-deepTransparent transition-all duration-1000"), style: { opacity }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 14892 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 14893 "span", 14894 { 14895 className: cn(iconClassName, "text-2xl leading-none", { 14896 "text-lavender": status !== "failed", 14897 "text-red-400": status === "failed" 14898 }) 14899 } 14900 ) }), 14901 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: text }) 14902 ] }) }); 14903}; 14904 14905const Loading = ({ info, loading, progress, stageStatuses }) => { 14906 const [currentBlock, setCurrentBlock] = reactExports.useState(0); 14907 const usesRealStatuses = Boolean(stageStatuses?.length); 14908 const onLoad = () => { 14909 setCurrentBlock((number) => number + 1); 14910 }; 14911 return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
14912 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative grow rounded-2xl z-10 px-4 py-6 md:p-0 md:overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto", children: [ 14913 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "md:pt-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TitleBlock, { title: info.title, description: info.description }) }), 14914 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-[450px] mx-auto flex flex-col gap-2 md:gap-4", children: [ 14915 info.blocks.map((block, index, array) => { 14916 return /* @__PURE__ */ jsxRuntimeExports.jsx( 14917 AnimatedBlock, 14918 { 14919 text: block, 14920 index, 14921 isLast: index === array.length - 1, 14922 loading, 14923 onLoad, 14924 opacity: usesRealStatuses ? 1 : index > currentBlock ? 0 : 1, 14925 status: stageStatuses?.[index] 14926 }, 14927 index 14928 ); 14929 }), 14930 "footer" in info && info.footer && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-center text-greyGentle mt-2", children: info.footer }) 14931 ] }) 14932 ] }) }), 14933 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}) }) 14934 ] }); 14935}; 14936 14937const FeatureSelection = ({ data, onSubmitted }) => { 14938 const [modules, setModules] = reactExports.useState(() => { 14939 const init = {}; 14940 for (const mod of data.modules) { 14941 init[mod.id] = { 14942 selected: mod.selected_to_implement, 14943 selectedFeatures: new Set( 14944 mod.features.filter((f) => f.selected_to_implement).map((f) => f.id) 14945 ) 14946 }; 14947 } 14948 return init; 14949 }); 14950 const [submitting, setSubmitting] = reactExports.useState(false); 14951 const toggleModule = reactExports.useCallback((moduleId) => { 14952 setModules((prev) => { 14953 const mod = prev[moduleId]; 14954 const newSelected = !mod.selected; 14955 const module = data.modules.find((m) => m.id === moduleId); 14956 return { 14957 ...prev, 14958 [moduleId]: { 14959 selected: newSelected, 14960 selectedFeatures: newSelected ? new Set(module?.features.map((f) => f.id) ?? []) : /* @__PURE__ */ new Set() 14961 } 14962 }; 14963 }); 14964 }, [data.modules]); 14965 const toggleFeature = reactExports.useCallback((moduleId, featureId) => { 14966 setModules((prev) => { 14967 const mod = prev[moduleId]; 14968 const newFeatures = new Set(mod.selectedFeatures); 14969 if (newFeatures.has(featureId)) { 14970 newFeatures.delete(featureId); 14971 } else { 14972 newFeatures.add(featureId); 14973 } 14974 return { 14975 ...prev, 14976 [moduleId]: { 14977 ...mod, 14978 selected: newFeatures.size > 0 ? true : mod.selected, 14979 selectedFeatures: newFeatures 14980 } 14981 }; 14982 }); 14983 }, []); 14984 const handleSubmit = async () => { 14985 setSubmitting(true); 14986 try { 14987 const sessionId = localStorage.getItem(SESSION_ID_NAME); 14988 const payload = { 14989 session_id: sessionId, 14990 modules: data.modules.map((mod) => ({ 14991 id: mod.id, 14992 selected: modules[mod.id]?.selected ?? false, 14993 selected_features: Array.from(modules[mod.id]?.selectedFeatures ?? []) 14994 })) 14995 }; 14996 await axios.post(API_URLS.SELECT_FEATURES, payload); 14997 const { data: shortHtml } = await axios.get(API_URLS.SHORT_VERSION, { 14998 params: { session_id: sessionId }, 14999 responseType: "text", 15000 transformResponse: [(d) => d] 15001 }); 15002 const sleepMs = 1200 + Math.floor(Math.random() * 501); 15003 await new Promise((resolve) => { 15004 setTimeout(resolve, sleepMs); 15005 }); 15006 onSubmitted(shortHtml); 15007 } catch (err) { 15008 console.error(err); 15009 alert("Failed to save feature selection. Please try again."); 15010 setSubmitting(false); 15011 } 15012 }; 15013 return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow min-h-0 rounded-2xl z-10 px-4 py-6 md:p-0 overflow-y-auto", children: [
15014 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 15015 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto", children: [ 15016 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "md:pt-10 mb-6 md:mb-10", children: [ 15017 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Review Generated Features" }), 15018 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Select the modules and features you'd like to include in your budget estimate. Unselected items won't affect the final cost calculation." }) 15019 ] }), 15020 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4 max-w-[700px] mx-auto mb-8", children: data.modules.map((mod) => { 15021 const modState = modules[mod.id]; 15022 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 15023 "div", 15024 { 15025 className: "rounded-xl border border-gentle bg-nightfall/40 backdrop-blur-sm overflow-hidden", 15026 children: [
15027 /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "flex items-start gap-3 p-4 cursor-pointer select-none hover:bg-white/5 transition-colors", children: [ 15028 /* @__PURE__ */ jsxRuntimeExports.jsx( 15029 "input", 15030 { 15031 type: "checkbox", 15032 checked: modState?.selected ?? false, 15033 onChange: () => toggleModule(mod.id), 15034 className: "mt-1 h-5 w-5 shrink-0 rounded accent-sapphireLight cursor-pointer" 15035 } 15036 ), 15037 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [ 15038 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-base", children: mod.title }), 15039 mod.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-greyGentle mt-1 line-clamp-2", children: mod.description }) 15040 ] }) 15041 ] }), 15042 mod.features.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-gentle/50", children: mod.features.map((feature) => { 15043 const featureChecked = (modState?.selected ?? false) && (modState?.selectedFeatures.has(feature.id) ?? false); 15044 const featureDisabled = !(modState?.selected ?? false); 15045 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 15046 "label", 15047 { 15048 className: `flex items-start gap-3 px-4 py-3 pl-10 cursor-pointer select-none transition-colors ${featureDisabled ? "opacity-40 cursor-not-allowed" : "hover:bg-white/5"}`, 15049 children: [
15050 /* @__PURE__ */ jsxRuntimeExports.jsx( 15051 "input", 15052 { 15053 type: "checkbox", 15054 checked: featureChecked, 15055 disabled: featureDisabled, 15056 onChange: () => toggleFeature(mod.id, feature.id), 15057 className: "mt-0.5 h-4 w-4 shrink-0 rounded accent-sapphireLight cursor-pointer disabled:cursor-not-allowed" 15058 } 15059 ), 15060 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [ 15061 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: feature.title }), 15062 feature.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-greyGentle mt-0.5 line-clamp-2", children: feature.description }) 15063 ] }) 15064 ] 15065 }, 15066 feature.id 15067 ); 15068 }) }) 15069 ] 15070 }, 15071 mod.id 15072 ); 15073 }) }),
15074 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 15075 "button", 15076 { 15077 className: "btn-main !py-3 !px-8 text-sm", 15078 disabled: submitting, 15079 onClick: handleSubmit, 15080 children: submitting ? "Saving..." : "Continue" 15081 } 15082 ) }) 15083 ] }) 15084 ] }) }); 15085}; 15086 15087const loadingEstimationDescription = { 15088 first: { 15089 title: "Your Great Ideas Are Being Analyzed...", 15090 description: "We're working on generating your project description based on the details you provided. Hang tightâyour summary will be ready shortly!", 15091 blocks: [ 15092 "Formulating Your Project Overview", 15093 "Compiling Essential Project Details", 15094 "Assembling the Core Project Description", 15095 "Creating a Detailed Project Description" 15096 ] 15097 }, 15098 second: { 15099 title: "Crafting Your Custom Estimate...", 15100 description: "We're busy processing the details to generate a customized estimate for you. Sit tight-your results will be ready soon.", 15101 footer: "This process may take from 30 seconds to a couple of minutes.", 15102 blocks: [ 15103 "Writing Your Brief Project Summary", 15104 "Identifying Key Features of Your Project", 15105 "Selecting the Recommended Team Structure", 15106 "Calculating Technical Specifications", 15107 "Generate product modules and features" 15108 // "Estimating Time and Cost for Project Completion", 15109 // "Finalizing the Overall Project Description", 15110 ] 15111 } 15112}; 15113const loadingBusinessDescription = { 15114 first: { 15115 title: "Crafting Your Business Blueprint...", 15116 description: "Sit tight â weâre building a complete strategy for your idea.", 15117 blocks: [ 15118 "Identifying Your Target Audience", 15119 "Analyzing User Needs and Problems", 15120 "Defining Your Unique Value Propositions", 15121 "Structuring Your Go-to-Market Approach" 15122 ] 15123 }, 15124 second: { 15125 title: "Generating Key Insights...", 15126 description: "Weâre uncovering needs, challenges, and opportunities to shape a stronger product direction.", 15127 blocks: ["Understanding key user needs", "Identifying core problems", "Generating tailored value propositions"] 15128 }, 15129 hlc: { 15130 title: "Generating Your High-Level Components...", 15131 description: "Weâre mapping out the foundational elements of your solution based on segment(s) insights.", 15132 blocks: [ 15133 "Translating needs into product features", 15134 "Outlining essential components", 15135 "Defining core architecture blocks", 15136 "Connecting value to functionality" 15137 ] 15138 }, 15139 mvp: { 15140 title: "Generating Your MVP Plan...", 15141 description: "Sit tight â weâre turning your strategy into actionable user stories and a focused MVP scope.", 15142 blocks: [ 15143 "Reviewing audience needs and problems", 15144 "Mapping feature priorities", 15145 "Structuring user stories", 15146 "Defining MVP boundaries" 15147 ] 15148 } 15149}; 15150const loadingPatentDescription = { 15151 start: { 15152 title: "Analyzing Your Inventionâ¦", 15153 description: "Weâre reviewing the details youâve shared to better understand your idea â just a moment before we move on.", 15154 blocks: [ 15155 "Reading your invention summary", 15156 "Identifying core components", 15157 "Preparing context for visuals", 15158 "Getting ready for the next step" 15159 ] 15160 }, 15161 visualisation: { 15162 title: "Image Received", 15163 description: "Weâve successfully uploaded your image. Getting things readyâ¦", 15164 blocks: [ 15165 "Upload confirmed", 15166 "Getting ready for the next step", 15167 "Just a momentâ¦" 15168 ] 15169 }, 15170 markers: { 15171 title: "Markers Uploaded", 15172 description: "Weâve received your markers. Setting up everything for the next stepâ¦", 15173 blocks: [ 15174 "Markers received", 15175 "Getting things ready", 15176 "Almost thereâ¦" 15177 ] 15178 }, 15179 markerInteractions: { 15180 title: "Thanks! We Got the Interactions.", 15181 description: "Everythingâs in place â just setting things up.", 15182 blocks: [ 15183 "Upload confirmed", 15184 "Prepping connections", 15185 "One step awayâ¦" 15186 ] 15187 }, 15188 context: { 15189 title: "Finalizing Your Patent Draftâ¦", 15190 description: "Weâre reviewing the context and classification of your invention to generate a clear, structured draft â almost there!", 15191 blocks: [ 15192 "Analyzing invention background", 15193 "Classifying the field of invention", 15194 "Aligning all inputs", 15195 "Generating your draft structure" 15196 ] 15197 } 15198}; 15199 15200const CheckDescription = () => { 15201 const navigate = useNavigate(); 15202 const { appState, setAppState } = useAppData(); 15203 const { 15204 data, 15205 loading, 15206 error, 15207 startAsync 15208 } = useAsyncPolling(); 15209 const { 15210 data: estimateData, 15211 loading: estimateLoading, 15212 error: estimateError, 15213 startAsync: startEstimateAsync, 15214 featuresPendingReview} = useAsyncPolling(); 15215 const descriptionAsyncStartedRef = reactExports.useRef(false); 15216 const estimateAsyncStartedRef = reactExports.useRef(false); 15217 const generateDescription = async () => { 15218 const sessionId = localStorage.getItem(SESSION_ID_NAME); 15219 if (!sessionId || estimateAsyncStartedRef.current) { 15220 return; 15221 } 15222 estimateAsyncStartedRef.current = true; 15223 startEstimateAsync(async () => { 15224 const { data: data2 } = await axios.post(API_URLS.GENERATE_ESTIMATE_ASYNC, { 15225 session_id: sessionId 15226 }); 15227 return { session_id: data2.session_id }; 15228 }, "generate_estimate"); 15229 }; 15230 reactExports.useEffect(() => { 15231 if (!appState.updatedDescription && !appState.description) { 15232 navigate("/estimation/start"); 15233 return; 15234 } 15235 if (!descriptionAsyncStartedRef.current && appState.description) { 15236 descriptionAsyncStartedRef.current = true; 15237 startAsync(async () => { 15238 const { data: data2 } = await axios.post(API_URLS.SAVE_PROJECT_DESCRIPTION_ASYNC, { 15239 description: appState.description 15240 }); 15241 if (data2.session_id) { 15242 localStorage.setItem(SESSION_ID_NAME, data2.session_id); 15243 } 15244 return { session_id: data2.session_id }; 15245 }); 15246 } 15247 }, [appState.description, appState.updatedDescription]); 15248 reactExports.useEffect(() => { 15249 if (loading) return; 15250 if (data) { 15251 const { session_id, estimate_points_coverage: estimatePointsCoverage } = data; 15252 setAppState((prevState) => ({ 15253 ...prevState, 15254 estimatePointsCoverage 15255 })); 15256 if (session_id) { 15257 localStorage.setItem(SESSION_ID_NAME, session_id); 15258 } 15259 if (estimatePointsCoverage.length === 0) { 15260 generateDescription(); 15261 } else { 15262 navigate("/estimation/survey"); 15263 } 15264 } 15265 if (error) { 15266 console.log(error); 15267 } 15268 }, [data, loading, error, setAppState]); 15269 reactExports.useEffect(() => { 15270 if (estimateLoading) return; 15271 if (estimateData) { 15272 setAppState((prevState) => ({ 15273 ...prevState, 15274 estimationDataNoRestrictions: estimateData 15275 })); 15276 navigate("/estimation/final"); 15277 } 15278 if (estimateError) { 15279 console.log(estimateError); 15280 } 15281 }, [estimateData, estimateLoading, estimateError, navigate, setAppState]); 15282 const handleFeaturesSubmitted = reactExports.useCallback((shortVersionHtml) => { 15283 setAppState((prevState) => ({ 15284 ...prevState, 15285 shortVersionHtml 15286 })); 15287 navigate("/estimation/final"); 15288 }, [navigate, setAppState]); 15289 if (featuresPendingReview) { 15290 return /* @__PURE__ */ jsxRuntimeExports.jsx(FeatureSelection, { data: featuresPendingReview, onSubmitted: handleFeaturesSubmitted }); 15291 } 15292 return /* @__PURE__ */ jsxRuntimeExports.jsx( 15293 Loading, 15294 { 15295 info: loadingEstimationDescription.first, 15296 loading: loading || estimateLoading, 15297 progress: appState.descriptionUpdateCount > 0 ? 52 : 40 15298 } 15299 ); 15300}; 15301 15302const customTextArea = "_customTextArea_1utdr_1"; 15303const isFocused = "_isFocused_1utdr_6"; 15304const styles$4 = { 15305 customTextArea: customTextArea, 15306 isFocused: isFocused 15307}; 15308 15309const TextArea = ({ 15310 maxLength,
15311 value, 15312 onChange, 15313 placeholder, 15314 className, 15315 withAutosize, 15316 isFocused: initialIsFocused, 15317 ...rest 15318}) => { 15319 const textareaRef = reactExports.useRef(null); 15320 const [inputValue, setInputValue] = reactExports.useState(value || ""); 15321 const [isFocused, setIsFocused] = reactExports.useState(initialIsFocused); 15322 const handleInputChange = (event) => { 15323 const value2 = event.target.value.slice(0, maxLength); 15324 setInputValue(value2); 15325 onChange(value2); 15326 }; 15327 const handleFocus = (e) => { 15328 setIsFocused(true); 15329 rest.onFocus?.(e); 15330 }; 15331 reactExports.useEffect(() => { 15332 setInputValue(value || ""); 15333 }, [value]); 15334 reactExports.useEffect(() => { 15335 if (!withAutosize) return; 15336 const textarea = textareaRef.current; 15337 if (textarea) { 15338 textarea.style.height = "auto"; 15339 textarea.style.height = `${textarea.scrollHeight + 2}px`; 15340 } 15341 }, [value]); 15342 return /* @__PURE__ */ jsxRuntimeExports.jsx( 15343 "textarea", 15344 { 15345 ...rest, 15346 ref: textareaRef, 15347 placeholder, 15348 value: inputValue, 15349 className: cn(styles$4.customTextArea, "peer outline-none", { [styles$4.isFocused]: isFocused }, className), 15350 onFocus: handleFocus, 15351 onChange: handleInputChange 15352 } 15353 ); 15354}; 15355 15356const CheckSummary = () => { 15357 const navigate = useNavigate(); 15358 const { appState, setAppState } = useAppData(); 15359 const [textValue, setTextValue] = reactExports.useState(""); 15360 const [isFocused, setIsFocused] = reactExports.useState(false); 15361 const handleFocus = () => { 15362 setIsFocused(true); 15363 }; 15364 const handleBlur = () => { 15365 if (!textValue) { 15366 setIsFocused(false); 15367 } 15368 }; 15369 const handleSend = () => { 15370 setAppState((appState2) => ({ 15371 ...appState2, 15372 updatedDescription: textValue, 15373 descriptionUpdateCount: appState2.descriptionUpdateCount + 1 15374 })); 15375 navigate("/estimation/check-description", { 15376 state: { action: appState.descriptionUpdateCount + 1 === 2 ? "generate" : "edit" } 15377 }); 15378 }; 15379 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 15380 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 15381 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col h-[calc(100vh-136px)] md:h-[calc(100vh-152px)] md:mt-10 mb-6", children: [
15382 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 15383 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl text-grey", children: "Your creativity shines!" }), 15384 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Below is a list of key features based on your project ideas. Please take a moment to review and refine it as needed to ensure it captures your vision perfectly." }) 15385 ] }), 15386 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden relative rounded-3xl bg-nightfall mb-4 p-4" }), 15387 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden rounded-3xl bg-deep", children: [ 15388 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 grow flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 15389 TextArea, 15390 { 15391 isFocused, 15392 onChange: setTextValue, 15393 onFocus: handleFocus, 15394 onBlur: handleBlur, 15395 value: textValue, 15396 maxLength: 4e3, 15397 className: isFocused ? "h-[calc(220px-16px)] md:h-[calc(172px-16px)]" : "!h-9", 15398 placeholder: "What would you add or edit?" 15399 } 15400 ) }),
15401 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleSend, disabled: !textValue, className: "btn-main-circle", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) }) }) 15402 ] }), 15403 !textValue && !isFocused && /* @__PURE__ */ jsxRuntimeExports.jsxs(NavLink, { to: "/estimation/survey", className: "btn-main w-full mt-4", children: [ 15404 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: appState.descriptionUpdateCount === 1 ? "Continue" : "Continue without editing" }), 15405 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 15406 ] }) 15407 ] }), 15408 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed z-30 bottom-0 left-0 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-hidden bg-nightfall", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[6px] bg-gradient-to-r from-redLight to-sapphireLight", style: { width: "52%" } }) }) }) 15409 ] }); 15410}; 15411 15412var propTypes = {exports: {}}; 15413 15414/** 15415 * Copyright (c) 2013-present, Facebook, Inc. 15416 * 15417 * This source code is licensed under the MIT license found in the 15418 * LICENSE file in the root directory of this source tree. 15419 */ 15420 15421var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 15422 15423var ReactPropTypesSecret_1 = ReactPropTypesSecret$1; 15424 15425/** 15426 * Copyright (c) 2013-present, Facebook, Inc. 15427 * 15428 * This source code is licensed under the MIT license found in the 15429 * LICENSE file in the root directory of this source tree. 15430 */ 15431 15432var ReactPropTypesSecret = ReactPropTypesSecret_1; 15433 15434function emptyFunction() {} 15435function emptyFunctionWithReset() {} 15436emptyFunctionWithReset.resetWarningCache = emptyFunction; 15437 15438var factoryWithThrowingShims = function() { 15439 function shim(props, propName, componentName, location, propFullName, secret) { 15440 if (secret === ReactPropTypesSecret) { 15441 // It is still safe when called from React. 15442 return; 15443 } 15444 var err = new Error( 15445 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 15446 'Use PropTypes.checkPropTypes() to call them. ' + 15447 'Read more at http://fb.me/use-check-prop-types' 15448 ); 15449 err.name = 'Invariant Violation'; 15450 throw err; 15451 } shim.isRequired = shim; 15452 function getShim() { 15453 return shim; 15454 } // Important! 15455 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 15456 var ReactPropTypes = { 15457 array: shim, 15458 bigint: shim, 15459 bool: shim, 15460 func: shim, 15461 number: shim, 15462 object: shim, 15463 string: shim, 15464 symbol: shim, 15465 15466 any: shim, 15467 arrayOf: getShim, 15468 element: shim, 15469 elementType: shim, 15470 instanceOf: getShim, 15471 node: shim, 15472 objectOf: getShim, 15473 oneOf: getShim, 15474 oneOfType: getShim, 15475 shape: getShim, 15476 exact: getShim, 15477 15478 checkPropTypes: emptyFunctionWithReset, 15479 resetWarningCache: emptyFunction 15480 }; 15481 15482 ReactPropTypes.PropTypes = ReactPropTypes; 15483 15484 return ReactPropTypes; 15485}; 15486 15487{ 15488 propTypes.exports = factoryWithThrowingShims(); 15489} 15490 15491var propTypesExports = propTypes.exports; 15492const PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports); 15493 15494/****************************************************************************** 15495Copyright (c) Microsoft Corporation. 15496 15497Permission to use, copy, modify, and/or distribute this software for any 15498purpose with or without fee is hereby granted. 15499 15500THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 15501REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 15502AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 15503INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15504LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 15505OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15506PERFORMANCE OF THIS SOFTWARE. 15507***************************************************************************** */ 15508/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 15509 15510 15511function __awaiter(thisArg, _arguments, P, generator) { 15512 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 15513 return new (P || (P = Promise))(function (resolve, reject) { 15514 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 15515 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 15516 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 15517 step((generator = generator.apply(thisArg, _arguments || [])).next()); 15518 }); 15519} 15520 15521function __generator(thisArg, body) { 15522 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 15523 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 15524 function verb(n) { return function (v) { return step([n, v]); }; } 15525 function step(op) { 15526 if (f) throw new TypeError("Generator is already executing."); 15527 while (g && (g = 0, op[0] && (_ = 0)), _) try {
vendor: 5,187 bytes, lines 15528-15663
15528 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 15529 if (y = 0, t) op = [op[0] & 2, t.value]; 15530 switch (op[0]) { 15531 case 0: case 1: t = op; break; 15532 case 4: _.label++; return { value: op[1], done: false }; 15533 case 5: _.label++; y = op[1]; op = [0]; continue; 15534 case 7: op = _.ops.pop(); _.trys.pop(); continue; 15535 default: 15536 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 15537 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 15538 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 15539 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 15540 if (t[2]) _.ops.pop(); 15541 _.trys.pop(); continue; 15542 } 15543 op = body.call(thisArg, _); 15544 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 15545 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 15546 } 15547} 15548 15549function __read(o, n) { 15550 var m = typeof Symbol === "function" && o[Symbol.iterator]; 15551 if (!m) return o; 15552 var i = m.call(o), r, ar = [], e; 15553 try { 15554 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 15555 } 15556 catch (error) { e = { error: error }; } 15557 finally { 15558 try { 15559 if (r && !r.done && (m = i["return"])) m.call(i); 15560 } 15561 finally { if (e) throw e.error; } 15562 } 15563 return ar; 15564} 15565 15566function __spreadArray(to, from, pack) { 15567 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 15568 if (ar || !(i in from)) { 15569 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 15570 ar[i] = from[i]; 15571 } 15572 } 15573 return to.concat(ar || Array.prototype.slice.call(from)); 15574} 15575 15576typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 15577 var e = new Error(message); 15578 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 15579}; 15580 15581var COMMON_MIME_TYPES = new Map([ 15582 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types 15583 ['aac', 'audio/aac'], 15584 ['abw', 'application/x-abiword'], 15585 ['arc', 'application/x-freearc'], 15586 ['avif', 'image/avif'], 15587 ['avi', 'video/x-msvideo'], 15588 ['azw', 'application/vnd.amazon.ebook'], 15589 ['bin', 'application/octet-stream'], 15590 ['bmp', 'image/bmp'], 15591 ['bz', 'application/x-bzip'], 15592 ['bz2', 'application/x-bzip2'], 15593 ['cda', 'application/x-cdf'], 15594 ['csh', 'application/x-csh'], 15595 ['css', 'text/css'], 15596 ['csv', 'text/csv'], 15597 ['doc', 'application/msword'], 15598 ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], 15599 ['eot', 'application/vnd.ms-fontobject'], 15600 ['epub', 'application/epub+zip'], 15601 ['gz', 'application/gzip'], 15602 ['gif', 'image/gif'], 15603 ['heic', 'image/heic'], 15604 ['heif', 'image/heif'], 15605 ['htm', 'text/html'], 15606 ['html', 'text/html'], 15607 ['ico', 'image/vnd.microsoft.icon'], 15608 ['ics', 'text/calendar'], 15609 ['jar', 'application/java-archive'], 15610 ['jpeg', 'image/jpeg'], 15611 ['jpg', 'image/jpeg'], 15612 ['js', 'text/javascript'], 15613 ['json', 'application/json'], 15614 ['jsonld', 'application/ld+json'], 15615 ['mid', 'audio/midi'], 15616 ['midi', 'audio/midi'], 15617 ['mjs', 'text/javascript'], 15618 ['mp3', 'audio/mpeg'], 15619 ['mp4', 'video/mp4'], 15620 ['mpeg', 'video/mpeg'], 15621 ['mpkg', 'application/vnd.apple.installer+xml'], 15622 ['odp', 'application/vnd.oasis.opendocument.presentation'], 15623 ['ods', 'application/vnd.oasis.opendocument.spreadsheet'], 15624 ['odt', 'application/vnd.oasis.opendocument.text'], 15625 ['oga', 'audio/ogg'], 15626 ['ogv', 'video/ogg'], 15627 ['ogx', 'application/ogg'], 15628 ['opus', 'audio/opus'], 15629 ['otf', 'font/otf'], 15630 ['png', 'image/png'], 15631 ['pdf', 'application/pdf'], 15632 ['php', 'application/x-httpd-php'], 15633 ['ppt', 'application/vnd.ms-powerpoint'], 15634 ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], 15635 ['rar', 'application/vnd.rar'], 15636 ['rtf', 'application/rtf'], 15637 ['sh', 'application/x-sh'], 15638 ['svg', 'image/svg+xml'], 15639 ['swf', 'application/x-shockwave-flash'], 15640 ['tar', 'application/x-tar'], 15641 ['tif', 'image/tiff'], 15642 ['tiff', 'image/tiff'], 15643 ['ts', 'video/mp2t'], 15644 ['ttf', 'font/ttf'], 15645 ['txt', 'text/plain'], 15646 ['vsd', 'application/vnd.visio'], 15647 ['wav', 'audio/wav'], 15648 ['weba', 'audio/webm'], 15649 ['webm', 'video/webm'], 15650 ['webp', 'image/webp'], 15651 ['woff', 'font/woff'], 15652 ['woff2', 'font/woff2'], 15653 ['xhtml', 'application/xhtml+xml'], 15654 ['xls', 'application/vnd.ms-excel'], 15655 ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], 15656 ['xml', 'application/xml'], 15657 ['xul', 'application/vnd.mozilla.xul+xml'], 15658 ['zip', 'application/zip'], 15659 ['7z', 'application/x-7z-compressed'], 15660 // Others 15661 ['mkv', 'video/x-matroska'], 15662 ['mov', 'video/quicktime'], 15663 ['msg', 'application/vnd.ms-outlook']
15664]); 15665function toFileWithPath(file, path) { 15666 var f = withMimeType(file); 15667 if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path 15668 var webkitRelativePath = file.webkitRelativePath; 15669 Object.defineProperty(f, 'path', { 15670 value: typeof path === 'string' 15671 ? path 15672 // If <input webkitdirectory> is set, 15673 // the File will have a {webkitRelativePath} property 15674 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory 15675 : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0 15676 ? webkitRelativePath 15677 : file.name, 15678 writable: false, 15679 configurable: false, 15680 enumerable: true 15681 }); 15682 } 15683 return f; 15684} 15685function withMimeType(file) { 15686 var name = file.name; 15687 var hasExtension = name && name.lastIndexOf('.') !== -1; 15688 if (hasExtension && !file.type) { 15689 var ext = name.split('.') 15690 .pop().toLowerCase(); 15691 var type = COMMON_MIME_TYPES.get(ext); 15692 if (type) { 15693 Object.defineProperty(file, 'type', { 15694 value: type, 15695 writable: false, 15696 configurable: false, 15697 enumerable: true 15698 }); 15699 } 15700 } 15701 return file; 15702} 15703 15704var FILES_TO_IGNORE = [ 15705 // Thumbnail cache files for macOS and Windows 15706 '.DS_Store', 15707 'Thumbs.db' // Windows 15708]; 15709/** 15710 * Convert a DragEvent's DataTrasfer object to a list of File objects 15711 * NOTE: If some of the items are folders, 15712 * everything will be flattened and placed in the same list but the paths will be kept as a {path} property. 15713 * 15714 * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg 15715 * and a list of File objects will be returned. 15716 * 15717 * @param evt 15718 */ 15719function fromEvent(evt) { 15720 return __awaiter(this, void 0, void 0, function () { 15721 return __generator(this, function (_a) { 15722 if (isObject(evt) && isDataTransfer(evt.dataTransfer)) { 15723 return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)]; 15724 } 15725 else if (isChangeEvt(evt)) { 15726 return [2 /*return*/, getInputFiles(evt)]; 15727 } 15728 else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) { 15729 return [2 /*return*/, getFsHandleFiles(evt)]; 15730 } 15731 return [2 /*return*/, []]; 15732 }); 15733 }); 15734} 15735function isDataTransfer(value) { 15736 return isObject(value); 15737} 15738function isChangeEvt(value) { 15739 return isObject(value) && isObject(value.target); 15740} 15741function isObject(v) { 15742 return typeof v === 'object' && v !== null; 15743} 15744function getInputFiles(evt) { 15745 return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); }); 15746} 15747// Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle 15748function getFsHandleFiles(handles) { 15749 return __awaiter(this, void 0, void 0, function () { 15750 var files; 15751 return __generator(this, function (_a) { 15752 switch (_a.label) { 15753 case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))]; 15754 case 1: 15755 files = _a.sent(); 15756 return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })]; 15757 } 15758 }); 15759 }); 15760} 15761function getDataTransferFiles(dt, type) { 15762 return __awaiter(this, void 0, void 0, function () { 15763 var items, files; 15764 return __generator(this, function (_a) { 15765 switch (_a.label) { 15766 case 0: 15767 if (!dt.items) return [3 /*break*/, 2]; 15768 items = fromList(dt.items) 15769 .filter(function (item) { return item.kind === 'file'; }); 15770 // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents, 15771 // only 'dragstart' and 'drop' has access to the data (source node) 15772 if (type !== 'drop') { 15773 return [2 /*return*/, items]; 15774 } 15775 return [4 /*yield*/, Promise.all(items.map(toFilePromises))]; 15776 case 1: 15777 files = _a.sent(); 15778 return [2 /*return*/, noIgnoredFiles(flatten(files))]; 15779 case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files) 15780 .map(function (file) { return toFileWithPath(file); }))]; 15781 } 15782 }); 15783 }); 15784} 15785function noIgnoredFiles(files) { 15786 return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; }); 15787} 15788// IE11 does not support Array.from() 15789// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility 15790// https://developer.mozilla.org/en-US/docs/Web/API/FileList 15791// https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList 15792function fromList(items) { 15793 if (items === null) { 15794 return []; 15795 } 15796 var files = []; 15797 // tslint:disable: prefer-for-of 15798 for (var i = 0; i < items.length; i++) { 15799 var file = items[i]; 15800 files.push(file); 15801 } 15802 return files; 15803} 15804// https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem 15805function toFilePromises(item) { 15806 if (typeof item.webkitGetAsEntry !== 'function') { 15807 return fromDataTransferItem(item); 15808 } 15809 var entry = item.webkitGetAsEntry(); 15810 // Safari supports dropping an image node from a different window and can be retrieved using 15811 // the DataTransferItem.getAsFile() API 15812 // NOTE: FileSystemEntry.file() throws if trying to get the file 15813 if (entry && entry.isDirectory) { 15814 return fromDirEntry(entry); 15815 } 15816 return fromDataTransferItem(item); 15817} 15818function flatten(items) { 15819 return items.reduce(function (acc, files) { return __spreadArray(__spreadArray([], __read(acc), false), __read((Array.isArray(files) ? flatten(files) : [files])), false); }, []); 15820} 15821function fromDataTransferItem(item) { 15822 var file = item.getAsFile(); 15823 if (!file) { 15824 return Promise.reject("".concat(item, " is not a File")); 15825 } 15826 var fwp = toFileWithPath(file); 15827 return Promise.resolve(fwp); 15828} 15829// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
15830function fromEntry(entry) { 15831 return __awaiter(this, void 0, void 0, function () { 15832 return __generator(this, function (_a) { 15833 return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)]; 15834 }); 15835 }); 15836} 15837// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry 15838function fromDirEntry(entry) { 15839 var reader = entry.createReader(); 15840 return new Promise(function (resolve, reject) { 15841 var entries = []; 15842 function readEntries() { 15843 var _this = this; 15844 // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader 15845 // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries 15846 reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () { 15847 var files, err_1, items; 15848 return __generator(this, function (_a) { 15849 switch (_a.label) { 15850 case 0: 15851 if (!!batch.length) return [3 /*break*/, 5]; 15852 _a.label = 1; 15853 case 1: 15854 _a.trys.push([1, 3, , 4]); 15855 return [4 /*yield*/, Promise.all(entries)]; 15856 case 2: 15857 files = _a.sent(); 15858 resolve(files); 15859 return [3 /*break*/, 4]; 15860 case 3: 15861 err_1 = _a.sent(); 15862 reject(err_1); 15863 return [3 /*break*/, 4]; 15864 case 4: return [3 /*break*/, 6]; 15865 case 5: 15866 items = Promise.all(batch.map(fromEntry)); 15867 entries.push(items); 15868 // Continue reading 15869 readEntries(); 15870 _a.label = 6; 15871 case 6: return [2 /*return*/]; 15872 } 15873 }); 15874 }); }, function (err) { 15875 reject(err); 15876 }); 15877 } 15878 readEntries(); 15879 }); 15880} 15881// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry 15882function fromFileEntry(entry) { 15883 return __awaiter(this, void 0, void 0, function () { 15884 return __generator(this, function (_a) { 15885 return [2 /*return*/, new Promise(function (resolve, reject) { 15886 entry.file(function (file) { 15887 var fwp = toFileWithPath(file, entry.fullPath); 15888 resolve(fwp); 15889 }, function (err) { 15890 reject(err); 15891 }); 15892 })]; 15893 }); 15894 }); 15895} 15896 15897var _default$1 = function (file, acceptedFiles) { 15898 if (file && acceptedFiles) { 15899 var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(','); 15900 var fileName = file.name || ''; 15901 var mimeType = (file.type || '').toLowerCase(); 15902 var baseMimeType = mimeType.replace(/\/.*$/, ''); 15903 return acceptedFilesArray.some(function (type) { 15904 var validType = type.trim().toLowerCase(); 15905 15906 if (validType.charAt(0) === '.') { 15907 return fileName.toLowerCase().endsWith(validType); 15908 } else if (validType.endsWith('/*')) { 15909 // This is something like a image/* mime type 15910 return baseMimeType === validType.replace(/\/.*$/, ''); 15911 } 15912 15913 return mimeType === validType; 15914 }); 15915 } 15916 15917 return true; 15918}; 15919 15920function _toConsumableArray$2(arr) { return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$2(); } 15921 15922function _nonIterableSpread$2() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 15923 15924function _iterableToArray$2(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 15925 15926function _arrayWithoutHoles$2(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$2(arr); } 15927 15928function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 15929 15930function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEac
15930h(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 15931 15932function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 15933 15934function _slicedToArray$2(arr, i) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2(); } 15935 15936function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 15937 15938function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); } 15939 15940function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 15941 15942function _iterableToArrayLimit$2(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 15943 15944function _arrayWithHoles$2(arr) { if (Array.isArray(arr)) return arr; } 15945 15946var FILE_INVALID_TYPE = "file-invalid-type"; 15947var FILE_TOO_LARGE = "file-too-large"; 15948var FILE_TOO_SMALL = "file-too-small"; 15949var TOO_MANY_FILES = "too-many-files"; 15950 15951var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) { 15952 accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept; 15953 var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept; 15954 return { 15955 code: FILE_INVALID_TYPE, 15956 message: "File type must be ".concat(messageSuffix) 15957 }; 15958}; 15959var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) { 15960 return { 15961 code: FILE_TOO_LARGE, 15962 message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes") 15963 }; 15964}; 15965var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) { 15966 return { 15967 code: FILE_TOO_SMALL, 15968 message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes") 15969 }; 15970}; 15971var TOO_MANY_FILES_REJECTION = { 15972 code: TOO_MANY_FILES, 15973 message: "Too many files" 15974}; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with 15975// that MIME type will always be accepted 15976 15977function fileAccepted(file, accept) { 15978 var isAcceptable = file.type === "application/x-moz-file" || _default$1(file, accept); 15979 return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)]; 15980} 15981function fileMatchSize(file, minSize, maxSize) { 15982 if (isDefined(file.size)) { 15983 if (isDefined(minSize) && isDefined(maxSize)) { 15984 if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)]; 15985 if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)]; 15986 } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)]; 15987 } 15988 15989 return [true, null]; 15990} 15991 15992function isDefined(value) { 15993 return value !== undefined && value !== null; 15994} 15995/** 15996 * 15997 * @param {object} options 15998 * @param {File[]} options.files 15999 * @param {string|string[]} [options.accept] 16000 * @param {number} [options.minSize] 16001 * @param {number} [options.maxSize] 16002 * @param {boolean} [options.multiple] 16003 * @param {number} [options.maxFiles] 16004 * @param {(f: File) =>
16004 FileError|FileError[]|null} [options.validator] 16005 * @returns 16006 */ 16007 16008 16009function allFilesAccepted(_ref) { 16010 var files = _ref.files, 16011 accept = _ref.accept, 16012 minSize = _ref.minSize, 16013 maxSize = _ref.maxSize, 16014 multiple = _ref.multiple, 16015 maxFiles = _ref.maxFiles, 16016 validator = _ref.validator; 16017 16018 if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) { 16019 return false; 16020 } 16021 16022 return files.every(function (file) { 16023 var _fileAccepted = fileAccepted(file, accept), 16024 _fileAccepted2 = _slicedToArray$2(_fileAccepted, 1), 16025 accepted = _fileAccepted2[0]; 16026 16027 var _fileMatchSize = fileMatchSize(file, minSize, maxSize), 16028 _fileMatchSize2 = _slicedToArray$2(_fileMatchSize, 1), 16029 sizeMatch = _fileMatchSize2[0]; 16030 16031 var customErrors = validator ? validator(file) : null; 16032 return accepted && sizeMatch && !customErrors; 16033 }); 16034} // React's synthetic events has event.isPropagationStopped, 16035// but to remain compatibility with other libs (Preact) fall back 16036// to check event.cancelBubble 16037 16038function isPropagationStopped(event) { 16039 if (typeof event.isPropagationStopped === "function") { 16040 return event.isPropagationStopped(); 16041 } else if (typeof event.cancelBubble !== "undefined") { 16042 return event.cancelBubble; 16043 } 16044 16045 return false; 16046} 16047function isEvtWithFiles(event) { 16048 if (!event.dataTransfer) { 16049 return !!event.target && !!event.target.files; 16050 } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types 16051 // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file 16052 16053 16054 return Array.prototype.some.call(event.dataTransfer.types, function (type) { 16055 return type === "Files" || type === "application/x-moz-file"; 16056 }); 16057} 16058 16059function onDocumentDragOver(event) { 16060 event.preventDefault(); 16061} 16062 16063function isIe(userAgent) { 16064 return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1; 16065} 16066 16067function isEdge(userAgent) { 16068 return userAgent.indexOf("Edge/") !== -1; 16069} 16070 16071function isIeOrEdge() { 16072 var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent; 16073 return isIe(userAgent) || isEdge(userAgent); 16074} 16075/** 16076 * This is intended to be used to compose event handlers 16077 * They are executed in order until one of them calls `event.isPropagationStopped()`. 16078 * Note that the check is done on the first invoke too, 16079 * meaning that if propagation was stopped before invoking the fns, 16080 * no handlers will be executed. 16081 * 16082 * @param {Function} fns the event hanlder functions 16083 * @return {Function} the event handler to add to an element 16084 */ 16085 16086function composeEventHandlers() { 16087 for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) { 16088 fns[_key] = arguments[_key]; 16089 } 16090 16091 return function (event) { 16092 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 16093 args[_key2 - 1] = arguments[_key2]; 16094 } 16095 16096 return fns.some(function (fn) { 16097 if (!isPropagationStopped(event) && fn) { 16098 fn.apply(void 0, [event].concat(args)); 16099 } 16100 16101 return isPropagationStopped(event); 16102 }); 16103 }; 16104} 16105/** 16106 * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API) 16107 * is supported by the browser. 16108 * @returns {boolean} 16109 */ 16110 16111function canUseFileSystemAccessAPI() { 16112 return "showOpenFilePicker" in window; 16113} 16114/** 16115 * Convert the `{accept}` dropzone prop to the 16116 * `{types}` option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker 16117 * 16118 * @param {AcceptProp} accept 16119 * @returns {{accept: string[]}[]} 16120 */ 16121 16122function pickerOptionsFromAccept(accept) { 16123 if (isDefined(accept)) { 16124 var acceptForPicker = Object.entries(accept).filter(function (_ref2) { 16125 var _ref3 = _slicedToArray$2(_ref2, 2), 16126 mimeType = _ref3[0], 16127 ext = _ref3[1]; 16128 16129 var ok = true; 16130 16131 if (!isMIMEType(mimeType)) { 16132 console.warn("Skipped \"".concat(mimeType, "\" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.")); 16133 ok = false;
16134 } 16135 16136 if (!Array.isArray(ext) || !ext.every(isExt)) { 16137 console.warn("Skipped \"".concat(mimeType, "\" because an invalid file extension was provided.")); 16138 ok = false; 16139 } 16140 16141 return ok; 16142 }).reduce(function (agg, _ref4) { 16143 var _ref5 = _slicedToArray$2(_ref4, 2), 16144 mimeType = _ref5[0], 16145 ext = _ref5[1]; 16146 16147 return _objectSpread$1(_objectSpread$1({}, agg), {}, _defineProperty$2({}, mimeType, ext)); 16148 }, {}); 16149 return [{ 16150 // description is required due to https://crbug.com/1264708 16151 description: "Files", 16152 accept: acceptForPicker 16153 }]; 16154 } 16155 16156 return accept; 16157} 16158/** 16159 * Convert the `{accept}` dropzone prop to an array of MIME types/extensions. 16160 * @param {AcceptProp} accept 16161 * @returns {string} 16162 */ 16163 16164function acceptPropAsAcceptAttr(accept) { 16165 if (isDefined(accept)) { 16166 return Object.entries(accept).reduce(function (a, _ref6) { 16167 var _ref7 = _slicedToArray$2(_ref6, 2), 16168 mimeType = _ref7[0], 16169 ext = _ref7[1]; 16170 16171 return [].concat(_toConsumableArray$2(a), [mimeType], _toConsumableArray$2(ext)); 16172 }, []) // Silently discard invalid entries as pickerOptionsFromAccept warns about these 16173 .filter(function (v) { 16174 return isMIMEType(v) || isExt(v); 16175 }).join(","); 16176 } 16177 16178 return undefined; 16179} 16180/** 16181 * Check if v is an exception caused by aborting a request (e.g window.showOpenFilePicker()). 16182 * 16183 * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException. 16184 * @param {any} v 16185 * @returns {boolean} True if v is an abort exception. 16186 */ 16187 16188function isAbort(v) { 16189 return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR); 16190} 16191/** 16192 * Check if v is a security error. 16193 * 16194 * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException. 16195 * @param {any} v 16196 * @returns {boolean} True if v is a security error. 16197 */ 16198 16199function isSecurityError(v) { 16200 return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR); 16201} 16202/** 16203 * Check if v is a MIME type string. 16204 * 16205 * See accepted format: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers. 16206 * 16207 * @param {string} v 16208 */ 16209 16210function isMIMEType(v) { 16211 return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v); 16212} 16213/** 16214 * Check if v is a file extension. 16215 * @param {string} v 16216 */ 16217 16218function isExt(v) { 16219 return /^.*\.[\w]+$/.test(v); 16220} 16221/** 16222 * @typedef {Object.<string, string[]>} AcceptProp 16223 */ 16224 16225/** 16226 * @typedef {object} FileError 16227 * @property {string} message 16228 * @property {ErrorCode|string} code 16229 */ 16230 16231/** 16232 * @typedef {"file-invalid-type"|"file-too-large"|"file-too-small"|"too-many-files"} ErrorCode 16233 */ 16234 16235var _excluded$7 = ["children"], 16236 _excluded2$2 = ["open"], 16237 _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"], 16238 _excluded4 = ["refKey", "onChange", "onClick"]; 16239 16240function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); } 16241 16242function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 16243 16244function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 16245 16246function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); } 16247 16248function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); } 16249 16250function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 16251 16252function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } 16253 16254function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 16255 16256function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 16257 16258function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; } 16259 16260function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 16261 16262function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEac
16262h(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 16263 16264function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 16265 16266function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } 16267 16268function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } 16269/** 16270 * Convenience wrapper component for the `useDropzone` hook 16271 * 16272 * ```jsx 16273 * <Dropzone> 16274 * {({getRootProps, getInputProps}) => ( 16275 * <div {...getRootProps()}> 16276 * <input {...getInputProps()} /> 16277 * <p>Drag 'n' drop some files here, or click to select files</p> 16278 * </div> 16279 * )} 16280 * </Dropzone> 16281 * ``` 16282 */ 16283 16284var Dropzone = /*#__PURE__*/reactExports.forwardRef(function (_ref, ref) { 16285 var children = _ref.children, 16286 params = _objectWithoutProperties$1(_ref, _excluded$7); 16287 16288 var _useDropzone = useDropzone(params), 16289 open = _useDropzone.open, 16290 props = _objectWithoutProperties$1(_useDropzone, _excluded2$2); 16291 16292 reactExports.useImperativeHandle(ref, function () { 16293 return { 16294 open: open 16295 }; 16296 }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element 16297 16298 return /*#__PURE__*/e$2.createElement(reactExports.Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, { 16299 open: open 16300 }))); 16301}); 16302Dropzone.displayName = "Dropzone"; // Add default props for react-docgen 16303 16304var defaultProps$1 = { 16305 disabled: false, 16306 getFilesFromEvent: fromEvent, 16307 maxSize: Infinity, 16308 minSize: 0, 16309 multiple: true, 16310 maxFiles: 0, 16311 preventDropOnDocument: true, 16312 noClick: false, 16313 noKeyboard: false, 16314 noDrag: false, 16315 noDragEventsBubbling: false, 16316 validator: null, 16317 useFsAccessApi: true, 16318 autoFocus: false 16319}; 16320Dropzone.defaultProps = defaultProps$1; 16321Dropzone.propTypes = { 16322 /** 16323 * Render function that exposes the dropzone state and prop getter fns 16324 * 16325 * @param {object} params 16326 * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render 16327 * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render 16328 * @param {Function} params.open Open the native file selection dialog 16329 * @param {boolean} params.isFocused Dropzone area is in focus 16330 * @param {boolean} params.isFileDialogActive File dialog is opened 16331 * @param {boolean} params.isDragActive Active drag is in progress 16332 * @param {boolean} params.isDragAccept Dragged files are accepted 16333 * @param {boolean} params.isDragReject Some dragged files are rejected 16334 * @param {File[]} params.acceptedFiles Accepted files 16335 * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected 16336 */ 16337 children: PropTypes.func, 16338 16339 /** 16340 * Set accepted file types. 16341 * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information. 16342 * Keep in mind that mime type determination is not reliable across platforms. CSV files, 16343 * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under 16344 * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276). 16345 */ 16346 accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)), 16347 16348 /** 16349 * Allow drag 'n' drop (or selection from the file dialog) of multiple files 16350 */ 16351 multiple: PropTypes.bool, 16352 16353 /** 16354 * If false, allow dropped items to take over the current browser window 16355 */ 16356 preventDropOnDocument: PropTypes.bool, 16357 16358 /** 16359 * If true, disables click to open the native file selection dialog 16360 */ 16361 noClick: PropTypes.bool, 16362 16363 /** 16364 * If true, disables SPACE/ENTER to open the native file selection dialog. 16365 * Note that it also stops tracking the focus state. 16366 */ 16367 noKeyboard: PropTypes.bool, 16368 16369 /** 16370 * If true, disables drag 'n' drop 16371 */ 16372 noDrag: PropTypes.bool, 16373 16374 /** 16375 * If true, stops drag event propagation to parents 16376 */ 16377 noDragEventsBubbling: PropTypes.bool, 16378 16379 /** 16380 * Minimum file size (in bytes) 16381 */ 16382 minSize: PropTypes.number, 16383 16384 /** 16385 * Maximum file size (in bytes) 16386 */ 16387 maxSize: PropTypes.number, 16388 16389 /** 16390 * Maximum accepted number of files 16391 * The default value is 0 which means there is no limitation to how many files are accepted. 16392 */ 16393 maxFiles: PropTypes.number, 16394 16395 /** 16396 * Enable/disable the dropzone 16397 */ 16398 disabled: PropTypes.bool, 16399 16400 /** 16401 * Use this to provide a custom file aggregator 16402 * 16403 * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog) 16404 */ 16405 getFilesFromEvent: PropTypes.func, 16406 16407 /** 16408 * Cb for when closing the file dialog with no selection 16409 */ 16410 onFileDialogCancel: PropTypes.func, 16411 16412 /** 16413 * Cb for when opening the file dialog 16414 */ 16415 onFileDialogOpen: PropTypes.func, 16416 16417 /** 16418 * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API 16419 * to open the file picker instead of using an `<input type="file">` click event. 16420 */ 16421 useFsAccessApi: PropTypes.bool, 16422 16423 /** 16424 * Set to true to focus the root element on render 16425 */ 16426 autoFocus: PropTypes.bool, 16427 16428 /** 16429 * Cb for when the `dragenter` event occurs. 16430 * 16431 * @param {DragEvent} event 16432 */ 16433 onDragEnter: PropTypes.func, 16434 16435 /** 16436 * Cb for when the `dragleave` event occurs 16437 * 16438 * @param {DragEvent} event 16439 */ 16440 onDragLeave: PropTypes.func, 16441 16442 /** 16443 * Cb for when the `dragover` event occurs 16444 * 16445 * @param {DragEvent} event 16446 */ 16447 onDragOver: PropTypes.func, 16448 16449 /** 16450 * Cb for when the `drop` event occurs. 16451 * Note that this callback is invoked after the `getFilesFromEvent` callback is done. 16452 * 16453 * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props. 16454 * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension. 16455 * If `multiple` is set to false and additional files are dropped, 16456 * all files besides the first will be rejected. 16457 * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well. 16458 * 16459 * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
16460 * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props. 16461 * 16462 * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server. 16463 * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library: 16464 * 16465 * ```js 16466 * function onDrop(acceptedFiles) { 16467 * const req = request.post('/upload') 16468 * acceptedFiles.forEach(file => { 16469 * req.attach(file.name, file) 16470 * }) 16471 * req.end(callback) 16472 * } 16473 * ``` 16474 * 16475 * @param {File[]} acceptedFiles 16476 * @param {FileRejection[]} fileRejections 16477 * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog) 16478 */ 16479 onDrop: PropTypes.func, 16480 16481 /** 16482 * Cb for when the `drop` event occurs. 16483 * Note that if no files are accepted, this callback is not invoked. 16484 * 16485 * @param {File[]} files 16486 * @param {(DragEvent|Event)} event 16487 */ 16488 onDropAccepted: PropTypes.func, 16489 16490 /** 16491 * Cb for when the `drop` event occurs. 16492 * Note that if no files are rejected, this callback is not invoked. 16493 * 16494 * @param {FileRejection[]} fileRejections 16495 * @param {(DragEvent|Event)} event 16496 */ 16497 onDropRejected: PropTypes.func, 16498 16499 /** 16500 * Cb for when there's some error from any of the promises. 16501 * 16502 * @param {Error} error 16503 */ 16504 onError: PropTypes.func, 16505 16506 /** 16507 * Custom validation function. It must return null if there's no errors. 16508 * @param {File} file 16509 * @returns {FileError|FileError[]|null} 16510 */ 16511 validator: PropTypes.func 16512}; 16513/** 16514 * A function that is invoked for the `dragenter`, 16515 * `dragover` and `dragleave` events. 16516 * It is not invoked if the items are not files (such as link, text, etc.). 16517 * 16518 * @callback dragCb 16519 * @param {DragEvent} event 16520 */ 16521 16522/** 16523 * A function that is invoked for the `drop` or input change event. 16524 * It is not invoked if the items are not files (such as link, text, etc.). 16525 * 16526 * @callback dropCb 16527 * @param {File[]} acceptedFiles List of accepted files 16528 * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected 16529 * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog) 16530 */ 16531 16532/** 16533 * A function that is invoked for the `drop` or input change event. 16534 * It is not invoked if the items are files (such as link, text, etc.). 16535 * 16536 * @callback dropAcceptedCb 16537 * @param {File[]} files List of accepted files that meet the given criteria 16538 * (`accept`, `multiple`, `minSize`, `maxSize`) 16539 * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog) 16540 */ 16541 16542/** 16543 * A function that is invoked for the `drop` or input change event. 16544 * 16545 * @callback dropRejectedCb 16546 * @param {File[]} files List of rejected files that do not meet the given criteria 16547 * (`accept`, `multiple`, `minSize`, `maxSize`) 16548 * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog) 16549 */ 16550 16551/** 16552 * A function that is used aggregate files, 16553 * in a asynchronous fashion, from drag or input change events. 16554 * 16555 * @callback getFilesFromEvent 16556 * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog) 16557 * @returns {(File[]|Promise<File[]>)} 16558 */ 16559 16560/** 16561 * An object with the current dropzone state. 16562 * 16563 * @typedef {object} DropzoneState 16564 * @property {boolean} isFocused Dropzone area is in focus 16565 * @property {boolean} isFileDialogActive File dialog is opened 16566 * @property {boolean} isDragActive Active drag is in progress 16567 * @property {boolean} isDragAccept Dragged files are accepted 16568 * @property {boolean} isDragReject Some dragged files are rejected 16569 * @property {File[]} acceptedFiles Accepted files 16570 * @property {FileRejection[]} fileRejections Rejected files and why they were rejected 16571 */ 16572 16573/** 16574 * An object with the dropzone methods. 16575 * 16576 * @typedef {object} DropzoneMethods 16577 * @property {Function} getRootProps Returns the props you should apply to the root drop container you render 16578 * @property {Function} getInputProps Returns the props you should apply to hidden file input you render 16579 * @property {Function} open Open the native file selection dialog 16580 */ 16581 16582var initialState = { 16583 isFocused: false, 16584 isFileDialogActive: false, 16585 isDragActive: false, 16586 isDragAccept: false, 16587 isDragReject: false, 16588 acceptedFiles: [], 16589 fileRejections: [] 16590}; 16591/** 16592 * A React hook that creates a drag 'n' drop area. 16593 * 16594 * ```jsx 16595 * function MyDropzone(props) { 16596 * const {getRootProps, getInputProps} = useDropzone({ 16597 * onDrop: acceptedFiles => {
16598 * // do something with the File objects, e.g. upload to some server 16599 * } 16600 * }); 16601 * return ( 16602 * <div {...getRootProps()}> 16603 * <input {...getInputProps()} /> 16604 * <p>Drag and drop some files here, or click to select files</p> 16605 * </div> 16606 * ) 16607 * } 16608 * ``` 16609 * 16610 * @function useDropzone 16611 * 16612 * @param {object} props 16613 * @param {import("./utils").AcceptProp} [props.accept] Set accepted file types. 16614 * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information. 16615 * Keep in mind that mime type determination is not reliable across platforms. CSV files, 16616 * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under 16617 * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276). 16618 * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files 16619 * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window 16620 * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog 16621 * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog. 16622 * Note that it also stops tracking the focus state. 16623 * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop 16624 * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents 16625 * @param {number} [props.minSize=0] Minimum file size (in bytes) 16626 * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes) 16627 * @param {boolean} [props.disabled=false] Enable/disable the dropzone 16628 * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator 16629 * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection 16630 * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API 16631 * to open the file picker instead of using an `<input type="file">` click event. 16632 * @param {boolean} autoFocus Set to true to auto focus the root element. 16633 * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog 16634 * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs. 16635 * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs 16636 * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs 16637 * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs. 16638 * Note that this callback is invoked after the `getFilesFromEvent` callback is done. 16639 * 16640 * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props. 16641 * `accept` must be an object with keys as a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) and the value an array of file extensions (optional). 16642 * If `multiple` is set to false and additional files are dropped, 16643 * all files besides the first will be rejected. 16644 * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well. 16645 * 16646 * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected. 16647 * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props. 16648 * 16649 * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server. 16650 * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library: 16651 * 16652 * ```js 16653 * function onDrop(acceptedFiles) { 16654 * const req = request.post('/upload') 16655 * acceptedFiles.forEach(file => { 16656 * req.attach(file.name, file) 16657 * }) 16658 * req.end(callback) 16659 * } 16660 * ``` 16661 * @param {dropAcceptedCb} [props.onDropAccepted] 16662 * @param {dropRejectedCb} [props.onDropRejected] 16663 * @param {(error: Error) => void} [props.onError] 16664 * 16665 * @returns {DropzoneState & DropzoneMethods} 16666 */ 16667 16668function useDropzone() { 16669 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 16670 16671 var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps$1), props), 16672 accept = _defaultProps$props.accept, 16673 disabled = _defaultProps$props.disabled, 16674 getFilesFromEvent = _defaultProps$props.getFilesFromEvent, 16675 maxSize = _defaultProps$props.maxSize, 16676 minSize = _defaultProps$props.minSize, 16677 multiple = _defaultProps$props.multiple, 16678 maxFiles = _defaultProps$props.maxFiles, 16679 onDragEnter = _defaultProps$props.onDragEnter, 16680 onDragLeave = _defaultProps$props.onDragLeave, 16681 onDragOver = _defaultProps$props.onDragOver, 16682 onDrop = _defaultProps$props.onDrop, 16683 onDropAccepted = _defaultProps$props.onDropAccepted, 16684 onDropRejected = _defaultProps$props.onDropRejected, 16685 onFileDialogCancel = _defaultProps$props.onFileDialogCancel, 16686 onFileDialogOpen = _defaultProps$props.onFileDialogOpen, 16687 useFsAccessApi = _defaultProps$props.useFsAccessApi, 16688 autoFocus = _defaultProps$props.autoFocus, 16689 preventDropOnDocument = _defaultProps$props.preventDropOnDocument, 16690 noClick = _defaultProps$props.noClick, 16691 noKeyboard = _defaultProps$props.noKeyboard, 16692 noDrag = _defaultProps$props.noDrag, 16693 noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, 16694 onError = _defaultProps$props.onError, 16695 validator = _defaultProps$props.validator; 16696 16697 var acceptAttr = reactExports.useMemo(function () { 16698 return acceptPropAsAcceptAttr(accept); 16699 }, [accept]); 16700 var pickerTypes = reactExports.useMemo(function () { 16701 return pickerOptionsFromAccept(accept); 16702 }, [accept]); 16703 var onFileDialogOpenCb = reactExports.useMemo(function () { 16704 return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop$2; 16705 }, [onFileDialogOpen]); 16706 var onFileDialogCancelCb = reactExports.useMemo(function () { 16707 return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop$2; 16708 }, [onFileDialogCancel]); 16709 /** 16710 * @constant 16711 * @type {React.MutableRefObject<HTMLElement>} 16712 */ 16713 16714 var rootRef = reactExports.useRef(null); 16715 var inputRef = reactExports.useRef(null); 16716 16717 var _useReducer = reactExports.useReducer(reducer, initialState), 16718 _useReducer2 = _slicedToArray$1(_useReducer, 2), 16719 state = _useReducer2[0], 16720 dispatch = _useReducer2[1]; 16721 16722 var isFocused = state.isFocused, 16723 isFileDialogActive = state.isFileDialogActive; 16724 var fsAccessApiWorksRef = reactExports.useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); // Update file dialog active state when the window is focused on 16725 16726 var onWindowFocus = function onWindowFocus() { 16727 // Execute the timeout only if the file dialog is opened in the browser 16728 if (!fsAccessApiWorksRef.current && isFileDialogActive) { 16729 setTimeout(function () { 16730 if (inputRef.current) { 16731 var files = inputRef.current.files; 16732 16733 if (!files.length) { 16734 dispatch({ 16735 type: "closeDialog" 16736 }); 16737 onFileDialogCancelCb(); 16738 } 16739 } 16740 }, 300); 16741 } 16742 }; 16743 16744 reactExports.useEffect(function () { 16745 window.addEventListener("focus", onWindowFocus, false); 16746 return function () { 16747 window.removeEventListener("focus", onWindowFocus, false); 16748 }; 16749 }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]); 16750 var dragTargetsRef = reactExports.useRef([]); 16751 16752 var onDocumentDrop = function onDocumentDrop(event) { 16753 if (rootRef.current && rootRef.current.contains(event.target)) { 16754 // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler 16755 return; 16756 } 16757 16758 event.preventDefault(); 16759 dragTargetsRef.current = []; 16760 }; 16761 16762 reactExports.useEffect(function () { 16763 if (preventDropOnDocument) { 16764 document.addEventListener("dragover", onDocumentDragOver, false); 16765 document.addEventListener("drop", onDocumentDrop, false); 16766 } 16767 16768 return function () { 16769 if (preventDropOnDocument) { 16770 document.removeEventListener("dragover", onDocumentDragOver); 16771 document.removeEventListener("drop", onDocumentDrop); 16772 } 16773 }; 16774 }, [rootRef, preventDropOnDocument]); // Auto focus the root when autoFocus is true 16775 16776 reactExports.useEffect(function () { 16777 if (!disabled && autoFocus && rootRef.current) { 16778 rootRef.current.focus(); 16779 } 16780 16781 return function () {}; 16782 }, [rootRef, autoFocus, disabled]); 16783 var onErrCb = reactExports.useCallback(function (e) { 16784 if (onError) { 16785 onError(e); 16786 } else { 16787 // Let the user know something's gone wrong if they haven't provided the onError cb. 16788 console.error(e); 16789 } 16790 }, [onError]); 16791 var onDragEnterCb = reactExports.useCallback(function (event) { 16792 event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done 16793 16794 event.persist(); 16795 stopPropagation(event); 16796 dragTargetsRef.current = [].concat(_toConsumableArray$1(dragTargetsRef.current), [event.target]); 16797 16798 if (isEvtWithFiles(event)) { 16799 Promise.resolve(getFilesFromEvent(event)).then(function (files) { 16800 if (isPropagationStopped(event) && !noDragEventsBubbling) { 16801 return; 16802 } 16803 16804 var fileCount = files.length; 16805 var isDragAccept = fileCount > 0 && allFilesAccepted({ 16806 files: files, 16807 accept: acceptAttr, 16808 minSize: minSize, 16809 maxSize: maxSize, 16810 multiple: multiple, 16811 maxFiles: maxFiles, 16812 validator: validator 16813 }); 16814 var isDragReject = fileCount > 0 && !isDragAccept; 16815 dispatch({ 16816 isDragAccept: isDragAccept, 16817 isDragReject: isDragReject, 16818 isDragActive: true, 16819 type: "setDraggedFiles" 16820 }); 16821 16822 if (onDragEnter) { 16823 onDragEnter(event); 16824 } 16825 }).catch(function (e) { 16826 return onErrCb(e); 16827 }); 16828 } 16829 }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]); 16830 var onDragOverCb = reactExports.useCallback(function (event) { 16831 event.preventDefault(); 16832 event.persist(); 16833 stopPropagation(event); 16834 var hasFiles = isEvtWithFiles(event); 16835 16836 if (hasFiles && event.dataTransfer) {
16837 try { 16838 event.dataTransfer.dropEffect = "copy"; 16839 } catch (_unused) {} 16840 /* eslint-disable-line no-empty */ 16841 16842 } 16843 16844 if (hasFiles && onDragOver) { 16845 onDragOver(event); 16846 } 16847 16848 return false; 16849 }, [onDragOver, noDragEventsBubbling]); 16850 var onDragLeaveCb = reactExports.useCallback(function (event) { 16851 event.preventDefault(); 16852 event.persist(); 16853 stopPropagation(event); // Only deactivate once the dropzone and all children have been left 16854 16855 var targets = dragTargetsRef.current.filter(function (target) { 16856 return rootRef.current && rootRef.current.contains(target); 16857 }); // Make sure to remove a target present multiple times only once 16858 // (Firefox may fire dragenter/dragleave multiple times on the same element) 16859 16860 var targetIdx = targets.indexOf(event.target); 16861 16862 if (targetIdx !== -1) { 16863 targets.splice(targetIdx, 1); 16864 } 16865 16866 dragTargetsRef.current = targets; 16867 16868 if (targets.length > 0) { 16869 return; 16870 } 16871 16872 dispatch({ 16873 type: "setDraggedFiles", 16874 isDragActive: false, 16875 isDragAccept: false, 16876 isDragReject: false 16877 }); 16878 16879 if (isEvtWithFiles(event) && onDragLeave) { 16880 onDragLeave(event); 16881 } 16882 }, [rootRef, onDragLeave, noDragEventsBubbling]); 16883 var setFiles = reactExports.useCallback(function (files, event) { 16884 var acceptedFiles = []; 16885 var fileRejections = []; 16886 files.forEach(function (file) { 16887 var _fileAccepted = fileAccepted(file, acceptAttr), 16888 _fileAccepted2 = _slicedToArray$1(_fileAccepted, 2), 16889 accepted = _fileAccepted2[0], 16890 acceptError = _fileAccepted2[1]; 16891 16892 var _fileMatchSize = fileMatchSize(file, minSize, maxSize), 16893 _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 2), 16894 sizeMatch = _fileMatchSize2[0], 16895 sizeError = _fileMatchSize2[1]; 16896 16897 var customErrors = validator ? validator(file) : null; 16898 16899 if (accepted && sizeMatch && !customErrors) { 16900 acceptedFiles.push(file); 16901 } else { 16902 var errors = [acceptError, sizeError]; 16903 16904 if (customErrors) { 16905 errors = errors.concat(customErrors); 16906 } 16907 16908 fileRejections.push({ 16909 file: file, 16910 errors: errors.filter(function (e) { 16911 return e; 16912 }) 16913 }); 16914 } 16915 }); 16916 16917 if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) { 16918 // Reject everything and empty accepted files 16919 acceptedFiles.forEach(function (file) { 16920 fileRejections.push({ 16921 file: file, 16922 errors: [TOO_MANY_FILES_REJECTION] 16923 }); 16924 }); 16925 acceptedFiles.splice(0); 16926 } 16927 16928 dispatch({ 16929 acceptedFiles: acceptedFiles, 16930 fileRejections: fileRejections, 16931 type: "setFiles" 16932 }); 16933 16934 if (onDrop) { 16935 onDrop(acceptedFiles, fileRejections, event); 16936 } 16937 16938 if (fileRejections.length > 0 && onDropRejected) { 16939 onDropRejected(fileRejections, event); 16940 } 16941 16942 if (acceptedFiles.length > 0 && onDropAccepted) { 16943 onDropAccepted(acceptedFiles, event); 16944 } 16945 }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]); 16946 var onDropCb = reactExports.useCallback(function (event) { 16947 event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done 16948 16949 event.persist(); 16950 stopPropagation(event); 16951 dragTargetsRef.current = []; 16952 16953 if (isEvtWithFiles(event)) { 16954 Promise.resolve(getFilesFromEvent(event)).then(function (files) { 16955 if (isPropagationStopped(event) && !noDragEventsBubbling) { 16956 return; 16957 } 16958 16959 setFiles(files, event); 16960 }).catch(function (e) { 16961 return onErrCb(e); 16962 }); 16963 } 16964 16965 dispatch({ 16966 type: "reset" 16967 }); 16968 }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); // Fn for opening the file dialog programmatically 16969 16970 var openFileDialog = reactExports.useCallback(function () { 16971 // No point to use FS access APIs if context is not secure 16972 // https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#feature_detection 16973 if (fsAccessApiWorksRef.current) { 16974 dispatch({ 16975 type: "openDialog" 16976 }); 16977 onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker 16978 16979 var opts = { 16980 multiple: multiple, 16981 types: pickerTypes 16982 }; 16983 window.showOpenFilePicker(opts).then(function (handles) { 16984 return getFilesFromEvent(handles); 16985 }).then(function (files) { 16986 setFiles(files, null); 16987 dispatch({ 16988 type: "closeDialog" 16989 }); 16990 }).catch(function (e) { 16991 // AbortError means the user canceled 16992 if (isAbort(e)) { 16993 onFileDialogCancelCb(e); 16994 dispatch({ 16995 type: "closeDialog" 16996 }); 16997 } else if (isSecurityError(e)) { 16998 fsAccessApiWorksRef.current = false; // CORS, so cannot use this API 16999 // Try using the input 17000 17001 if (inputRef.current) { 17002 inputRef.current.value = null; 17003 inputRef.current.click(); 17004 } else { 17005 onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.")); 17006 } 17007 } else { 17008 onErrCb(e); 17009 } 17010 }); 17011 return; 17012 } 17013 17014 if (inputRef.current) { 17015 dispatch({ 17016 type: "openDialog" 17017 }); 17018 onFileDialogOpenCb(); 17019 inputRef.current.value = null; 17020 inputRef.current.click(); 17021 } 17022 }
17022, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone 17023 17024 var onKeyDownCb = reactExports.useCallback(function (event) { 17025 // Ignore keyboard events bubbling up the DOM tree 17026 if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) { 17027 return; 17028 } 17029 17030 if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) { 17031 event.preventDefault(); 17032 openFileDialog(); 17033 } 17034 }, [rootRef, openFileDialog]); // Update focus state for the dropzone 17035 17036 var onFocusCb = reactExports.useCallback(function () { 17037 dispatch({ 17038 type: "focus" 17039 }); 17040 }, []); 17041 var onBlurCb = reactExports.useCallback(function () { 17042 dispatch({ 17043 type: "blur" 17044 }); 17045 }, []); // Cb to open the file dialog when click occurs on the dropzone 17046 17047 var onClickCb = reactExports.useCallback(function () { 17048 if (noClick) { 17049 return; 17050 } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout() 17051 // to ensure React can handle state changes 17052 // See: https://github.com/react-dropzone/react-dropzone/issues/450 17053 17054 17055 if (isIeOrEdge()) { 17056 setTimeout(openFileDialog, 0); 17057 } else { 17058 openFileDialog(); 17059 } 17060 }, [noClick, openFileDialog]); 17061 17062 var composeHandler = function composeHandler(fn) { 17063 return disabled ? null : fn; 17064 }; 17065 17066 var composeKeyboardHandler = function composeKeyboardHandler(fn) { 17067 return noKeyboard ? null : composeHandler(fn); 17068 }; 17069 17070 var composeDragHandler = function composeDragHandler(fn) { 17071 return noDrag ? null : composeHandler(fn); 17072 }; 17073 17074 var stopPropagation = function stopPropagation(event) { 17075 if (noDragEventsBubbling) { 17076 event.stopPropagation(); 17077 } 17078 }; 17079 17080 var getRootProps = reactExports.useMemo(function () { 17081 return function () { 17082 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 17083 _ref2$refKey = _ref2.refKey, 17084 refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, 17085 role = _ref2.role, 17086 onKeyDown = _ref2.onKeyDown, 17087 onFocus = _ref2.onFocus, 17088 onBlur = _ref2.onBlur, 17089 onClick = _ref2.onClick, 17090 onDragEnter = _ref2.onDragEnter, 17091 onDragOver = _ref2.onDragOver, 17092 onDragLeave = _ref2.onDragLeave, 17093 onDrop = _ref2.onDrop, 17094 rest = _objectWithoutProperties$1(_ref2, _excluded3); 17095 17096 return _objectSpread(_objectSpread(_defineProperty$1({ 17097 onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)), 17098 onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)), 17099 onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)), 17100 onClick: composeHandler(composeEventHandlers(onClick, onClickCb)), 17101 onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)), 17102 onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)), 17103 onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)), 17104 onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)), 17105 role: typeof role === "string" && role !== "" ? role : "presentation" 17106 }, refKey, rootRef), !disabled && !noKeyboard ? { 17107 tabIndex: 0 17108 } : {}), rest); 17109 }; 17110 }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]); 17111 var onInputElementClick = reactExports.useCallback(function (event) { 17112 event.stopPropagation(); 17113 }, []); 17114 var getInputProps = reactExports.useMemo(function () { 17115 return function () { 17116 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 17117 _ref3$refKey = _ref3.refKey, 17118 refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, 17119 onChange = _ref3.onChange, 17120 onClick = _ref3.onClick, 17121 rest = _objectWithoutProperties$1(_ref3, _excluded4); 17122 17123 var inputProps = _defineProperty$1({ 17124 accept: acceptAttr, 17125 multiple: multiple, 17126 type: "file", 17127 style: { 17128 display: "none" 17129 }, 17130 onChange: composeHandler(composeEventHandlers(onChange, onDropCb)), 17131 onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)), 17132 tabIndex: -1 17133 }, refKey, inputRef); 17134 17135 return _objectSpread(_objectSpread({}, inputProps), rest); 17136 }; 17137 }, [inputRef, accept, multiple, onDropCb, disabled]); 17138 return _objectSpread(_objectSpread({}, state), {}, { 17139 isFocused: isFocused && !disabled, 17140 getRootProps: getRootProps,
17141 getInputProps: getInputProps, 17142 rootRef: rootRef, 17143 inputRef: inputRef, 17144 open: composeHandler(openFileDialog) 17145 }); 17146} 17147/** 17148 * @param {DropzoneState} state 17149 * @param {{type: string} & DropzoneState} action 17150 * @returns {DropzoneState} 17151 */ 17152 17153function reducer(state, action) { 17154 /* istanbul ignore next */ 17155 switch (action.type) { 17156 case "focus": 17157 return _objectSpread(_objectSpread({}, state), {}, { 17158 isFocused: true 17159 }); 17160 17161 case "blur": 17162 return _objectSpread(_objectSpread({}, state), {}, { 17163 isFocused: false 17164 }); 17165 17166 case "openDialog": 17167 return _objectSpread(_objectSpread({}, initialState), {}, { 17168 isFileDialogActive: true 17169 }); 17170 17171 case "closeDialog": 17172 return _objectSpread(_objectSpread({}, state), {}, { 17173 isFileDialogActive: false 17174 }); 17175 17176 case "setDraggedFiles": 17177 return _objectSpread(_objectSpread({}, state), {}, { 17178 isDragActive: action.isDragActive, 17179 isDragAccept: action.isDragAccept, 17180 isDragReject: action.isDragReject 17181 }); 17182 17183 case "setFiles": 17184 return _objectSpread(_objectSpread({}, state), {}, { 17185 acceptedFiles: action.acceptedFiles, 17186 fileRejections: action.fileRejections 17187 }); 17188 17189 case "reset": 17190 return _objectSpread({}, initialState); 17191 17192 default: 17193 return state; 17194 } 17195} 17196 17197function noop$2() {} 17198 17199const useStartData = () => { 17200 const [isFileMode, setIsFileMode] = reactExports.useState(false); 17201 const [showNDA, setShowNDA] = reactExports.useState(!sessionStorage.getItem(SESSION_NDA_NAME)); 17202 const [showNDAModal, setShowNDAModal] = reactExports.useState(false); 17203 const [searchParams] = useSearchParams(); 17204 const [textValue, setTextValue] = reactExports.useState(searchParams.get("project_description") ?? ""); 17205 const [isFocused, setIsFocused] = reactExports.useState(!!searchParams.get("project_description")?.length); 17206 const { setAppState } = useAppData(); 17207 const navigate = useNavigate(); 17208 const handleInputChange = (value) => { 17209 setTextValue(value); 17210 }; 17211 const handleError = (error) => { 17212 console.log(error); 17213 }; 17214 const onOpenDialog = () => { 17215 document.body.style.overflow = "clip"; 17216 setShowNDAModal(true); 17217 }; 17218 const onCloseDialog = () => { 17219 document.body.style.overflow = "unset"; 17220 setShowNDAModal(false); 17221 }; 17222 const onSubmitData = ({ nda_file }) => { 17223 sessionStorage.setItem(SESSION_NDA_NAME, "true"); 17224 downloadBase64File(nda_file, "NDA.pdf"); 17225 setShowNDA(false); 17226 onCloseDialog(); 17227 }; 17228 const onSend = async (text) => { 17229 setAppState((prev) => ({ 17230 ...prev, 17231 description: text 17232 })); 17233 navigate("/estimation/check-description"); 17234 }; 17235 const handleSend = () => { 17236 onSend(textValue); 17237 }; 17238 const switchModeHandler = (event) => { 17239 event.stopPropagation(); 17240 event.preventDefault(); 17241 setTextValue(""); 17242 setIsFileMode(!isFileMode); 17243 }; 17244 const handleFocus = () => { 17245 setIsFocused(true); 17246 }; 17247 const onDropRejected = reactExports.useCallback( 17248 (files) => { 17249 const errors = files.map((file) => file.errors); 17250 const message = errors[0].map((error) => error.message).join(". "); 17251 handleError(message); 17252 }, 17253 [handleError] 17254 ); 17255 const onDrop = reactExports.useCallback( 17256 (acceptedFiles) => { 17257 if (acceptedFiles.length === 0) { 17258 return; 17259 } 17260 const file = acceptedFiles[0]; 17261 navigate("/estimation/check-file-description", { state: { file } }); 17262 }, 17263 [onSend] 17264 ); 17265 reactExports.useEffect(() => { 17266 localStorage.removeItem(SESSION_ID_NAME); 17267 localStorage.removeItem(STATE_ID_NAME); 17268 setAppState(initialState$1); 17269 }, [setAppState]); 17270 const { getRootProps, getInputProps, isDragActive } = useDropzone({ 17271 onDrop, 17272 onDropRejected, 17273 noKeyboard: true, 17274 noClick: false, 17275 multiple: false 17276 }); 17277 return { 17278 textValue, 17279 isFileMode, 17280 isFocused, 17281 isDragActive, 17282 showNDA: false, 17283 showNDAModal, 17284 handleInputChange, 17285 handleSend, 17286 switchModeHandler, 17287 handleFocus, 17288 getRootProps, 17289 getInputProps, 17290 onCloseDialog, 17291 onOpenDialog, 17292 onSubmitData 17293 }; 17294}; 17295 17296const interval = 50; 17297const useAnimatePlaceholder = ({ placeholders, value }) => { 17298 const [index, setIndex] = reactExports.useState(0); 17299 const [placeholder, setPlaceholder] = reactExports.useState(""); 17300 reactExports.useEffect(() => { 17301 let place = ""; 17302 if (value) return; 17303 const typingInterval = setInterval(() => { 17304 if (place.length < placeholders[index].length) { 17305 place += placeholders[index][place.length]; 17306 setPlaceholder(place); 17307 } else { 17308 setTimeout(() => { 17309 clearInterval(typingInterval); 17310 const deletingInterval = setInterval(() => { 17311 if (place.length > 0) { 17312 place = place.slice(0, place.length - 1); 17313 setPlaceholder(place); 17314 } else { 17315 clearInterval(deletingInterval); 17316 setIndex((index + 1) % placeholders.length); 17317 } 17318 }, 75); 17319 }, 1e3); 17320 } 17321 }, interval); 17322 return () => clearInterval(typingInterval); 17323 }, [index, placeholders, value]); 17324 return placeholder; 17325}; 17326 17327const startPlaceholders = [ 17328 "Describe your project", 17329 "What are the main features of your project?", 17330 "Who are the main team members?", 17331 "What are the technical requirements?", 17332 "How long will the project take?" 17333]; 17334 17335const CombinedTextArea = ({ 17336 textValue, 17337 isFileMode, 17338 isFocused, 17339 handleInputChange, 17340 handleSend, 17341 switchModeHandler, 17342 handleFocus, 17343 getRootProps, 17344 getInputProps, 17345 isDragActive, 17346 maxLength = 8192 17347}) => { 17348 const placeholder = useAnimatePlaceholder({ placeholders: startPlaceholders, value: textValue });
17349 return isFileMode || isDragActive ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getRootProps(), className: cn("flex flex-col md:flex-row gap-2 md:items-end group"), children: [ 17350 /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }), 17351 /* @__PURE__ */ jsxRuntimeExports.jsxs( 17352 "div", 17353 { 17354 className: cn( 17355 "relative w-full h-[172px] rounded-3xl p-4 flex items-center justify-center border border-dashed bg-deep border-muted", 17356 { "border-redLight": isDragActive } 17357 ), 17358 children: [ 17359 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: switchModeHandler, className: "btn-main-circle", title: "Attach a file", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--paperclip-bold] text-2xl leading-none" }) }) }), 17360 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex flex-col items-center justify-center gap-4", children: [
17361 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--upload-bold] text-[56px] text-white" }), 17362 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-greyGentle text-center", children: "Drop your file here to upload them quickly and easily." }) 17363 ] }) 17364 ] 17365 } 17366 ) 17367 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex flex-col md:flex-row gap-2 md:items-end group", isFocused && "is-focused"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative grow overflow-hidden rounded-3xl flex w-full h-auto group-[.is-focused]:h-auto bg-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-2 grow flex", children: [ 17368 /* @__PURE__ */ jsxRuntimeExports.jsx( 17369 TextArea, 17370 { 17371 isFocused, 17372 onFocus: handleFocus, 17373 onChange: handleInputChange, 17374 maxLength, 17375 placeholder, 17376 value: textValue 17377 } 17378 ), 17379 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-2 right-[72px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: switchModeHandler, className: "btn-main-circle", title: "Attach a file", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--paperclip-bold] text-2xl leading-none" }) }) }), 17380 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { disabled: !textValue, onClick: handleSend, className: "btn-main-circle bg-gray-100", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--plain-bold] text-2xl leading-none" }) }) }) 17381 ] }) }) }); 17382}; 17383 17384const inputWrapper$2 = "_inputWrapper_i3pzp_1"; 17385const input$2 = "_input_i3pzp_1"; 17386const modalBackdrop$1 = "_modalBackdrop_i3pzp_8"; 17387const modal = "_modal_i3pzp_8"; 17388const textBlock = "_textBlock_i3pzp_26"; 17389const styles$3 = { 17390 inputWrapper: inputWrapper$2, 17391 input: input$2, 17392 modalBackdrop: modalBackdrop$1, 17393 modal: modal, 17394 textBlock: textBlock 17395}; 17396 17397const NDA = (props) => { 17398 const [info, setInfo] = reactExports.useState({ 17399 first_name: "", 17400 last_name: "", 17401 email: "" 17402 }); 17403 const [emailError, setEmailError] = reactExports.useState(false); 17404 const handleInputChange = (e) => { 17405 const { name, value } = e.target; 17406 setEmailError(false); 17407 setInfo((prev) => ({ ...prev, [name]: value })); 17408 }; 17409 const handleSubmit = async () => { 17410 try { 17411 const emailRexex = new RegExp( 17412 "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" 17413 ); 17414 if (!emailRexex.test(info.email)) { 17415 setEmailError(true); 17416 } 17417 const { data } = await axios.post(API_URLS.SIGN_NDA, info); 17418 props.onSubmitData({ nda_file: data.nda_file_base64 }); 17419 } catch (e) { 17420 console.log(e); 17421 } 17422 }; 17423 if (!props.show) { 17424 return null; 17425 } 17426 return reactDomExports.createPortal( 17427 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$3.modalBackdrop, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$3.modal, children: [
17428 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "md:hidden shrink-0 p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "dark:block", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, width: "83", alt: "Costquest" }) }) }), 17429 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-6 pl-4 md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "cursor-pointer flex items-center", onClick: props.onCloseDialog, children: [ 17430 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--alt-arrow-left-linear] text-l text-lavender" }), 17431 "Back" 17432 ] }) }), 17433 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-muted p-4", children: [ 17434 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-l font-medium text-grey", children: "Non-Disclosure Agreement" }), 17435 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "Before you share your idea, we must sign a non-disclosure agreement with you." }) 17436 ] }),
17437 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4 p-4", children: [ 17438 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 17439 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "first_name", className: "text-grey text-xs", children: "First name:" }), 17440 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$3.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 17441 "input", 17442 { 17443 className: styles$3.input, 17444 type: "text", 17445 id: "first_name", 17446 name: "first_name", 17447 onChange: handleInputChange, 17448 placeholder: "Enter your first name" 17449 } 17450 ) }) 17451 ] }), 17452 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 17453 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "last_name", className: "text-grey text-xs", children: "Last name:" }),
17454 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$3.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 17455 "input", 17456 { 17457 className: styles$3.input, 17458 type: "text", 17459 id: "last_name", 17460 name: "last_name", 17461 onChange: handleInputChange, 17462 placeholder: "Enter your last name" 17463 } 17464 ) }) 17465 ] }), 17466 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 17467 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "email", className: "text-grey text-xs", children: "Email:" }), 17468 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(styles$3.inputWrapper, emailError && "border-red-500"), children: /* @__PURE__ */ jsxRuntimeExports.jsx( 17469 "input", 17470 { 17471 className: styles$3.input, 17472 type: "email", 17473 id: "email", 17474 name: "email", 17475 onChange: handleInputChange, 17476 placeholder: "[email protected]" 17477 } 17478 ) }) 17479 ] }) 17480 ] }),
17481 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-1 text-grey text-xs whitespace-break-spaces overflow-auto px-4 my-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { children: [ 17482 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17483 "This non-disclosure undertaking (the ", 17484 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: '"Undertaking"' }), 17485 ") is entered into and made effective in the city of Hamburg, Federal Republic of Germany on the date set out on the cover page above, by ", 17486 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "SDH IT GmbH" }), 17487 ", a legal entity under the laws of Federal Republic of Germany, registration number DE306650237, with its registered address at: Anckelmannplatz 1, EG, Aufgang C, Hamburg, 20537 represented by ", 17488 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "Vasyl Kuchma" }), 17489 ", acting by virtue of a charter (the ",
17490 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: '"Undertaking Party"' }), 17491 "), in favor of each and every visitor, user or client of the services, resources, applications, platforms, and other products created by the Undertaking Party (the ", 17492 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: '"Disclosing Party"' }), 17493 ") (hereinafter collectively referred to from time to time as the ", 17494 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: '"Parties"' }), 17495 " and each individually as the ", 17496 /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: '"Party"' }), 17497 ")." 17498 ] }), 17499 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "WHEREAS:" }) }), 17500 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "(A) The Undertaking Party provides access to its services, resources, applications, platforms, and other products, during the use of which the Disclosing Party may provide information that could be confidential in nature." }),
17501 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "(B) The Undertaking Party undertakes to protect and maintain the confidentiality of all such information in accordance with the terms set out in this Undertaking." }), 17502 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: cn(styles$3.textBlock, "font-bold"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("i", { children: "NOW, THEREFORE, the Undertaking Party agrees and undertakes as follows:" }) }), 17503 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "1. SUBJECT MATTER OF UNDERTAKING" }) }), 17504 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.1 This Undertaking shall regulate the relations between the Parties with respect to the transfer, use, and storage of Confidential information, as this term is defined below, related to the joint activities of the Parties, aimed at establishing cooperation and fulfilment of the respective obligations between the Parties." }),
17505 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17506 '1.2 For the purposes of this Undertaking the "Confidential information" means any and all information that the Disclosing Party discloses to the Undertaking Party during the use of it services, resources, applications, platforms, and other products, which includes, but is not limited to the following:', 17507 " " 17508 ] }), 17509 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.2.1 all information received from the Disclosing Party in verbal form or in tangible form, whether or not identified as confidential, proprietary, or in any other similar manner;" }), 17510 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17511 "1.2.2 any information concerning the business, financial condition, operations, assets, and liabilities of the Disclosing Party;", 17512 " " 17513 ] }), 17514 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.2.3 any notes, analyses, calculations, or other documents prepared by the Disclosing Party, which contain, reflect, or are based upon, in whole or in part, Confidential information;" }),
17515 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.2.4 technical information, know-how, processes, discoveries, inventions, researches, designs, drawings, operational data, electronic files and data compilations, service techniques, service documentation, production methods, computer architectures, and computer software;" }), 17516 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.2.5 other commercial or financial information relating to current activity and future plans of the Parties, both already received and to be further received in any form; technical specifications; experimental information;" }), 17517 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.2.6 information of third parties given under confidentiality terms; statements on business activity, technologies, methods, software, trade secrets as well as other data of the clients or suppliers of the Parties, the affiliated entities and business partners of the Parties being of restricted nature;" }),
17518 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.2.7 other information which is qualified as confidential by effective laws of Ukraine." }), 17519 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.3 Confidential information does not include information that:" }), 17520 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.3.1 is publicly known at the time of its disclosure by the Disclosing Party to the Undertaking Party;" }), 17521 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.3.2 comes into the public domain after being disclosed by the Disclosing Party to the Undertaking Party through no fault of the Undertaking Party;" }), 17522 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17523 "1.3.3 is received by the Undertaking Party from a third party without liabilities on such information disclosure provided that the Undertaking Party may prove such receipt; or", 17524 " " 17525 ] }),
17526 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "1.3.4 is disclosed by the Undertaking Party with the written consent of the Disclosing Party." }), 17527 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17528 "1.4 The Undertaking Party is entitled to disclose Confidential information to the third party without obtaining the consent of the Disclosing Party to the extent that this is required by law, by any court of relevant jurisdictions, or by a governmental or regulatory authority.", 17529 " " 17530 ] }), 17531 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "2. OBLIGATIONS OF THE UNDERTAKING PARTY" }) }), 17532 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "2.1 The Undertaking Party undertakes to keep Confidential information secure and properly protected against theft, damage, loss, and unauthorized access." }),
17533 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "2.2 While receiving, developing or having access to the Confidential information the Undertaking Party undertakes to refrain from disclosure or provision of such Confidential information (as well as from deliberate permitting to access such information or enabling such accession), directly or indirectly to any third person without obtaining the prior approval of the Disclosing Party." }), 17534 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "2.3 The Undertaking Party agrees to exercise at least the same degree of care in protecting the Confidential information as it would for its own confidential information, but in no event less than a reasonable degree of care." }), 17535 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "2.4 The Undertaking Party undertakes not to use or attempt to use Confidential information for his/her own needs or at the request of the third persons, or for any purpose that is not for the direct benefit of the Disclosing Party, or in any other manner which may injure or cause losses either directly or indirectly to the Disclosing Party (or any of his business partners) or may be likely to do so unless such use has been permitted by the Disclosing Party or is required by legislation." }),
17536 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17537 "2.5 The Undertaking Party shall disclose the Confidential information only to those employees, advisors and consultants, for whom the awareness of the Confidential information is necessary in connection with the fulfilment of their official duties and shall request each such employee, advisor and consultant receiving the Confidential information to sign the written commitment on non-disclosure and confidentiality of the Confidential information.", 17538 " " 17539 ] }), 17540 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "2.6 Upon the Disclosing Partyâs request, or upon termination of access to the services, resources, applications, or platforms, the Undertaking Party agrees to promptly return or destroy all copies of the Confidential information in its possession or control, and to certify in writing that it has complied with this obligation." }), 17541 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "2.7 In case the Undertaking Party becomes aware of the improper use of Confidential information by other persons, the Undertaking Party undertakes to immediately notify the Disclosing Party of such improper use, inform the names of those involved and those, permitted such improper use, the facts, and circumstances of such improper use." }),
17542 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "3. TERM OF UNDERTAKING" }) }), 17543 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "3.1 Unless otherwise agreed in writing by the Undertaking Party, this Undertaking shall become effective on the date of execution and shall remain in full force and effect for a period of five (5) years from the date of disclosure of any Confidential information to the Undertaking Party." }), 17544 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "3.2 Notwithstanding the above, for any Confidential information that qualifies as a trade secret or is otherwise protected under applicable law, the confidentiality obligations shall remain in effect for as long as such information remains confidential and is not generally known to the public unless otherwise agreed in writing by the Disclosing Party." }), 17545 /* @__P
17545URE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "4. RESPONSIBILITY OF THE UNDERTAKING PARTY" }) }), 17546 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "4.1 In the event of a breach of this Undertaking, the Undertaking Party undertakes to reimburse the other Party for all direct expenses and losses suffered due to such violation, and uncollected profits (lost profits)." }), 17547 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "4.2 The Undertaking Party shall not be liable for any damages or losses incurred by the Disclosing Party arising from the proper use of Confidential Information in accordance with the express terms and conditions of this Undertaking." }), 17548 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "4.3 The Undertaking Party shall not be liable for any indirect, consequential, or incidental damages unless such damages result from gross negligence or willful misconduct." }),
17549 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "5. SETTLEMENT OF DISPUTES" }) }), 17550 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "5.1 Any and all disputes arising out of or in connection with performance hereof shall be settled by negotiations between the Parties." }), 17551 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "5.2 If a respective dispute may not be settled by negotiations, it shall be finally settled in accordance with the Arbitration Rules of the German Arbitration Institute (DIS) without recourse to the ordinary courts of law. The arbitral tribunal shall be comprised of a sole arbitrator. The seat of the arbitration is Munich, Germany. The language of the arbitration shall be English." }), 17552 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "6. MISCELLANEOUS" }) }),
17553 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "6.1 This Undertaking constitutes a legally binding public offer. " }), 17554 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: styles$3.textBlock, children: [ 17555 "6.2 By accessing or using the services, resources, applications, platforms, and other products provided by the Undertaking Party, the Disclosing Party acknowledges and accepts the terms of this Undertaking. Acceptance is deemed to occur upon the first use of any such service or resource.", 17556 " " 17557 ] }), 17558 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "6.3 The Undertaking Party reserves the right to amend the terms of this Undertaking. Any amendments shall become effective upon their publication on the Undertaking Partyâs official website or through any other official communication channels. Continued use of the services after the publication of amendments shall be deemed as acceptance of the amended terms." }),
17559 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "6.4 This Undertaking is personal to the Parties and may not be assigned, transferred, or delegated to any third party without the prior written consent of the other Party." }), 17560 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: styles$3.textBlock, children: "6.5 This Undertaking shall be governed by and construed in accordance with the legislation of Federal Republic of Germany." }) 17561 ] }) }), 17562 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-t border-muted p-4 flex justify-end gap-2", children: [ 17563 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main-outlined hidden md:block", onClick: props.onCloseDialog, children: "Cancel" }), 17564 /* @__PURE__ */ jsxRuntimeExports.jsxs( 17565 "button", 17566 { 17567 disabled: !info.email || !info.first_name || !info.last_name, 17568 className: "btn-main w-full md:w-auto", 17569 onClick: handleSubmit, 17570 children: [ 17571 "Confirm and Sign",
17572 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--check-circle-bold] text-2xl leading-none" }) 17573 ] 17574 } 17575 ) 17576 ] }) 17577 ] }) }), 17578 document.body 17579 ); 17580}; 17581 17582const Card = ({ description, text }) => { 17583 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grow p-4 rounded-2xl bg-deepTransparent", children: [ 17584 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-2 md:mb-4 text-xs font-semibold", children: text }), 17585 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-greyGentle", children: description }) 17586 ] }); 17587}; 17588 17589const Start = () => { 17590 const props = useStartData(); 17591 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 17592 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 17593 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative max-w-[900px] mx-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "md:pt-[12.5vh]", children: [
17594 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 17595 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Get Your Project Cost Estimate right now!" }), 17596 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Simply share a brief description of your product idea or drop here a project description document, and we'll generate a customized cost estimate for you. Get started now and turn your vision into a reality!" }) 17597 ] }), 17598 props.showNDA, 17599 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 17600 /* @__PURE__ */ jsxRuntimeExports.jsx(CombinedTextArea, { ...props }), 17601 !!props.textValue.length && !props.isFileMode && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end text-sm text-greyGentle mt-2", children: [ 17602 props.textValue.length, 17603 "/8192" 17604 ] }) 17605 ] }),
17606 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col md:flex-row gap-4 md:gap-6", children: [ 17607 /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { text: "âï¸ Be Clear and Concise", description: "Describe your product's purpose and features." }), 17608 /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { text: "ð Highlight Uniqueness", description: "Mention what makes your product special." }), 17609 /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { text: "âï¸ Include Tech Specs", description: "Add any technical details that are relevant." }) 17610 ] }) 17611 ] }) }), 17612 /* @__PURE__ */ jsxRuntimeExports.jsx(NDA, { ...props, show: props.showNDAModal }) 17613 ] }); 17614}; 17615 17616const QuestionItemComponent = ({ onChange, onChangeBudgetLimits, name, title, placeholder, type }) => { 17617 const [value, setValue] = reactExports.useState(false); 17618 const handleRadioChange = (e) => { 17619 setValue(e.target.value === "1"); 17620 onChange(e.target.value === "1"); 17621 if (e.target.value !== "1") { 17622 onChangeBudgetLimits(""); 17623 } 17624 }; 17625 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 w-full rounded-2xl bg-nightfall", children: [ 17626 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-4 text-s font-semibold md:text-m md:font-medium", children: title }), 17627 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("mb-4 flex gap-2 items-center py-2"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs( 17628 "label", 17629 { 17630 "aria-label": "No", 17631 className: "relative -m-0.5 p-0.5 flex cursor-pointer items-center gap-2 focus:outline-none", 17632 children: [
17633 /* @__PURE__ */ jsxRuntimeExports.jsx("input", { onChange: handleRadioChange, type: "radio", name, value: "0", className: "peer sr-only" }), 17634 /* @__PURE__ */ jsxRuntimeExports.jsx( 17635 "span", 17636 { 17637 "aria-hidden": "true", 17638 className: "h-5 w-5 rounded-full ring-2 border-4 bg-clip-padding border-transparent ring-soft hover:ring-lavender peer-checked:ring-lavender peer-checked:bg-lavender hover:peer-checked:ring-soft hover:peer-checked:bg-soft" 17639 } 17640 ), 17641 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-s", children: "No" }) 17642 ] 17643 } 17644 ) }), 17645 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 flex gap-2 items-center", children: [ 17646 /* @__PURE__ */ jsxRuntimeExports.jsxs( 17647 "label", 17648 { 17649 "aria-label": "Yes", 17650 className: "relative -m-0.5 p-0.5 flex cursor-pointer items-center gap-2 focus:outline-none", 17651 children: [ 17652 /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "radio", onChange: handleRadioChange, name, value: "1", className: "peer sr-only" }),
17653 /* @__PURE__ */ jsxRuntimeExports.jsx( 17654 "span", 17655 { 17656 "aria-hidden": "true", 17657 className: "h-5 w-5 rounded-full ring-2 border-4 bg-clip-padding border-transparent ring-soft hover:ring-lavender peer-checked:ring-lavender peer-checked:bg-lavender hover:peer-checked:ring-soft hover:peer-checked:bg-soft" 17658 } 17659 ), 17660 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-s", children: "Yes" }) 17661 ] 17662 } 17663 ), 17664 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-grow max-w-[205px] flex items-center w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 17665 "input", 17666 { 17667 type: "text", 17668 onChange: (e) => onChangeBudgetLimits(e.target.value), 17669 placeholder, 17670 className: cn( 17671 { ["opacity-0"]: !value }, 17672 "w-[205px] p-2 bg-transparent placeholder:text-greyGentle placeholder:font-normal border-b border-muted focus:border-lavender text-xs font-semibold focus:outline-none" 17673 ) 17674 } 17675 ) }), 17676 !!value && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 bg-muted rounded-lg p-2 items-center flex gap-2 text-s", children: type === "budget" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17677 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--euro-bold] text-2xl leading-none text-lavender" }), 17678 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-greySilver", children: "Euro" }) 17679 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 17680 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--calendar-bold] text-2xl leading-none text-lavender" }), 17681 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-greySilver", children: "Months" }) 17682 ] }) }) 17683 ] }) 17684 ] }); 17685}; 17686const QuestionItem = reactExports.memo(QuestionItemComponent); 17687 17688const Questions = () => { 17689 const navigate = useNavigate(); 17690 const { setAppState } = useAppData(); 17691 const [budgetLimits, setBudgetLimits] = reactExports.useState(null); 17692 const [timeLimits, setTimeLimits] = reactExports.useState(null); 17693 const [budgetLimitsValue, setBudgetLimitsValue] = reactExports.useState(""); 17694 const [timeLimitsValue, setTimeLimitsValue] = reactExports.useState(""); 17695 const isSubmitDisabled = reactExports.useMemo(() => { 17696 if (budgetLimits === null || timeLimits === null) { 17697 return true; 17698 } 17699 if (budgetLimits && budgetLimitsValue === "" || timeLimits && timeLimitsValue === "") { 17700 return true; 17701 } 17702 return false; 17703 }, [budgetLimits, budgetLimitsValue, timeLimits, timeLimitsValue]); 17704 const handleSubmit = async () => { 17705 setAppState((appState) => ({ 17706 ...appState, 17707 budget_limit: budgetLimitsValue, 17708 time_limit: timeLimitsValue 17709 })); 17710 navigate("/estimation/check-limits"); 17711 }; 17712 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 17713 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 17714 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative max-w-[900px] mx-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "md:pt-10", children: [
17715 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 17716 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "You're almost there!" }), 17717 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Just answer a few more questions to help us make the evaluation as accurate as possible." }) 17718 ] }), 17719 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 md:gap-6 items-start", children: [ 17720 /* @__PURE__ */ jsxRuntimeExports.jsx( 17721 QuestionItem, 17722 { 17723 onChange: setBudgetLimits, 17724 onChangeBudgetLimits: setBudgetLimitsValue, 17725 name: "budget-limits", 17726 title: "Do you have some budget limits?", 17727 placeholder: "Enter your budget amount", 17728 type: "budget" 17729 } 17730 ), 17731 /* @__PURE__ */ jsxRuntimeExports.jsx( 17732 QuestionItem, 17733 { 17734 onChange: setTimeLimits, 17735 onChangeBudgetLimits: setTimeLimitsValue, 17736 name: "time-limits", 17737 title: "Do you have some time limits?", 17738 placeholder: "Enter your time amount", 17739 type: "time" 17740 } 17741 ),
17742 /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main w-full md:w-auto", disabled: isSubmitDisabled, onClick: handleSubmit, children: [ 17743 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 17744 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 17745 ] }) 17746 ] }) 17747 ] }) }) 17748 ] }); 17749}; 17750 17751const ProgressCircle = ({ progress = 0 }) => { 17752 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative size-12 md:size-20", children: [ 17753 /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className: "size-full -rotate-90", viewBox: "0 0 36 36", xmlns: "http://www.w3.org/2000/svg", children: [ 17754 /* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: "gradient", children: [ 17755 /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset: "0%", stopColor: "#1C7EFF" }), 17756 /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset: "100%", stopColor: "#FF656F" }) 17757 ] }) }),
17758 /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "18", cy: "18", r: "16", fill: "none", className: "stroke-current text-gentle", strokeWidth: "2" }), 17759 /* @__PURE__ */ jsxRuntimeExports.jsx( 17760 "circle", 17761 { 17762 cx: "18", 17763 cy: "18", 17764 r: "16", 17765 fill: "none", 17766 stroke: "url(#gradient)", 17767 strokeWidth: "2", 17768 strokeDasharray: "100", 17769 strokeDashoffset: 100 - ((isNaN(progress) ? 0 : progress) > 100 ? 100 : isNaN(progress) ? 0 : progress), 17770 strokeLinecap: "round" 17771 } 17772 ) 17773 ] }), 17774 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-1/2 start-1/2 transform -translate-y-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-center text-xxs md:text-s font-bold text-grey", children: [ 17775 progress > 100 ? 100 : progress, 17776 "%" 17777 ] }) }) 17778 ] }); 17779}; 17780 17781const useSurvey = () => { 17782 const { appState } = useAppData(); 17783 const navigate = useNavigate(); 17784 const { estimatePointsCoverage } = appState; 17785 const [steps, setSteps] = reactExports.useState([]); 17786 const [currentStep, setCurrentStep] = reactExports.useState(0); 17787 const [history, setHistory] = reactExports.useState([]); 17788 const [hasNavigatedBack, setHasNavigatedBack] = reactExports.useState(false); 17789 reactExports.useEffect(() => { 17790 const stepsNotCovered = estimatePointsCoverage?.filter((el) => !el.is_covered) ?? []; 17791 setSteps(stepsNotCovered); 17792 setCurrentStep(0); 17793 setHistory([]); 17794 setHasNavigatedBack(false); 17795 }, []); 17796 const goBack = () => { 17797 setHasNavigatedBack(true); 17798 setHistory((prev) => { 17799 if (!prev.length) return prev; 17800 const next = prev.slice(0, -1); 17801 const prevStep = prev[prev.length - 1]; 17802 setCurrentStep(prevStep); 17803 return next; 17804 }); 17805 }; 17806 const onSubmit = async (value) => { 17807 setHistory((prev) => [...prev, currentStep]); 17808 const { data } = await axios.patch(API_URLS.COST_ESTIMATE + steps[currentStep]?.slug + "/", { 17809 session_id: localStorage.getItem(SESSION_ID_NAME) ?? void 0, 17810 ...value 17811 }); 17812 setSteps(data); 17813 let nextStep = 0; 17814 if (hasNavigatedBack) { 17815 nextStep = currentStep + 1; 17816 } else { 17817 while (data[nextStep]?.is_covered) { 17818 nextStep++; 17819 } 17820 } 17821 if (nextStep >= data.length) { 17822 navigate("/estimation/check-survey"); 17823 } else { 17824 setCurrentStep(nextStep); 17825 } 17826 }; 17827 return { steps, currentStep, onSubmit, goBack, canGoBack: history.length > 0 }; 17828}; 17829 17830const QuestionTile = ({ iconName, title, subtitle = "", radioName, radioId, onClick }) => { 17831 const optimizedIconName = iconName.replace(/icon-|[[\]]/g, "").replace("--", ":"); 17832 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 17833 "div", 17834 { 17835 className: "relative flex-1 flex flex-col", 17836 onClick: (e) => { 17837 e.stopPropagation(); 17838 e.preventDefault(); 17839 onClick?.(radioName); 17840 }, 17841 children: [
17842 /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "radio", name: radioName, id: radioId, className: "absolute hidden peer" }), 17843 /* @__PURE__ */ jsxRuntimeExports.jsxs( 17844 "label", 17845 { 17846 htmlFor: radioId, 17847 className: "grow flex flex-col items-start p-4 rounded-lg border border-soft cursor-pointer hover:border-lavender hover:bg-muted peer-checked:border-lavender peer-checked:bg-muted", 17848 children: [ 17849 /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: optimizedIconName, className: "text-m md:text-l leading-none mb-2 md:mb-4 text-lavender" }), 17850 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs md:text-s font-medium text-grey", children: title }), 17851 subtitle && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle mt-1", children: subtitle }) 17852 ] 17853 } 17854 ) 17855 ] 17856 } 17857 ); 17858}; 17859 17860const SingleChoice = ({ step, onSubmit }) => { 17861 const handleSubmit = (value) => { 17862 onSubmit({ 17863 choice: value 17864 }); 17865 }; 17866 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-6 gap-4 rounded-2xl md:gap-6 bg-nightfall text-grey", children: [ 17867 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s font-semibold md:text-m md:font-medium", children: step.question }), 17868 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-3 md:flex-row md:gap-6", children: step.choices.map((el) => /* @__PURE__ */ jsxRuntimeExports.jsx( 17869 QuestionTile, 17870 { 17871 iconName: `icon-[${el.icon}]`, 17872 title: el.name, 17873 subtitle: el.description, 17874 radioName: el.slug, 17875 radioId: step.slug, 17876 onClick: handleSubmit 17877 }, 17878 el.slug 17879 )) }) 17880 ] }); 17881}; 17882 17883function _typeof(o) { 17884 "@babel/helpers - typeof"; 17885 17886 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 17887 return typeof o; 17888 } : function (o) { 17889 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 17890 }, _typeof(o); 17891} 17892 17893function toPrimitive(t, r) { 17894 if ("object" != _typeof(t) || !t) return t; 17895 var e = t[Symbol.toPrimitive]; 17896 if (void 0 !== e) { 17897 var i = e.call(t, r); 17898 if ("object" != _typeof(i)) return i; 17899 throw new TypeError("@@toPrimitive must return a primitive value."); 17900 } 17901 return ("string" === r ? String : Number)(t); 17902} 17903 17904function toPropertyKey(t) { 17905 var i = toPrimitive(t, "string"); 17906 return "symbol" == _typeof(i) ? i : i + ""; 17907} 17908 17909function _defineProperty(e, r, t) { 17910 return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 17911 value: t, 17912 enumerable: true, 17913 configurable: true, 17914 writable: true 17915 }) : e[r] = t, e; 17916} 17917 17918function ownKeys(e, r) { 17919 var t = Object.keys(e); 17920 if (Object.getOwnPropertySymbols) { 17921 var o = Object.getOwnPropertySymbols(e); 17922 r && (o = o.filter(function (r) { 17923 return Object.getOwnPropertyDescriptor(e, r).enumerable; 17924 })), t.push.apply(t, o); 17925 } 17926 return t; 17927} 17928function _objectSpread2(e) { 17929 for (var r = 1; r < arguments.length; r++) { 17930 var t = null != arguments[r] ? arguments[r] : {}; 17931 r % 2 ? ownKeys(Object(t), true).forEach(function (r) { 17932 _defineProperty(e, r, t[r]); 17933 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { 17934 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); 17935 }); 17936 } 17937 return e; 17938} 17939 17940function _arrayWithHoles(r) { 17941 if (Array.isArray(r)) return r; 17942} 17943 17944function _iterableToArrayLimit(r, l) { 17945 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 17946 if (null != t) { 17947 var e, 17948 n, 17949 i, 17950 u, 17951 a = [], 17952 f = true, 17953 o = false; 17954 try { 17955 if (i = (t = t.call(r)).next, 0 === l) { 17956 if (Object(t) !== t) return; 17957 f = !1; 17958 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 17959 } catch (r) { 17960 o = true, n = r; 17961 } finally {
17962 try { 17963 if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; 17964 } finally { 17965 if (o) throw n; 17966 } 17967 } 17968 return a; 17969 } 17970} 17971 17972function _arrayLikeToArray(r, a) { 17973 (null == a || a > r.length) && (a = r.length); 17974 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 17975 return n; 17976} 17977 17978function _unsupportedIterableToArray(r, a) { 17979 if (r) { 17980 if ("string" == typeof r) return _arrayLikeToArray(r, a); 17981 var t = {}.toString.call(r).slice(8, -1); 17982 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 17983 } 17984} 17985 17986function _nonIterableRest() { 17987 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 17988} 17989 17990function _slicedToArray(r, e) { 17991 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 17992} 17993 17994function _objectWithoutPropertiesLoose(r, e) { 17995 if (null == r) return {}; 17996 var t = {}; 17997 for (var n in r) if ({}.hasOwnProperty.call(r, n)) { 17998 if (e.includes(n)) continue; 17999 t[n] = r[n]; 18000 } 18001 return t; 18002} 18003 18004function _objectWithoutProperties(e, t) { 18005 if (null == e) return {}; 18006 var o, 18007 r, 18008 i = _objectWithoutPropertiesLoose(e, t); 18009 if (Object.getOwnPropertySymbols) { 18010 var s = Object.getOwnPropertySymbols(e); 18011 for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); 18012 } 18013 return i; 18014} 18015 18016var _excluded$6 = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"]; 18017function useStateManager(_ref) { 18018 var _ref$defaultInputValu = _ref.defaultInputValue, 18019 defaultInputValue = _ref$defaultInputValu === void 0 ? '' : _ref$defaultInputValu, 18020 _ref$defaultMenuIsOpe = _ref.defaultMenuIsOpen, 18021 defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe, 18022 _ref$defaultValue = _ref.defaultValue, 18023 defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue, 18024 propsInputValue = _ref.inputValue, 18025 propsMenuIsOpen = _ref.menuIsOpen, 18026 propsOnChange = _ref.onChange, 18027 propsOnInputChange = _ref.onInputChange, 18028 propsOnMenuClose = _ref.onMenuClose, 18029 propsOnMenuOpen = _ref.onMenuOpen, 18030 propsValue = _ref.value, 18031 restSelectProps = _objectWithoutProperties(_ref, _excluded$6); 18032 var _useState = reactExports.useState(propsInputValue !== undefined ? propsInputValue : defaultInputValue), 18033 _useState2 = _slicedToArray(_useState, 2), 18034 stateInputValue = _useState2[0], 18035 setStateInputValue = _useState2[1]; 18036 var _useState3 = reactExports.useState(propsMenuIsOpen !== undefined ? propsMenuIsOpen : defaultMenuIsOpen), 18037 _useState4 = _slicedToArray(_useState3, 2), 18038 stateMenuIsOpen = _useState4[0], 18039 setStateMenuIsOpen = _useState4[1]; 18040 var _useState5 = reactExports.useState(propsValue !== undefined ? propsValue : defaultValue), 18041 _useState6 = _slicedToArray(_useState5, 2), 18042 stateValue = _useState6[0], 18043 setStateValue = _useState6[1]; 18044 var onChange = reactExports.useCallback(function (value, actionMeta) { 18045 if (typeof propsOnChange === 'function') { 18046 propsOnChange(value, actionMeta); 18047 } 18048 setStateValue(value); 18049 }, [propsOnChange]); 18050 var onInputChange = reactExports.useCallback(function (value, actionMeta) { 18051 var newValue; 18052 if (typeof propsOnInputChange === 'function') { 18053 newValue = propsOnInputChange(value, actionMeta); 18054 } 18055 setStateInputValue(newValue !== undefined ? newValue : value); 18056 }, [propsOnInputChange]); 18057 var onMenuOpen = reactExports.useCallback(function () { 18058 if (typeof propsOnMenuOpen === 'function') { 18059 propsOnMenuOpen(); 18060 } 18061 setStateMenuIsOpen(true); 18062 }, [propsOnMenuOpen]); 18063 var onMenuClose = reactExports.useCallback(function () { 18064 if (typeof propsOnMenuClose === 'function') { 18065 propsOnMenuClose(); 18066 } 18067 setStateMenuIsOpen(false); 18068 }, [propsOnMenuClose]); 18069 var inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue; 18070 var menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen; 18071 var value = propsValue !== undefined ? propsValue : stateValue;
18072 return _objectSpread2(_objectSpread2({}, restSelectProps), {}, { 18073 inputValue: inputValue, 18074 menuIsOpen: menuIsOpen, 18075 onChange: onChange, 18076 onInputChange: onInputChange, 18077 onMenuClose: onMenuClose, 18078 onMenuOpen: onMenuOpen, 18079 value: value 18080 }); 18081} 18082 18083function _extends() { 18084 return _extends = Object.assign ? Object.assign.bind() : function (n) { 18085 for (var e = 1; e < arguments.length; e++) { 18086 var t = arguments[e]; 18087 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); 18088 } 18089 return n; 18090 }, _extends.apply(null, arguments); 18091} 18092 18093function _classCallCheck(a, n) { 18094 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 18095} 18096 18097function _defineProperties(e, r) { 18098 for (var t = 0; t < r.length; t++) { 18099 var o = r[t]; 18100 o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o); 18101 } 18102} 18103function _createClass(e, r, t) { 18104 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 18105 writable: false 18106 }), e; 18107} 18108 18109function _setPrototypeOf(t, e) { 18110 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { 18111 return t.__proto__ = e, t; 18112 }, _setPrototypeOf(t, e); 18113} 18114 18115function _inherits(t, e) { 18116 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); 18117 t.prototype = Object.create(e && e.prototype, { 18118 constructor: { 18119 value: t, 18120 writable: true, 18121 configurable: true 18122 } 18123 }), Object.defineProperty(t, "prototype", { 18124 writable: false 18125 }), e && _setPrototypeOf(t, e); 18126} 18127 18128function _getPrototypeOf(t) { 18129 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { 18130 return t.__proto__ || Object.getPrototypeOf(t); 18131 }, _getPrototypeOf(t); 18132} 18133 18134function _isNativeReflectConstruct() { 18135 try { 18136 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 18137 } catch (t) {} 18138 return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { 18139 return !!t; 18140 })(); 18141} 18142 18143function _assertThisInitialized(e) { 18144 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 18145 return e; 18146} 18147 18148function _possibleConstructorReturn(t, e) { 18149 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; 18150 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); 18151 return _assertThisInitialized(t); 18152} 18153 18154function _createSuper(t) { 18155 var r = _isNativeReflectConstruct(); 18156 return function () { 18157 var e, 18158 o = _getPrototypeOf(t); 18159 if (r) { 18160 var s = _getPrototypeOf(this).constructor; 18161 e = Reflect.construct(o, arguments, s); 18162 } else e = o.apply(this, arguments); 18163 return _possibleConstructorReturn(this, e); 18164 }; 18165} 18166 18167function _arrayWithoutHoles(r) { 18168 if (Array.isArray(r)) return _arrayLikeToArray(r); 18169} 18170 18171function _iterableToArray(r) { 18172 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); 18173} 18174 18175function _nonIterableSpread() { 18176 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 18177} 18178 18179function _toConsumableArray(r) { 18180 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread()
vendor: 3,408 bytes, lines 18180-18307
18180; 18181} 18182 18183/* 18184 18185Based off glamor's StyleSheet, thanks Sunil â¤ï¸ 18186 18187high performance StyleSheet for css-in-js systems 18188 18189- uses multiple style tags behind the scenes for millions of rules 18190- uses `insertRule` for appending in production for *much* faster performance 18191 18192// usage 18193 18194import { StyleSheet } from '@emotion/sheet' 18195 18196let styleSheet = new StyleSheet({ key: '', container: document.head }) 18197 18198styleSheet.insert('#box { border: 1px solid red; }') 18199- appends a css rule into the stylesheet 18200 18201styleSheet.flush() 18202- empties the stylesheet of all its contents 18203 18204*/ 18205 18206function sheetForTag(tag) { 18207 if (tag.sheet) { 18208 return tag.sheet; 18209 } // this weirdness brought to you by firefox 18210 18211 /* istanbul ignore next */ 18212 18213 18214 for (var i = 0; i < document.styleSheets.length; i++) { 18215 if (document.styleSheets[i].ownerNode === tag) { 18216 return document.styleSheets[i]; 18217 } 18218 } // this function should always return with a value 18219 // TS can't understand it though so we make it stop complaining here 18220 18221 18222 return undefined; 18223} 18224 18225function createStyleElement(options) { 18226 var tag = document.createElement('style'); 18227 tag.setAttribute('data-emotion', options.key); 18228 18229 if (options.nonce !== undefined) { 18230 tag.setAttribute('nonce', options.nonce); 18231 } 18232 18233 tag.appendChild(document.createTextNode('')); 18234 tag.setAttribute('data-s', ''); 18235 return tag; 18236} 18237 18238var StyleSheet = /*#__PURE__*/function () { 18239 // Using Node instead of HTMLElement since container may be a ShadowRoot 18240 function StyleSheet(options) { 18241 var _this = this; 18242 18243 this._insertTag = function (tag) { 18244 var before; 18245 18246 if (_this.tags.length === 0) { 18247 if (_this.insertionPoint) { 18248 before = _this.insertionPoint.nextSibling; 18249 } else if (_this.prepend) { 18250 before = _this.container.firstChild; 18251 } else { 18252 before = _this.before; 18253 } 18254 } else { 18255 before = _this.tags[_this.tags.length - 1].nextSibling; 18256 } 18257 18258 _this.container.insertBefore(tag, before); 18259 18260 _this.tags.push(tag); 18261 }; 18262 18263 this.isSpeedy = options.speedy === undefined ? true : options.speedy; 18264 this.tags = []; 18265 this.ctr = 0; 18266 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets 18267 18268 this.key = options.key; 18269 this.container = options.container; 18270 this.prepend = options.prepend; 18271 this.insertionPoint = options.insertionPoint; 18272 this.before = null; 18273 } 18274 18275 var _proto = StyleSheet.prototype; 18276 18277 _proto.hydrate = function hydrate(nodes) { 18278 nodes.forEach(this._insertTag); 18279 }; 18280 18281 _proto.insert = function insert(rule) { 18282 // the max length is how many rules we have per style tag, it's 65000 in speedy mode 18283 // it's 1 in dev because we insert source maps that map a single rule to a location 18284 // and you can only have one source map per style tag 18285 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { 18286 this._insertTag(createStyleElement(this)); 18287 } 18288 18289 var tag = this.tags[this.tags.length - 1]; 18290 18291 if (this.isSpeedy) { 18292 var sheet = sheetForTag(tag); 18293 18294 try { 18295 // this is the ultrafast version, works across browsers 18296 // the big drawback is that the css won't be editable in devtools 18297 sheet.insertRule(rule, sheet.cssRules.length); 18298 } catch (e) { 18299 } 18300 } else { 18301 tag.appendChild(document.createTextNode(rule)); 18302 } 18303 18304 this.ctr++; 18305 }; 18306 18307 _proto.flush = function flush() {
vendor: 13,396 bytes, lines 18308-18917
18308 this.tags.forEach(function (tag) { 18309 var _tag$parentNode; 18310 18311 return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag); 18312 }); 18313 this.tags = []; 18314 this.ctr = 0; 18315 }; 18316 18317 return StyleSheet; 18318}(); 18319 18320var MS = '-ms-'; 18321var MOZ = '-moz-'; 18322var WEBKIT = '-webkit-'; 18323 18324var COMMENT = 'comm'; 18325var RULESET = 'rule'; 18326var DECLARATION = 'decl'; 18327var IMPORT = '@import'; 18328var KEYFRAMES = '@keyframes'; 18329var LAYER = '@layer'; 18330 18331/** 18332 * @param {number} 18333 * @return {number} 18334 */ 18335var abs = Math.abs; 18336 18337/** 18338 * @param {number} 18339 * @return {string} 18340 */ 18341var from = String.fromCharCode; 18342 18343/** 18344 * @param {object} 18345 * @return {object} 18346 */ 18347var assign = Object.assign; 18348 18349/** 18350 * @param {string} value 18351 * @param {number} length 18352 * @return {number} 18353 */ 18354function hash (value, length) { 18355 return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0 18356} 18357 18358/** 18359 * @param {string} value 18360 * @return {string} 18361 */ 18362function trim (value) { 18363 return value.trim() 18364} 18365 18366/** 18367 * @param {string} value 18368 * @param {RegExp} pattern 18369 * @return {string?} 18370 */ 18371function match (value, pattern) { 18372 return (value = pattern.exec(value)) ? value[0] : value 18373} 18374 18375/** 18376 * @param {string} value 18377 * @param {(string|RegExp)} pattern 18378 * @param {string} replacement 18379 * @return {string} 18380 */ 18381function replace (value, pattern, replacement) { 18382 return value.replace(pattern, replacement) 18383} 18384 18385/** 18386 * @param {string} value 18387 * @param {string} search 18388 * @return {number} 18389 */ 18390function indexof (value, search) { 18391 return value.indexOf(search) 18392} 18393 18394/** 18395 * @param {string} value 18396 * @param {number} index 18397 * @return {number} 18398 */ 18399function charat (value, index) { 18400 return value.charCodeAt(index) | 0 18401} 18402 18403/** 18404 * @param {string} value 18405 * @param {number} begin 18406 * @param {number} end 18407 * @return {string} 18408 */ 18409function substr (value, begin, end) { 18410 return value.slice(begin, end) 18411} 18412 18413/** 18414 * @param {string} value 18415 * @return {number} 18416 */ 18417function strlen (value) { 18418 return value.length 18419} 18420 18421/** 18422 * @param {any[]} value 18423 * @return {number} 18424 */ 18425function sizeof (value) { 18426 return value.length 18427} 18428 18429/** 18430 * @param {any} value 18431 * @param {any[]} array 18432 * @return {any} 18433 */ 18434function append (value, array) { 18435 return array.push(value), value 18436} 18437 18438/** 18439 * @param {string[]} array 18440 * @param {function} callback 18441 * @return {string} 18442 */ 18443function combine (array, callback) { 18444 return array.map(callback).join('') 18445} 18446 18447var line = 1; 18448var column = 1; 18449var length = 0; 18450var position = 0; 18451var character = 0; 18452var characters = ''; 18453 18454/** 18455 * @param {string} value 18456 * @param {object | null} root 18457 * @param {object | null} parent 18458 * @param {string} type 18459 * @param {string[] | string} props 18460 * @param {object[] | string} children 18461 * @param {number} length 18462 */ 18463function node (value, root, parent, type, props, children, length) { 18464 return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} 18465} 18466 18467/** 18468 * @param {object} root 18469 * @param {object} props 18470 * @return {object} 18471 */ 18472function copy (root, props) { 18473 return assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) 18474} 18475 18476/** 18477 * @return {number} 18478 */ 18479function char () { 18480 return character 18481} 18482 18483/** 18484 * @return {number} 18485 */ 18486function prev () { 18487 character = position > 0 ? charat(characters, --position) : 0; 18488 18489 if (column--, character === 10) 18490 column = 1, line--; 18491 18492 return character 18493} 18494 18495/** 18496 * @return {number} 18497 */ 18498function next () { 18499 character = position < length ? charat(characters, position++) : 0; 18500 18501 if (column++, character === 10) 18502 column = 1, line++; 18503 18504 return character 18505} 18506 18507/** 18508 * @return {number} 18509 */ 18510function peek () { 18511 return charat(characters, position) 18512} 18513 18514/** 18515 * @return {number} 18516 */ 18517function caret () { 18518 return position 18519} 18520 18521/** 18522 * @param {number} begin 18523 * @param {number} end 18524 * @return {string} 18525 */ 18526function slice (begin, end) { 18527 return substr(characters, begin, end) 18528} 18529 18530/** 18531 * @param {number} type 18532 * @return {number} 18533 */ 18534function token (type) { 18535 switch (type) { 18536 // \0 \t \n \r \s whitespace token 18537 case 0: case 9: case 10: case 13: case 32: 18538 return 5 18539 // ! + , / > @ ~ isolate token 18540 case 33: case 43: case 44: case 47: case 62: case 64: case 126: 18541 // ; { } breakpoint token 18542 case 59: case 123: case 125: 18543 return 4 18544 // : accompanied token 18545 case 58: 18546 return 3 18547 // " ' ( [ opening delimit token 18548 case 34: case 39: case 40: case 91: 18549 return 2 18550 // ) ] closing delimit token 18551 case 41: case 93: 18552 return 1 18553 } 18554 18555 return 0 18556} 18557 18558/** 18559 * @param {string} value 18560 * @return {any[]} 18561 */ 18562function alloc (value) { 18563 return line = column = 1, length = strlen(characters = value), position = 0, [] 18564} 18565 18566/** 18567 * @param {any} value 18568 * @return {any} 18569 */ 18570function dealloc (value) { 18571 return characters = '', value 18572} 18573 18574/** 18575 * @param {number} type 18576 * @return {string} 18577 */ 18578function delimit (type) { 18579 return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) 18580} 18581 18582/** 18583 * @param {number} type 18584 * @return {string} 18585 */ 18586function whitespace (type) { 18587 while (character = peek()) 18588 if (character < 33) 18589 next(); 18590 else 18591 break 18592 18593 return token(type) > 2 || token(character) > 3 ? '' : ' ' 18594} 18595 18596/** 18597 * @param {number} index 18598 * @param {number} count 18599 * @return {string} 18600 */ 18601function escaping (index, count) { 18602 while (--count && next()) 18603 // not 0-9 A-F a-f 18604 if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) 18605 break 18606 18607 return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) 18608} 18609 18610/** 18611 * @param {number} type 18612 * @return {number} 18613 */ 18614function delimiter (type) { 18615 while (next()) 18616 switch (character) { 18617 // ] ) " ' 18618 case type: 18619 return position 18620 // " ' 18621 case 34: case 39: 18622 if (type !== 34 && type !== 39) 18623 delimiter(character); 18624 break 18625 // ( 18626 case 40: 18627 if (type === 41) 18628 delimiter(type); 18629 break 18630 // \ 18631 case 92: 18632 next(); 18633 break 18634 } 18635 18636 return position 18637} 18638 18639/** 18640 * @param {number} type 18641 * @param {number} index 18642 * @return {number} 18643 */ 18644function commenter (type, index) { 18645 while (next()) 18646 // // 18647 if (type + character === 47 + 10) 18648 break 18649 // /* 18650 else if (type + character === 42 + 42 && peek() === 47) 18651 break 18652 18653 return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next()) 18654} 18655 18656/** 18657 * @param {number} index 18658 * @return {string} 18659 */ 18660function identifier (index) { 18661 while (!token(peek())) 18662 next(); 18663 18664 return slice(index, position) 18665} 18666 18667/** 18668 * @param {string} value 18669 * @return {object[]} 18670 */ 18671function compile (value) { 18672 return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) 18673} 18674 18675/** 18676 * @param {string} value 18677 * @param {object} root 18678 * @param {object?} parent 18679 * @param {string[]} rule 18680 * @param {string[]} rules 18681 * @param {string[]} rulesets 18682 * @param {number[]} pseudo 18683 * @param {number[]} points 18684 * @param {string[]} declarations 18685 * @return {object} 18686 */ 18687function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { 18688 var index = 0; 18689 var offset = 0; 18690 var length = pseudo; 18691 var atrule = 0; 18692 var property = 0; 18693 var previous = 0; 18694 var variable = 1; 18695 var scanning = 1; 18696 var ampersand = 1; 18697 var character = 0; 18698 var type = ''; 18699 var props = rules; 18700 var children = rulesets; 18701 var reference = rule; 18702 var characters = type; 18703 18704 while (scanning) 18705 switch (previous = character, character = next()) { 18706 // ( 18707 case 40: 18708 if (previous != 108 && charat(characters, length - 1) == 58) { 18709 if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1) 18710 ampersand = -1; 18711 break 18712 } 18713 // " ' [ 18714 case 34: case 39: case 91: 18715 characters += delimit(character); 18716 break 18717 // \t \n \r \s 18718 case 9: case 10: case 13: case 32: 18719 characters += whitespace(previous); 18720 break 18721 // \ 18722 case 92: 18723 characters += escaping(caret() - 1, 7); 18724 continue 18725 // / 18726 case 47: 18727 switch (peek()) { 18728 case 42: case 47: 18729 append(comment(commenter(next(), caret()), root, parent), declarations); 18730 break 18731 default: 18732 characters += '/'; 18733 } 18734 break 18735 // { 18736 case 123 * variable: 18737 points[index++] = strlen(characters) * ampersand; 18738 // } ; \0 18739 case 125 * variable: case 59: case 0: 18740 switch (character) { 18741 // \0 } 18742 case 0: case 125: scanning = 0; 18743 // ; 18744 case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, ''); 18745 if (property > 0 && (strlen(characters) - length)) 18746 append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations); 18747 break 18748 // @ ; 18749 case 59: characters += ';'; 18750 // { rule/at-rule 18751 default: 18752 append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets); 18753 18754 if (character === 123) 18755 if (offset === 0) 18756 parse(characters, root, reference, reference, props, rulesets, length, points, children); 18757 else 18758 switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) { 18759 // d l m s 18760 case 100: case 108: case 109: case 115: 18761 parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children); 18762 break 18763 default: 18764 parse(characters, reference, reference, reference, [''], children, 0, points, children); 18765 } 18766 } 18767 18768 index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo; 18769 break 18770 // : 18771 case 58: 18772 length = 1 + strlen(characters), property = previous; 18773 default: 18774 if (variable < 1) 18775 if (character == 123) 18776 --variable; 18777 else if (character == 125 && variable++ == 0 && prev() == 125) 18778 continue 18779 18780 switch (characters += from(character), character * variable) { 18781 // & 18782 case 38: 18783 ampersand = offset > 0 ? 1 : (characters += '\f', -1); 18784 break 18785 // , 18786 case 44: 18787 points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1; 18788 break 18789 // @ 18790 case 64: 18791 // - 18792 if (peek() === 45) 18793 characters += delimit(next()); 18794 18795 atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++; 18796 break 18797 // - 18798 case 45: 18799 if (previous === 45 && strlen(characters) == 2) 18800 variable = 0; 18801 } 18802 } 18803 18804 return rulesets 18805} 18806 18807/** 18808 * @param {string} value 18809 * @param {object} root 18810 * @param {object?} parent 18811 * @param {number} index 18812 * @param {number} offset 18813 * @param {string[]} rules 18814 * @param {number[]} points 18815 * @param {string} type 18816 * @param {string[]} props 18817 * @param {string[]} children 18818 * @param {number} length 18819 * @return {object} 18820 */ 18821function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { 18822 var post = offset - 1; 18823 var rule = offset === 0 ? rules : ['']; 18824 var size = sizeof(rule); 18825 18826 for (var i = 0, j = 0, k = 0; i < index; ++i) 18827 for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) 18828 if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x]))) 18829 props[k++] = z; 18830 18831 return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length) 18832} 18833 18834/** 18835 * @param {number} value 18836 * @param {object} root 18837 * @param {object?} parent 18838 * @return {object} 18839 */ 18840function comment (value, root, parent) { 18841 return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0) 18842} 18843 18844/** 18845 * @param {string} value 18846 * @param {object} root 18847 * @param {object?} parent 18848 * @param {number} length 18849 * @return {object} 18850 */ 18851function declaration (value, root, parent, length) { 18852 return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length) 18853} 18854 18855/** 18856 * @param {object[]} children 18857 * @param {function} callback 18858 * @return {string} 18859 */ 18860function serialize (children, callback) { 18861 var output = ''; 18862 var length = sizeof(children); 18863 18864 for (var i = 0; i < length; i++) 18865 output += callback(children[i], i, children, callback) || ''; 18866 18867 return output 18868} 18869 18870/** 18871 * @param {object} element 18872 * @param {number} index 18873 * @param {object[]} children 18874 * @param {function} callback 18875 * @return {string} 18876 */ 18877function stringify (element, index, children, callback) { 18878 switch (element.type) { 18879 case LAYER: if (element.children.length) break 18880 case IMPORT: case DECLARATION: return element.return = element.return || element.value 18881 case COMMENT: return '' 18882 case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}' 18883 case RULESET: element.value = element.props.join(','); 18884 } 18885 18886 return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' 18887} 18888 18889/** 18890 * @param {function[]} collection 18891 * @return {function} 18892 */ 18893function middleware (collection) { 18894 var length = sizeof(collection); 18895 18896 return function (element, index, children, callback) { 18897 var output = ''; 18898 18899 for (var i = 0; i < length; i++) 18900 output += collection[i](element, index, children, callback) || ''; 18901 18902 return output 18903 } 18904} 18905 18906/** 18907 * @param {function} callback 18908 * @return {function} 18909 */ 18910function rulesheet (callback) { 18911 return function (element) { 18912 if (!element.root) 18913 if (element = element.return) 18914 callback(element); 18915 } 18916} 18917
vendor: 2,351 bytes, lines 18918-19005
18918function memoize(fn) { 18919 var cache = Object.create(null); 18920 return function (arg) { 18921 if (cache[arg] === undefined) cache[arg] = fn(arg); 18922 return cache[arg]; 18923 }; 18924} 18925 18926var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { 18927 var previous = 0; 18928 var character = 0; 18929 18930 while (true) { 18931 previous = character; 18932 character = peek(); // &\f 18933 18934 if (previous === 38 && character === 12) { 18935 points[index] = 1; 18936 } 18937 18938 if (token(character)) { 18939 break; 18940 } 18941 18942 next(); 18943 } 18944 18945 return slice(begin, position); 18946}; 18947 18948var toRules = function toRules(parsed, points) { 18949 // pretend we've started with a comma 18950 var index = -1; 18951 var character = 44; 18952 18953 do { 18954 switch (token(character)) { 18955 case 0: 18956 // &\f 18957 if (character === 38 && peek() === 12) { 18958 // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings 18959 // stylis inserts \f after & to know when & where it should replace this sequence with the context selector 18960 // and when it should just concatenate the outer and inner selectors 18961 // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here 18962 points[index] = 1; 18963 } 18964 18965 parsed[index] += identifierWithPointTracking(position - 1, points, index); 18966 break; 18967 18968 case 2: 18969 parsed[index] += delimit(character); 18970 break; 18971 18972 case 4: 18973 // comma 18974 if (character === 44) { 18975 // colon 18976 parsed[++index] = peek() === 58 ? '&\f' : ''; 18977 points[index] = parsed[index].length; 18978 break; 18979 } 18980 18981 // fallthrough 18982 18983 default: 18984 parsed[index] += from(character); 18985 } 18986 } while (character = next()); 18987 18988 return parsed; 18989}; 18990 18991var getRules = function getRules(value, points) { 18992 return dealloc(toRules(alloc(value), points)); 18993}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 18994 18995 18996var fixedElements = /* #__PURE__ */new WeakMap(); 18997var compat = function compat(element) { 18998 if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo 18999 // negative .length indicates that this rule has been already prefixed 19000 element.length < 1) { 19001 return; 19002 } 19003 19004 var value = element.value; 19005 var
vendor: 7,662 bytes, lines 19005-19262
19005 parent = element.parent; 19006 var isImplicitRule = element.column === parent.column && element.line === parent.line; 19007 19008 while (parent.type !== 'rule') { 19009 parent = parent.parent; 19010 if (!parent) return; 19011 } // short-circuit for the simplest case 19012 19013 19014 if (element.props.length === 1 && value.charCodeAt(0) !== 58 19015 /* colon */ 19016 && !fixedElements.get(parent)) { 19017 return; 19018 } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) 19019 // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" 19020 19021 19022 if (isImplicitRule) { 19023 return; 19024 } 19025 19026 fixedElements.set(element, true); 19027 var points = []; 19028 var rules = getRules(value, points); 19029 var parentRules = parent.props; 19030 19031 for (var i = 0, k = 0; i < rules.length; i++) { 19032 for (var j = 0; j < parentRules.length; j++, k++) { 19033 element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; 19034 } 19035 } 19036}; 19037var removeLabel = function removeLabel(element) { 19038 if (element.type === 'decl') { 19039 var value = element.value; 19040 19041 if ( // charcode for l 19042 value.charCodeAt(0) === 108 && // charcode for b 19043 value.charCodeAt(2) === 98) { 19044 // this ignores label 19045 element["return"] = ''; 19046 element.value = ''; 19047 } 19048 } 19049}; 19050 19051/* eslint-disable no-fallthrough */ 19052 19053function prefix(value, length) { 19054 switch (hash(value, length)) { 19055 // color-adjust 19056 case 5103: 19057 return WEBKIT + 'print-' + value + value; 19058 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) 19059 19060 case 5737: 19061 case 4201: 19062 case 3177: 19063 case 3433: 19064 case 1641: 19065 case 4457: 19066 case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break 19067 19068 case 5572: 19069 case 6356: 19070 case 5844: 19071 case 3191: 19072 case 6645: 19073 case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, 19074 19075 case 6391: 19076 case 5879: 19077 case 5623: 19078 case 6135: 19079 case 4599: 19080 case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) 19081 19082 case 4215: 19083 case 6389: 19084 case 5109: 19085 case 5365: 19086 case 5621: 19087 case 3829: 19088 return WEBKIT + value + value; 19089 // appearance, user-select, transform, hyphens, text-size-adjust 19090 19091 case 5349: 19092 case 4246: 19093 case 4810: 19094 case 6968: 19095 case 2756: 19096 return WEBKIT + value + MOZ + value + MS + value + value; 19097 // flex, flex-direction 19098 19099 case 6828: 19100 case 4268: 19101 return WEBKIT + value + MS + value + value; 19102 // order 19103 19104 case 6165: 19105 return WEBKIT + value + MS + 'flex-' + value + value; 19106 // align-items 19107 19108 case 5187: 19109 return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value; 19110 // align-self 19111 19112 case 5443: 19113 return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value; 19114 // align-content 19115 19116 case 4675: 19117 return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value; 19118 // flex-shrink 19119 19120 case 5548: 19121 return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value; 19122 // flex-basis 19123 19124 case 5292: 19125 return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value; 19126 // flex-grow 19127 19128 case 6060: 19129 return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value; 19130 // transition 19131 19132 case 4554: 19133 return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value; 19134 // cursor 19135 19136 case 6187: 19137 return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value; 19138 // background, background-image 19139 19140 case 5495: 19141 case 3959: 19142 return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1'); 19143 // justify-content 19144 19145 case 4968: 19146 return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value; 19147 // (margin|padding)-inline-(start|end) 19148 19149 case 4095: 19150 case 3583: 19151 case 4068: 19152 case 2532: 19153 return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value; 19154 // (min|max)?(width|height|inline-size|block-size) 19155 19156 case 8116: 19157 case 7059: 19158 case 5753: 19159 case 5535: 19160 case 5445: 19161 case 5701: 19162 case 4933: 19163 case 4677: 19164 case 5533: 19165 case 5789: 19166 case 5021: 19167 case 4765: 19168 // stretch, max-content, min-content, fill-available 19169 if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) { 19170 // (m)ax-content, (m)in-content 19171 case 109: 19172 // - 19173 if (charat(value, length + 4) !== 45) break; 19174 // (f)ill-available, (f)it-content 19175 19176 case 102: 19177 return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; 19178 // (s)tretch 19179 19180 case 115: 19181 return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value; 19182 } 19183 break; 19184 // position: sticky 19185 19186 case 4949: 19187 // (s)ticky? 19188 if (charat(value, length + 1) !== 115) break; 19189 // display: (flex|inline-flex) 19190 19191 case 6444: 19192 switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) { 19193 // stic(k)y 19194 case 107: 19195 return replace(value, ':', ':' + WEBKIT) + value; 19196 // (inline-)?fl(e)x 19197 19198 case 101: 19199 return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value; 19200 } 19201 19202 break; 19203 // writing-mode 19204 19205 case 5936: 19206 switch (charat(value, length + 11)) { 19207 // vertical-l(r) 19208 case 114: 19209 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; 19210 // vertical-r(l) 19211 19212 case 108: 19213 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; 19214 // horizontal(-)tb 19215 19216 case 45: 19217 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; 19218 } 19219 19220 return WEBKIT + value + MS + value + value; 19221 } 19222 19223 return value; 19224} 19225 19226var prefixer = function prefixer(element, index, children, callback) { 19227 if (element.length > -1) if (!element["return"]) switch (element.type) { 19228 case DECLARATION: 19229 element["return"] = prefix(element.value, element.length); 19230 break; 19231 19232 case KEYFRAMES: 19233 return serialize([copy(element, { 19234 value: replace(element.value, '@', '@' + WEBKIT) 19235 })], callback); 19236 19237 case RULESET: 19238 if (element.length) return combine(element.props, function (value) { 19239 switch (match(value, /(::plac\w+|:read-\w+)/)) { 19240 // :read-(only|write) 19241 case ':read-only': 19242 case ':read-write': 19243 return serialize([copy(element, { 19244 props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')] 19245 })], callback); 19246 // :placeholder 19247 19248 case '::placeholder': 19249 return serialize([copy(element, { 19250 props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')] 19251 }), copy(element, { 19252 props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')] 19253 }), copy(element, { 19254 props: [replace(value, /:(plac\w+)/, MS + 'input-$1')] 19255 })], callback); 19256 } 19257 19258 return ''; 19259 }); 19260 } 19261}; 19262
vendor: 6,852 bytes, lines 19263-19396
19263var defaultStylisPlugins = [prefixer]; 19264 19265var createCache = function createCache(options) { 19266 var key = options.key; 19267 19268 if (key === 'css') { 19269 var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration 19270 // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) 19271 // note this very very intentionally targets all style elements regardless of the key to ensure 19272 // that creating a cache works inside of render of a React component 19273 19274 Array.prototype.forEach.call(ssrStyles, function (node) { 19275 // we want to only move elements which have a space in the data-emotion attribute value 19276 // because that indicates that it is an Emotion 11 server-side rendered style elements 19277 // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector 19278 // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) 19279 // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles 19280 // will not result in the Emotion 10 styles being destroyed 19281 var dataEmotionAttribute = node.getAttribute('data-emotion'); 19282 19283 if (dataEmotionAttribute.indexOf(' ') === -1) { 19284 return; 19285 } 19286 19287 document.head.appendChild(node); 19288 node.setAttribute('data-s', ''); 19289 }); 19290 } 19291 19292 var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; 19293 19294 var inserted = {}; 19295 var container; 19296 var nodesToHydrate = []; 19297 19298 { 19299 container = options.container || document.head; 19300 Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which 19301 // means that the style elements we're looking at are only Emotion 11 server-rendered style elements 19302 document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { 19303 var attrib = node.getAttribute("data-emotion").split(' '); 19304 19305 for (var i = 1; i < attrib.length; i++) { 19306 inserted[attrib[i]] = true; 19307 } 19308 19309 nodesToHydrate.push(node); 19310 }); 19311 } 19312 19313 var _insert; 19314 19315 var omnipresentPlugins = [compat, removeLabel]; 19316 19317 { 19318 var currentSheet; 19319 var finalizingPlugins = [stringify, rulesheet(function (rule) { 19320 currentSheet.insert(rule); 19321 })]; 19322 var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); 19323 19324 var stylis = function stylis(styles) { 19325 return serialize(compile(styles), serializer); 19326 }; 19327 19328 _insert = function insert(selector, serialized, sheet, shouldCache) { 19329 currentSheet = sheet; 19330 19331 stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); 19332 19333 if (shouldCache) { 19334 cache.inserted[serialized.name] = true; 19335 } 19336 }; 19337 } 19338 19339 var cache = { 19340 key: key, 19341 sheet: new StyleSheet({ 19342 key: key, 19343 container: container, 19344 nonce: options.nonce, 19345 speedy: options.speedy, 19346 prepend: options.prepend, 19347 insertionPoint: options.insertionPoint 19348 }), 19349 nonce: options.nonce, 19350 inserted: inserted, 19351 registered: {}, 19352 insert: _insert 19353 }; 19354 cache.sheet.hydrate(nodesToHydrate); 19355 return cache; 19356}; 19357 19358var reactIs$1 = {exports: {}}; 19359 19360var reactIs_production_min = {}; 19361 19362/** @license React v16.13.1 19363 * react-is.production.min.js 19364 * 19365 * Copyright (c) Facebook, Inc. and its affiliates. 19366 * 19367 * This source code is licensed under the MIT license found in the 19368 * LICENSE file in the root directory of this source tree. 19369 */ 19370var b$1="function"===typeof Symbol&&Symbol.for,c$1=b$1?Symbol.for("react.element"):60103,d$1=b$1?Symbol.for("react.portal"):60106,e$1=b$1?Symbol.for("react.fragment"):60107,f$1=b$1?Symbol.for("react.strict_mode"):60108,g$1=b$1?Symbol.for("react.profiler"):60114,h$1=b$1?Symbol.for("react.provider"):60109,k=b$1?Symbol.for("react.context"):60110,l=b$1?Symbol.for("react.async_mode"):60111,m$1=b$1?Symbol.for("react.concurrent_mode"):60111,n$1=b$1?Symbol.for("react.forward_ref"):60112,p$1=b$1?Symbol.for("react.suspense"):60113,q$1=b$1? 19371Symbol.for("react.suspense_list"):60120,r=b$1?Symbol.for("react.memo"):60115,t$1=b$1?Symbol.for("react.lazy"):60116,v$1=b$1?Symbol.for("react.block"):60121,w$2=b$1?Symbol.for("react.fundamental"):60117,x$1=b$1?Symbol.for("react.responder"):60118,y$1=b$1?Symbol.for("react.scope"):60119; 19372function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$1:switch(a=a.type,a){case l:case m$1:case e$1:case g$1:case f$1:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k:case n$1:case t$1:case r:case h$1:return a;default:return u}}case d$1:return u}}}function A(a){return z(a)===m$1}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m$1;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h$1;reactIs_production_min.Element=c$1;reactIs_production_min.ForwardRef=n$1;reactIs_production_min.Fragment=e$1;reactIs_production_min.Lazy=t$1;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d$1; 19373reactIs_production_min.Profiler=g$1;reactIs_production_min.StrictMode=f$1;reactIs_production_min.Suspense=p$1;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h$1};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$1};reactIs_production_min.isForwardRef=function(a){return z(a)===n$1};reactIs_production_min.isFragment=function(a){return z(a)===e$1};reactIs_production_min.isLazy=function(a){return z(a)===t$1}; 19374reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d$1};reactIs_production_min.isProfiler=function(a){return z(a)===g$1};reactIs_production_min.isStrictMode=function(a){return z(a)===f$1};reactIs_production_min.isSuspense=function(a){return z(a)===p$1}; 19375reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e$1||a===m$1||a===g$1||a===f$1||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r||a.$$typeof===h$1||a.$$typeof===k||a.$$typeof===n$1||a.$$typeof===w$2||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};reactIs_production_min.typeOf=z; 19376 19377{ 19378 reactIs$1.exports = reactIs_production_min; 19379} 19380 19381var reactIsExports = reactIs$1.exports; 19382 19383var reactIs = reactIsExports; 19384var FORWARD_REF_STATICS = { 19385 '$$typeof': true, 19386 render: true, 19387 defaultProps: true, 19388 displayName: true, 19389 propTypes: true 19390}; 19391var MEMO_STATICS = { 19392 '$$typeof': true, 19393 compare: true, 19394 defaultProps: true, 19395 displayName: true, 19396 propTypes: true,
vendor: 4,513 bytes, lines 19397-19555
19397 type: true 19398}; 19399var TYPE_STATICS = {}; 19400TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; 19401TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; 19402 19403var isBrowser$1 = true; 19404 19405function getRegisteredStyles(registered, registeredStyles, classNames) { 19406 var rawClassName = ''; 19407 classNames.split(' ').forEach(function (className) { 19408 if (registered[className] !== undefined) { 19409 registeredStyles.push(registered[className] + ";"); 19410 } else if (className) { 19411 rawClassName += className + " "; 19412 } 19413 }); 19414 return rawClassName; 19415} 19416var registerStyles = function registerStyles(cache, serialized, isStringTag) { 19417 var className = cache.key + "-" + serialized.name; 19418 19419 if ( // we only need to add the styles to the registered cache if the 19420 // class name could be used further down 19421 // the tree but if it's a string tag, we know it won't 19422 // so we don't have to add it to registered cache. 19423 // this improves memory usage since we can avoid storing the whole style string 19424 (isStringTag === false || // we need to always store it if we're in compat mode and 19425 // in node since emotion-server relies on whether a style is in 19426 // the registered cache to know whether a style is global or not 19427 // also, note that this check will be dead code eliminated in the browser 19428 isBrowser$1 === false ) && cache.registered[className] === undefined) { 19429 cache.registered[className] = serialized.styles; 19430 } 19431}; 19432var insertStyles = function insertStyles(cache, serialized, isStringTag) { 19433 registerStyles(cache, serialized, isStringTag); 19434 var className = cache.key + "-" + serialized.name; 19435 19436 if (cache.inserted[serialized.name] === undefined) { 19437 var current = serialized; 19438 19439 do { 19440 cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); 19441 19442 current = current.next; 19443 } while (current !== undefined); 19444 } 19445}; 19446 19447/* eslint-disable */ 19448// Inspired by https://github.com/garycourt/murmurhash-js 19449// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 19450function murmur2(str) { 19451 // 'm' and 'r' are mixing constants generated offline. 19452 // They're not really 'magic', they just happen to work well. 19453 // const m = 0x5bd1e995; 19454 // const r = 24; 19455 // Initialize the hash 19456 var h = 0; // Mix 4 bytes at a time into the hash 19457 19458 var k, 19459 i = 0, 19460 len = str.length; 19461 19462 for (; len >= 4; ++i, len -= 4) { 19463 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; 19464 k = 19465 /* Math.imul(k, m): */ 19466 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); 19467 k ^= 19468 /* k >>> r: */ 19469 k >>> 24; 19470 h = 19471 /* Math.imul(k, m): */ 19472 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ 19473 /* Math.imul(h, m): */ 19474 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 19475 } // Handle the last few bytes of the input array 19476 19477 19478 switch (len) { 19479 case 3: 19480 h ^= (str.charCodeAt(i + 2) & 0xff) << 16; 19481 19482 case 2: 19483 h ^= (str.charCodeAt(i + 1) & 0xff) << 8; 19484 19485 case 1: 19486 h ^= str.charCodeAt(i) & 0xff; 19487 h = 19488 /* Math.imul(h, m): */ 19489 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 19490 } // Do a few final mixes of the hash to ensure the last few 19491 // bytes are well-incorporated. 19492 19493 19494 h ^= h >>> 13; 19495 h = 19496 /* Math.imul(h, m): */ 19497 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 19498 return ((h ^ h >>> 15) >>> 0).toString(36); 19499} 19500 19501var unitlessKeys = { 19502 animationIterationCount: 1, 19503 aspectRatio: 1, 19504 borderImageOutset: 1, 19505 borderImageSlice: 1, 19506 borderImageWidth: 1, 19507 boxFlex: 1, 19508 boxFlexGroup: 1, 19509 boxOrdinalGroup: 1, 19510 columnCount: 1, 19511 columns: 1, 19512 flex: 1, 19513 flexGrow: 1, 19514 flexPositive: 1, 19515 flexShrink: 1, 19516 flexNegative: 1, 19517 flexOrder: 1, 19518 gridRow: 1, 19519 gridRowEnd: 1, 19520 gridRowSpan: 1, 19521 gridRowStart: 1, 19522 gridColumn: 1, 19523 gridColumnEnd: 1, 19524 gridColumnSpan: 1, 19525 gridColumnStart: 1, 19526 msGridRow: 1, 19527 msGridRowSpan: 1, 19528 msGridColumn: 1, 19529 msGridColumnSpan: 1, 19530 fontWeight: 1, 19531 lineHeight: 1, 19532 opacity: 1, 19533 order: 1, 19534 orphans: 1, 19535 scale: 1, 19536 tabSize: 1, 19537 widows: 1, 19538 zIndex: 1, 19539 zoom: 1, 19540 WebkitLineClamp: 1, 19541 // SVG-related properties 19542 fillOpacity: 1, 19543 floodOpacity: 1, 19544 stopOpacity: 1, 19545 strokeDasharray: 1, 19546 strokeDashoffset: 1, 19547 strokeMiterlimit: 1, 19548 strokeOpacity: 1, 19549 strokeWidth: 1 19550}; 19551 19552var hyphenateRegex = /[A-Z]|^ms/g; 19553var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; 19554 19555var isCustomProperty = function isCustomProperty(property) {
vendor: 4,639 bytes, lines 19556-19734
19556 return property.charCodeAt(1) === 45; 19557}; 19558 19559var isProcessableValue = function isProcessableValue(value) { 19560 return value != null && typeof value !== 'boolean'; 19561}; 19562 19563var processStyleName = /* #__PURE__ */memoize(function (styleName) { 19564 return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); 19565}); 19566 19567var processStyleValue = function processStyleValue(key, value) { 19568 switch (key) { 19569 case 'animation': 19570 case 'animationName': 19571 { 19572 if (typeof value === 'string') { 19573 return value.replace(animationRegex, function (match, p1, p2) { 19574 cursor = { 19575 name: p1, 19576 styles: p2, 19577 next: cursor 19578 }; 19579 return p1; 19580 }); 19581 } 19582 } 19583 } 19584 19585 if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { 19586 return value + 'px'; 19587 } 19588 19589 return value; 19590}; 19591 19592function handleInterpolation(mergedProps, registered, interpolation) { 19593 if (interpolation == null) { 19594 return ''; 19595 } 19596 19597 var componentSelector = interpolation; 19598 19599 if (componentSelector.__emotion_styles !== undefined) { 19600 19601 return componentSelector; 19602 } 19603 19604 switch (typeof interpolation) { 19605 case 'boolean': 19606 { 19607 return ''; 19608 } 19609 19610 case 'object': 19611 { 19612 var keyframes = interpolation; 19613 19614 if (keyframes.anim === 1) { 19615 cursor = { 19616 name: keyframes.name, 19617 styles: keyframes.styles, 19618 next: cursor 19619 }; 19620 return keyframes.name; 19621 } 19622 19623 var serializedStyles = interpolation; 19624 19625 if (serializedStyles.styles !== undefined) { 19626 var next = serializedStyles.next; 19627 19628 if (next !== undefined) { 19629 // not the most efficient thing ever but this is a pretty rare case 19630 // and there will be very few iterations of this generally 19631 while (next !== undefined) { 19632 cursor = { 19633 name: next.name, 19634 styles: next.styles, 19635 next: cursor 19636 }; 19637 next = next.next; 19638 } 19639 } 19640 19641 var styles = serializedStyles.styles + ";"; 19642 return styles; 19643 } 19644 19645 return createStringFromObject(mergedProps, registered, interpolation); 19646 } 19647 19648 case 'function': 19649 { 19650 if (mergedProps !== undefined) { 19651 var previousCursor = cursor; 19652 var result = interpolation(mergedProps); 19653 cursor = previousCursor; 19654 return handleInterpolation(mergedProps, registered, result); 19655 } 19656 19657 break; 19658 } 19659 } // finalize string values (regular strings and functions interpolated into css calls) 19660 19661 19662 var asString = interpolation; 19663 19664 { 19665 return asString; 19666 } 19667} 19668 19669function createStringFromObject(mergedProps, registered, obj) { 19670 var string = ''; 19671 19672 if (Array.isArray(obj)) { 19673 for (var i = 0; i < obj.length; i++) { 19674 string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; 19675 } 19676 } else { 19677 for (var key in obj) { 19678 var value = obj[key]; 19679 19680 if (typeof value !== 'object') { 19681 var asString = value; 19682 19683 if (isProcessableValue(asString)) { 19684 string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";"; 19685 } 19686 } else { 19687 19688 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null)) { 19689 for (var _i = 0; _i < value.length; _i++) { 19690 if (isProcessableValue(value[_i])) { 19691 string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";"; 19692 } 19693 } 19694 } else { 19695 var interpolated = handleInterpolation(mergedProps, registered, value); 19696 19697 switch (key) { 19698 case 'animation': 19699 case 'animationName': 19700 { 19701 string += processStyleName(key) + ":" + interpolated + ";"; 19702 break; 19703 } 19704 19705 default: 19706 { 19707 19708 string += key + "{" + interpolated + "}"; 19709 } 19710 } 19711 } 19712 } 19713 } 19714 } 19715 19716 return string; 19717} 19718 19719var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes 19720// keyframes are stored on the SerializedStyles object as a linked list 19721 19722var cursor; 19723function serializeStyles(args, registered, mergedProps) { 19724 if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { 19725 return args[0]; 19726 } 19727 19728 var stringMode = true; 19729 var styles = ''; 19730 cursor = undefined; 19731 var strings = args[0]; 19732 19733 if (strings == null || strings.raw === undefined) { 19734 stringMode = false;
19735 styles += handleInterpolation(mergedProps, registered, strings); 19736 } else { 19737 var asTemplateStringsArr = strings; 19738 19739 styles += asTemplateStringsArr[0]; 19740 } // we start at 1 since we've already handled the first arg 19741 19742 19743 for (var i = 1; i < args.length; i++) { 19744 styles += handleInterpolation(mergedProps, registered, args[i]); 19745 19746 if (stringMode) { 19747 var templateStringsArr = strings; 19748 19749 styles += templateStringsArr[i]; 19750 } 19751 } // using a global regex with .exec is stateful so lastIndex has to be reset each time 19752 19753 19754 labelPattern.lastIndex = 0; 19755 var identifierName = ''; 19756 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 19757 19758 while ((match = labelPattern.exec(styles)) !== null) { 19759 identifierName += '-' + match[1]; 19760 } 19761 19762 var name = murmur2(styles) + identifierName; 19763 19764 return { 19765 name: name, 19766 styles: styles, 19767 next: cursor 19768 }; 19769} 19770 19771var syncFallback = function syncFallback(create) { 19772 return create(); 19773}; 19774 19775var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false; 19776var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; 19777 19778var EmotionCacheContext = /* #__PURE__ */reactExports.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case 19779// because this module is primarily intended for the browser and node 19780// but it's also required in react native and similar environments sometimes 19781// and we could have a special build just for that 19782// but this is much easier and the native packages 19783// might use a different theme context in the future anyway 19784typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({ 19785 key: 'css' 19786}) : null); 19787 19788EmotionCacheContext.Provider; 19789 19790var withEmotionCache = function withEmotionCache(func) { 19791 return /*#__PURE__*/reactExports.forwardRef(function (props, ref) { 19792 // the cache will never be null in the browser 19793 var cache = reactExports.useContext(EmotionCacheContext); 19794 return func(props, cache, ref); 19795 }); 19796}; 19797 19798var ThemeContext = /* #__PURE__ */reactExports.createContext({}); 19799 19800var hasOwn = {}.hasOwnProperty; 19801 19802var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; 19803var createEmotionProps = function createEmotionProps(type, props) { 19804 19805 var newProps = {}; 19806 19807 for (var _key in props) { 19808 if (hasOwn.call(props, _key)) { 19809 newProps[_key] = props[_key]; 19810 } 19811 } 19812 19813 newProps[typePropName] = type; // Runtime labeling is an opt-in feature because: 19814 19815 return newProps; 19816}; 19817 19818var Insertion = function Insertion(_ref) { 19819 var cache = _ref.cache, 19820 serialized = _ref.serialized, 19821 isStringTag = _ref.isStringTag; 19822 registerStyles(cache, serialized, isStringTag); 19823 useInsertionEffectAlwaysWithSyncFallback(function () { 19824 return insertStyles(cache, serialized, isStringTag); 19825 }); 19826 19827 return null; 19828}; 19829 19830var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) { 19831 var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works 19832 // not passing the registered cache to serializeStyles because it would 19833 // make certain babel optimisations not possible 19834 19835 if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { 19836 cssProp = cache.registered[cssProp]; 19837 } 19838 19839 var WrappedComponent = props[typePropName]; 19840 var registeredStyles = [cssProp]; 19841 var className = ''; 19842 19843 if (typeof props.className === 'string') { 19844 className = getRegisteredStyles(cache.registered, registeredStyles, props.className); 19845 } else if (props.className != null) { 19846 className = props.className + " "; 19847 } 19848 19849 var serialized = serializeStyles(registeredStyles, undefined, reactExports.useContext(ThemeContext)); 19850 19851 className += cache.key + "-" + serialized.name; 19852 var newProps = {}; 19853 19854 for (var _key2 in props) { 19855 if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (true )) { 19856 newProps[_key2] = props[_key2]; 19857 } 19858 } 19859 19860 newProps.className = className; 19861 19862 if (ref) { 19863 newProps.ref = ref; 19864 } 19865 19866 return /*#__PURE__*/reactExports.createElement(reactExports.Fragment, null, /*#__PURE__*/reactExports.createElement(Insertion, { 19867 cache: cache, 19868 serialized: serialized, 19869 isStringTag: typeof WrappedComponent === 'string' 19870 }), /*#__PURE__*/reactExports.createElement(WrappedComponent, newProps)); 19871}); 19872 19873var Emotion$1 = Emotion; 19874 19875var jsx = function jsx(type, props) { 19876 // eslint-disable-next-line prefer-rest-params 19877 var args = arguments; 19878 19879 if (props == null || !hasOwn.call(props, 'css')) { 19880 return reactExports.createElement.apply(undefined, args); 19881 } 19882 19883 var argsLength = args.length; 19884 var createElementArgArray = new Array(argsLength); 19885 createElementArgArray[0] = Emotion$1; 19886 createElementArgArray[1] = createEmotionProps(type, props); 19887 19888 for (var i = 2; i < argsLength; i++) { 19889 createElementArgArray[i] = args[i]; 19890 } 19891 19892 return reactExports.createElement.apply(null, createElementArgArray); 19893}; 19894 19895(function (_jsx) { 19896 var JSX; 19897 19898 (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {}))); 19899})(jsx || (jsx = {})); 19900 19901function css() { 19902 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 19903 args[_key] = arguments[_key]; 19904 } 19905 19906 return serializeStyles(args); 19907} 19908 19909function keyframes$1() { 19910 var insertable = css.apply(void 0, arguments); 19911 var name = "animation-" + insertable.name; 19912 return { 19913 name: name, 19914 styles: "@keyframes " + name + "{" + insertable.styles + "}", 19915 anim: 1, 19916 toString: function toString() { 19917 return "_EMO_" + this.name + "_" + this.styles + "_EMO_"; 19918 } 19919 }; 19920} 19921 19922function _taggedTemplateLiteral(e, t) { 19923 return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { 19924 raw: { 19925 value: Object.freeze(t) 19926 } 19927 })); 19928} 19929 19930/** 19931 * Custom positioning reference element. 19932 * @see https://floating-ui.com/docs/virtual-elements 19933 */ 19934 19935const min = Math.min; 19936const max = Math.max; 19937const round = Math.round; 19938const floor = Math.floor; 19939const createCoords = v => ({ 19940 x: v, 19941 y: v 19942}); 19943function rectToClientRect(rect) { 19944 const { 19945 x, 19946 y, 19947 width, 19948 height 19949 } = rect; 19950 return { 19951 width, 19952 height, 19953 top: y, 19954 left: x, 19955 right: x + width, 19956 bottom: y + height, 19957 x, 19958 y 19959 }; 19960} 19961 19962function hasWindow() { 19963 return typeof window !== 'undefined'; 19964} 19965function getNodeName(node) { 19966 if (isNode(node)) { 19967 return (node.nodeName || '').toLowerCase(); 19968 } 19969 // Mocked nodes in testing environments may not be instances of Node. By 19970 // returning `#document` an infinite loop won't occur. 19971 // https://github.com/floating-ui/floating-ui/issues/2317 19972 return '#document'; 19973} 19974function getWindow(node) { 19975 var _node$ownerDocument; 19976 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 19977} 19978function getDocumentElement(node) { 19979 var _ref; 19980 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 19981} 19982function isNode(value) { 19983 if (!hasWindow()) { 19984 return false;
vendor: 2,814 bytes, lines 19985-20067
19985 } 19986 return value instanceof Node || value instanceof getWindow(value).Node; 19987} 19988function isElement(value) { 19989 if (!hasWindow()) { 19990 return false; 19991 } 19992 return value instanceof Element || value instanceof getWindow(value).Element; 19993} 19994function isHTMLElement(value) { 19995 if (!hasWindow()) { 19996 return false; 19997 } 19998 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 19999} 20000function isShadowRoot(value) { 20001 if (!hasWindow() || typeof ShadowRoot === 'undefined') { 20002 return false; 20003 } 20004 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 20005} 20006function isOverflowElement(element) { 20007 const { 20008 overflow, 20009 overflowX, 20010 overflowY, 20011 display 20012 } = getComputedStyle$2(element); 20013 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display); 20014} 20015function isWebKit() { 20016 if (typeof CSS === 'undefined' || !CSS.supports) return false; 20017 return CSS.supports('-webkit-backdrop-filter', 'none'); 20018} 20019function isLastTraversableNode(node) { 20020 return ['html', 'body', '#document'].includes(getNodeName(node)); 20021} 20022function getComputedStyle$2(element) { 20023 return getWindow(element).getComputedStyle(element); 20024} 20025function getParentNode(node) { 20026 if (getNodeName(node) === 'html') { 20027 return node; 20028 } 20029 const result = 20030 // Step into the shadow DOM of the parent of a slotted node. 20031 node.assignedSlot || 20032 // DOM Element detected. 20033 node.parentNode || 20034 // ShadowRoot detected. 20035 isShadowRoot(node) && node.host || 20036 // Fallback. 20037 getDocumentElement(node); 20038 return isShadowRoot(result) ? result.host : result; 20039} 20040function getNearestOverflowAncestor(node) { 20041 const parentNode = getParentNode(node); 20042 if (isLastTraversableNode(parentNode)) { 20043 return node.ownerDocument ? node.ownerDocument.body : node.body; 20044 } 20045 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 20046 return parentNode; 20047 } 20048 return getNearestOverflowAncestor(parentNode); 20049} 20050function getOverflowAncestors(node, list, traverseIframes) { 20051 var _node$ownerDocument2; 20052 if (list === void 0) { 20053 list = []; 20054 } 20055 if (traverseIframes === void 0) { 20056 traverseIframes = true; 20057 } 20058 const scrollableAncestor = getNearestOverflowAncestor(node); 20059 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 20060 const win = getWindow(scrollableAncestor); 20061 if (isBody) { 20062 const frameElement = getFrameElement(win); 20063 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 20064 } 20065 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 20066} 20067function getFrameElement(win) {
vendor: 7,026 bytes, lines 20068-20297
20068 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 20069} 20070 20071function getCssDimensions(element) { 20072 const css = getComputedStyle$2(element); 20073 // In testing environments, the `width` and `height` properties are empty 20074 // strings for SVG elements, returning NaN. Fallback to `0` in this case. 20075 let width = parseFloat(css.width) || 0; 20076 let height = parseFloat(css.height) || 0; 20077 const hasOffset = isHTMLElement(element); 20078 const offsetWidth = hasOffset ? element.offsetWidth : width; 20079 const offsetHeight = hasOffset ? element.offsetHeight : height; 20080 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 20081 if (shouldFallback) { 20082 width = offsetWidth; 20083 height = offsetHeight; 20084 } 20085 return { 20086 width, 20087 height, 20088 $: shouldFallback 20089 }; 20090} 20091 20092function unwrapElement(element) { 20093 return !isElement(element) ? element.contextElement : element; 20094} 20095 20096function getScale(element) { 20097 const domElement = unwrapElement(element); 20098 if (!isHTMLElement(domElement)) { 20099 return createCoords(1); 20100 } 20101 const rect = domElement.getBoundingClientRect(); 20102 const { 20103 width, 20104 height, 20105 $ 20106 } = getCssDimensions(domElement); 20107 let x = ($ ? round(rect.width) : rect.width) / width; 20108 let y = ($ ? round(rect.height) : rect.height) / height; 20109 20110 // 0, NaN, or Infinity should always fallback to 1. 20111 20112 if (!x || !Number.isFinite(x)) { 20113 x = 1; 20114 } 20115 if (!y || !Number.isFinite(y)) { 20116 y = 1; 20117 } 20118 return { 20119 x, 20120 y 20121 }; 20122} 20123 20124const noOffsets = /*#__PURE__*/createCoords(0); 20125function getVisualOffsets(element) { 20126 const win = getWindow(element); 20127 if (!isWebKit() || !win.visualViewport) { 20128 return noOffsets; 20129 } 20130 return { 20131 x: win.visualViewport.offsetLeft, 20132 y: win.visualViewport.offsetTop 20133 }; 20134} 20135function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 20136 { 20137 return false; 20138 } 20139} 20140 20141function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 20142 if (includeScale === void 0) { 20143 includeScale = false; 20144 } 20145 const clientRect = element.getBoundingClientRect(); 20146 const domElement = unwrapElement(element); 20147 let scale = createCoords(1); 20148 if (includeScale) { 20149 { 20150 scale = getScale(element); 20151 } 20152 } 20153 const visualOffsets = shouldAddVisualOffsets() ? getVisualOffsets(domElement) : createCoords(0); 20154 let x = (clientRect.left + visualOffsets.x) / scale.x; 20155 let y = (clientRect.top + visualOffsets.y) / scale.y; 20156 let width = clientRect.width / scale.x; 20157 let height = clientRect.height / scale.y; 20158 if (domElement) { 20159 const win = getWindow(domElement); 20160 const offsetWin = offsetParent; 20161 let currentWin = win; 20162 let currentIFrame = getFrameElement(currentWin); 20163 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 20164 const iframeScale = getScale(currentIFrame); 20165 const iframeRect = currentIFrame.getBoundingClientRect(); 20166 const css = getComputedStyle$2(currentIFrame); 20167 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 20168 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 20169 x *= iframeScale.x; 20170 y *= iframeScale.y; 20171 width *= iframeScale.x; 20172 height *= iframeScale.y; 20173 x += left; 20174 y += top; 20175 currentWin = getWindow(currentIFrame); 20176 currentIFrame = getFrameElement(currentWin); 20177 } 20178 } 20179 return rectToClientRect({ 20180 width, 20181 height, 20182 x, 20183 y 20184 }); 20185} 20186 20187function rectsAreEqual(a, b) { 20188 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 20189} 20190 20191// https://samthor.au/2021/observing-dom/ 20192function observeMove(element, onMove) { 20193 let io = null; 20194 let timeoutId; 20195 const root = getDocumentElement(element); 20196 function cleanup() { 20197 var _io; 20198 clearTimeout(timeoutId); 20199 (_io = io) == null || _io.disconnect(); 20200 io = null; 20201 } 20202 function refresh(skip, threshold) { 20203 if (skip === void 0) { 20204 skip = false; 20205 } 20206 if (threshold === void 0) { 20207 threshold = 1; 20208 } 20209 cleanup(); 20210 const elementRectForRootMargin = element.getBoundingClientRect(); 20211 const { 20212 left, 20213 top, 20214 width, 20215 height 20216 } = elementRectForRootMargin; 20217 if (!skip) { 20218 onMove(); 20219 } 20220 if (!width || !height) { 20221 return; 20222 } 20223 const insetTop = floor(top); 20224 const insetRight = floor(root.clientWidth - (left + width)); 20225 const insetBottom = floor(root.clientHeight - (top + height)); 20226 const insetLeft = floor(left); 20227 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 20228 const options = { 20229 rootMargin, 20230 threshold: max(0, min(1, threshold)) || 1 20231 }; 20232 let isFirstUpdate = true; 20233 function handleObserve(entries) { 20234 const ratio = entries[0].intersectionRatio; 20235 if (ratio !== threshold) { 20236 if (!isFirstUpdate) { 20237 return refresh(); 20238 } 20239 if (!ratio) { 20240 // If the reference is clipped, the ratio is 0. Throttle the refresh 20241 // to prevent an infinite loop of updates. 20242 timeoutId = setTimeout(() => { 20243 refresh(false, 1e-7); 20244 }, 1000); 20245 } else { 20246 refresh(false, ratio); 20247 } 20248 } 20249 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 20250 // It's possible that even though the ratio is reported as 1, the 20251 // element is not actually fully within the IntersectionObserver's root 20252 // area anymore. This can happen under performance constraints. This may 20253 // be a bug in the browser's IntersectionObserver implementation. To 20254 // work around this, we compare the element's bounding rect now with 20255 // what it was at the time we created the IntersectionObserver. If they 20256 // are not equal then the element moved, so we refresh. 20257 refresh(); 20258 } 20259 isFirstUpdate = false; 20260 } 20261 20262 // Older browsers don't support a `document` as the root and will throw an 20263 // error. 20264 try { 20265 io = new IntersectionObserver(handleObserve, { 20266 ...options, 20267 // Handle <iframe>s 20268 root: root.ownerDocument 20269 }); 20270 } catch (e) { 20271 io = new IntersectionObserver(handleObserve, options); 20272 } 20273 io.observe(element); 20274 } 20275 refresh(true); 20276 return cleanup; 20277} 20278 20279/** 20280 * Automatically updates the position of the floating element when necessary. 20281 * Should only be called when the floating element is mounted on the DOM or 20282 * visible on the screen. 20283 * @returns cleanup function that should be invoked when the floating element is 20284 * removed from the DOM or hidden from the screen. 20285 * @see https://floating-ui.com/docs/autoUpdate 20286 */ 20287function autoUpdate(reference, floating, update, options) { 20288 if (options === void 0) { 20289 options = {}; 20290 } 20291 const { 20292 ancestorScroll = true, 20293 ancestorResize = true, 20294 elementResize = typeof ResizeObserver === 'function', 20295 layoutShift = typeof IntersectionObserver === 'function', 20296 animationFrame = false 20297 }
vendor: 13,013 bytes, lines 20297-20673
20297 = options; 20298 const referenceEl = unwrapElement(reference); 20299 const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : []; 20300 ancestors.forEach(ancestor => { 20301 ancestorScroll && ancestor.addEventListener('scroll', update, { 20302 passive: true 20303 }); 20304 ancestorResize && ancestor.addEventListener('resize', update); 20305 }); 20306 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 20307 let reobserveFrame = -1; 20308 let resizeObserver = null; 20309 if (elementResize) { 20310 resizeObserver = new ResizeObserver(_ref => { 20311 let [firstEntry] = _ref; 20312 if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { 20313 // Prevent update loops when using the `size` middleware. 20314 // https://github.com/floating-ui/floating-ui/issues/1740 20315 resizeObserver.unobserve(floating); 20316 cancelAnimationFrame(reobserveFrame); 20317 reobserveFrame = requestAnimationFrame(() => { 20318 var _resizeObserver; 20319 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 20320 }); 20321 } 20322 update(); 20323 }); 20324 if (referenceEl && !animationFrame) { 20325 resizeObserver.observe(referenceEl); 20326 } 20327 resizeObserver.observe(floating); 20328 } 20329 let frameId; 20330 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 20331 if (animationFrame) { 20332 frameLoop(); 20333 } 20334 function frameLoop() { 20335 const nextRefRect = getBoundingClientRect(reference); 20336 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 20337 update(); 20338 } 20339 prevRefRect = nextRefRect; 20340 frameId = requestAnimationFrame(frameLoop); 20341 } 20342 update(); 20343 return () => { 20344 var _resizeObserver2; 20345 ancestors.forEach(ancestor => { 20346 ancestorScroll && ancestor.removeEventListener('scroll', update); 20347 ancestorResize && ancestor.removeEventListener('resize', update); 20348 }); 20349 cleanupIo == null || cleanupIo(); 20350 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 20351 resizeObserver = null; 20352 if (animationFrame) { 20353 cancelAnimationFrame(frameId); 20354 } 20355 }; 20356} 20357 20358var index = reactExports.useLayoutEffect ; 20359 20360var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"]; 20361var noop$1 = function noop2() { 20362}; 20363function applyPrefixToName(prefix, name) { 20364 if (!name) { 20365 return prefix; 20366 } else if (name[0] === "-") { 20367 return prefix + name; 20368 } else { 20369 return prefix + "__" + name; 20370 } 20371} 20372function classNames(prefix, state) { 20373 for (var _len = arguments.length, classNameList = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { 20374 classNameList[_key - 2] = arguments[_key]; 20375 } 20376 var arr = [].concat(classNameList); 20377 if (state && prefix) { 20378 for (var key in state) { 20379 if (state.hasOwnProperty(key) && state[key]) { 20380 arr.push("".concat(applyPrefixToName(prefix, key))); 20381 } 20382 } 20383 } 20384 return arr.filter(function(i) { 20385 return i; 20386 }).map(function(i) { 20387 return String(i).trim(); 20388 }).join(" "); 20389} 20390var cleanValue = function cleanValue2(value) { 20391 if (isArray(value)) return value.filter(Boolean); 20392 if (_typeof(value) === "object" && value !== null) return [value]; 20393 return []; 20394}; 20395var cleanCommonProps = function cleanCommonProps2(props) { 20396 props.className; 20397 props.clearValue; 20398 props.cx; 20399 props.getStyles; 20400 props.getClassNames; 20401 props.getValue; 20402 props.hasValue; 20403 props.isMulti; 20404 props.isRtl; 20405 props.options; 20406 props.selectOption; 20407 props.selectProps; 20408 props.setValue; 20409 props.theme; 20410 var innerProps = _objectWithoutProperties(props, _excluded$4); 20411 return _objectSpread2({}, innerProps); 20412}; 20413var getStyleProps = function getStyleProps2(props, name, classNamesState) { 20414 var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className; 20415 return { 20416 css: getStyles(name, props), 20417 className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className) 20418 }; 20419}; 20420function isDocumentElement(el) { 20421 return [document.documentElement, document.body, window].indexOf(el) > -1; 20422} 20423function normalizedHeight(el) { 20424 if (isDocumentElement(el)) { 20425 return window.innerHeight; 20426 } 20427 return el.clientHeight; 20428} 20429function getScrollTop(el) { 20430 if (isDocumentElement(el)) { 20431 return window.pageYOffset; 20432 } 20433 return el.scrollTop; 20434} 20435function scrollTo(el, top) { 20436 if (isDocumentElement(el)) { 20437 window.scrollTo(0, top); 20438 return; 20439 } 20440 el.scrollTop = top; 20441} 20442function getScrollParent(element) { 20443 var style = getComputedStyle(element); 20444 var excludeStaticParent = style.position === "absolute"; 20445 var overflowRx = /(auto|scroll)/; 20446 if (style.position === "fixed") return document.documentElement; 20447 for (var parent = element; parent = parent.parentElement; ) { 20448 style = getComputedStyle(parent); 20449 if (excludeStaticParent && style.position === "static") { 20450 continue; 20451 } 20452 if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) { 20453 return parent; 20454 } 20455 } 20456 return document.documentElement; 20457} 20458function easeOutCubic(t, b, c, d) { 20459 return c * ((t = t / d - 1) * t * t + 1) + b; 20460} 20461function animatedScrollTo(element, to) { 20462 var duration = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 200; 20463 var callback = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : noop$1; 20464 var start = getScrollTop(element); 20465 var change = to - start; 20466 var increment = 10; 20467 var currentTime = 0; 20468 function animateScroll() { 20469 currentTime += increment; 20470 var val = easeOutCubic(currentTime, start, change, duration); 20471 scrollTo(element, val); 20472 if (currentTime < duration) { 20473 window.requestAnimationFrame(animateScroll); 20474 } else { 20475 callback(element); 20476 } 20477 } 20478 animateScroll(); 20479} 20480function scrollIntoView(menuEl, focusedEl) { 20481 var menuRect = menuEl.getBoundingClientRect(); 20482 var focusedRect = focusedEl.getBoundingClientRect(); 20483 var overScroll = focusedEl.offsetHeight / 3; 20484 if (focusedRect.bottom + overScroll > menuRect.bottom) { 20485 scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight)); 20486 } else if (focusedRect.top - overScroll < menuRect.top) { 20487 scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0)); 20488 } 20489} 20490function getBoundingClientObj(element) { 20491 var rect = element.getBoundingClientRect(); 20492 return { 20493 bottom: rect.bottom, 20494 height: rect.height, 20495 left: rect.left, 20496 right: rect.right, 20497 top: rect.top, 20498 width: rect.width 20499 }; 20500} 20501function isTouchCapable() { 20502 try { 20503 document.createEvent("TouchEvent"); 20504 return true; 20505 } catch (e) { 20506 return false; 20507 } 20508} 20509function isMobileDevice() { 20510 try { 20511 return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 20512 } catch (e) { 20513 return false; 20514 } 20515} 20516var passiveOptionAccessed = false; 20517var options = { 20518 get passive() { 20519 return passiveOptionAccessed = true; 20520 } 20521}; 20522var w$1 = typeof window !== "undefined" ? window : {}; 20523if (w$1.addEventListener && w$1.removeEventListener) { 20524 w$1.addEventListener("p", noop$1, options); 20525 w$1.removeEventListener("p", noop$1, false); 20526} 20527var supportsPassiveEvents = passiveOptionAccessed; 20528function notNullish(item) { 20529 return item != null; 20530} 20531function isArray(arg) { 20532 return Array.isArray(arg); 20533} 20534function valueTernary(isMulti, multiValue, singleValue) { 20535 return isMulti ? multiValue : singleValue; 20536} 20537function singleValueAsValue(singleValue) { 20538 return singleValue; 20539} 20540function multiValueAsValue(multiValue) { 20541 return multiValue; 20542} 20543var removeProps = function removeProps2(propsObj) { 20544 for (var _len2 = arguments.length, properties = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 20545 properties[_key2 - 1] = arguments[_key2]; 20546 } 20547 var propsMap = Object.entries(propsObj).filter(function(_ref) { 20548 var _ref22 = _slicedToArray(_ref, 1), key = _ref22[0]; 20549 return !properties.includes(key); 20550 }); 20551 return propsMap.reduce(function(newProps, _ref3) { 20552 var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], val = _ref4[1]; 20553 newProps[key] = val; 20554 return newProps; 20555 }, {}); 20556}; 20557var _excluded$3 = ["children", "innerProps"], _excluded2$1 = ["children", "innerProps"]; 20558function getMenuPlacement(_ref) { 20559 var preferredMaxHeight = _ref.maxHeight, menuEl = _ref.menuEl, minHeight = _ref.minHeight, preferredPlacement = _ref.placement, shouldScroll = _ref.shouldScroll, isFixedPosition = _ref.isFixedPosition, controlHeight = _ref.controlHeight; 20560 var scrollParent = getScrollParent(menuEl); 20561 var defaultState = { 20562 placement: "bottom", 20563 maxHeight: preferredMaxHeight 20564 }; 20565 if (!menuEl || !menuEl.offsetParent) return defaultState; 20566 var _scrollParent$getBoun = scrollParent.getBoundingClientRect(), scrollHeight = _scrollParent$getBoun.height; 20567 var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(), menuBottom = _menuEl$getBoundingCl.bottom, menuHeight = _menuEl$getBoundingCl.height, menuTop = _menuEl$getBoundingCl.top; 20568 var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(), containerTop = _menuEl$offsetParent$.top; 20569 var viewHeight = isFixedPosition ? window.innerHeight : normalizedHeight(scrollParent); 20570 var scrollTop = getScrollTop(scrollParent); 20571 var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10); 20572 var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10); 20573 var viewSpaceAbove = containerTop - marginTop; 20574 var viewSpaceBelow = viewHeight - menuTop; 20575 var scrollSpaceAbove = viewSpaceAbove + scrollTop; 20576 var scrollSpaceBelow = scrollHeight - scrollTop - menuTop; 20577 var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom; 20578 var scrollUp = scrollTop + menuTop - marginTop; 20579 var scrollDuration = 160; 20580 switch (preferredPlacement) { 20581 case "auto": 20582 case "bottom": 20583 if (viewSpaceBelow >= menuHeight) { 20584 return { 20585 placement: "bottom", 20586 maxHeight: preferredMaxHeight 20587 }; 20588 } 20589 if (scrollSpaceBelow >= menuHeight && !isFixedPosition) { 20590 if (shouldScroll) { 20591 animatedScrollTo(scrollParent, scrollDown, scrollDuration); 20592 } 20593 return { 20594 placement: "bottom", 20595 maxHeight: preferredMaxHeight 20596 }; 20597 } 20598 if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) { 20599 if (shouldScroll) { 20600 animatedScrollTo(scrollParent, scrollDown, scrollDuration); 20601 } 20602 var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom; 20603 return { 20604 placement: "bottom", 20605 maxHeight: constrainedHeight 20606 }; 20607 } 20608 if (preferredPlacement === "auto" || isFixedPosition) { 20609 var _constrainedHeight = preferredMaxHeight; 20610 var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove; 20611 if (spaceAbove >= minHeight) { 20612 _constrainedHeight = Math.min(spaceAbove - marginBottom - controlHeight, preferredMaxHeight); 20613 } 20614 return { 20615 placement: "top", 20616 maxHeight: _constrainedHeight 20617 }; 20618 } 20619 if (preferredPlacement === "bottom") { 20620 if (shouldScroll) { 20621 scrollTo(scrollParent, scrollDown); 20622 } 20623 return { 20624 placement: "bottom", 20625 maxHeight: preferredMaxHeight 20626 }; 20627 } 20628 break; 20629 case "top": 20630 if (viewSpaceAbove >= menuHeight) { 20631 return { 20632 placement: "top", 20633 maxHeight: preferredMaxHeight 20634 }; 20635 } 20636 if (scrollSpaceAbove >= menuHeight && !isFixedPosition) { 20637 if (shouldScroll) { 20638 animatedScrollTo(scrollParent, scrollUp, scrollDuration); 20639 } 20640 return { 20641 placement: "top", 20642 maxHeight: preferredMaxHeight 20643 }; 20644 } 20645 if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) { 20646 var _constrainedHeight2 = preferredMaxHeight; 20647 if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) { 20648 _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop; 20649 } 20650 if (shouldScroll) { 20651 animatedScrollTo(scrollParent, scrollUp, scrollDuration); 20652 } 20653 return { 20654 placement: "top", 20655 maxHeight: _constrainedHeight2 20656 }; 20657 } 20658 return { 20659 placement: "bottom", 20660 maxHeight: preferredMaxHeight 20661 }; 20662 default: 20663 throw new Error('Invalid placement provided "'.concat(preferredPlacement, '".')); 20664 } 20665 return defaultState; 20666} 20667function alignToControl(placement) { 20668 var placementToCSSProp = { 20669 bottom: "top", 20670 top: "bottom" 20671 }; 20672 return placement ? placementToCSSProp[placement] : "bottom"; 20673}
20674var coercePlacement = function coercePlacement2(p) { 20675 return p === "auto" ? "bottom" : p; 20676}; 20677var menuCSS = function menuCSS2(_ref22, unstyled) { 20678 var _objectSpread2$1; 20679 var placement = _ref22.placement, _ref2$theme = _ref22.theme, borderRadius = _ref2$theme.borderRadius, spacing = _ref2$theme.spacing, colors = _ref2$theme.colors; 20680 return _objectSpread2((_objectSpread2$1 = { 20681 label: "menu" 20682 }, _defineProperty(_objectSpread2$1, alignToControl(placement), "100%"), _defineProperty(_objectSpread2$1, "position", "absolute"), _defineProperty(_objectSpread2$1, "width", "100%"), _defineProperty(_objectSpread2$1, "zIndex", 1), _objectSpread2$1), unstyled ? {} : { 20683 backgroundColor: colors.neutral0, 20684 borderRadius, 20685 boxShadow: "0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)", 20686 marginBottom: spacing.menuGutter, 20687 marginTop: spacing.menuGutter 20688 }); 20689}; 20690var PortalPlacementContext = /* @__PURE__ */ reactExports.createContext(null); 20691var MenuPlacer = function MenuPlacer2(props) { 20692 var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme; 20693 var _ref3 = reactExports.useContext(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement; 20694 var ref = reactExports.useRef(null); 20695 var _useState = reactExports.useState(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1]; 20696 var _useState3 = reactExports.useState(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1]; 20697 var controlHeight = theme.spacing.controlHeight; 20698 index(function() { 20699 var menuEl = ref.current; 20700 if (!menuEl) return; 20701 var isFixedPosition = menuPosition === "fixed"; 20702 var shouldScroll = menuShouldScrollIntoView && !isFixedPosition; 20703 var state = getMenuPlacement({ 20704 maxHeight: maxMenuHeight, 20705 menuEl, 20706 minHeight: minMenuHeight, 20707 placement: menuPlacement, 20708 shouldScroll, 20709 isFixedPosition, 20710 controlHeight 20711 }); 20712 setMaxHeight(state.maxHeight); 20713 setPlacement(state.placement); 20714 setPortalPlacement === null || setPortalPlacement === void 0 ? void 0 : setPortalPlacement(state.placement); 20715 }, [maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, setPortalPlacement, controlHeight]); 20716 return children({ 20717 ref, 20718 placerProps: _objectSpread2(_objectSpread2({}, props), {}, { 20719 placement: placement || coercePlacement(menuPlacement), 20720 maxHeight 20721 }) 20722 }); 20723}; 20724var Menu = function Menu2(props) { 20725 var children = props.children, innerRef = props.innerRef, innerProps = props.innerProps; 20726 return jsx("div", _extends({}, getStyleProps(props, "menu", { 20727 menu: true 20728 }), { 20729 ref: innerRef 20730 }, innerProps), children); 20731}; 20732var Menu$1 = Menu; 20733var menuListCSS = function menuListCSS2(_ref4, unstyled) { 20734 var maxHeight = _ref4.maxHeight, baseUnit = _ref4.theme.spacing.baseUnit; 20735 return _objectSpread2({ 20736 maxHeight, 20737 overflowY: "auto", 20738 position: "relative", 20739 // required for offset[Height, Top] > keyboard scroll 20740 WebkitOverflowScrolling: "touch" 20741 }, unstyled ? {} : { 20742 paddingBottom: baseUnit, 20743 paddingTop: baseUnit 20744 }); 20745}; 20746var MenuList$1 = function MenuList2(props) { 20747 var children = props.children, innerProps = props.innerProps, innerRef = props.innerRef, isMulti = props.isMulti; 20748 return jsx("div", _extends({}, getStyleProps(props, "menuList", { 20749 "menu-list": true, 20750 "menu-list--is-multi": isMulti 20751 }), { 20752 ref: innerRef 20753 }, innerProps), children); 20754}; 20755var noticeCSS = function noticeCSS2(_ref5, unstyled) { 20756 var _ref5$theme = _ref5.theme, baseUnit = _ref5$theme.spacing.baseUnit, colors = _ref5$theme.colors; 20757 return _objectSpread2({ 20758 textAlign: "center" 20759 }, unstyled ? {} : { 20760 color: colors.neutral40, 20761 padding: "".concat(baseUnit * 2, "px ").concat(baseUnit * 3, "px") 20762 }); 20763}; 20764var noOptionsMessageCSS = noticeCSS; 20765var loadingMessageCSS = noticeCSS; 20766var NoOptionsMessage = function NoOptionsMessage2(_ref6) { 20767 var _ref6$children = _ref6.children, children = _ref6$children === void 0 ? "No options" : _ref6$children, innerProps = _ref6.innerProps, restProps = _objectWithoutProperties(_ref6, _excluded$3); 20768 return jsx("div", _extends({}
20768, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, { 20769 children, 20770 innerProps 20771 }), "noOptionsMessage", { 20772 "menu-notice": true, 20773 "menu-notice--no-options": true 20774 }), innerProps), children); 20775}; 20776var LoadingMessage = function LoadingMessage2(_ref7) { 20777 var _ref7$children = _ref7.children, children = _ref7$children === void 0 ? "Loading..." : _ref7$children, innerProps = _ref7.innerProps, restProps = _objectWithoutProperties(_ref7, _excluded2$1); 20778 return jsx("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, { 20779 children, 20780 innerProps 20781 }), "loadingMessage", { 20782 "menu-notice": true, 20783 "menu-notice--loading": true 20784 }), innerProps), children); 20785}; 20786var menuPortalCSS = function menuPortalCSS2(_ref8) { 20787 var rect = _ref8.rect, offset = _ref8.offset, position = _ref8.position; 20788 return { 20789 left: rect.left, 20790 position, 20791 top: offset, 20792 width: rect.width, 20793 zIndex: 1 20794 }; 20795}; 20796var MenuPortal = function MenuPortal2(props) { 20797 var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition; 20798 var menuPortalRef = reactExports.useRef(null); 20799 var cleanupRef = reactExports.useRef(null); 20800 var _useState5 = reactExports.useState(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1]; 20801 var portalPlacementContext = reactExports.useMemo(function() { 20802 return { 20803 setPortalPlacement 20804 }; 20805 }, []); 20806 var _useState7 = reactExports.useState(null), _useState8 = _slicedToArray(_useState7, 2), computedPosition = _useState8[0], setComputedPosition = _useState8[1]; 20807 var updateComputedPosition = reactExports.useCallback(function() { 20808 if (!controlElement) return; 20809 var rect = getBoundingClientObj(controlElement); 20810 var scrollDistance = menuPosition === "fixed" ? 0 : window.pageYOffset; 20811 var offset = rect[placement] + scrollDistance; 20812 if (offset !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset) || rect.left !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left) || rect.width !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width)) { 20813 setComputedPosition({ 20814 offset, 20815 rect 20816 }); 20817 } 20818 }, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]); 20819 index(function() { 20820 updateComputedPosition(); 20821 }, [updateComputedPosition]); 20822 var runAutoUpdate = reactExports.useCallback(function() { 20823 if (typeof cleanupRef.current === "function") { 20824 cleanupRef.current(); 20825 cleanupRef.current = null; 20826 } 20827 if (controlElement && menuPortalRef.current) { 20828 cleanupRef.current = autoUpdate(controlElement, menuPortalRef.current, updateComputedPosition, { 20829 elementResize: "ResizeObserver" in window 20830 }); 20831 } 20832 }, [controlElement, updateComputedPosition]); 20833 index(function() { 20834 runAutoUpdate(); 20835 }, [runAutoUpdate]); 20836 var setMenuPortalElement = reactExports.useCallback(function(menuPortalElement) { 20837 menuPortalRef.current = menuPortalElement; 20838 runAutoUpdate(); 20839 }, [runAutoUpdate]); 20840 if (!appendTo && menuPosition !== "fixed" || !computedPosition) return null; 20841 var menuWrapper = jsx("div", _extends({ 20842 ref: setMenuPortalElement 20843 }, getStyleProps(_objectSpread2(_objectSpread2({}, props), {}, { 20844 offset: computedPosition.offset, 20845 position: menuPosition, 20846 rect: computedPosition.rect 20847 }), "menuPortal", { 20848 "menu-portal": true 20849 }), innerProps), children); 20850 return jsx(PortalPlacementContext.Provider, { 20851 value: portalPlacementContext 20852 }, appendTo ? /* @__PURE__ */ reactDomExports.createPortal(menuWrapper, appendTo) : menuWrapper); 20853}; 20854var containerCSS = function containerCSS2(_ref) { 20855 var isDisabled = _ref.isDisabled, isRtl = _ref.isRtl; 20856 return { 20857 label: "container", 20858 direction: isRtl ? "rtl" : void 0, 20859 pointerEvents: isDisabled ? "none" : void 0, 20860 // cancel mouse events when disabled 20861 position: "relative" 20862 }; 20863}; 20864var SelectContainer = function SelectContainer2(props) { 20865 var children = props.children, innerProps = props.innerProps, isDisabled = props.isDisabled, isRtl = props.isRtl; 20866 return jsx("div", _extends({}, getStyleProps(props, "container", { 20867 "--is-disabled": isDisabled, 20868 "--is-rtl": isRtl 20869 }), innerProps), children); 20870}; 20871var valueContainerCSS = function valueContainerCSS2(_ref22, unstyled) { 20872 var spacing = _ref22.theme.spacing, isMulti = _ref22.isMulti, hasValue = _ref22.hasValue, controlShouldRenderValue = _ref22.selectProps.controlShouldRenderValue;
vendor: 4,503 bytes, lines 20873-20985
20873 return _objectSpread2({ 20874 alignItems: "center", 20875 display: isMulti && hasValue && controlShouldRenderValue ? "flex" : "grid", 20876 flex: 1, 20877 flexWrap: "wrap", 20878 WebkitOverflowScrolling: "touch", 20879 position: "relative", 20880 overflow: "hidden" 20881 }, unstyled ? {} : { 20882 padding: "".concat(spacing.baseUnit / 2, "px ").concat(spacing.baseUnit * 2, "px") 20883 }); 20884}; 20885var ValueContainer = function ValueContainer2(props) { 20886 var children = props.children, innerProps = props.innerProps, isMulti = props.isMulti, hasValue = props.hasValue; 20887 return jsx("div", _extends({}, getStyleProps(props, "valueContainer", { 20888 "value-container": true, 20889 "value-container--is-multi": isMulti, 20890 "value-container--has-value": hasValue 20891 }), innerProps), children); 20892}; 20893var indicatorsContainerCSS = function indicatorsContainerCSS2() { 20894 return { 20895 alignItems: "center", 20896 alignSelf: "stretch", 20897 display: "flex", 20898 flexShrink: 0 20899 }; 20900}; 20901var IndicatorsContainer = function IndicatorsContainer2(props) { 20902 var children = props.children, innerProps = props.innerProps; 20903 return jsx("div", _extends({}, getStyleProps(props, "indicatorsContainer", { 20904 indicators: true 20905 }), innerProps), children); 20906}; 20907var _templateObject; 20908var _excluded$2 = ["size"], _excluded2 = ["innerProps", "isRtl", "size"]; 20909var _ref2$2 = { 20910 name: "8mmkcg", 20911 styles: "display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0" 20912} ; 20913var Svg = function Svg2(_ref) { 20914 var size = _ref.size, props = _objectWithoutProperties(_ref, _excluded$2); 20915 return jsx("svg", _extends({ 20916 height: size, 20917 width: size, 20918 viewBox: "0 0 20 20", 20919 "aria-hidden": "true", 20920 focusable: "false", 20921 css: _ref2$2 20922 }, props)); 20923}; 20924var CrossIcon = function CrossIcon2(props) { 20925 return jsx(Svg, _extends({ 20926 size: 20 20927 }, props), jsx("path", { 20928 d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" 20929 })); 20930}; 20931var DownChevron = function DownChevron2(props) { 20932 return jsx(Svg, _extends({ 20933 size: 20 20934 }, props), jsx("path", { 20935 d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" 20936 })); 20937}; 20938var baseCSS = function baseCSS2(_ref3, unstyled) { 20939 var isFocused = _ref3.isFocused, _ref3$theme = _ref3.theme, baseUnit = _ref3$theme.spacing.baseUnit, colors = _ref3$theme.colors; 20940 return _objectSpread2({ 20941 label: "indicatorContainer", 20942 display: "flex", 20943 transition: "color 150ms" 20944 }, unstyled ? {} : { 20945 color: isFocused ? colors.neutral60 : colors.neutral20, 20946 padding: baseUnit * 2, 20947 ":hover": { 20948 color: isFocused ? colors.neutral80 : colors.neutral40 20949 } 20950 }); 20951}; 20952var dropdownIndicatorCSS = baseCSS; 20953var DropdownIndicator$1 = function DropdownIndicator2(props) { 20954 var children = props.children, innerProps = props.innerProps; 20955 return jsx("div", _extends({}, getStyleProps(props, "dropdownIndicator", { 20956 indicator: true, 20957 "dropdown-indicator": true 20958 }), innerProps), children || jsx(DownChevron, null)); 20959}; 20960var clearIndicatorCSS = baseCSS; 20961var ClearIndicator = function ClearIndicator2(props) { 20962 var children = props.children, innerProps = props.innerProps; 20963 return jsx("div", _extends({}, getStyleProps(props, "clearIndicator", { 20964 indicator: true, 20965 "clear-indicator": true 20966 }), innerProps), children || jsx(CrossIcon, null)); 20967}; 20968var indicatorSeparatorCSS = function indicatorSeparatorCSS2(_ref4, unstyled) { 20969 var isDisabled = _ref4.isDisabled, _ref4$theme = _ref4.theme, baseUnit = _ref4$theme.spacing.baseUnit, colors = _ref4$theme.colors; 20970 return _objectSpread2({ 20971 label: "indicatorSeparator", 20972 alignSelf: "stretch", 20973 width: 1 20974 }, unstyled ? {} : { 20975 backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20, 20976 marginBottom: baseUnit * 2, 20977 marginTop: baseUnit * 2 20978 }); 20979}; 20980var IndicatorSeparator = function IndicatorSeparator2(props) { 20981 var innerProps = props.innerProps; 20982 return jsx("span", _extends({}, innerProps, getStyleProps(props, "indicatorSeparator", { 20983 "indicator-separator": true 20984 }))); 20985};
20986var loadingDotAnimations = keyframes$1(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"]))); 20987var loadingIndicatorCSS = function loadingIndicatorCSS2(_ref5, unstyled) { 20988 var isFocused = _ref5.isFocused, size = _ref5.size, _ref5$theme = _ref5.theme, colors = _ref5$theme.colors, baseUnit = _ref5$theme.spacing.baseUnit; 20989 return _objectSpread2({ 20990 label: "loadingIndicator", 20991 display: "flex", 20992 transition: "color 150ms", 20993 alignSelf: "center", 20994 fontSize: size, 20995 lineHeight: 1, 20996 marginRight: size, 20997 textAlign: "center", 20998 verticalAlign: "middle" 20999 }, unstyled ? {} : { 21000 color: isFocused ? colors.neutral60 : colors.neutral20, 21001 padding: baseUnit * 2 21002 }); 21003}; 21004var LoadingDot = function LoadingDot2(_ref6) { 21005 var delay = _ref6.delay, offset = _ref6.offset; 21006 return jsx("span", { 21007 css: /* @__PURE__ */ css({ 21008 animation: "".concat(loadingDotAnimations, " 1s ease-in-out ").concat(delay, "ms infinite;"), 21009 backgroundColor: "currentColor", 21010 borderRadius: "1em", 21011 display: "inline-block", 21012 marginLeft: offset ? "1em" : void 0, 21013 height: "1em", 21014 verticalAlign: "top", 21015 width: "1em" 21016 }, "" , "" ) 21017 }); 21018}; 21019var LoadingIndicator = function LoadingIndicator2(_ref7) { 21020 var innerProps = _ref7.innerProps, isRtl = _ref7.isRtl, _ref7$size = _ref7.size, size = _ref7$size === void 0 ? 4 : _ref7$size, restProps = _objectWithoutProperties(_ref7, _excluded2); 21021 return jsx("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, { 21022 innerProps, 21023 isRtl, 21024 size 21025 }), "loadingIndicator", { 21026 indicator: true, 21027 "loading-indicator": true 21028 }), innerProps), jsx(LoadingDot, { 21029 delay: 0, 21030 offset: isRtl 21031 }), jsx(LoadingDot, { 21032 delay: 160, 21033 offset: true 21034 }), jsx(LoadingDot, { 21035 delay: 320, 21036 offset: !isRtl 21037 })); 21038}; 21039var css$1 = function css(_ref, unstyled) { 21040 var isDisabled = _ref.isDisabled, isFocused = _ref.isFocused, _ref$theme = _ref.theme, colors = _ref$theme.colors, borderRadius = _ref$theme.borderRadius, spacing = _ref$theme.spacing; 21041 return _objectSpread2({ 21042 label: "control", 21043 alignItems: "center", 21044 cursor: "default", 21045 display: "flex", 21046 flexWrap: "wrap", 21047 justifyContent: "space-between", 21048 minHeight: spacing.controlHeight, 21049 outline: "0 !important", 21050 position: "relative", 21051 transition: "all 100ms" 21052 }, unstyled ? {} : { 21053 backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0, 21054 borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20, 21055 borderRadius, 21056 borderStyle: "solid", 21057 borderWidth: 1, 21058 boxShadow: isFocused ? "0 0 0 1px ".concat(colors.primary) : void 0, 21059 "&:hover": { 21060 borderColor: isFocused ? colors.primary : colors.neutral30 21061 } 21062 }); 21063}; 21064var Control = function Control2(props) { 21065 var children = props.children, isDisabled = props.isDisabled, isFocused = props.isFocused, innerRef = props.innerRef, innerProps = props.innerProps, menuIsOpen = props.menuIsOpen; 21066 return jsx("div", _extends({ 21067 ref: innerRef 21068 }, getStyleProps(props, "control", { 21069 control: true, 21070 "control--is-disabled": isDisabled, 21071 "control--is-focused": isFocused, 21072 "control--menu-is-open": menuIsOpen 21073 }), innerProps, { 21074 "aria-disabled": isDisabled || void 0 21075 }), children); 21076}; 21077var Control$1 = Control; 21078var _excluded$1 = ["data"]; 21079var groupCSS = function groupCSS2(_ref, unstyled) { 21080 var spacing = _ref.theme.spacing; 21081 return unstyled ? {} : { 21082 paddingBottom: spacing.baseUnit * 2, 21083 paddingTop: spacing.baseUnit * 2 21084 }; 21085}; 21086var Group$3 = function Group2(props) { 21087 var children = props.children, cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, Heading = props.Heading, headingProps = props.headingProps, innerProps = props.innerProps, label = props.label, theme = props.theme, selectProps = props.selectProps; 21088 return jsx("div", _extends({}, getStyleProps(props, "group", { 21089 group: true 21090 }), innerProps), jsx(Heading, _extends({}, headingProps, { 21091 selectProps, 21092 theme, 21093 getStyles, 21094 getClassNames, 21095 cx 21096 }), label), jsx("div", null, children)); 21097}; 21098var groupHeadingCSS = function groupHeadingCSS2(_ref22, unstyled) { 21099 var _ref2$theme = _ref22.theme, colors = _ref2$theme.colors, spacing = _ref2$theme.spacing;
vendor: 5,163 bytes, lines 21100-21244
21100 return _objectSpread2({ 21101 label: "group", 21102 cursor: "default", 21103 display: "block" 21104 }, unstyled ? {} : { 21105 color: colors.neutral40, 21106 fontSize: "75%", 21107 fontWeight: 500, 21108 marginBottom: "0.25em", 21109 paddingLeft: spacing.baseUnit * 3, 21110 paddingRight: spacing.baseUnit * 3, 21111 textTransform: "uppercase" 21112 }); 21113}; 21114var GroupHeading = function GroupHeading2(props) { 21115 var _cleanCommonProps = cleanCommonProps(props); 21116 _cleanCommonProps.data; 21117 var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1); 21118 return jsx("div", _extends({}, getStyleProps(props, "groupHeading", { 21119 "group-heading": true 21120 }), innerProps)); 21121}; 21122var Group$1$1 = Group$3; 21123var _excluded$5 = ["innerRef", "isDisabled", "isHidden", "inputClassName"]; 21124var inputCSS = function inputCSS2(_ref, unstyled) { 21125 var isDisabled = _ref.isDisabled, value = _ref.value, _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors; 21126 return _objectSpread2(_objectSpread2({ 21127 visibility: isDisabled ? "hidden" : "visible", 21128 // force css to recompute when value change due to @emotion bug. 21129 // We can remove it whenever the bug is fixed. 21130 transform: value ? "translateZ(0)" : "" 21131 }, containerStyle), unstyled ? {} : { 21132 margin: spacing.baseUnit / 2, 21133 paddingBottom: spacing.baseUnit / 2, 21134 paddingTop: spacing.baseUnit / 2, 21135 color: colors.neutral80 21136 }); 21137}; 21138var spacingStyle = { 21139 gridArea: "1 / 2", 21140 font: "inherit", 21141 minWidth: "2px", 21142 border: 0, 21143 margin: 0, 21144 outline: 0, 21145 padding: 0 21146}; 21147var containerStyle = { 21148 flex: "1 1 auto", 21149 display: "inline-grid", 21150 gridArea: "1 / 1 / 2 / 3", 21151 gridTemplateColumns: "0 min-content", 21152 "&:after": _objectSpread2({ 21153 content: 'attr(data-value) " "', 21154 visibility: "hidden", 21155 whiteSpace: "pre" 21156 }, spacingStyle) 21157}; 21158var inputStyle = function inputStyle2(isHidden) { 21159 return _objectSpread2({ 21160 label: "input", 21161 color: "inherit", 21162 background: 0, 21163 opacity: isHidden ? 0 : 1, 21164 width: "100%" 21165 }, spacingStyle); 21166}; 21167var Input = function Input2(props) { 21168 var cx = props.cx, value = props.value; 21169 var _cleanCommonProps = cleanCommonProps(props), innerRef = _cleanCommonProps.innerRef, isDisabled = _cleanCommonProps.isDisabled, isHidden = _cleanCommonProps.isHidden, inputClassName = _cleanCommonProps.inputClassName, innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$5); 21170 return jsx("div", _extends({}, getStyleProps(props, "input", { 21171 "input-container": true 21172 }), { 21173 "data-value": value || "" 21174 }), jsx("input", _extends({ 21175 className: cx({ 21176 input: true 21177 }, inputClassName), 21178 ref: innerRef, 21179 style: inputStyle(isHidden), 21180 disabled: isDisabled 21181 }, innerProps))); 21182}; 21183var Input$1 = Input; 21184var multiValueCSS = function multiValueCSS2(_ref, unstyled) { 21185 var _ref$theme = _ref.theme, spacing = _ref$theme.spacing, borderRadius = _ref$theme.borderRadius, colors = _ref$theme.colors; 21186 return _objectSpread2({ 21187 label: "multiValue", 21188 display: "flex", 21189 minWidth: 0 21190 }, unstyled ? {} : { 21191 backgroundColor: colors.neutral10, 21192 borderRadius: borderRadius / 2, 21193 margin: spacing.baseUnit / 2 21194 }); 21195}; 21196var multiValueLabelCSS = function multiValueLabelCSS2(_ref22, unstyled) { 21197 var _ref2$theme = _ref22.theme, borderRadius = _ref2$theme.borderRadius, colors = _ref2$theme.colors, cropWithEllipsis = _ref22.cropWithEllipsis; 21198 return _objectSpread2({ 21199 overflow: "hidden", 21200 textOverflow: cropWithEllipsis || cropWithEllipsis === void 0 ? "ellipsis" : void 0, 21201 whiteSpace: "nowrap" 21202 }, unstyled ? {} : { 21203 borderRadius: borderRadius / 2, 21204 color: colors.neutral80, 21205 fontSize: "85%", 21206 padding: 3, 21207 paddingLeft: 6 21208 }); 21209}; 21210var multiValueRemoveCSS = function multiValueRemoveCSS2(_ref3, unstyled) { 21211 var _ref3$theme = _ref3.theme, spacing = _ref3$theme.spacing, borderRadius = _ref3$theme.borderRadius, colors = _ref3$theme.colors, isFocused = _ref3.isFocused; 21212 return _objectSpread2({ 21213 alignItems: "center", 21214 display: "flex" 21215 }, unstyled ? {} : { 21216 borderRadius: borderRadius / 2, 21217 backgroundColor: isFocused ? colors.dangerLight : void 0, 21218 paddingLeft: spacing.baseUnit, 21219 paddingRight: spacing.baseUnit, 21220 ":hover": { 21221 backgroundColor: colors.dangerLight, 21222 color: colors.danger 21223 } 21224 }); 21225}; 21226var MultiValueGeneric = function MultiValueGeneric2(_ref4) { 21227 var children = _ref4.children, innerProps = _ref4.innerProps; 21228 return jsx("div", innerProps, children); 21229}; 21230var MultiValueContainer$1 = MultiValueGeneric; 21231var MultiValueLabel = MultiValueGeneric; 21232function MultiValueRemove(_ref5) { 21233 var children = _ref5.children, innerProps = _ref5.innerProps; 21234 return jsx("div", _extends({ 21235 role: "button" 21236 }, innerProps), children || jsx(CrossIcon, { 21237 size: 14 21238 })); 21239} 21240var MultiValue = function MultiValue2(props) { 21241 var children = props.children, components2 = props.components, data = props.data, innerProps = props.innerProps, isDisabled = props.isDisabled, removeProps3 = props.removeProps, selectProps = props.selectProps; 21242 var Container = components2.Container, Label = components2.Label, Remove = components2.Remove; 21243 return jsx(Container, { 21244 data,
21245 innerProps: _objectSpread2(_objectSpread2({}, getStyleProps(props, "multiValue", { 21246 "multi-value": true, 21247 "multi-value--is-disabled": isDisabled 21248 })), innerProps), 21249 selectProps 21250 }, jsx(Label, { 21251 data, 21252 innerProps: _objectSpread2({}, getStyleProps(props, "multiValueLabel", { 21253 "multi-value__label": true 21254 })), 21255 selectProps 21256 }, children), jsx(Remove, { 21257 data, 21258 innerProps: _objectSpread2(_objectSpread2({}, getStyleProps(props, "multiValueRemove", { 21259 "multi-value__remove": true 21260 })), {}, { 21261 "aria-label": "Remove ".concat(children || "option") 21262 }, removeProps3), 21263 selectProps 21264 })); 21265}; 21266var MultiValue$1 = MultiValue; 21267var optionCSS = function optionCSS2(_ref, unstyled) { 21268 var isDisabled = _ref.isDisabled, isFocused = _ref.isFocused, isSelected = _ref.isSelected, _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors; 21269 return _objectSpread2({ 21270 label: "option", 21271 cursor: "default", 21272 display: "block", 21273 fontSize: "inherit", 21274 width: "100%", 21275 userSelect: "none", 21276 WebkitTapHighlightColor: "rgba(0, 0, 0, 0)" 21277 }, unstyled ? {} : { 21278 backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : "transparent", 21279 color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : "inherit", 21280 padding: "".concat(spacing.baseUnit * 2, "px ").concat(spacing.baseUnit * 3, "px"), 21281 // provide some affordance on touch devices 21282 ":active": { 21283 backgroundColor: !isDisabled ? isSelected ? colors.primary : colors.primary50 : void 0 21284 } 21285 }); 21286}; 21287var Option$1 = function Option2(props) { 21288 var children = props.children, isDisabled = props.isDisabled, isFocused = props.isFocused, isSelected = props.isSelected, innerRef = props.innerRef, innerProps = props.innerProps; 21289 return jsx("div", _extends({}, getStyleProps(props, "option", { 21290 option: true, 21291 "option--is-disabled": isDisabled, 21292 "option--is-focused": isFocused, 21293 "option--is-selected": isSelected 21294 }), { 21295 ref: innerRef, 21296 "aria-disabled": isDisabled 21297 }, innerProps), children); 21298}; 21299var Option$1$1 = Option$1; 21300var placeholderCSS = function placeholderCSS2(_ref, unstyled) { 21301 var _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors; 21302 return _objectSpread2({ 21303 label: "placeholder", 21304 gridArea: "1 / 1 / 2 / 3" 21305 }, unstyled ? {} : { 21306 color: colors.neutral50, 21307 marginLeft: spacing.baseUnit / 2, 21308 marginRight: spacing.baseUnit / 2 21309 }); 21310}; 21311var Placeholder = function Placeholder2(props) { 21312 var children = props.children, innerProps = props.innerProps; 21313 return jsx("div", _extends({}, getStyleProps(props, "placeholder", { 21314 placeholder: true 21315 }), innerProps), children); 21316}; 21317var Placeholder$1 = Placeholder; 21318var css2 = function css3(_ref, unstyled) { 21319 var isDisabled = _ref.isDisabled, _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors; 21320 return _objectSpread2({ 21321 label: "singleValue", 21322 gridArea: "1 / 1 / 2 / 3", 21323 maxWidth: "100%", 21324 overflow: "hidden", 21325 textOverflow: "ellipsis", 21326 whiteSpace: "nowrap" 21327 }, unstyled ? {} : { 21328 color: isDisabled ? colors.neutral40 : colors.neutral80, 21329 marginLeft: spacing.baseUnit / 2, 21330 marginRight: spacing.baseUnit / 2 21331 }); 21332}; 21333var SingleValue = function SingleValue2(props) { 21334 var children = props.children, isDisabled = props.isDisabled, innerProps = props.innerProps; 21335 return jsx("div", _extends({}, getStyleProps(props, "singleValue", { 21336 "single-value": true, 21337 "single-value--is-disabled": isDisabled 21338 }), innerProps), children); 21339}; 21340var SingleValue$1 = SingleValue; 21341var components = { 21342 ClearIndicator, 21343 Control: Control$1, 21344 DropdownIndicator: DropdownIndicator$1, 21345 DownChevron, 21346 CrossIcon, 21347 Group: Group$1$1, 21348 GroupHeading, 21349 IndicatorsContainer, 21350 IndicatorSeparator, 21351 Input: Input$1, 21352 LoadingIndicator, 21353 Menu: Menu$1, 21354 MenuList: MenuList$1, 21355 MenuPortal, 21356 LoadingMessage, 21357 NoOptionsMessage, 21358 MultiValue: MultiValue$1, 21359 MultiValueContainer: MultiValueContainer$1, 21360 MultiValueLabel, 21361 MultiValueRemove, 21362 Option: Option$1$1, 21363 Placeholder: Placeholder$1, 21364 SelectContainer, 21365 SingleValue: SingleValue$1, 21366 ValueContainer 21367}; 21368var defaultComponents = function defaultComponents2(props) {
vendor: 5,638 bytes, lines 21369-21488
21369 return _objectSpread2(_objectSpread2({}, components), props.components); 21370}; 21371 21372var safeIsNaN = Number.isNaN || 21373 function ponyfill(value) { 21374 return typeof value === 'number' && value !== value; 21375 }; 21376function isEqual(first, second) { 21377 if (first === second) { 21378 return true; 21379 } 21380 if (safeIsNaN(first) && safeIsNaN(second)) { 21381 return true; 21382 } 21383 return false; 21384} 21385function areInputsEqual(newInputs, lastInputs) { 21386 if (newInputs.length !== lastInputs.length) { 21387 return false; 21388 } 21389 for (var i = 0; i < newInputs.length; i++) { 21390 if (!isEqual(newInputs[i], lastInputs[i])) { 21391 return false; 21392 } 21393 } 21394 return true; 21395} 21396 21397function memoizeOne(resultFn, isEqual) { 21398 if (isEqual === void 0) { isEqual = areInputsEqual; } 21399 var cache = null; 21400 function memoized() { 21401 var newArgs = []; 21402 for (var _i = 0; _i < arguments.length; _i++) { 21403 newArgs[_i] = arguments[_i]; 21404 } 21405 if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) { 21406 return cache.lastResult; 21407 } 21408 var lastResult = resultFn.apply(this, newArgs); 21409 cache = { 21410 lastResult: lastResult, 21411 lastArgs: newArgs, 21412 lastThis: this, 21413 }; 21414 return lastResult; 21415 } 21416 memoized.clear = function clear() { 21417 cache = null; 21418 }; 21419 return memoized; 21420} 21421 21422var _ref = { 21423 name: "7pg0cj-a11yText", 21424 styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap" 21425} ; 21426var A11yText = function A11yText2(props) { 21427 return jsx("span", _extends({ 21428 css: _ref 21429 }, props)); 21430}; 21431var A11yText$1 = A11yText; 21432var defaultAriaLiveMessages = { 21433 guidance: function guidance(props) { 21434 var isSearchable = props.isSearchable, isMulti = props.isMulti, tabSelectsValue = props.tabSelectsValue, context = props.context, isInitialFocus = props.isInitialFocus; 21435 switch (context) { 21436 case "menu": 21437 return "Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(tabSelectsValue ? ", press Tab to select the option and exit the menu" : "", "."); 21438 case "input": 21439 return isInitialFocus ? "".concat(props["aria-label"] || "Select", " is focused ").concat(isSearchable ? ",type to refine list" : "", ", press Down to open the menu, ").concat(isMulti ? " press left to focus selected values" : "") : ""; 21440 case "value": 21441 return "Use left and right to toggle between focused values, press Backspace to remove the currently focused value"; 21442 default: 21443 return ""; 21444 } 21445 }, 21446 onChange: function onChange(props) { 21447 var action = props.action, _props$label = props.label, label = _props$label === void 0 ? "" : _props$label, labels = props.labels, isDisabled = props.isDisabled; 21448 switch (action) { 21449 case "deselect-option": 21450 case "pop-value": 21451 case "remove-value": 21452 return "option ".concat(label, ", deselected."); 21453 case "clear": 21454 return "All selected options have been cleared."; 21455 case "initial-input-focus": 21456 return "option".concat(labels.length > 1 ? "s" : "", " ").concat(labels.join(","), ", selected."); 21457 case "select-option": 21458 return isDisabled ? "option ".concat(label, " is disabled. Select another option.") : "option ".concat(label, ", selected."); 21459 default: 21460 return ""; 21461 } 21462 }, 21463 onFocus: function onFocus(props) { 21464 var context = props.context, focused = props.focused, options = props.options, _props$label2 = props.label, label = _props$label2 === void 0 ? "" : _props$label2, selectValue = props.selectValue, isDisabled = props.isDisabled, isSelected = props.isSelected, isAppleDevice2 = props.isAppleDevice; 21465 var getArrayIndex = function getArrayIndex2(arr, item) { 21466 return arr && arr.length ? "".concat(arr.indexOf(item) + 1, " of ").concat(arr.length) : ""; 21467 }; 21468 if (context === "value" && selectValue) { 21469 return "value ".concat(label, " focused, ").concat(getArrayIndex(selectValue, focused), "."); 21470 } 21471 if (context === "menu" && isAppleDevice2) { 21472 var disabled = isDisabled ? " disabled" : ""; 21473 var status = "".concat(isSelected ? " selected" : "").concat(disabled); 21474 return "".concat(label).concat(status, ", ").concat(getArrayIndex(options, focused), "."); 21475 } 21476 return ""; 21477 }, 21478 onFilter: function onFilter(props) { 21479 var inputValue = props.inputValue, resultsMessage = props.resultsMessage; 21480 return "".concat(resultsMessage).concat(inputValue ? " for search term " + inputValue : "", "."); 21481 } 21482}; 21483var LiveRegion = function LiveRegion2(props) { 21484 var ariaSelection = props.ariaSelection, focusedOption = props.focusedOption, focusedValue = props.focusedValue, focusableOptions = props.focusableOptions, isFocused = props.isFocused, selectValue = props.selectValue, selectProps = props.selectProps, id = props.id, isAppleDevice2 = props.isAppleDevice; 21485 var ariaLiveMessages = selectProps.ariaLiveMessages, getOptionLabel4 = selectProps.getOptionLabel, inputValue = selectProps.inputValue, isMulti = selectProps.isMulti, isOptionDisabled3 = selectProps.isOptionDisabled, isSearchable = selectProps.isSearchable, menuIsOpen = selectProps.menuIsOpen, options = selectProps.options, screenReaderStatus2 = selectProps.screenReaderStatus, tabSelectsValue = selectProps.tabSelectsValue, isLoading = selectProps.isLoading; 21486 var ariaLabel = selectProps["aria-label"]; 21487 var ariaLive = selectProps["aria-live"]; 21488 var messages = reactExports.useMemo(function() {
21489 return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {}); 21490 }, [ariaLiveMessages]); 21491 var ariaSelected = reactExports.useMemo(function() { 21492 var message = ""; 21493 if (ariaSelection && messages.onChange) { 21494 var option = ariaSelection.option, selectedOptions = ariaSelection.options, removedValue = ariaSelection.removedValue, removedValues = ariaSelection.removedValues, value = ariaSelection.value; 21495 var asOption = function asOption2(val) { 21496 return !Array.isArray(val) ? val : null; 21497 }; 21498 var selected = removedValue || option || asOption(value); 21499 var label = selected ? getOptionLabel4(selected) : ""; 21500 var multiSelected = selectedOptions || removedValues || void 0; 21501 var labels = multiSelected ? multiSelected.map(getOptionLabel4) : []; 21502 var onChangeProps = _objectSpread2({ 21503 // multiSelected items are usually items that have already been selected 21504 // or set by the user as a default value so we assume they are not disabled 21505 isDisabled: selected && isOptionDisabled3(selected, selectValue), 21506 label, 21507 labels 21508 }, ariaSelection); 21509 message = messages.onChange(onChangeProps); 21510 } 21511 return message; 21512 }, [ariaSelection, messages, isOptionDisabled3, selectValue, getOptionLabel4]); 21513 var ariaFocused = reactExports.useMemo(function() { 21514 var focusMsg = ""; 21515 var focused = focusedOption || focusedValue; 21516 var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption)); 21517 if (focused && messages.onFocus) { 21518 var onFocusProps = { 21519 focused, 21520 label: getOptionLabel4(focused), 21521 isDisabled: isOptionDisabled3(focused, selectValue), 21522 isSelected, 21523 options: focusableOptions, 21524 context: focused === focusedOption ? "menu" : "value", 21525 selectValue, 21526 isAppleDevice: isAppleDevice2 21527 }; 21528 focusMsg = messages.onFocus(onFocusProps); 21529 } 21530 return focusMsg; 21531 }, [focusedOption, focusedValue, getOptionLabel4, isOptionDisabled3, messages, focusableOptions, selectValue, isAppleDevice2]); 21532 var ariaResults = reactExports.useMemo(function() { 21533 var resultsMsg = ""; 21534 if (menuIsOpen && options.length && !isLoading && messages.onFilter) { 21535 var resultsMessage = screenReaderStatus2({ 21536 count: focusableOptions.length 21537 }); 21538 resultsMsg = messages.onFilter({ 21539 inputValue, 21540 resultsMessage 21541 }); 21542 } 21543 return resultsMsg; 21544 }, [focusableOptions, inputValue, menuIsOpen, messages, options, screenReaderStatus2, isLoading]); 21545 var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus"; 21546 var ariaGuidance = reactExports.useMemo(function() { 21547 var guidanceMsg = ""; 21548 if (messages.guidance) { 21549 var context = focusedValue ? "value" : menuIsOpen ? "menu" : "input"; 21550 guidanceMsg = messages.guidance({ 21551 "aria-label": ariaLabel, 21552 context, 21553 isDisabled: focusedOption && isOptionDisabled3(focusedOption, selectValue), 21554 isMulti, 21555 isSearchable, 21556 tabSelectsValue, 21557 isInitialFocus 21558 }); 21559 } 21560 return guidanceMsg; 21561 }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled3, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]); 21562 var ScreenReaderText = jsx(reactExports.Fragment, null, jsx("span", { 21563 id: "aria-selection" 21564 }, ariaSelected), jsx("span", { 21565 id: "aria-focused" 21566 }, ariaFocused), jsx("span", { 21567 id: "aria-results" 21568 }, ariaResults), jsx("span", { 21569 id: "aria-guidance" 21570 }, ariaGuidance)); 21571 return jsx(reactExports.Fragment, null, jsx(A11yText$1, { 21572 id 21573 }, isInitialFocus && ScreenReaderText), jsx(A11yText$1, { 21574 "aria-live": ariaLive, 21575 "aria-atomic": "false", 21576 "aria-relevant": "additions text", 21577 role: "log" 21578 }, isFocused && !isInitialFocus && ScreenReaderText)); 21579}; 21580var LiveRegion$1 = LiveRegion; 21581var diacritics = [{ 21582 base: "A", 21583 letters: "Aâ¶ï¼¡ÃÃÃẦẤẪẨÃÄÄáº°áº®áº´áº²È¦Ç ÃÇẢà ǺÇÈÈẠẬẶá¸ÄȺⱯ" 21584}, { 21585 base: "AA", 21586 letters: "ê²" 21587}, { 21588 base: "AE", 21589 letters: "ÃǼǢ" 21590}, { 21591 base: "AO", 21592 letters: "ê´" 21593}, { 21594 base: "AU", 21595 letters: "ê¶" 21596}, { 21597 base: "AV", 21598 letters: "ê¸êº" 21599}, { 21600 base: "AY", 21601 letters: "ê¼" 21602}, { 21603 base: "B", 21604 letters: "Bâ·ï¼¢á¸á¸á¸ÉÆÆ" 21605}, { 21606 base: "C", 21607 letters: "Câ¸ï¼£ÄÄÄÄÃá¸ÆÈ»ê¾" 21608}, { 21609 base: "D", 21610 letters: "Dâ¹ï¼¤á¸Äá¸á¸á¸á¸ÄÆÆÆê¹" 21611}, { 21612 base: "DZ", 21613 letters: "DZÇ" 21614}, { 21615 base: "Dz", 21616 letters: "Ç²Ç " 21617}, { 21618 base: "E", 21619 letters: "Eâºï¼¥ÃÃÃá»áº¾á»á»áº¼Äá¸á¸ÄÄÃẺÄÈÈẸá»È¨á¸Äá¸á¸ÆÆ" 21620}, { 21621 base: "F", 21622 letters: "Fâ»ï¼¦á¸Æê»" 21623}, { 21624 base: "G", 21625 letters: "Gâ¼ï¼§Ç´ÄḠÄÄ Ç¦Ä¢Ç¤Æê ê½ê¾" 21626}, { 21627 base: "H", 21628 letters: "Hâ½ï¼¨Ä¤á¸¢á¸¦ÈḤḨḪĦⱧⱵê" 21629}, { 21630 base: "I", 21631 letters: "Iâ¾ï¼©ÃÃÃĨĪĬİÃḮá»ÇÈÈá»Ä®á¸¬Æ" 21632}, { 21633 base: "J", 21634 letters: "Jâ¿ï¼ªÄ´É" 21635}, { 21636 base: "K", 21637 letters: "KâKḰǨḲĶḴÆâ±©êêêê¢" 21638}, { 21639 base: "L", 21640 letters: "LâLĿĹĽḶḸĻḼḺÅȽⱢⱠêêê" 21641}, { 21642 base: "LJ", 21643 letters: "Ç" 21644}, { 21645 base: "Lj", 21646 letters: "Ç" 21647}, { 21648 base: "M", 21649 letters: "Mâï¼á¸¾á¹á¹â±®Æ" 21650}, { 21651 base: "N", 21652 letters: "NâNǸÅÃá¹Åá¹Å á¹á¹È Æêê¤" 21653}, { 21654 base: "NJ", 21655 letters: "Ç" 21656}, { 21657 base: "Nj", 21658 letters: "Ç" 21659}, { 21660 base: "O", 21661 letters: "OâOÃÃÃá»á»á»á»Ãá¹È¬á¹Åá¹á¹ÅȮȰÃȪá»ÅÇÈÈÆ á»á»á» á»á»¢á»á»ÇªÇ¬ÃÇ¾ÆÆêê" 21662}, { 21663 base: "OI", 21664 letters: "Æ¢" 21665}, { 21666 base: "OO", 21667 letters: "ê" 21668}, { 21669 base: "OU", 21670 letters: "È¢" 21671}, { 21672 base: "P", 21673 letters: "Pâ ï¼°á¹á¹Æ¤â±£êêê" 21674}, { 21675 base: "Q", 21676 letters: "Qâï¼±êêÉ" 21677}, { 21678 base: "R",
vendor: 10,679 bytes, lines 21679-22031
21679 letters: "Râï¼²Åá¹ÅÈÈá¹á¹Åá¹ÉⱤêê¦ê" 21680}, { 21681 base: "S", 21682 letters: "Sâï¼³áºÅṤÅṠŠṦṢṨÈÅâ±¾ê¨ê" 21683}, { 21684 base: "T", 21685 letters: "TâTṪŤṬÈŢṰṮŦƬƮȾê" 21686}, { 21687 base: "TZ", 21688 letters: "ê¨" 21689}, { 21690 base: "U", 21691 letters: "Uâï¼µÃÃÃŨṸŪṺŬÃÇÇÇÇỦŮŰÇÈÈÆ¯á»ªá»¨á»®á»¬á»°á»¤á¹²Å²á¹¶á¹´É" 21692}, { 21693 base: "V", 21694 letters: "VâVṼṾƲêÉ " 21695}, { 21696 base: "VY", 21697 letters: "ê " 21698}, { 21699 base: "W", 21700 letters: "Wâï¼·áºáºÅ´áºáºáºâ±²" 21701}, { 21702 base: "X", 21703 letters: "XâXáºáº" 21704}, { 21705 base: "Y", 21706 letters: "YâYỲÃŶỸȲáºÅ¸á»¶á»´Æ³ÉỾ" 21707}, { 21708 base: "Z", 21709 letters: "ZâZŹáºÅ»Å½áºáºÆµÈ¤â±¿â±«ê¢" 21710}, { 21711 base: "a", 21712 letters: "aâï½áºÃ áâầấẫẩãÄÄằắẵẳȧǡäÇảåǻÇÈÈạáºáº·á¸Ä â±¥É" 21713}, { 21714 base: "aa", 21715 letters: "ê³" 21716}, { 21717 base: "ae", 21718 letters: "æǽǣ" 21719}, { 21720 base: "ao", 21721 letters: "êµ" 21722}, { 21723 base: "au", 21724 letters: "ê·" 21725}, { 21726 base: "av", 21727 letters: "ê¹ê»" 21728}, { 21729 base: "ay", 21730 letters: "ê½" 21731}, { 21732 base: "b", 21733 letters: "bâï½á¸á¸ á¸ÆÆÉ" 21734}, { 21735 base: "c", 21736 letters: "câï½ÄÄÄÄÃ§á¸ÆÈ¼ê¿â" 21737}, { 21738 base: "d", 21739 letters: "dâï½á¸Äá¸á¸á¸á¸ÄÆÉÉêº" 21740}, { 21741 base: "dz", 21742 letters: "dzÇ" 21743}, { 21744 base: "e", 21745 letters: "eâï½ Ã¨Ã©Ãªá»áº¿á» á»áº½Äá¸á¸ÄÄëẻÄÈ Èẹá»È©á¸Äá¸á¸ÉÉÇ" 21746}, { 21747 base: "f", 21748 letters: "fâï½á¸Æê¼" 21749}, { 21750 base: "g", 21751 letters: "gâï½ÇµÄḡÄÄ¡Ç§Ä£Ç¥É ê¡áµ¹ê¿" 21752}, { 21753 base: "h", 21754 letters: "hâï½Ä¥á¸£á¸§ÈḥḩḫáºÄ§â±¨â±¶É¥" 21755}, { 21756 base: "hv", 21757 letters: "Æ" 21758}, { 21759 base: "i", 21760 letters: "iâï½Ã¬ÃîĩīÄïḯá»ÇÈÈá»Ä¯á¸É¨Ä±" 21761}, { 21762 base: "j", 21763 letters: "jâï½ÄµÇ°É" 21764}, { 21765 base: "k", 21766 letters: "kâï½á¸±Ç©á¸³Ä·á¸µÆâ±ªêêê ê£" 21767}, { 21768 base: "l", 21769 letters: "lâï½ÅÄºÄ¾á¸·á¸¹Ä¼á¸½á¸»Å¿ÅÆÉ«â±¡êêê" 21770}, { 21771 base: "lj", 21772 letters: "Ç" 21773}, { 21774 base: "m", 21775 letters: "mâï½á¸¿á¹á¹É±É¯" 21776}, { 21777 base: "n", 21778 letters: "nâï½Ç¹ÅñṠÅá¹Åá¹á¹ÆÉ²Åêê¥" 21779}, { 21780 base: "nj", 21781 letters: "Ç" 21782}, { 21783 base: "o", 21784 letters: "oâï½Ã²Ã³Ã´á»á»á»á»Ãµá¹Èá¹Åá¹á¹Åȯȱöȫá»ÅÇÈÈÆ¡á»á»á»¡á»á»£á»á»Ç«ÇøǿÉêêɵ" 21785}, { 21786 base: "oi", 21787 letters: "Æ£" 21788}, { 21789 base: "ou", 21790 letters: "È£" 21791}, { 21792 base: "oo", 21793 letters: "ê" 21794}, { 21795 base: "p", 21796 letters: "pâï½á¹á¹Æ¥áµ½êêê" 21797}, { 21798 base: "q", 21799 letters: "qâ ï½Éêê" 21800}, { 21801 base: "r", 21802 letters: "râ¡ï½Åá¹ÅÈÈá¹á¹Åá¹Éɽêê§ê" 21803}, { 21804 base: "s", 21805 letters: "sâ¢ï½ÃÅá¹¥ÅṡšṧṣṩÈÅÈ¿ê©ê áº" 21806}, { 21807 base: "t", 21808 letters: "tâ£ï½á¹«áºÅ¥á¹ÈţṱṯŧÆÊⱦê" 21809}, { 21810 base: "tz", 21811 letters: "ê©" 21812}, { 21813 base: "u", 21814 letters: "uâ¤ï½Ã¹ÃºÃ»Å©á¹¹Å«á¹»ÅüÇÇÇÇủůűÇÈÈÆ°á»«á»©á»¯á»á»±á»¥á¹³Å³á¹·á¹µÊ" 21815}, { 21816 base: "v", 21817 letters: "vâ¥ï½á¹½á¹¿ÊêÊ" 21818}, { 21819 base: "vy", 21820 letters: "ê¡" 21821}, { 21822 base: "w", 21823 letters: "wâ¦ï½áºáºÅµáºáº áºáºâ±³" 21824}, { 21825 base: "x", 21826 letters: "xâ§ï½áºáº" 21827}, { 21828 base: "y", 21829 letters: "yâ¨ï½á»³Ã½Å·á»¹È³áºÃ¿á»·áºá»µÆ´Éỿ" 21830}, { 21831 base: "z", 21832 letters: "zâ©ï½ÅºáºÅ¼Å¾áºáºÆ¶È¥Éⱬê£" 21833}]; 21834var anyDiacritic = new RegExp("[" + diacritics.map(function(d) { 21835 return d.letters; 21836}).join("") + "]", "g"); 21837var diacriticToBase = {}; 21838for (var i$1 = 0; i$1 < diacritics.length; i$1++) { 21839 var diacritic = diacritics[i$1]; 21840 for (var j = 0; j < diacritic.letters.length; j++) { 21841 diacriticToBase[diacritic.letters[j]] = diacritic.base; 21842 } 21843} 21844var stripDiacritics = function stripDiacritics2(str) { 21845 return str.replace(anyDiacritic, function(match) { 21846 return diacriticToBase[match]; 21847 }); 21848}; 21849var memoizedStripDiacriticsForInput = memoizeOne(stripDiacritics); 21850var trimString = function trimString2(str) { 21851 return str.replace(/^\s+|\s+$/g, ""); 21852}; 21853var defaultStringify = function defaultStringify2(option) { 21854 return "".concat(option.label, " ").concat(option.value); 21855}; 21856var createFilter = function createFilter2(config) { 21857 return function(option, rawInput) { 21858 if (option.data.__isNew__) return true; 21859 var _ignoreCase$ignoreAcc = _objectSpread2({ 21860 ignoreCase: true, 21861 ignoreAccents: true, 21862 stringify: defaultStringify, 21863 trim: true, 21864 matchFrom: "any" 21865 }, config), ignoreCase = _ignoreCase$ignoreAcc.ignoreCase, ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents, stringify = _ignoreCase$ignoreAcc.stringify, trim = _ignoreCase$ignoreAcc.trim, matchFrom = _ignoreCase$ignoreAcc.matchFrom; 21866 var input = trim ? trimString(rawInput) : rawInput; 21867 var candidate = trim ? trimString(stringify(option)) : stringify(option); 21868 if (ignoreCase) { 21869 input = input.toLowerCase(); 21870 candidate = candidate.toLowerCase(); 21871 } 21872 if (ignoreAccents) { 21873 input = memoizedStripDiacriticsForInput(input); 21874 candidate = stripDiacritics(candidate); 21875 } 21876 return matchFrom === "start" ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1; 21877 }; 21878}; 21879var _excluded = ["innerRef"]; 21880function DummyInput(_ref3) { 21881 var innerRef = _ref3.innerRef, props = _objectWithoutProperties(_ref3, _excluded); 21882 var filteredProps = removeProps(props, "onExited", "in", "enter", "exit", "appear"); 21883 return jsx("input", _extends({ 21884 ref: innerRef 21885 }, filteredProps, { 21886 css: /* @__PURE__ */ css({ 21887 label: "dummyInput", 21888 // get rid of any default styles 21889 background: 0, 21890 border: 0, 21891 // important! this hides the flashing cursor 21892 caretColor: "transparent", 21893 fontSize: "inherit", 21894 gridArea: "1 / 1 / 2 / 3", 21895 outline: 0, 21896 padding: 0, 21897 // important! without `width` browsers won't allow focus 21898 width: 1, 21899 // remove cursor on desktop 21900 color: "transparent", 21901 // remove cursor on mobile whilst maintaining "scroll into view" behaviour 21902 left: -100, 21903 opacity: 0, 21904 position: "relative", 21905 transform: "scale(.01)" 21906 }, "" , "" ) 21907 })); 21908} 21909var cancelScroll = function cancelScroll2(event) { 21910 if (event.cancelable) event.preventDefault(); 21911 event.stopPropagation(); 21912}; 21913function useScrollCapture(_ref3) { 21914 var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave; 21915 var isBottom = reactExports.useRef(false); 21916 var isTop = reactExports.useRef(false); 21917 var touchStart = reactExports.useRef(0); 21918 var scrollTarget = reactExports.useRef(null); 21919 var handleEventDelta = reactExports.useCallback(function(event, delta) { 21920 if (scrollTarget.current === null) return; 21921 var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight; 21922 var target = scrollTarget.current; 21923 var isDeltaPositive = delta > 0; 21924 var availableScroll = scrollHeight - clientHeight - scrollTop; 21925 var shouldCancelScroll = false; 21926 if (availableScroll > delta && isBottom.current) { 21927 if (onBottomLeave) onBottomLeave(event); 21928 isBottom.current = false; 21929 } 21930 if (isDeltaPositive && isTop.current) { 21931 if (onTopLeave) onTopLeave(event); 21932 isTop.current = false; 21933 } 21934 if (isDeltaPositive && delta > availableScroll) { 21935 if (onBottomArrive && !isBottom.current) { 21936 onBottomArrive(event); 21937 } 21938 target.scrollTop = scrollHeight; 21939 shouldCancelScroll = true; 21940 isBottom.current = true; 21941 } else if (!isDeltaPositive && -delta > scrollTop) { 21942 if (onTopArrive && !isTop.current) { 21943 onTopArrive(event); 21944 } 21945 target.scrollTop = 0; 21946 shouldCancelScroll = true; 21947 isTop.current = true; 21948 } 21949 if (shouldCancelScroll) { 21950 cancelScroll(event); 21951 } 21952 }, [onBottomArrive, onBottomLeave, onTopArrive, onTopLeave]); 21953 var onWheel = reactExports.useCallback(function(event) { 21954 handleEventDelta(event, event.deltaY); 21955 }, [handleEventDelta]); 21956 var onTouchStart = reactExports.useCallback(function(event) { 21957 touchStart.current = event.changedTouches[0].clientY; 21958 }, []); 21959 var onTouchMove = reactExports.useCallback(function(event) { 21960 var deltaY = touchStart.current - event.changedTouches[0].clientY; 21961 handleEventDelta(event, deltaY); 21962 }, [handleEventDelta]); 21963 var startListening = reactExports.useCallback(function(el) { 21964 if (!el) return; 21965 var notPassive = supportsPassiveEvents ? { 21966 passive: false 21967 } : false; 21968 el.addEventListener("wheel", onWheel, notPassive); 21969 el.addEventListener("touchstart", onTouchStart, notPassive); 21970 el.addEventListener("touchmove", onTouchMove, notPassive); 21971 }, [onTouchMove, onTouchStart, onWheel]); 21972 var stopListening = reactExports.useCallback(function(el) { 21973 if (!el) return; 21974 el.removeEventListener("wheel", onWheel, false); 21975 el.removeEventListener("touchstart", onTouchStart, false); 21976 el.removeEventListener("touchmove", onTouchMove, false); 21977 }, [onTouchMove, onTouchStart, onWheel]); 21978 reactExports.useEffect(function() { 21979 if (!isEnabled) return; 21980 var element = scrollTarget.current; 21981 startListening(element); 21982 return function() { 21983 stopListening(element); 21984 }; 21985 }, [isEnabled, startListening, stopListening]); 21986 return function(element) { 21987 scrollTarget.current = element; 21988 }; 21989} 21990var STYLE_KEYS = ["boxSizing", "height", "overflow", "paddingRight", "position"]; 21991var LOCK_STYLES = { 21992 boxSizing: "border-box", 21993 // account for possible declaration `width: 100%;` on body 21994 overflow: "hidden", 21995 position: "relative", 21996 height: "100%" 21997}; 21998function preventTouchMove(e) { 21999 if (e.cancelable) e.preventDefault(); 22000} 22001function allowTouchMove(e) { 22002 e.stopPropagation(); 22003} 22004function preventInertiaScroll() { 22005 var top = this.scrollTop; 22006 var totalScroll = this.scrollHeight; 22007 var currentScroll = top + this.offsetHeight; 22008 if (top === 0) { 22009 this.scrollTop = 1; 22010 } else if (currentScroll === totalScroll) { 22011 this.scrollTop = top - 1; 22012 } 22013} 22014function isTouchDevice() { 22015 return "ontouchstart" in window || navigator.maxTouchPoints; 22016} 22017var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement); 22018var activeScrollLocks = 0; 22019var listenerOptions = { 22020 capture: false, 22021 passive: false 22022}; 22023function useScrollLock(_ref3) { 22024 var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll; 22025 var originalStyles = reactExports.useRef({}); 22026 var scrollTarget = reactExports.useRef(null); 22027 var addScrollLock = reactExports.useCallback(function(touchScrollTarget) { 22028 if (!canUseDOM) return; 22029 var target = document.body; 22030 var targetStyle = target && target.style; 22031 if (accountForScrollbars) {
22032 STYLE_KEYS.forEach(function(key) { 22033 var val = targetStyle && targetStyle[key]; 22034 originalStyles.current[key] = val; 22035 }); 22036 } 22037 if (accountForScrollbars && activeScrollLocks < 1) { 22038 var currentPadding = parseInt(originalStyles.current.paddingRight, 10) || 0; 22039 var clientWidth = document.body ? document.body.clientWidth : 0; 22040 var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0; 22041 Object.keys(LOCK_STYLES).forEach(function(key) { 22042 var val = LOCK_STYLES[key]; 22043 if (targetStyle) { 22044 targetStyle[key] = val; 22045 } 22046 }); 22047 if (targetStyle) { 22048 targetStyle.paddingRight = "".concat(adjustedPadding, "px"); 22049 } 22050 } 22051 if (target && isTouchDevice()) { 22052 target.addEventListener("touchmove", preventTouchMove, listenerOptions); 22053 if (touchScrollTarget) { 22054 touchScrollTarget.addEventListener("touchstart", preventInertiaScroll, listenerOptions); 22055 touchScrollTarget.addEventListener("touchmove", allowTouchMove, listenerOptions); 22056 } 22057 } 22058 activeScrollLocks += 1; 22059 }, [accountForScrollbars]); 22060 var removeScrollLock = reactExports.useCallback(function(touchScrollTarget) { 22061 if (!canUseDOM) return; 22062 var target = document.body; 22063 var targetStyle = target && target.style; 22064 activeScrollLocks = Math.max(activeScrollLocks - 1, 0); 22065 if (accountForScrollbars && activeScrollLocks < 1) { 22066 STYLE_KEYS.forEach(function(key) { 22067 var val = originalStyles.current[key]; 22068 if (targetStyle) { 22069 targetStyle[key] = val; 22070 } 22071 }); 22072 } 22073 if (target && isTouchDevice()) { 22074 target.removeEventListener("touchmove", preventTouchMove, listenerOptions); 22075 if (touchScrollTarget) { 22076 touchScrollTarget.removeEventListener("touchstart", preventInertiaScroll, listenerOptions); 22077 touchScrollTarget.removeEventListener("touchmove", allowTouchMove, listenerOptions); 22078 } 22079 } 22080 }, [accountForScrollbars]); 22081 reactExports.useEffect(function() { 22082 if (!isEnabled) return; 22083 var element = scrollTarget.current; 22084 addScrollLock(element); 22085 return function() { 22086 removeScrollLock(element); 22087 }; 22088 }, [isEnabled, addScrollLock, removeScrollLock]); 22089 return function(element) { 22090 scrollTarget.current = element; 22091 }; 22092} 22093var blurSelectInput = function blurSelectInput2(event) { 22094 var element = event.target; 22095 return element.ownerDocument.activeElement && element.ownerDocument.activeElement.blur(); 22096}; 22097var _ref2$1 = { 22098 name: "1kfdb0e", 22099 styles: "position:fixed;left:0;bottom:0;right:0;top:0" 22100} ; 22101function ScrollManager(_ref3) { 22102 var children = _ref3.children, lockEnabled = _ref3.lockEnabled, _ref$captureEnabled = _ref3.captureEnabled, captureEnabled = _ref$captureEnabled === void 0 ? true : _ref$captureEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave; 22103 var setScrollCaptureTarget = useScrollCapture({ 22104 isEnabled: captureEnabled, 22105 onBottomArrive, 22106 onBottomLeave, 22107 onTopArrive, 22108 onTopLeave 22109 }); 22110 var setScrollLockTarget = useScrollLock({ 22111 isEnabled: lockEnabled 22112 }); 22113 var targetRef = function targetRef2(element) { 22114 setScrollCaptureTarget(element); 22115 setScrollLockTarget(element); 22116 }; 22117 return jsx(reactExports.Fragment, null, lockEnabled && jsx("div", { 22118 onClick: blurSelectInput, 22119 css: _ref2$1 22120 }), children(targetRef)); 22121} 22122var _ref2 = { 22123 name: "1a0ro4n-requiredInput", 22124 styles: "label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%" 22125} ; 22126var RequiredInput = function RequiredInput2(_ref3) { 22127 var name = _ref3.name, onFocus2 = _ref3.onFocus; 22128 return jsx("input", { 22129 required: true, 22130 name, 22131 tabIndex: -1, 22132 "aria-hidden": "true", 22133 onFocus: onFocus2, 22134 css: _ref2, 22135 value: "", 22136 onChange: function onChange2() { 22137 } 22138 }); 22139}; 22140var RequiredInput$1 = RequiredInput; 22141function testPlatform(re) { 22142 var _window$navigator$use; 22143 return typeof window !== "undefined" && window.navigator != null ? re.test(((_window$navigator$use = window.navigator["userAgentData"]) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
vendor: 32,378 bytes, lines 22144-23080
22144} 22145function isIPhone() { 22146 return testPlatform(/^iPhone/i); 22147} 22148function isMac() { 22149 return testPlatform(/^Mac/i); 22150} 22151function isIPad() { 22152 return testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. 22153 isMac() && navigator.maxTouchPoints > 1; 22154} 22155function isIOS() { 22156 return isIPhone() || isIPad(); 22157} 22158function isAppleDevice() { 22159 return isMac() || isIOS(); 22160} 22161var formatGroupLabel = function formatGroupLabel2(group) { 22162 return group.label; 22163}; 22164var getOptionLabel$1 = function getOptionLabel(option) { 22165 return option.label; 22166}; 22167var getOptionValue$1 = function getOptionValue(option) { 22168 return option.value; 22169}; 22170var isOptionDisabled = function isOptionDisabled2(option) { 22171 return !!option.isDisabled; 22172}; 22173var defaultStyles = { 22174 clearIndicator: clearIndicatorCSS, 22175 container: containerCSS, 22176 control: css$1, 22177 dropdownIndicator: dropdownIndicatorCSS, 22178 group: groupCSS, 22179 groupHeading: groupHeadingCSS, 22180 indicatorsContainer: indicatorsContainerCSS, 22181 indicatorSeparator: indicatorSeparatorCSS, 22182 input: inputCSS, 22183 loadingIndicator: loadingIndicatorCSS, 22184 loadingMessage: loadingMessageCSS, 22185 menu: menuCSS, 22186 menuList: menuListCSS, 22187 menuPortal: menuPortalCSS, 22188 multiValue: multiValueCSS, 22189 multiValueLabel: multiValueLabelCSS, 22190 multiValueRemove: multiValueRemoveCSS, 22191 noOptionsMessage: noOptionsMessageCSS, 22192 option: optionCSS, 22193 placeholder: placeholderCSS, 22194 singleValue: css2, 22195 valueContainer: valueContainerCSS 22196}; 22197var colors = { 22198 primary: "#2684FF", 22199 primary75: "#4C9AFF", 22200 primary50: "#B2D4FF", 22201 primary25: "#DEEBFF", 22202 danger: "#DE350B", 22203 dangerLight: "#FFBDAD", 22204 neutral0: "hsl(0, 0%, 100%)", 22205 neutral5: "hsl(0, 0%, 95%)", 22206 neutral10: "hsl(0, 0%, 90%)", 22207 neutral20: "hsl(0, 0%, 80%)", 22208 neutral30: "hsl(0, 0%, 70%)", 22209 neutral40: "hsl(0, 0%, 60%)", 22210 neutral50: "hsl(0, 0%, 50%)", 22211 neutral60: "hsl(0, 0%, 40%)", 22212 neutral70: "hsl(0, 0%, 30%)", 22213 neutral80: "hsl(0, 0%, 20%)", 22214 neutral90: "hsl(0, 0%, 10%)" 22215}; 22216var borderRadius = 4; 22217var baseUnit = 4; 22218var controlHeight = 38; 22219var menuGutter = baseUnit * 2; 22220var spacing = { 22221 baseUnit, 22222 controlHeight, 22223 menuGutter 22224}; 22225var defaultTheme = { 22226 borderRadius, 22227 colors, 22228 spacing 22229}; 22230var defaultProps = { 22231 "aria-live": "polite", 22232 backspaceRemovesValue: true, 22233 blurInputOnSelect: isTouchCapable(), 22234 captureMenuScroll: !isTouchCapable(), 22235 classNames: {}, 22236 closeMenuOnSelect: true, 22237 closeMenuOnScroll: false, 22238 components: {}, 22239 controlShouldRenderValue: true, 22240 escapeClearsValue: false, 22241 filterOption: createFilter(), 22242 formatGroupLabel, 22243 getOptionLabel: getOptionLabel$1, 22244 getOptionValue: getOptionValue$1, 22245 isDisabled: false, 22246 isLoading: false, 22247 isMulti: false, 22248 isRtl: false, 22249 isSearchable: true, 22250 isOptionDisabled, 22251 loadingMessage: function loadingMessage() { 22252 return "Loading..."; 22253 }, 22254 maxMenuHeight: 300, 22255 minMenuHeight: 140, 22256 menuIsOpen: false, 22257 menuPlacement: "bottom", 22258 menuPosition: "absolute", 22259 menuShouldBlockScroll: false, 22260 menuShouldScrollIntoView: !isMobileDevice(), 22261 noOptionsMessage: function noOptionsMessage() { 22262 return "No options"; 22263 }, 22264 openMenuOnFocus: false, 22265 openMenuOnClick: true, 22266 options: [], 22267 pageSize: 5, 22268 placeholder: "Select...", 22269 screenReaderStatus: function screenReaderStatus(_ref3) { 22270 var count = _ref3.count; 22271 return "".concat(count, " result").concat(count !== 1 ? "s" : "", " available"); 22272 }, 22273 styles: {}, 22274 tabIndex: 0, 22275 tabSelectsValue: true, 22276 unstyled: false 22277}; 22278function toCategorizedOption(props, option, selectValue, index) { 22279 var isDisabled = _isOptionDisabled(props, option, selectValue); 22280 var isSelected = _isOptionSelected(props, option, selectValue); 22281 var label = getOptionLabel2(props, option); 22282 var value = getOptionValue2(props, option); 22283 return { 22284 type: "option", 22285 data: option, 22286 isDisabled, 22287 isSelected, 22288 label, 22289 value, 22290 index 22291 }; 22292} 22293function buildCategorizedOptions(props, selectValue) { 22294 return props.options.map(function(groupOrOption, groupOrOptionIndex) { 22295 if ("options" in groupOrOption) { 22296 var categorizedOptions = groupOrOption.options.map(function(option, optionIndex) { 22297 return toCategorizedOption(props, option, selectValue, optionIndex); 22298 }).filter(function(categorizedOption2) { 22299 return isFocusable(props, categorizedOption2); 22300 }); 22301 return categorizedOptions.length > 0 ? { 22302 type: "group", 22303 data: groupOrOption, 22304 options: categorizedOptions, 22305 index: groupOrOptionIndex 22306 } : void 0; 22307 } 22308 var categorizedOption = toCategorizedOption(props, groupOrOption, selectValue, groupOrOptionIndex); 22309 return isFocusable(props, categorizedOption) ? categorizedOption : void 0; 22310 }).filter(notNullish); 22311} 22312function buildFocusableOptionsFromCategorizedOptions(categorizedOptions) { 22313 return categorizedOptions.reduce(function(optionsAccumulator, categorizedOption) { 22314 if (categorizedOption.type === "group") { 22315 optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function(option) { 22316 return option.data; 22317 }))); 22318 } else { 22319 optionsAccumulator.push(categorizedOption.data); 22320 } 22321 return optionsAccumulator; 22322 }, []); 22323} 22324function buildFocusableOptionsWithIds(categorizedOptions, optionId) { 22325 return categorizedOptions.reduce(function(optionsAccumulator, categorizedOption) { 22326 if (categorizedOption.type === "group") { 22327 optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function(option) { 22328 return { 22329 data: option.data, 22330 id: "".concat(optionId, "-").concat(categorizedOption.index, "-").concat(option.index) 22331 }; 22332 }))); 22333 } else { 22334 optionsAccumulator.push({ 22335 data: categorizedOption.data, 22336 id: "".concat(optionId, "-").concat(categorizedOption.index) 22337 }); 22338 } 22339 return optionsAccumulator; 22340 }, []); 22341} 22342function buildFocusableOptions(props, selectValue) { 22343 return buildFocusableOptionsFromCategorizedOptions(buildCategorizedOptions(props, selectValue)); 22344} 22345function isFocusable(props, categorizedOption) { 22346 var _props$inputValue = props.inputValue, inputValue = _props$inputValue === void 0 ? "" : _props$inputValue; 22347 var data = categorizedOption.data, isSelected = categorizedOption.isSelected, label = categorizedOption.label, value = categorizedOption.value; 22348 return (!shouldHideSelectedOptions(props) || !isSelected) && _filterOption(props, { 22349 label, 22350 value, 22351 data 22352 }, inputValue); 22353} 22354function getNextFocusedValue(state, nextSelectValue) { 22355 var focusedValue = state.focusedValue, lastSelectValue = state.selectValue; 22356 var lastFocusedIndex = lastSelectValue.indexOf(focusedValue); 22357 if (lastFocusedIndex > -1) { 22358 var nextFocusedIndex = nextSelectValue.indexOf(focusedValue); 22359 if (nextFocusedIndex > -1) { 22360 return focusedValue; 22361 } else if (lastFocusedIndex < nextSelectValue.length) { 22362 return nextSelectValue[lastFocusedIndex]; 22363 } 22364 } 22365 return null; 22366} 22367function getNextFocusedOption(state, options) { 22368 var lastFocusedOption = state.focusedOption; 22369 return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0]; 22370} 22371var getFocusedOptionId = function getFocusedOptionId2(focusableOptionsWithIds, focusedOption) { 22372 var _focusableOptionsWith; 22373 var focusedOptionId = (_focusableOptionsWith = focusableOptionsWithIds.find(function(option) { 22374 return option.data === focusedOption; 22375 })) === null || _focusableOptionsWith === void 0 ? void 0 : _focusableOptionsWith.id; 22376 return focusedOptionId || null; 22377}; 22378var getOptionLabel2 = function getOptionLabel3(props, data) { 22379 return props.getOptionLabel(data); 22380}; 22381var getOptionValue2 = function getOptionValue3(props, data) { 22382 return props.getOptionValue(data); 22383}; 22384function _isOptionDisabled(props, option, selectValue) { 22385 return typeof props.isOptionDisabled === "function" ? props.isOptionDisabled(option, selectValue) : false; 22386} 22387function _isOptionSelected(props, option, selectValue) { 22388 if (selectValue.indexOf(option) > -1) return true; 22389 if (typeof props.isOptionSelected === "function") { 22390 return props.isOptionSelected(option, selectValue); 22391 } 22392 var candidate = getOptionValue2(props, option); 22393 return selectValue.some(function(i) { 22394 return getOptionValue2(props, i) === candidate; 22395 }); 22396} 22397function _filterOption(props, option, inputValue) { 22398 return props.filterOption ? props.filterOption(option, inputValue) : true; 22399} 22400var shouldHideSelectedOptions = function shouldHideSelectedOptions2(props) { 22401 var hideSelectedOptions = props.hideSelectedOptions, isMulti = props.isMulti; 22402 if (hideSelectedOptions === void 0) return isMulti; 22403 return hideSelectedOptions; 22404}; 22405var instanceId = 1; 22406var Select$1 = /* @__PURE__ */ function(_Component) { 22407 _inherits(Select2, _Component); 22408 var _super = _createSuper(Select2); 22409 function Select2(_props) { 22410 var _this; 22411 _classCallCheck(this, Select2); 22412 _this = _super.call(this, _props); 22413 _this.state = { 22414 ariaSelection: null, 22415 focusedOption: null, 22416 focusedOptionId: null, 22417 focusableOptionsWithIds: [], 22418 focusedValue: null, 22419 inputIsHidden: false, 22420 isFocused: false, 22421 selectValue: [], 22422 clearFocusValueOnUpdate: false, 22423 prevWasFocused: false, 22424 inputIsHiddenAfterUpdate: void 0, 22425 prevProps: void 0, 22426 instancePrefix: "" 22427 }; 22428 _this.blockOptionHover = false; 22429 _this.isComposing = false; 22430 _this.commonProps = void 0; 22431 _this.initialTouchX = 0; 22432 _this.initialTouchY = 0; 22433 _this.openAfterFocus = false; 22434 _this.scrollToFocusedOptionOnUpdate = false; 22435 _this.userIsDragging = void 0; 22436 _this.isAppleDevice = isAppleDevice(); 22437 _this.controlRef = null; 22438 _this.getControlRef = function(ref) { 22439 _this.controlRef = ref; 22440 }; 22441 _this.focusedOptionRef = null; 22442 _this.getFocusedOptionRef = function(ref) { 22443 _this.focusedOptionRef = ref; 22444 }; 22445 _this.menuListRef = null; 22446 _this.getMenuListRef = function(ref) { 22447 _this.menuListRef = ref; 22448 }; 22449 _this.inputRef = null; 22450 _this.getInputRef = function(ref) { 22451 _this.inputRef = ref; 22452 }; 22453 _this.focus = _this.focusInput; 22454 _this.blur = _this.blurInput; 22455 _this.onChange = function(newValue, actionMeta) { 22456 var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name; 22457 actionMeta.name = name; 22458 _this.ariaOnChange(newValue, actionMeta); 22459 onChange2(newValue, actionMeta); 22460 }; 22461 _this.setValue = function(newValue, action, option) { 22462 var _this$props2 = _this.props, closeMenuOnSelect = _this$props2.closeMenuOnSelect, isMulti = _this$props2.isMulti, inputValue = _this$props2.inputValue; 22463 _this.onInputChange("", { 22464 action: "set-value", 22465 prevInputValue: inputValue 22466 }); 22467 if (closeMenuOnSelect) { 22468 _this.setState({ 22469 inputIsHiddenAfterUpdate: !isMulti 22470 }); 22471 _this.onMenuClose(); 22472 } 22473 _this.setState({ 22474 clearFocusValueOnUpdate: true 22475 }); 22476 _this.onChange(newValue, { 22477 action, 22478 option 22479 }); 22480 }; 22481 _this.selectOption = function(newValue) { 22482 var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name; 22483 var selectValue = _this.state.selectValue; 22484 var deselected = isMulti && _this.isOptionSelected(newValue, selectValue); 22485 var isDisabled = _this.isOptionDisabled(newValue, selectValue); 22486 if (deselected) { 22487 var candidate = _this.getOptionValue(newValue); 22488 _this.setValue(multiValueAsValue(selectValue.filter(function(i) { 22489 return _this.getOptionValue(i) !== candidate; 22490 })), "deselect-option", newValue); 22491 } else if (!isDisabled) { 22492 if (isMulti) { 22493 _this.setValue(multiValueAsValue([].concat(_toConsumableArray(selectValue), [newValue])), "select-option", newValue); 22494 } else { 22495 _this.setValue(singleValueAsValue(newValue), "select-option"); 22496 } 22497 } else { 22498 _this.ariaOnChange(singleValueAsValue(newValue), { 22499 action: "select-option", 22500 option: newValue, 22501 name 22502 }); 22503 return; 22504 } 22505 if (blurInputOnSelect) { 22506 _this.blurInput(); 22507 } 22508 }; 22509 _this.removeValue = function(removedValue) { 22510 var isMulti = _this.props.isMulti; 22511 var selectValue = _this.state.selectValue; 22512 var candidate = _this.getOptionValue(removedValue); 22513 var newValueArray = selectValue.filter(function(i) { 22514 return _this.getOptionValue(i) !== candidate; 22515 }); 22516 var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null); 22517 _this.onChange(newValue, { 22518 action: "remove-value", 22519 removedValue 22520 }); 22521 _this.focusInput(); 22522 }; 22523 _this.clearValue = function() { 22524 var selectValue = _this.state.selectValue; 22525 _this.onChange(valueTernary(_this.props.isMulti, [], null), { 22526 action: "clear", 22527 removedValues: selectValue 22528 }); 22529 }; 22530 _this.popValue = function() { 22531 var isMulti = _this.props.isMulti; 22532 var selectValue = _this.state.selectValue; 22533 var lastSelectedValue = selectValue[selectValue.length - 1]; 22534 var newValueArray = selectValue.slice(0, selectValue.length - 1); 22535 var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null); 22536 if (lastSelectedValue) { 22537 _this.onChange(newValue, { 22538 action: "pop-value", 22539 removedValue: lastSelectedValue 22540 }); 22541 } 22542 }; 22543 _this.getFocusedOptionId = function(focusedOption) { 22544 return getFocusedOptionId(_this.state.focusableOptionsWithIds, focusedOption); 22545 }; 22546 _this.getFocusableOptionsWithIds = function() { 22547 return buildFocusableOptionsWithIds(buildCategorizedOptions(_this.props, _this.state.selectValue), _this.getElementId("option")); 22548 }; 22549 _this.getValue = function() { 22550 return _this.state.selectValue; 22551 }; 22552 _this.cx = function() { 22553 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 22554 args[_key] = arguments[_key]; 22555 } 22556 return classNames.apply(void 0, [_this.props.classNamePrefix].concat(args)); 22557 }; 22558 _this.getOptionLabel = function(data) { 22559 return getOptionLabel2(_this.props, data); 22560 }; 22561 _this.getOptionValue = function(data) { 22562 return getOptionValue2(_this.props, data); 22563 }; 22564 _this.getStyles = function(key, props) { 22565 var unstyled = _this.props.unstyled; 22566 var base = defaultStyles[key](props, unstyled); 22567 base.boxSizing = "border-box"; 22568 var custom = _this.props.styles[key]; 22569 return custom ? custom(base, props) : base; 22570 }; 22571 _this.getClassNames = function(key, props) { 22572 var _this$props$className, _this$props$className2; 22573 return (_this$props$className = (_this$props$className2 = _this.props.classNames)[key]) === null || _this$props$className === void 0 ? void 0 : _this$props$className.call(_this$props$className2, props); 22574 }; 22575 _this.getElementId = function(element) { 22576 return "".concat(_this.state.instancePrefix, "-").concat(element); 22577 }; 22578 _this.getComponents = function() { 22579 return defaultComponents(_this.props); 22580 }; 22581 _this.buildCategorizedOptions = function() { 22582 return buildCategorizedOptions(_this.props, _this.state.selectValue); 22583 }; 22584 _this.getCategorizedOptions = function() { 22585 return _this.props.menuIsOpen ? _this.buildCategorizedOptions() : []; 22586 }; 22587 _this.buildFocusableOptions = function() { 22588 return buildFocusableOptionsFromCategorizedOptions(_this.buildCategorizedOptions()); 22589 }; 22590 _this.getFocusableOptions = function() { 22591 return _this.props.menuIsOpen ? _this.buildFocusableOptions() : []; 22592 }; 22593 _this.ariaOnChange = function(value, actionMeta) { 22594 _this.setState({ 22595 ariaSelection: _objectSpread2({ 22596 value 22597 }, actionMeta) 22598 }); 22599 }; 22600 _this.onMenuMouseDown = function(event) { 22601 if (event.button !== 0) { 22602 return; 22603 } 22604 event.stopPropagation(); 22605 event.preventDefault(); 22606 _this.focusInput(); 22607 }; 22608 _this.onMenuMouseMove = function(event) { 22609 _this.blockOptionHover = false; 22610 }; 22611 _this.onControlMouseDown = function(event) { 22612 if (event.defaultPrevented) { 22613 return; 22614 } 22615 var openMenuOnClick = _this.props.openMenuOnClick; 22616 if (!_this.state.isFocused) { 22617 if (openMenuOnClick) { 22618 _this.openAfterFocus = true; 22619 } 22620 _this.focusInput(); 22621 } else if (!_this.props.menuIsOpen) { 22622 if (openMenuOnClick) { 22623 _this.openMenu("first"); 22624 } 22625 } else { 22626 if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA") { 22627 _this.onMenuClose(); 22628 } 22629 } 22630 if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA") { 22631 event.preventDefault(); 22632 } 22633 }; 22634 _this.onDropdownIndicatorMouseDown = function(event) { 22635 if (event && event.type === "mousedown" && event.button !== 0) { 22636 return; 22637 } 22638 if (_this.props.isDisabled) return; 22639 var _this$props4 = _this.props, isMulti = _this$props4.isMulti, menuIsOpen = _this$props4.menuIsOpen; 22640 _this.focusInput(); 22641 if (menuIsOpen) { 22642 _this.setState({ 22643 inputIsHiddenAfterUpdate: !isMulti 22644 }); 22645 _this.onMenuClose(); 22646 } else { 22647 _this.openMenu("first"); 22648 } 22649 event.preventDefault(); 22650 }; 22651 _this.onClearIndicatorMouseDown = function(event) { 22652 if (event && event.type === "mousedown" && event.button !== 0) { 22653 return; 22654 } 22655 _this.clearValue(); 22656 event.preventDefault(); 22657 _this.openAfterFocus = false; 22658 if (event.type === "touchend") { 22659 _this.focusInput(); 22660 } else { 22661 setTimeout(function() { 22662 return _this.focusInput(); 22663 }); 22664 } 22665 }; 22666 _this.onScroll = function(event) { 22667 if (typeof _this.props.closeMenuOnScroll === "boolean") { 22668 if (event.target instanceof HTMLElement && isDocumentElement(event.target)) { 22669 _this.props.onMenuClose(); 22670 } 22671 } else if (typeof _this.props.closeMenuOnScroll === "function") { 22672 if (_this.props.closeMenuOnScroll(event)) { 22673 _this.props.onMenuClose(); 22674 } 22675 } 22676 }; 22677 _this.onCompositionStart = function() { 22678 _this.isComposing = true; 22679 }; 22680 _this.onCompositionEnd = function() { 22681 _this.isComposing = false; 22682 }; 22683 _this.onTouchStart = function(_ref22) { 22684 var touches = _ref22.touches; 22685 var touch = touches && touches.item(0); 22686 if (!touch) { 22687 return; 22688 } 22689 _this.initialTouchX = touch.clientX; 22690 _this.initialTouchY = touch.clientY; 22691 _this.userIsDragging = false; 22692 }; 22693 _this.onTouchMove = function(_ref3) { 22694 var touches = _ref3.touches; 22695 var touch = touches && touches.item(0); 22696 if (!touch) { 22697 return; 22698 } 22699 var deltaX = Math.abs(touch.clientX - _this.initialTouchX); 22700 var deltaY = Math.abs(touch.clientY - _this.initialTouchY); 22701 var moveThreshold = 5; 22702 _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold; 22703 }; 22704 _this.onTouchEnd = function(event) { 22705 if (_this.userIsDragging) return; 22706 if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) { 22707 _this.blurInput(); 22708 } 22709 _this.initialTouchX = 0; 22710 _this.initialTouchY = 0; 22711 }; 22712 _this.onControlTouchEnd = function(event) { 22713 if (_this.userIsDragging) return; 22714 _this.onControlMouseDown(event); 22715 }; 22716 _this.onClearIndicatorTouchEnd = function(event) { 22717 if (_this.userIsDragging) return; 22718 _this.onClearIndicatorMouseDown(event); 22719 }; 22720 _this.onDropdownIndicatorTouchEnd = function(event) { 22721 if (_this.userIsDragging) return; 22722 _this.onDropdownIndicatorMouseDown(event); 22723 }; 22724 _this.handleInputChange = function(event) { 22725 var prevInputValue = _this.props.inputValue; 22726 var inputValue = event.currentTarget.value; 22727 _this.setState({ 22728 inputIsHiddenAfterUpdate: false 22729 }); 22730 _this.onInputChange(inputValue, { 22731 action: "input-change", 22732 prevInputValue 22733 }); 22734 if (!_this.props.menuIsOpen) { 22735 _this.onMenuOpen(); 22736 } 22737 }; 22738 _this.onInputFocus = function(event) { 22739 if (_this.props.onFocus) { 22740 _this.props.onFocus(event); 22741 } 22742 _this.setState({ 22743 inputIsHiddenAfterUpdate: false, 22744 isFocused: true 22745 }); 22746 if (_this.openAfterFocus || _this.props.openMenuOnFocus) { 22747 _this.openMenu("first"); 22748 } 22749 _this.openAfterFocus = false; 22750 }; 22751 _this.onInputBlur = function(event) { 22752 var prevInputValue = _this.props.inputValue; 22753 if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) { 22754 _this.inputRef.focus(); 22755 return; 22756 } 22757 if (_this.props.onBlur) { 22758 _this.props.onBlur(event); 22759 } 22760 _this.onInputChange("", { 22761 action: "input-blur", 22762 prevInputValue 22763 }); 22764 _this.onMenuClose(); 22765 _this.setState({ 22766 focusedValue: null, 22767 isFocused: false 22768 }); 22769 }; 22770 _this.onOptionHover = function(focusedOption) { 22771 if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) { 22772 return; 22773 } 22774 var options = _this.getFocusableOptions(); 22775 var focusedOptionIndex = options.indexOf(focusedOption); 22776 _this.setState({ 22777 focusedOption, 22778 focusedOptionId: focusedOptionIndex > -1 ? _this.getFocusedOptionId(focusedOption) : null 22779 }); 22780 }; 22781 _this.shouldHideSelectedOptions = function() { 22782 return shouldHideSelectedOptions(_this.props); 22783 }; 22784 _this.onValueInputFocus = function(e) { 22785 e.preventDefault(); 22786 e.stopPropagation(); 22787 _this.focus(); 22788 }; 22789 _this.onKeyDown = function(event) { 22790 var _this$props5 = _this.props, isMulti = _this$props5.isMulti, backspaceRemovesValue = _this$props5.backspaceRemovesValue, escapeClearsValue = _this$props5.escapeClearsValue, inputValue = _this$props5.inputValue, isClearable = _this$props5.isClearable, isDisabled = _this$props5.isDisabled, menuIsOpen = _this$props5.menuIsOpen, onKeyDown = _this$props5.onKeyDown, tabSelectsValue = _this$props5.tabSelectsValue, openMenuOnFocus = _this$props5.openMenuOnFocus; 22791 var _this$state = _this.state, focusedOption = _this$state.focusedOption, focusedValue = _this$state.focusedValue, selectValue = _this$state.selectValue; 22792 if (isDisabled) return; 22793 if (typeof onKeyDown === "function") { 22794 onKeyDown(event); 22795 if (event.defaultPrevented) { 22796 return; 22797 } 22798 } 22799 _this.blockOptionHover = true; 22800 switch (event.key) { 22801 case "ArrowLeft": 22802 if (!isMulti || inputValue) return; 22803 _this.focusValue("previous"); 22804 break; 22805 case "ArrowRight": 22806 if (!isMulti || inputValue) return; 22807 _this.focusValue("next"); 22808 break; 22809 case "Delete": 22810 case "Backspace": 22811 if (inputValue) return; 22812 if (focusedValue) { 22813 _this.removeValue(focusedValue); 22814 } else { 22815 if (!backspaceRemovesValue) return; 22816 if (isMulti) { 22817 _this.popValue(); 22818 } else if (isClearable) { 22819 _this.clearValue(); 22820 } 22821 } 22822 break; 22823 case "Tab": 22824 if (_this.isComposing) return; 22825 if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused 22826 // option is already selected; it breaks the flow of navigation 22827 openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) { 22828 return; 22829 } 22830 _this.selectOption(focusedOption); 22831 break; 22832 case "Enter": 22833 if (event.keyCode === 229) { 22834 break; 22835 } 22836 if (menuIsOpen) { 22837 if (!focusedOption) return; 22838 if (_this.isComposing) return; 22839 _this.selectOption(focusedOption); 22840 break; 22841 } 22842 return; 22843 case "Escape": 22844 if (menuIsOpen) { 22845 _this.setState({ 22846 inputIsHiddenAfterUpdate: false 22847 }); 22848 _this.onInputChange("", { 22849 action: "menu-close", 22850 prevInputValue: inputValue 22851 }); 22852 _this.onMenuClose(); 22853 } else if (isClearable && escapeClearsValue) { 22854 _this.clearValue(); 22855 } 22856 break; 22857 case " ": 22858 if (inputValue) { 22859 return; 22860 } 22861 if (!menuIsOpen) { 22862 _this.openMenu("first"); 22863 break; 22864 } 22865 if (!focusedOption) return; 22866 _this.selectOption(focusedOption); 22867 break; 22868 case "ArrowUp": 22869 if (menuIsOpen) { 22870 _this.focusOption("up"); 22871 } else { 22872 _this.openMenu("last"); 22873 } 22874 break; 22875 case "ArrowDown": 22876 if (menuIsOpen) { 22877 _this.focusOption("down"); 22878 } else { 22879 _this.openMenu("first"); 22880 } 22881 break; 22882 case "PageUp": 22883 if (!menuIsOpen) return; 22884 _this.focusOption("pageup"); 22885 break; 22886 case "PageDown": 22887 if (!menuIsOpen) return; 22888 _this.focusOption("pagedown"); 22889 break; 22890 case "Home": 22891 if (!menuIsOpen) return; 22892 _this.focusOption("first"); 22893 break; 22894 case "End": 22895 if (!menuIsOpen) return; 22896 _this.focusOption("last"); 22897 break; 22898 default: 22899 return; 22900 } 22901 event.preventDefault(); 22902 }; 22903 _this.state.instancePrefix = "react-select-" + (_this.props.instanceId || ++instanceId); 22904 _this.state.selectValue = cleanValue(_props.value); 22905 if (_props.menuIsOpen && _this.state.selectValue.length) { 22906 var focusableOptionsWithIds = _this.getFocusableOptionsWithIds(); 22907 var focusableOptions = _this.buildFocusableOptions(); 22908 var optionIndex = focusableOptions.indexOf(_this.state.selectValue[0]); 22909 _this.state.focusableOptionsWithIds = focusableOptionsWithIds; 22910 _this.state.focusedOption = focusableOptions[optionIndex]; 22911 _this.state.focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusableOptions[optionIndex]); 22912 } 22913 return _this; 22914 } 22915 _createClass(Select2, [{ 22916 key: "componentDidMount", 22917 value: function componentDidMount() { 22918 this.startListeningComposition(); 22919 this.startListeningToTouch(); 22920 if (this.props.closeMenuOnScroll && document && document.addEventListener) { 22921 document.addEventListener("scroll", this.onScroll, true); 22922 } 22923 if (this.props.autoFocus) { 22924 this.focusInput(); 22925 } 22926 if (this.props.menuIsOpen && this.state.focusedOption && this.menuListRef && this.focusedOptionRef) { 22927 scrollIntoView(this.menuListRef, this.focusedOptionRef); 22928 } 22929 } 22930 }, { 22931 key: "componentDidUpdate", 22932 value: function componentDidUpdate(prevProps) { 22933 var _this$props6 = this.props, isDisabled = _this$props6.isDisabled, menuIsOpen = _this$props6.menuIsOpen; 22934 var isFocused = this.state.isFocused; 22935 if ( 22936 // ensure focus is restored correctly when the control becomes enabled 22937 isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens 22938 isFocused && menuIsOpen && !prevProps.menuIsOpen 22939 ) { 22940 this.focusInput(); 22941 } 22942 if (isFocused && isDisabled && !prevProps.isDisabled) { 22943 this.setState({ 22944 isFocused: false 22945 }, this.onMenuClose); 22946 } else if (!isFocused && !isDisabled && prevProps.isDisabled && this.inputRef === document.activeElement) { 22947 this.setState({ 22948 isFocused: true 22949 }); 22950 } 22951 if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) { 22952 scrollIntoView(this.menuListRef, this.focusedOptionRef); 22953 this.scrollToFocusedOptionOnUpdate = false; 22954 } 22955 } 22956 }, { 22957 key: "componentWillUnmount", 22958 value: function componentWillUnmount() { 22959 this.stopListeningComposition(); 22960 this.stopListeningToTouch(); 22961 document.removeEventListener("scroll", this.onScroll, true); 22962 } 22963 // ============================== 22964 // Consumer Handlers 22965 // ============================== 22966 }, { 22967 key: "onMenuOpen", 22968 value: function onMenuOpen() { 22969 this.props.onMenuOpen(); 22970 } 22971 }, { 22972 key: "onMenuClose", 22973 value: function onMenuClose() { 22974 this.onInputChange("", { 22975 action: "menu-close", 22976 prevInputValue: this.props.inputValue 22977 }); 22978 this.props.onMenuClose(); 22979 } 22980 }, { 22981 key: "onInputChange", 22982 value: function onInputChange(newValue, actionMeta) { 22983 this.props.onInputChange(newValue, actionMeta); 22984 } 22985 // ============================== 22986 // Methods 22987 // ============================== 22988 }, { 22989 key: "focusInput", 22990 value: function focusInput() { 22991 if (!this.inputRef) return; 22992 this.inputRef.focus(); 22993 } 22994 }, { 22995 key: "blurInput", 22996 value: function blurInput() { 22997 if (!this.inputRef) return; 22998 this.inputRef.blur(); 22999 } 23000 // aliased for consumers 23001 }, { 23002 key: "openMenu", 23003 value: function openMenu(focusOption) { 23004 var _this2 = this; 23005 var _this$state2 = this.state, selectValue = _this$state2.selectValue, isFocused = _this$state2.isFocused; 23006 var focusableOptions = this.buildFocusableOptions(); 23007 var openAtIndex = focusOption === "first" ? 0 : focusableOptions.length - 1; 23008 if (!this.props.isMulti) { 23009 var selectedIndex = focusableOptions.indexOf(selectValue[0]); 23010 if (selectedIndex > -1) { 23011 openAtIndex = selectedIndex; 23012 } 23013 } 23014 this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef); 23015 this.setState({ 23016 inputIsHiddenAfterUpdate: false, 23017 focusedValue: null, 23018 focusedOption: focusableOptions[openAtIndex], 23019 focusedOptionId: this.getFocusedOptionId(focusableOptions[openAtIndex]) 23020 }, function() { 23021 return _this2.onMenuOpen(); 23022 }); 23023 } 23024 }, { 23025 key: "focusValue", 23026 value: function focusValue(direction) { 23027 var _this$state3 = this.state, selectValue = _this$state3.selectValue, focusedValue = _this$state3.focusedValue; 23028 if (!this.props.isMulti) return; 23029 this.setState({ 23030 focusedOption: null 23031 }); 23032 var focusedIndex = selectValue.indexOf(focusedValue); 23033 if (!focusedValue) { 23034 focusedIndex = -1; 23035 } 23036 var lastIndex = selectValue.length - 1; 23037 var nextFocus = -1; 23038 if (!selectValue.length) return; 23039 switch (direction) { 23040 case "previous": 23041 if (focusedIndex === 0) { 23042 nextFocus = 0; 23043 } else if (focusedIndex === -1) { 23044 nextFocus = lastIndex; 23045 } else { 23046 nextFocus = focusedIndex - 1; 23047 } 23048 break; 23049 case "next": 23050 if (focusedIndex > -1 && focusedIndex < lastIndex) { 23051 nextFocus = focusedIndex + 1; 23052 } 23053 break; 23054 } 23055 this.setState({ 23056 inputIsHidden: nextFocus !== -1, 23057 focusedValue: selectValue[nextFocus] 23058 }); 23059 } 23060 }, { 23061 key: "focusOption", 23062 value: function focusOption() { 23063 var direction = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "first"; 23064 var pageSize = this.props.pageSize; 23065 var focusedOption = this.state.focusedOption; 23066 var options = this.getFocusableOptions(); 23067 if (!options.length) return; 23068 var nextFocus = 0; 23069 var focusedIndex = options.indexOf(focusedOption); 23070 if (!focusedOption) { 23071 focusedIndex = -1; 23072 } 23073 if (direction === "up") { 23074 nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1; 23075 } else if (direction === "down") { 23076 nextFocus = (focusedIndex + 1) % options.length; 23077 } else if (direction === "pageup") { 23078 nextFocus = focusedIndex - pageSize; 23079 if (nextFocus < 0) nextFocus = 0; 23080 } else if (direction === "pagedown") {
23081 nextFocus = focusedIndex + pageSize; 23082 if (nextFocus > options.length - 1) nextFocus = options.length - 1; 23083 } else if (direction === "last") { 23084 nextFocus = options.length - 1; 23085 } 23086 this.scrollToFocusedOptionOnUpdate = true; 23087 this.setState({ 23088 focusedOption: options[nextFocus], 23089 focusedValue: null, 23090 focusedOptionId: this.getFocusedOptionId(options[nextFocus]) 23091 }); 23092 } 23093 }, { 23094 key: "getTheme", 23095 value: ( 23096 // ============================== 23097 // Getters 23098 // ============================== 23099 function getTheme() { 23100 if (!this.props.theme) { 23101 return defaultTheme; 23102 } 23103 if (typeof this.props.theme === "function") { 23104 return this.props.theme(defaultTheme); 23105 } 23106 return _objectSpread2(_objectSpread2({}, defaultTheme), this.props.theme); 23107 } 23108 ) 23109 }, { 23110 key: "getCommonProps", 23111 value: function getCommonProps() { 23112 var clearValue = this.clearValue, cx = this.cx, getStyles = this.getStyles, getClassNames = this.getClassNames, getValue = this.getValue, selectOption = this.selectOption, setValue = this.setValue, props = this.props; 23113 var isMulti = props.isMulti, isRtl = props.isRtl, options = props.options; 23114 var hasValue = this.hasValue(); 23115 return { 23116 clearValue, 23117 cx, 23118 getStyles, 23119 getClassNames, 23120 getValue, 23121 hasValue, 23122 isMulti, 23123 isRtl, 23124 options, 23125 selectOption, 23126 selectProps: props, 23127 setValue, 23128 theme: this.getTheme() 23129 }; 23130 } 23131 }, { 23132 key: "hasValue", 23133 value: function hasValue() { 23134 var selectValue = this.state.selectValue; 23135 return selectValue.length > 0; 23136 } 23137 }, { 23138 key: "hasOptions", 23139 value: function hasOptions() { 23140 return !!this.getFocusableOptions().length; 23141 } 23142 }, { 23143 key: "isClearable", 23144 value: function isClearable() { 23145 var _this$props7 = this.props, isClearable2 = _this$props7.isClearable, isMulti = _this$props7.isMulti; 23146 if (isClearable2 === void 0) return isMulti; 23147 return isClearable2; 23148 } 23149 }, { 23150 key: "isOptionDisabled", 23151 value: function isOptionDisabled3(option, selectValue) { 23152 return _isOptionDisabled(this.props, option, selectValue); 23153 } 23154 }, { 23155 key: "isOptionSelected", 23156 value: function isOptionSelected(option, selectValue) { 23157 return _isOptionSelected(this.props, option, selectValue); 23158 } 23159 }, { 23160 key: "filterOption", 23161 value: function filterOption(option, inputValue) { 23162 return _filterOption(this.props, option, inputValue); 23163 } 23164 }, { 23165 key: "formatOptionLabel", 23166 value: function formatOptionLabel(data, context) { 23167 if (typeof this.props.formatOptionLabel === "function") { 23168 var _inputValue = this.props.inputValue; 23169 var _selectValue = this.state.selectValue; 23170 return this.props.formatOptionLabel(data, { 23171 context, 23172 inputValue: _inputValue, 23173 selectValue: _selectValue 23174 }); 23175 } else { 23176 return this.getOptionLabel(data); 23177 } 23178 } 23179 }, { 23180 key: "formatGroupLabel", 23181 value: function formatGroupLabel3(data) { 23182 return this.props.formatGroupLabel(data); 23183 } 23184 // ============================== 23185 // Mouse Handlers 23186 // ============================== 23187 }, { 23188 key: "startListeningComposition", 23189 value: ( 23190 // ============================== 23191 // Composition Handlers 23192 // ============================== 23193 function startListeningComposition() { 23194 if (document && document.addEventListener) { 23195 document.addEventListener("compositionstart", this.onCompositionStart, false); 23196 document.addEventListener("compositionend", this.onCompositionEnd, false); 23197 } 23198 } 23199 ) 23200 }, { 23201 key: "stopListeningComposition", 23202 value: function stopListeningComposition() { 23203 if (document && document.removeEventListener) { 23204 document.removeEventListener("compositionstart", this.onCompositionStart); 23205 document.removeEventListener("compositionend", this.onCompositionEnd); 23206 } 23207 } 23208 }, { 23209 key: "startListeningToTouch", 23210 value: ( 23211 // ============================== 23212 // Touch Handlers 23213 // ============================== 23214 function startListeningToTouch() { 23215 if (document && document.addEventListener) { 23216 document.addEventListener("touchstart", this.onTouchStart, false); 23217 document.addEventListener("touchmove", this.onTouchMove, false); 23218 document.addEventListener("touchend", this.onTouchEnd, false); 23219 } 23220 } 23221 ) 23222 }, { 23223 key: "stopListeningToTouch", 23224 value: function stopListeningToTouch() { 23225 if (document && document.removeEventListener) { 23226 document.removeEventListener("touchstart", this.onTouchStart); 23227 document.removeEventListener("touchmove", this.onTouchMove); 23228 document.removeEventListener("touchend", this.onTouchEnd); 23229 } 23230 } 23231 }, { 23232 key: "renderInput", 23233 value: ( 23234 // ============================== 23235 // Renderers 23236 // ============================== 23237 function renderInput() { 23238 var _this$props8 = this.props, isDisabled = _this$props8.isDisabled, isSearchable = _this$props8.isSearchable, inputId = _this$props8.inputId, inputValue = _this$props8.inputValue, tabIndex = _this$props8.tabIndex, form = _this$props8.form, menuIsOpen = _this$props8.menuIsOpen, required = _this$props8.required; 23239 var _this$getComponents = this.getComponents(), Input = _this$getComponents.Input; 23240 var _this$state4 = this.state, inputIsHidden = _this$state4.inputIsHidden, ariaSelection = _this$state4.ariaSelection; 23241 var commonProps = this.commonProps; 23242 var id = inputId || this.getElementId("input");
23243 var ariaAttributes = _objectSpread2(_objectSpread2(_objectSpread2({ 23244 "aria-autocomplete": "list", 23245 "aria-expanded": menuIsOpen, 23246 "aria-haspopup": true, 23247 "aria-errormessage": this.props["aria-errormessage"], 23248 "aria-invalid": this.props["aria-invalid"], 23249 "aria-label": this.props["aria-label"], 23250 "aria-labelledby": this.props["aria-labelledby"], 23251 "aria-required": required, 23252 role: "combobox", 23253 "aria-activedescendant": this.isAppleDevice ? void 0 : this.state.focusedOptionId || "" 23254 }, menuIsOpen && { 23255 "aria-controls": this.getElementId("listbox") 23256 }), !isSearchable && { 23257 "aria-readonly": true 23258 }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus" && { 23259 "aria-describedby": this.getElementId("live-region") 23260 } : { 23261 "aria-describedby": this.getElementId("placeholder") 23262 }); 23263 if (!isSearchable) { 23264 return /* @__PURE__ */ reactExports.createElement(DummyInput, _extends({ 23265 id, 23266 innerRef: this.getInputRef, 23267 onBlur: this.onInputBlur, 23268 onChange: noop$1, 23269 onFocus: this.onInputFocus, 23270 disabled: isDisabled, 23271 tabIndex, 23272 inputMode: "none", 23273 form, 23274 value: "" 23275 }, ariaAttributes)); 23276 } 23277 return /* @__PURE__ */ reactExports.createElement(Input, _extends({}, commonProps, { 23278 autoCapitalize: "none", 23279 autoComplete: "off", 23280 autoCorrect: "off", 23281 id, 23282 innerRef: this.getInputRef, 23283 isDisabled, 23284 isHidden: inputIsHidden, 23285 onBlur: this.onInputBlur, 23286 onChange: this.handleInputChange, 23287 onFocus: this.onInputFocus, 23288 spellCheck: "false", 23289 tabIndex, 23290 form, 23291 type: "text", 23292 value: inputValue 23293 }, ariaAttributes)); 23294 } 23295 ) 23296 }, { 23297 key: "renderPlaceholderOrValue", 23298 value: function renderPlaceholderOrValue() { 23299 var _this3 = this; 23300 var _this$getComponents2 = this.getComponents(), MultiValue = _this$getComponents2.MultiValue, MultiValueContainer = _this$getComponents2.MultiValueContainer, MultiValueLabel = _this$getComponents2.MultiValueLabel, MultiValueRemove = _this$getComponents2.MultiValueRemove, SingleValue = _this$getComponents2.SingleValue, Placeholder = _this$getComponents2.Placeholder; 23301 var commonProps = this.commonProps; 23302 var _this$props9 = this.props, controlShouldRenderValue = _this$props9.controlShouldRenderValue, isDisabled = _this$props9.isDisabled, isMulti = _this$props9.isMulti, inputValue = _this$props9.inputValue, placeholder = _this$props9.placeholder; 23303 var _this$state5 = this.state, selectValue = _this$state5.selectValue, focusedValue = _this$state5.focusedValue, isFocused = _this$state5.isFocused; 23304 if (!this.hasValue() || !controlShouldRenderValue) { 23305 return inputValue ? null : /* @__PURE__ */ reactExports.createElement(Placeholder, _extends({}, commonProps, { 23306 key: "placeholder", 23307 isDisabled, 23308 isFocused, 23309 innerProps: { 23310 id: this.getElementId("placeholder") 23311 } 23312 }), placeholder); 23313 } 23314 if (isMulti) { 23315 return selectValue.map(function(opt, index) { 23316 var isOptionFocused = opt === focusedValue; 23317 var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt)); 23318 return /* @__PURE__ */ reactExports.createElement(MultiValue, _extends({}, commonProps, { 23319 components: { 23320 Container: MultiValueContainer, 23321 Label: MultiValueLabel, 23322 Remove: MultiValueRemove 23323 }, 23324 isFocused: isOptionFocused, 23325 isDisabled, 23326 key, 23327 index, 23328 removeProps: { 23329 onClick: function onClick() { 23330 return _this3.removeValue(opt); 23331 }, 23332 onTouchEnd: function onTouchEnd() { 23333 return _this3.removeValue(opt); 23334 }, 23335 onMouseDown: function onMouseDown(e) { 23336 e.preventDefault(); 23337 } 23338 }, 23339 data: opt 23340 }), _this3.formatOptionLabel(opt, "value")); 23341 }); 23342 } 23343 if (inputValue) { 23344 return null; 23345 } 23346 var singleValue = selectValue[0]; 23347 return /* @__PURE__ */ reactExports.createElement(SingleValue, _extends({}, commonProps, { 23348 data: singleValue, 23349 isDisabled 23350 }), this.formatOptionLabel(singleValue, "value")); 23351 } 23352 }, { 23353 key: "renderClearIndicator", 23354 value: function renderClearIndicator() { 23355 var _this$getComponents3 = this.getComponents(), ClearIndicator = _this$getComponents3.ClearIndicator; 23356 var commonProps = this.commonProps; 23357 var _this$props10 = this.props, isDisabled = _this$props10.isDisabled, isLoading = _this$props10.isLoading; 23358 var isFocused = this.state.isFocused; 23359 if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) { 23360 return null; 23361 } 23362 var innerProps = { 23363 onMouseDown: this.onClearIndicatorMouseDown, 23364 onTouchEnd: this.onClearIndicatorTouchEnd, 23365 "aria-hidden": "true" 23366 }; 23367 return /* @__PURE__ */ reactExports.createElement(ClearIndicator, _extends({}, commonProps, { 23368 innerProps, 23369 isFocused 23370 })); 23371 } 23372 }, { 23373 key: "renderLoadingIndicator", 23374 value: function renderLoadingIndicator() { 23375 var _this$getComponents4 = this.getComponents(), LoadingIndicator = _this$getComponents4.LoadingIndicator; 23376 var commonProps = this.commonProps; 23377 var _this$props11 = this.props, isDisabled = _this$props11.isDisabled, isLoading = _this$props11.isLoading; 23378 var isFocused = this.state.isFocused; 23379 if (!LoadingIndicator || !isLoading) return null; 23380 var innerProps = { 23381 "aria-hidden": "true" 23382 }; 23383 return /* @__PURE__ */ reactExports.createElement(LoadingIndicator, _extends({}, commonProps, { 23384 innerProps, 23385 isDisabled, 23386 isFocused 23387 })); 23388 } 23389 }, { 23390 key: "renderIndicatorSeparator", 23391 value: function renderIndicatorSeparator() { 23392 var _this$getComponents5 = this.getComponents(), DropdownIndicator = _this$getComponents5.DropdownIndicator, IndicatorSeparator = _this$getComponents5.IndicatorSeparator; 23393 if (!DropdownIndicator || !IndicatorSeparator) return null; 23394 var commonProps = this.commonProps; 23395 var isDisabled = this.props.isDisabled; 23396 var isFocused = this.state.isFocused; 23397 return /* @__PURE__ */ reactExports.createElement(IndicatorSeparator, _extends({}, commonProps, { 23398 isDisabled, 23399 isFocused 23400 })); 23401 } 23402 }, { 23403 key: "renderDropdownIndicator", 23404 value: function renderDropdownIndicator() { 23405 var _this$getComponents6 = this.getComponents(), DropdownIndicator = _this$getComponents6.DropdownIndicator; 23406 if (!DropdownIndicator) return null; 23407 var commonProps = this.commonProps; 23408 var isDisabled = this.props.isDisabled; 23409 var isFocused = this.state.isFocused; 23410 var innerProps = { 23411 onMouseDown: this.onDropdownIndicatorMouseDown, 23412 onTouchEnd: this.onDropdownIndicatorTouchEnd, 23413 "aria-hidden": "true" 23414 }; 23415 return /* @__PURE__ */ reactExports.createElement(DropdownIndicator, _extends({}, commonProps, { 23416 innerProps, 23417 isDisabled, 23418 isFocused 23419 })); 23420 } 23421 }, { 23422 key: "renderMenu", 23423 value: function renderMenu() { 23424 var _this4 = this; 23425 var _this$getComponents7 = this.getComponents(), Group = _this$getComponents7.Group, GroupHeading = _this$getComponents7.GroupHeading, Menu = _this$getComponents7.Menu, MenuList = _this$getComponents7.MenuList, MenuPortal = _this$getComponents7.MenuPortal, LoadingMessage = _this$getComponents7.LoadingMessage, NoOptionsMessage = _this$getComponents7.NoOptionsMessage, Option = _this$getComponents7.Option; 23426 var commonProps = this.commonProps; 23427 var focusedOption = this.state.focusedOption; 23428 var _this$props12 = this.props, captureMenuScroll = _this$props12.captureMenuScroll, inputValue = _this$props12.inputValue, isLoading = _this$props12.isLoading, loadingMessage2 = _this$props12.loadingMessage, minMenuHeight = _this$props12.minMenuHeight, maxMenuHeight = _this$props12.maxMenuHeight, menuIsOpen = _this$props12.menuIsOpen, menuPlacement = _this$props12.menuPlacement, menuPosition = _this$props12.menuPosition, menuPortalTarget = _this$props12.menuPortalTarget, menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, noOptionsMessage2 = _this$props12.noOptionsMessage, onMenuScrollToTop = _this$props12.onMenuScrollToTop, onMenuScrollToBottom = _this$props12.onMenuScrollToBottom; 23429 if (!menuIsOpen) return null; 23430 var render = function render2(props, id) { 23431 var type = props.type, data = props.data, isDisabled = props.isDisabled, isSelected = props.isSelected, label = props.label, value = props.value; 23432 var isFocused = focusedOption === data; 23433 var onHover = isDisabled ? void 0 : function() { 23434 return _this4.onOptionHover(data); 23435 }; 23436 var onSelect = isDisabled ? void 0 : function() { 23437 return _this4.selectOption(data); 23438 }; 23439 var optionId = "".concat(_this4.getElementId("option"), "-").concat(id); 23440 var innerProps = { 23441 id: optionId, 23442 onClick: onSelect, 23443 onMouseMove: onHover, 23444 onMouseOver: onHover, 23445 tabIndex: -1, 23446 role: "option", 23447 "aria-selected": _this4.isAppleDevice ? void 0 : isSelected 23448 // is not supported on Apple devices 23449 }; 23450 return /* @__PURE__ */ reactExports.createElement(Option, _extends({}, commonProps, { 23451 innerProps, 23452 data, 23453 isDisabled, 23454 isSelected, 23455 key: optionId, 23456 label, 23457 type, 23458 value, 23459 isFocused, 23460 innerRef: isFocused ? _this4.getFocusedOptionRef : void 0 23461 }), _this4.formatOptionLabel(props.data, "menu")); 23462 }; 23463 var menuUI; 23464 if (this.hasOptions()) { 23465 menuUI = this.getCategorizedOptions().map(function(item) { 23466 if (item.type === "group") { 23467 var _data = item.data, options = item.options, groupIndex = item.index; 23468 var groupId = "".concat(_this4.getElementId("group"), "-").concat(groupIndex); 23469 var headingId = "".concat(groupId, "-heading"); 23470 return /* @__PURE__ */ reactExports.createElement(Group, _extends({}, commonProps, { 23471 key: groupId, 23472 data: _data, 23473 options, 23474 Heading: GroupHeading, 23475 headingProps: { 23476 id: headingId, 23477 data: item.data 23478 }, 23479 label: _this4.formatGroupLabel(item.data) 23480 }), item.options.map(function(option) { 23481 return render(option, "".concat(groupIndex, "-").concat(option.index)); 23482 })); 23483 } else if (item.type === "option") { 23484 return render(item, "".concat(item.index)); 23485 } 23486 }); 23487 } else if (isLoading) { 23488 var message = loadingMessage2({ 23489 inputValue 23490 }); 23491 if (message === null) return null; 23492 menuUI = /* @__PURE__ */ reactExports.createElement(LoadingMessage, commonProps, message); 23493 } else { 23494 var _message = noOptionsMessage2({ 23495 inputValue 23496 }); 23497 if (_message === null) return null; 23498 menuUI = /* @__PURE__ */ reactExports.createElement(NoOptionsMessage, commonProps, _message); 23499 } 23500 var menuPlacementProps = { 23501 minMenuHeight, 23502 maxMenuHeight, 23503 menuPlacement, 23504 menuPosition, 23505 menuShouldScrollIntoView 23506 }; 23507 var menuElement = /* @__PURE__ */ reactExports.createElement(MenuPlacer, _extends({}, commonProps, menuPlacementProps), function(_ref4) { 23508 var ref = _ref4.ref, _ref4$placerProps = _ref4.placerProps, placement = _ref4$placerProps.placement, maxHeight = _ref4$placerProps.maxHeight; 23509 return /* @__PURE__ */ reactExports.createElement(Menu, _extends({}, commonProps, menuPlacementProps, { 23510 innerRef: ref, 23511 innerProps: { 23512 onMouseDown: _this4.onMenuMouseDown, 23513 onMouseMove: _this4.onMenuMouseMove 23514 }, 23515 isLoading, 23516 placement 23517 }
23517), /* @__PURE__ */ reactExports.createElement(ScrollManager, { 23518 captureEnabled: captureMenuScroll, 23519 onTopArrive: onMenuScrollToTop, 23520 onBottomArrive: onMenuScrollToBottom, 23521 lockEnabled: menuShouldBlockScroll 23522 }, function(scrollTargetRef) { 23523 return /* @__PURE__ */ reactExports.createElement(MenuList, _extends({}, commonProps, { 23524 innerRef: function innerRef(instance) { 23525 _this4.getMenuListRef(instance); 23526 scrollTargetRef(instance); 23527 }, 23528 innerProps: { 23529 role: "listbox", 23530 "aria-multiselectable": commonProps.isMulti, 23531 id: _this4.getElementId("listbox") 23532 }, 23533 isLoading, 23534 maxHeight, 23535 focusedOption 23536 }), menuUI); 23537 })); 23538 }); 23539 return menuPortalTarget || menuPosition === "fixed" ? /* @__PURE__ */ reactExports.createElement(MenuPortal, _extends({}, commonProps, { 23540 appendTo: menuPortalTarget, 23541 controlElement: this.controlRef, 23542 menuPlacement, 23543 menuPosition 23544 }), menuElement) : menuElement; 23545 } 23546 }, { 23547 key: "renderFormField", 23548 value: function renderFormField() { 23549 var _this5 = this; 23550 var _this$props13 = this.props, delimiter = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti, name = _this$props13.name, required = _this$props13.required; 23551 var selectValue = this.state.selectValue; 23552 if (required && !this.hasValue() && !isDisabled) { 23553 return /* @__PURE__ */ reactExports.createElement(RequiredInput$1, { 23554 name, 23555 onFocus: this.onValueInputFocus 23556 }); 23557 } 23558 if (!name || isDisabled) return; 23559 if (isMulti) { 23560 if (delimiter) { 23561 var value = selectValue.map(function(opt) { 23562 return _this5.getOptionValue(opt); 23563 }).join(delimiter); 23564 return /* @__PURE__ */ reactExports.createElement("input", { 23565 name, 23566 type: "hidden", 23567 value 23568 }); 23569 } else { 23570 var input = selectValue.length > 0 ? selectValue.map(function(opt, i) { 23571 return /* @__PURE__ */ reactExports.createElement("input", { 23572 key: "i-".concat(i), 23573 name, 23574 type: "hidden", 23575 value: _this5.getOptionValue(opt) 23576 }); 23577 }) : /* @__PURE__ */ reactExports.createElement("input", { 23578 name, 23579 type: "hidden", 23580 value: "" 23581 }); 23582 return /* @__PURE__ */ reactExports.createElement("div", null, input); 23583 } 23584 } else { 23585 var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : ""; 23586 return /* @__PURE__ */ reactExports.createElement("input", { 23587 name, 23588 type: "hidden", 23589 value: _value 23590 }); 23591 } 23592 } 23593 }, { 23594 key: "renderLiveRegion", 23595 value: function renderLiveRegion() { 23596 var commonProps = this.commonProps; 23597 var _this$state6 = this.state, ariaSelection = _this$state6.ariaSelection, focusedOption = _this$state6.focusedOption, focusedValue = _this$state6.focusedValue, isFocused = _this$state6.isFocused, selectValue = _this$state6.selectValue; 23598 var focusableOptions = this.getFocusableOptions(); 23599 return /* @__PURE__ */ reactExports.createElement(LiveRegion$1, _extends({}, commonProps, { 23600 id: this.getElementId("live-region"), 23601 ariaSelection, 23602 focusedOption, 23603 focusedValue, 23604 isFocused, 23605 selectValue, 23606 focusableOptions, 23607 isAppleDevice: this.isAppleDevice 23608 })); 23609 } 23610 }, { 23611 key: "render", 23612 value: function render() { 23613 var _this$getComponents8 = this.getComponents(), Control = _this$getComponents8.Control, IndicatorsContainer = _this$getComponents8.IndicatorsContainer, SelectContainer = _this$getComponents8.SelectContainer, ValueContainer = _this$getComponents8.ValueContainer; 23614 var _this$props14 = this.props, className = _this$props14.className, id = _this$props14.id, isDisabled = _this$props14.isDisabled, menuIsOpen = _this$props14.menuIsOpen; 23615 var isFocused = this.state.isFocused; 23616 var commonProps = this.commonProps = this.getCommonProps(); 23617 return /* @__PURE__ */ reactExports.createElement(SelectContainer, _extends({}, commonProps, { 23618 className, 23619 innerProps: { 23620 id, 23621 onKeyDown: this.onKeyDown 23622 }, 23623 isDisabled, 23624 isFocused 23625 }
23625), this.renderLiveRegion(), /* @__PURE__ */ reactExports.createElement(Control, _extends({}, commonProps, { 23626 innerRef: this.getControlRef, 23627 innerProps: { 23628 onMouseDown: this.onControlMouseDown, 23629 onTouchEnd: this.onControlTouchEnd 23630 }, 23631 isDisabled, 23632 isFocused, 23633 menuIsOpen 23634 }), /* @__PURE__ */ reactExports.createElement(ValueContainer, _extends({}, commonProps, { 23635 isDisabled 23636 }), this.renderPlaceholderOrValue(), this.renderInput()), /* @__PURE__ */ reactExports.createElement(IndicatorsContainer, _extends({}, commonProps, { 23637 isDisabled 23638 }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField()); 23639 } 23640 }], [{ 23641 key: "getDerivedStateFromProps", 23642 value: function getDerivedStateFromProps(props, state) { 23643 var prevProps = state.prevProps, clearFocusValueOnUpdate = state.clearFocusValueOnUpdate, inputIsHiddenAfterUpdate = state.inputIsHiddenAfterUpdate, ariaSelection = state.ariaSelection, isFocused = state.isFocused, prevWasFocused = state.prevWasFocused, instancePrefix = state.instancePrefix; 23644 var options = props.options, value = props.value, menuIsOpen = props.menuIsOpen, inputValue = props.inputValue, isMulti = props.isMulti; 23645 var selectValue = cleanValue(value); 23646 var newMenuOptionsState = {}; 23647 if (prevProps && (value !== prevProps.value || options !== prevProps.options || menuIsOpen !== prevProps.menuIsOpen || inputValue !== prevProps.inputValue)) { 23648 var focusableOptions = menuIsOpen ? buildFocusableOptions(props, selectValue) : []; 23649 var focusableOptionsWithIds = menuIsOpen ? buildFocusableOptionsWithIds(buildCategorizedOptions(props, selectValue), "".concat(instancePrefix, "-option")) : []; 23650 var focusedValue = clearFocusValueOnUpdate ? getNextFocusedValue(state, selectValue) : null; 23651 var focusedOption = getNextFocusedOption(state, focusableOptions); 23652 var focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusedOption); 23653 newMenuOptionsState = { 23654 selectValue, 23655 focusedOption, 23656 focusedOptionId, 23657 focusableOptionsWithIds, 23658 focusedValue, 23659 clearFocusValueOnUpdate: false 23660 }; 23661 } 23662 var newInputIsHiddenState = inputIsHiddenAfterUpdate != null && props !== prevProps ? { 23663 inputIsHidden: inputIsHiddenAfterUpdate, 23664 inputIsHiddenAfterUpdate: void 0 23665 } : {}; 23666 var newAriaSelection = ariaSelection; 23667 var hasKeptFocus = isFocused && prevWasFocused; 23668 if (isFocused && !hasKeptFocus) { 23669 newAriaSelection = { 23670 value: valueTernary(isMulti, selectValue, selectValue[0] || null), 23671 options: selectValue, 23672 action: "initial-input-focus" 23673 }; 23674 hasKeptFocus = !prevWasFocused; 23675 } 23676 if ((ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus") { 23677 newAriaSelection = null; 23678 } 23679 return _objectSpread2(_objectSpread2(_objectSpread2({}, newMenuOptionsState), newInputIsHiddenState), {}, { 23680 prevProps: props, 23681 ariaSelection: newAriaSelection, 23682 prevWasFocused: hasKeptFocus 23683 }); 23684 } 23685 }]); 23686 return Select2; 23687}(reactExports.Component); 23688Select$1.defaultProps = defaultProps; 23689 23690var StateManagedSelect = /*#__PURE__*/reactExports.forwardRef(function (props, ref) { 23691 var baseSelectProps = useStateManager(props); 23692 return /*#__PURE__*/reactExports.createElement(Select$1, _extends({ 23693 ref: ref 23694 }, baseSelectProps)); 23695}); 23696var StateManagedSelect$1 = StateManagedSelect; 23697
23698// src/index.ts 23699var EMPTY_VALUE = Symbol("useLazyRef empty value"); 23700var useLazyRef = (init) => { 23701 const resultRef = reactExports.useRef(EMPTY_VALUE); 23702 if (resultRef.current === EMPTY_VALUE) { 23703 resultRef.current = init(); 23704 } 23705 return resultRef; 23706}; 23707 23708function useIsMountedRef() { 23709 var isMountedRef = reactExports.useRef(false); 23710 reactExports.useEffect(function () { 23711 isMountedRef.current = true; 23712 return function () { 23713 isMountedRef.current = false; 23714 }; 23715 }, []); 23716 return isMountedRef; 23717} 23718 23719var useLatest = function useLatest(value) { 23720 var ref = e$2.useRef(value); 23721 index(function () { 23722 ref.current = value; 23723 }); 23724 return ref; 23725}; 23726
23727// src/option_result.ts 23728function Ok(result) { 23729 const self = { 23730 isOk: () => true, 23731 isOkAnd: (fn) => fn(result), 23732 isErr: () => false, 23733 isErrAnd: () => false, 23734 ok: () => Some(result), 23735 err: () => None(), 23736 map: (fn) => Ok(fn(result)), 23737 mapOr: (_, fn) => fn(result), 23738 mapOrElse: (_, fn) => fn(result), 23739 mapErr: () => Ok(result), 23740 expect: () => result, 23741 expectErr: (msg) => { 23742 throw new Error(msg); 23743 }, 23744 unwrap: () => result, 23745 unwrapErr: () => { 23746 throw new Error(`${result}`); 23747 }, 23748 unwrapOr: () => result, 23749 unwrapOrElse: () => result, 23750 and: (res) => res, 23751 andThen: (getRes) => getRes(result), 23752 or: () => Ok(result), 23753 orElse: () => Ok(result) 23754 }; 23755 return self; 23756} 23757function Err(err) { 23758 const self = { 23759 isOk: () => false, 23760 isOkAnd: () => false, 23761 isErr: () => true, 23762 isErrAnd: (fn) => fn(err), 23763 ok: () => None(), 23764 err: () => Some(err), 23765 map: () => Err(err), 23766 mapOr: (defaultValue) => defaultValue, 23767 mapOrElse: (getDefaultValue) => getDefaultValue(err), 23768 mapErr: (fn) => Err(fn(err)), 23769 expect: (msg) => { 23770 throw new Error(msg); 23771 }, 23772 expectErr: () => err, 23773 unwrap: () => { 23774 throw new Error(`${err}`); 23775 }, 23776 unwrapErr: () => err, 23777 unwrapOr: (defaultValue) => defaultValue, 23778 unwrapOrElse: (getDefaultValue) => getDefaultValue(err), 23779 and: () => Err(err), 23780 andThen: () => Err(err), 23781 or: (res) => res, 23782 orElse: (getRes) => getRes(err) 23783 }; 23784 return self; 23785} 23786function None() { 23787 const self = { 23788 and: () => None(), 23789 andThen: () => None(), 23790 expect: (msg) => { 23791 throw new Error(msg); 23792 }, 23793 filter: () => self, 23794 isSome: () => false, 23795 isSomeAnd: () => false, 23796 isNone: () => true, 23797 map: () => None(), 23798 mapOr: (defaultValue) => defaultValue, 23799 mapOrElse: (getDefaultValue) => getDefaultValue(), 23800 okOr: (err) => Err(err), 23801 okOrElse: (getErr) => Err(getErr()), 23802 or: (opt) => opt, 23803 orElse: (fn) => fn(), 23804 unwrap: () => { 23805 throw new Error("panic! call `unwrap` on a `None` value"); 23806 }, 23807 unwrapOr: (defaultValue) => defaultValue, 23808 unwrapOrElse: (getDefaultValue) => getDefaultValue(), 23809 xor: (opt) => { 23810 if (opt.isSome()) { 23811 return opt; 23812 } 23813 return self; 23814 } 23815 }; 23816 return self; 23817} 23818function Some(value) { 23819 const self = { 23820 and: (opt) => opt, 23821 andThen: (fn) => fn(value), 23822 expect: () => value, 23823 filter: (fn) => { 23824 if (fn(value)) { 23825 return self; 23826 } 23827 return None(); 23828 }, 23829 isSome: () => true, 23830 isSomeAnd: (fn) => fn(value), 23831 isNone: () => false, 23832 map: (fn) => Some(fn(value)), 23833 mapOr: (_, fn) => fn(value), 23834 mapOrElse: (_, fn) => fn(value), 23835 okOr: () => Ok(value), 23836 okOrElse: () => Ok(value), 23837 or: () => self, 23838 orElse: () => self, 23839 unwrap: () => value, 23840 unwrapOr: () => value, 23841 unwrapOrElse: () => value, 23842 xor: (opt) => { 23843 if (opt.isNone()) { 23844 return self; 23845 } 23846 return None(); 23847 } 23848 }; 23849 return self; 23850} 23851
23852// src/get_result.ts 23853function getResult(promise) { 23854 return promise.then( 23855 (response) => Ok(response), 23856 (err) => Err(err) 23857 ); 23858} 23859 23860var e=setTimeout;function t(t,n){var u=n.useCachedSetTimeout?e:setTimeout;return new Promise((function(e){u(e,t);}))}function n(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=n.useCachedSetTimeout,r=t(e,{useCachedSetTimeout:u});function o(e){return r.then((function(){return e}))}return o.then=function(){return r.then.apply(r,arguments)},o.catch=Promise.resolve().catch,o} 23861 23862var composeRefs$1 = {}; 23863 23864Object.defineProperty(composeRefs$1, "__esModule", { value: true }); 23865function composeRefs() { 23866 var refs = []; 23867 for (var _i = 0; _i < arguments.length; _i++) { 23868 refs[_i] = arguments[_i]; 23869 } 23870 if (refs.length === 2) { // micro-optimize the hot path 23871 return composeTwoRefs(refs[0], refs[1]) || null; 23872 } 23873 var composedRef = refs.slice(1).reduce(function (semiCombinedRef, refToInclude) { return composeTwoRefs(semiCombinedRef, refToInclude); }, refs[0]); 23874 return composedRef || null; 23875} 23876var _default = composeRefs$1.default = composeRefs; 23877var composedRefCache = new WeakMap(); 23878function composeTwoRefs(ref1, ref2) { 23879 if (ref1 && ref2) { 23880 var ref1Cache = composedRefCache.get(ref1) || new WeakMap(); 23881 composedRefCache.set(ref1, ref1Cache); 23882 var composedRef = ref1Cache.get(ref2) || (function (instance) { 23883 updateRef(ref1, instance); 23884 updateRef(ref2, instance); 23885 }); 23886 ref1Cache.set(ref2, composedRef); 23887 return composedRef; 23888 } 23889 if (!ref1) { 23890 return ref2; 23891 } 23892 else { 23893 return ref1; 23894 } 23895} 23896function updateRef(ref, instance) { 23897 if (typeof ref === 'function') { 23898 ref(instance); 23899 } 23900 else { 23901 ref.current = instance; 23902 } 23903}
vendor: 28 bytes, lines 23903-23907
23903 23904 23905// src/index.ts 23906 23907// src/de
23907faultReduceOptions.ts 23908var defaultReduceOptions = (prevOptions, loadedOptions) => [...prevOptions, ...loadedOptions]; 23909
23910// src/defaultShouldLoadMore.ts 23911var AVAILABLE_DELTA = 10; 23912var defaultShouldLoadMore = (scrollHeight, clientHeight, scrollTop) => { 23913 const bottomBorder = scrollHeight - clientHeight - AVAILABLE_DELTA; 23914 return bottomBorder < scrollTop; 23915}; 23916
23917// src/getInitialCache.ts 23918var getInitialCache = (params) => ({ 23919 isFirstLoad: true, 23920 options: [], 23921 hasMore: true, 23922 isLoading: false, 23923 lockedUntil: 0, 23924 additional: params.additional 23925}); 23926
23927// src/getInitialOptionsCache.ts 23928var getInitialOptionsCache = ({ 23929 options, 23930 defaultOptions, 23931 additional, 23932 defaultAdditional 23933}) => { 23934 const initialOptions = defaultOptions === true ? null : Array.isArray(defaultOptions) ? defaultOptions : options; 23935 if (initialOptions) { 23936 return { 23937 "": { 23938 isFirstLoad: false, 23939 isLoading: false, 23940 options: initialOptions, 23941 hasMore: true, 23942 lockedUntil: 0, 23943 additional: defaultAdditional || additional 23944 } 23945 }; 23946 } 23947 return {}; 23948}; 23949
23950// src/validateResponse.ts 23951var errorText = '[react-select-async-paginate] response of "loadOptions" should be an object with "options" prop, which contains array of options.'; 23952var checkIsResponse = (response) => { 23953 if (!response) { 23954 return false; 23955 } 23956 const { options, hasMore } = response; 23957 if (!Array.isArray(options)) { 23958 return false; 23959 } 23960 if (typeof hasMore !== "boolean" && typeof hasMore !== "undefined") { 23961 return false; 23962 } 23963 return true; 23964}; 23965var validateResponse = (response) => { 23966 if (!checkIsResponse(response)) { 23967 console.error(errorText, "Received:", response); 23968 throw new Error(errorText); 23969 } 23970 return true; 23971}; 23972
23973// src/requestOptions.ts 23974var requestOptions = async (caller, paramsRef, optionsCacheRef, debounceTimeout, setOptionsCache, reduceOptions, isMountedRef) => { 23975 const currentInputValue = paramsRef.current.inputValue; 23976 const isCacheEmpty = !optionsCacheRef.current[currentInputValue]; 23977 const currentOptions = isCacheEmpty ? getInitialCache(paramsRef.current) : optionsCacheRef.current[currentInputValue]; 23978 if (currentOptions.isLoading || !currentOptions.hasMore || currentOptions.lockedUntil > Date.now()) { 23979 return; 23980 } 23981 setOptionsCache( 23982 (prevOptionsCache) => ({ 23983 ...prevOptionsCache, 23984 [currentInputValue]: { 23985 ...currentOptions, 23986 isLoading: true 23987 } 23988 }) 23989 ); 23990 if (debounceTimeout > 0 && caller === "input-change") { 23991 await n(debounceTimeout); 23992 const newInputValue = paramsRef.current.inputValue; 23993 if (currentInputValue !== newInputValue) { 23994 setOptionsCache((prevOptionsCache) => { 23995 if (isCacheEmpty) { 23996 const { [currentInputValue]: itemForDelete, ...restCache } = prevOptionsCache; 23997 return restCache; 23998 } 23999 return { 24000 ...prevOptionsCache, 24001 [currentInputValue]: { 24002 ...currentOptions, 24003 isLoading: false 24004 } 24005 }; 24006 }); 24007 return; 24008 } 24009 } 24010 const { loadOptions, reloadOnErrorTimeout = 0 } = paramsRef.current; 24011 const result = await getResult( 24012 Promise.resolve().then( 24013 () => loadOptions( 24014 currentInputValue, 24015 currentOptions.options, 24016 currentOptions.additional 24017 ) 24018 ) 24019 ); 24020 if (!isMountedRef.current) { 24021 return; 24022 } 24023 if (result.isErr()) { 24024 setOptionsCache((prevOptionsCache) => ({ 24025 ...prevOptionsCache, 24026 [currentInputValue]: { 24027 ...currentOptions, 24028 isLoading: false, 24029 lockedUntil: Date.now() + reloadOnErrorTimeout 24030 } 24031 })); 24032 return; 24033 } 24034 const response = result.unwrap(); 24035 if (validateResponse(response)) { 24036 const { options, hasMore } = response; 24037 const newAdditional = Object.hasOwn(response, "additional") ? response.additional : currentOptions.additional; 24038 setOptionsCache((prevOptionsCache) => ({ 24039 ...prevOptionsCache, 24040 [currentInputValue]: { 24041 ...currentOptions, 24042 options: reduceOptions(currentOptions.options, options, newAdditional), 24043 hasMore: !!hasMore, 24044 isLoading: false, 24045 isFirstLoad: false, 24046 additional: newAdditional 24047 } 24048 })); 24049 } 24050}; 24051
24052// src/useAsyncPaginateBase.ts 24053var increaseStateId = (prevStateId) => prevStateId + 1; 24054var useAsyncPaginateBase = (params, deps = []) => { 24055 const { 24056 defaultOptions, 24057 loadOptionsOnMenuOpen = true, 24058 debounceTimeout = 0, 24059 inputValue, 24060 menuIsOpen, 24061 filterOption = null, 24062 reduceOptions = defaultReduceOptions, 24063 shouldLoadMore = defaultShouldLoadMore, 24064 mapOptionsForMenu = void 0 24065 } = params; 24066 const menuIsOpenRef = useLatest(menuIsOpen); 24067 const isMountedRef = useIsMountedRef(); 24068 const reduceOptionsRef = useLatest(reduceOptions); 24069 const loadOptionsOnMenuOpenRef = useLatest(loadOptionsOnMenuOpen); 24070 const isInitRef = reactExports.useRef(true); 24071 const paramsRef = reactExports.useRef(params); 24072 paramsRef.current = params; 24073 const [_stateId, setStateId] = reactExports.useState(0); 24074 const optionsCacheRef = useLazyRef(() => getInitialOptionsCache(params)); 24075 const callRequestOptionsRef = useLatest( 24076 (caller) => { 24077 requestOptions( 24078 caller, 24079 paramsRef, 24080 optionsCacheRef, 24081 debounceTimeout, 24082 (reduceState) => { 24083 optionsCacheRef.current = reduceState(optionsCacheRef.current); 24084 if (isMountedRef.current) { 24085 setStateId(increaseStateId); 24086 } 24087 }, 24088 reduceOptionsRef.current, 24089 isMountedRef 24090 ); 24091 } 24092 ); 24093 const handleScrolledToBottom = reactExports.useCallback(() => { 24094 const currentInputValue = paramsRef.current.inputValue; 24095 const currentOptions2 = optionsCacheRef.current[currentInputValue]; 24096 if (currentOptions2) { 24097 callRequestOptionsRef.current("menu-scroll"); 24098 } 24099 }, [callRequestOptionsRef, optionsCacheRef]); 24100 reactExports.useEffect(() => { 24101 if (isInitRef.current) { 24102 isInitRef.current = false; 24103 } else { 24104 optionsCacheRef.current = {}; 24105 setStateId(increaseStateId); 24106 } 24107 if (defaultOptions === true) { 24108 callRequestOptionsRef.current("autoload"); 24109 } 24110 }, deps); 24111 reactExports.useEffect(() => { 24112 if (menuIsOpenRef.current && !optionsCacheRef.current[inputValue]) { 24113 callRequestOptionsRef.current("input-change"); 24114 } 24115 }, [callRequestOptionsRef, inputValue, menuIsOpenRef, optionsCacheRef]); 24116 reactExports.useEffect(() => { 24117 if (menuIsOpen && !optionsCacheRef.current[""] && loadOptionsOnMenuOpenRef.current) { 24118 callRequestOptionsRef.current("menu-toggle"); 24119 } 24120 }, [ 24121 callRequestOptionsRef, 24122 loadOptionsOnMenuOpenRef, 24123 menuIsOpen, 24124 optionsCacheRef 24125 ]); 24126 const currentOptions = optionsCacheRef.current[inputValue] || getInitialCache(params); 24127 const options = reactExports.useMemo(() => { 24128 if (!mapOptionsForMenu) { 24129 return currentOptions.options; 24130 } 24131 return mapOptionsForMenu(currentOptions.options); 24132 }, [currentOptions.options, mapOptionsForMenu]); 24133 return { 24134 handleScrolledToBottom, 24135 shouldLoadMore, 24136 filterOption, 24137 isLoading: currentOptions.isLoading || currentOptions.lockedUntil > Date.now(), 24138 isFirstLoad: currentOptions.isFirstLoad, 24139 options 24140 }; 24141}; 24142
24143// src/useAsyncPaginate.ts 24144var useAsyncPaginate = (params, deps = []) => { 24145 const { 24146 inputValue: inputValueParam, 24147 menuIsOpen: menuIsOpenParam, 24148 defaultInputValue: defaultInputValueParam, 24149 defaultMenuIsOpen: defaultMenuIsOpenParam, 24150 onInputChange: onInputChangeParam, 24151 onMenuClose: onMenuCloseParam, 24152 onMenuOpen: onMenuOpenParam 24153 } = params; 24154 const [inputValueState, setInputValue] = reactExports.useState( 24155 defaultInputValueParam || "" 24156 ); 24157 const [menuIsOpenState, setMenuIsOpen] = reactExports.useState(!!defaultMenuIsOpenParam); 24158 const inputValue = typeof inputValueParam === "string" ? inputValueParam : inputValueState; 24159 const menuIsOpen = typeof menuIsOpenParam === "boolean" ? menuIsOpenParam : menuIsOpenState; 24160 const onInputChange = reactExports.useCallback( 24161 (nextInputValue, actionMeta) => { 24162 if (onInputChangeParam) { 24163 onInputChangeParam(nextInputValue, actionMeta); 24164 } 24165 setInputValue(nextInputValue); 24166 }, 24167 [onInputChangeParam] 24168 ); 24169 const onMenuClose = reactExports.useCallback(() => { 24170 if (onMenuCloseParam) { 24171 onMenuCloseParam(); 24172 } 24173 setMenuIsOpen(false); 24174 }, [onMenuCloseParam]); 24175 const onMenuOpen = reactExports.useCallback(() => { 24176 if (onMenuOpenParam) { 24177 onMenuOpenParam(); 24178 } 24179 setMenuIsOpen(true); 24180 }, [onMenuOpenParam]); 24181 const baseResult = useAsyncPaginateBase( 24182 { 24183 ...params, 24184 inputValue, 24185 menuIsOpen 24186 }, 24187 deps 24188 ); 24189 return { 24190 ...baseResult, 24191 inputValue, 24192 menuIsOpen, 24193 onInputChange, 24194 onMenuClose, 24195 onMenuOpen 24196 }; 24197}; 24198var CHECK_TIMEOUT = 300; 24199function wrapMenuList(MenuList2) { 24200 function WrappedMenuList(props) { 24201 const { selectProps, innerRef } = props; 24202 const { handleScrolledToBottom, shouldLoadMore } = selectProps; 24203 const checkTimeoutRef = reactExports.useRef(null); 24204 const menuListRef = reactExports.useRef(null); 24205 const shouldHandle = reactExports.useCallback(() => { 24206 const el = menuListRef.current; 24207 if (!el) { 24208 return false; 24209 } 24210 const { scrollTop, scrollHeight, clientHeight } = el; 24211 return shouldLoadMore(scrollHeight, clientHeight, scrollTop); 24212 }, [shouldLoadMore]); 24213 const checkAndHandle = reactExports.useCallback(() => { 24214 if (shouldHandle()) { 24215 if (handleScrolledToBottom) { 24216 handleScrolledToBottom(); 24217 } 24218 } 24219 }, [shouldHandle, handleScrolledToBottom]); 24220 const setCheckAndHandleTimeout = reactExports.useMemo(() => { 24221 const res = () => { 24222 checkAndHandle(); 24223 checkTimeoutRef.current = setTimeout(res, CHECK_TIMEOUT); 24224 }; 24225 return res; 24226 }, [checkAndHandle]); 24227 reactExports.useEffect(() => { 24228 setCheckAndHandleTimeout(); 24229 return () => { 24230 if (checkTimeoutRef.current) { 24231 clearTimeout(checkTimeoutRef.current); 24232 } 24233 }; 24234 }, []); 24235 return /* @__PURE__ */ jsxRuntimeExports.jsx( 24236 MenuList2, 24237 { 24238 ...props, 24239 innerRef: _default(innerRef, menuListRef) 24240 } 24241 ); 24242 } 24243 return WrappedMenuList; 24244} 24245
24246// src/useComponents.ts 24247var MenuList = wrapMenuList( 24248 // biome-ignore lint/suspicious/noExplicitAny: fix types 24249 components.MenuList 24250); 24251var useComponents = (components) => reactExports.useMemo( 24252 () => ({ 24253 MenuList, 24254 ...components 24255 }), 24256 [components] 24257); 24258var defaultCacheUniqs = []; 24259var defaultComponents2 = {}; 24260function withAsyncPaginate(SelectComponent) { 24261 function WithAsyncPaginate(props) { 24262 const { 24263 components = defaultComponents2, 24264 selectRef = void 0, 24265 isLoading: isLoadingProp, 24266 cacheUniqs = defaultCacheUniqs, 24267 ...rest 24268 } = props; 24269 const asyncPaginateProps = useAsyncPaginate(rest, cacheUniqs); 24270 const processedComponents = useComponents( 24271 components 24272 ); 24273 const isLoading = typeof isLoadingProp === "boolean" ? isLoadingProp : asyncPaginateProps.isLoading; 24274 return /* @__PURE__ */ jsxRuntimeExports.jsx( 24275 SelectComponent, 24276 { 24277 ...props, 24278 ...asyncPaginateProps, 24279 isLoading, 24280 components: processedComponents, 24281 ref: selectRef 24282 } 24283 ); 24284 } 24285 return WithAsyncPaginate; 24286} 24287
24288// src/index.ts 24289var AsyncPaginate = withAsyncPaginate(StateManagedSelect$1); 24290 24291const MultiValueContainer = ({ selectProps, data }) => { 24292 const values = selectProps.value; 24293 if (values && Array.isArray(values) && values.length > 0) { 24294 const isLast = values[values.length - 1].label === data.label; 24295 const isFirst = values[0].label === data.label; 24296 const isSeveral = values.length > 1; 24297 return isFirst ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 24298 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--global-bold] text-m leading-none text-lavender shrink-0 mr-2" }), 24299 data.label, 24300 isSeveral ? "," : "", 24301 " " 24302 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 24303 isLast ? data.label : data.label + ",", 24304 " " 24305 ] }); 24306 } else return ""; 24307}; 24308const Option = (props) => { 24309 const option = props.data; 24310 return /* @__PURE__ */ jsxRuntimeExports.jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-[10px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "leading-[20px]", children: option.name }) }) }); 24311}; 24312const SingleValueComponent = ({ children, ...props }) => { 24313 return /* @__PURE__ */ jsxRuntimeExports.jsx(components.SingleValue, { ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-[10px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children }) }) }); 24314}; 24315const DropdownIndicator = (props) => { 24316 return /* @__PURE__ */ jsxRuntimeExports.jsx(components.DropdownIndicator, { ...props, styles: { padding: 0 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24317 "span", 24318 { 24319 className: clsx( 24320 "icon-[solar--alt-arrow-down-bold] text-[18px] text-lavender shrink-0", 24321 props.selectProps.menuIsOpen ? "rotate-180" : "" 24322 ) 24323 } 24324 ) }); 24325}; 24326const colourStyles = { 24327 option: (styles, { isFocused, isSelected }) => { 24328 return { 24329 ...styles, 24330 "color": "#F3F3F3", 24331 "backgroundColor": isSelected ? "#1E1F2D" : isFocused ? "#1E1F2D" : void 0, 24332 ":active": { 24333 ...styles[":active"], 24334 backgroundColor: "#1E1F2D" 24335 }, 24336 "cursor": "pointer", 24337 "padding": "12px 8px", 24338 "borderRadius": "3px" 24339 }; 24340 }, 24341 control: () => ({}), 24342 multiValueLabel: () => ({}), 24343 valueContainer: (base) => ({ 24344 ...base, 24345 padding: 0, 24346 columnGap: "4px" 24347 }), 24348 input: (base) => ({ 24349 ...base, 24350 margin: "0" 24351 }), 24352 placeholder: (base) => ({ 24353 ...base, 24354 color: "#989A9D", 24355 margin: "0" 24356 }), 24357 indicatorsContainer: (base) => ({ 24358 ...base, 24359 padding: 0 24360 }), 24361 dropdownIndicator: (base) => ({ 24362 ...base, 24363 padding: 0 24364 }) 24365}; 24366const selectClasses = { 24367 control: () => "flex group cursor-pointer gap-2 items-center w-full md:max-w-xs p-4 rounded-[40px] border border-transparent bg-deep hover:border-lavender", 24368 menu: () => "!rounded-[16px] !m-0 !mt-2 !bg-deep p-2 md:max-w-xs ", 24369 singleValue: () => "!text-grey", 24370 multiValue: () => "!truncate", 24371 multiValueLabel: () => "!truncate", 24372 valueContainer: () => "!flex-nowrap truncate", 24373 input: () => "!text-grey" 24374}; 24375const Select = ({ 24376 apiUrl, 24377 isMulti, 24378 name, 24379 value, 24380 onChange, 24381 excludedLanguages 24382}) => { 24383 const selectRef = reactExports.useRef(null); 24384 const [menuPlacement, setMenuPlacement] = reactExports.useState("auto"); 24385 const [dropdownHeight, setDropdownHeight] = reactExports.useState(null); 24386 reactExports.useEffect(() => { 24387 if (!dropdownHeight) { 24388 return; 24389 } 24390 const calculateMenuPlacement = () => { 24391 const selectElement = selectRef.current; 24392 if (!selectElement) { 24393 return "bottom"; 24394 } 24395 const viewportHeight = window.innerHeight; 24396 const boundingRect = selectElement.getBoundingClientRect(); 24397 const inputBottom = boundingRect.bottom; 24398 const spaceBelow = viewportHeight - inputBottom; 24399 if (dropdownHeight + 20 >= spaceBelow) { 24400 return "top"; 24401 } 24402 return "bottom"; 24403 }; 24404 calculateMenuPlacement(); 24405 setMenuPlacement(calculateMenuPlacement()); 24406 }, [dropdownHeight]); 24407 const CustomMenu = (menuProps) => { 24408 const menuRef = reactExports.useRef(null); 24409 reactExports.useLayoutEffect(() => { 24410 if (menuRef.current) { 24411 setDropdownHeight(menuRef.current.offsetHeight); 24412 } 24413 }, [menuProps]); 24414 return /* @__PURE__ */ jsxRuntimeExports.jsx(components.Menu, { ...menuProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: menuRef, children: menuProps.children }) }); 24415 }; 24416 const callApi = async (searchQuery = "", prevOptions, { page }) => { 24417 const { data } = await axios.get( 24418 `${apiUrl}?search=${searchQuery}&limit=50&offset=${page * 50}${excludedLanguages.length ? "&exclude_codes=" + excludedLanguages.join(",") : ""}` 24419 ); 24420 return { 24421 options: data.results?.length ? data.results.map((el) => ({ ...el, label: el.name, value: el.code, id: el.id || el.code })) : [], 24422 hasMore: !!data.next, 24423 additional: { 24424 page: page + 1 24425 } 24426 }; 24427 }; 24428 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: selectRef, className: "w-full md:max-w-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24429 AsyncPaginate, 24430 { 24431 isClearable: true, 24432 loadOptions: callApi, 24433 additional: { 24434 page: 0 24435 }, 24436 isMulti, 24437 placeholder: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[10px]", children: [
24438 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--global-bold] text-m leading-none text-lavender shrink-0" }), 24439 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle grow", children: "Select language" }) 24440 ] }), 24441 name, 24442 cacheUniqs: [apiUrl + excludedLanguages.join("")], 24443 value, 24444 onChange, 24445 menuPlacement, 24446 maxMenuHeight: 250, 24447 components: { 24448 IndicatorSeparator: () => null, 24449 MultiValueRemove: () => null, 24450 ClearIndicator: () => null, 24451 Option, 24452 MultiValueContainer, 24453 SingleValue: SingleValueComponent, 24454 DropdownIndicator, 24455 Menu: CustomMenu 24456 }, 24457 classNames: selectClasses, 24458 hideSelectedOptions: false, 24459 styles: colourStyles, 24460 className: "react-select-container", 24461 classNamePrefix: "react-select" 24462 } 24463 ) }); 24464}; 24465 24466const Toggle = ({ isEnabled = false, onChange }) => { 24467 const [enabled, setEnabled] = reactExports.useState(isEnabled); 24468 const handleClick = () => { 24469 setEnabled(!enabled); 24470 onChange?.(!enabled); 24471 }; 24472 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 24473 "button", 24474 { 24475 type: "button", 24476 className: cn( 24477 enabled ? "bg-gradient-to-r from-redLight to-sapphireLight" : "bg-gentle", 24478 "relative inline-flex p-[2px] h-[31px] w-[62px] flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out" 24479 ), 24480 role: "switch", 24481 "aria-checked": "false", 24482 onClick: handleClick, 24483 children: [
24484 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Use setting" }), 24485 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: cn( 24486 enabled ? "inline" : "hidden", 24487 "text-xxs font-semibold text-white absolute left-[6px] top-1/2 -translate-y-1/2" 24488 ), children: "Yes" }), 24489 /* @__PURE__ */ jsxRuntimeExports.jsx( 24490 "span", 24491 { 24492 "aria-hidden": "true", 24493 className: cn( 24494 enabled ? "translate-x-8" : "translate-x-0", 24495 "pointer-events-none inline-block h-[27px] w-[27px] transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out" 24496 ) 24497 } 24498 ), 24499 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: cn( 24500 enabled ? "hidden" : "inline", 24501 "text-xxs font-semibold text-greyGentle absolute right-[7px] top-1/2 -translate-y-1/2" 24502 ), children: "No" }) 24503 ] 24504 } 24505 ); 24506}; 24507 24508const MultilanguageStep = ({ onSubmit }) => { 24509 const [mainLanguage, setMainLanguage] = reactExports.useState(null); 24510 const [additionalLanguages, setAdditionalLanguages] = reactExports.useState([]); 24511 const [supportMulti, setSupportMulti] = reactExports.useState(false); 24512 reactExports.useEffect(() => { 24513 const loadLanguagesAndSetDefault = async () => { 24514 try { 24515 const { data } = await axios.get(API_URLS.LANGUAGE); 24516 const englishLanguage = data.results.find((lang) => lang.code === "en"); 24517 if (englishLanguage) { 24518 setMainLanguage({ 24519 ...englishLanguage, 24520 label: englishLanguage.name, 24521 value: englishLanguage.code, 24522 id: englishLanguage.code 24523 }); 24524 } 24525 } catch (error) { 24526 console.error("Failed to load languages:", error); 24527 } 24528 }; 24529 loadLanguagesAndSetDefault(); 24530 }, []); 24531 const handleChangeMultiLanguage = (values) => { 24532 if (values?.length > 5) return; 24533 setAdditionalLanguages(values); 24534 }; 24535 const handleChangeMainLanguage = (value) => { 24536 setMainLanguage(value); 24537 }; 24538 const handleSubmit = () => { 24539 if (!mainLanguage?.code) return; 24540 onSubmit({ 24541 primary_language: mainLanguage.code, 24542 additional_languages: additionalLanguages.map((el) => el.code) 24543 }); 24544 }; 24545 return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 24546 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-4 md:flex-row md:justify-between md:items-center", children: [
24547 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s md:text-m font-medium", children: "Select main language for your product:" }), 24548 /* @__PURE__ */ jsxRuntimeExports.jsx( 24549 Select, 24550 { 24551 apiUrl: API_URLS.LANGUAGE, 24552 value: mainLanguage, 24553 onChange: handleChangeMainLanguage, 24554 excludedLanguages: additionalLanguages?.map((el) => el.code) 24555 } 24556 ) 24557 ] }) }), 24558 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: [ 24559 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: [ 24560 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "md:space-x-2 grow", children: [ 24561 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: "Do you need multilingual support?" }), 24562 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-block text-s text-greyGentle", children: "(5 languages max)" }) 24563 ] }),
24564 /* @__PURE__ */ jsxRuntimeExports.jsx(Toggle, { onChange: setSupportMulti, isEnabled: supportMulti }) 24565 ] }), 24566 supportMulti && /* @__PURE__ */ jsxRuntimeExports.jsx( 24567 Select, 24568 { 24569 apiUrl: API_URLS.LANGUAGE, 24570 onChange: handleChangeMultiLanguage, 24571 isMulti: true, 24572 value: additionalLanguages, 24573 excludedLanguages: mainLanguage?.code ? [mainLanguage?.code] : [] 24574 } 24575 ) 24576 ] }), 24577 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main w-full", onClick: handleSubmit, disabled: !mainLanguage, children: [ 24578 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 24579 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 24580 ] }) }) }) 24581 ] }); 24582}; 24583 24584const YesNoStep = ({ step, onSubmit }) => { 24585 const [value, setValue] = reactExports.useState(false); 24586 const handleSubmit = () => { 24587 onSubmit({ 24588 yes_no: value 24589 }); 24590 }; 24591 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 24592 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: [
24593 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-2", children: [ 24594 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: step.question }), 24595 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-block text-s text-greyGentle", children: step.question_description }) 24596 ] }), 24597 /* @__PURE__ */ jsxRuntimeExports.jsx(Toggle, { onChange: setValue, isEnabled: value }) 24598 ] }) }), 24599 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main w-full", onClick: handleSubmit, children: [ 24600 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 24601 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 24602 ] }) }) }) 24603 ] }); 24604}; 24605 24606const inputWrapper$1 = "_inputWrapper_myef3_1"; 24607const input$1 = "_input_myef3_1"; 24608const styles$2 = { 24609 inputWrapper: inputWrapper$1, 24610 input: input$1 24611}; 24612 24613const BudgetTimeEstimateStep = ({ onSubmit }) => { 24614 const [needBuget, setNeedBudget] = reactExports.useState(false); 24615 const [budgetLimit, setBudgetLimit] = reactExports.useState(""); 24616 const [needTime, setNeedTime] = reactExports.useState(false); 24617 const [timeLimit, setTimeLimit] = reactExports.useState(""); 24618 const handleSubmit = () => { 24619 onSubmit({ 24620 budget_limit: needBuget ? budgetLimit : null, 24621 time_limit: needTime ? timeLimit : null 24622 }); 24623 }; 24624 const handleInputChange = (e) => { 24625 const { name, value } = e.target; 24626 if (value.length > 50) return; 24627 if (name === "budget") { 24628 setBudgetLimit(e.target.value); 24629 } else { 24630 setTimeLimit(e.target.value); 24631 } 24632 }; 24633 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 24634 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: [
24635 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: [ 24636 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-2", children: [ 24637 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: "Do you have some budget limits?" }), 24638 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "Toggle on to specify your budget and help us align with your financial expectations." }) 24639 ] }), 24640 /* @__PURE__ */ jsxRuntimeExports.jsx(Toggle, { onChange: setNeedBudget, isEnabled: needBuget }) 24641 ] }), 24642 needBuget && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$2.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24643 "input", 24644 { 24645 className: styles$2.input, 24646 type: "text", 24647 id: "budget", 24648 name: "budget", 24649 value: budgetLimit, 24650 onChange: handleInputChange, 24651 placeholder: "Enter your budget amount (Euro)" 24652 } 24653 ) }) 24654 ] }), 24655 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: [
24656 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: [ 24657 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-2", children: [ 24658 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: "Do you have a time limit for development?" }), 24659 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "Toggle on to specify your timeline and ensure we meet your deadlines." }) 24660 ] }), 24661 /* @__PURE__ */ jsxRuntimeExports.jsx(Toggle, { onChange: setNeedTime, isEnabled: needTime }) 24662 ] }), 24663 needTime && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$2.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24664 "input", 24665 { 24666 className: styles$2.input, 24667 type: "text", 24668 id: "time", 24669 name: "time", 24670 value: timeLimit, 24671 onChange: handleInputChange, 24672 placeholder: "Enter your time limit (Month)" 24673 } 24674 ) }) 24675 ] }), 24676 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs( 24677 "button", 24678 { 24679 className: "btn-main w-full", 24680 onClick: handleSubmit, 24681 disabled: needBuget && !budgetLimit || needTime && !timeLimit, 24682 children: [
24683 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 24684 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 24685 ] 24686 } 24687 ) }) }) 24688 ] }); 24689}; 24690 24691const inputWrapper = "_inputWrapper_myef3_1"; 24692const input = "_input_myef3_1"; 24693const styles$1 = { 24694 inputWrapper: inputWrapper, 24695 input: input 24696}; 24697 24698const TargetAudienceStep = ({ onSubmit }) => { 24699 const [viewMode, setViewMode] = reactExports.useState("textarea"); 24700 const [textValue, setTextValue] = reactExports.useState(""); 24701 const [isFocused, setIsFocused] = reactExports.useState(false); 24702 const [audiences, setAudiences] = reactExports.useState([]); 24703 const [selected, setSelected] = reactExports.useState(/* @__PURE__ */ new Set()); 24704 const [customValue, setCustomValue] = reactExports.useState(""); 24705 const [showCustomInput, setShowCustomInput] = reactExports.useState(false); 24706 const handleGenerateAudiences = async () => { 24707 setViewMode("loading"); 24708 try { 24709 const sessionId = localStorage.getItem(SESSION_ID_NAME) ?? void 0; 24710 const { data } = await axios.post(API_URLS.GENERATE_TARGET_AUDIENCE, { 24711 session_id: sessionId 24712 }); 24713 const suggestions = data.suggested_target_audiences ?? []; 24714 if (suggestions.length === 0) { 24715 setViewMode("textarea"); 24716 return; 24717 } 24718 setAudiences(suggestions); 24719 setSelected(new Set(suggestions.map((_, i) => i))); 24720 setViewMode("checkboxes"); 24721 } catch { 24722 setViewMode("textarea"); 24723 } 24724 }; 24725 const handleToggle = (index) => { 24726 setSelected((prev) => { 24727 const next = new Set(prev); 24728 if (next.has(index)) { 24729 next.delete(index); 24730 } else { 24731 next.add(index); 24732 } 24733 return next; 24734 }); 24735 }; 24736 const handleAddCustom = () => { 24737 const trimmed = customValue.trim(); 24738 if (!trimmed) return; 24739 const newIndex = audiences.length; 24740 setAudiences((prev) => [...prev, trimmed]); 24741 setSelected((prev) => new Set(prev).add(newIndex)); 24742 setCustomValue(""); 24743 setShowCustomInput(false); 24744 }; 24745 const handleCustomInputChange = (e) => { 24746 if (e.target.value.length > 255) return; 24747 setCustomValue(e.target.value); 24748 }; 24749 const handleCustomKeyDown = (e) => { 24750 if (e.key === "Enter") { 24751 e.preventDefault(); 24752 handleAddCustom(); 24753 } 24754 }; 24755 const handleBackToTextarea = () => { 24756 const selectedText = audiences.filter((_, i) => selected.has(i)).join("\n"); 24757 setTextValue(selectedText); 24758 setViewMode("textarea"); 24759 setIsFocused(true); 24760 }; 24761 const handleSubmit = () => { 24762 if (viewMode === "checkboxes") { 24763 const selectedAudiences = audiences.filter((_, i) => selected.has(i)); 24764 onSubmit({ text: selectedAudiences.join("\n") }); 24765 } else { 24766 onSubmit({ text: textValue }); 24767 } 24768 }; 24769 const isSubmitDisabled = viewMode === "loading" || viewMode === "textarea" && !textValue.trim() || viewMode === "checkboxes" && selected.size === 0; 24770 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 24771 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: [
24772 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-2", children: [ 24773 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: "Who is the target audience for your product?" }), 24774 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "Describe who will use your product, or use the magic wand to generate suggestions." }) 24775 ] }) }), 24776 viewMode === "textarea" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 24777 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 grow rounded-3xl bg-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24778 TextArea, 24779 { 24780 isFocused, 24781 onChange: setTextValue, 24782 onFocus: () => setIsFocused(true), 24783 onBlur: () => { 24784 if (!textValue) setIsFocused(false); 24785 }, 24786 value: textValue, 24787 maxLength: 2048, 24788 className: isFocused ? "h-[calc(220px-16px)] md:h-[calc(172px-16px)]" : "!h-9", 24789 placeholder: "Describe your target audience..." 24790 } 24791 ) }),
24792 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center", children: [ 24793 /* @__PURE__ */ jsxRuntimeExports.jsxs( 24794 "button", 24795 { 24796 type: "button", 24797 className: "btn-main-outlined gap-2", 24798 onClick: handleGenerateAudiences, 24799 children: [ 24800 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--magic-stick-3-bold] text-xl leading-none" }), 24801 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Generate" }) 24802 ] 24803 } 24804 ), 24805 /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-greyGentle", children: [ 24806 textValue.length, 24807 "/", 24808 2048 24809 ] }) 24810 ] }) 24811 ] }), 24812 viewMode === "loading" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-10 gap-4", children: [ 24813 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-10 h-10 border-4 border-lavender border-t-transparent rounded-full animate-spin" }),
24814 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "Generating audience suggestions..." }) 24815 ] }), 24816 viewMode === "checkboxes" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 24817 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: audiences.map((audience, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs( 24818 "label", 24819 { 24820 className: [ 24821 "flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors", 24822 selected.has(index) ? "border-lavender bg-muted" : "border-soft hover:border-lavender hover:bg-muted" 24823 ].join(" "), 24824 children: [ 24825 /* @__PURE__ */ jsxRuntimeExports.jsx( 24826 "input", 24827 { 24828 type: "checkbox", 24829 checked: selected.has(index), 24830 onChange: () => handleToggle(index), 24831 className: "w-4 h-4 accent-lavender shrink-0" 24832 } 24833 ),
24834 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs md:text-s text-grey", children: audience }) 24835 ] 24836 }, 24837 index 24838 )) }), 24839 showCustomInput ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 24840 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${styles$1.inputWrapper} grow`, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24841 "input", 24842 { 24843 className: styles$1.input, 24844 type: "text", 24845 value: customValue, 24846 onChange: handleCustomInputChange, 24847 onKeyDown: handleCustomKeyDown, 24848 placeholder: "Enter custom audience (max 255 chars)", 24849 maxLength: 255, 24850 autoFocus: true 24851 } 24852 ) }), 24853 /* @__PURE__ */ jsxRuntimeExports.jsx( 24854 "button", 24855 { 24856 type: "button", 24857 className: "btn-main-outlined shrink-0 !px-3", 24858 onClick: handleAddCustom, 24859 disabled: !customValue.trim(), 24860 children: "Add" 24861 } 24862 ),
24863 /* @__PURE__ */ jsxRuntimeExports.jsx( 24864 "button", 24865 { 24866 type: "button", 24867 className: "text-greyGentle hover:text-grey transition-colors shrink-0", 24868 onClick: () => { 24869 setShowCustomInput(false); 24870 setCustomValue(""); 24871 }, 24872 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--close-circle-bold] text-xl leading-none" }) 24873 } 24874 ) 24875 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs( 24876 "button", 24877 { 24878 type: "button", 24879 className: "btn-main-outlined gap-2 self-start", 24880 onClick: () => setShowCustomInput(true), 24881 children: [ 24882 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--add-circle-bold] text-xl leading-none" }), 24883 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Add Custom" }) 24884 ] 24885 } 24886 ), 24887 /* @__PURE__ */ jsxRuntimeExports.jsxs( 24888 "button", 24889 { 24890 type: "button", 24891 className: "btn-main-outlined gap-2 self-start", 24892 onClick: handleBackToTextarea, 24893 children: [
24894 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--pen-bold] text-xl leading-none" }), 24895 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Edit as Text" }) 24896 ] 24897 } 24898 ) 24899 ] }) 24900 ] }), 24901 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs( 24902 "button", 24903 { 24904 className: "btn-main w-full", 24905 onClick: handleSubmit, 24906 disabled: isSubmitDisabled, 24907 children: [ 24908 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 24909 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 24910 ] 24911 } 24912 ) }) }) 24913 ] }); 24914}; 24915 24916const YesNoWithTextStep = ({ step, onSubmit }) => { 24917 const [showText, setShowText] = reactExports.useState(false); 24918 const [text, setText] = reactExports.useState(""); 24919 const handleSubmit = () => { 24920 onSubmit({ 24921 yes_no: showText, 24922 text: showText ? text : void 0 24923 }); 24924 }; 24925 const handleInputChange = (e) => { 24926 const { value } = e.target; 24927 if (value.length > 2e3) return; 24928 setText(value); 24929 }; 24930 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 24931 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: [
24932 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: [ 24933 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-2", children: [ 24934 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: step.question_name }), 24935 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: step.question_description }) 24936 ] }), 24937 /* @__PURE__ */ jsxRuntimeExports.jsx(Toggle, { onChange: setShowText, isEnabled: showText }) 24938 ] }), 24939 showText && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$2.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24940 "input", 24941 { 24942 className: styles$2.input, 24943 type: "text", 24944 id: "text", 24945 name: "text", 24946 value: text, 24947 onChange: handleInputChange, 24948 placeholder: step.question_placeholder 24949 } 24950 ) }) 24951 ] }), 24952 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main w-full", onClick: handleSubmit, disabled: showText && !text, children: [
24953 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 24954 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 24955 ] }) }) }) 24956 ] }); 24957}; 24958 24959const TextStep = ({ step, onSubmit }) => { 24960 const [textValue, setTextValue] = reactExports.useState(""); 24961 const [isFocused, setIsFocused] = reactExports.useState(false); 24962 const handleFocus = () => { 24963 setIsFocused(true); 24964 }; 24965 const handleBlur = () => { 24966 if (!textValue) { 24967 setIsFocused(false); 24968 } 24969 }; 24970 const handleSubmit = () => { 24971 onSubmit({ 24972 text: textValue 24973 }); 24974 }; 24975 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 24976 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: [ 24977 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-2", children: [
24978 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "inline-block text-s md:text-m font-medium", children: step.question }), 24979 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: step.question_description }) 24980 ] }) }), 24981 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden flex flex-col gap-2", children: [ 24982 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 grow rounded-3xl bg-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 24983 TextArea, 24984 { 24985 isFocused, 24986 onChange: setTextValue, 24987 onFocus: handleFocus, 24988 onBlur: handleBlur, 24989 value: textValue, 24990 maxLength: 2048, 24991 className: isFocused ? "h-[calc(220px-16px)] md:h-[calc(172px-16px)]" : "!h-9", 24992 placeholder: step.question_placeholder 24993 } 24994 ) }), 24995 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end text-sm text-greyGentle", children: [ 24996 textValue.length, 24997 "/", 24998 2048 24999 ] }) 25000 ] }) 25001 ] }), 25002 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main w-full", onClick: handleSubmit, disabled: !textValue, children: [
25003 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 25004 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 25005 ] }) }) }) 25006 ] }); 25007}; 25008 25009const MultiChoiceTile = ({ choice, isSelected }) => { 25010 const optimizedIconName = choice.icon ? choice.icon.replace(/icon-|[[\]]/g, "").replace("--", ":") : ""; 25011 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 25012 "div", 25013 { 25014 className: [ 25015 "relative flex-1 flex flex-col items-center justify-center p-4 rounded-lg border cursor-pointer transition-colors", 25016 isSelected ? "border-lavender bg-muted" : "border-soft hover:border-lavender hover:bg-muted" 25017 ].join(" "), 25018 children: [ 25019 isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-2 right-2 icon-[solar--check-circle-bold] text-lavender text-base leading-none" }), 25020 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center text-center gap-2", children: [ 25021 optimizedIconName && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: optimizedIconName, className: "text-m md:text-l leading-none text-lavender" }),
25022 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs md:text-s font-medium text-grey", children: choice.name }), 25023 choice.description && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle", children: choice.description }) 25024 ] }) 25025 ] 25026 } 25027 ); 25028}; 25029const MultipleChoiceStep = ({ step, onSubmit }) => { 25030 const [selected, setSelected] = reactExports.useState(/* @__PURE__ */ new Set()); 25031 const handleSubmit = () => { 25032 onSubmit({ choices: Array.from(selected) }); 25033 }; 25034 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 25035 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-6 gap-4 rounded-2xl md:gap-6 bg-nightfall text-grey", children: [ 25036 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [ 25037 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s font-semibold md:text-m md:font-medium", children: step.question }),
25038 step.question_description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-greyGentle", children: step.question_description }) 25039 ] }), 25040 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3 md:gap-4 lg:grid-cols-4", children: step.choices.map((choice) => /* @__PURE__ */ jsxRuntimeExports.jsx( 25041 MultiChoiceTile, 25042 { 25043 choice, 25044 isSelected: selected.has(choice.slug) 25045 }, 25046 choice.slug 25047 )) }) 25048 ] }), 25049 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs( 25050 "button", 25051 { 25052 className: "btn-main w-full", 25053 onClick: handleSubmit, 25054 disabled: selected.size === 0, 25055 children: [ 25056 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }),
25057 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 25058 ] 25059 } 25060 ) }) }) 25061 ] }); 25062}; 25063 25064const NONE_OF_THE_ABOVE_SLUG = "none_of_the_above"; 25065const MAX_QTY = 5; 25066const TeamRoleTile = ({ choice, qty, onQtyChange }) => { 25067 const isSelected = qty > 0; 25068 const optimizedIconName = choice.icon ? choice.icon.replace(/icon-|[[\]]/g, "").replace("--", ":") : ""; 25069 const decrement = (e) => { 25070 e.stopPropagation(); 25071 onQtyChange(choice.slug, Math.max(0, qty - 1)); 25072 }; 25073 const increment = (e) => { 25074 e.stopPropagation(); 25075 onQtyChange(choice.slug, Math.min(MAX_QTY, qty + 1)); 25076 }; 25077 const handleTileClick = () => { 25078 if (!isSelected) { 25079 onQtyChange(choice.slug, 1); 25080 } 25081 }; 25082 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 25083 "div", 25084 { 25085 className: [ 25086 "relative flex flex-col items-center justify-between p-4 rounded-lg border transition-colors", 25087 isSelected ? "border-lavender bg-muted" : "border-soft hover:border-lavender hover:bg-muted cursor-pointer" 25088 ].join(" "), 25089 onClick: handleTileClick, 25090 children: [
25091 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center text-center gap-2 mb-3", children: [ 25092 optimizedIconName && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: optimizedIconName, className: "text-m md:text-l leading-none text-lavender" }), 25093 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs md:text-s font-medium text-grey", children: choice.name }), 25094 choice.description && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle", children: choice.description }) 25095 ] }), 25096 isSelected && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mt-auto", onClick: (e) => e.stopPropagation(), children: [ 25097 /* @__PURE__ */ jsxRuntimeExports.jsx( 25098 "button", 25099 { 25100 className: "w-7 h-7 flex items-center justify-center rounded-full border border-soft hover:border-lavender text-grey hover:text-lavender transition-colors", 25101 onClick: decrement, 25102 "aria-label": "Decrease", 25103 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--minus-circle-outline] text-base leading-none" }) 25104 } 25105 ),
25106 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-4 text-center text-s font-semibold text-lavender", children: qty }), 25107 /* @__PURE__ */ jsxRuntimeExports.jsx( 25108 "button", 25109 { 25110 className: [ 25111 "w-7 h-7 flex items-center justify-center rounded-full border transition-colors", 25112 qty >= MAX_QTY ? "border-soft text-greyGentle cursor-not-allowed" : "border-soft hover:border-lavender text-grey hover:text-lavender" 25113 ].join(" "), 25114 onClick: increment, 25115 disabled: qty >= MAX_QTY, 25116 "aria-label": "Increase", 25117 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--add-circle-outline] text-base leading-none" }) 25118 } 25119 ) 25120 ] }) 25121 ] 25122 } 25123 ); 25124}; 25125const TeamChoiceStep = ({ step, onSubmit }) => { 25126 const [qtys, setQtys] = reactExports.useState({}); 25127 const [hasTeam, setHasTeam] = reactExports.useState(false); 25128 const handleQtyChange = (slug, qty) => { 25129 setQtys((prev) => ({ ...prev, [slug]: qty })); 25130 }; 25131 const handleHasTeamChange = (value) => { 25132 setHasTeam(value); 25133 if (!value) { 25134 setQtys({}); 25135 } 25136 }; 25137 const roles = step.choices.filter((c) => c.slug !== NONE_OF_THE_ABOVE_SLUG); 25138 const teamMembers = roles.filter((c) => (qtys[c.slug] ?? 0) > 0).map((c) => ({ role: c.slug, qty: qtys[c.slug] })); 25139 const handleSubmit = () => { 25140 onSubmit({ team_members: hasTeam ? teamMembers : [] }); 25141 }; 25142 const isSubmitDisabled = hasTeam && teamMembers.length === 0; 25143 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 25144 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-6 gap-4 rounded-2xl md:gap-6 bg-nightfall text-grey", children: [
25145 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex gap-4 md:justify-between md:items-center", children: [ 25146 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col grow gap-1", children: [ 25147 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s font-semibold md:text-m md:font-medium", children: step.question }), 25148 step.question_description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-greyGentle", children: step.question_description }) 25149 ] }), 25150 /* @__PURE__ */ jsxRuntimeExports.jsx(Toggle, { onChange: handleHasTeamChange, isEnabled: hasTeam }) 25151 ] }), 25152 hasTeam && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3 md:gap-4 lg:grid-cols-4", children: roles.map((choice) => /* @__PURE__ */ jsxRuntimeExports.jsx( 25153 TeamRoleTile, 25154 { 25155 choice, 25156 qty: qtys[choice.slug] ?? 0, 25157 onQtyChange: handleQtyChange 25158 }, 25159 choice.slug 25160 )) }) 25161 ] }), 25162 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:w-fit lg:static p-4 lg:p-0 bg-denim lg:bg-transparent order-last", children: /* @__PURE__ */ jsxRuntimeExports.jsxs( 25163 "button", 25164 { 25165 className: "btn-main w-full", 25166 onClick: handleSubmit, 25167 disabled: isSubmitDisabled, 25168 children: [
25169 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Continue" }), 25170 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-right-bold] text-2xl leading-none" }) 25171 ] 25172 } 25173 ) }) }) 25174 ] }); 25175}; 25176 25177const Survey = () => { 25178 const { steps, currentStep, onSubmit, goBack, canGoBack } = useSurvey(); 25179 const renderStep = () => { 25180 const step = steps[currentStep]; 25181 if (step?.slug === "multilanguage") { 25182 return /* @__PURE__ */ jsxRuntimeExports.jsx(MultilanguageStep, { onSubmit }); 25183 } 25184 if (step?.slug === "budget-time-estimate") { 25185 return /* @__PURE__ */ jsxRuntimeExports.jsx(BudgetTimeEstimateStep, { onSubmit }); 25186 } 25187 if (step?.slug === "target-audience") { 25188 return /* @__PURE__ */ jsxRuntimeExports.jsx(TargetAudienceStep, { onSubmit }); 25189 } 25190 if (step?.slug === "existing-team") { 25191 return /* @__PURE__ */ jsxRuntimeExports.jsx(TeamChoiceStep, { step, onSubmit }); 25192 } 25193 switch (step?.answer_type) { 25194 case "SINGLE_CHOICE": 25195 return /* @__PURE__ */ jsxRuntimeExports.jsx(SingleChoice, { step, onSubmit }); 25196 case "YES_NO": 25197 return /* @__PURE__ */ jsxRuntimeExports.jsx(YesNoStep, { step, onSubmit }); 25198 case "YES_NO_WITH_TEXT": 25199 return /* @__PURE__ */ jsxRuntimeExports.jsx(YesNoWithTextStep, { step, onSubmit }); 25200 case "TEXT": 25201 return /* @__PURE__ */ jsxRuntimeExports.jsx(TextStep, { step, onSubmit }); 25202 case "MULTIPLE_CHOICE": 25203 return /* @__PURE__ */ jsxRuntimeExports.jsx(MultipleChoiceStep, { step, onSubmit }); 25204 } 25205 }; 25206 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 25207 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 25208 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto", children: [
25209 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-3 md:mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressCircle, { progress: Math.round(currentStep / steps.length * 100) + 10 }) }), 25210 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 25211 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "You're almost there!" }), 25212 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Just answer a few more questions to help us make the evaluation as accurate as possible." }) 25213 ] }), 25214 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [ 25215 canGoBack && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-start", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-main-outlined", onClick: goBack, children: [ 25216 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--round-arrow-left-bold] text-2xl leading-none" }),
25217 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Back" }) 25218 ] }) }), 25219 renderStep() 25220 ] }) 25221 ] }) 25222 ] }); 25223}; 25224 25225const estimateLogo = ""+new URL('profileEstimateIcon.svg', import.meta.url).href+""; 25226 25227const marketingLogo = ""+new URL('profileMarketingIcon.svg', import.meta.url).href+""; 25228 25229const businessLogo = ""+new URL('profileBusinessIcon.svg', import.meta.url).href+""; 25230 25231const EmptyTab = (props) => { 25232 const { activeTab } = props; 25233 const navigate = useNavigate(); 25234 const emptyTabData = reactExports.useMemo(() => { 25235 switch (activeTab) { 25236 case WorkspaceTabs.ESTIMATION: 25237 return { 25238 icon: estimateLogo, 25239 title: "Ready to see what your idea will cost?", 25240 subtitle: "Instantly calculate development costs and move forward with clarity.", 25241 btnTitle: "Start New Estimation", 25242 btnCallback: () => navigate("/estimation") 25243 }; 25244 case WorkspaceTabs.BUSINESS: 25245 return { 25246 icon: businessLogo, 25247 title: "Ready to turn your idea into a business plan?", 25248 subtitle: "Define your audience, strategy, and model â and get an investor-ready blueprint powered by AI.", 25249 btnTitle: "Start Business Planning", 25250 btnCallback: () => navigate("/business") 25251 }; 25252 case WorkspaceTabs.PATENT: 25253 return { 25254 icon: estimateLogo, 25255 title: "Your next big idea deserves protection", 25256 subtitle: "No patent drafts here yet. Secure your innovation and stay ahead â letâs begin crafting your patent concept.", 25257 btnTitle: "Start New Patent", 25258 btnCallback: () => navigate("/patent") 25259 }; 25260 case WorkspaceTabs.MARKETING: 25261 return { 25262 icon: marketingLogo, 25263 title: "Marketing Tool Coming Soon", 25264 subtitle: "Weâre working on something powerful. Soon youâll be able to generate tailored marketing strategies with just a few clicks â AI-powered, audience-focused, and ready to launch.", 25265 btnTitle: "Available soon â stay tuned", 25266 btnDisabled: true 25267 }; 25268 } 25269 }, [activeTab]); 25270 return !emptyTabData ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-nightfall rounded-2xl grid items-center justify-center gap-4 p-10", children: [ 25271 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: emptyTabData.icon, alt: "profile cq estimate logo", className: "m-auto" }), 25272 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xl text-center", children: emptyTabData?.title }), 25273 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-base text-center text-textSecondary2", children: emptyTabData?.subtitle }), 25274 /* @__PURE__ */ jsxRuntimeExports.jsx( 25275 "button", 25276 { 25277 className: "btn-main w-fit m-auto text-sm font-bold", 25278 onClick: emptyTabData?.btnCallback, 25279 disabled: emptyTabData.btnDisabled, 25280 children: emptyTabData?.btnTitle 25281 } 25282 ) 25283 ] }); 25284}; 25285 25286const WorkspaceTab = (props) => { 25287 const { name, isActive, onClick } = props; 25288 return /* @__PURE__ */ jsxRuntimeExports.jsx( 25289 "button", 25290 { 25291 onClick, 25292 className: cn( 25293 "cursor-pointer shrink-0 whitespace-nowrap inline-block py-2 px-4 rounded-[20px] text-xs hover:bg-buttonBgPrimary text-white", 25294 { "bg-buttonBgPrimary": isActive } 25295 ), 25296 children: name 25297 } 25298 ); 25299}; 25300 25301const EstimationCard = (props) => { 25302 const { itemData } = props; 25303 const [downloadLoading, setDownloadLoading] = reactExports.useState(false); 25304 const localeDate = reactExports.useMemo(() => { 25305 const date = new Date(itemData.created_stamp); 25306 const formatter = new Intl.DateTimeFormat("en", { month: "short" }); 25307 const day = date.getDate();
25308 const month = formatter.format(date); 25309 const year = date.getFullYear(); 25310 return `${month} ${day}, ${year}`; 25311 }, [itemData]); 25312 const onDownloadClick = async () => { 25313 try { 25314 setDownloadLoading(true); 25315 if (itemData.result) { 25316 downloadFileFromLink(itemData.result); 25317 } else if (props.activeTab === WorkspaceTabs.ESTIMATION) { 25318 await downloadPdf(itemData.id)(); 25319 } else if (props.activeTab === WorkspaceTabs.BUSINESS) { 25320 await downloadBusinessEstimate(itemData.id); 25321 } else if (props.activeTab === WorkspaceTabs.PATENT) { 25322 await downloadPatentEstimate(itemData.id); 25323 } 25324 ; 25325 } finally { 25326 setDownloadLoading(false); 25327 } 25328 }; 25329 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 25330 "div", 25331 { 25332 className: "group flex flex-col gap-4 p-6 before:rounded-2xl bg-nightfall rounded-2xl border-gradient before:bg-none hover:before:bg-gradient-to-r hover:before:from-redLightTransparent hover:before:to-sapphireLightTransparent hover:bg-muted", 25333 children: [
25334 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2 grow", children: [ 25335 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base font-medium text-grey", children: itemData.name }), 25336 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "clamped-text-6 text-xs text-textSecondary2", children: itemData.description }) 25337 ] }), 25338 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [ 25339 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--history-bold] text-m leading-none text-lavender" }), 25340 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-textSecondary2", children: localeDate }) 25341 ] }), 25342 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-px bg-muted" }), 25343 /* @__PURE__ */ jsxRuntimeExports.jsx( 25344 "button", 25345 { 25346 disabled: downloadLoading, 25347 onClick: onDownloadClick, 25348 className: cn( 25349 "btn-outlined w-full min-h-[33px]", 25350 { "group-hover:bg-gradient-to-r group-hover:from-redLight group-hover:to-sapphireLight group-hover:before:from-redLight group-hover:before:to-sapphireLight": !downloadLoading } 25351 ),
25352 children: downloadLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "svg-spinners:90-ring-with-bg", width: 17, height: 17 }) : "Download PDF" 25353 } 25354 ) 25355 ] 25356 } 25357 ); 25358}; 25359 25360var WorkspaceTabs = /* @__PURE__ */ ((WorkspaceTabs2) => { 25361 WorkspaceTabs2["ESTIMATION"] = "CQ Estimation"; 25362 WorkspaceTabs2["BUSINESS"] = "CQ Business"; 25363 WorkspaceTabs2["PATENT"] = "CQ Patent"; 25364 WorkspaceTabs2["MARKETING"] = "CQ Marketing"; 25365 return WorkspaceTabs2; 25366})(WorkspaceTabs || {}); 25367const Workspace = () => { 25368 const navigate = useNavigate(); 25369 const [estimateLoading, setEstimateLoading] = reactExports.useState(false); 25370 const [estimations, setEstimations] = reactExports.useState([]); 25371 const [activeTab, setActiveTab] = reactExports.useState("CQ Estimation" /* ESTIMATION */); 25372 const onTabClick = (tabName) => { 25373 setActiveTab(tabName); 25374 }; 25375 const getEstimations = async () => { 25376 let res; 25377 try { 25378 setEstimateLoading(true); 25379 if (activeTab === "CQ Estimation" /* ESTIMATION */) { 25380 res = await axios.get(API_URLS.PROFILE_ESTIMATIONS); 25381 } else if (activeTab === "CQ Business" /* BUSINESS */) { 25382 res = await axios.get(API_URLS.PROFILE_BUSINESS); 25383 } else if (activeTab === "CQ Patent" /* PATENT */) { 25384 res = await axios.get(API_URLS.PROFILE_PATENT); 25385 } 25386 setEstimations(res?.data?.results || []); 25387 setEstimateLoading(false); 25388 } catch (e) { 25389 console.log(e); 25390 } 25391 }; 25392 const onNavigate = () => { 25393 if (activeTab === "CQ Estimation" /* ESTIMATION */) { 25394 navigate("/estimation"); 25395 } else if (activeTab === "CQ Business" /* BUSINESS */) { 25396 navigate("/business"); 25397 } else if (activeTab === "CQ Patent" /* PATENT */) { 25398 navigate("/patent"); 25399 } 25400 }; 25401 reactExports.useEffect(() => { 25402 getEstimations(); 25403 }, [activeTab]); 25404 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-10 px-4 pb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full max-w-[900px] mx-auto space-y-6", children: [ 25405 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25406 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base text-textSecondary2", children: "My Workspace" }), 25407 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-medium ", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-white to-textSecondary2 bg-clip-text text-transparent", children: "Welcome!" }) }) 25408 ] }), 25409 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "inline-flex gap-1 p-1 rounded-full bg-white/5 shadow-[0_0_0_1px_rgba(141,155,229,0.18)] max-w-full overflow-x-auto", children: Object.values(WorkspaceTabs).map((tabName) => { 25410 return /* @__PURE__ */ jsxRuntimeExports.jsx( 25411 WorkspaceTab, 25412 { 25413 onClick: () => onTabClick(tabName), 25414 name: tabName, 25415 isActive: tabName === activeTab 25416 }, 25417 tabName 25418 ); 25419 }) }), 25420 !estimateLoading && estimations.length !== 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3", children: [
25421 /* @__PURE__ */ jsxRuntimeExports.jsxs( 25422 "button", 25423 { 25424 className: "flex flex-col gap-2 justify-center items-center text-center p-6 before:rounded-2xl cursor-pointer bg-nightfall rounded-2xl border-gradient before:bg-none hover:before:bg-gradient-to-r hover:before:from-redLightTransparent hover:before:to-sapphireLightTransparent hover:bg-muted", 25425 onClick: onNavigate, 25426 children: [ 25427 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--add-circle-linear] text-xl leading-none text-lavender" }), 25428 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-base font-medium text-grey", children: [ 25429 activeTab === "CQ Estimation" /* ESTIMATION */ && "Start New Estimation", 25430 activeTab === "CQ Business" /* BUSINESS */ && "Start Business Planning", 25431 activeTab === "CQ Patent" /* PATENT */ && "Start New Patent", 25432 activeTab === "CQ Marketing" /* MARKETING */ && "Start New Estimation" 25433 ] }) 25434 ] 25435 } 25436 ), 25437 estimations.map((itemData) => { 25438 return /* @__PURE__ */ jsxRuntimeExports.jsx(EstimationCard, { itemData, activeTab }, itemData.id); 25439 }) 25440 ] }),
25441 !estimateLoading && !estimations.length && /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyTab, { activeTab }), 25442 estimateLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-nightfall rounded-2xl grid items-center justify-center gap-4 p-10 min-h-[315px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "svg-spinners:90-ring-with-bg", width: 46, height: 46 }) }) 25443 ] }) }); 25444}; 25445 25446const CheckSurvey = () => { 25447 const navigate = useNavigate(); 25448 const { setAppState } = useAppData(); 25449 const estimateAsyncStartedRef = reactExports.useRef(false); 25450 const { 25451 data: estimationDataNoRestrictions, 25452 loading: loadingNoRestrictions, 25453 error: errorNoRestrictions, 25454 progress, 25455 startAsync, 25456 featuresPendingReview} = useAsyncPolling(); 25457 reactExports.useEffect(() => { 25458 estimateAsyncStartedRef.current = true; 25459 startAsync(async () => { 25460 const { data } = await axios.post(API_URLS.GENERATE_ESTIMATE_ASYNC, { 25461 session_id: localStorage.getItem(SESSION_ID_NAME) 25462 }); 25463 return { session_id: data.session_id }; 25464 }, "generate_estimate"); 25465 }, [startAsync]); 25466 reactExports.useEffect(() => { 25467 if (!estimateAsyncStartedRef.current) { 25468 return; 25469 } 25470 if (!loadingNoRestrictions) { 25471 if (errorNoRestrictions) { 25472 console.log(errorNoRestrictions); 25473 } else if (estimationDataNoRestrictions) { 25474 setAppState((prevState) => ({ 25475 ...prevState, 25476 estimationDataNoRestrictions, 25477 estimationDataWithRestrictions: null 25478 })); 25479 navigate("/estimation/final"); 25480 } 25481 } 25482 }, [errorNoRestrictions, estimationDataNoRestrictions, loadingNoRestrictions, navigate, setAppState]); 25483 const handleFeaturesSubmitted = reactExports.useCallback((shortVersionHtml) => { 25484 setAppState((prevState) => ({ 25485 ...prevState, 25486 shortVersionHtml 25487 })); 25488 navigate("/estimation/final"); 25489 }, [navigate, setAppState]); 25490 if (featuresPendingReview) { 25491 return /* @__PURE__ */ jsxRuntimeExports.jsx(FeatureSelection, { data: featuresPendingReview, onSubmitted: handleFeaturesSubmitted }); 25492 } 25493 return /* @__PURE__ */ jsxRuntimeExports.jsx( 25494 Loading, 25495 { 25496 info: loadingEstimationDescription.second, 25497 loading: loadingNoRestrictions, 25498 stageStatuses: progress?.stages?.map((item) => item.status) 25499 } 25500 ); 25501}; 25502 25503const CheckFileDescription = () => { 25504 const navigate = useNavigate(); 25505 const { state } = useLocation(); 25506 const { appState, setAppState } = useAppData(); 25507 const { data, loading, error, startAsync } = useAsyncPolling(); 25508 const { 25509 data: estimateData, 25510 loading: estimateLoading, 25511 error: estimateError, 25512 startAsync: startEstimateAsync, 25513 featuresPendingReview} = useAsyncPolling(); 25514 const descriptionAsyncStartedRef = reactExports.useRef(false); 25515 const estimateAsyncStartedRef = reactExports.useRef(false); 25516 const generateDescription = async () => { 25517 const sessionId = localStorage.getItem(SESSION_ID_NAME); 25518 if (!sessionId || estimateAsyncStartedRef.current) { 25519 return; 25520 } 25521 estimateAsyncStartedRef.current = true; 25522 startEstimateAsync(async () => { 25523 const { data: data2 } = await axios.post(API_URLS.GENERATE_ESTIMATE_ASYNC, { 25524 session_id: sessionId 25525 }); 25526 return { session_id: data2.session_id }; 25527 }, "generate_estimate"); 25528 }; 25529 reactExports.useEffect(() => { 25530 if (!state?.file) { 25531 navigate("/estimation/start"); 25532 return; 25533 } 25534 if (!descriptionAsyncStartedRef.current) { 25535 descriptionAsyncStartedRef.current = true; 25536 startAsync(async () => { 25537 const formData = new FormData(); 25538 formData.append("file", state.file); 25539 const { data: data2 } = await axios.post(API_URLS.PROJECT_FILE_DESCRIPTION_ASYNC, formData, { 25540 headers: { 25541 "Content-Type": "multipart/form-data" 25542 } 25543 }); 25544 if (data2.session_id) { 25545 localStorage.setItem(SESSION_ID_NAME, data2.session_id); 25546 } 25547 return { session_id: data2.session_id }; 25548 }); 25549 } 25550 }, [setAppState]); 25551 reactExports.useEffect(() => { 25552 if (loading) return; 25553 if (data) { 25554 const { session_id, estimate_points_coverage: estimatePointsCoverage } = data; 25555 setAppState((prevState) => ({ 25556 ...prevState, 25557 estimatePointsCoverage 25558 })); 25559 if (session_id) { 25560 localStorage.setItem(SESSION_ID_NAME, session_id); 25561 } 25562 if (estimatePointsCoverage.length === 0) { 25563 generateDescription(); 25564 } else { 25565 navigate("/estimation/survey"); 25566 } 25567 } 25568 if (error) { 25569 console.log(error); 25570 } 25571 }, [data, loading, error, setAppState]); 25572 reactExports.useEffect(() => { 25573 if (estimateLoading) return; 25574 if (estimateData) { 25575 setAppState((prevState) => ({ 25576 ...prevState, 25577 estimationDataNoRestrictions: estimateData, 25578 estimationDataWithRestrictions: estimateData 25579 })); 25580 navigate("/estimation/download"); 25581 } 25582 if (estimateError) { 25583 console.log(estimateError); 25584 } 25585 }, [estimateData, estimateLoading, estimateError, navigate, setAppState]); 25586 const handleFeaturesSubmitted = reactExports.useCallback((shortVersionHtml) => { 25587 setAppState((prevState) => ({ 25588 ...prevState, 25589 shortVersionHtml 25590 })); 25591 navigate("/estimation/final"); 25592 }, [navigate, setAppState]); 25593 if (featuresPendingReview) { 25594 return /* @__PURE__ */ jsxRuntimeExports.jsx(FeatureSelection, { data: featuresPendingReview, onSubmitted: handleFeaturesSubmitted }); 25595 } 25596 return /* @__PURE__ */ jsxRuntimeExports.jsx( 25597 Loading, 25598 { 25599 info: loadingEstimationDescription.first, 25600 loading: loading || estimateLoading || !data, 25601 progress: appState.descriptionUpdateCount > 0 ? 52 : 40 25602 } 25603 ); 25604}; 25605 25606const useFetchData = ({ sendData, url, skip = false }) => { 25607 const [state, setState] = reactExports.useState({ 25608 data: null, 25609 error: null, 25610 loading: true 25611 }); 25612 const controller = reactExports.useRef(null); 25613 const memoizedSendData = reactExports.useMemo(() => sendData, [JSON.stringify(sendData)]); 25614 reactExports.useEffect(() => { 25615 if (controller.current) { 25616 controller.current.abort(); 25617 } 25618 controller.current = new AbortController(); 25619 const { signal } = controller.current; 25620 const fetchData = async () => { 25621 setState({ data: null, error: null, loading: true });
25622 try { 25623 const { data: result } = await axios.post( 25624 url, 25625 { 25626 ...memoizedSendData, 25627 session_id: localStorage.getItem(SESSION_ID_NAME) ?? void 0 25628 }, 25629 { signal } 25630 ); 25631 setState({ data: result, error: null, loading: false }); 25632 } catch (error) { 25633 if (!signal.aborted) { 25634 setState({ data: null, error, loading: false }); 25635 } 25636 } 25637 }; 25638 if (!skip) { 25639 fetchData(); 25640 } 25641 return () => { 25642 controller.current?.abort(); 25643 }; 25644 }, [memoizedSendData, url, skip]); 25645 return state; 25646}; 25647 25648const useBusinessData = () => { 25649 const { appState, setAppState } = useAppData(); 25650 const [textValue, setTextValue] = reactExports.useState(""); 25651 const [isFileMode, setIsFileMode] = reactExports.useState(false); 25652 const [isFocused, setIsFocused] = reactExports.useState(false); 25653 const [showNDA, setShowNDA] = reactExports.useState(!sessionStorage.getItem(SESSION_NDA_NAME)); 25654 const [showNDAModal, setShowNDAModal] = reactExports.useState(false); 25655 const [skipSubmit, setSkipSubmit] = reactExports.useState(true); 25656 const [isLoading, setIsLoading] = reactExports.useState(false); 25657 const navigate = useNavigate(); 25658 const handleInputChange = (value) => { 25659 setTextValue(value); 25660 }; 25661 const handleError = (error) => { 25662 console.log(error); 25663 }; 25664 const onOpenDialog = () => { 25665 document.body.style.overflow = "clip"; 25666 setShowNDAModal(true); 25667 }; 25668 const onCloseDialog = () => { 25669 document.body.style.overflow = "unset"; 25670 setShowNDAModal(false); 25671 }; 25672 const onSubmitData = ({ nda_file }) => { 25673 sessionStorage.setItem(SESSION_NDA_NAME, "true"); 25674 downloadBase64File(nda_file, "NDA.pdf"); 25675 setShowNDA(false); 25676 onCloseDialog(); 25677 }; 25678 const { data } = useFetchData({ 25679 sendData: { 25680 description: appState.description 25681 }, 25682 url: API_URLS.CUSTOMER_SEGMENTS, 25683 skip: skipSubmit 25684 }); 25685 const onSend = async (text) => { 25686 setIsLoading(true); 25687 setAppState((prev) => ({ 25688 ...prev, 25689 description: text 25690 })); 25691 setSkipSubmit(false); 25692 }; 25693 reactExports.useEffect(() => { 25694 if (data) { 25695 if (data.session_id) { 25696 localStorage.setItem(SESSION_ID_NAME, data.session_id); 25697 } 25698 setAppState((prevState) => ({ 25699 ...prevState, 25700 customer_segments: data.customer_segments 25701 })); 25702 navigate("/business/check-segments"); 25703 } 25704 }, [data]); 25705 const handleSend = () => { 25706 onSend(textValue); 25707 }; 25708 const switchModeHandler = (event) => { 25709 event.stopPropagation(); 25710 event.preventDefault(); 25711 setTextValue(""); 25712 setIsFileMode(!isFileMode); 25713 }; 25714 const handleFocus = () => { 25715 setIsFocused(true); 25716 }; 25717 const onDropRejected = reactExports.useCallback( 25718 (files) => { 25719 const errors = files.map((file) => file.errors); 25720 const message = errors[0].map((error) => error.message).join(". "); 25721 handleError(message); 25722 }, 25723 [handleError] 25724 ); 25725 const onDrop = reactExports.useCallback( 25726 async (acceptedFiles) => { 25727 if (acceptedFiles.length === 0) { 25728 return; 25729 } 25730 try { 25731 setIsLoading(true); 25732 const file = acceptedFiles[0]; 25733 const formData = new FormData(); 25734 formData.append("file", file); 25735 const { data: data2 } = await axios.post(API_URLS.FILE_CUSTOMER_SEGMENTS, formData, { 25736 headers: { 25737 "Content-Type": "multipart/form-data" 25738 } 25739 }); 25740 if (data2.session_id) { 25741 localStorage.setItem(SESSION_ID_NAME, data2.session_id); 25742 } 25743 setAppState((prevState) => ({ 25744 ...prevState, 25745 customer_segments: data2.customer_segments 25746 })); 25747 navigate("/business/check-segments"); 25748 } catch (e) { 25749 console.log(e); 25750 } finally { 25751 setIsLoading(false); 25752 } 25753 }, 25754 [onSend] 25755 ); 25756 reactExports.useEffect(() => { 25757 localStorage.removeItem(SESSION_ID_NAME); 25758 localStorage.removeItem(STATE_ID_NAME); 25759 setAppState(initialState$1); 25760 }, [setAppState]); 25761 const { getRootProps, getInputProps, isDragActive } = useDropzone({ 25762 onDrop, 25763 onDropRejected, 25764 noKeyboard: true, 25765 noClick: false, 25766 multiple: false 25767 }); 25768 return { 25769 textValue, 25770 isFileMode, 25771 isFocused, 25772 isDragActive, 25773 showNDA: false, 25774 showNDAModal, 25775 handleInputChange, 25776 handleSend, 25777 switchModeHandler, 25778 handleFocus, 25779 getRootProps, 25780 getInputProps, 25781 onCloseDialog, 25782 onOpenDialog, 25783 onSubmitData, 25784 loading: isLoading 25785 }; 25786}; 25787 25788const Business = () => { 25789 const props = useBusinessData();
25790 return props.loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { info: loadingBusinessDescription.first, loading: true, progress: 0 }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 25791 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 25792 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative max-w-[900px] mx-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "md:pt-[12.5vh]", children: [ 25793 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 25794 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Turn Your Idea Into a Business Blueprint" }), 25795 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Simply describe your product idea or upload a concept document, and weâll transform it into a structured business foundation â including audience insights, user needs, and your market fit strategy." }) 25796 ] }), 25797 props.showNDA,
25798 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 25799 /* @__PURE__ */ jsxRuntimeExports.jsx(CombinedTextArea, { ...props, maxLength: 4e3 }), 25800 !!props.textValue.length && !props.isFileMode && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end text-sm text-greyGentle mt-2", children: [ 25801 props.textValue.length, 25802 "/4000" 25803 ] }) 25804 ] }), 25805 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col md:flex-row gap-4 md:gap-6", children: [ 25806 /* @__PURE__ */ jsxRuntimeExports.jsx( 25807 Card, 25808 { 25809 text: "âï¸ Be Clear and Concise", 25810 description: "Summarize what your product does and the problem it solves." 25811 } 25812 ), 25813 /* @__PURE__ */ jsxRuntimeExports.jsx( 25814 Card, 25815 { 25816 text: "ð Mention What Makes It Special", 25817 description: "You can mention what makes it unique â or just stick to the basics." 25818 } 25819 ),
25820 /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { text: "âï¸ Include Tech Specs", description: "Who is this product for? What are their biggest needs?" }) 25821 ] }) 25822 ] }) }), 25823 /* @__PURE__ */ jsxRuntimeExports.jsx(NDA, { ...props, show: props.showNDAModal }) 25824 ] }); 25825}; 25826 25827const CheckSegments = () => { 25828 const { appState, setAppState } = useAppData(); 25829 const { customer_segments } = appState; 25830 const navigate = useNavigate(); 25831 const handleSend = async () => { 25832 const sessionId = localStorage.getItem(SESSION_ID_NAME); 25833 const { data } = await axios.patch(API_URLS.SEGMENTS, { segments: customer_segments, session_id: sessionId }); 25834 setAppState((prevState) => ({ 25835 ...prevState, 25836 segments: data.customer_segments 25837 })); 25838 navigate("/business/segment"); 25839 }; 25840 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 25841 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 25842 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto", children: [
25843 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-3 md:mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressCircle, { progress: 50 }) }), 25844 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 25845 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Your Business Blueprint Is Taking Shape!" }), 25846 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Weâve analyzed your input and identified customer segments for your idea." }) 25847 ] }), 25848 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-4", children: [ 25849 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s md:text-m font-medium", children: "Below is the finalized list â no further changes can be made at this stage." }),
25850 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-s text-greyGentle", children: "ð In the next step, youâll define each segmentâs core needs, problems, and tailored value propositions. This will ensure your product addresses real needs and stands out in the market." }), 25851 customer_segments?.map((segment, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep text-xs text-grey w-full", children: segment }) }, index)) 25852 ] }) }), 25853 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full justify-end flex mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleSend, className: "btn-main ", children: "Start Value Proposition Design" }) }) 25854 ] }) 25855 ] }); 25856}; 25857 25858const Segement = () => { 25859 const { appState } = useAppData(); 25860 const navigate = useNavigate(); 25861 const [currentStep, setCurrentStep] = reactExports.useState(0); 25862 const [isLoading, setIsLoading] = reactExports.useState(true); 25863 const [segmentData, setSegmentData] = reactExports.useState(null); 25864 const generateSecgemntData = async (id) => { 25865 try { 25866 setIsLoading(true); 25867 const sessionId = localStorage.getItem(SESSION_ID_NAME); 25868 const { data } = await axios.post(API_URLS.GENERATE_SEGMENT, { 25869 segment: id, 25870 session_id: sessionId 25871 }); 25872 if (data.session_id) { 25873 localStorage.setItem(SESSION_ID_NAME, data.session_id); 25874 } 25875 setSegmentData(data); 25876 } catch (e) { 25877 console.log(e); 25878 } finally { 25879 setIsLoading(false); 25880 } 25881 }; 25882 reactExports.useEffect(() => { 25883 if (appState.segments?.[currentStep]?.id) { 25884 generateSecgemntData(appState.segments?.[currentStep]?.id); 25885 } 25886 }, [currentStep]); 25887 const handleSubmit = async () => { 25888 const sessionId = localStorage.getItem(SESSION_ID_NAME); 25889 if (currentStep === appState.segments.length - 1) { 25890 navigate("/business/high-level-components"); 25891 } else { 25892 await axios.patch(API_URLS.UPDATE_SEGMENT, { 25893 segment: appState.segments?.[currentStep]?.id, 25894 session_id: sessionId, 25895 ...segmentData 25896 }); 25897 setCurrentStep(currentStep + 1); 25898 } 25899 };
25900 return !segmentData || isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx( 25901 Loading, 25902 { 25903 info: loadingBusinessDescription.second, 25904 loading: true, 25905 progress: appState.descriptionUpdateCount > 0 ? 52 : 40 25906 } 25907 ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 25908 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 25909 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto", children: [ 25910 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-3 md:mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressCircle, { progress: 50 + (currentStep + 1) * 10 }) }), 25911 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 25912 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Deep Dive Into Your Segments" }), 25913 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Weâre tailoring insights for each segment â their needs, pain points, and how your product stands out." }) 25914 ] }),
25915 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-4", children: [ 25916 /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "text-s md:text-m font-medium", children: [ 25917 currentStep + 1, 25918 "/", 25919 appState.segments.length, 25920 " Segment: ", 25921 appState.segments?.[currentStep].name 25922 ] }), 25923 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-s text-greyGentle", children: "These are the core insights for this segment â they reflect what matters most, the challenges they face, and how your product can deliver real value." }), 25924 !!segmentData.needs?.length && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 25925 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "ð§© Key Needs" }), 25926 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep eading-5 flex flex-col gap-2", children: segmentData.needs.map((el, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: el }, index)) }) 25927 ] }),
25928 !!segmentData.problems?.length && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 25929 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "ð§ Key Problems" }), 25930 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep eading-5 flex flex-col gap-2", children: segmentData.problems.map((el, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: el }, index)) }) 25931 ] }), 25932 !!segmentData.propositions?.length && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 25933 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s text-greyGentle", children: "ð¡ Value Proposition" }), 25934 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep leading-5 flex flex-col gap-2", children: segmentData.propositions.map((el, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: el }, index)) }) 25935 ] }) 25936 ] }) }),
25937 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full justify-end flex mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleSubmit, className: "btn-main ", children: currentStep === appState.segments.length - 1 ? "Generate High-Level Components" : "Continue to Next Segment" }) }) 25938 ] }) 25939 ] }); 25940}; 25941 25942const POLLING_INTERVAL_MS = 1e3; 25943const POLLING_TIMEOUT_MS = 3 * 60 * 1e3; 25944const useBusinessAsyncPolling = () => { 25945 const [state, setState] = reactExports.useState({ 25946 data: null, 25947 sessionId: null, 25948 loading: false, 25949 error: null 25950 }); 25951 const pollingRef = reactExports.useRef(null); 25952 const timeoutRef = reactExports.useRef(null); 25953 const abortRef = reactExports.useRef(false); 25954 const stopPolling = reactExports.useCallback(() => { 25955 if (pollingRef.current) { 25956 clearInterval(pollingRef.current); 25957 pollingRef.current = null; 25958 } 25959 if (timeoutRef.current) { 25960 clearTimeout(timeoutRef.current); 25961 timeoutRef.current = null; 25962 } 25963 }, []); 25964 const pollStatus = reactExports.useCallback(async (sessionId, stage) => { 25965 if (abortRef.current) return; 25966 try { 25967 const { data } = await axios.get( 25968 API_URLS.BUSINESS_TASK_STEP_STATUS, 25969 { params: { session_id: sessionId, stage } } 25970 ); 25971 if (abortRef.current) return; 25972 if (data.status === "complete") { 25973 stopPolling(); 25974 setState({ 25975 data: data.response ?? data, 25976 sessionId, 25977 loading: false, 25978 error: null 25979 }); 25980 } else if (data.status === "failed") { 25981 stopPolling(); 25982 const errorMsg = "Processing failed. Please try again."; 25983 setState({ data: null, sessionId, loading: false, error: errorMsg }); 25984 alert(errorMsg); 25985 } else { 25986 setState((prev) => ({ 25987 ...prev, 25988 sessionId, 25989 loading: true, 25990 error: null 25991 })); 25992 } 25993 } catch (err) { 25994 if (abortRef.current) return; 25995 stopPolling(); 25996 const errorMsg = "Error while checking status. Please try again."; 25997 setState({ data: null, sessionId, loading: false, error: errorMsg }); 25998 alert(errorMsg); 25999 } 26000 }, [stopPolling]); 26001 const startPolling = reactExports.useCallback((sessionId, stage) => { 26002 stopPolling(); 26003 pollingRef.current = setInterval(() => { 26004 void pollStatus(sessionId, stage); 26005 }, POLLING_INTERVAL_MS); 26006 timeoutRef.current = setTimeout(() => { 26007 stopPolling(); 26008 const errorMsg = "Polling timed out after 3 minutes. Please try again later."; 26009 setState((prev) => ({ ...prev, loading: false, error: errorMsg })); 26010 alert(errorMsg); 26011 }, POLLING_TIMEOUT_MS); 26012 }, [pollStatus, stopPolling]); 26013 const startAsync = reactExports.useCallback(async (asyncCall, stage = "user_story_and_mvp") => { 26014 abortRef.current = false; 26015 setState({ data: null, sessionId: null, loading: true, error: null }); 26016 try { 26017 const result = await asyncCall(); 26018 const sessionId = result.session_id; 26019 if (abortRef.current) return; 26020 setState((prev) => ({ ...prev, sessionId })); 26021 startPolling(sessionId, stage); 26022 } catch (err) { 26023 if (abortRef.current) return; 26024 const errorMsg = "Failed to start async processing. Please try again."; 26025 setState({ data: null, sessionId: null, loading: false, error: errorMsg }); 26026 alert(errorMsg); 26027 } 26028 }, [startPolling]); 26029 reactExports.useEffect(() => { 26030 return () => { 26031 abortRef.current = true; 26032 stopPolling(); 26033 }; 26034 }, [stopPolling]); 26035 return { ...state, startAsync }; 26036}; 26037 26038const HighLevelComponents = () => { 26039 const { appState, setAppState } = useAppData(); 26040 const navigate = useNavigate(); 26041 const [isLoading, setIsLoading] = reactExports.useState(true); 26042 const [loadingType, setLoadingType] = reactExports.useState("hlc"); 26043 const [hlcData, setHLCData] = reactExports.useState(null); 26044 const { 26045 data: mvpData, 26046 loading: mvpLoading, 26047 error: mvpError, 26048 startAsync: startMvpAsync 26049 } = useBusinessAsyncPolling(); 26050 const mvpAsyncStartedRef = reactExports.useRef(false); 26051 const generateHLCData = async () => { 26052 try {
26053 setLoadingType("hlc"); 26054 setIsLoading(true); 26055 const sessionId = localStorage.getItem(SESSION_ID_NAME); 26056 const { data } = await axios.patch(API_URLS.HLC, { 26057 session_id: sessionId 26058 }); 26059 if (data.session_id) { 26060 localStorage.setItem(SESSION_ID_NAME, data.session_id); 26061 } 26062 setHLCData(data); 26063 } catch (e) { 26064 console.log(e); 26065 } finally { 26066 setIsLoading(false); 26067 } 26068 }; 26069 reactExports.useEffect(() => { 26070 generateHLCData(); 26071 }, []); 26072 reactExports.useEffect(() => { 26073 if (mvpLoading) { 26074 setLoadingType("mvp"); 26075 setIsLoading(true); 26076 } 26077 }, [mvpLoading]); 26078 reactExports.useEffect(() => { 26079 if (mvpLoading) return; 26080 if (mvpData) { 26081 const sessionId = localStorage.getItem(SESSION_ID_NAME); 26082 setAppState((prevState) => ({ 26083 ...prevState, 26084 estimationDataNoRestrictions: { 26085 name: mvpData.name, 26086 brief_project_description: mvpData.brief_project_description 26087 } 26088 })); 26089 navigate("/business/final", { 26090 state: { 26091 sessionId 26092 } 26093 }); 26094 } 26095 if (mvpError) { 26096 console.log(mvpError); 26097 setIsLoading(false); 26098 } 26099 }, [mvpData, mvpLoading, mvpError, navigate, setAppState]); 26100 const handleSubmit = async () => { 26101 if (mvpAsyncStartedRef.current) return; 26102 mvpAsyncStartedRef.current = true; 26103 const sessionId = localStorage.getItem(SESSION_ID_NAME); 26104 startMvpAsync(async () => { 26105 const { data } = await axios.patch(API_URLS.USER_STORY_ASYNC, { 26106 session_id: sessionId 26107 }); 26108 return { session_id: data.session_id }; 26109 }, "user_story_and_mvp"); 26110 };
26111 return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx( 26112 Loading, 26113 { 26114 info: loadingType ? loadingBusinessDescription.hlc : loadingBusinessDescription.mvp, 26115 loading: true, 26116 progress: appState.descriptionUpdateCount > 0 ? 52 : 40 26117 } 26118 ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 26119 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 26120 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col h-[calc(100vh-113px)] md:h-[calc(100vh-80px)] overflow-hidden", children: [ 26121 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-3 md:mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressCircle, { progress: 90 }) }), 26122 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 26123 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "High-Level Components Overview" }),
26124 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Hereâs a snapshot of the core building blocks based on your selected segment. These components help shape your productâs foundation and prepare it for user story and MVP planning." }) 26125 ] }), 26126 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: " overflow-auto leading-5 flex flex-col gap-4", children: hlcData?.high_level_components?.map(({ name, customer_segment, purpose, core_features }, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-6 rounded-2xl bg-nightfall text-grey leading-5", children: [ 26127 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s md:text-m font-medium", children: name }), 26128 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-s text-greyGentle leading-5", children: [ 26129 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-white", children: "Segment:" }), 26130 " ", 26131 customer_segment 26132 ] }),
26133 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-s text-greyGentle leading-5", children: [ 26134 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-white", children: "Purpose:" }), 26135 " ", 26136 purpose 26137 ] }), 26138 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-s text-greyGentle leading-5", children: [ 26139 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-white", children: "Core features:" }), 26140 " ", 26141 core_features 26142 ] }) 26143 ] }, index)) }), 26144 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full justify-end flex mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleSubmit, className: "btn-main ", children: "Generate User Stories & MVP Scope" }) }) 26145 ] }) 26146 ] }); 26147}; 26148 26149const MVP = () => { 26150 const { user } = useAuth(); 26151 const { state } = useLocation(); 26152 const [showSignUpModal, setShowSignUpModal] = reactExports.useState(false); 26153 const handleSignUp = () => { 26154 setShowSignUpModal(true); 26155 }; 26156 const handleCloseSignUpModal = () => { 26157 setShowSignUpModal(false); 26158 }; 26159 const onSignUp = async () => { 26160 const sessionId = localStorage.getItem(SESSION_ID_NAME); 26161 await axios.post(API_URLS.BIND_BUSINESS, { 26162 session_id: state?.sessionId ?? sessionId 26163 }); 26164 setShowSignUpModal(false); 26165 }; 26166 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 26167 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 26168 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col", children: [
26169 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 26170 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "ð Your Business Blueprint Is Ready!" }), 26171 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Success! Weâve crafted a structured business plan based on your idea, audience needs, and value propositions." }) 26172 ] }), 26173 user?.isAuth ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey overflow-auto flex gap-4 flex-row", children: [ 26174 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 text-[16px] w-full whitespace-nowrap", children: [ 26175 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "", children: "Download now or find it later in your workspace" }), 26176 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "dark:text-greyGentle", children: "Your business blueprint is ready whenever you are." }) 26177 ] }),
26178 /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/workspace", className: "btn-main-outlined w-full", children: "Go to My Workspace" }), 26179 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main w-full", onClick: () => downloadBusinessEstimate(), children: "Download Full Blueprint" }) 26180 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey overflow-auto flex gap-4 flex-row", children: [ 26181 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 text-[16px] w-full whitespace-nowrap", children: [ 26182 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "", children: "Want to save your draft for later?" }), 26183 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "dark:text-greyGentle", children: "Create a free account or download your document now." }) 26184 ] }), 26185 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main-outlined w-full", onClick: () => downloadBusinessEstimate(), children: "Download Full Blueprint" }),
26186 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main w-fit whitespace-nowrap", onClick: handleSignUp, children: "Create Account" }) 26187 ] }), 26188 showSignUpModal && /* @__PURE__ */ jsxRuntimeExports.jsx(AuthorizationModal, { onCloseDialog: handleCloseSignUpModal, isSignUp: true, onSubmit: onSignUp }) 26189 ] }) 26190 ] }); 26191}; 26192 26193const usePatentData = () => { 26194 const { setAppState } = useAppData(); 26195 const [textValue, setTextValue] = reactExports.useState(""); 26196 const [nameValue, setNameValue] = reactExports.useState(""); 26197 const [showNDA, setShowNDA] = reactExports.useState(!sessionStorage.getItem(SESSION_NDA_NAME)); 26198 const [showNDAModal, setShowNDAModal] = reactExports.useState(false); 26199 const [isLoading, setIsLoading] = reactExports.useState(false); 26200 const navigate = useNavigate(); 26201 const handleInputChange = (value) => { 26202 setTextValue(value); 26203 }; 26204 const handleNameChange = (value) => { 26205 setNameValue(value); 26206 }; 26207 const onOpenDialog = () => { 26208 document.body.style.overflow = "clip"; 26209 setShowNDAModal(true); 26210 }; 26211 const onCloseDialog = () => { 26212 document.body.style.overflow = "unset"; 26213 setShowNDAModal(false); 26214 }; 26215 const onSubmitData = ({ nda_file }) => { 26216 sessionStorage.setItem(SESSION_NDA_NAME, "true"); 26217 downloadBase64File(nda_file, "NDA.pdf"); 26218 setShowNDA(false); 26219 onCloseDialog(); 26220 }; 26221 const onSubmit = async () => { 26222 try { 26223 setIsLoading(true); 26224 const { data } = await axios.post(API_URLS.CREATE_PATENT, { 26225 name: nameValue, 26226 description: textValue 26227 }); 26228 if (data.session_id) { 26229 localStorage.setItem(SESSION_ID_NAME, data.session_id); 26230 navigate("/patent/visual-representation"); 26231 } 26232 } catch (e) { 26233 console.log(e); 26234 } finally { 26235 setIsLoading(false); 26236 } 26237 }; 26238 reactExports.useEffect(() => { 26239 setAppState(initialState$1); 26240 }, []); 26241 return { 26242 textValue, 26243 showNDA: false, 26244 showNDAModal, 26245 nameValue, 26246 onSubmit, 26247 handleInputChange, 26248 handleNameChange, 26249 onCloseDialog, 26250 onOpenDialog, 26251 onSubmitData, 26252 loading: isLoading 26253 }; 26254}; 26255 26256const TextareaAutosize = ({ value, onChange, ...props }) => { 26257 const textareaRef = reactExports.useRef(null); 26258 reactExports.useEffect(() => { 26259 const textarea = textareaRef.current; 26260 if (textarea) { 26261 textarea.style.height = "auto"; 26262 textarea.style.height = `${textarea.scrollHeight}px`; 26263 } 26264 }, [value]); 26265 return /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { ref: textareaRef, value, onChange, ...props }); 26266}; 26267 26268const Patent = () => { 26269 const props = usePatentData();
26270 return props.loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { info: loadingPatentDescription.start, loading: true, progress: 0 }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 26271 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 26272 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative max-w-[900px] mx-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "md:pt-[12.5vh]", children: [ 26273 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-10", children: [ 26274 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Protect Your Idea with Confidence" }), 26275 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Turn your invention into a ready-to-file patent draft â fast and simple." }) 26276 ] }), 26277 props.showNDA, 26278 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-6", children: [
26279 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-4", children: [ 26280 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s md:text-m font-medium", children: "Tell Us About Your Invention" }), 26281 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s dark:text-greyGentle", children: "Turn your invention into a ready-to-file patent draft â fast and simple." }) 26282 ] }), 26283 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$3.inputWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 26284 "input", 26285 { 26286 className: styles$3.input, 26287 type: "text", 26288 onChange: (e) => props.handleNameChange(e.target.value), 26289 placeholder: "Enter your inventionâs name (e.g., Smart Pet Feeder with App Control)" 26290 } 26291 ) }), 26292 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 26293 TextareaAutosize, 26294 { 26295 onChange: (e) => props.handleInputChange(e.target.value), 26296 value: props.textValue, 26297 maxLength: 2e3, 26298 rows: 4, 26299 placeholder: "Briefly describe what your invention does, how it works, and what makes it unique", 26300 className: "p-2 bg-deep text-xs text-grey w-full outline-none resize-none max-h-[122px] overflow-auto" 26301 } 26302 ) }),
26303 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end text-sm text-greyGentle mt-2", children: [ 26304 props.textValue.length, 26305 "/2000" 26306 ] }) 26307 ] }) }), 26308 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full justify-end mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main", disabled: !props.textValue && !props.nameValue, onClick: props.onSubmit, children: "Letâs Draft It" }) }) 26309 ] }) }), 26310 /* @__PURE__ */ jsxRuntimeExports.jsx(NDA, { ...props, show: props.showNDAModal }) 26311 ] }); 26312}; 26313 26314const fileIcon = "data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17%207C17%208.10457%2016.1046%209%2015%209C13.8954%209%2013%208.10457%2013%207C13%205.89543%2013.8954%205%2015%205C16.1046%205%2017%205.89543%2017%207Z'%20fill='%238D9BE5'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.9426%200.25H11.0574C13.3658%200.249988%2015.1748%200.249978%2016.5863%200.439747C18.031%200.633987%2019.1711%201.03933%2020.0659%201.93414C20.9607%202.82895%2021.366%203.96897%2021.5603%205.41371C21.75%206.82519%2021.75%208.63423%2021.75%2010.9426V11.0309C21.75%2012.9397%2021.75%2014.5023%2021.6463%2015.7745C21.5422%2017.0531%2021.3287%2018.1214%2020.8509%2019.0087C20.6401%2019.4001%2020.3812%2019.7506%2020.0659%2020.0659C19.1711%2020.9607%2018.031%2021.366%2016.5863%2021.5603C15.1748%2021.75%2013.3658%2021.75%2011.0574%2021.75H10.9426C8.63423%2021.75%206.82519%2021.75%205.41371%2021.5603C3.96897%2021.366%202.82895%2020.9607%201.93414%2020.0659C1.14086%2019.2726%200.731199%2018.2852%200.513351%2017.0604C0.29935%2015.8573%200.260202%2014.3603%200.25207%2012.5015C0.25%2012.0287%200.25%2011.5286%200.25%2011.001V10.9426C0.249988%208.63424%200.249978%206.82519%200.439747%205.41371C0.633987%203.96897%201.03933%202.82895%201.93414%201.93414C2.82895%201.03933%203.96897%200.633987%205.41371%200.439747C6.82519%200.249978%208.63424%200.249988%2010.9426%200.25ZM5.61358%201.92637C4.33517%202.09825%203.56445%202.42514%202.9948%202.9948C2.42514%203.56445%202.09825%204.33517%201.92637%205.61358C1.75159%206.91356%201.75%208.62178%201.75%2011C1.75%2011.2905%201.75%2011.5715%201.75034%2011.8435L2.75148%2010.9675C3.66275%2010.1702%205.03617%2010.2159%205.89238%2011.0721L10.1821%2015.3618C10.8693%2016.0491%2011.9511%2016.1428%2012.7463%2015.5839L13.0445%2015.3744C14.1887%2014.5702%2015.7368%2014.6634%2016.7764%2015.599L19.6068%2018.1463C19.8917%2017.548%2020.0609%2016.7618%2020.1513%2015.6527C20.2494%2014.4482%2020.25%2012.9459%2020.25%2011C20.25%208.62178%2020.2484%206.91356%2020.0736%205.61358C19.9018%204.33517%2019.5749%203.56445%2019.0052%202.9948C18.4355%202.42514%2017.6648%202.09825%2016.3864%201.92637C15.0864%201.75159%2013.3782%201.75%2011%201.75C8.62178%201.75%206.91356%201.75159%205.61358%201.92637Z'%20fill='%238D9BE5'/%3e%3c/svg%3e"; 26315 26316const closeIcon = "data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.0303%207.96965C8.73741%207.67676%208.26253%207.67676%207.96964%207.96965C7.67675%208.26255%207.67675%208.73742%207.96964%209.03031L9.93932%2011L7.96966%2012.9697C7.67677%2013.2625%207.67677%2013.7374%207.96966%2014.0303C8.26255%2014.3232%208.73743%2014.3232%209.03032%2014.0303L11%2012.0607L12.9696%2014.0303C13.2625%2014.3232%2013.7374%2014.3232%2014.0303%2014.0303C14.3232%2013.7374%2014.3232%2013.2625%2014.0303%2012.9696L12.0606%2011L14.0303%209.03033C14.3232%208.73744%2014.3232%208.26257%2014.0303%207.96968C13.7374%207.67678%2013.2625%207.67678%2012.9696%207.96968L11%209.93933L9.0303%207.96965Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11%200.25C5.06294%200.25%200.25%205.06294%200.25%2011C0.25%2016.9371%205.06294%2021.75%2011%2021.75C16.9371%2021.75%2021.75%2016.9371%2021.75%2011C21.75%205.06294%2016.9371%200.25%2011%200.25ZM1.75%2011C1.75%205.89137%205.89137%201.75%2011%201.75C16.1086%201.75%2020.25%205.89137%2020.25%2011C20.25%2016.1086%2016.1086%2020.25%2011%2020.25C5.89137%2020.25%201.75%2016.1086%201.75%2011Z'%20fill='white'/%3e%3c/svg%3e"; 26317 26318const VisualRepresentation = () => { 26319 const { setAppState } = useAppData(); 26320 const [file, setFile] = reactExports.useState(null); 26321 const [isLoading, setIsLoading] = reactExports.useState(false); 26322 const [error, setError] = reactExports.useState(""); 26323 const navigate = useNavigate(); 26324 const handleError = (error2) => { 26325 setError(error2); 26326 }; 26327 const onDropRejected = reactExports.useCallback( 26328 (files) => { 26329 const errors = files.map((file2) => file2.errors); 26330 const message = errors[0].map((error2) => error2.message).join(". "); 26331 handleError(message); 26332 }, 26333 [handleError] 26334 ); 26335 const onDrop = reactExports.useCallback(async (acceptedFiles) => { 26336 if (acceptedFiles.length === 0) { 26337 return; 26338 } 26339 setError(""); 26340 setFile(acceptedFiles[0]); 26341 }, []); 26342 const { getRootProps, getInputProps, isDragActive } = useDropzone({ 26343 onDrop, 26344 onDropRejected, 26345 noKeyboard: true, 26346 noClick: false, 26347 multiple: false, 26348 accept: { 26349 "image": [".jpg", ".jpeg", ".png"] 26350 } 26351 }); 26352 const handleSubmit = async () => { 26353 if (!file) return; 26354 try { 26355 const sessionId = localStorage.getItem(SESSION_ID_NAME) || ""; 26356 setIsLoading(true); 26357 const formData = new FormData(); 26358 formData.append("image", file); 26359 formData.append("session_id", sessionId); 26360 const { data } = await axios.patch(API_URLS.PATENT_IMAGE, formData, { 26361 headers: { 26362 "Content-Type": "multipart/form-data" 26363 } 26364 }); 26365 if (data.session_id) { 26366 localStorage.setItem(SESSION_ID_NAME, data.session_id); 26367 } 26368 setAppState((prevState) => ({ 26369 ...prevState, 26370 patent: { imageURL: data.image } 26371 })); 26372 navigate("/patent/markers"); 26373 } catch (e) { 26374 console.log(e); 26375 } finally { 26376 setIsLoading(false); 26377 } 26378 };
26379 return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { info: loadingPatentDescription.visualisation, loading: true, progress: 0 }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 26380 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 26381 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col h-[calc(100vh-113px)] md:h-[calc(100vh-80px)] overflow-hidden", children: [ 26382 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-3 md:mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressCircle, { progress: 50 }) }), 26383 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 26384 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Add a Visual Representation of Your Idea" }), 26385 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Upload an image that shows key details or structure â itâs essential for generating your draft." }) 26386 ] }),
26387 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey flex flex-col gap-6", children: !file ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getRootProps(), className: cn("flex flex-col gap-2 group "), children: [ 26388 /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }), 26389 /* @__PURE__ */ jsxRuntimeExports.jsx( 26390 "div", 26391 { 26392 className: cn( 26393 "cursor-pointer w-full h-[100px] rounded-3xl p-4 flex items-center justify-center border border-dashed bg-deep border-[#8D9BE5]", 26394 { "border-redLight": isDragActive }, 26395 { "border-redLight border-solid": !!error } 26396 ), 26397 children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex flex-col items-center justify-center gap-4", children: [ 26398 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--upload-bold] text-[27px] text-white" }), 26399 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-greyGentle text-center", children: "Drag & drop or click to upload image" }) 26400 ] }) 26401 } 26402 ), 26403 !!error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-redLight", children: error }) 26404 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 bg-deep placeholder:text-greyGentle rounded-3xl border justify-between flex items-center border-deep", children: [
26405 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [ 26406 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: fileIcon, width: "22", alt: "fileIcon" }), 26407 file.name 26408 ] }), 26409 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: () => setFile(null), children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: closeIcon, width: "22", alt: "deleteFile" }) }) 26410 ] }) }), 26411 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full justify-end flex mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleSubmit, disabled: !file, className: "btn-main ", children: "Continue" }) }) 26412 ] }) 26413 ] }); 26414}; 26415 26416const Context$2 = () => { 26417 const navigate = useNavigate(); 26418 const { setAppState } = useAppData(); 26419 const [isLoading, setIsLoading] = reactExports.useState(false); 26420 const [contextData, setContextData] = reactExports.useState({ background: "", field_of_invention: "" }); 26421 const onChangeInput = (key) => (e) => { 26422 setContextData((prevState) => { 26423 return { 26424 background: key === "background" ? e.target.value : prevState.background, 26425 field_of_invention: key === "field_of_invention" ? e.target.value : prevState.field_of_invention 26426 }; 26427 }); 26428 }; 26429 const onSubmit = async () => { 26430 try { 26431 setIsLoading(true); 26432 const sessionId = localStorage.getItem(SESSION_ID_NAME); 26433 const { data } = await axios.patch(API_URLS.PATENT_AREA, { ...contextData, session_id: sessionId }); 26434 if (data.session_id) { 26435 localStorage.setItem(SESSION_ID_NAME, data.session_id); 26436 } 26437 const { data: dataAbstract } = await axios.post(API_URLS.PATENT_ABSTRACT, { session_id: sessionId }); 26438 if (dataAbstract.session_id) { 26439 localStorage.setItem(SESSION_ID_NAME, data.session_id); 26440 } 26441 setAppState((prevState) => ({ 26442 ...prevState, 26443 estimationDataNoRestrictions: { 26444 name: dataAbstract.name, 26445 brief_project_description: dataAbstract.brief_project_description 26446 } 26447 })); 26448 navigate("/patent/final", { 26449 state: { 26450 sessionId 26451 } 26452 }); 26453 } catch (e) { 26454 console.log(e); 26455 } finally { 26456 setIsLoading(false); 26457 } 26458 };
26459 return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { info: loadingPatentDescription.context, loading: true, progress: 0 }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 26460 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 26461 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col h-[calc(100vh-113px)] md:h-[calc(100vh-80px)] overflow-hidden", children: [ 26462 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mb-3 md:mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressCircle, { progress: 70 }) }), 26463 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 26464 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "Almost Done â Letâs Wrap It Up!" }), 26465 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle leading-[24px]", children: "Just a couple more details to finalize your draft â youâre one step away from generating your patent-ready document." }) 26466 ] }),
26467 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-6", children: [ 26468 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full flex flex-col gap-4", children: [ 26469 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-s md:text-m font-medium", children: "Provide a Bit More Context" }), 26470 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-s dark:text-greyGentle", children: "These final details help us position your invention within its industry and explain the problem it solves." }) 26471 ] }), 26472 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 26473 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-white text-[14px] leading-5", children: "ð§ Background" }), 26474 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 26475 TextareaAutosize, 26476 { 26477 onChange: onChangeInput("background"), 26478 value: contextData?.background ?? "", 26479 className: "p-2 bg-deep text-xs text-grey w-full outline-none resize-none leading-5", 26480 placeholder: "Explain the problem or need your invention solves.", 26481 rows: 1 26482 } 26483 ) }) 26484 ] }),
26485 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [ 26486 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-white text-[14px] leading-5", children: "ð¬ Field of Invention" }), 26487 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 bg-deep placeholder:text-greyGentle rounded-3xl border border-deep", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 26488 TextareaAutosize, 26489 { 26490 onChange: onChangeInput("field_of_invention"), 26491 value: contextData?.field_of_invention ?? "", 26492 className: "p-2 bg-deep text-xs text-grey w-full outline-none resize-none leading-5", 26493 placeholder: "Briefly describe the industry or technical domain your invention belongs to.", 26494 rows: 1 26495 } 26496 ) }) 26497 ] }) 26498 ] }) }), 26499 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full justify-end mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 26500 "button", 26501 { 26502 className: "btn-main", 26503 disabled: !contextData?.background || !contextData?.field_of_invention, 26504 onClick: onSubmit, 26505 children: "Generate My Draft" 26506 } 26507 ) }) 26508 ] }) 26509 ] }); 26510}; 26511 26512const PatentDraft = () => { 26513 const { user } = useAuth(); 26514 const { state } = useLocation(); 26515 const [showSignUpModal, setShowSignUpModal] = reactExports.useState(false); 26516 const handleSignUp = () => { 26517 setShowSignUpModal(true); 26518 }; 26519 const handleCloseSignUpModal = () => { 26520 setShowSignUpModal(false); 26521 }; 26522 const onSignUp = async () => { 26523 const sessionId = localStorage.getItem(SESSION_ID_NAME); 26524 await axios.post(API_URLS.BIND_PATENT, { 26525 session_id: state?.sessionId ?? sessionId 26526 }); 26527 setShowSignUpModal(false); 26528 }; 26529 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden", children: [ 26530 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 26531 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col", children: [
26532 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 md:mb-10", children: [ 26533 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "ð Your Patent Draft Is Ready!" }), 26534 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Success! Weâve generated a clear, professional patent draft based on your invention details and illustration." }) 26535 ] }), 26536 user?.isAuth ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey overflow-auto flex gap-4 flex-row", children: [ 26537 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 text-[16px] w-full whitespace-nowrap", children: [ 26538 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "", children: "Download now or find it later in your workspace" }), 26539 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "dark:text-greyGentle", children: "Your draft is saved and ready anytime." }) 26540 ] }),
26541 /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/workspace", className: "btn-main-outlined w-full", children: "Go to My Workspace" }), 26542 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main w-full", onClick: () => downloadPatentEstimate(), children: "Download Patent Draft" }) 26543 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey overflow-auto flex gap-4 flex-row", children: [ 26544 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 text-[16px] w-full whitespace-nowrap", children: [ 26545 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "", children: "Want to save your draft for later?" }), 26546 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "dark:text-greyGentle", children: "Create a free account or download your document now." }) 26547 ] }), 26548 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main-outlined w-full", onClick: () => downloadPatentEstimate(), children: "Download Full Blueprint" }),
26549 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main w-fit whitespace-nowrap", onClick: handleSignUp, children: "Create Account" }) 26550 ] }), 26551 showSignUpModal && /* @__PURE__ */ jsxRuntimeExports.jsx(AuthorizationModal, { onCloseDialog: handleCloseSignUpModal, isSignUp: true, onSubmit: onSignUp }) 26552 ] }) 26553 ] }); 26554}; 26555 26556const RedirectSocial = () => { 26557 const navigate = useNavigate(); 26558 const { social, action } = useParams(); 26559 const redirectFunc = async () => { 26560 const url = new URL(window.location.href); 26561 if (url.href.includes("/auth/")) { 26562 if (social && action) { 26563 window.location.href = `/social/${social}/success/?action=${action}&${url.hash.substring(1)}`; 26564 } else { 26565 navigate("/"); 26566 } 26567 } 26568 }; 26569 reactExports.useEffect(() => { 26570 redirectFunc(); 26571 }, []); 26572 return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}); 26573}; 26574 26575const LayoutGroupContext = reactExports.createContext({}); 26576 26577/** 26578 * Creates a constant value over the lifecycle of a component. 26579 * 26580 * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer 26581 * a guarantee that it won't re-run for performance reasons later on. By using `useConstant` 26582 * you can ensure that initialisers don't execute twice or more. 26583 */ 26584function useConstant(init) { 26585 const ref = reactExports.useRef(null); 26586 if (ref.current === null) { 26587 ref.current = init(); 26588 } 26589 return ref.current; 26590} 26591 26592const isBrowser = typeof window !== "undefined"; 26593 26594const useIsomorphicLayoutEffect = isBrowser ? reactExports.useLayoutEffect : reactExports.useEffect; 26595 26596/** 26597 * @public 26598 */ 26599const PresenceContext = 26600/* @__PURE__ */ reactExports.createContext(null); 26601 26602/** 26603 * @public 26604 */ 26605const MotionConfigContext = reactExports.createContext({ 26606 transformPagePoint: (p) => p, 26607 isStatic: false, 26608 reducedMotion: "never", 26609}); 26610 26611/** 26612 * Measurement functionality has to be within a separate component 26613 * to leverage snapshot lifecycle. 26614 */ 26615class PopChildMeasure extends reactExports.Component { 26616 getSnapshotBeforeUpdate(prevProps) { 26617 const element = this.props.childRef.current; 26618 if (element && prevProps.isPresent && !this.props.isPresent) { 26619 const parent = element.offsetParent; 26620 const parentWidth = parent instanceof HTMLElement ? parent.offsetWidth || 0 : 0; 26621 const size = this.props.sizeRef.current; 26622 size.height = element.offsetHeight || 0; 26623 size.width = element.offsetWidth || 0; 26624 size.top = element.offsetTop; 26625 size.left = element.offsetLeft; 26626 size.right = parentWidth - size.width - size.left; 26627 } 26628 return null; 26629 } 26630 /** 26631 * Required with getSnapshotBeforeUpdate to stop React complaining. 26632 */ 26633 componentDidUpdate() { } 26634 render() { 26635 return this.props.children; 26636 } 26637} 26638function PopChild({ children, isPresent, anchorX }) { 26639 const id = reactExports.useId(); 26640 const ref = reactExports.useRef(null); 26641 const size = reactExports.useRef({ 26642 width: 0, 26643 height: 0, 26644 top: 0, 26645 left: 0, 26646 right: 0, 26647 }); 26648 const { nonce } = reactExports.useContext(MotionConfigContext); 26649 /** 26650 * We create and inject a style block so we can apply this explicit 26651 * sizing in a non-destructive manner by just deleting the style block. 26652 * 26653 * We can't apply size via render as the measurement happens 26654 * in getSnapshotBeforeUpdate (post-render), likewise if we apply the 26655 * styles directly on the DOM node, we might be overwriting 26656 * styles set via the style prop. 26657 */ 26658 reactExports.useInsertionEffect(() => { 26659 const { width, height, top, left, right } = size.current; 26660 if (isPresent || !ref.current || !width || !height) 26661 return; 26662 const x = anchorX === "left" ? `left: ${left}` : `right: ${right}`; 26663 ref.current.dataset.motionPopId = id; 26664 const style = document.createElement("style"); 26665 if (nonce) 26666 style.nonce = nonce; 26667 document.head.appendChild(style); 26668 if (style.sheet) { 26669 style.sheet.insertRule(` 26670 [data-motion-pop-id="${id}"] { 26671 position: absolute !important; 26672 width: ${width}px !important; 26673 height: ${height}px !important; 26674 ${x}px !important; 26675 top: ${top}px !important; 26676 } 26677 `); 26678 } 26679 return () => { 26680 if (document.head.contains(style)) { 26681 document.head.removeChild(style); 26682 } 26683 }; 26684 }, [isPresent]); 26685 return (jsxRuntimeExports.jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: reactExports.cloneElement(children, { ref }) })); 26686} 26687 26688const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, }) => { 26689 const presenceChildren = useConstant(newChildrenMap); 26690 const id = reactExports.useId(); 26691 let isReusedContext = true;
vendor: 29,552 bytes, lines 26692-27602
26692 let context = reactExports.useMemo(() => { 26693 isReusedContext = false; 26694 return { 26695 id, 26696 initial, 26697 isPresent, 26698 custom, 26699 onExitComplete: (childId) => { 26700 presenceChildren.set(childId, true); 26701 for (const isComplete of presenceChildren.values()) { 26702 if (!isComplete) 26703 return; // can stop searching when any is incomplete 26704 } 26705 onExitComplete && onExitComplete(); 26706 }, 26707 register: (childId) => { 26708 presenceChildren.set(childId, false); 26709 return () => presenceChildren.delete(childId); 26710 }, 26711 }; 26712 }, [isPresent, presenceChildren, onExitComplete]); 26713 /** 26714 * If the presence of a child affects the layout of the components around it, 26715 * we want to make a new context value to ensure they get re-rendered 26716 * so they can detect that layout change. 26717 */ 26718 if (presenceAffectsLayout && isReusedContext) { 26719 context = { ...context }; 26720 } 26721 reactExports.useMemo(() => { 26722 presenceChildren.forEach((_, key) => presenceChildren.set(key, false)); 26723 }, [isPresent]); 26724 /** 26725 * If there's no `motion` components to fire exit animations, we want to remove this 26726 * component immediately. 26727 */ 26728 reactExports.useEffect(() => { 26729 !isPresent && 26730 !presenceChildren.size && 26731 onExitComplete && 26732 onExitComplete(); 26733 }, [isPresent]); 26734 if (mode === "popLayout") { 26735 children = (jsxRuntimeExports.jsx(PopChild, { isPresent: isPresent, anchorX: anchorX, children: children })); 26736 } 26737 return (jsxRuntimeExports.jsx(PresenceContext.Provider, { value: context, children: children })); 26738}; 26739function newChildrenMap() { 26740 return new Map(); 26741} 26742 26743/** 26744 * When a component is the child of `AnimatePresence`, it can use `usePresence` 26745 * to access information about whether it's still present in the React tree. 26746 * 26747 * ```jsx 26748 * import { usePresence } from "framer-motion" 26749 * 26750 * export const Component = () => { 26751 * const [isPresent, safeToRemove] = usePresence() 26752 * 26753 * useEffect(() => { 26754 * !isPresent && setTimeout(safeToRemove, 1000) 26755 * }, [isPresent]) 26756 * 26757 * return <div /> 26758 * } 26759 * ``` 26760 * 26761 * If `isPresent` is `false`, it means that a component has been removed the tree, but 26762 * `AnimatePresence` won't really remove it until `safeToRemove` has been called. 26763 * 26764 * @public 26765 */ 26766function usePresence(subscribe = true) { 26767 const context = reactExports.useContext(PresenceContext); 26768 if (context === null) 26769 return [true, null]; 26770 const { isPresent, onExitComplete, register } = context; 26771 // It's safe to call the following hooks conditionally (after an early return) because the context will always 26772 // either be null or non-null for the lifespan of the component. 26773 const id = reactExports.useId(); 26774 reactExports.useEffect(() => { 26775 if (subscribe) { 26776 return register(id); 26777 } 26778 }, [subscribe]); 26779 const safeToRemove = reactExports.useCallback(() => subscribe && onExitComplete && onExitComplete(id), [id, onExitComplete, subscribe]); 26780 return !isPresent && onExitComplete ? [false, safeToRemove] : [true]; 26781} 26782 26783const getChildKey = (child) => child.key || ""; 26784function onlyElements(children) { 26785 const filtered = []; 26786 // We use forEach here instead of map as map mutates the component key by preprending `.$` 26787 reactExports.Children.forEach(children, (child) => { 26788 if (reactExports.isValidElement(child)) 26789 filtered.push(child); 26790 }); 26791 return filtered; 26792} 26793 26794const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left" }) => { 26795 const [isParentPresent, safeToRemove] = usePresence(propagate); 26796 const presentChildren = reactExports.useMemo(() => onlyElements(children), [children]); 26797 const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey); 26798 const isInitialRender = reactExports.useRef(true); 26799 const pendingPresentChildren = reactExports.useRef(presentChildren); 26800 const exitComplete = useConstant(() => /* @__PURE__ */ new Map()); 26801 const [diffedChildren, setDiffedChildren] = reactExports.useState(presentChildren); 26802 const [renderedChildren, setRenderedChildren] = reactExports.useState(presentChildren); 26803 useIsomorphicLayoutEffect(() => { 26804 isInitialRender.current = false; 26805 pendingPresentChildren.current = presentChildren; 26806 for (let i = 0; i < renderedChildren.length; i++) { 26807 const key = getChildKey(renderedChildren[i]); 26808 if (!presentKeys.includes(key)) { 26809 if (exitComplete.get(key) !== true) { 26810 exitComplete.set(key, false); 26811 } 26812 } else { 26813 exitComplete.delete(key); 26814 } 26815 } 26816 }, [renderedChildren, presentKeys.length, presentKeys.join("-")]); 26817 const exitingChildren = []; 26818 if (presentChildren !== diffedChildren) { 26819 let nextChildren = [...presentChildren]; 26820 for (let i = 0; i < renderedChildren.length; i++) { 26821 const child = renderedChildren[i]; 26822 const key = getChildKey(child); 26823 if (!presentKeys.includes(key)) { 26824 nextChildren.splice(i, 0, child); 26825 exitingChildren.push(child); 26826 } 26827 } 26828 if (mode === "wait" && exitingChildren.length) { 26829 nextChildren = exitingChildren; 26830 } 26831 setRenderedChildren(onlyElements(nextChildren)); 26832 setDiffedChildren(presentChildren); 26833 return null; 26834 } 26835 const { forceRender } = reactExports.useContext(LayoutGroupContext); 26836 return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderedChildren.map((child) => { 26837 const key = getChildKey(child); 26838 const isPresent = propagate && !isParentPresent ? false : presentChildren === renderedChildren || presentKeys.includes(key); 26839 const onExit = () => { 26840 if (exitComplete.has(key)) { 26841 exitComplete.set(key, true); 26842 } else { 26843 return; 26844 } 26845 let isEveryExitComplete = true; 26846 exitComplete.forEach((isExitComplete) => { 26847 if (!isExitComplete) 26848 isEveryExitComplete = false; 26849 }); 26850 if (isEveryExitComplete) { 26851 forceRender?.(); 26852 setRenderedChildren(pendingPresentChildren.current); 26853 propagate && safeToRemove?.(); 26854 onExitComplete && onExitComplete(); 26855 } 26856 }; 26857 return jsxRuntimeExports.jsx(PresenceChild, { isPresent, initial: !isInitialRender.current || initial ? void 0 : false, custom, presenceAffectsLayout, mode, onExitComplete: isPresent ? void 0 : onExit, anchorX, children: child }, key); 26858 }) }); 26859}; 26860 26861function addUniqueItem(arr, item) { 26862 if (arr.indexOf(item) === -1) 26863 arr.push(item); 26864} 26865function removeItem(arr, item) { 26866 const index = arr.indexOf(item); 26867 if (index > -1) 26868 arr.splice(index, 1); 26869} 26870 26871const clamp = (min, max, v) => { 26872 if (v > max) 26873 return max; 26874 if (v < min) 26875 return min; 26876 return v; 26877}; 26878 26879let invariant = () => { 26880}; 26881 26882const MotionGlobalConfig = {}; 26883 26884/** 26885 * Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1" 26886 */ 26887const isNumericalString = (v) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v); 26888 26889/** 26890 * Check if the value is a zero value string like "0px" or "0%" 26891 */ 26892const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v); 26893 26894/*#__NO_SIDE_EFFECTS__*/ 26895function memo(callback) { 26896 let result; 26897 return () => { 26898 if (result === undefined) 26899 result = callback(); 26900 return result; 26901 }; 26902} 26903 26904/*#__NO_SIDE_EFFECTS__*/ 26905const noop = (any) => any; 26906 26907/** 26908 * Pipe 26909 * Compose other transformers to run linearily 26910 * pipe(min(20), max(40)) 26911 * @param {...functions} transformers 26912 * @return {function} 26913 */ 26914const combineFunctions = (a, b) => (v) => b(a(v)); 26915const pipe = (...transformers) => transformers.reduce(combineFunctions); 26916 26917/* 26918 Progress within given range 26919 26920 Given a lower limit and an upper limit, we return the progress 26921 (expressed as a number 0-1) represented by the given value, and 26922 limit that progress to within 0-1. 26923 26924 @param [number]: Lower limit 26925 @param [number]: Upper limit 26926 @param [number]: Value to find progress within given range 26927 @return [number]: Progress of value within range as expressed 0-1 26928*/ 26929/*#__NO_SIDE_EFFECTS__*/ 26930const progress = (from, to, value) => { 26931 const toFromDifference = to - from; 26932 return toFromDifference === 0 ? 1 : (value - from) / toFromDifference; 26933}; 26934 26935class SubscriptionManager { 26936 constructor() { 26937 this.subscriptions = []; 26938 } 26939 add(handler) { 26940 addUniqueItem(this.subscriptions, handler); 26941 return () => removeItem(this.subscriptions, handler); 26942 } 26943 notify(a, b, c) { 26944 const numSubscriptions = this.subscriptions.length; 26945 if (!numSubscriptions) 26946 return; 26947 if (numSubscriptions === 1) { 26948 /** 26949 * If there's only a single handler we can just call it without invoking a loop. 26950 */ 26951 this.subscriptions[0](a, b, c); 26952 } 26953 else { 26954 for (let i = 0; i < numSubscriptions; i++) { 26955 /** 26956 * Check whether the handler exists before firing as it's possible 26957 * the subscriptions were modified during this loop running. 26958 */ 26959 const handler = this.subscriptions[i]; 26960 handler && handler(a, b, c); 26961 } 26962 } 26963 } 26964 getSize() { 26965 return this.subscriptions.length; 26966 } 26967 clear() { 26968 this.subscriptions.length = 0; 26969 } 26970} 26971 26972/** 26973 * Converts seconds to milliseconds 26974 * 26975 * @param seconds - Time in seconds. 26976 * @return milliseconds - Converted time in milliseconds. 26977 */ 26978/*#__NO_SIDE_EFFECTS__*/ 26979const secondsToMilliseconds = (seconds) => seconds * 1000; 26980/*#__NO_SIDE_EFFECTS__*/ 26981const millisecondsToSeconds = (milliseconds) => milliseconds / 1000; 26982 26983/* 26984 Convert velocity into velocity per second 26985 26986 @param [number]: Unit per frame 26987 @param [number]: Frame duration in ms 26988*/ 26989function velocityPerSecond(velocity, frameDuration) { 26990 return frameDuration ? velocity * (1000 / frameDuration) : 0; 26991} 26992 26993/* 26994 Bezier function generator 26995 This has been modified from Gaëtan Renaudeau's BezierEasing 26996 https://github.com/gre/bezier-easing/blob/master/src/index.js 26997 https://github.com/gre/bezier-easing/blob/master/LICENSE 26998 26999 I've removed the newtonRaphsonIterate algo because in benchmarking it 27000 wasn't noticiably faster than binarySubdivision, indeed removing it 27001 usually improved times, depending on the curve. 27002 I also removed the lookup table, as for the added bundle size and loop we're 27003 only cutting ~4 or so subdivision iterations. I bumped the max iterations up 27004 to 12 to compensate and this still tended to be faster for no perceivable 27005 loss in accuracy. 27006 Usage 27007 const easeOut = cubicBezier(.17,.67,.83,.67); 27008 const x = easeOut(0.5); // returns 0.627... 27009*/ 27010// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2. 27011const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) * 27012 t; 27013const subdivisionPrecision = 0.0000001; 27014const subdivisionMaxIterations = 12; 27015function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) { 27016 let currentX; 27017 let currentT; 27018 let i = 0; 27019 do { 27020 currentT = lowerBound + (upperBound - lowerBound) / 2.0; 27021 currentX = calcBezier(currentT, mX1, mX2) - x; 27022 if (currentX > 0.0) { 27023 upperBound = currentT; 27024 } 27025 else { 27026 lowerBound = currentT; 27027 } 27028 } while (Math.abs(currentX) > subdivisionPrecision && 27029 ++i < subdivisionMaxIterations); 27030 return currentT; 27031} 27032function cubicBezier(mX1, mY1, mX2, mY2) { 27033 // If this is a linear gradient, return linear easing 27034 if (mX1 === mY1 && mX2 === mY2) 27035 return noop; 27036 const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2); 27037 // If animation is at start/end, return t without easing 27038 return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2); 27039} 27040 27041// Accepts an easing function and returns a new one that outputs mirrored values for 27042// the second half of the animation. Turns easeIn into easeInOut. 27043const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2; 27044 27045// Accepts an easing function and returns a new one that outputs reversed values. 27046// Turns easeIn into easeOut. 27047const reverseEasing = (easing) => (p) => 1 - easing(1 - p); 27048 27049const backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99); 27050const backIn = /*@__PURE__*/ reverseEasing(backOut); 27051const backInOut = /*@__PURE__*/ mirrorEasing(backIn); 27052 27053const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1))); 27054 27055const circIn = (p) => 1 - Math.sin(Math.acos(p)); 27056const circOut = reverseEasing(circIn); 27057const circInOut = mirrorEasing(circIn); 27058 27059const easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1); 27060const easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1); 27061const easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1); 27062 27063const isEasingArray = (ease) => { 27064 return Array.isArray(ease) && typeof ease[0] !== "number"; 27065}; 27066 27067const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number"; 27068 27069const easingLookup = { 27070 linear: noop, 27071 easeIn, 27072 easeInOut, 27073 easeOut, 27074 circIn, 27075 circInOut, 27076 circOut, 27077 backIn, 27078 backInOut, 27079 backOut, 27080 anticipate, 27081}; 27082const isValidEasing = (easing) => { 27083 return typeof easing === "string"; 27084}; 27085const easingDefinitionToFunction = (definition) => { 27086 if (isBezierDefinition(definition)) { 27087 // If cubic bezier definition, create bezier curve 27088 invariant(definition.length === 4); 27089 const [x1, y1, x2, y2] = definition; 27090 return cubicBezier(x1, y1, x2, y2); 27091 } 27092 else if (isValidEasing(definition)) { 27093 return easingLookup[definition]; 27094 } 27095 return definition; 27096}; 27097 27098const stepsOrder = [ 27099 "setup", // Compute 27100 "read", // Read 27101 "resolveKeyframes", // Write/Read/Write/Read 27102 "preUpdate", // Compute 27103 "update", // Compute 27104 "preRender", // Compute 27105 "render", // Write 27106 "postRender", // Compute 27107]; 27108 27109const statsBuffer = { 27110 value: null}; 27111 27112function createRenderStep(runNextFrame, stepName) { 27113 /** 27114 * We create and reuse two queues, one to queue jobs for the current frame 27115 * and one for the next. We reuse to avoid triggering GC after x frames. 27116 */ 27117 let thisFrame = new Set(); 27118 let nextFrame = new Set(); 27119 /** 27120 * Track whether we're currently processing jobs in this step. This way 27121 * we can decide whether to schedule new jobs for this frame or next. 27122 */ 27123 let isProcessing = false; 27124 let flushNextFrame = false; 27125 /** 27126 * A set of processes which were marked keepAlive when scheduled. 27127 */ 27128 const toKeepAlive = new WeakSet(); 27129 let latestFrameData = { 27130 delta: 0.0, 27131 timestamp: 0.0, 27132 isProcessing: false, 27133 }; 27134 let numCalls = 0; 27135 function triggerCallback(callback) { 27136 if (toKeepAlive.has(callback)) { 27137 step.schedule(callback); 27138 runNextFrame(); 27139 } 27140 numCalls++; 27141 callback(latestFrameData); 27142 } 27143 const step = { 27144 /** 27145 * Schedule a process to run on the next frame. 27146 */ 27147 schedule: (callback, keepAlive = false, immediate = false) => { 27148 const addToCurrentFrame = immediate && isProcessing; 27149 const queue = addToCurrentFrame ? thisFrame : nextFrame; 27150 if (keepAlive) 27151 toKeepAlive.add(callback); 27152 if (!queue.has(callback)) 27153 queue.add(callback); 27154 return callback; 27155 }, 27156 /** 27157 * Cancel the provided callback from running on the next frame. 27158 */ 27159 cancel: (callback) => { 27160 nextFrame.delete(callback); 27161 toKeepAlive.delete(callback); 27162 }, 27163 /** 27164 * Execute all schedule callbacks. 27165 */ 27166 process: (frameData) => { 27167 latestFrameData = frameData; 27168 /** 27169 * If we're already processing we've probably been triggered by a flushSync 27170 * inside an existing process. Instead of executing, mark flushNextFrame 27171 * as true and ensure we flush the following frame at the end of this one. 27172 */ 27173 if (isProcessing) { 27174 flushNextFrame = true; 27175 return; 27176 } 27177 isProcessing = true; 27178 [thisFrame, nextFrame] = [nextFrame, thisFrame]; 27179 // Execute this frame 27180 thisFrame.forEach(triggerCallback); 27181 /** 27182 * If we're recording stats then 27183 */ 27184 if (stepName && statsBuffer.value) { 27185 statsBuffer.value.frameloop[stepName].push(numCalls); 27186 } 27187 numCalls = 0; 27188 // Clear the frame so no callbacks remain. This is to avoid 27189 // memory leaks should this render step not run for a while. 27190 thisFrame.clear(); 27191 isProcessing = false; 27192 if (flushNextFrame) { 27193 flushNextFrame = false; 27194 step.process(frameData); 27195 } 27196 }, 27197 }; 27198 return step; 27199} 27200 27201const maxElapsed = 40; 27202function createRenderBatcher(scheduleNextBatch, allowKeepAlive) { 27203 let runNextFrame = false; 27204 let useDefaultElapsed = true; 27205 const state = { 27206 delta: 0.0, 27207 timestamp: 0.0, 27208 isProcessing: false, 27209 }; 27210 const flagRunNextFrame = () => (runNextFrame = true); 27211 const steps = stepsOrder.reduce((acc, key) => { 27212 acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined); 27213 return acc; 27214 }, {}); 27215 const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps; 27216 const processBatch = () => { 27217 const timestamp = MotionGlobalConfig.useManualTiming 27218 ? state.timestamp 27219 : performance.now(); 27220 runNextFrame = false; 27221 if (!MotionGlobalConfig.useManualTiming) { 27222 state.delta = useDefaultElapsed 27223 ? 1000 / 60 27224 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1); 27225 } 27226 state.timestamp = timestamp; 27227 state.isProcessing = true; 27228 // Unrolled render loop for better per-frame performance 27229 setup.process(state); 27230 read.process(state); 27231 resolveKeyframes.process(state); 27232 preUpdate.process(state); 27233 update.process(state); 27234 preRender.process(state); 27235 render.process(state); 27236 postRender.process(state); 27237 state.isProcessing = false; 27238 if (runNextFrame && allowKeepAlive) { 27239 useDefaultElapsed = false; 27240 scheduleNextBatch(processBatch); 27241 } 27242 }; 27243 const wake = () => { 27244 runNextFrame = true; 27245 useDefaultElapsed = true; 27246 if (!state.isProcessing) { 27247 scheduleNextBatch(processBatch); 27248 } 27249 }; 27250 const schedule = stepsOrder.reduce((acc, key) => { 27251 const step = steps[key]; 27252 acc[key] = (process, keepAlive = false, immediate = false) => { 27253 if (!runNextFrame) 27254 wake(); 27255 return step.schedule(process, keepAlive, immediate); 27256 }; 27257 return acc; 27258 }, {}); 27259 const cancel = (process) => { 27260 for (let i = 0; i < stepsOrder.length; i++) { 27261 steps[stepsOrder[i]].cancel(process); 27262 } 27263 }; 27264 return { schedule, cancel, state, steps }; 27265} 27266 27267const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true); 27268 27269let now$1; 27270function clearTime() { 27271 now$1 = undefined; 27272} 27273/** 27274 * An eventloop-synchronous alternative to performance.now(). 27275 * 27276 * Ensures that time measurements remain consistent within a synchronous context. 27277 * Usually calling performance.now() twice within the same synchronous context 27278 * will return different values which isn't useful for animations when we're usually 27279 * trying to sync animations to the same frame. 27280 */ 27281const time = { 27282 now: () => { 27283 if (now$1 === undefined) { 27284 time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming 27285 ? frameData.timestamp 27286 : performance.now()); 27287 } 27288 return now$1; 27289 }, 27290 set: (newTime) => { 27291 now$1 = newTime; 27292 queueMicrotask(clearTime); 27293 }, 27294}; 27295 27296const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token); 27297const isCSSVariableName = 27298/*@__PURE__*/ checkStringStartsWith("--"); 27299const startsAsVariableToken = 27300/*@__PURE__*/ checkStringStartsWith("var(--"); 27301const isCSSVariableToken = (value) => { 27302 const startsWithToken = startsAsVariableToken(value); 27303 if (!startsWithToken) 27304 return false; 27305 // Ensure any comments are stripped from the value as this can harm performance of the regex. 27306 return singleCssVariableRegex.test(value.split("/*")[0].trim()); 27307}; 27308const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu; 27309 27310const number = { 27311 test: (v) => typeof v === "number", 27312 parse: parseFloat, 27313 transform: (v) => v, 27314}; 27315const alpha = { 27316 ...number, 27317 transform: (v) => clamp(0, 1, v), 27318}; 27319const scale = { 27320 ...number, 27321 default: 1, 27322}; 27323 27324// If this number is a decimal, make it just five decimal places 27325// to avoid exponents 27326const sanitize = (v) => Math.round(v * 100000) / 100000; 27327 27328const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; 27329 27330function isNullish(v) { 27331 return v == null; 27332} 27333 27334const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu; 27335 27336/** 27337 * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000, 27338 * but false if a number or multiple colors 27339 */ 27340const isColorString = (type, testProp) => (v) => { 27341 return Boolean((typeof v === "string" && 27342 singleColorRegex.test(v) && 27343 v.startsWith(type)) || 27344 (testProp && 27345 !isNullish(v) && 27346 Object.prototype.hasOwnProperty.call(v, testProp))); 27347}; 27348const splitColor = (aName, bName, cName) => (v) => { 27349 if (typeof v !== "string") 27350 return v; 27351 const [a, b, c, alpha] = v.match(floatRegex); 27352 return { 27353 [aName]: parseFloat(a), 27354 [bName]: parseFloat(b), 27355 [cName]: parseFloat(c), 27356 alpha: alpha !== undefined ? parseFloat(alpha) : 1, 27357 }; 27358}; 27359 27360const clampRgbUnit = (v) => clamp(0, 255, v); 27361const rgbUnit = { 27362 ...number, 27363 transform: (v) => Math.round(clampRgbUnit(v)), 27364}; 27365const rgba = { 27366 test: /*@__PURE__*/ isColorString("rgb", "red"), 27367 parse: /*@__PURE__*/ splitColor("red", "green", "blue"), 27368 transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" + 27369 rgbUnit.transform(red) + 27370 ", " + 27371 rgbUnit.transform(green) + 27372 ", " + 27373 rgbUnit.transform(blue) + 27374 ", " + 27375 sanitize(alpha.transform(alpha$1)) + 27376 ")", 27377}; 27378 27379function parseHex(v) { 27380 let r = ""; 27381 let g = ""; 27382 let b = ""; 27383 let a = ""; 27384 // If we have 6 characters, ie #FF0000 27385 if (v.length > 5) { 27386 r = v.substring(1, 3); 27387 g = v.substring(3, 5); 27388 b = v.substring(5, 7); 27389 a = v.substring(7, 9); 27390 // Or we have 3 characters, ie #F00 27391 } 27392 else { 27393 r = v.substring(1, 2); 27394 g = v.substring(2, 3); 27395 b = v.substring(3, 4); 27396 a = v.substring(4, 5); 27397 r += r; 27398 g += g; 27399 b += b; 27400 a += a; 27401 } 27402 return { 27403 red: parseInt(r, 16), 27404 green: parseInt(g, 16), 27405 blue: parseInt(b, 16), 27406 alpha: a ? parseInt(a, 16) / 255 : 1, 27407 }; 27408} 27409const hex = { 27410 test: /*@__PURE__*/ isColorString("#"), 27411 parse: parseHex, 27412 transform: rgba.transform, 27413}; 27414 27415/*#__NO_SIDE_EFFECTS__*/ 27416const createUnitType = (unit) => ({ 27417 test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1, 27418 parse: parseFloat, 27419 transform: (v) => `${v}${unit}`, 27420}); 27421const degrees = /*@__PURE__*/ createUnitType("deg"); 27422const percent = /*@__PURE__*/ createUnitType("%"); 27423const px = /*@__PURE__*/ createUnitType("px"); 27424const vh = /*@__PURE__*/ createUnitType("vh"); 27425const vw = /*@__PURE__*/ createUnitType("vw"); 27426const progressPercentage = /*@__PURE__*/ (() => ({ 27427 ...percent, 27428 parse: (v) => percent.parse(v) / 100, 27429 transform: (v) => percent.transform(v * 100), 27430}))(); 27431 27432const hsla = { 27433 test: /*@__PURE__*/ isColorString("hsl", "hue"), 27434 parse: /*@__PURE__*/ splitColor("hue", "saturation", "lightness"), 27435 transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => { 27436 return ("hsla(" + 27437 Math.round(hue) + 27438 ", " + 27439 percent.transform(sanitize(saturation)) + 27440 ", " + 27441 percent.transform(sanitize(lightness)) + 27442 ", " + 27443 sanitize(alpha.transform(alpha$1)) + 27444 ")"); 27445 }, 27446}; 27447 27448const color = { 27449 test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v), 27450 parse: (v) => { 27451 if (rgba.test(v)) { 27452 return rgba.parse(v); 27453 } 27454 else if (hsla.test(v)) { 27455 return hsla.parse(v); 27456 } 27457 else { 27458 return hex.parse(v); 27459 } 27460 }, 27461 transform: (v) => { 27462 return typeof v === "string" 27463 ? v 27464 : v.hasOwnProperty("red") 27465 ? rgba.transform(v) 27466 : hsla.transform(v); 27467 }, 27468}; 27469 27470const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; 27471 27472function test(v) { 27473 return (isNaN(v) && 27474 typeof v === "string" && 27475 (v.match(floatRegex)?.length || 0) + 27476 (v.match(colorRegex)?.length || 0) > 27477 0); 27478} 27479const NUMBER_TOKEN = "number"; 27480const COLOR_TOKEN = "color"; 27481const VAR_TOKEN = "var"; 27482const VAR_FUNCTION_TOKEN = "var("; 27483const SPLIT_TOKEN = "${}"; 27484// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex` 27485const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; 27486function analyseComplexValue(value) { 27487 const originalValue = value.toString(); 27488 const values = []; 27489 const indexes = { 27490 color: [], 27491 number: [], 27492 var: [], 27493 }; 27494 const types = []; 27495 let i = 0; 27496 const tokenised = originalValue.replace(complexRegex, (parsedValue) => { 27497 if (color.test(parsedValue)) { 27498 indexes.color.push(i); 27499 types.push(COLOR_TOKEN); 27500 values.push(color.parse(parsedValue)); 27501 } 27502 else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) { 27503 indexes.var.push(i); 27504 types.push(VAR_TOKEN); 27505 values.push(parsedValue); 27506 } 27507 else { 27508 indexes.number.push(i); 27509 types.push(NUMBER_TOKEN); 27510 values.push(parseFloat(parsedValue)); 27511 } 27512 ++i; 27513 return SPLIT_TOKEN; 27514 }); 27515 const split = tokenised.split(SPLIT_TOKEN); 27516 return { values, split, indexes, types }; 27517} 27518function parseComplexValue(v) { 27519 return analyseComplexValue(v).values; 27520} 27521function createTransformer(source) { 27522 const { split, types } = analyseComplexValue(source); 27523 const numSections = split.length; 27524 return (v) => { 27525 let output = ""; 27526 for (let i = 0; i < numSections; i++) { 27527 output += split[i]; 27528 if (v[i] !== undefined) { 27529 const type = types[i]; 27530 if (type === NUMBER_TOKEN) { 27531 output += sanitize(v[i]); 27532 } 27533 else if (type === COLOR_TOKEN) { 27534 output += color.transform(v[i]); 27535 } 27536 else { 27537 output += v[i]; 27538 } 27539 } 27540 } 27541 return output; 27542 }; 27543} 27544const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v; 27545function getAnimatableNone$1(v) { 27546 const parsed = parseComplexValue(v); 27547 const transformer = createTransformer(v); 27548 return transformer(parsed.map(convertNumbersToZero)); 27549} 27550const complex = { 27551 test, 27552 parse: parseComplexValue, 27553 createTransformer, 27554 getAnimatableNone: getAnimatableNone$1, 27555}; 27556 27557// Adapted from https://gist.github.com/mjackson/5311256 27558function hueToRgb(p, q, t) { 27559 if (t < 0) 27560 t += 1; 27561 if (t > 1) 27562 t -= 1; 27563 if (t < 1 / 6) 27564 return p + (q - p) * 6 * t; 27565 if (t < 1 / 2) 27566 return q; 27567 if (t < 2 / 3) 27568 return p + (q - p) * (2 / 3 - t) * 6; 27569 return p; 27570} 27571function hslaToRgba({ hue, saturation, lightness, alpha }) { 27572 hue /= 360; 27573 saturation /= 100; 27574 lightness /= 100; 27575 let red = 0; 27576 let green = 0; 27577 let blue = 0; 27578 if (!saturation) { 27579 red = green = blue = lightness; 27580 } 27581 else { 27582 const q = lightness < 0.5 27583 ? lightness * (1 + saturation) 27584 : lightness + saturation - lightness * saturation; 27585 const p = 2 * lightness - q; 27586 red = hueToRgb(p, q, hue + 1 / 3); 27587 green = hueToRgb(p, q, hue); 27588 blue = hueToRgb(p, q, hue - 1 / 3); 27589 } 27590 return { 27591 red: Math.round(red * 255), 27592 green: Math.round(green * 255), 27593 blue: Math.round(blue * 255), 27594 alpha, 27595 }; 27596} 27597 27598function mixImmediate(a, b) { 27599 return (p) => (p > 0 ? b : a); 27600} 27601 27602/*
27603 Value in range from progress 27604 27605 Given a lower limit and an upper limit, we return the value within 27606 that range as expressed by progress (usually a number from 0 to 1) 27607 27608 So progress = 0.5 would change 27609 27610 from -------- to 27611 27612 to 27613 27614 from ---- to 27615 27616 E.g. from = 10, to = 20, progress = 0.5 => 15 27617 27618 @param [number]: Lower limit of range 27619 @param [number]: Upper limit of range 27620 @param [number]: The progress between lower and upper limits expressed 0-1 27621 @return [number]: Value as calculated from progress within range (not limited within range) 27622*/ 27623const mixNumber$1 = (from, to, progress) => { 27624 return from + (to - from) * progress; 27625}; 27626 27627// Linear color space blending 27628// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw 27629// Demonstrated http://codepen.io/osublake/pen/xGVVaN 27630const mixLinearColor = (from, to, v) => { 27631 const fromExpo = from * from; 27632 const expo = v * (to * to - fromExpo) + fromExpo; 27633 return expo < 0 ? 0 : Math.sqrt(expo); 27634}; 27635const colorTypes = [hex, rgba, hsla]; 27636const getColorType = (v) => colorTypes.find((type) => type.test(v)); 27637function asRGBA(color) { 27638 const type = getColorType(color); 27639 if (!Boolean(type)) 27640 return false; 27641 let model = type.parse(color); 27642 if (type === hsla) { 27643 // TODO Remove this cast - needed since Motion's stricter typing 27644 model = hslaToRgba(model); 27645 } 27646 return model; 27647} 27648const mixColor = (from, to) => { 27649 const fromRGBA = asRGBA(from); 27650 const toRGBA = asRGBA(to); 27651 if (!fromRGBA || !toRGBA) { 27652 return mixImmediate(from, to); 27653 } 27654 const blended = { ...fromRGBA }; 27655 return (v) => { 27656 blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v); 27657 blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v); 27658 blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v); 27659 blended.alpha = mixNumber$1(fromRGBA.alpha, toRGBA.alpha, v); 27660 return rgba.transform(blended); 27661 }; 27662}; 27663 27664const invisibleValues = new Set(["none", "hidden"]); 27665/** 27666 * Returns a function that, when provided a progress value between 0 and 1, 27667 * will return the "none" or "hidden" string only when the progress is that of 27668 * the origin or target. 27669 */ 27670function mixVisibility(origin, target) { 27671 if (invisibleValues.has(origin)) { 27672 return (p) => (p <= 0 ? origin : target); 27673 } 27674 else { 27675 return (p) => (p >= 1 ? target : origin); 27676 } 27677} 27678 27679function mixNumber(a, b) { 27680 return (p) => mixNumber$1(a, b, p); 27681} 27682function getMixer(a) { 27683 if (typeof a === "number") { 27684 return mixNumber; 27685 } 27686 else if (typeof a === "string") { 27687 return isCSSVariableToken(a) 27688 ? mixImmediate 27689 : color.test(a) 27690 ? mixColor 27691 : mixComplex; 27692 } 27693 else if (Array.isArray(a)) { 27694 return mixArray; 27695 } 27696 else if (typeof a === "object") { 27697 return color.test(a) ? mixColor : mixObject; 27698 } 27699 return mixImmediate; 27700} 27701function mixArray(a, b) { 27702 const output = [...a]; 27703 const numValues = output.length; 27704 const blendValue = a.map((v, i) => getMixer(v)(v, b[i])); 27705 return (p) => { 27706 for (let i = 0; i < numValues; i++) { 27707 output[i] = blendValue[i](p); 27708 } 27709 return output; 27710 }; 27711} 27712function mixObject(a, b) { 27713 const output = { ...a, ...b }; 27714 const blendValue = {}; 27715 for (const key in output) { 27716 if (a[key] !== undefined && b[key] !== undefined) { 27717 blendValue[key] = getMixer(a[key])(a[key], b[key]); 27718 } 27719 } 27720 return (v) => { 27721 for (const key in blendValue) { 27722 output[key] = blendValue[key](v); 27723 } 27724 return output; 27725 }; 27726} 27727function matchOrder(origin, target) { 27728 const orderedOrigin = []; 27729 const pointers = { color: 0, var: 0, number: 0 }; 27730 for (let i = 0; i < target.values.length; i++) { 27731 const type = target.types[i]; 27732 const originIndex = origin.indexes[type][pointers[type]]; 27733 const originValue = origin.values[originIndex] ?? 0; 27734 orderedOrigin[i] = originValue; 27735 pointers[type]++; 27736 } 27737 return orderedOrigin; 27738} 27739const mixComplex = (origin, target) => { 27740 const template = complex.createTransformer(target);
vendor: 22,968 bytes, lines 27741-28381
27741 const originStats = analyseComplexValue(origin); 27742 const targetStats = analyseComplexValue(target); 27743 const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length && 27744 originStats.indexes.color.length === targetStats.indexes.color.length && 27745 originStats.indexes.number.length >= targetStats.indexes.number.length; 27746 if (canInterpolate) { 27747 if ((invisibleValues.has(origin) && 27748 !targetStats.values.length) || 27749 (invisibleValues.has(target) && 27750 !originStats.values.length)) { 27751 return mixVisibility(origin, target); 27752 } 27753 return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template); 27754 } 27755 else { 27756 return mixImmediate(origin, target); 27757 } 27758}; 27759 27760function mix(from, to, p) { 27761 if (typeof from === "number" && 27762 typeof to === "number" && 27763 typeof p === "number") { 27764 return mixNumber$1(from, to, p); 27765 } 27766 const mixer = getMixer(from); 27767 return mixer(from, to); 27768} 27769 27770const frameloopDriver = (update) => { 27771 const passTimestamp = ({ timestamp }) => update(timestamp); 27772 return { 27773 start: (keepAlive = true) => frame.update(passTimestamp, keepAlive), 27774 stop: () => cancelFrame(passTimestamp), 27775 /** 27776 * If we're processing this frame we can use the 27777 * framelocked timestamp to keep things in sync. 27778 */ 27779 now: () => (frameData.isProcessing ? frameData.timestamp : time.now()), 27780 }; 27781}; 27782 27783const generateLinearEasing = (easing, duration, // as milliseconds 27784resolution = 10 // as milliseconds 27785) => { 27786 let points = ""; 27787 const numPoints = Math.max(Math.round(duration / resolution), 2); 27788 for (let i = 0; i < numPoints; i++) { 27789 points += easing(i / (numPoints - 1)) + ", "; 27790 } 27791 return `linear(${points.substring(0, points.length - 2)})`; 27792}; 27793 27794/** 27795 * Implement a practical max duration for keyframe generation 27796 * to prevent infinite loops 27797 */ 27798const maxGeneratorDuration = 20000; 27799function calcGeneratorDuration(generator) { 27800 let duration = 0; 27801 const timeStep = 50; 27802 let state = generator.next(duration); 27803 while (!state.done && duration < maxGeneratorDuration) { 27804 duration += timeStep; 27805 state = generator.next(duration); 27806 } 27807 return duration >= maxGeneratorDuration ? Infinity : duration; 27808} 27809 27810/** 27811 * Create a progress => progress easing function from a generator. 27812 */ 27813function createGeneratorEasing(options, scale = 100, createGenerator) { 27814 const generator = createGenerator({ ...options, keyframes: [0, scale] }); 27815 const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration); 27816 return { 27817 type: "keyframes", 27818 ease: (progress) => { 27819 return generator.next(duration * progress).value / scale; 27820 }, 27821 duration: millisecondsToSeconds(duration), 27822 }; 27823} 27824 27825const velocitySampleDuration = 5; // ms 27826function calcGeneratorVelocity(resolveValue, t, current) { 27827 const prevT = Math.max(t - velocitySampleDuration, 0); 27828 return velocityPerSecond(current - resolveValue(prevT), t - prevT); 27829} 27830 27831const springDefaults = { 27832 // Default spring physics 27833 stiffness: 100, 27834 damping: 10, 27835 mass: 1.0, 27836 velocity: 0.0, 27837 // Default duration/bounce-based options 27838 duration: 800, // in ms 27839 bounce: 0.3, 27840 visualDuration: 0.3, // in seconds 27841 // Rest thresholds 27842 restSpeed: { 27843 granular: 0.01, 27844 default: 2, 27845 }, 27846 restDelta: { 27847 granular: 0.005, 27848 default: 0.5, 27849 }, 27850 // Limits 27851 minDuration: 0.01, // in seconds 27852 maxDuration: 10.0, // in seconds 27853 minDamping: 0.05, 27854 maxDamping: 1, 27855}; 27856 27857const safeMin = 0.001; 27858function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) { 27859 let envelope; 27860 let derivative; 27861 let dampingRatio = 1 - bounce; 27862 /** 27863 * Restrict dampingRatio and duration to within acceptable ranges. 27864 */ 27865 dampingRatio = clamp(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio); 27866 duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, millisecondsToSeconds(duration)); 27867 if (dampingRatio < 1) { 27868 /** 27869 * Underdamped spring 27870 */ 27871 envelope = (undampedFreq) => { 27872 const exponentialDecay = undampedFreq * dampingRatio; 27873 const delta = exponentialDecay * duration; 27874 const a = exponentialDecay - velocity; 27875 const b = calcAngularFreq(undampedFreq, dampingRatio); 27876 const c = Math.exp(-delta); 27877 return safeMin - (a / b) * c; 27878 }; 27879 derivative = (undampedFreq) => { 27880 const exponentialDecay = undampedFreq * dampingRatio; 27881 const delta = exponentialDecay * duration; 27882 const d = delta * velocity + velocity; 27883 const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration; 27884 const f = Math.exp(-delta); 27885 const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio); 27886 const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1; 27887 return (factor * ((d - e) * f)) / g; 27888 }; 27889 } 27890 else { 27891 /** 27892 * Critically-damped spring 27893 */ 27894 envelope = (undampedFreq) => { 27895 const a = Math.exp(-undampedFreq * duration); 27896 const b = (undampedFreq - velocity) * duration + 1; 27897 return -1e-3 + a * b; 27898 }; 27899 derivative = (undampedFreq) => { 27900 const a = Math.exp(-undampedFreq * duration); 27901 const b = (velocity - undampedFreq) * (duration * duration); 27902 return a * b; 27903 }; 27904 } 27905 const initialGuess = 5 / duration; 27906 const undampedFreq = approximateRoot(envelope, derivative, initialGuess); 27907 duration = secondsToMilliseconds(duration); 27908 if (isNaN(undampedFreq)) { 27909 return { 27910 stiffness: springDefaults.stiffness, 27911 damping: springDefaults.damping, 27912 duration, 27913 }; 27914 } 27915 else { 27916 const stiffness = Math.pow(undampedFreq, 2) * mass; 27917 return { 27918 stiffness, 27919 damping: dampingRatio * 2 * Math.sqrt(mass * stiffness), 27920 duration, 27921 }; 27922 } 27923} 27924const rootIterations = 12; 27925function approximateRoot(envelope, derivative, initialGuess) { 27926 let result = initialGuess; 27927 for (let i = 1; i < rootIterations; i++) { 27928 result = result - envelope(result) / derivative(result); 27929 } 27930 return result; 27931} 27932function calcAngularFreq(undampedFreq, dampingRatio) { 27933 return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio); 27934} 27935 27936const durationKeys = ["duration", "bounce"]; 27937const physicsKeys = ["stiffness", "damping", "mass"]; 27938function isSpringType(options, keys) { 27939 return keys.some((key) => options[key] !== undefined); 27940} 27941function getSpringOptions(options) { 27942 let springOptions = { 27943 velocity: springDefaults.velocity, 27944 stiffness: springDefaults.stiffness, 27945 damping: springDefaults.damping, 27946 mass: springDefaults.mass, 27947 isResolvedFromDuration: false, 27948 ...options, 27949 }; 27950 // stiffness/damping/mass overrides duration/bounce 27951 if (!isSpringType(options, physicsKeys) && 27952 isSpringType(options, durationKeys)) { 27953 if (options.visualDuration) { 27954 const visualDuration = options.visualDuration; 27955 const root = (2 * Math.PI) / (visualDuration * 1.2); 27956 const stiffness = root * root; 27957 const damping = 2 * 27958 clamp(0.05, 1, 1 - (options.bounce || 0)) * 27959 Math.sqrt(stiffness); 27960 springOptions = { 27961 ...springOptions, 27962 mass: springDefaults.mass, 27963 stiffness, 27964 damping, 27965 }; 27966 } 27967 else { 27968 const derived = findSpring(options); 27969 springOptions = { 27970 ...springOptions, 27971 ...derived, 27972 mass: springDefaults.mass, 27973 }; 27974 springOptions.isResolvedFromDuration = true; 27975 } 27976 } 27977 return springOptions; 27978} 27979function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) { 27980 const options = typeof optionsOrVisualDuration !== "object" 27981 ? { 27982 visualDuration: optionsOrVisualDuration, 27983 keyframes: [0, 1], 27984 bounce, 27985 } 27986 : optionsOrVisualDuration; 27987 let { restSpeed, restDelta } = options; 27988 const origin = options.keyframes[0]; 27989 const target = options.keyframes[options.keyframes.length - 1]; 27990 /** 27991 * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator 27992 * to reduce GC during animation. 27993 */ 27994 const state = { done: false, value: origin }; 27995 const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration, } = getSpringOptions({ 27996 ...options, 27997 velocity: -millisecondsToSeconds(options.velocity || 0), 27998 }); 27999 const initialVelocity = velocity || 0.0; 28000 const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass)); 28001 const initialDelta = target - origin; 28002 const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass)); 28003 /** 28004 * If we're working on a granular scale, use smaller defaults for determining 28005 * when the spring is finished. 28006 * 28007 * These defaults have been selected emprically based on what strikes a good 28008 * ratio between feeling good and finishing as soon as changes are imperceptible. 28009 */ 28010 const isGranularScale = Math.abs(initialDelta) < 5; 28011 restSpeed || (restSpeed = isGranularScale 28012 ? springDefaults.restSpeed.granular 28013 : springDefaults.restSpeed.default); 28014 restDelta || (restDelta = isGranularScale 28015 ? springDefaults.restDelta.granular 28016 : springDefaults.restDelta.default); 28017 let resolveSpring; 28018 if (dampingRatio < 1) { 28019 const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio); 28020 // Underdamped spring 28021 resolveSpring = (t) => { 28022 const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t); 28023 return (target - 28024 envelope * 28025 (((initialVelocity + 28026 dampingRatio * undampedAngularFreq * initialDelta) / 28027 angularFreq) * 28028 Math.sin(angularFreq * t) + 28029 initialDelta * Math.cos(angularFreq * t))); 28030 }; 28031 } 28032 else if (dampingRatio === 1) { 28033 // Critically damped spring 28034 resolveSpring = (t) => target - 28035 Math.exp(-undampedAngularFreq * t) * 28036 (initialDelta + 28037 (initialVelocity + undampedAngularFreq * initialDelta) * t); 28038 } 28039 else { 28040 // Overdamped spring 28041 const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1); 28042 resolveSpring = (t) => { 28043 const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t); 28044 // When performing sinh or cosh values can hit Infinity so we cap them here 28045 const freqForT = Math.min(dampedAngularFreq * t, 300); 28046 return (target - 28047 (envelope * 28048 ((initialVelocity + 28049 dampingRatio * undampedAngularFreq * initialDelta) * 28050 Math.sinh(freqForT) + 28051 dampedAngularFreq * 28052 initialDelta * 28053 Math.cosh(freqForT))) / 28054 dampedAngularFreq); 28055 }; 28056 } 28057 const generator = { 28058 calculatedDuration: isResolvedFromDuration ? duration || null : null, 28059 next: (t) => { 28060 const current = resolveSpring(t); 28061 if (!isResolvedFromDuration) { 28062 let currentVelocity = t === 0 ? initialVelocity : 0.0; 28063 /** 28064 * We only need to calculate velocity for under-damped springs 28065 * as over- and critically-damped springs can't overshoot, so 28066 * checking only for displacement is enough. 28067 */ 28068 if (dampingRatio < 1) { 28069 currentVelocity = 28070 t === 0 28071 ? secondsToMilliseconds(initialVelocity) 28072 : calcGeneratorVelocity(resolveSpring, t, current); 28073 } 28074 const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed; 28075 const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta; 28076 state.done = 28077 isBelowVelocityThreshold && isBelowDisplacementThreshold; 28078 } 28079 else { 28080 state.done = t >= duration; 28081 } 28082 state.value = state.done ? target : current; 28083 return state; 28084 }, 28085 toString: () => { 28086 const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration); 28087 const easing = generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30); 28088 return calculatedDuration + "ms " + easing; 28089 }, 28090 toTransition: () => { }, 28091 }; 28092 return generator; 28093} 28094spring.applyToOptions = (options) => { 28095 const generatorOptions = createGeneratorEasing(options, 100, spring); 28096 options.ease = generatorOptions.ease; 28097 options.duration = secondsToMilliseconds(generatorOptions.duration); 28098 options.type = "keyframes"; 28099 return options; 28100}; 28101 28102function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) { 28103 const origin = keyframes[0]; 28104 const state = { 28105 done: false, 28106 value: origin, 28107 }; 28108 const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max); 28109 const nearestBoundary = (v) => { 28110 if (min === undefined) 28111 return max; 28112 if (max === undefined) 28113 return min; 28114 return Math.abs(min - v) < Math.abs(max - v) ? min : max; 28115 }; 28116 let amplitude = power * velocity; 28117 const ideal = origin + amplitude; 28118 const target = modifyTarget === undefined ? ideal : modifyTarget(ideal); 28119 /** 28120 * If the target has changed we need to re-calculate the amplitude, otherwise 28121 * the animation will start from the wrong position. 28122 */ 28123 if (target !== ideal) 28124 amplitude = target - origin; 28125 const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant); 28126 const calcLatest = (t) => target + calcDelta(t); 28127 const applyFriction = (t) => { 28128 const delta = calcDelta(t); 28129 const latest = calcLatest(t); 28130 state.done = Math.abs(delta) <= restDelta; 28131 state.value = state.done ? target : latest; 28132 }; 28133 /** 28134 * Ideally this would resolve for t in a stateless way, we could 28135 * do that by always precalculating the animation but as we know 28136 * this will be done anyway we can assume that spring will 28137 * be discovered during that. 28138 */ 28139 let timeReachedBoundary; 28140 let spring$1; 28141 const checkCatchBoundary = (t) => { 28142 if (!isOutOfBounds(state.value)) 28143 return; 28144 timeReachedBoundary = t; 28145 spring$1 = spring({ 28146 keyframes: [state.value, nearestBoundary(state.value)], 28147 velocity: calcGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000 28148 damping: bounceDamping, 28149 stiffness: bounceStiffness, 28150 restDelta, 28151 restSpeed, 28152 }); 28153 }; 28154 checkCatchBoundary(0); 28155 return { 28156 calculatedDuration: null, 28157 next: (t) => { 28158 /** 28159 * We need to resolve the friction to figure out if we need a 28160 * spring but we don't want to do this twice per frame. So here 28161 * we flag if we updated for this frame and later if we did 28162 * we can skip doing it again. 28163 */ 28164 let hasUpdatedFrame = false; 28165 if (!spring$1 && timeReachedBoundary === undefined) { 28166 hasUpdatedFrame = true; 28167 applyFriction(t); 28168 checkCatchBoundary(t); 28169 } 28170 /** 28171 * If we have a spring and the provided t is beyond the moment the friction 28172 * animation crossed the min/max boundary, use the spring. 28173 */ 28174 if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) { 28175 return spring$1.next(t - timeReachedBoundary); 28176 } 28177 else { 28178 !hasUpdatedFrame && applyFriction(t); 28179 return state; 28180 } 28181 }, 28182 }; 28183} 28184 28185function createMixers(output, ease, customMixer) { 28186 const mixers = []; 28187 const mixerFactory = customMixer || MotionGlobalConfig.mix || mix; 28188 const numMixers = output.length - 1; 28189 for (let i = 0; i < numMixers; i++) { 28190 let mixer = mixerFactory(output[i], output[i + 1]); 28191 if (ease) { 28192 const easingFunction = Array.isArray(ease) ? ease[i] || noop : ease; 28193 mixer = pipe(easingFunction, mixer); 28194 } 28195 mixers.push(mixer); 28196 } 28197 return mixers; 28198} 28199/** 28200 * Create a function that maps from a numerical input array to a generic output array. 28201 * 28202 * Accepts: 28203 * - Numbers 28204 * - Colors (hex, hsl, hsla, rgb, rgba) 28205 * - Complex (combinations of one or more numbers or strings) 28206 * 28207 * ```jsx 28208 * const mixColor = interpolate([0, 1], ['#fff', '#000']) 28209 * 28210 * mixColor(0.5) // 'rgba(128, 128, 128, 1)' 28211 * ``` 28212 * 28213 * TODO Revist this approach once we've moved to data models for values, 28214 * probably not needed to pregenerate mixer functions. 28215 * 28216 * @public 28217 */ 28218function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) { 28219 const inputLength = input.length; 28220 invariant(inputLength === output.length); 28221 /** 28222 * If we're only provided a single input, we can just make a function 28223 * that returns the output. 28224 */ 28225 if (inputLength === 1) 28226 return () => output[0]; 28227 if (inputLength === 2 && output[0] === output[1]) 28228 return () => output[1]; 28229 const isZeroDeltaRange = input[0] === input[1]; 28230 // If input runs highest -> lowest, reverse both arrays 28231 if (input[0] > input[inputLength - 1]) { 28232 input = [...input].reverse(); 28233 output = [...output].reverse(); 28234 } 28235 const mixers = createMixers(output, ease, mixer); 28236 const numMixers = mixers.length; 28237 const interpolator = (v) => { 28238 if (isZeroDeltaRange && v < input[0]) 28239 return output[0]; 28240 let i = 0; 28241 if (numMixers > 1) { 28242 for (; i < input.length - 2; i++) { 28243 if (v < input[i + 1]) 28244 break; 28245 } 28246 } 28247 const progressInRange = progress(input[i], input[i + 1], v); 28248 return mixers[i](progressInRange); 28249 }; 28250 return isClamp 28251 ? (v) => interpolator(clamp(input[0], input[inputLength - 1], v)) 28252 : interpolator; 28253} 28254 28255function fillOffset(offset, remaining) { 28256 const min = offset[offset.length - 1]; 28257 for (let i = 1; i <= remaining; i++) { 28258 const offsetProgress = progress(0, remaining, i); 28259 offset.push(mixNumber$1(min, 1, offsetProgress)); 28260 } 28261} 28262 28263function defaultOffset(arr) { 28264 const offset = [0]; 28265 fillOffset(offset, arr.length - 1); 28266 return offset; 28267} 28268 28269function convertOffsetToTimes(offset, duration) { 28270 return offset.map((o) => o * duration); 28271} 28272 28273function defaultEasing(values, easing) { 28274 return values.map(() => easing || easeInOut).splice(0, values.length - 1); 28275} 28276function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut", }) { 28277 /** 28278 * Easing functions can be externally defined as strings. Here we convert them 28279 * into actual functions. 28280 */ 28281 const easingFunctions = isEasingArray(ease) 28282 ? ease.map(easingDefinitionToFunction) 28283 : easingDefinitionToFunction(ease); 28284 /** 28285 * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator 28286 * to reduce GC during animation. 28287 */ 28288 const state = { 28289 done: false, 28290 value: keyframeValues[0], 28291 }; 28292 /** 28293 * Create a times array based on the provided 0-1 offsets 28294 */ 28295 const absoluteTimes = convertOffsetToTimes( 28296 // Only use the provided offsets if they're the correct length 28297 // TODO Maybe we should warn here if there's a length mismatch 28298 times && times.length === keyframeValues.length 28299 ? times 28300 : defaultOffset(keyframeValues), duration); 28301 const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, { 28302 ease: Array.isArray(easingFunctions) 28303 ? easingFunctions 28304 : defaultEasing(keyframeValues, easingFunctions), 28305 }); 28306 return { 28307 calculatedDuration: duration, 28308 next: (t) => { 28309 state.value = mapTimeToKeyframe(t); 28310 state.done = t >= duration; 28311 return state; 28312 }, 28313 }; 28314} 28315 28316const isNotNull$1 = (value) => value !== null; 28317function getFinalKeyframe$1(keyframes, { repeat, repeatType = "loop" }, finalKeyframe, speed = 1) { 28318 const resolvedKeyframes = keyframes.filter(isNotNull$1); 28319 const useFirstKeyframe = speed < 0 || (repeat && repeatType !== "loop" && repeat % 2 === 1); 28320 const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1; 28321 return !index || finalKeyframe === undefined 28322 ? resolvedKeyframes[index] 28323 : finalKeyframe; 28324} 28325 28326const transitionTypeMap = { 28327 decay: inertia, 28328 inertia, 28329 tween: keyframes, 28330 keyframes: keyframes, 28331 spring, 28332}; 28333function replaceTransitionType(transition) { 28334 if (typeof transition.type === "string") { 28335 transition.type = transitionTypeMap[transition.type]; 28336 } 28337} 28338 28339class WithPromise { 28340 constructor() { 28341 this.updateFinished(); 28342 } 28343 get finished() { 28344 return this._finished; 28345 } 28346 updateFinished() { 28347 this._finished = new Promise((resolve) => { 28348 this.resolve = resolve; 28349 }); 28350 } 28351 notifyFinished() { 28352 this.resolve(); 28353 } 28354 /** 28355 * Allows the animation to be awaited. 28356 * 28357 * @deprecated Use `finished` instead. 28358 */ 28359 then(onResolve, onReject) { 28360 return this.finished.then(onResolve, onReject); 28361 } 28362} 28363 28364const percentToProgress = (percent) => percent / 100; 28365class JSAnimation extends WithPromise { 28366 constructor(options) { 28367 super(); 28368 this.state = "idle"; 28369 this.startTime = null; 28370 this.isStopped = false; 28371 this.currentTime = 0; 28372 this.holdTime = null; 28373 this.playbackSpeed = 1; 28374 this.stop = (sync = true) => { 28375 if (sync) { 28376 const { motionValue } = this.options; 28377 if (motionValue && motionValue.updatedAt !== time.now()) { 28378 this.tick(time.now()); 28379 } 28380 } 28381 this.isStopped = true;
vendor: 7,273 bytes, lines 28382-28599
28382 if (this.state === "idle") 28383 return; 28384 this.teardown(); 28385 this.options.onStop?.(); 28386 }; 28387 this.options = options; 28388 this.initAnimation(); 28389 this.play(); 28390 if (options.autoplay === false) 28391 this.pause(); 28392 } 28393 initAnimation() { 28394 const { options } = this; 28395 replaceTransitionType(options); 28396 const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = options; 28397 let { keyframes: keyframes$1 } = options; 28398 const generatorFactory = type || keyframes; 28399 if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") { 28400 this.mixKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1])); 28401 keyframes$1 = [0, 100]; 28402 } 28403 const generator = generatorFactory({ ...options, keyframes: keyframes$1 }); 28404 if (repeatType === "mirror") { 28405 this.mirroredGenerator = generatorFactory({ 28406 ...options, 28407 keyframes: [...keyframes$1].reverse(), 28408 velocity: -velocity 28409 }); 28410 } 28411 if (generator.calculatedDuration === null) { 28412 generator.calculatedDuration = calcGeneratorDuration(generator); 28413 } 28414 const { calculatedDuration } = generator; 28415 this.calculatedDuration = calculatedDuration; 28416 this.resolvedDuration = calculatedDuration + repeatDelay; 28417 this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay; 28418 this.generator = generator; 28419 } 28420 updateTime(timestamp) { 28421 const animationTime = Math.round(timestamp - this.startTime) * this.playbackSpeed; 28422 if (this.holdTime !== null) { 28423 this.currentTime = this.holdTime; 28424 } else { 28425 this.currentTime = animationTime; 28426 } 28427 } 28428 tick(timestamp, sample = false) { 28429 const { generator, totalDuration, mixKeyframes, mirroredGenerator, resolvedDuration, calculatedDuration } = this; 28430 if (this.startTime === null) 28431 return generator.next(0); 28432 const { delay = 0, keyframes: keyframes2, repeat, repeatType, repeatDelay, type, onUpdate, finalKeyframe } = this.options; 28433 if (this.speed > 0) { 28434 this.startTime = Math.min(this.startTime, timestamp); 28435 } else if (this.speed < 0) { 28436 this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime); 28437 } 28438 if (sample) { 28439 this.currentTime = timestamp; 28440 } else { 28441 this.updateTime(timestamp); 28442 } 28443 const timeWithoutDelay = this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1); 28444 const isInDelayPhase = this.playbackSpeed >= 0 ? timeWithoutDelay < 0 : timeWithoutDelay > totalDuration; 28445 this.currentTime = Math.max(timeWithoutDelay, 0); 28446 if (this.state === "finished" && this.holdTime === null) { 28447 this.currentTime = totalDuration; 28448 } 28449 let elapsed = this.currentTime; 28450 let frameGenerator = generator; 28451 if (repeat) { 28452 const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration; 28453 let currentIteration = Math.floor(progress); 28454 let iterationProgress = progress % 1; 28455 if (!iterationProgress && progress >= 1) { 28456 iterationProgress = 1; 28457 } 28458 iterationProgress === 1 && currentIteration--; 28459 currentIteration = Math.min(currentIteration, repeat + 1); 28460 const isOddIteration = Boolean(currentIteration % 2); 28461 if (isOddIteration) { 28462 if (repeatType === "reverse") { 28463 iterationProgress = 1 - iterationProgress; 28464 if (repeatDelay) { 28465 iterationProgress -= repeatDelay / resolvedDuration; 28466 } 28467 } else if (repeatType === "mirror") { 28468 frameGenerator = mirroredGenerator; 28469 } 28470 } 28471 elapsed = clamp(0, 1, iterationProgress) * resolvedDuration; 28472 } 28473 const state = isInDelayPhase ? { done: false, value: keyframes2[0] } : frameGenerator.next(elapsed); 28474 if (mixKeyframes) { 28475 state.value = mixKeyframes(state.value); 28476 } 28477 let { done } = state; 28478 if (!isInDelayPhase && calculatedDuration !== null) { 28479 done = this.playbackSpeed >= 0 ? this.currentTime >= totalDuration : this.currentTime <= 0; 28480 } 28481 const isAnimationFinished = this.holdTime === null && (this.state === "finished" || this.state === "running" && done); 28482 if (isAnimationFinished && type !== inertia) { 28483 state.value = getFinalKeyframe$1(keyframes2, this.options, finalKeyframe, this.speed); 28484 } 28485 if (onUpdate) { 28486 onUpdate(state.value); 28487 } 28488 if (isAnimationFinished) { 28489 this.finish(); 28490 } 28491 return state; 28492 } 28493 /** 28494 * Allows the returned animation to be awaited or promise-chained. Currently 28495 * resolves when the animation finishes at all but in a future update could/should 28496 * reject if its cancels. 28497 */ 28498 then(resolve, reject) { 28499 return this.finished.then(resolve, reject); 28500 } 28501 get duration() { 28502 return millisecondsToSeconds(this.calculatedDuration); 28503 } 28504 get time() { 28505 return millisecondsToSeconds(this.currentTime); 28506 } 28507 set time(newTime) { 28508 newTime = secondsToMilliseconds(newTime); 28509 this.currentTime = newTime; 28510 if (this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0) { 28511 this.holdTime = newTime; 28512 } else if (this.driver) { 28513 this.startTime = this.driver.now() - newTime / this.playbackSpeed; 28514 } 28515 this.driver?.start(false); 28516 } 28517 get speed() { 28518 return this.playbackSpeed; 28519 } 28520 set speed(newSpeed) { 28521 this.updateTime(time.now()); 28522 const hasChanged = this.playbackSpeed !== newSpeed; 28523 this.playbackSpeed = newSpeed; 28524 if (hasChanged) { 28525 this.time = millisecondsToSeconds(this.currentTime); 28526 } 28527 } 28528 play() { 28529 if (this.isStopped) 28530 return; 28531 const { driver = frameloopDriver, startTime } = this.options; 28532 if (!this.driver) { 28533 this.driver = driver((timestamp) => this.tick(timestamp)); 28534 } 28535 this.options.onPlay?.(); 28536 const now = this.driver.now(); 28537 if (this.state === "finished") { 28538 this.updateFinished(); 28539 this.startTime = now; 28540 } else if (this.holdTime !== null) { 28541 this.startTime = now - this.holdTime; 28542 } else if (!this.startTime) { 28543 this.startTime = startTime ?? now; 28544 } 28545 if (this.state === "finished" && this.speed < 0) { 28546 this.startTime += this.calculatedDuration; 28547 } 28548 this.holdTime = null; 28549 this.state = "running"; 28550 this.driver.start(); 28551 } 28552 pause() { 28553 this.state = "paused"; 28554 this.updateTime(time.now()); 28555 this.holdTime = this.currentTime; 28556 } 28557 complete() { 28558 if (this.state !== "running") { 28559 this.play(); 28560 } 28561 this.state = "finished"; 28562 this.holdTime = null; 28563 } 28564 finish() { 28565 this.notifyFinished(); 28566 this.teardown(); 28567 this.state = "finished"; 28568 this.options.onComplete?.(); 28569 } 28570 cancel() { 28571 this.holdTime = null; 28572 this.startTime = 0; 28573 this.tick(0); 28574 this.teardown(); 28575 this.options.onCancel?.(); 28576 } 28577 teardown() { 28578 this.state = "idle"; 28579 this.stopDriver(); 28580 this.startTime = this.holdTime = null; 28581 } 28582 stopDriver() { 28583 if (!this.driver) 28584 return; 28585 this.driver.stop(); 28586 this.driver = void 0; 28587 } 28588 sample(sampleTime) { 28589 this.startTime = 0; 28590 return this.tick(sampleTime, true); 28591 } 28592 attachTimeline(timeline) { 28593 if (this.options.allowFlatten) { 28594 this.options.type = "keyframes"; 28595 this.options.ease = "linear"; 28596 this.initAnimation(); 28597 } 28598 this.driver?.stop(); 28599 return timeline.observe(this);
vendor: 13,436 bytes, lines 28600-29013
28600 } 28601} 28602 28603function fillWildcards(keyframes) { 28604 for (let i = 1; i < keyframes.length; i++) { 28605 keyframes[i] ?? (keyframes[i] = keyframes[i - 1]); 28606 } 28607} 28608 28609const radToDeg = (rad) => (rad * 180) / Math.PI; 28610const rotate = (v) => { 28611 const angle = radToDeg(Math.atan2(v[1], v[0])); 28612 return rebaseAngle(angle); 28613}; 28614const matrix2dParsers = { 28615 x: 4, 28616 y: 5, 28617 translateX: 4, 28618 translateY: 5, 28619 scaleX: 0, 28620 scaleY: 3, 28621 scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2, 28622 rotate, 28623 rotateZ: rotate, 28624 skewX: (v) => radToDeg(Math.atan(v[1])), 28625 skewY: (v) => radToDeg(Math.atan(v[2])), 28626 skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2, 28627}; 28628const rebaseAngle = (angle) => { 28629 angle = angle % 360; 28630 if (angle < 0) 28631 angle += 360; 28632 return angle; 28633}; 28634const rotateZ = rotate; 28635const scaleX = (v) => Math.sqrt(v[0] * v[0] + v[1] * v[1]); 28636const scaleY = (v) => Math.sqrt(v[4] * v[4] + v[5] * v[5]); 28637const matrix3dParsers = { 28638 x: 12, 28639 y: 13, 28640 z: 14, 28641 translateX: 12, 28642 translateY: 13, 28643 translateZ: 14, 28644 scaleX, 28645 scaleY, 28646 scale: (v) => (scaleX(v) + scaleY(v)) / 2, 28647 rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))), 28648 rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))), 28649 rotateZ, 28650 rotate: rotateZ, 28651 skewX: (v) => radToDeg(Math.atan(v[4])), 28652 skewY: (v) => radToDeg(Math.atan(v[1])), 28653 skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2, 28654}; 28655function defaultTransformValue(name) { 28656 return name.includes("scale") ? 1 : 0; 28657} 28658function parseValueFromTransform(transform, name) { 28659 if (!transform || transform === "none") { 28660 return defaultTransformValue(name); 28661 } 28662 const matrix3dMatch = transform.match(/^matrix3d\(([-\d.e\s,]+)\)$/u); 28663 let parsers; 28664 let match; 28665 if (matrix3dMatch) { 28666 parsers = matrix3dParsers; 28667 match = matrix3dMatch; 28668 } 28669 else { 28670 const matrix2dMatch = transform.match(/^matrix\(([-\d.e\s,]+)\)$/u); 28671 parsers = matrix2dParsers; 28672 match = matrix2dMatch; 28673 } 28674 if (!match) { 28675 return defaultTransformValue(name); 28676 } 28677 const valueParser = parsers[name]; 28678 const values = match[1].split(",").map(convertTransformToNumber); 28679 return typeof valueParser === "function" 28680 ? valueParser(values) 28681 : values[valueParser]; 28682} 28683const readTransformValue = (instance, name) => { 28684 const { transform = "none" } = getComputedStyle(instance); 28685 return parseValueFromTransform(transform, name); 28686}; 28687function convertTransformToNumber(value) { 28688 return parseFloat(value.trim()); 28689} 28690 28691/** 28692 * Generate a list of every possible transform key. 28693 */ 28694const transformPropOrder = [ 28695 "transformPerspective", 28696 "x", 28697 "y", 28698 "z", 28699 "translateX", 28700 "translateY", 28701 "translateZ", 28702 "scale", 28703 "scaleX", 28704 "scaleY", 28705 "rotate", 28706 "rotateX", 28707 "rotateY", 28708 "rotateZ", 28709 "skew", 28710 "skewX", 28711 "skewY", 28712]; 28713/** 28714 * A quick lookup for transform props. 28715 */ 28716const transformProps = /*@__PURE__*/ (() => new Set(transformPropOrder))(); 28717 28718const isNumOrPxType = (v) => v === number || v === px; 28719const transformKeys = new Set(["x", "y", "z"]); 28720const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key)); 28721function removeNonTranslationalTransform(visualElement) { 28722 const removedTransforms = []; 28723 nonTranslationalTransformKeys.forEach((key) => { 28724 const value = visualElement.getValue(key); 28725 if (value !== undefined) { 28726 removedTransforms.push([key, value.get()]); 28727 value.set(key.startsWith("scale") ? 1 : 0); 28728 } 28729 }); 28730 return removedTransforms; 28731} 28732const positionalValues = { 28733 // Dimensions 28734 width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) => x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight), 28735 height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) => y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom), 28736 top: (_bbox, { top }) => parseFloat(top), 28737 left: (_bbox, { left }) => parseFloat(left), 28738 bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min), 28739 right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min), 28740 // Transform 28741 x: (_bbox, { transform }) => parseValueFromTransform(transform, "x"), 28742 y: (_bbox, { transform }) => parseValueFromTransform(transform, "y"), 28743}; 28744// Alias translate longform names 28745positionalValues.translateX = positionalValues.x; 28746positionalValues.translateY = positionalValues.y; 28747 28748const toResolve = new Set(); 28749let isScheduled = false; 28750let anyNeedsMeasurement = false; 28751let isForced = false; 28752function measureAllKeyframes() { 28753 if (anyNeedsMeasurement) { 28754 const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement); 28755 const elementsToMeasure = new Set(resolversToMeasure.map((resolver) => resolver.element)); 28756 const transformsToRestore = new Map(); 28757 /** 28758 * Write pass 28759 * If we're measuring elements we want to remove bounding box-changing transforms. 28760 */ 28761 elementsToMeasure.forEach((element) => { 28762 const removedTransforms = removeNonTranslationalTransform(element); 28763 if (!removedTransforms.length) 28764 return; 28765 transformsToRestore.set(element, removedTransforms); 28766 element.render(); 28767 }); 28768 // Read 28769 resolversToMeasure.forEach((resolver) => resolver.measureInitialState()); 28770 // Write 28771 elementsToMeasure.forEach((element) => { 28772 element.render(); 28773 const restore = transformsToRestore.get(element); 28774 if (restore) { 28775 restore.forEach(([key, value]) => { 28776 element.getValue(key)?.set(value); 28777 }); 28778 } 28779 }); 28780 // Read 28781 resolversToMeasure.forEach((resolver) => resolver.measureEndState()); 28782 // Write 28783 resolversToMeasure.forEach((resolver) => { 28784 if (resolver.suspendedScrollY !== undefined) { 28785 window.scrollTo(0, resolver.suspendedScrollY); 28786 } 28787 }); 28788 } 28789 anyNeedsMeasurement = false; 28790 isScheduled = false; 28791 toResolve.forEach((resolver) => resolver.complete(isForced)); 28792 toResolve.clear(); 28793} 28794function readAllKeyframes() { 28795 toResolve.forEach((resolver) => { 28796 resolver.readKeyframes(); 28797 if (resolver.needsMeasurement) { 28798 anyNeedsMeasurement = true; 28799 } 28800 }); 28801} 28802function flushKeyframeResolvers() { 28803 isForced = true; 28804 readAllKeyframes(); 28805 measureAllKeyframes(); 28806 isForced = false; 28807} 28808class KeyframeResolver { 28809 constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) { 28810 this.state = "pending"; 28811 /** 28812 * Track whether this resolver is async. If it is, it'll be added to the 28813 * resolver queue and flushed in the next frame. Resolvers that aren't going 28814 * to trigger read/write thrashing don't need to be async. 28815 */ 28816 this.isAsync = false; 28817 /** 28818 * Track whether this resolver needs to perform a measurement 28819 * to resolve its keyframes. 28820 */ 28821 this.needsMeasurement = false; 28822 this.unresolvedKeyframes = [...unresolvedKeyframes]; 28823 this.onComplete = onComplete; 28824 this.name = name; 28825 this.motionValue = motionValue; 28826 this.element = element; 28827 this.isAsync = isAsync; 28828 } 28829 scheduleResolve() { 28830 this.state = "scheduled"; 28831 if (this.isAsync) { 28832 toResolve.add(this); 28833 if (!isScheduled) { 28834 isScheduled = true; 28835 frame.read(readAllKeyframes); 28836 frame.resolveKeyframes(measureAllKeyframes); 28837 } 28838 } 28839 else { 28840 this.readKeyframes(); 28841 this.complete(); 28842 } 28843 } 28844 readKeyframes() { 28845 const { unresolvedKeyframes, name, element, motionValue } = this; 28846 // If initial keyframe is null we need to read it from the DOM 28847 if (unresolvedKeyframes[0] === null) { 28848 const currentValue = motionValue?.get(); 28849 // TODO: This doesn't work if the final keyframe is a wildcard 28850 const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1]; 28851 if (currentValue !== undefined) { 28852 unresolvedKeyframes[0] = currentValue; 28853 } 28854 else if (element && name) { 28855 const valueAsRead = element.readValue(name, finalKeyframe); 28856 if (valueAsRead !== undefined && valueAsRead !== null) { 28857 unresolvedKeyframes[0] = valueAsRead; 28858 } 28859 } 28860 if (unresolvedKeyframes[0] === undefined) { 28861 unresolvedKeyframes[0] = finalKeyframe; 28862 } 28863 if (motionValue && currentValue === undefined) { 28864 motionValue.set(unresolvedKeyframes[0]); 28865 } 28866 } 28867 fillWildcards(unresolvedKeyframes); 28868 } 28869 setFinalKeyframe() { } 28870 measureInitialState() { } 28871 renderEndStyles() { } 28872 measureEndState() { } 28873 complete(isForcedComplete = false) { 28874 this.state = "complete"; 28875 this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, isForcedComplete); 28876 toResolve.delete(this); 28877 } 28878 cancel() { 28879 if (this.state === "scheduled") { 28880 toResolve.delete(this); 28881 this.state = "pending"; 28882 } 28883 } 28884 resume() { 28885 if (this.state === "pending") 28886 this.scheduleResolve(); 28887 } 28888} 28889 28890const isCSSVar = (name) => name.startsWith("--"); 28891 28892function setStyle(element, name, value) { 28893 isCSSVar(name) 28894 ? element.style.setProperty(name, value) 28895 : (element.style[name] = value); 28896} 28897 28898const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== undefined); 28899 28900/** 28901 * Add the ability for test suites to manually set support flags 28902 * to better test more environments. 28903 */ 28904const supportsFlags = {}; 28905 28906function memoSupports(callback, supportsFlag) { 28907 const memoized = memo(callback); 28908 return () => supportsFlags[supportsFlag] ?? memoized(); 28909} 28910 28911const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => { 28912 try { 28913 document 28914 .createElement("div") 28915 .animate({ opacity: 0 }, { easing: "linear(0, 1)" }); 28916 } 28917 catch (e) { 28918 return false; 28919 } 28920 return true; 28921}, "linearEasing"); 28922 28923const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`; 28924 28925const supportedWaapiEasing = { 28926 linear: "linear", 28927 ease: "ease", 28928 easeIn: "ease-in", 28929 easeOut: "ease-out", 28930 easeInOut: "ease-in-out", 28931 circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]), 28932 circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]), 28933 backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]), 28934 backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]), 28935}; 28936 28937function mapEasingToNativeEasing(easing, duration) { 28938 if (!easing) { 28939 return undefined; 28940 } 28941 else if (typeof easing === "function") { 28942 return supportsLinearEasing() 28943 ? generateLinearEasing(easing, duration) 28944 : "ease-out"; 28945 } 28946 else if (isBezierDefinition(easing)) { 28947 return cubicBezierAsString(easing); 28948 } 28949 else if (Array.isArray(easing)) { 28950 return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || 28951 supportedWaapiEasing.easeOut); 28952 } 28953 else { 28954 return supportedWaapiEasing[easing]; 28955 } 28956} 28957 28958function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeOut", times, } = {}, pseudoElement = undefined) { 28959 const keyframeOptions = { 28960 [valueName]: keyframes, 28961 }; 28962 if (times) 28963 keyframeOptions.offset = times; 28964 const easing = mapEasingToNativeEasing(ease, duration); 28965 /** 28966 * If this is an easing array, apply to keyframes, not animation as a whole 28967 */ 28968 if (Array.isArray(easing)) 28969 keyframeOptions.easing = easing; 28970 const options = { 28971 delay, 28972 duration, 28973 easing: !Array.isArray(easing) ? easing : "linear", 28974 fill: "both", 28975 iterations: repeat + 1, 28976 direction: repeatType === "reverse" ? "alternate" : "normal", 28977 }; 28978 if (pseudoElement) 28979 options.pseudoElement = pseudoElement; 28980 const animation = element.animate(keyframeOptions, options); 28981 return animation; 28982} 28983 28984function isGenerator(type) { 28985 return typeof type === "function" && "applyToOptions" in type; 28986} 28987 28988function applyGeneratorOptions({ type, ...options }) { 28989 if (isGenerator(type) && supportsLinearEasing()) { 28990 return type.applyToOptions(options); 28991 } 28992 else { 28993 options.duration ?? (options.duration = 300); 28994 options.ease ?? (options.ease = "easeOut"); 28995 } 28996 return options; 28997} 28998 28999/** 29000 * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API. 29001 */ 29002class NativeAnimation extends WithPromise { 29003 constructor(options) { 29004 super(); 29005 this.finishedTime = null; 29006 this.isStopped = false; 29007 if (!options) 29008 return; 29009 const { element, name, keyframes, pseudoElement, allowFlatten = false, finalKeyframe, onComplete, } = options; 29010 this.isPseudoElement = Boolean(pseudoElement); 29011 this.allowFlatten = allowFlatten; 29012 this.options = options; 29013
vendor: 1,615 bytes, lines 29013-29063
29013invariant(typeof options.type !== "string"); 29014 const transition = applyGeneratorOptions(options); 29015 this.animation = startWaapiAnimation(element, name, keyframes, transition, pseudoElement); 29016 if (transition.autoplay === false) { 29017 this.animation.pause(); 29018 } 29019 this.animation.onfinish = () => { 29020 this.finishedTime = this.time; 29021 if (!pseudoElement) { 29022 const keyframe = getFinalKeyframe$1(keyframes, this.options, finalKeyframe, this.speed); 29023 if (this.updateMotionValue) { 29024 this.updateMotionValue(keyframe); 29025 } 29026 else { 29027 /** 29028 * If we can, we want to commit the final style as set by the user, 29029 * rather than the computed keyframe value supplied by the animation. 29030 */ 29031 setStyle(element, name, keyframe); 29032 } 29033 this.animation.cancel(); 29034 } 29035 onComplete?.(); 29036 this.notifyFinished(); 29037 }; 29038 } 29039 play() { 29040 if (this.isStopped) 29041 return; 29042 this.animation.play(); 29043 if (this.state === "finished") { 29044 this.updateFinished(); 29045 } 29046 } 29047 pause() { 29048 this.animation.pause(); 29049 } 29050 complete() { 29051 this.animation.finish?.(); 29052 } 29053 cancel() { 29054 try { 29055 this.animation.cancel(); 29056 } 29057 catch (e) { } 29058 } 29059 stop() { 29060 if (this.isStopped) 29061 return; 29062 this.isStopped = true; 29063 const { state } = this;
vendor: 19,124 bytes, lines 29064-29684
29064 if (state === "idle" || state === "finished") { 29065 return; 29066 } 29067 if (this.updateMotionValue) { 29068 this.updateMotionValue(); 29069 } 29070 else { 29071 this.commitStyles(); 29072 } 29073 if (!this.isPseudoElement) 29074 this.cancel(); 29075 } 29076 /** 29077 * WAAPI doesn't natively have any interruption capabilities. 29078 * 29079 * In this method, we commit styles back to the DOM before cancelling 29080 * the animation. 29081 * 29082 * This is designed to be overridden by NativeAnimationExtended, which 29083 * will create a renderless JS animation and sample it twice to calculate 29084 * its current value, "previous" value, and therefore allow 29085 * Motion to also correctly calculate velocity for any subsequent animation 29086 * while deferring the commit until the next animation frame. 29087 */ 29088 commitStyles() { 29089 if (!this.isPseudoElement) { 29090 this.animation.commitStyles?.(); 29091 } 29092 } 29093 get duration() { 29094 const duration = this.animation.effect?.getComputedTiming?.().duration || 0; 29095 return millisecondsToSeconds(Number(duration)); 29096 } 29097 get time() { 29098 return millisecondsToSeconds(Number(this.animation.currentTime) || 0); 29099 } 29100 set time(newTime) { 29101 this.finishedTime = null; 29102 this.animation.currentTime = secondsToMilliseconds(newTime); 29103 } 29104 /** 29105 * The playback speed of the animation. 29106 * 1 = normal speed, 2 = double speed, 0.5 = half speed. 29107 */ 29108 get speed() { 29109 return this.animation.playbackRate; 29110 } 29111 set speed(newSpeed) { 29112 // Allow backwards playback after finishing 29113 if (newSpeed < 0) 29114 this.finishedTime = null; 29115 this.animation.playbackRate = newSpeed; 29116 } 29117 get state() { 29118 return this.finishedTime !== null 29119 ? "finished" 29120 : this.animation.playState; 29121 } 29122 get startTime() { 29123 return Number(this.animation.startTime); 29124 } 29125 set startTime(newStartTime) { 29126 this.animation.startTime = newStartTime; 29127 } 29128 /** 29129 * Attaches a timeline to the animation, for instance the `ScrollTimeline`. 29130 */ 29131 attachTimeline({ timeline, observe }) { 29132 if (this.allowFlatten) { 29133 this.animation.effect?.updateTiming({ easing: "linear" }); 29134 } 29135 this.animation.onfinish = null; 29136 if (timeline && supportsScrollTimeline()) { 29137 this.animation.timeline = timeline; 29138 return noop; 29139 } 29140 else { 29141 return observe(this); 29142 } 29143 } 29144} 29145 29146const unsupportedEasingFunctions = { 29147 anticipate, 29148 backInOut, 29149 circInOut, 29150}; 29151function isUnsupportedEase(key) { 29152 return key in unsupportedEasingFunctions; 29153} 29154function replaceStringEasing(transition) { 29155 if (typeof transition.ease === "string" && 29156 isUnsupportedEase(transition.ease)) { 29157 transition.ease = unsupportedEasingFunctions[transition.ease]; 29158 } 29159} 29160 29161/** 29162 * 10ms is chosen here as it strikes a balance between smooth 29163 * results (more than one keyframe per frame at 60fps) and 29164 * keyframe quantity. 29165 */ 29166const sampleDelta = 10; //ms 29167class NativeAnimationExtended extends NativeAnimation { 29168 constructor(options) { 29169 /** 29170 * The base NativeAnimation function only supports a subset 29171 * of Motion easings, and WAAPI also only supports some 29172 * easing functions via string/cubic-bezier definitions. 29173 * 29174 * This function replaces those unsupported easing functions 29175 * with a JS easing function. This will later get compiled 29176 * to a linear() easing function. 29177 */ 29178 replaceStringEasing(options); 29179 /** 29180 * Ensure we replace the transition type with a generator function 29181 * before passing to WAAPI. 29182 * 29183 * TODO: Does this have a better home? It could be shared with 29184 * JSAnimation. 29185 */ 29186 replaceTransitionType(options); 29187 super(options); 29188 if (options.startTime) { 29189 this.startTime = options.startTime; 29190 } 29191 this.options = options; 29192 } 29193 /** 29194 * WAAPI doesn't natively have any interruption capabilities. 29195 * 29196 * Rather than read commited styles back out of the DOM, we can 29197 * create a renderless JS animation and sample it twice to calculate 29198 * its current value, "previous" value, and therefore allow 29199 * Motion to calculate velocity for any subsequent animation. 29200 */ 29201 updateMotionValue(value) { 29202 const { motionValue, onUpdate, onComplete, element, ...options } = this.options; 29203 if (!motionValue) 29204 return; 29205 if (value !== undefined) { 29206 motionValue.set(value); 29207 return; 29208 } 29209 const sampleAnimation = new JSAnimation({ 29210 ...options, 29211 autoplay: false, 29212 }); 29213 const sampleTime = secondsToMilliseconds(this.finishedTime ?? this.time); 29214 motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta); 29215 sampleAnimation.stop(); 29216 } 29217} 29218 29219/** 29220 * Check if a value is animatable. Examples: 29221 * 29222 * â : 100, "100px", "#fff" 29223 * â: "block", "url(2.jpg)" 29224 * @param value 29225 * 29226 * @internal 29227 */ 29228const isAnimatable = (value, name) => { 29229 // If the list of keys tat might be non-animatable grows, replace with Set 29230 if (name === "zIndex") 29231 return false; 29232 // If it's a number or a keyframes array, we can animate it. We might at some point 29233 // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this, 29234 // but for now lets leave it like this for performance reasons 29235 if (typeof value === "number" || Array.isArray(value)) 29236 return true; 29237 if (typeof value === "string" && // It's animatable if we have a string 29238 (complex.test(value) || value === "0") && // And it contains numbers and/or colors 29239 !value.startsWith("url(") // Unless it starts with "url(" 29240 ) { 29241 return true; 29242 } 29243 return false; 29244}; 29245 29246function hasKeyframesChanged(keyframes) { 29247 const current = keyframes[0]; 29248 if (keyframes.length === 1) 29249 return true; 29250 for (let i = 0; i < keyframes.length; i++) { 29251 if (keyframes[i] !== current) 29252 return true; 29253 } 29254} 29255function canAnimate(keyframes, name, type, velocity) { 29256 /** 29257 * Check if we're able to animate between the start and end keyframes, 29258 * and throw a warning if we're attempting to animate between one that's 29259 * animatable and another that isn't. 29260 */ 29261 const originKeyframe = keyframes[0]; 29262 if (originKeyframe === null) 29263 return false; 29264 /** 29265 * These aren't traditionally animatable but we do support them. 29266 * In future we could look into making this more generic or replacing 29267 * this function with mix() === mixImmediate 29268 */ 29269 if (name === "display" || name === "visibility") 29270 return true; 29271 const targetKeyframe = keyframes[keyframes.length - 1]; 29272 const isOriginAnimatable = isAnimatable(originKeyframe, name); 29273 const isTargetAnimatable = isAnimatable(targetKeyframe, name); 29274 // Always skip if any of these are true 29275 if (!isOriginAnimatable || !isTargetAnimatable) { 29276 return false; 29277 } 29278 return (hasKeyframesChanged(keyframes) || 29279 ((type === "spring" || isGenerator(type)) && velocity)); 29280} 29281 29282/** 29283 * A list of values that can be hardware-accelerated. 29284 */ 29285const acceleratedValues = new Set([ 29286 "opacity", 29287 "clipPath", 29288 "filter", 29289 "transform", 29290 // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved 29291 // or until we implement support for linear() easing. 29292 // "background-color" 29293]); 29294const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate")); 29295function supportsBrowserAnimation(options) { 29296 const { motionValue, name, repeatDelay, repeatType, damping, type } = options; 29297 if (!motionValue || 29298 !motionValue.owner || 29299 !(motionValue.owner.current instanceof HTMLElement)) { 29300 return false; 29301 } 29302 const { onUpdate, transformTemplate } = motionValue.owner.getProps(); 29303 return (supportsWaapi() && 29304 name && 29305 acceleratedValues.has(name) && 29306 (name !== "transform" || !transformTemplate) && 29307 /** 29308 * If we're outputting values to onUpdate then we can't use WAAPI as there's 29309 * no way to read the value from WAAPI every frame. 29310 */ 29311 !onUpdate && 29312 !repeatDelay && 29313 repeatType !== "mirror" && 29314 damping !== 0 && 29315 type !== "inertia"); 29316} 29317 29318/** 29319 * Maximum time allowed between an animation being created and it being 29320 * resolved for us to use the latter as the start time. 29321 * 29322 * This is to ensure that while we prefer to "start" an animation as soon 29323 * as it's triggered, we also want to avoid a visual jump if there's a big delay 29324 * between these two moments. 29325 */ 29326const MAX_RESOLVE_DELAY = 40; 29327class AsyncMotionValueAnimation extends WithPromise { 29328 constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", keyframes, name, motionValue, element, ...options }) { 29329 super(); 29330 /** 29331 * Bound to support return animation.stop pattern 29332 */ 29333 this.stop = () => { 29334 if (this._animation) { 29335 this._animation.stop(); 29336 this.stopTimeline?.(); 29337 } 29338 this.keyframeResolver?.cancel(); 29339 }; 29340 this.createdAt = time.now(); 29341 const optionsWithDefaults = { 29342 autoplay, 29343 delay, 29344 type, 29345 repeat, 29346 repeatDelay, 29347 repeatType, 29348 name, 29349 motionValue, 29350 element, 29351 ...options, 29352 }; 29353 const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver; 29354 this.keyframeResolver = new KeyframeResolver$1(keyframes, (resolvedKeyframes, finalKeyframe, forced) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe, optionsWithDefaults, !forced), name, motionValue, element); 29355 this.keyframeResolver?.scheduleResolve(); 29356 } 29357 onKeyframesResolved(keyframes, finalKeyframe, options, sync) { 29358 this.keyframeResolver = undefined; 29359 const { name, type, velocity, delay, isHandoff, onUpdate } = options; 29360 this.resolvedAt = time.now(); 29361 /** 29362 * If we can't animate this value with the resolved keyframes 29363 * then we should complete it immediately. 29364 */ 29365 if (!canAnimate(keyframes, name, type, velocity)) { 29366 if (MotionGlobalConfig.instantAnimations || !delay) { 29367 onUpdate?.(getFinalKeyframe$1(keyframes, options, finalKeyframe)); 29368 } 29369 keyframes[0] = keyframes[keyframes.length - 1]; 29370 options.duration = 0; 29371 options.repeat = 0; 29372 } 29373 /** 29374 * Resolve startTime for the animation. 29375 * 29376 * This method uses the createdAt and resolvedAt to calculate the 29377 * animation startTime. *Ideally*, we would use the createdAt time as t=0 29378 * as the following frame would then be the first frame of the animation in 29379 * progress, which would feel snappier. 29380 * 29381 * However, if there's a delay (main thread work) between the creation of 29382 * the animation and the first commited frame, we prefer to use resolvedAt 29383 * to avoid a sudden jump into the animation. 29384 */ 29385 const startTime = sync 29386 ? !this.resolvedAt 29387 ? this.createdAt 29388 : this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY 29389 ? this.resolvedAt 29390 : this.createdAt 29391 : undefined; 29392 const resolvedOptions = { 29393 startTime, 29394 finalKeyframe, 29395 ...options, 29396 keyframes, 29397 }; 29398 /** 29399 * Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via 29400 * WAAPI. Therefore, this animation must be JS to ensure it runs "under" the 29401 * optimised animation. 29402 */ 29403 const animation = !isHandoff && supportsBrowserAnimation(resolvedOptions) 29404 ? new NativeAnimationExtended({ 29405 ...resolvedOptions, 29406 element: resolvedOptions.motionValue.owner.current, 29407 }) 29408 : new JSAnimation(resolvedOptions); 29409 animation.finished.then(() => this.notifyFinished()).catch(noop); 29410 if (this.pendingTimeline) { 29411 this.stopTimeline = animation.attachTimeline(this.pendingTimeline); 29412 this.pendingTimeline = undefined; 29413 } 29414 this._animation = animation; 29415 } 29416 get finished() { 29417 if (!this._animation) { 29418 return this._finished; 29419 } 29420 else { 29421 return this.animation.finished; 29422 } 29423 } 29424 then(onResolve, _onReject) { 29425 return this.finished.finally(onResolve).then(() => { }); 29426 } 29427 get animation() { 29428 if (!this._animation) { 29429 this.keyframeResolver?.resume(); 29430 flushKeyframeResolvers(); 29431 } 29432 return this._animation; 29433 } 29434 get duration() { 29435 return this.animation.duration; 29436 } 29437 get time() { 29438 return this.animation.time; 29439 } 29440 set time(newTime) { 29441 this.animation.time = newTime; 29442 } 29443 get speed() { 29444 return this.animation.speed; 29445 } 29446 get state() { 29447 return this.animation.state; 29448 } 29449 set speed(newSpeed) { 29450 this.animation.speed = newSpeed; 29451 } 29452 get startTime() { 29453 return this.animation.startTime; 29454 } 29455 attachTimeline(timeline) { 29456 if (this._animation) { 29457 this.stopTimeline = this.animation.attachTimeline(timeline); 29458 } 29459 else { 29460 this.pendingTimeline = timeline; 29461 } 29462 return () => this.stop(); 29463 } 29464 play() { 29465 this.animation.play(); 29466 } 29467 pause() { 29468 this.animation.pause(); 29469 } 29470 complete() { 29471 this.animation.complete(); 29472 } 29473 cancel() { 29474 if (this._animation) { 29475 this.animation.cancel(); 29476 } 29477 this.keyframeResolver?.cancel(); 29478 } 29479} 29480 29481/** 29482 * Parse Framer's special CSS variable format into a CSS token and a fallback. 29483 * 29484 * ``` 29485 * `var(--foo, #fff)` => [`--foo`, '#fff'] 29486 * ``` 29487 * 29488 * @param current 29489 */ 29490const splitCSSVariableRegex = 29491// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words 29492/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u; 29493function parseCSSVariable(current) { 29494 const match = splitCSSVariableRegex.exec(current); 29495 if (!match) 29496 return [,]; 29497 const [, token1, token2, fallback] = match; 29498 return [`--${token1 ?? token2}`, fallback]; 29499} 29500function getVariableValue(current, element, depth = 1) { 29501 const [token, fallback] = parseCSSVariable(current); 29502 // No CSS variable detected 29503 if (!token) 29504 return; 29505 // Attempt to read this CSS variable off the element 29506 const resolved = window.getComputedStyle(element).getPropertyValue(token); 29507 if (resolved) { 29508 const trimmed = resolved.trim(); 29509 return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed; 29510 } 29511 return isCSSVariableToken(fallback) 29512 ? getVariableValue(fallback, element, depth + 1) 29513 : fallback; 29514} 29515 29516function getValueTransition(transition, key) { 29517 return (transition?.[key] ?? 29518 transition?.["default"] ?? 29519 transition); 29520} 29521 29522const positionalKeys = new Set([ 29523 "width", 29524 "height", 29525 "top", 29526 "left", 29527 "right", 29528 "bottom", 29529 ...transformPropOrder, 29530]); 29531 29532/** 29533 * ValueType for "auto" 29534 */ 29535const auto = { 29536 test: (v) => v === "auto", 29537 parse: (v) => v, 29538}; 29539 29540/** 29541 * Tests a provided value against a ValueType 29542 */ 29543const testValueType = (v) => (type) => type.test(v); 29544 29545/** 29546 * A list of value types commonly used for dimensions 29547 */ 29548const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto]; 29549/** 29550 * Tests a dimensional value against the list of dimension ValueTypes 29551 */ 29552const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v)); 29553 29554function isNone(value) { 29555 if (typeof value === "number") { 29556 return value === 0; 29557 } 29558 else if (value !== null) { 29559 return value === "none" || value === "0" || isZeroValueString(value); 29560 } 29561 else { 29562 return true; 29563 } 29564} 29565 29566/** 29567 * Properties that should default to 1 or 100% 29568 */ 29569const maxDefaults = new Set(["brightness", "contrast", "saturate", "opacity"]); 29570function applyDefaultFilter(v) { 29571 const [name, value] = v.slice(0, -1).split("("); 29572 if (name === "drop-shadow") 29573 return v; 29574 const [number] = value.match(floatRegex) || []; 29575 if (!number) 29576 return v; 29577 const unit = value.replace(number, ""); 29578 let defaultValue = maxDefaults.has(name) ? 1 : 0; 29579 if (number !== value) 29580 defaultValue *= 100; 29581 return name + "(" + defaultValue + unit + ")"; 29582} 29583const functionRegex = /\b([a-z-]*)\(.*?\)/gu; 29584const filter = { 29585 ...complex, 29586 getAnimatableNone: (v) => { 29587 const functions = v.match(functionRegex); 29588 return functions ? functions.map(applyDefaultFilter).join(" ") : v; 29589 }, 29590}; 29591 29592const int = { 29593 ...number, 29594 transform: Math.round, 29595}; 29596 29597const transformValueTypes = { 29598 rotate: degrees, 29599 rotateX: degrees, 29600 rotateY: degrees, 29601 rotateZ: degrees, 29602 scale, 29603 scaleX: scale, 29604 scaleY: scale, 29605 scaleZ: scale, 29606 skew: degrees, 29607 skewX: degrees, 29608 skewY: degrees, 29609 distance: px, 29610 translateX: px, 29611 translateY: px, 29612 translateZ: px, 29613 x: px, 29614 y: px, 29615 z: px, 29616 perspective: px, 29617 transformPerspective: px, 29618 opacity: alpha, 29619 originX: progressPercentage, 29620 originY: progressPercentage, 29621 originZ: px, 29622}; 29623 29624const numberValueTypes = { 29625 // Border props 29626 borderWidth: px, 29627 borderTopWidth: px, 29628 borderRightWidth: px, 29629 borderBottomWidth: px, 29630 borderLeftWidth: px, 29631 borderRadius: px, 29632 radius: px, 29633 borderTopLeftRadius: px, 29634 borderTopRightRadius: px, 29635 borderBottomRightRadius: px, 29636 borderBottomLeftRadius: px, 29637 // Positioning props 29638 width: px, 29639 maxWidth: px, 29640 height: px, 29641 maxHeight: px, 29642 top: px, 29643 right: px, 29644 bottom: px, 29645 left: px, 29646 // Spacing props 29647 padding: px, 29648 paddingTop: px, 29649 paddingRight: px, 29650 paddingBottom: px, 29651 paddingLeft: px, 29652 margin: px, 29653 marginTop: px, 29654 marginRight: px, 29655 marginBottom: px, 29656 marginLeft: px, 29657 // Misc 29658 backgroundPositionX: px, 29659 backgroundPositionY: px, 29660 ...transformValueTypes, 29661 zIndex: int, 29662 // SVG 29663 fillOpacity: alpha, 29664 strokeOpacity: alpha, 29665 numOctaves: int, 29666}; 29667 29668/** 29669 * A map of default value types for common values 29670 */ 29671const defaultValueTypes = { 29672 ...numberValueTypes, 29673 // Color props 29674 color, 29675 backgroundColor: color, 29676 outlineColor: color, 29677 fill: color, 29678 stroke: color, 29679 // Border props 29680 borderColor: color, 29681 borderTopColor: color, 29682 borderRightColor: color, 29683 borderBottomColor: color, 29684 borderLeftColor: color
vendor: 7,186 bytes, lines 29684-29856
29684, 29685 filter, 29686 WebkitFilter: filter, 29687}; 29688/** 29689 * Gets the default ValueType for the provided value key 29690 */ 29691const getDefaultValueType = (key) => defaultValueTypes[key]; 29692 29693function getAnimatableNone(key, value) { 29694 let defaultValueType = getDefaultValueType(key); 29695 if (defaultValueType !== filter) 29696 defaultValueType = complex; 29697 // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target 29698 return defaultValueType.getAnimatableNone 29699 ? defaultValueType.getAnimatableNone(value) 29700 : undefined; 29701} 29702 29703/** 29704 * If we encounter keyframes like "none" or "0" and we also have keyframes like 29705 * "#fff" or "200px 200px" we want to find a keyframe to serve as a template for 29706 * the "none" keyframes. In this case "#fff" or "200px 200px" - then these get turned into 29707 * zero equivalents, i.e. "#fff0" or "0px 0px". 29708 */ 29709const invalidTemplates = new Set(["auto", "none", "0"]); 29710function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) { 29711 let i = 0; 29712 let animatableTemplate = undefined; 29713 while (i < unresolvedKeyframes.length && !animatableTemplate) { 29714 const keyframe = unresolvedKeyframes[i]; 29715 if (typeof keyframe === "string" && 29716 !invalidTemplates.has(keyframe) && 29717 analyseComplexValue(keyframe).values.length) { 29718 animatableTemplate = unresolvedKeyframes[i]; 29719 } 29720 i++; 29721 } 29722 if (animatableTemplate && name) { 29723 for (const noneIndex of noneKeyframeIndexes) { 29724 unresolvedKeyframes[noneIndex] = getAnimatableNone(name, animatableTemplate); 29725 } 29726 } 29727} 29728 29729class DOMKeyframesResolver extends KeyframeResolver { 29730 constructor(unresolvedKeyframes, onComplete, name, motionValue, element) { 29731 super(unresolvedKeyframes, onComplete, name, motionValue, element, true); 29732 } 29733 readKeyframes() { 29734 const { unresolvedKeyframes, element, name } = this; 29735 if (!element || !element.current) 29736 return; 29737 super.readKeyframes(); 29738 /** 29739 * If any keyframe is a CSS variable, we need to find its value by sampling the element 29740 */ 29741 for (let i = 0; i < unresolvedKeyframes.length; i++) { 29742 let keyframe = unresolvedKeyframes[i]; 29743 if (typeof keyframe === "string") { 29744 keyframe = keyframe.trim(); 29745 if (isCSSVariableToken(keyframe)) { 29746 const resolved = getVariableValue(keyframe, element.current); 29747 if (resolved !== undefined) { 29748 unresolvedKeyframes[i] = resolved; 29749 } 29750 if (i === unresolvedKeyframes.length - 1) { 29751 this.finalKeyframe = keyframe; 29752 } 29753 } 29754 } 29755 } 29756 /** 29757 * Resolve "none" values. We do this potentially twice - once before and once after measuring keyframes. 29758 * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which 29759 * have a far bigger performance impact. 29760 */ 29761 this.resolveNoneKeyframes(); 29762 /** 29763 * Check to see if unit type has changed. If so schedule jobs that will 29764 * temporarily set styles to the destination keyframes. 29765 * Skip if we have more than two keyframes or this isn't a positional value. 29766 * TODO: We can throw if there are multiple keyframes and the value type changes. 29767 */ 29768 if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) { 29769 return; 29770 } 29771 const [origin, target] = unresolvedKeyframes; 29772 const originType = findDimensionValueType(origin); 29773 const targetType = findDimensionValueType(target); 29774 /** 29775 * Either we don't recognise these value types or we can animate between them. 29776 */ 29777 if (originType === targetType) 29778 return; 29779 /** 29780 * If both values are numbers or pixels, we can animate between them by 29781 * converting them to numbers. 29782 */ 29783 if (isNumOrPxType(originType) && isNumOrPxType(targetType)) { 29784 for (let i = 0; i < unresolvedKeyframes.length; i++) { 29785 const value = unresolvedKeyframes[i]; 29786 if (typeof value === "string") { 29787 unresolvedKeyframes[i] = parseFloat(value); 29788 } 29789 } 29790 } 29791 else if (positionalValues[name]) { 29792 /** 29793 * Else, the only way to resolve this is by measuring the element. 29794 */ 29795 this.needsMeasurement = true; 29796 } 29797 } 29798 resolveNoneKeyframes() { 29799 const { unresolvedKeyframes, name } = this; 29800 const noneKeyframeIndexes = []; 29801 for (let i = 0; i < unresolvedKeyframes.length; i++) { 29802 if (unresolvedKeyframes[i] === null || 29803 isNone(unresolvedKeyframes[i])) { 29804 noneKeyframeIndexes.push(i); 29805 } 29806 } 29807 if (noneKeyframeIndexes.length) { 29808 makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name); 29809 } 29810 } 29811 measureInitialState() { 29812 const { element, unresolvedKeyframes, name } = this; 29813 if (!element || !element.current) 29814 return; 29815 if (name === "height") { 29816 this.suspendedScrollY = window.pageYOffset; 29817 } 29818 this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current)); 29819 unresolvedKeyframes[0] = this.measuredOrigin; 29820 // Set final key frame to measure after next render 29821 const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1]; 29822 if (measureKeyframe !== undefined) { 29823 element.getValue(name, measureKeyframe).jump(measureKeyframe, false); 29824 } 29825 } 29826 measureEndState() { 29827 const { element, name, unresolvedKeyframes } = this; 29828 if (!element || !element.current) 29829 return; 29830 const value = element.getValue(name); 29831 value && value.jump(this.measuredOrigin, false); 29832 const finalKeyframeIndex = unresolvedKeyframes.length - 1; 29833 const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex]; 29834 unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current)); 29835 if (finalKeyframe !== null && this.finalKeyframe === undefined) { 29836 this.finalKeyframe = finalKeyframe; 29837 } 29838 // If we removed transform values, reapply them before the next render 29839 if (this.removedTransforms?.length) { 29840 this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => { 29841 element 29842 .getValue(unsetTransformName) 29843 .set(unsetTransformValue); 29844 }); 29845 } 29846 this.resolveNoneKeyframes(); 29847 } 29848} 29849 29850function resolveElements(elementOrSelector, scope, selectorCache) { 29851 if (elementOrSelector instanceof EventTarget) { 29852 return [elementOrSelector]; 29853 } 29854 else if (typeof elementOrSelector === "string") { 29855 let root = document; 29856
29856const elements = selectorCache?.[elementOrSelector] ?? 29857 root.querySelectorAll(elementOrSelector); 29858 return elements ? Array.from(elements) : []; 29859 } 29860 return Array.from(elementOrSelector); 29861} 29862 29863const MAX_VELOCITY_DELTA = 30; 29864const isFloat = (value) => { 29865 return !isNaN(parseFloat(value)); 29866}; 29867class MotionValue { 29868 /** 29869 * @param init - The initiating value 29870 * @param config - Optional configuration options 29871 * 29872 * - `transformer`: A function to transform incoming values with. 29873 */ 29874 constructor(init, options = {}) { 29875 this.version = "__VERSION__"; 29876 this.canTrackVelocity = null; 29877 this.events = {}; 29878 this.updateAndNotify = (v, render = true) => { 29879 const currentTime = time.now(); 29880 if (this.updatedAt !== currentTime) { 29881 this.setPrevFrameValue(); 29882 } 29883 this.prev = this.current; 29884 this.setCurrent(v); 29885 if (this.current !== this.prev) { 29886 this.events.change?.notify(this.current); 29887 if (this.dependents) { 29888 for (const dependent of this.dependents) { 29889 dependent.dirty(); 29890 } 29891 } 29892 } 29893 if (render) { 29894 this.events.renderRequest?.notify(this.current); 29895 } 29896 }; 29897 this.hasAnimated = false; 29898 this.setCurrent(init); 29899 this.owner = options.owner; 29900 } 29901 setCurrent(current) { 29902 this.current = current; 29903 this.updatedAt = time.now(); 29904 if (this.canTrackVelocity === null && current !== void 0) { 29905 this.canTrackVelocity = isFloat(this.current); 29906 } 29907 } 29908 setPrevFrameValue(prevFrameValue = this.current) { 29909 this.prevFrameValue = prevFrameValue; 29910 this.prevUpdatedAt = this.updatedAt; 29911 } 29912 /** 29913 * Adds a function that will be notified when the `MotionValue` is updated. 29914 * 29915 * It returns a function that, when called, will cancel the subscription. 29916 * 29917 * When calling `onChange` inside a React component, it should be wrapped with the 29918 * `useEffect` hook. As it returns an unsubscribe function, this should be returned 29919 * from the `useEffect` function to ensure you don't add duplicate subscribers.. 29920 * 29921 * ```jsx 29922 * export const MyComponent = () => { 29923 * const x = useMotionValue(0) 29924 * const y = useMotionValue(0) 29925 * const opacity = useMotionValue(1) 29926 * 29927 * useEffect(() => { 29928 * function updateOpacity() { 29929 * const maxXY = Math.max(x.get(), y.get()) 29930 * const newOpacity = transform(maxXY, [0, 100], [1, 0]) 29931 * opacity.set(newOpacity) 29932 * } 29933 * 29934 * const unsubscribeX = x.on("change", updateOpacity) 29935 * const unsubscribeY = y.on("change", updateOpacity) 29936 * 29937 * return () => { 29938 * unsubscribeX() 29939 * unsubscribeY() 29940 * } 29941 * }, []) 29942 * 29943 * return <motion.div style={{ x }} /> 29944 * } 29945 * ``` 29946 * 29947 * @param subscriber - A function that receives the latest value. 29948 * @returns A function that, when called, will cancel this subscription. 29949 * 29950 * @deprecated 29951 */ 29952 onChange(subscription) { 29953 return this.on("change", subscription); 29954 } 29955 on(eventName, callback) { 29956 if (!this.events[eventName]) { 29957 this.events[eventName] = new SubscriptionManager(); 29958 } 29959 const unsubscribe = this.events[eventName].add(callback); 29960 if (eventName === "change") { 29961 return () => { 29962 unsubscribe(); 29963 frame.read(() => { 29964 if (!this.events.change.getSize()) { 29965 this.stop(); 29966 } 29967 }); 29968 }; 29969 } 29970 return unsubscribe; 29971 } 29972 clearListeners() { 29973 for (const eventManagers in this.events) { 29974 this.events[eventManagers].clear(); 29975 } 29976 } 29977 /** 29978 * Attaches a passive effect to the `MotionValue`. 29979 */ 29980 attach(passiveEffect, stopPassiveEffect) { 29981 this.passiveEffect = passiveEffect; 29982 this.stopPassiveEffect = stopPassiveEffect; 29983 } 29984 /** 29985 * Sets the state of the `MotionValue`. 29986 * 29987 * @remarks 29988 * 29989 * ```jsx 29990 * const x = useMotionValue(0) 29991 * x.set(10) 29992 * ``` 29993 * 29994 * @param latest - Latest value to set. 29995 * @param render - Whether to notify render subscribers. Defaults to `true` 29996 * 29997 * @public 29998 */ 29999 set(v, render = true) { 30000 if (!render || !this.passiveEffect) { 30001 this.updateAndNotify(v, render); 30002 } else { 30003 this.passiveEffect(v, this.updateAndNotify); 30004 } 30005 } 30006 setWithVelocity(prev, current, delta) { 30007 this.set(current); 30008 this.prev = void 0; 30009 this.prevFrameValue = prev; 30010 this.prevUpdatedAt = this.updatedAt - delta; 30011 } 30012 /** 30013 * Set the state of the `MotionValue`, stopping any active animations, 30014 * effects, and resets velocity to `0`. 30015 */ 30016 jump(v, endAnimation = true) { 30017 this.updateAndNotify(v); 30018 this.prev = v; 30019 this.prevUpdatedAt = this.prevFrameValue = void 0; 30020 endAnimation && this.stop(); 30021 if (this.stopPassiveEffect) 30022 this.stopPassiveEffect(); 30023 } 30024 dirty() { 30025 this.events.change?.notify(this.current); 30026 } 30027 addDependent(dependent) { 30028 if (!this.dependents) { 30029 this.dependents = /* @__PURE__ */ new Set(); 30030 } 30031 this.dependents.add(dependent); 30032 } 30033 removeDependent(dependent) { 30034 if (this.dependents) {
vendor: 2,870 bytes, lines 30035-30151
30035 this.dependents.delete(dependent); 30036 } 30037 } 30038 /** 30039 * Returns the latest state of `MotionValue` 30040 * 30041 * @returns - The latest state of `MotionValue` 30042 * 30043 * @public 30044 */ 30045 get() { 30046 return this.current; 30047 } 30048 /** 30049 * @public 30050 */ 30051 getPrevious() { 30052 return this.prev; 30053 } 30054 /** 30055 * Returns the latest velocity of `MotionValue` 30056 * 30057 * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical. 30058 * 30059 * @public 30060 */ 30061 getVelocity() { 30062 const currentTime = time.now(); 30063 if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) { 30064 return 0; 30065 } 30066 const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA); 30067 return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta); 30068 } 30069 /** 30070 * Registers a new animation to control this `MotionValue`. Only one 30071 * animation can drive a `MotionValue` at one time. 30072 * 30073 * ```jsx 30074 * value.start() 30075 * ``` 30076 * 30077 * @param animation - A function that starts the provided animation 30078 */ 30079 start(startAnimation) { 30080 this.stop(); 30081 return new Promise((resolve) => { 30082 this.hasAnimated = true; 30083 this.animation = startAnimation(resolve); 30084 if (this.events.animationStart) { 30085 this.events.animationStart.notify(); 30086 } 30087 }).then(() => { 30088 if (this.events.animationComplete) { 30089 this.events.animationComplete.notify(); 30090 } 30091 this.clearAnimation(); 30092 }); 30093 } 30094 /** 30095 * Stop the currently active animation. 30096 * 30097 * @public 30098 */ 30099 stop() { 30100 if (this.animation) { 30101 this.animation.stop(); 30102 if (this.events.animationCancel) { 30103 this.events.animationCancel.notify(); 30104 } 30105 } 30106 this.clearAnimation(); 30107 } 30108 /** 30109 * Returns `true` if this value is currently animating. 30110 * 30111 * @public 30112 */ 30113 isAnimating() { 30114 return !!this.animation; 30115 } 30116 clearAnimation() { 30117 delete this.animation; 30118 } 30119 /** 30120 * Destroy and clean up subscribers to this `MotionValue`. 30121 * 30122 * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically 30123 * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually 30124 * created a `MotionValue` via the `motionValue` function. 30125 * 30126 * @public 30127 */ 30128 destroy() { 30129 this.dependents?.clear(); 30130 this.events.destroy?.notify(); 30131 this.clearListeners(); 30132 this.stop(); 30133 if (this.stopPassiveEffect) { 30134 this.stopPassiveEffect(); 30135 } 30136 } 30137} 30138function motionValue(init, options) { 30139 return new MotionValue(init, options); 30140} 30141 30142/** 30143 * Provided a value and a ValueType, returns the value as that value type. 30144 */ 30145const getValueAsType = (value, type) => { 30146 return type && typeof value === "number" 30147 ? type.transform(value) 30148 : value; 30149}; 30150 30151const { schedule: microtask
vendor: 7,507 bytes, lines 30151-30379
30151} = 30152/* @__PURE__ */ createRenderBatcher(queueMicrotask, false); 30153 30154const isDragging = { 30155 x: false, 30156 y: false, 30157}; 30158function isDragActive() { 30159 return isDragging.x || isDragging.y; 30160} 30161 30162function setDragLock(axis) { 30163 if (axis === "x" || axis === "y") { 30164 if (isDragging[axis]) { 30165 return null; 30166 } 30167 else { 30168 isDragging[axis] = true; 30169 return () => { 30170 isDragging[axis] = false; 30171 }; 30172 } 30173 } 30174 else { 30175 if (isDragging.x || isDragging.y) { 30176 return null; 30177 } 30178 else { 30179 isDragging.x = isDragging.y = true; 30180 return () => { 30181 isDragging.x = isDragging.y = false; 30182 }; 30183 } 30184 } 30185} 30186 30187function setupGesture(elementOrSelector, options) { 30188 const elements = resolveElements(elementOrSelector); 30189 const gestureAbortController = new AbortController(); 30190 const eventOptions = { 30191 passive: true, 30192 ...options, 30193 signal: gestureAbortController.signal, 30194 }; 30195 const cancel = () => gestureAbortController.abort(); 30196 return [elements, eventOptions, cancel]; 30197} 30198 30199function isValidHover(event) { 30200 return !(event.pointerType === "touch" || isDragActive()); 30201} 30202/** 30203 * Create a hover gesture. hover() is different to .addEventListener("pointerenter") 30204 * in that it has an easier syntax, filters out polyfilled touch events, interoperates 30205 * with drag gestures, and automatically removes the "pointerennd" event listener when the hover ends. 30206 * 30207 * @public 30208 */ 30209function hover(elementOrSelector, onHoverStart, options = {}) { 30210 const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options); 30211 const onPointerEnter = (enterEvent) => { 30212 if (!isValidHover(enterEvent)) 30213 return; 30214 const { target } = enterEvent; 30215 const onHoverEnd = onHoverStart(target, enterEvent); 30216 if (typeof onHoverEnd !== "function" || !target) 30217 return; 30218 const onPointerLeave = (leaveEvent) => { 30219 if (!isValidHover(leaveEvent)) 30220 return; 30221 onHoverEnd(leaveEvent); 30222 target.removeEventListener("pointerleave", onPointerLeave); 30223 }; 30224 target.addEventListener("pointerleave", onPointerLeave, eventOptions); 30225 }; 30226 elements.forEach((element) => { 30227 element.addEventListener("pointerenter", onPointerEnter, eventOptions); 30228 }); 30229 return cancel; 30230} 30231 30232/** 30233 * Recursively traverse up the tree to check whether the provided child node 30234 * is the parent or a descendant of it. 30235 * 30236 * @param parent - Element to find 30237 * @param child - Element to test against parent 30238 */ 30239const isNodeOrChild = (parent, child) => { 30240 if (!child) { 30241 return false; 30242 } 30243 else if (parent === child) { 30244 return true; 30245 } 30246 else { 30247 return isNodeOrChild(parent, child.parentElement); 30248 } 30249}; 30250 30251const isPrimaryPointer = (event) => { 30252 if (event.pointerType === "mouse") { 30253 return typeof event.button !== "number" || event.button <= 0; 30254 } 30255 else { 30256 /** 30257 * isPrimary is true for all mice buttons, whereas every touch point 30258 * is regarded as its own input. So subsequent concurrent touch points 30259 * will be false. 30260 * 30261 * Specifically match against false here as incomplete versions of 30262 * PointerEvents in very old browser might have it set as undefined. 30263 */ 30264 return event.isPrimary !== false; 30265 } 30266}; 30267 30268const focusableElements = new Set([ 30269 "BUTTON", 30270 "INPUT", 30271 "SELECT", 30272 "TEXTAREA", 30273 "A", 30274]); 30275function isElementKeyboardAccessible(element) { 30276 return (focusableElements.has(element.tagName) || 30277 element.tabIndex !== -1); 30278} 30279 30280const isPressing = new WeakSet(); 30281 30282/** 30283 * Filter out events that are not "Enter" keys. 30284 */ 30285function filterEvents(callback) { 30286 return (event) => { 30287 if (event.key !== "Enter") 30288 return; 30289 callback(event); 30290 }; 30291} 30292function firePointerEvent(target, type) { 30293 target.dispatchEvent(new PointerEvent("pointer" + type, { isPrimary: true, bubbles: true })); 30294} 30295const enableKeyboardPress = (focusEvent, eventOptions) => { 30296 const element = focusEvent.currentTarget; 30297 if (!element) 30298 return; 30299 const handleKeydown = filterEvents(() => { 30300 if (isPressing.has(element)) 30301 return; 30302 firePointerEvent(element, "down"); 30303 const handleKeyup = filterEvents(() => { 30304 firePointerEvent(element, "up"); 30305 }); 30306 const handleBlur = () => firePointerEvent(element, "cancel"); 30307 element.addEventListener("keyup", handleKeyup, eventOptions); 30308 element.addEventListener("blur", handleBlur, eventOptions); 30309 }); 30310 element.addEventListener("keydown", handleKeydown, eventOptions); 30311 /** 30312 * Add an event listener that fires on blur to remove the keydown events. 30313 */ 30314 element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions); 30315}; 30316 30317/** 30318 * Filter out events that are not primary pointer events, or are triggering 30319 * while a Motion gesture is active. 30320 */ 30321function isValidPressEvent(event) { 30322 return isPrimaryPointer(event) && !isDragActive(); 30323} 30324/** 30325 * Create a press gesture. 30326 * 30327 * Press is different to `"pointerdown"`, `"pointerup"` in that it 30328 * automatically filters out secondary pointer events like right 30329 * click and multitouch. 30330 * 30331 * It also adds accessibility support for keyboards, where 30332 * an element with a press gesture will receive focus and 30333 * trigger on Enter `"keydown"` and `"keyup"` events. 30334 * 30335 * This is different to a browser's `"click"` event, which does 30336 * respond to keyboards but only for the `"click"` itself, rather 30337 * than the press start and end/cancel. The element also needs 30338 * to be focusable for this to work, whereas a press gesture will 30339 * make an element focusable by default. 30340 * 30341 * @public 30342 */ 30343function press(targetOrSelector, onPressStart, options = {}) { 30344 const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options); 30345 const startPress = (startEvent) => { 30346 const target = startEvent.currentTarget; 30347 if (!isValidPressEvent(startEvent)) 30348 return; 30349 isPressing.add(target); 30350 const onPressEnd = onPressStart(target, startEvent); 30351 const onPointerEnd = (endEvent, success) => { 30352 window.removeEventListener("pointerup", onPointerUp); 30353 window.removeEventListener("pointercancel", onPointerCancel); 30354 if (isPressing.has(target)) { 30355 isPressing.delete(target); 30356 } 30357 if (!isValidPressEvent(endEvent)) { 30358 return; 30359 } 30360 if (typeof onPressEnd === "function") { 30361 onPressEnd(endEvent, { success }); 30362 } 30363 }; 30364 const onPointerUp = (upEvent) => { 30365 onPointerEnd(upEvent, target === window || 30366 target === document || 30367 options.useGlobalTarget || 30368 isNodeOrChild(target, upEvent.target)); 30369 }; 30370 const onPointerCancel = (cancelEvent) => { 30371 onPointerEnd(cancelEvent, false); 30372 }; 30373 window.addEventListener("pointerup", onPointerUp, eventOptions); 30374 window.addEventListener("pointercancel", onPointerCancel, eventOptions); 30375 }; 30376 targets.forEach((target) => { 30377 const pointerDownTarget = options.useGlobalTarget ? window : target; 30378 pointerDownTarget.addEventListener("pointerdown", startPress, eventOptions); 30379 if (
vendor: 10,231 bytes, lines 30379-30700
30379target instanceof HTMLElement) { 30380 target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)); 30381 if (!isElementKeyboardAccessible(target) && 30382 !target.hasAttribute("tabindex")) { 30383 target.tabIndex = 0; 30384 } 30385 } 30386 }); 30387 return cancelEvents; 30388} 30389 30390/** 30391 * A list of all ValueTypes 30392 */ 30393const valueTypes = [...dimensionValueTypes, color, complex]; 30394/** 30395 * Tests a value against the list of ValueTypes 30396 */ 30397const findValueType = (v) => valueTypes.find(testValueType(v)); 30398 30399const LazyContext = reactExports.createContext({ strict: false }); 30400 30401const featureProps = { 30402 animation: [ 30403 "animate", 30404 "variants", 30405 "whileHover", 30406 "whileTap", 30407 "exit", 30408 "whileInView", 30409 "whileFocus", 30410 "whileDrag", 30411 ], 30412 exit: ["exit"], 30413 drag: ["drag", "dragControls"], 30414 focus: ["whileFocus"], 30415 hover: ["whileHover", "onHoverStart", "onHoverEnd"], 30416 tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], 30417 pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], 30418 inView: ["whileInView", "onViewportEnter", "onViewportLeave"], 30419 layout: ["layout", "layoutId"], 30420}; 30421const featureDefinitions = {}; 30422for (const key in featureProps) { 30423 featureDefinitions[key] = { 30424 isEnabled: (props) => featureProps[key].some((name) => !!props[name]), 30425 }; 30426} 30427 30428function loadFeatures(features) { 30429 for (const key in features) { 30430 featureDefinitions[key] = { 30431 ...featureDefinitions[key], 30432 ...features[key], 30433 }; 30434 } 30435} 30436 30437/** 30438 * A list of all valid MotionProps. 30439 * 30440 * @privateRemarks 30441 * This doesn't throw if a `MotionProp` name is missing - it should. 30442 */ 30443const validMotionProps = new Set([ 30444 "animate", 30445 "exit", 30446 "variants", 30447 "initial", 30448 "style", 30449 "values", 30450 "variants", 30451 "transition", 30452 "transformTemplate", 30453 "custom", 30454 "inherit", 30455 "onBeforeLayoutMeasure", 30456 "onAnimationStart", 30457 "onAnimationComplete", 30458 "onUpdate", 30459 "onDragStart", 30460 "onDrag", 30461 "onDragEnd", 30462 "onMeasureDragConstraints", 30463 "onDirectionLock", 30464 "onDragTransitionEnd", 30465 "_dragX", 30466 "_dragY", 30467 "onHoverStart", 30468 "onHoverEnd", 30469 "onViewportEnter", 30470 "onViewportLeave", 30471 "globalTapTarget", 30472 "ignoreStrict", 30473 "viewport", 30474]); 30475/** 30476 * Check whether a prop name is a valid `MotionProp` key. 30477 * 30478 * @param key - Name of the property to check 30479 * @returns `true` is key is a valid `MotionProp`. 30480 * 30481 * @public 30482 */ 30483function isValidMotionProp(key) { 30484 return (key.startsWith("while") || 30485 (key.startsWith("drag") && key !== "draggable") || 30486 key.startsWith("layout") || 30487 key.startsWith("onTap") || 30488 key.startsWith("onPan") || 30489 key.startsWith("onLayout") || 30490 validMotionProps.has(key)); 30491} 30492 30493let shouldForward = (key) => !isValidMotionProp(key); 30494function loadExternalIsValidProp(isValidProp) { 30495 if (!isValidProp) 30496 return; 30497 // Explicitly filter our events 30498 shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key); 30499} 30500/** 30501 * Emotion and Styled Components both allow users to pass through arbitrary props to their components 30502 * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which 30503 * of these should be passed to the underlying DOM node. 30504 * 30505 * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props 30506 * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props 30507 * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of 30508 * `@emotion/is-prop-valid`, however to fix this problem we need to use it. 30509 * 30510 * By making it an optionalDependency we can offer this functionality only in the situations where it's 30511 * actually required. 30512 */ 30513try { 30514 /** 30515 * We attempt to import this package but require won't be defined in esm environments, in that case 30516 * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed 30517 * in favour of explicit injection. 30518 */ 30519 loadExternalIsValidProp(require("@emotion/is-prop-valid").default); 30520} 30521catch { 30522 // We don't need to actually do anything here - the fallback is the existing `isPropValid`. 30523} 30524function filterProps(props, isDom, forwardMotionProps) { 30525 const filteredProps = {}; 30526 for (const key in props) { 30527 /** 30528 * values is considered a valid prop by Emotion, so if it's present 30529 * this will be rendered out to the DOM unless explicitly filtered. 30530 * 30531 * We check the type as it could be used with the `feColorMatrix` 30532 * element, which we support. 30533 */ 30534 if (key === "values" && typeof props.values === "object") 30535 continue; 30536 if (shouldForward(key) || 30537 (forwardMotionProps === true && isValidMotionProp(key)) || 30538 (!isDom && !isValidMotionProp(key)) || 30539 // If trying to use native HTML drag events, forward drag listeners 30540 (props["draggable"] && 30541 key.startsWith("onDrag"))) { 30542 filteredProps[key] = 30543 props[key]; 30544 } 30545 } 30546 return filteredProps; 30547} 30548 30549function createDOMMotionComponentProxy(componentFactory) { 30550 if (typeof Proxy === "undefined") { 30551 return componentFactory; 30552 } 30553 const componentCache = /* @__PURE__ */ new Map(); 30554 const deprecatedFactoryFunction = (...args) => { 30555 return componentFactory(...args); 30556 }; 30557 return new Proxy(deprecatedFactoryFunction, { 30558 /** 30559 * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. 30560 * The prop name is passed through as `key` and we can use that to generate a `motion` 30561 * DOM component with that name. 30562 */ 30563 get: (_target, key) => { 30564 if (key === "create") 30565 return componentFactory; 30566 if (!componentCache.has(key)) { 30567 componentCache.set(key, componentFactory(key)); 30568 } 30569 return componentCache.get(key); 30570 } 30571 }); 30572} 30573 30574const MotionContext = /* @__PURE__ */ reactExports.createContext({}); 30575 30576function isAnimationControls(v) { 30577 return (v !== null && 30578 typeof v === "object" && 30579 typeof v.start === "function"); 30580} 30581 30582/** 30583 * Decides if the supplied variable is variant label 30584 */ 30585function isVariantLabel(v) { 30586 return typeof v === "string" || Array.isArray(v); 30587} 30588 30589const variantPriorityOrder = [ 30590 "animate", 30591 "whileInView", 30592 "whileFocus", 30593 "whileHover", 30594 "whileTap", 30595 "whileDrag", 30596 "exit", 30597]; 30598const variantProps = ["initial", ...variantPriorityOrder]; 30599 30600function isControllingVariants(props) { 30601 return (isAnimationControls(props.animate) || 30602 variantProps.some((name) => isVariantLabel(props[name]))); 30603} 30604function isVariantNode(props) { 30605 return Boolean(isControllingVariants(props) || props.variants); 30606} 30607 30608function getCurrentTreeVariants(props, context) { 30609 if (isControllingVariants(props)) { 30610 const { initial, animate } = props; 30611 return { 30612 initial: initial === false || isVariantLabel(initial) 30613 ? initial 30614 : undefined, 30615 animate: isVariantLabel(animate) ? animate : undefined, 30616 }; 30617 } 30618 return props.inherit !== false ? context : {}; 30619} 30620 30621function useCreateMotionContext(props) { 30622 const { initial, animate } = getCurrentTreeVariants(props, reactExports.useContext(MotionContext)); 30623 return reactExports.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]); 30624} 30625function variantLabelsAsDependency(prop) { 30626 return Array.isArray(prop) ? prop.join(" ") : prop; 30627} 30628 30629const motionComponentSymbol = Symbol.for("motionComponentSymbol"); 30630 30631function isRefObject(ref) { 30632 return (ref && 30633 typeof ref === "object" && 30634 Object.prototype.hasOwnProperty.call(ref, "current")); 30635} 30636 30637/** 30638 * Creates a ref function that, when called, hydrates the provided 30639 * external ref and VisualElement. 30640 */ 30641function useMotionRef(visualState, visualElement, externalRef) { 30642 return reactExports.useCallback((instance) => { 30643 if (instance) { 30644 visualState.onMount && visualState.onMount(instance); 30645 } 30646 if (visualElement) { 30647 if (instance) { 30648 visualElement.mount(instance); 30649 } 30650 else { 30651 visualElement.unmount(); 30652 } 30653 } 30654 if (externalRef) { 30655 if (typeof externalRef === "function") { 30656 externalRef(instance); 30657 } 30658 else if (isRefObject(externalRef)) { 30659 externalRef.current = instance; 30660 } 30661 } 30662 }, 30663 /** 30664 * Only pass a new ref callback to React if we've received a visual element 30665 * factory. Otherwise we'll be mounting/remounting every time externalRef 30666 * or other dependencies change. 30667 */ 30668 [visualElement]); 30669} 30670 30671/** 30672 * Convert camelCase to dash-case properties. 30673 */ 30674const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(); 30675 30676const optimizedAppearDataId = "framerAppearId"; 30677const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId); 30678 30679/** 30680 * Internal, exported only for usage in Framer 30681 */ 30682const SwitchLayoutGroupContext = reactExports.createContext({}); 30683 30684function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) { 30685 const { visualElement: parent } = reactExports.useContext(MotionContext); 30686 const lazyContext = reactExports.useContext(LazyContext); 30687 const presenceContext = reactExports.useContext(PresenceContext); 30688 const reducedMotionConfig = reactExports.useContext(MotionConfigContext).reducedMotion; 30689 const visualElementRef = reactExports.useRef(null); 30690 /** 30691 * If we haven't preloaded a renderer, check to see if we have one lazy-loaded 30692 */ 30693 createVisualElement = createVisualElement || lazyContext.renderer; 30694 if (!visualElementRef.current && createVisualElement) { 30695 visualElementRef.current = createVisualElement(Component, { 30696 visualState, 30697 parent, 30698 props, 30699 presenceContext, 30700 blockInitialAnimation: presenceContext
30701 ? presenceContext.initial === false 30702 : false, 30703 reducedMotionConfig, 30704 }); 30705 } 30706 const visualElement = visualElementRef.current; 30707 /** 30708 * Load Motion gesture and animation features. These are rendered as renderless 30709 * components so each feature can optionally make use of React lifecycle methods. 30710 */ 30711 const initialLayoutGroupConfig = reactExports.useContext(SwitchLayoutGroupContext); 30712 if (visualElement && 30713 !visualElement.projection && 30714 ProjectionNodeConstructor && 30715 (visualElement.type === "html" || visualElement.type === "svg")) { 30716 createProjectionNode$1(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig); 30717 } 30718 const isMounted = reactExports.useRef(false); 30719 reactExports.useInsertionEffect(() => { 30720 /** 30721 * Check the component has already mounted before calling 30722 * `update` unnecessarily. This ensures we skip the initial update. 30723 */ 30724 if (visualElement && isMounted.current) { 30725 visualElement.update(props, presenceContext); 30726 } 30727 }); 30728 /** 30729 * Cache this value as we want to know whether HandoffAppearAnimations 30730 * was present on initial render - it will be deleted after this. 30731 */ 30732 const optimisedAppearId = props[optimizedAppearDataAttribute]; 30733 const wantsHandoff = reactExports.useRef(Boolean(optimisedAppearId) && 30734 !window.MotionHandoffIsComplete?.(optimisedAppearId) && 30735 window.MotionHasOptimisedAnimation?.(optimisedAppearId)); 30736 useIsomorphicLayoutEffect(() => { 30737 if (!visualElement) 30738 return; 30739 isMounted.current = true; 30740 window.MotionIsMounted = true; 30741 visualElement.updateFeatures(); 30742 microtask.render(visualElement.render); 30743 /** 30744 * Ideally this function would always run in a useEffect. 30745 * 30746 * However, if we have optimised appear animations to handoff from, 30747 * it needs to happen synchronously to ensure there's no flash of 30748 * incorrect styles in the event of a hydration error. 30749 * 30750 * So if we detect a situtation where optimised appear animations 30751 * are running, we use useLayoutEffect to trigger animations. 30752 */ 30753 if (wantsHandoff.current && visualElement.animationState) { 30754 visualElement.animationState.animateChanges(); 30755 } 30756 }); 30757 reactExports.useEffect(() => { 30758 if (!visualElement) 30759 return; 30760 if (!wantsHandoff.current && visualElement.animationState) { 30761 visualElement.animationState.animateChanges(); 30762 } 30763 if (wantsHandoff.current) { 30764 // This ensures all future calls to animateChanges() in this component will run in useEffect 30765 queueMicrotask(() => { 30766 window.MotionHandoffMarkAsComplete?.(optimisedAppearId); 30767 }); 30768 wantsHandoff.current = false; 30769 } 30770 }); 30771 return visualElement; 30772} 30773function createProjectionNode$1(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) { 30774 const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, layoutCrossfade, } = props; 30775 visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] 30776 ? undefined 30777 : getClosestProjectingNode(visualElement.parent)); 30778 visualElement.projection.setOptions({ 30779 layoutId, 30780 layout, 30781 alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)), 30782 visualElement, 30783 /** 30784 * TODO: Update options in an effect. This could be tricky as it'll be too late 30785 * to update by the time layout animations run. 30786 * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, 30787 * ensuring it gets called if there's no potential layout animations. 30788 * 30789 */ 30790 animationType: typeof layout === "string" ? layout : "both", 30791 initialPromotionConfig, 30792 crossfade: layoutCrossfade, 30793 layoutScroll, 30794 layoutRoot, 30795 }); 30796} 30797function getClosestProjectingNode(visualElement) { 30798 if (!visualElement) 30799 return undefined; 30800 return visualElement.options.allowProjection !== false 30801 ? visualElement.projection 30802 : getClosestProjectingNode(visualElement.parent); 30803} 30804 30805function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component }) { 30806 preloadedFeatures && loadFeatures(preloadedFeatures); 30807 function MotionComponent(props, externalRef) { 30808 let MeasureLayout; 30809 const configAndProps = { 30810 ...reactExports.useContext(MotionConfigContext), 30811 ...props, 30812 layoutId: useLayoutId(props) 30813 }; 30814 const { isStatic } = configAndProps; 30815 const context = useCreateMotionContext(props); 30816 const visualState = useVisualState(props, isStatic); 30817 if (!isStatic && isBrowser) { 30818 useStrictMode(); 30819 const layoutProjection = getProjectionFunctionality(configAndProps); 30820 MeasureLayout = layoutProjection.MeasureLayout; 30821 context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode); 30822 } 30823 return jsxRuntimeExports.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? jsxRuntimeExports.jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps }) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] }); 30824 } 30825 MotionComponent.displayName = `motion.${typeof Component === "string" ? Component : `create(${Component.displayName ?? Component.name ?? ""})`}`; 30826 const ForwardRefMotionComponent = reactExports.forwardRef(MotionComponent); 30827 ForwardRefMotionComponent[motionComponentSymbol] = Component; 30828 return ForwardRefMotionComponent; 30829} 30830function useLayoutId({ layoutId }) { 30831 const layoutGroupId = reactExports.useContext(LayoutGroupContext).id; 30832 return layoutGroupId && layoutId !== void 0 ? layoutGroupId + "-" + layoutId : layoutId; 30833} 30834function useStrictMode(configAndProps, preloadedFeatures) { 30835 reactExports.useContext(LazyContext).strict; 30836} 30837function getProjectionFunctionality(props) { 30838 const { drag, layout } = featureDefinitions; 30839 if (!drag && !layout) 30840 return {}; 30841 const combined = { ...drag, ...layout }; 30842 return {
30843 MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props) ? combined.MeasureLayout : void 0, 30844 ProjectionNode: combined.ProjectionNode 30845 }; 30846} 30847 30848const scaleCorrectors = {}; 30849function addScaleCorrector(correctors) { 30850 for (const key in correctors) { 30851 scaleCorrectors[key] = correctors[key]; 30852 if (isCSSVariableName(key)) { 30853 scaleCorrectors[key].isCSSVariable = true; 30854 } 30855 } 30856} 30857 30858function isForcedMotionValue(key, { layout, layoutId }) { 30859 return (transformProps.has(key) || 30860 key.startsWith("origin") || 30861 ((layout || layoutId !== undefined) && 30862 (!!scaleCorrectors[key] || key === "opacity"))); 30863} 30864 30865const isMotionValue = (value) => Boolean(value && value.getVelocity);
vendor: 6,058 bytes, lines 30865-31038
30865 30866 30867const translateAlias = { 30868 x: "translateX", 30869 y: "translateY", 30870 z: "translateZ", 30871 transformPerspective: "perspective", 30872}; 30873const numTransforms = transformPropOrder.length; 30874/** 30875 * Build a CSS transform style from individual x/y/scale etc properties. 30876 * 30877 * This outputs with a default order of transforms/scales/rotations, this can be customised by 30878 * providing a transformTemplate function. 30879 */ 30880function buildTransform(latestValues, transform, transformTemplate) { 30881 // The transform string we're going to build into. 30882 let transformString = ""; 30883 let transformIsDefault = true; 30884 /** 30885 * Loop over all possible transforms in order, adding the ones that 30886 * are present to the transform string. 30887 */ 30888 for (let i = 0; i < numTransforms; i++) { 30889 const key = transformPropOrder[i]; 30890 const value = latestValues[key]; 30891 if (value === undefined) 30892 continue; 30893 let valueIsDefault = true; 30894 if (typeof value === "number") { 30895 valueIsDefault = value === (key.startsWith("scale") ? 1 : 0); 30896 } 30897 else { 30898 valueIsDefault = parseFloat(value) === 0; 30899 } 30900 if (!valueIsDefault || transformTemplate) { 30901 const valueAsType = getValueAsType(value, numberValueTypes[key]); 30902 if (!valueIsDefault) { 30903 transformIsDefault = false; 30904 const transformName = translateAlias[key] || key; 30905 transformString += `${transformName}(${valueAsType}) `; 30906 } 30907 if (transformTemplate) { 30908 transform[key] = valueAsType; 30909 } 30910 } 30911 } 30912 transformString = transformString.trim(); 30913 // If we have a custom `transform` template, pass our transform values and 30914 // generated transformString to that before returning 30915 if (transformTemplate) { 30916 transformString = transformTemplate(transform, transformIsDefault ? "" : transformString); 30917 } 30918 else if (transformIsDefault) { 30919 transformString = "none"; 30920 } 30921 return transformString; 30922} 30923 30924function buildHTMLStyles(state, latestValues, transformTemplate) { 30925 const { style, vars, transformOrigin } = state; 30926 // Track whether we encounter any transform or transformOrigin values. 30927 let hasTransform = false; 30928 let hasTransformOrigin = false; 30929 /** 30930 * Loop over all our latest animated values and decide whether to handle them 30931 * as a style or CSS variable. 30932 * 30933 * Transforms and transform origins are kept separately for further processing. 30934 */ 30935 for (const key in latestValues) { 30936 const value = latestValues[key]; 30937 if (transformProps.has(key)) { 30938 // If this is a transform, flag to enable further transform processing 30939 hasTransform = true; 30940 continue; 30941 } 30942 else if (isCSSVariableName(key)) { 30943 vars[key] = value; 30944 continue; 30945 } 30946 else { 30947 // Convert the value to its default value type, ie 0 -> "0px" 30948 const valueAsType = getValueAsType(value, numberValueTypes[key]); 30949 if (key.startsWith("origin")) { 30950 // If this is a transform origin, flag and enable further transform-origin processing 30951 hasTransformOrigin = true; 30952 transformOrigin[key] = 30953 valueAsType; 30954 } 30955 else { 30956 style[key] = valueAsType; 30957 } 30958 } 30959 } 30960 if (!latestValues.transform) { 30961 if (hasTransform || transformTemplate) { 30962 style.transform = buildTransform(latestValues, state.transform, transformTemplate); 30963 } 30964 else if (style.transform) { 30965 /** 30966 * If we have previously created a transform but currently don't have any, 30967 * reset transform style to none. 30968 */ 30969 style.transform = "none"; 30970 } 30971 } 30972 /** 30973 * Build a transformOrigin style. Uses the same defaults as the browser for 30974 * undefined origins. 30975 */ 30976 if (hasTransformOrigin) { 30977 const { originX = "50%", originY = "50%", originZ = 0, } = transformOrigin; 30978 style.transformOrigin = `${originX} ${originY} ${originZ}`; 30979 } 30980} 30981 30982const createHtmlRenderState = () => ({ 30983 style: {}, 30984 transform: {}, 30985 transformOrigin: {}, 30986 vars: {}, 30987}); 30988 30989function copyRawValuesOnly(target, source, props) { 30990 for (const key in source) { 30991 if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) { 30992 target[key] = source[key]; 30993 } 30994 } 30995} 30996function useInitialMotionValues({ transformTemplate }, visualState) { 30997 return reactExports.useMemo(() => { 30998 const state = createHtmlRenderState(); 30999 buildHTMLStyles(state, visualState, transformTemplate); 31000 return Object.assign({}, state.vars, state.style); 31001 }, [visualState]); 31002} 31003function useStyle(props, visualState) { 31004 const styleProp = props.style || {}; 31005 const style = {}; 31006 /** 31007 * Copy non-Motion Values straight into style 31008 */ 31009 copyRawValuesOnly(style, styleProp, props); 31010 Object.assign(style, useInitialMotionValues(props, visualState)); 31011 return style; 31012} 31013function useHTMLProps(props, visualState) { 31014 // The `any` isn't ideal but it is the type of createElement props argument 31015 const htmlProps = {}; 31016 const style = useStyle(props, visualState); 31017 if (props.drag && props.dragListener !== false) { 31018 // Disable the ghost element when a user drags 31019 htmlProps.draggable = false; 31020 // Disable text selection 31021 style.userSelect = 31022 style.WebkitUserSelect = 31023 style.WebkitTouchCallout = 31024 "none"; 31025 // Disable scrolling on the draggable direction 31026 style.touchAction = 31027 props.drag === true 31028 ? "none" 31029 : `pan-${props.drag === "x" ? "y" : "x"}`; 31030 } 31031 if (props.tabIndex === undefined && 31032 (props.onTap || props.onTapStart || props.whileTap)) { 31033 htmlProps.tabIndex = 0; 31034 } 31035 htmlProps.style = style; 31036 return htmlProps; 31037} 31038
vendor: 31,638 bytes, lines 31039-31897
31039/** 31040 * We keep these listed separately as we use the lowercase tag names as part 31041 * of the runtime bundle to detect SVG components 31042 */ 31043const lowercaseSVGElements = [ 31044 "animate", 31045 "circle", 31046 "defs", 31047 "desc", 31048 "ellipse", 31049 "g", 31050 "image", 31051 "line", 31052 "filter", 31053 "marker", 31054 "mask", 31055 "metadata", 31056 "path", 31057 "pattern", 31058 "polygon", 31059 "polyline", 31060 "rect", 31061 "stop", 31062 "switch", 31063 "symbol", 31064 "svg", 31065 "text", 31066 "tspan", 31067 "use", 31068 "view", 31069]; 31070 31071function isSVGComponent(Component) { 31072 if ( 31073 /** 31074 * If it's not a string, it's a custom React component. Currently we only support 31075 * HTML custom React components. 31076 */ 31077 typeof Component !== "string" || 31078 /** 31079 * If it contains a dash, the element is a custom HTML webcomponent. 31080 */ 31081 Component.includes("-")) { 31082 return false; 31083 } 31084 else if ( 31085 /** 31086 * If it's in our list of lowercase SVG tags, it's an SVG component 31087 */ 31088 lowercaseSVGElements.indexOf(Component) > -1 || 31089 /** 31090 * If it contains a capital letter, it's an SVG component 31091 */ 31092 /[A-Z]/u.test(Component)) { 31093 return true; 31094 } 31095 return false; 31096} 31097 31098const dashKeys = { 31099 offset: "stroke-dashoffset", 31100 array: "stroke-dasharray", 31101}; 31102const camelKeys = { 31103 offset: "strokeDashoffset", 31104 array: "strokeDasharray", 31105}; 31106/** 31107 * Build SVG path properties. Uses the path's measured length to convert 31108 * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset 31109 * and stroke-dasharray attributes. 31110 * 31111 * This function is mutative to reduce per-frame GC. 31112 */ 31113function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) { 31114 // Normalise path length by setting SVG attribute pathLength to 1 31115 attrs.pathLength = 1; 31116 // We use dash case when setting attributes directly to the DOM node and camel case 31117 // when defining props on a React component. 31118 const keys = useDashCase ? dashKeys : camelKeys; 31119 // Build the dash offset 31120 attrs[keys.offset] = px.transform(-offset); 31121 // Build the dash array 31122 const pathLength = px.transform(length); 31123 const pathSpacing = px.transform(spacing); 31124 attrs[keys.array] = `${pathLength} ${pathSpacing}`; 31125} 31126 31127/** 31128 * Build SVG visual attrbutes, like cx and style.transform 31129 */ 31130function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing = 1, pathOffset = 0, 31131// This is object creation, which we try to avoid per-frame. 31132...latest }, isSVGTag, transformTemplate, styleProp) { 31133 buildHTMLStyles(state, latest, transformTemplate); 31134 /** 31135 * For svg tags we just want to make sure viewBox is animatable and treat all the styles 31136 * as normal HTML tags. 31137 */ 31138 if (isSVGTag) { 31139 if (state.style.viewBox) { 31140 state.attrs.viewBox = state.style.viewBox; 31141 } 31142 return; 31143 } 31144 state.attrs = state.style; 31145 state.style = {}; 31146 const { attrs, style } = state; 31147 /** 31148 * However, we apply transforms as CSS transforms. 31149 * So if we detect a transform, transformOrigin we take it from attrs and copy it into style. 31150 */ 31151 if (attrs.transform) { 31152 style.transform = attrs.transform; 31153 delete attrs.transform; 31154 } 31155 if (style.transform || attrs.transformOrigin) { 31156 style.transformOrigin = attrs.transformOrigin ?? "50% 50%"; 31157 delete attrs.transformOrigin; 31158 } 31159 if (style.transform) { 31160 /** 31161 * SVG's element transform-origin uses its own median as a reference. 31162 * Therefore, transformBox becomes a fill-box 31163 */ 31164 style.transformBox = styleProp?.transformBox ?? "fill-box"; 31165 delete attrs.transformBox; 31166 } 31167 // Render attrX/attrY/attrScale as attributes 31168 if (attrX !== undefined) 31169 attrs.x = attrX; 31170 if (attrY !== undefined) 31171 attrs.y = attrY; 31172 if (attrScale !== undefined) 31173 attrs.scale = attrScale; 31174 // Build SVG path if one has been defined 31175 if (pathLength !== undefined) { 31176 buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false); 31177 } 31178} 31179 31180const createSvgRenderState = () => ({ 31181 ...createHtmlRenderState(), 31182 attrs: {}, 31183}); 31184 31185const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg"; 31186 31187function useSVGProps(props, visualState, _isStatic, Component) { 31188 const visualProps = reactExports.useMemo(() => { 31189 const state = createSvgRenderState(); 31190 buildSVGAttrs(state, visualState, isSVGTag(Component), props.transformTemplate, props.style); 31191 return { 31192 ...state.attrs, 31193 style: { ...state.style }, 31194 }; 31195 }, [visualState]); 31196 if (props.style) { 31197 const rawStyles = {}; 31198 copyRawValuesOnly(rawStyles, props.style, props); 31199 visualProps.style = { ...rawStyles, ...visualProps.style }; 31200 } 31201 return visualProps; 31202} 31203 31204function createUseRender(forwardMotionProps = false) { 31205 const useRender = (Component, props, ref, { latestValues }, isStatic) => { 31206 const useVisualProps = isSVGComponent(Component) 31207 ? useSVGProps 31208 : useHTMLProps; 31209 const visualProps = useVisualProps(props, latestValues, isStatic, Component); 31210 const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps); 31211 const elementProps = Component !== reactExports.Fragment 31212 ? { ...filteredProps, ...visualProps, ref } 31213 : {}; 31214 /** 31215 * If component has been handed a motion value as its child, 31216 * memoise its initial value and render that. Subsequent updates 31217 * will be handled by the onChange handler 31218 */ 31219 const { children } = props; 31220 const renderedChildren = reactExports.useMemo(() => (isMotionValue(children) ? children.get() : children), [children]); 31221 return reactExports.createElement(Component, { 31222 ...elementProps, 31223 children: renderedChildren, 31224 }); 31225 }; 31226 return useRender; 31227} 31228 31229function getValueState(visualElement) { 31230 const state = [{}, {}]; 31231 visualElement?.values.forEach((value, key) => { 31232 state[0][key] = value.get(); 31233 state[1][key] = value.getVelocity(); 31234 }); 31235 return state; 31236} 31237function resolveVariantFromProps(props, definition, custom, visualElement) { 31238 /** 31239 * If the variant definition is a function, resolve. 31240 */ 31241 if (typeof definition === "function") { 31242 const [current, velocity] = getValueState(visualElement); 31243 definition = definition(custom !== undefined ? custom : props.custom, current, velocity); 31244 } 31245 /** 31246 * If the variant definition is a variant label, or 31247 * the function returned a variant label, resolve. 31248 */ 31249 if (typeof definition === "string") { 31250 definition = props.variants && props.variants[definition]; 31251 } 31252 /** 31253 * At this point we've resolved both functions and variant labels, 31254 * but the resolved variant label might itself have been a function. 31255 * If so, resolve. This can only have returned a valid target object. 31256 */ 31257 if (typeof definition === "function") { 31258 const [current, velocity] = getValueState(visualElement); 31259 definition = definition(custom !== undefined ? custom : props.custom, current, velocity); 31260 } 31261 return definition; 31262} 31263 31264/** 31265 * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself 31266 * 31267 * TODO: Remove and move to library 31268 */ 31269function resolveMotionValue(value) { 31270 return isMotionValue(value) ? value.get() : value; 31271} 31272 31273function makeState({ scrapeMotionValuesFromProps, createRenderState, }, props, context, presenceContext) { 31274 const state = { 31275 latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps), 31276 renderState: createRenderState(), 31277 }; 31278 return state; 31279} 31280const makeUseVisualState = (config) => (props, isStatic) => { 31281 const context = reactExports.useContext(MotionContext); 31282 const presenceContext = reactExports.useContext(PresenceContext); 31283 const make = () => makeState(config, props, context, presenceContext); 31284 return isStatic ? make() : useConstant(make); 31285}; 31286function makeLatestValues(props, context, presenceContext, scrapeMotionValues) { 31287 const values = {}; 31288 const motionValues = scrapeMotionValues(props, {}); 31289 for (const key in motionValues) { 31290 values[key] = resolveMotionValue(motionValues[key]); 31291 } 31292 let { initial, animate } = props; 31293 const isControllingVariants$1 = isControllingVariants(props); 31294 const isVariantNode$1 = isVariantNode(props); 31295 if (context && 31296 isVariantNode$1 && 31297 !isControllingVariants$1 && 31298 props.inherit !== false) { 31299 if (initial === undefined) 31300 initial = context.initial; 31301 if (animate === undefined) 31302 animate = context.animate; 31303 } 31304 let isInitialAnimationBlocked = presenceContext 31305 ? presenceContext.initial === false 31306 : false; 31307 isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false; 31308 const variantToSet = isInitialAnimationBlocked ? animate : initial; 31309 if (variantToSet && 31310 typeof variantToSet !== "boolean" && 31311 !isAnimationControls(variantToSet)) { 31312 const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet]; 31313 for (let i = 0; i < list.length; i++) { 31314 const resolved = resolveVariantFromProps(props, list[i]); 31315 if (resolved) { 31316 const { transitionEnd, transition, ...target } = resolved; 31317 for (const key in target) { 31318 let valueTarget = target[key]; 31319 if (Array.isArray(valueTarget)) { 31320 /** 31321 * Take final keyframe if the initial animation is blocked because 31322 * we want to initialise at the end of that blocked animation. 31323 */ 31324 const index = isInitialAnimationBlocked 31325 ? valueTarget.length - 1 31326 : 0; 31327 valueTarget = valueTarget[index]; 31328 } 31329 if (valueTarget !== null) { 31330 values[key] = valueTarget; 31331 } 31332 } 31333 for (const key in transitionEnd) { 31334 values[key] = transitionEnd[key]; 31335 } 31336 } 31337 } 31338 } 31339 return values; 31340} 31341 31342function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) { 31343 const { style } = props; 31344 const newValues = {}; 31345 for (const key in style) { 31346 if (isMotionValue(style[key]) || 31347 (prevProps.style && 31348 isMotionValue(prevProps.style[key])) || 31349 isForcedMotionValue(key, props) || 31350 visualElement?.getValue(key)?.liveStyle !== undefined) { 31351 newValues[key] = style[key]; 31352 } 31353 } 31354 return newValues; 31355} 31356 31357const htmlMotionConfig = { 31358 useVisualState: makeUseVisualState({ 31359 scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1, 31360 createRenderState: createHtmlRenderState, 31361 }), 31362}; 31363 31364function scrapeMotionValuesFromProps(props, prevProps, visualElement) { 31365 const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement); 31366 for (const key in props) { 31367 if (isMotionValue(props[key]) || 31368 isMotionValue(prevProps[key])) { 31369 const targetKey = transformPropOrder.indexOf(key) !== -1 31370 ? "attr" + key.charAt(0).toUpperCase() + key.substring(1) 31371 : key; 31372 newValues[targetKey] = props[key]; 31373 } 31374 } 31375 return newValues; 31376} 31377 31378const svgMotionConfig = { 31379 useVisualState: makeUseVisualState({ 31380 scrapeMotionValuesFromProps: scrapeMotionValuesFromProps, 31381 createRenderState: createSvgRenderState, 31382 }), 31383}; 31384 31385function createMotionComponentFactory(preloadedFeatures, createVisualElement) { 31386 return function createMotionComponent(Component, { forwardMotionProps } = { forwardMotionProps: false }) { 31387 const baseConfig = isSVGComponent(Component) 31388 ? svgMotionConfig 31389 : htmlMotionConfig; 31390 const config = { 31391 ...baseConfig, 31392 preloadedFeatures, 31393 useRender: createUseRender(forwardMotionProps), 31394 createVisualElement, 31395 Component, 31396 }; 31397 return createRendererMotionComponent(config); 31398 }; 31399} 31400 31401function resolveVariant(visualElement, definition, custom) { 31402 const props = visualElement.getProps(); 31403 return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement); 31404} 31405 31406const isKeyframesTarget = (v) => { 31407 return Array.isArray(v); 31408}; 31409 31410/** 31411 * Set VisualElement's MotionValue, creating a new MotionValue for it if 31412 * it doesn't exist. 31413 */ 31414function setMotionValue(visualElement, key, value) { 31415 if (visualElement.hasValue(key)) { 31416 visualElement.getValue(key).set(value); 31417 } 31418 else { 31419 visualElement.addValue(key, motionValue(value)); 31420 } 31421} 31422function resolveFinalValueInKeyframes(v) { 31423 // TODO maybe throw if v.length - 1 is placeholder token? 31424 return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v; 31425} 31426function setTarget(visualElement, definition) { 31427 const resolved = resolveVariant(visualElement, definition); 31428 let { transitionEnd = {}, transition = {}, ...target } = resolved || {}; 31429 target = { ...target, ...transitionEnd }; 31430 for (const key in target) { 31431 const value = resolveFinalValueInKeyframes(target[key]); 31432 setMotionValue(visualElement, key, value); 31433 } 31434} 31435 31436function isWillChangeMotionValue(value) { 31437 return Boolean(isMotionValue(value) && value.add); 31438} 31439 31440function addValueToWillChange(visualElement, key) { 31441 const willChange = visualElement.getValue("willChange"); 31442 /** 31443 * It could be that a user has set willChange to a regular MotionValue, 31444 * in which case we can't add the value to it. 31445 */ 31446 if (isWillChangeMotionValue(willChange)) { 31447 return willChange.add(key); 31448 } 31449 else if (!willChange && MotionGlobalConfig.WillChange) { 31450 const newWillChange = new MotionGlobalConfig.WillChange("auto"); 31451 visualElement.addValue("willChange", newWillChange); 31452 newWillChange.add(key); 31453 } 31454} 31455 31456function getOptimisedAppearId(visualElement) { 31457 return visualElement.props[optimizedAppearDataAttribute]; 31458} 31459 31460const isNotNull = (value) => value !== null; 31461function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) { 31462 const resolvedKeyframes = keyframes.filter(isNotNull); 31463 const index = repeat && repeatType !== "loop" && repeat % 2 === 1 31464 ? 0 31465 : resolvedKeyframes.length - 1; 31466 return resolvedKeyframes[index] 31467 ; 31468} 31469 31470const underDampedSpring = { 31471 type: "spring", 31472 stiffness: 500, 31473 damping: 25, 31474 restSpeed: 10, 31475}; 31476const criticallyDampedSpring = (target) => ({ 31477 type: "spring", 31478 stiffness: 550, 31479 damping: target === 0 ? 2 * Math.sqrt(550) : 30, 31480 restSpeed: 10, 31481}); 31482const keyframesTransition = { 31483 type: "keyframes", 31484 duration: 0.8, 31485}; 31486/** 31487 * Default easing curve is a slightly shallower version of 31488 * the default browser easing curve. 31489 */ 31490const ease = { 31491 type: "keyframes", 31492 ease: [0.25, 0.1, 0.35, 1], 31493 duration: 0.3, 31494}; 31495const getDefaultTransition = (valueKey, { keyframes }) => { 31496 if (keyframes.length > 2) { 31497 return keyframesTransition; 31498 } 31499 else if (transformProps.has(valueKey)) { 31500 return valueKey.startsWith("scale") 31501 ? criticallyDampedSpring(keyframes[1]) 31502 : underDampedSpring; 31503 } 31504 return ease; 31505}; 31506 31507/** 31508 * Decide whether a transition is defined on a given Transition. 31509 * This filters out orchestration options and returns true 31510 * if any options are left. 31511 */ 31512function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) { 31513 return !!Object.keys(transition).length; 31514} 31515 31516const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => { 31517 const valueTransition = getValueTransition(transition, name) || {}; 31518 /** 31519 * Most transition values are currently completely overwritten by value-specific 31520 * transitions. In the future it'd be nicer to blend these transitions. But for now 31521 * delay actually does inherit from the root transition if not value-specific. 31522 */ 31523 const delay = valueTransition.delay || transition.delay || 0; 31524 /** 31525 * Elapsed isn't a public transition option but can be passed through from 31526 * optimized appear effects in milliseconds. 31527 */ 31528 let { elapsed = 0 } = transition; 31529 elapsed = elapsed - secondsToMilliseconds(delay); 31530 const options = { 31531 keyframes: Array.isArray(target) ? target : [null, target], 31532 ease: "easeOut", 31533 velocity: value.getVelocity(), 31534 ...valueTransition, 31535 delay: -elapsed, 31536 onUpdate: (v) => { 31537 value.set(v); 31538 valueTransition.onUpdate && valueTransition.onUpdate(v); 31539 }, 31540 onComplete: () => { 31541 onComplete(); 31542 valueTransition.onComplete && valueTransition.onComplete(); 31543 }, 31544 name, 31545 motionValue: value, 31546 element: isHandoff ? undefined : element, 31547 }; 31548 /** 31549 * If there's no transition defined for this value, we can generate 31550 * unique transition settings for this value. 31551 */ 31552 if (!isTransitionDefined(valueTransition)) { 31553 Object.assign(options, getDefaultTransition(name, options)); 31554 } 31555 /** 31556 * Both WAAPI and our internal animation functions use durations 31557 * as defined by milliseconds, while our external API defines them 31558 * as seconds. 31559 */ 31560 options.duration && (options.duration = secondsToMilliseconds(options.duration)); 31561 options.repeatDelay && (options.repeatDelay = secondsToMilliseconds(options.repeatDelay)); 31562 /** 31563 * Support deprecated way to set initial value. Prefer keyframe syntax. 31564 */ 31565 if (options.from !== undefined) { 31566 options.keyframes[0] = options.from; 31567 } 31568 let shouldSkip = false; 31569 if (options.type === false || 31570 (options.duration === 0 && !options.repeatDelay)) { 31571 options.duration = 0; 31572 if (options.delay === 0) { 31573 shouldSkip = true; 31574 } 31575 } 31576 if (MotionGlobalConfig.instantAnimations || 31577 MotionGlobalConfig.skipAnimations) { 31578 shouldSkip = true; 31579 options.duration = 0; 31580 options.delay = 0; 31581 } 31582 /** 31583 * If the transition type or easing has been explicitly set by the user 31584 * then we don't want to allow flattening the animation. 31585 */ 31586 options.allowFlatten = !valueTransition.type && !valueTransition.ease; 31587 /** 31588 * If we can or must skip creating the animation, and apply only 31589 * the final keyframe, do so. We also check once keyframes are resolved but 31590 * this early check prevents the need to create an animation at all. 31591 */ 31592 if (shouldSkip && !isHandoff && value.get() !== undefined) { 31593 const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition); 31594 if (finalKeyframe !== undefined) { 31595 frame.update(() => { 31596 options.onUpdate(finalKeyframe); 31597 options.onComplete(); 31598 }); 31599 return; 31600 } 31601 } 31602 return valueTransition.isSync 31603 ? new JSAnimation(options) 31604 : new AsyncMotionValueAnimation(options); 31605}; 31606 31607/** 31608 * Decide whether we should block this animation. Previously, we achieved this 31609 * just by checking whether the key was listed in protectedKeys, but this 31610 * posed problems if an animation was triggered by afterChildren and protectedKeys 31611 * had been set to true in the meantime. 31612 */ 31613function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) { 31614 const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true; 31615 needsAnimating[key] = false; 31616 return shouldBlock; 31617} 31618function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) { 31619 let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition; 31620 if (transitionOverride) 31621 transition = transitionOverride; 31622 const animations = []; 31623 const animationTypeState = type && 31624 visualElement.animationState && 31625 visualElement.animationState.getState()[type]; 31626 for (const key in target) { 31627 const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null); 31628 const valueTarget = target[key]; 31629 if (valueTarget === undefined || 31630 (animationTypeState && 31631 shouldBlockAnimation(animationTypeState, key))) { 31632 continue; 31633 } 31634 const valueTransition = { 31635 delay, 31636 ...getValueTransition(transition || {}, key), 31637 }; 31638 /** 31639 * If the value is already at the defined target, skip the animation. 31640 */ 31641 const currentValue = value.get(); 31642 if (currentValue !== undefined && 31643 !value.isAnimating && 31644 !Array.isArray(valueTarget) && 31645 valueTarget === currentValue && 31646 !valueTransition.velocity) { 31647 continue; 31648 } 31649 /** 31650 * If this is the first time a value is being animated, check 31651 * to see if we're handling off from an existing animation. 31652 */ 31653 let isHandoff = false; 31654 if (window.MotionHandoffAnimation) { 31655 const appearId = getOptimisedAppearId(visualElement); 31656 if (appearId) { 31657 const startTime = window.MotionHandoffAnimation(appearId, key, frame); 31658 if (startTime !== null) { 31659 valueTransition.startTime = startTime; 31660 isHandoff = true; 31661 } 31662 } 31663 } 31664 addValueToWillChange(visualElement, key); 31665 value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && positionalKeys.has(key) 31666 ? { type: false } 31667 : valueTransition, visualElement, isHandoff)); 31668 const animation = value.animation; 31669 if (animation) { 31670 animations.push(animation); 31671 } 31672 } 31673 if (transitionEnd) { 31674 Promise.all(animations).then(() => { 31675 frame.update(() => { 31676 transitionEnd && setTarget(visualElement, transitionEnd); 31677 }); 31678 }); 31679 } 31680 return animations; 31681} 31682 31683function animateVariant(visualElement, variant, options = {}) { 31684 const resolved = resolveVariant(visualElement, variant, options.type === "exit" 31685 ? visualElement.presenceContext?.custom 31686 : undefined); 31687 let { transition = visualElement.getDefaultTransition() || {} } = resolved || {}; 31688 if (options.transitionOverride) { 31689 transition = options.transitionOverride; 31690 } 31691 /** 31692 * If we have a variant, create a callback that runs it as an animation. 31693 * Otherwise, we resolve a Promise immediately for a composable no-op. 31694 */ 31695 const getAnimation = resolved 31696 ? () => Promise.all(animateTarget(visualElement, resolved, options)) 31697 : () => Promise.resolve(); 31698 /** 31699 * If we have children, create a callback that runs all their animations. 31700 * Otherwise, we resolve a Promise immediately for a composable no-op. 31701 */ 31702 const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size 31703 ? (forwardDelay = 0) => { 31704 const { delayChildren = 0, staggerChildren, staggerDirection, } = transition; 31705 return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options); 31706 } 31707 : () => Promise.resolve(); 31708 /** 31709 * If the transition explicitly defines a "when" option, we need to resolve either 31710 * this animation or all children animations before playing the other. 31711 */ 31712 const { when } = transition; 31713 if (when) { 31714 const [first, last] = when === "beforeChildren" 31715 ? [getAnimation, getChildAnimations] 31716 : [getChildAnimations, getAnimation]; 31717 return first().then(() => last()); 31718 } 31719 else { 31720 return Promise.all([getAnimation(), getChildAnimations(options.delay)]); 31721 } 31722} 31723function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) { 31724 const animations = []; 31725 const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren; 31726 const generateStaggerDuration = staggerDirection === 1 31727 ? (i = 0) => i * staggerChildren 31728 : (i = 0) => maxStaggerDuration - i * staggerChildren; 31729 Array.from(visualElement.variantChildren) 31730 .sort(sortByTreeOrder) 31731 .forEach((child, i) => { 31732 child.notify("AnimationStart", variant); 31733 animations.push(animateVariant(child, variant, { 31734 ...options, 31735 delay: delayChildren + generateStaggerDuration(i), 31736 }).then(() => child.notify("AnimationComplete", variant))); 31737 }); 31738 return Promise.all(animations); 31739} 31740function sortByTreeOrder(a, b) { 31741 return a.sortNodePosition(b); 31742} 31743 31744function animateVisualElement(visualElement, definition, options = {}) { 31745 visualElement.notify("AnimationStart", definition); 31746 let animation; 31747 if (Array.isArray(definition)) { 31748 const animations = definition.map((variant) => animateVariant(visualElement, variant, options)); 31749 animation = Promise.all(animations); 31750 } 31751 else if (typeof definition === "string") { 31752 animation = animateVariant(visualElement, definition, options); 31753 } 31754 else { 31755 const resolvedDefinition = typeof definition === "function" 31756 ? resolveVariant(visualElement, definition, options.custom) 31757 : definition; 31758 animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options)); 31759 } 31760 return animation.then(() => { 31761 visualElement.notify("AnimationComplete", definition); 31762 }); 31763} 31764 31765function shallowCompare(next, prev) { 31766 if (!Array.isArray(prev)) 31767 return false; 31768 const prevLength = prev.length; 31769 if (prevLength !== next.length) 31770 return false; 31771 for (let i = 0; i < prevLength; i++) { 31772 if (prev[i] !== next[i]) 31773 return false; 31774 } 31775 return true; 31776} 31777 31778const numVariantProps = variantProps.length; 31779function getVariantContext(visualElement) { 31780 if (!visualElement) 31781 return undefined; 31782 if (!visualElement.isControllingVariants) { 31783 const context = visualElement.parent 31784 ? getVariantContext(visualElement.parent) || {} 31785 : {}; 31786 if (visualElement.props.initial !== undefined) { 31787 context.initial = visualElement.props.initial; 31788 } 31789 return context; 31790 } 31791 const context = {}; 31792 for (let i = 0; i < numVariantProps; i++) { 31793 const name = variantProps[i]; 31794 const prop = visualElement.props[name]; 31795 if (isVariantLabel(prop) || prop === false) { 31796 context[name] = prop; 31797 } 31798 } 31799 return context; 31800} 31801 31802const reversePriorityOrder = [...variantPriorityOrder].reverse(); 31803const numAnimationTypes = variantPriorityOrder.length; 31804function animateList(visualElement) { 31805 return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options))); 31806} 31807function createAnimationState(visualElement) { 31808 let animate = animateList(visualElement); 31809 let state = createState(); 31810 let isInitialRender = true; 31811 /** 31812 * This function will be used to reduce the animation definitions for 31813 * each active animation type into an object of resolved values for it. 31814 */ 31815 const buildResolvedTypeValues = (type) => (acc, definition) => { 31816 const resolved = resolveVariant(visualElement, definition, type === "exit" 31817 ? visualElement.presenceContext?.custom 31818 : undefined); 31819 if (resolved) { 31820 const { transition, transitionEnd, ...target } = resolved; 31821 acc = { ...acc, ...target, ...transitionEnd }; 31822 } 31823 return acc; 31824 }; 31825 /** 31826 * This just allows us to inject mocked animation functions 31827 * @internal 31828 */ 31829 function setAnimateFunction(makeAnimator) { 31830 animate = makeAnimator(visualElement); 31831 } 31832 /** 31833 * When we receive new props, we need to: 31834 * 1. Create a list of protected keys for each type. This is a directory of 31835 * value keys that are currently being "handled" by types of a higher priority 31836 * so that whenever an animation is played of a given type, these values are 31837 * protected from being animated. 31838 * 2. Determine if an animation type needs animating. 31839 * 3. Determine if any values have been removed from a type and figure out 31840 * what to animate those to. 31841 */ 31842 function animateChanges(changedActiveType) { 31843 const { props } = visualElement; 31844 const context = getVariantContext(visualElement.parent) || {}; 31845 /** 31846 * A list of animations that we'll build into as we iterate through the animation 31847 * types. This will get executed at the end of the function. 31848 */ 31849 const animations = []; 31850 /** 31851 * Keep track of which values have been removed. Then, as we hit lower priority 31852 * animation types, we can check if they contain removed values and animate to that. 31853 */ 31854 const removedKeys = new Set(); 31855 /** 31856 * A dictionary of all encountered keys. This is an object to let us build into and 31857 * copy it without iteration. Each time we hit an animation type we set its protected 31858 * keys - the keys its not allowed to animate - to the latest version of this object. 31859 */ 31860 let encounteredKeys = {}; 31861 /** 31862 * If a variant has been removed at a given index, and this component is controlling 31863 * variant animations, we want to ensure lower-priority variants are forced to animate. 31864 */ 31865 let removedVariantIndex = Infinity; 31866 /** 31867 * Iterate through all animation types in reverse priority order. For each, we want to 31868 * detect which values it's handling and whether or not they've changed (and therefore 31869 * need to be animated). If any values have been removed, we want to detect those in 31870 * lower priority props and flag for animation. 31871 */ 31872 for (let i = 0; i < numAnimationTypes; i++) { 31873 const type = reversePriorityOrder[i]; 31874 const typeState = state[type]; 31875 const prop = props[type] !== undefined 31876 ? props[type] 31877 : context[type]; 31878 const propIsVariant = isVariantLabel(prop); 31879 /** 31880 * If this type has *just* changed isActive status, set activeDelta 31881 * to that status. Otherwise set to null. 31882 */ 31883 const activeDelta = type === changedActiveType ? typeState.isActive : null; 31884 if (activeDelta === false) 31885 removedVariantIndex = i; 31886 /** 31887 * If this prop is an inherited variant, rather than been set directly on the 31888 * component itself, we want to make sure we allow the parent to trigger animations. 31889 * 31890 * TODO: Can probably change this to a !isControllingVariants check 31891 */ 31892 let isInherited = prop === context[type] && 31893 prop !== props[type] && 31894 propIsVariant; 31895 /** 31896 * 31897 */
vendor: 5,748 bytes, lines 31897-32018
31897 31898 if (isInherited && 31899 isInitialRender && 31900 visualElement.manuallyAnimateOnMount) { 31901 isInherited = false; 31902 } 31903 /** 31904 * Set all encountered keys so far as the protected keys for this type. This will 31905 * be any key that has been animated or otherwise handled by active, higher-priortiy types. 31906 */ 31907 typeState.protectedKeys = { ...encounteredKeys }; 31908 // Check if we can skip analysing this prop early 31909 if ( 31910 // If it isn't active and hasn't *just* been set as inactive 31911 (!typeState.isActive && activeDelta === null) || 31912 // If we didn't and don't have any defined prop for this animation type 31913 (!prop && !typeState.prevProp) || 31914 // Or if the prop doesn't define an animation 31915 isAnimationControls(prop) || 31916 typeof prop === "boolean") { 31917 continue; 31918 } 31919 /** 31920 * As we go look through the values defined on this type, if we detect 31921 * a changed value or a value that was removed in a higher priority, we set 31922 * this to true and add this prop to the animation list. 31923 */ 31924 const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop); 31925 let shouldAnimateType = variantDidChange || 31926 // If we're making this variant active, we want to always make it active 31927 (type === changedActiveType && 31928 typeState.isActive && 31929 !isInherited && 31930 propIsVariant) || 31931 // If we removed a higher-priority variant (i is in reverse order) 31932 (i > removedVariantIndex && propIsVariant); 31933 let handledRemovedValues = false; 31934 /** 31935 * As animations can be set as variant lists, variants or target objects, we 31936 * coerce everything to an array if it isn't one already 31937 */ 31938 const definitionList = Array.isArray(prop) ? prop : [prop]; 31939 /** 31940 * Build an object of all the resolved values. We'll use this in the subsequent 31941 * animateChanges calls to determine whether a value has changed. 31942 */ 31943 let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {}); 31944 if (activeDelta === false) 31945 resolvedValues = {}; 31946 /** 31947 * Now we need to loop through all the keys in the prev prop and this prop, 31948 * and decide: 31949 * 1. If the value has changed, and needs animating 31950 * 2. If it has been removed, and needs adding to the removedKeys set 31951 * 3. If it has been removed in a higher priority type and needs animating 31952 * 4. If it hasn't been removed in a higher priority but hasn't changed, and 31953 * needs adding to the type's protectedKeys list. 31954 */ 31955 const { prevResolvedValues = {} } = typeState; 31956 const allKeys = { 31957 ...prevResolvedValues, 31958 ...resolvedValues, 31959 }; 31960 const markToAnimate = (key) => { 31961 shouldAnimateType = true; 31962 if (removedKeys.has(key)) { 31963 handledRemovedValues = true; 31964 removedKeys.delete(key); 31965 } 31966 typeState.needsAnimating[key] = true; 31967 const motionValue = visualElement.getValue(key); 31968 if (motionValue) 31969 motionValue.liveStyle = false; 31970 }; 31971 for (const key in allKeys) { 31972 const next = resolvedValues[key]; 31973 const prev = prevResolvedValues[key]; 31974 // If we've already handled this we can just skip ahead 31975 if (encounteredKeys.hasOwnProperty(key)) 31976 continue; 31977 /** 31978 * If the value has changed, we probably want to animate it. 31979 */ 31980 let valueHasChanged = false; 31981 if (isKeyframesTarget(next) && isKeyframesTarget(prev)) { 31982 valueHasChanged = !shallowCompare(next, prev); 31983 } 31984 else { 31985 valueHasChanged = next !== prev; 31986 } 31987 if (valueHasChanged) { 31988 if (next !== undefined && next !== null) { 31989 // If next is defined and doesn't equal prev, it needs animating 31990 markToAnimate(key); 31991 } 31992 else { 31993 // If it's undefined, it's been removed. 31994 removedKeys.add(key); 31995 } 31996 } 31997 else if (next !== undefined && removedKeys.has(key)) { 31998 /** 31999 * If next hasn't changed and it isn't undefined, we want to check if it's 32000 * been removed by a higher priority 32001 */ 32002 markToAnimate(key); 32003 } 32004 else { 32005 /** 32006 * If it hasn't changed, we add it to the list of protected values 32007 * to ensure it doesn't get animated. 32008 */ 32009 typeState.protectedKeys[key] = true; 32010 } 32011 } 32012 /** 32013 * Update the typeState so next time animateChanges is called we can compare the 32014 * latest prop and resolvedValues to these. 32015 */ 32016 typeState.prevProp = prop; 32017 typeState.prevResolvedValues = resolvedValues; 32018
32018/** 32019 * 32020 */ 32021 if (typeState.isActive) { 32022 encounteredKeys = { ...encounteredKeys, ...resolvedValues }; 32023 } 32024 if (isInitialRender && visualElement.blockInitialAnimation) { 32025 shouldAnimateType = false;
vendor: 2,340 bytes, lines 32026-32075
32026 } 32027 /** 32028 * If this is an inherited prop we want to skip this animation 32029 * unless the inherited variants haven't changed on this render. 32030 */ 32031 const willAnimateViaParent = isInherited && variantDidChange; 32032 const needsAnimating = !willAnimateViaParent || handledRemovedValues; 32033 if (shouldAnimateType && needsAnimating) { 32034 animations.push(...definitionList.map((animation) => ({ 32035 animation: animation, 32036 options: { type }, 32037 }))); 32038 } 32039 } 32040 /** 32041 * If there are some removed value that haven't been dealt with, 32042 * we need to create a new animation that falls back either to the value 32043 * defined in the style prop, or the last read value. 32044 */ 32045 if (removedKeys.size) { 32046 const fallbackAnimation = {}; 32047 /** 32048 * If the initial prop contains a transition we can use that, otherwise 32049 * allow the animation function to use the visual element's default. 32050 */ 32051 if (typeof props.initial !== "boolean") { 32052 const initialTransition = resolveVariant(visualElement, Array.isArray(props.initial) 32053 ? props.initial[0] 32054 : props.initial); 32055 if (initialTransition && initialTransition.transition) { 32056 fallbackAnimation.transition = initialTransition.transition; 32057 } 32058 } 32059 removedKeys.forEach((key) => { 32060 const fallbackTarget = visualElement.getBaseTarget(key); 32061 const motionValue = visualElement.getValue(key); 32062 if (motionValue) 32063 motionValue.liveStyle = true; 32064 // @ts-expect-error - @mattgperry to figure if we should do something here 32065 fallbackAnimation[key] = fallbackTarget ?? null; 32066 }); 32067 animations.push({ animation: fallbackAnimation }); 32068 } 32069 let shouldAnimate = Boolean(animations.length); 32070 if (isInitialRender && 32071 (props.initial === false || props.initial === props.animate) && 32072 !visualElement.manuallyAnimateOnMount) { 32073 shouldAnimate = false; 32074 } 32075 isInitialRender = false;
vendor: 57,684 bytes, lines 32076-33626
32076 return shouldAnimate ? animate(animations) : Promise.resolve(); 32077 } 32078 /** 32079 * Change whether a certain animation type is active. 32080 */ 32081 function setActive(type, isActive) { 32082 // If the active state hasn't changed, we can safely do nothing here 32083 if (state[type].isActive === isActive) 32084 return Promise.resolve(); 32085 // Propagate active change to children 32086 visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive)); 32087 state[type].isActive = isActive; 32088 const animations = animateChanges(type); 32089 for (const key in state) { 32090 state[key].protectedKeys = {}; 32091 } 32092 return animations; 32093 } 32094 return { 32095 animateChanges, 32096 setActive, 32097 setAnimateFunction, 32098 getState: () => state, 32099 reset: () => { 32100 state = createState(); 32101 isInitialRender = true; 32102 }, 32103 }; 32104} 32105function checkVariantsDidChange(prev, next) { 32106 if (typeof next === "string") { 32107 return next !== prev; 32108 } 32109 else if (Array.isArray(next)) { 32110 return !shallowCompare(next, prev); 32111 } 32112 return false; 32113} 32114function createTypeState(isActive = false) { 32115 return { 32116 isActive, 32117 protectedKeys: {}, 32118 needsAnimating: {}, 32119 prevResolvedValues: {}, 32120 }; 32121} 32122function createState() { 32123 return { 32124 animate: createTypeState(true), 32125 whileInView: createTypeState(), 32126 whileHover: createTypeState(), 32127 whileTap: createTypeState(), 32128 whileDrag: createTypeState(), 32129 whileFocus: createTypeState(), 32130 exit: createTypeState(), 32131 }; 32132} 32133 32134class Feature { 32135 constructor(node) { 32136 this.isMounted = false; 32137 this.node = node; 32138 } 32139 update() { } 32140} 32141 32142class AnimationFeature extends Feature { 32143 /** 32144 * We dynamically generate the AnimationState manager as it contains a reference 32145 * to the underlying animation library. We only want to load that if we load this, 32146 * so people can optionally code split it out using the `m` component. 32147 */ 32148 constructor(node) { 32149 super(node); 32150 node.animationState || (node.animationState = createAnimationState(node)); 32151 } 32152 updateAnimationControlsSubscription() { 32153 const { animate } = this.node.getProps(); 32154 if (isAnimationControls(animate)) { 32155 this.unmountControls = animate.subscribe(this.node); 32156 } 32157 } 32158 /** 32159 * Subscribe any provided AnimationControls to the component's VisualElement 32160 */ 32161 mount() { 32162 this.updateAnimationControlsSubscription(); 32163 } 32164 update() { 32165 const { animate } = this.node.getProps(); 32166 const { animate: prevAnimate } = this.node.prevProps || {}; 32167 if (animate !== prevAnimate) { 32168 this.updateAnimationControlsSubscription(); 32169 } 32170 } 32171 unmount() { 32172 this.node.animationState.reset(); 32173 this.unmountControls?.(); 32174 } 32175} 32176 32177let id$1 = 0; 32178class ExitAnimationFeature extends Feature { 32179 constructor() { 32180 super(...arguments); 32181 this.id = id$1++; 32182 } 32183 update() { 32184 if (!this.node.presenceContext) 32185 return; 32186 const { isPresent, onExitComplete } = this.node.presenceContext; 32187 const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}; 32188 if (!this.node.animationState || isPresent === prevIsPresent) { 32189 return; 32190 } 32191 const exitAnimation = this.node.animationState.setActive("exit", !isPresent); 32192 if (onExitComplete && !isPresent) { 32193 exitAnimation.then(() => { 32194 onExitComplete(this.id); 32195 }); 32196 } 32197 } 32198 mount() { 32199 const { register, onExitComplete } = this.node.presenceContext || {}; 32200 if (onExitComplete) { 32201 onExitComplete(this.id); 32202 } 32203 if (register) { 32204 this.unmount = register(this.id); 32205 } 32206 } 32207 unmount() { } 32208} 32209 32210const animations = { 32211 animation: { 32212 Feature: AnimationFeature, 32213 }, 32214 exit: { 32215 Feature: ExitAnimationFeature, 32216 }, 32217}; 32218 32219function addDomEvent(target, eventName, handler, options = { passive: true }) { 32220 target.addEventListener(eventName, handler, options); 32221 return () => target.removeEventListener(eventName, handler); 32222} 32223 32224function extractEventInfo(event) { 32225 return { 32226 point: { 32227 x: event.pageX, 32228 y: event.pageY, 32229 }, 32230 }; 32231} 32232const addPointerInfo = (handler) => { 32233 return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event)); 32234}; 32235 32236function addPointerEvent(target, eventName, handler, options) { 32237 return addDomEvent(target, eventName, addPointerInfo(handler), options); 32238} 32239 32240/** 32241 * Bounding boxes tend to be defined as top, left, right, bottom. For various operations 32242 * it's easier to consider each axis individually. This function returns a bounding box 32243 * as a map of single-axis min/max values. 32244 */ 32245function convertBoundingBoxToBox({ top, left, right, bottom, }) { 32246 return { 32247 x: { min: left, max: right }, 32248 y: { min: top, max: bottom }, 32249 }; 32250} 32251function convertBoxToBoundingBox({ x, y }) { 32252 return { top: y.min, right: x.max, bottom: y.max, left: x.min }; 32253} 32254/** 32255 * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function 32256 * provided by Framer to allow measured points to be corrected for device scaling. This is used 32257 * when measuring DOM elements and DOM event points. 32258 */ 32259function transformBoxPoints(point, transformPoint) { 32260 if (!transformPoint) 32261 return point; 32262 const topLeft = transformPoint({ x: point.left, y: point.top }); 32263 const bottomRight = transformPoint({ x: point.right, y: point.bottom }); 32264 return { 32265 top: topLeft.y, 32266 left: topLeft.x, 32267 bottom: bottomRight.y, 32268 right: bottomRight.x, 32269 }; 32270} 32271 32272const SCALE_PRECISION = 0.0001; 32273const SCALE_MIN = 1 - SCALE_PRECISION; 32274const SCALE_MAX = 1 + SCALE_PRECISION; 32275const TRANSLATE_PRECISION = 0.01; 32276const TRANSLATE_MIN = 0 - TRANSLATE_PRECISION; 32277const TRANSLATE_MAX = 0 + TRANSLATE_PRECISION; 32278function calcLength(axis) { 32279 return axis.max - axis.min; 32280} 32281function isNear(value, target, maxDistance) { 32282 return Math.abs(value - target) <= maxDistance; 32283} 32284function calcAxisDelta(delta, source, target, origin = 0.5) { 32285 delta.origin = origin; 32286 delta.originPoint = mixNumber$1(source.min, source.max, delta.origin); 32287 delta.scale = calcLength(target) / calcLength(source); 32288 delta.translate = 32289 mixNumber$1(target.min, target.max, delta.origin) - delta.originPoint; 32290 if ((delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX) || 32291 isNaN(delta.scale)) { 32292 delta.scale = 1.0; 32293 } 32294 if ((delta.translate >= TRANSLATE_MIN && 32295 delta.translate <= TRANSLATE_MAX) || 32296 isNaN(delta.translate)) { 32297 delta.translate = 0.0; 32298 } 32299} 32300function calcBoxDelta(delta, source, target, origin) { 32301 calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : undefined); 32302 calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : undefined); 32303} 32304function calcRelativeAxis(target, relative, parent) { 32305 target.min = parent.min + relative.min; 32306 target.max = target.min + calcLength(relative); 32307} 32308function calcRelativeBox(target, relative, parent) { 32309 calcRelativeAxis(target.x, relative.x, parent.x); 32310 calcRelativeAxis(target.y, relative.y, parent.y); 32311} 32312function calcRelativeAxisPosition(target, layout, parent) { 32313 target.min = layout.min - parent.min; 32314 target.max = target.min + calcLength(layout); 32315} 32316function calcRelativePosition(target, layout, parent) { 32317 calcRelativeAxisPosition(target.x, layout.x, parent.x); 32318 calcRelativeAxisPosition(target.y, layout.y, parent.y); 32319} 32320 32321const createAxisDelta = () => ({ 32322 translate: 0, 32323 scale: 1, 32324 origin: 0, 32325 originPoint: 0, 32326}); 32327const createDelta = () => ({ 32328 x: createAxisDelta(), 32329 y: createAxisDelta(), 32330}); 32331const createAxis = () => ({ min: 0, max: 0 }); 32332const createBox = () => ({ 32333 x: createAxis(), 32334 y: createAxis(), 32335}); 32336 32337function eachAxis(callback) { 32338 return [callback("x"), callback("y")]; 32339} 32340 32341function isIdentityScale(scale) { 32342 return scale === undefined || scale === 1; 32343} 32344function hasScale({ scale, scaleX, scaleY }) { 32345 return (!isIdentityScale(scale) || 32346 !isIdentityScale(scaleX) || 32347 !isIdentityScale(scaleY)); 32348} 32349function hasTransform(values) { 32350 return (hasScale(values) || 32351 has2DTranslate(values) || 32352 values.z || 32353 values.rotate || 32354 values.rotateX || 32355 values.rotateY || 32356 values.skewX || 32357 values.skewY); 32358} 32359function has2DTranslate(values) { 32360 return is2DTranslate(values.x) || is2DTranslate(values.y); 32361} 32362function is2DTranslate(value) { 32363 return value && value !== "0%"; 32364} 32365 32366/** 32367 * Scales a point based on a factor and an originPoint 32368 */ 32369function scalePoint(point, scale, originPoint) { 32370 const distanceFromOrigin = point - originPoint; 32371 const scaled = scale * distanceFromOrigin; 32372 return originPoint + scaled; 32373} 32374/** 32375 * Applies a translate/scale delta to a point 32376 */ 32377function applyPointDelta(point, translate, scale, originPoint, boxScale) { 32378 if (boxScale !== undefined) { 32379 point = scalePoint(point, boxScale, originPoint); 32380 } 32381 return scalePoint(point, scale, originPoint) + translate; 32382} 32383/** 32384 * Applies a translate/scale delta to an axis 32385 */ 32386function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) { 32387 axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale); 32388 axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale); 32389} 32390/** 32391 * Applies a translate/scale delta to a box 32392 */ 32393function applyBoxDelta(box, { x, y }) { 32394 applyAxisDelta(box.x, x.translate, x.scale, x.originPoint); 32395 applyAxisDelta(box.y, y.translate, y.scale, y.originPoint); 32396} 32397const TREE_SCALE_SNAP_MIN = 0.999999999999; 32398const TREE_SCALE_SNAP_MAX = 1.0000000000001; 32399/** 32400 * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms 32401 * in a tree upon our box before then calculating how to project it into our desired viewport-relative box 32402 * 32403 * This is the final nested loop within updateLayoutDelta for future refactoring 32404 */ 32405function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) { 32406 const treeLength = treePath.length; 32407 if (!treeLength) 32408 return; 32409 // Reset the treeScale 32410 treeScale.x = treeScale.y = 1; 32411 let node; 32412 let delta; 32413 for (let i = 0; i < treeLength; i++) { 32414 node = treePath[i]; 32415 delta = node.projectionDelta; 32416 /** 32417 * TODO: Prefer to remove this, but currently we have motion components with 32418 * display: contents in Framer. 32419 */ 32420 const { visualElement } = node.options; 32421 if (visualElement && 32422 visualElement.props.style && 32423 visualElement.props.style.display === "contents") { 32424 continue; 32425 } 32426 if (isSharedTransition && 32427 node.options.layoutScroll && 32428 node.scroll && 32429 node !== node.root) { 32430 transformBox(box, { 32431 x: -node.scroll.offset.x, 32432 y: -node.scroll.offset.y, 32433 }); 32434 } 32435 if (delta) { 32436 // Incoporate each ancestor's scale into a culmulative treeScale for this component 32437 treeScale.x *= delta.x.scale; 32438 treeScale.y *= delta.y.scale; 32439 // Apply each ancestor's calculated delta into this component's recorded layout box 32440 applyBoxDelta(box, delta); 32441 } 32442 if (isSharedTransition && hasTransform(node.latestValues)) { 32443 transformBox(box, node.latestValues); 32444 } 32445 } 32446 /** 32447 * Snap tree scale back to 1 if it's within a non-perceivable threshold. 32448 * This will help reduce useless scales getting rendered. 32449 */ 32450 if (treeScale.x < TREE_SCALE_SNAP_MAX && 32451 treeScale.x > TREE_SCALE_SNAP_MIN) { 32452 treeScale.x = 1.0; 32453 } 32454 if (treeScale.y < TREE_SCALE_SNAP_MAX && 32455 treeScale.y > TREE_SCALE_SNAP_MIN) { 32456 treeScale.y = 1.0; 32457 } 32458} 32459function translateAxis(axis, distance) { 32460 axis.min = axis.min + distance; 32461 axis.max = axis.max + distance; 32462} 32463/** 32464 * Apply a transform to an axis from the latest resolved motion values. 32465 * This function basically acts as a bridge between a flat motion value map 32466 * and applyAxisDelta 32467 */ 32468function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) { 32469 const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin); 32470 // Apply the axis delta to the final axis 32471 applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale); 32472} 32473/** 32474 * Apply a transform to a box from the latest resolved motion values. 32475 */ 32476function transformBox(box, transform) { 32477 transformAxis(box.x, transform.x, transform.scaleX, transform.scale, transform.originX); 32478 transformAxis(box.y, transform.y, transform.scaleY, transform.scale, transform.originY); 32479} 32480 32481function measureViewportBox(instance, transformPoint) { 32482 return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint)); 32483} 32484function measurePageBox(element, rootProjectionNode, transformPagePoint) { 32485 const viewportBox = measureViewportBox(element, transformPagePoint); 32486 const { scroll } = rootProjectionNode; 32487 if (scroll) { 32488 translateAxis(viewportBox.x, scroll.offset.x); 32489 translateAxis(viewportBox.y, scroll.offset.y); 32490 } 32491 return viewportBox; 32492} 32493 32494// Fixes https://github.com/motiondivision/motion/issues/2270 32495const getContextWindow = ({ current }) => { 32496 return current ? current.ownerDocument.defaultView : null; 32497}; 32498 32499const distance = (a, b) => Math.abs(a - b); 32500function distance2D(a, b) { 32501 // Multi-dimensional 32502 const xDelta = distance(a.x, b.x); 32503 const yDelta = distance(a.y, b.y); 32504 return Math.sqrt(xDelta ** 2 + yDelta ** 2); 32505} 32506 32507/** 32508 * @internal 32509 */ 32510class PanSession { 32511 constructor(event, handlers, { transformPagePoint, contextWindow, dragSnapToOrigin = false, } = {}) { 32512 /** 32513 * @internal 32514 */ 32515 this.startEvent = null; 32516 /** 32517 * @internal 32518 */ 32519 this.lastMoveEvent = null; 32520 /** 32521 * @internal 32522 */ 32523 this.lastMoveEventInfo = null; 32524 /** 32525 * @internal 32526 */ 32527 this.handlers = {}; 32528 /** 32529 * @internal 32530 */ 32531 this.contextWindow = window; 32532 this.updatePoint = () => { 32533 if (!(this.lastMoveEvent && this.lastMoveEventInfo)) 32534 return; 32535 const info = getPanInfo(this.lastMoveEventInfo, this.history); 32536 const isPanStarted = this.startEvent !== null; 32537 // Only start panning if the offset is larger than 3 pixels. If we make it 32538 // any larger than this we'll want to reset the pointer history 32539 // on the first update to avoid visual snapping to the cursoe. 32540 const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= 3; 32541 if (!isPanStarted && !isDistancePastThreshold) 32542 return; 32543 const { point } = info; 32544 const { timestamp } = frameData; 32545 this.history.push({ ...point, timestamp }); 32546 const { onStart, onMove } = this.handlers; 32547 if (!isPanStarted) { 32548 onStart && onStart(this.lastMoveEvent, info); 32549 this.startEvent = this.lastMoveEvent; 32550 } 32551 onMove && onMove(this.lastMoveEvent, info); 32552 }; 32553 this.handlePointerMove = (event, info) => { 32554 this.lastMoveEvent = event; 32555 this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint); 32556 // Throttle mouse move event to once per frame 32557 frame.update(this.updatePoint, true); 32558 }; 32559 this.handlePointerUp = (event, info) => { 32560 this.end(); 32561 const { onEnd, onSessionEnd, resumeAnimation } = this.handlers; 32562 if (this.dragSnapToOrigin) 32563 resumeAnimation && resumeAnimation(); 32564 if (!(this.lastMoveEvent && this.lastMoveEventInfo)) 32565 return; 32566 const panInfo = getPanInfo(event.type === "pointercancel" 32567 ? this.lastMoveEventInfo 32568 : transformPoint(info, this.transformPagePoint), this.history); 32569 if (this.startEvent && onEnd) { 32570 onEnd(event, panInfo); 32571 } 32572 onSessionEnd && onSessionEnd(event, panInfo); 32573 }; 32574 // If we have more than one touch, don't start detecting this gesture 32575 if (!isPrimaryPointer(event)) 32576 return; 32577 this.dragSnapToOrigin = dragSnapToOrigin; 32578 this.handlers = handlers; 32579 this.transformPagePoint = transformPagePoint; 32580 this.contextWindow = contextWindow || window; 32581 const info = extractEventInfo(event); 32582 const initialInfo = transformPoint(info, this.transformPagePoint); 32583 const { point } = initialInfo; 32584 const { timestamp } = frameData; 32585 this.history = [{ ...point, timestamp }]; 32586 const { onSessionStart } = handlers; 32587 onSessionStart && 32588 onSessionStart(event, getPanInfo(initialInfo, this.history)); 32589 this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp)); 32590 } 32591 updateHandlers(handlers) { 32592 this.handlers = handlers; 32593 } 32594 end() { 32595 this.removeListeners && this.removeListeners(); 32596 cancelFrame(this.updatePoint); 32597 } 32598} 32599function transformPoint(info, transformPagePoint) { 32600 return transformPagePoint ? { point: transformPagePoint(info.point) } : info; 32601} 32602function subtractPoint(a, b) { 32603 return { x: a.x - b.x, y: a.y - b.y }; 32604} 32605function getPanInfo({ point }, history) { 32606 return { 32607 point, 32608 delta: subtractPoint(point, lastDevicePoint(history)), 32609 offset: subtractPoint(point, startDevicePoint(history)), 32610 velocity: getVelocity(history, 0.1), 32611 }; 32612} 32613function startDevicePoint(history) { 32614 return history[0]; 32615} 32616function lastDevicePoint(history) { 32617 return history[history.length - 1]; 32618} 32619function getVelocity(history, timeDelta) { 32620 if (history.length < 2) { 32621 return { x: 0, y: 0 }; 32622 } 32623 let i = history.length - 1; 32624 let timestampedPoint = null; 32625 const lastPoint = lastDevicePoint(history); 32626 while (i >= 0) { 32627 timestampedPoint = history[i]; 32628 if (lastPoint.timestamp - timestampedPoint.timestamp > 32629 secondsToMilliseconds(timeDelta)) { 32630 break; 32631 } 32632 i--; 32633 } 32634 if (!timestampedPoint) { 32635 return { x: 0, y: 0 }; 32636 } 32637 const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp); 32638 if (time === 0) { 32639 return { x: 0, y: 0 }; 32640 } 32641 const currentVelocity = { 32642 x: (lastPoint.x - timestampedPoint.x) / time, 32643 y: (lastPoint.y - timestampedPoint.y) / time, 32644 }; 32645 if (currentVelocity.x === Infinity) { 32646 currentVelocity.x = 0; 32647 } 32648 if (currentVelocity.y === Infinity) { 32649 currentVelocity.y = 0; 32650 } 32651 return currentVelocity; 32652} 32653 32654/** 32655 * Apply constraints to a point. These constraints are both physical along an 32656 * axis, and an elastic factor that determines how much to constrain the point 32657 * by if it does lie outside the defined parameters. 32658 */ 32659function applyConstraints(point, { min, max }, elastic) { 32660 if (min !== undefined && point < min) { 32661 // If we have a min point defined, and this is outside of that, constrain 32662 point = elastic 32663 ? mixNumber$1(min, point, elastic.min) 32664 : Math.max(point, min); 32665 } 32666 else if (max !== undefined && point > max) { 32667 // If we have a max point defined, and this is outside of that, constrain 32668 point = elastic 32669 ? mixNumber$1(max, point, elastic.max) 32670 : Math.min(point, max); 32671 } 32672 return point; 32673} 32674/** 32675 * Calculate constraints in terms of the viewport when defined relatively to the 32676 * measured axis. This is measured from the nearest edge, so a max constraint of 200 32677 * on an axis with a max value of 300 would return a constraint of 500 - axis length 32678 */ 32679function calcRelativeAxisConstraints(axis, min, max) { 32680 return { 32681 min: min !== undefined ? axis.min + min : undefined, 32682 max: max !== undefined 32683 ? axis.max + max - (axis.max - axis.min) 32684 : undefined, 32685 }; 32686} 32687/** 32688 * Calculate constraints in terms of the viewport when 32689 * defined relatively to the measured bounding box. 32690 */ 32691function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) { 32692 return { 32693 x: calcRelativeAxisConstraints(layoutBox.x, left, right), 32694 y: calcRelativeAxisConstraints(layoutBox.y, top, bottom), 32695 }; 32696} 32697/** 32698 * Calculate viewport constraints when defined as another viewport-relative axis 32699 */ 32700function calcViewportAxisConstraints(layoutAxis, constraintsAxis) { 32701 let min = constraintsAxis.min - layoutAxis.min; 32702 let max = constraintsAxis.max - layoutAxis.max; 32703 // If the constraints axis is actually smaller than the layout axis then we can 32704 // flip the constraints 32705 if (constraintsAxis.max - constraintsAxis.min < 32706 layoutAxis.max - layoutAxis.min) { 32707 [min, max] = [max, min]; 32708 } 32709 return { min, max }; 32710} 32711/** 32712 * Calculate viewport constraints when defined as another viewport-relative box 32713 */ 32714function calcViewportConstraints(layoutBox, constraintsBox) { 32715 return { 32716 x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x), 32717 y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y), 32718 }; 32719} 32720/** 32721 * Calculate a transform origin relative to the source axis, between 0-1, that results 32722 * in an asthetically pleasing scale/transform needed to project from source to target. 32723 */ 32724function calcOrigin(source, target) { 32725 let origin = 0.5; 32726 const sourceLength = calcLength(source); 32727 const targetLength = calcLength(target); 32728 if (targetLength > sourceLength) { 32729 origin = progress(target.min, target.max - sourceLength, source.min); 32730 } 32731 else if (sourceLength > targetLength) { 32732 origin = progress(source.min, source.max - targetLength, target.min); 32733 } 32734 return clamp(0, 1, origin); 32735} 32736/** 32737 * Rebase the calculated viewport constraints relative to the layout.min point. 32738 */ 32739function rebaseAxisConstraints(layout, constraints) { 32740 const relativeConstraints = {}; 32741 if (constraints.min !== undefined) { 32742 relativeConstraints.min = constraints.min - layout.min; 32743 } 32744 if (constraints.max !== undefined) { 32745 relativeConstraints.max = constraints.max - layout.min; 32746 } 32747 return relativeConstraints; 32748} 32749const defaultElastic = 0.35; 32750/** 32751 * Accepts a dragElastic prop and returns resolved elastic values for each axis. 32752 */ 32753function resolveDragElastic(dragElastic = defaultElastic) { 32754 if (dragElastic === false) { 32755 dragElastic = 0; 32756 } 32757 else if (dragElastic === true) { 32758 dragElastic = defaultElastic; 32759 } 32760 return { 32761 x: resolveAxisElastic(dragElastic, "left", "right"), 32762 y: resolveAxisElastic(dragElastic, "top", "bottom"), 32763 }; 32764} 32765function resolveAxisElastic(dragElastic, minLabel, maxLabel) { 32766 return { 32767 min: resolvePointElastic(dragElastic, minLabel), 32768 max: resolvePointElastic(dragElastic, maxLabel), 32769 }; 32770} 32771function resolvePointElastic(dragElastic, label) { 32772 return typeof dragElastic === "number" 32773 ? dragElastic 32774 : dragElastic[label] || 0; 32775} 32776 32777const elementDragControls = new WeakMap(); 32778/** 32779 * 32780 */ 32781// let latestPointerEvent: PointerEvent 32782class VisualElementDragControls { 32783 constructor(visualElement) { 32784 this.openDragLock = null; 32785 this.isDragging = false; 32786 this.currentDirection = null; 32787 this.originPoint = { x: 0, y: 0 }; 32788 /** 32789 * The permitted boundaries of travel, in pixels. 32790 */ 32791 this.constraints = false; 32792 this.hasMutatedConstraints = false; 32793 /** 32794 * The per-axis resolved elastic values. 32795 */ 32796 this.elastic = createBox(); 32797 this.visualElement = visualElement; 32798 } 32799 start(originEvent, { snapToCursor = false } = {}) { 32800 /** 32801 * Don't start dragging if this component is exiting 32802 */ 32803 const { presenceContext } = this.visualElement; 32804 if (presenceContext && presenceContext.isPresent === false) 32805 return; 32806 const onSessionStart = (event) => { 32807 const { dragSnapToOrigin } = this.getProps(); 32808 // Stop or pause any animations on both axis values immediately. This allows the user to throw and catch 32809 // the component. 32810 dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation(); 32811 if (snapToCursor) { 32812 this.snapToCursor(extractEventInfo(event).point); 32813 } 32814 }; 32815 const onStart = (event, info) => { 32816 // Attempt to grab the global drag gesture lock - maybe make this part of PanSession 32817 const { drag, dragPropagation, onDragStart } = this.getProps(); 32818 if (drag && !dragPropagation) { 32819 if (this.openDragLock) 32820 this.openDragLock(); 32821 this.openDragLock = setDragLock(drag); 32822 // If we don 't have the lock, don't start dragging 32823 if (!this.openDragLock) 32824 return; 32825 } 32826 this.isDragging = true; 32827 this.currentDirection = null; 32828 this.resolveConstraints(); 32829 if (this.visualElement.projection) { 32830 this.visualElement.projection.isAnimationBlocked = true; 32831 this.visualElement.projection.target = undefined; 32832 } 32833 /** 32834 * Record gesture origin 32835 */ 32836 eachAxis((axis) => { 32837 let current = this.getAxisMotionValue(axis).get() || 0; 32838 /** 32839 * If the MotionValue is a percentage value convert to px 32840 */ 32841 if (percent.test(current)) { 32842 const { projection } = this.visualElement; 32843 if (projection && projection.layout) { 32844 const measuredAxis = projection.layout.layoutBox[axis]; 32845 if (measuredAxis) { 32846 const length = calcLength(measuredAxis); 32847 current = length * (parseFloat(current) / 100); 32848 } 32849 } 32850 } 32851 this.originPoint[axis] = current; 32852 }); 32853 // Fire onDragStart event 32854 if (onDragStart) { 32855 frame.postRender(() => onDragStart(event, info)); 32856 } 32857 addValueToWillChange(this.visualElement, "transform"); 32858 const { animationState } = this.visualElement; 32859 animationState && animationState.setActive("whileDrag", true); 32860 }; 32861 const onMove = (event, info) => { 32862 // latestPointerEvent = event 32863 const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps(); 32864 // If we didn't successfully receive the gesture lock, early return. 32865 if (!dragPropagation && !this.openDragLock) 32866 return; 32867 const { offset } = info; 32868 // Attempt to detect drag direction if directionLock is true 32869 if (dragDirectionLock && this.currentDirection === null) { 32870 this.currentDirection = getCurrentDirection(offset); 32871 // If we've successfully set a direction, notify listener 32872 if (this.currentDirection !== null) { 32873 onDirectionLock && onDirectionLock(this.currentDirection); 32874 } 32875 return; 32876 } 32877 // Update each point with the latest position 32878 this.updateAxis("x", info.point, offset); 32879 this.updateAxis("y", info.point, offset); 32880 /** 32881 * Ideally we would leave the renderer to fire naturally at the end of 32882 * this frame but if the element is about to change layout as the result 32883 * of a re-render we want to ensure the browser can read the latest 32884 * bounding box to ensure the pointer and element don't fall out of sync. 32885 */ 32886 this.visualElement.render(); 32887 /** 32888 * This must fire after the render call as it might trigger a state 32889 * change which itself might trigger a layout update. 32890 */ 32891 onDrag && onDrag(event, info); 32892 }; 32893 const onSessionEnd = (event, info) => this.stop(event, info); 32894 const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" && 32895 this.getAxisMotionValue(axis).animation?.play()); 32896 const { dragSnapToOrigin } = this.getProps(); 32897 this.panSession = new PanSession(originEvent, { 32898 onSessionStart, 32899 onStart, 32900 onMove, 32901 onSessionEnd, 32902 resumeAnimation, 32903 }, { 32904 transformPagePoint: this.visualElement.getTransformPagePoint(), 32905 dragSnapToOrigin, 32906 contextWindow: getContextWindow(this.visualElement), 32907 }); 32908 } 32909 stop(event, info) { 32910 const isDragging = this.isDragging; 32911 this.cancel(); 32912 if (!isDragging) 32913 return; 32914 const { velocity } = info; 32915 this.startAnimation(velocity); 32916 const { onDragEnd } = this.getProps(); 32917 if (onDragEnd) { 32918 frame.postRender(() => onDragEnd(event, info)); 32919 } 32920 } 32921 cancel() { 32922 this.isDragging = false; 32923 const { projection, animationState } = this.visualElement; 32924 if (projection) { 32925 projection.isAnimationBlocked = false; 32926 } 32927 this.panSession && this.panSession.end(); 32928 this.panSession = undefined; 32929 const { dragPropagation } = this.getProps(); 32930 if (!dragPropagation && this.openDragLock) { 32931 this.openDragLock(); 32932 this.openDragLock = null; 32933 } 32934 animationState && animationState.setActive("whileDrag", false); 32935 } 32936 updateAxis(axis, _point, offset) { 32937 const { drag } = this.getProps(); 32938 // If we're not dragging this axis, do an early return. 32939 if (!offset || !shouldDrag(axis, drag, this.currentDirection)) 32940 return; 32941 const axisValue = this.getAxisMotionValue(axis); 32942 let next = this.originPoint[axis] + offset[axis]; 32943 // Apply constraints 32944 if (this.constraints && this.constraints[axis]) { 32945 next = applyConstraints(next, this.constraints[axis], this.elastic[axis]); 32946 } 32947 axisValue.set(next); 32948 } 32949 resolveConstraints() { 32950 const { dragConstraints, dragElastic } = this.getProps(); 32951 const layout = this.visualElement.projection && 32952 !this.visualElement.projection.layout 32953 ? this.visualElement.projection.measure(false) 32954 : this.visualElement.projection?.layout; 32955 const prevConstraints = this.constraints; 32956 if (dragConstraints && isRefObject(dragConstraints)) { 32957 if (!this.constraints) { 32958 this.constraints = this.resolveRefConstraints(); 32959 } 32960 } 32961 else { 32962 if (dragConstraints && layout) { 32963 this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints); 32964 } 32965 else { 32966 this.constraints = false; 32967 } 32968 } 32969 this.elastic = resolveDragElastic(dragElastic); 32970 /** 32971 * If we're outputting to external MotionValues, we want to rebase the measured constraints 32972 * from viewport-relative to component-relative. 32973 */ 32974 if (prevConstraints !== this.constraints && 32975 layout && 32976 this.constraints && 32977 !this.hasMutatedConstraints) { 32978 eachAxis((axis) => { 32979 if (this.constraints !== false && 32980 this.getAxisMotionValue(axis)) { 32981 this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]); 32982 } 32983 }); 32984 } 32985 } 32986 resolveRefConstraints() { 32987 const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps(); 32988 if (!constraints || !isRefObject(constraints)) 32989 return false; 32990 const constraintsElement = constraints.current; 32991 const { projection } = this.visualElement; 32992 // TODO 32993 if (!projection || !projection.layout) 32994 return false; 32995 const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint()); 32996 let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox); 32997 /** 32998 * If there's an onMeasureDragConstraints listener we call it and 32999 * if different constraints are returned, set constraints to that 33000 */ 33001 if (onMeasureDragConstraints) { 33002 const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints)); 33003 this.hasMutatedConstraints = !!userConstraints; 33004 if (userConstraints) { 33005 measuredConstraints = convertBoundingBoxToBox(userConstraints); 33006 } 33007 } 33008 return measuredConstraints; 33009 } 33010 startAnimation(velocity) { 33011 const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps(); 33012 const constraints = this.constraints || {}; 33013 const momentumAnimations = eachAxis((axis) => { 33014 if (!shouldDrag(axis, drag, this.currentDirection)) { 33015 return; 33016 } 33017 let transition = (constraints && constraints[axis]) || {}; 33018 if (dragSnapToOrigin) 33019 transition = { min: 0, max: 0 }; 33020 /** 33021 * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame 33022 * of spring animations so we should look into adding a disable spring option to `inertia`. 33023 * We could do something here where we affect the `bounceStiffness` and `bounceDamping` 33024 * using the value of `dragElastic`. 33025 */ 33026 const bounceStiffness = dragElastic ? 200 : 1000000; 33027 const bounceDamping = dragElastic ? 40 : 10000000; 33028 const inertia = { 33029 type: "inertia", 33030 velocity: dragMomentum ? velocity[axis] : 0, 33031 bounceStiffness, 33032 bounceDamping, 33033 timeConstant: 750, 33034 restDelta: 1, 33035 restSpeed: 10, 33036 ...dragTransition, 33037 ...transition, 33038 }; 33039 // If we're not animating on an externally-provided `MotionValue` we can use the 33040 // component's animation controls which will handle interactions with whileHover (etc), 33041 // otherwise we just have to animate the `MotionValue` itself. 33042 return this.startAxisValueAnimation(axis, inertia); 33043 }); 33044 // Run all animations and then resolve the new drag constraints. 33045 return Promise.all(momentumAnimations).then(onDragTransitionEnd); 33046 } 33047 startAxisValueAnimation(axis, transition) { 33048 const axisValue = this.getAxisMotionValue(axis); 33049 addValueToWillChange(this.visualElement, axis); 33050 return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false)); 33051 } 33052 stopAnimation() { 33053 eachAxis((axis) => this.getAxisMotionValue(axis).stop()); 33054 } 33055 pauseAnimation() { 33056 eachAxis((axis) => this.getAxisMotionValue(axis).animation?.pause()); 33057 } 33058 getAnimationState(axis) { 33059 return this.getAxisMotionValue(axis).animation?.state; 33060 } 33061 /** 33062 * Drag works differently depending on which props are provided. 33063 * 33064 * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values. 33065 * - Otherwise, we apply the delta to the x/y motion values. 33066 */ 33067 getAxisMotionValue(axis) { 33068 const dragKey = `_drag${axis.toUpperCase()}`; 33069 const props = this.visualElement.getProps(); 33070 const externalMotionValue = props[dragKey]; 33071 return externalMotionValue 33072 ? externalMotionValue 33073 : this.visualElement.getValue(axis, (props.initial 33074 ? props.initial[axis] 33075 : undefined) || 0); 33076 } 33077 snapToCursor(point) { 33078 eachAxis((axis) => { 33079 const { drag } = this.getProps(); 33080 // If we're not dragging this axis, do an early return. 33081 if (!shouldDrag(axis, drag, this.currentDirection)) 33082 return; 33083 const { projection } = this.visualElement; 33084 const axisValue = this.getAxisMotionValue(axis); 33085 if (projection && projection.layout) { 33086 const { min, max } = projection.layout.layoutBox[axis]; 33087 axisValue.set(point[axis] - mixNumber$1(min, max, 0.5)); 33088 } 33089 }); 33090 } 33091 /** 33092 * When the viewport resizes we want to check if the measured constraints 33093 * have changed and, if so, reposition the element within those new constraints 33094 * relative to where it was before the resize. 33095 */ 33096 scalePositionWithinConstraints() { 33097 if (!this.visualElement.current) 33098 return; 33099 const { drag, dragConstraints } = this.getProps(); 33100 const { projection } = this.visualElement; 33101 if (!isRefObject(dragConstraints) || !projection || !this.constraints) 33102 return; 33103 /** 33104 * Stop current animations as there can be visual glitching if we try to do 33105 * this mid-animation 33106 */ 33107 this.stopAnimation(); 33108 /** 33109 * Record the relative position of the dragged element relative to the 33110 * constraints box and save as a progress value. 33111 */ 33112 const boxProgress = { x: 0, y: 0 }; 33113 eachAxis((axis) => { 33114 const axisValue = this.getAxisMotionValue(axis); 33115 if (axisValue && this.constraints !== false) { 33116 const latest = axisValue.get(); 33117 boxProgress[axis] = calcOrigin({ min: latest, max: latest }, this.constraints[axis]); 33118 } 33119 }); 33120 /** 33121 * Update the layout of this element and resolve the latest drag constraints 33122 */ 33123 const { transformTemplate } = this.visualElement.getProps(); 33124 this.visualElement.current.style.transform = transformTemplate 33125 ? transformTemplate({}, "") 33126 : "none"; 33127 projection.root && projection.root.updateScroll(); 33128 projection.updateLayout(); 33129 this.resolveConstraints(); 33130 /** 33131 * For each axis, calculate the current progress of the layout axis 33132 * within the new constraints. 33133 */ 33134 eachAxis((axis) => { 33135 if (!shouldDrag(axis, drag, null)) 33136 return; 33137 /** 33138 * Calculate a new transform based on the previous box progress 33139 */ 33140 const axisValue = this.getAxisMotionValue(axis); 33141 const { min, max } = this.constraints[axis]; 33142 axisValue.set(mixNumber$1(min, max, boxProgress[axis])); 33143 }); 33144 } 33145 addListeners() { 33146 if (!this.visualElement.current) 33147 return; 33148 elementDragControls.set(this.visualElement, this); 33149 const element = this.visualElement.current; 33150 /** 33151 * Attach a pointerdown event listener on this DOM element to initiate drag tracking. 33152 */ 33153 const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => { 33154 const { drag, dragListener = true } = this.getProps(); 33155 drag && dragListener && this.start(event); 33156 }); 33157 const measureDragConstraints = () => { 33158 const { dragConstraints } = this.getProps(); 33159 if (isRefObject(dragConstraints) && dragConstraints.current) { 33160 this.constraints = this.resolveRefConstraints(); 33161 } 33162 }; 33163 const { projection } = this.visualElement; 33164 const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints); 33165 if (projection && !projection.layout) { 33166 projection.root && projection.root.updateScroll(); 33167 projection.updateLayout(); 33168 } 33169 frame.read(measureDragConstraints); 33170 /** 33171 * Attach a window resize listener to scale the draggable target within its defined 33172 * constraints as the window resizes. 33173 */ 33174 const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()); 33175 /** 33176 * If the element's layout changes, calculate the delta and apply that to 33177 * the drag gesture's origin point. 33178 */ 33179 const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => { 33180 if (this.isDragging && hasLayoutChanged) { 33181 eachAxis((axis) => { 33182 const motionValue = this.getAxisMotionValue(axis); 33183 if (!motionValue) 33184 return; 33185 this.originPoint[axis] += delta[axis].translate; 33186 motionValue.set(motionValue.get() + delta[axis].translate); 33187 }); 33188 this.visualElement.render(); 33189 } 33190 })); 33191 return () => { 33192 stopResizeListener(); 33193 stopPointerListener(); 33194 stopMeasureLayoutListener(); 33195 stopLayoutUpdateListener && stopLayoutUpdateListener(); 33196 }; 33197 } 33198 getProps() { 33199 const props = this.visualElement.getProps(); 33200 const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props; 33201 return { 33202 ...props, 33203 drag, 33204 dragDirectionLock, 33205 dragPropagation, 33206 dragConstraints, 33207 dragElastic, 33208 dragMomentum, 33209 }; 33210 } 33211} 33212function shouldDrag(direction, drag, currentDirection) { 33213 return ((drag === true || drag === direction) && 33214 (currentDirection === null || currentDirection === direction)); 33215} 33216/** 33217 * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower 33218 * than the provided threshold, return `null`. 33219 * 33220 * @param offset - The x/y offset from origin. 33221 * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction. 33222 */ 33223function getCurrentDirection(offset, lockThreshold = 10) { 33224 let direction = null; 33225 if (Math.abs(offset.y) > lockThreshold) { 33226 direction = "y"; 33227 } 33228 else if (Math.abs(offset.x) > lockThreshold) { 33229 direction = "x"; 33230 } 33231 return direction; 33232} 33233 33234class DragGesture extends Feature { 33235 constructor(node) { 33236 super(node); 33237 this.removeGroupControls = noop; 33238 this.removeListeners = noop; 33239 this.controls = new VisualElementDragControls(node); 33240 } 33241 mount() { 33242 // If we've been provided a DragControls for manual control over the drag gesture, 33243 // subscribe this component to it on mount. 33244 const { dragControls } = this.node.getProps(); 33245 if (dragControls) { 33246 this.removeGroupControls = dragControls.subscribe(this.controls); 33247 } 33248 this.removeListeners = this.controls.addListeners() || noop; 33249 } 33250 unmount() { 33251 this.removeGroupControls(); 33252 this.removeListeners(); 33253 } 33254} 33255 33256const asyncHandler = (handler) => (event, info) => { 33257 if (handler) { 33258 frame.postRender(() => handler(event, info)); 33259 } 33260}; 33261class PanGesture extends Feature { 33262 constructor() { 33263 super(...arguments); 33264 this.removePointerDownListener = noop; 33265 } 33266 onPointerDown(pointerDownEvent) { 33267 this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), { 33268 transformPagePoint: this.node.getTransformPagePoint(), 33269 contextWindow: getContextWindow(this.node), 33270 }); 33271 } 33272 createPanHandlers() { 33273 const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps(); 33274 return { 33275 onSessionStart: asyncHandler(onPanSessionStart), 33276 onStart: asyncHandler(onPanStart), 33277 onMove: onPan, 33278 onEnd: (event, info) => { 33279 delete this.session; 33280 if (onPanEnd) { 33281 frame.postRender(() => onPanEnd(event, info)); 33282 } 33283 }, 33284 }; 33285 } 33286 mount() { 33287 this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event)); 33288 } 33289 update() { 33290 this.session && this.session.updateHandlers(this.createPanHandlers()); 33291 } 33292 unmount() { 33293 this.removePointerDownListener(); 33294 this.session && this.session.end(); 33295 } 33296} 33297 33298/** 33299 * This should only ever be modified on the client otherwise it'll 33300 * persist through server requests. If we need instanced states we 33301 * could lazy-init via root. 33302 */ 33303const globalProjectionState = { 33304 /** 33305 * Global flag as to whether the tree has animated since the last time 33306 * we resized the window 33307 */ 33308 hasAnimatedSinceResize: true, 33309 /** 33310 * We set this to true once, on the first update. Any nodes added to the tree beyond that 33311 * update will be given a `data-projection-id` attribute. 33312 */ 33313 hasEverUpdated: false, 33314}; 33315 33316function pixelsToPercent(pixels, axis) { 33317 if (axis.max === axis.min) 33318 return 0; 33319 return (pixels / (axis.max - axis.min)) * 100; 33320} 33321/** 33322 * We always correct borderRadius as a percentage rather than pixels to reduce paints. 33323 * For example, if you are projecting a box that is 100px wide with a 10px borderRadius 33324 * into a box that is 200px wide with a 20px borderRadius, that is actually a 10% 33325 * borderRadius in both states. If we animate between the two in pixels that will trigger 33326 * a paint each time. If we animate between the two in percentage we'll avoid a paint. 33327 */ 33328const correctBorderRadius = { 33329 correct: (latest, node) => { 33330 if (!node.target) 33331 return latest; 33332 /** 33333 * If latest is a string, if it's a percentage we can return immediately as it's 33334 * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number. 33335 */ 33336 if (typeof latest === "string") { 33337 if (px.test(latest)) { 33338 latest = parseFloat(latest); 33339 } 33340 else { 33341 return latest; 33342 } 33343 } 33344 /** 33345 * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that 33346 * pixel value as a percentage of each axis 33347 */ 33348 const x = pixelsToPercent(latest, node.target.x); 33349 const y = pixelsToPercent(latest, node.target.y); 33350 return `${x}% ${y}%`; 33351 }, 33352}; 33353 33354const correctBoxShadow = { 33355 correct: (latest, { treeScale, projectionDelta }) => { 33356 const original = latest; 33357 const shadow = complex.parse(latest); 33358 // TODO: Doesn't support multiple shadows 33359 if (shadow.length > 5) 33360 return original; 33361 const template = complex.createTransformer(latest); 33362 const offset = typeof shadow[0] !== "number" ? 1 : 0; 33363 // Calculate the overall context scale 33364 const xScale = projectionDelta.x.scale * treeScale.x; 33365 const yScale = projectionDelta.y.scale * treeScale.y; 33366 shadow[0 + offset] /= xScale; 33367 shadow[1 + offset] /= yScale; 33368 /** 33369 * Ideally we'd correct x and y scales individually, but because blur and 33370 * spread apply to both we have to take a scale average and apply that instead. 33371 * We could potentially improve the outcome of this by incorporating the ratio between 33372 * the two scales. 33373 */ 33374 const averageScale = mixNumber$1(xScale, yScale, 0.5); 33375 // Blur 33376 if (typeof shadow[2 + offset] === "number") 33377 shadow[2 + offset] /= averageScale; 33378 // Spread 33379 if (typeof shadow[3 + offset] === "number") 33380 shadow[3 + offset] /= averageScale; 33381 return template(shadow); 33382 }, 33383}; 33384 33385class MeasureLayoutWithContext extends reactExports.Component { 33386 /** 33387 * This only mounts projection nodes for components that 33388 * need measuring, we might want to do it for all components 33389 * in order to incorporate transforms 33390 */ 33391 componentDidMount() { 33392 const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props; 33393 const { projection } = visualElement; 33394 addScaleCorrector(defaultScaleCorrectors); 33395 if (projection) { 33396 if (layoutGroup.group) 33397 layoutGroup.group.add(projection); 33398 if (switchLayoutGroup && switchLayoutGroup.register && layoutId) { 33399 switchLayoutGroup.register(projection); 33400 } 33401 projection.root.didUpdate(); 33402 projection.addEventListener("animationComplete", () => { 33403 this.safeToRemove(); 33404 }); 33405 projection.setOptions({ 33406 ...projection.options, 33407 onExitComplete: () => this.safeToRemove(), 33408 }); 33409 } 33410 globalProjectionState.hasEverUpdated = true; 33411 } 33412 getSnapshotBeforeUpdate(prevProps) { 33413 const { layoutDependency, visualElement, drag, isPresent } = this.props; 33414 const { projection } = visualElement; 33415 if (!projection) 33416 return null; 33417 /** 33418 * TODO: We use this data in relegate to determine whether to 33419 * promote a previous element. There's no guarantee its presence data 33420 * will have updated by this point - if a bug like this arises it will 33421 * have to be that we markForRelegation and then find a new lead some other way, 33422 * perhaps in didUpdate 33423 */ 33424 projection.isPresent = isPresent; 33425 if (drag || 33426 prevProps.layoutDependency !== layoutDependency || 33427 layoutDependency === undefined || 33428 prevProps.isPresent !== isPresent) { 33429 projection.willUpdate(); 33430 } 33431 else { 33432 this.safeToRemove(); 33433 } 33434 if (prevProps.isPresent !== isPresent) { 33435 if (isPresent) { 33436 projection.promote(); 33437 } 33438 else if (!projection.relegate()) { 33439 /** 33440 * If there's another stack member taking over from this one, 33441 * it's in charge of the exit animation and therefore should 33442 * be in charge of the safe to remove. Otherwise we call it here. 33443 */ 33444 frame.postRender(() => { 33445 const stack = projection.getStack(); 33446 if (!stack || !stack.members.length) { 33447 this.safeToRemove(); 33448 } 33449 }); 33450 } 33451 } 33452 return null; 33453 } 33454 componentDidUpdate() { 33455 const { projection } = this.props.visualElement; 33456 if (projection) { 33457 projection.root.didUpdate(); 33458 microtask.postRender(() => { 33459 if (!projection.currentAnimation && projection.isLead()) { 33460 this.safeToRemove(); 33461 } 33462 }); 33463 } 33464 } 33465 componentWillUnmount() { 33466 const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props; 33467 const { projection } = visualElement; 33468 if (projection) { 33469 projection.scheduleCheckAfterUnmount(); 33470 if (layoutGroup && layoutGroup.group) 33471 layoutGroup.group.remove(projection); 33472 if (promoteContext && promoteContext.deregister) 33473 promoteContext.deregister(projection); 33474 } 33475 } 33476 safeToRemove() { 33477 const { safeToRemove } = this.props; 33478 safeToRemove && safeToRemove(); 33479 } 33480 render() { 33481 return null; 33482 } 33483} 33484function MeasureLayout(props) { 33485 const [isPresent, safeToRemove] = usePresence(); 33486 const layoutGroup = reactExports.useContext(LayoutGroupContext); 33487 return (jsxRuntimeExports.jsx(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: reactExports.useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })); 33488} 33489const defaultScaleCorrectors = { 33490 borderRadius: { 33491 ...correctBorderRadius, 33492 applyTo: [ 33493 "borderTopLeftRadius", 33494 "borderTopRightRadius", 33495 "borderBottomLeftRadius", 33496 "borderBottomRightRadius", 33497 ], 33498 }, 33499 borderTopLeftRadius: correctBorderRadius, 33500 borderTopRightRadius: correctBorderRadius, 33501 borderBottomLeftRadius: correctBorderRadius, 33502 borderBottomRightRadius: correctBorderRadius, 33503 boxShadow: correctBoxShadow, 33504}; 33505 33506function animateSingleValue(value, keyframes, options) { 33507 const motionValue$1 = isMotionValue(value) ? value : motionValue(value); 33508 motionValue$1.start(animateMotionValue("", motionValue$1, keyframes, options)); 33509 return motionValue$1.animation; 33510} 33511 33512function isSVGElement(element) { 33513 return element instanceof SVGElement && element.tagName !== "svg"; 33514} 33515 33516const compareByDepth = (a, b) => a.depth - b.depth; 33517 33518class FlatTree { 33519 constructor() { 33520 this.children = []; 33521 this.isDirty = false; 33522 } 33523 add(child) { 33524 addUniqueItem(this.children, child); 33525 this.isDirty = true; 33526 } 33527 remove(child) { 33528 removeItem(this.children, child); 33529 this.isDirty = true; 33530 } 33531 forEach(callback) { 33532 this.isDirty && this.children.sort(compareByDepth); 33533 this.isDirty = false; 33534 this.children.forEach(callback); 33535 } 33536} 33537 33538/** 33539 * Timeout defined in ms 33540 */ 33541function delay(callback, timeout) { 33542 const start = time.now(); 33543 const checkElapsed = ({ timestamp }) => { 33544 const elapsed = timestamp - start; 33545 if (elapsed >= timeout) { 33546 cancelFrame(checkElapsed); 33547 callback(elapsed - timeout); 33548 } 33549 }; 33550 frame.setup(checkElapsed, true); 33551 return () => cancelFrame(checkElapsed); 33552} 33553 33554const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"]; 33555const numBorders = borders.length; 33556const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value; 33557const isPx = (value) => typeof value === "number" || px.test(value); 33558function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) { 33559 if (shouldCrossfadeOpacity) { 33560 target.opacity = mixNumber$1(0, lead.opacity ?? 1, easeCrossfadeIn(progress)); 33561 target.opacityExit = mixNumber$1(follow.opacity ?? 1, 0, easeCrossfadeOut(progress)); 33562 } 33563 else if (isOnlyMember) { 33564 target.opacity = mixNumber$1(follow.opacity ?? 1, lead.opacity ?? 1, progress); 33565 } 33566 /** 33567 * Mix border radius 33568 */ 33569 for (let i = 0; i < numBorders; i++) { 33570 const borderLabel = `border${borders[i]}Radius`; 33571 let followRadius = getRadius(follow, borderLabel); 33572 let leadRadius = getRadius(lead, borderLabel); 33573 if (followRadius === undefined && leadRadius === undefined) 33574 continue; 33575 followRadius || (followRadius = 0); 33576 leadRadius || (leadRadius = 0); 33577 const canMix = followRadius === 0 || 33578 leadRadius === 0 || 33579 isPx(followRadius) === isPx(leadRadius); 33580 if (canMix) { 33581 target[borderLabel] = Math.max(mixNumber$1(asNumber(followRadius), asNumber(leadRadius), progress), 0); 33582 if (percent.test(leadRadius) || percent.test(followRadius)) { 33583 target[borderLabel] += "%"; 33584 } 33585 } 33586 else { 33587 target[borderLabel] = leadRadius; 33588 } 33589 } 33590 /** 33591 * Mix rotation 33592 */ 33593 if (follow.rotate || lead.rotate) { 33594 target.rotate = mixNumber$1(follow.rotate || 0, lead.rotate || 0, progress); 33595 } 33596} 33597function getRadius(values, radiusName) { 33598 return values[radiusName] !== undefined 33599 ? values[radiusName] 33600 : values.borderRadius; 33601} 33602// /** 33603// * We only want to mix the background color if there's a follow element 33604// * that we're not crossfading opacity between. For instance with switch 33605// * AnimateSharedLayout animations, this helps the illusion of a continuous 33606// * element being animated but also cuts down on the number of paints triggered 33607// * for elements where opacity is doing that work for us. 33608// */ 33609// if ( 33610// !hasFollowElement && 33611// latestLeadValues.backgroundColor && 33612// latestFollowValues.backgroundColor 33613// ) { 33614// /** 33615// * This isn't ideal performance-wise as mixColor is creating a new function every frame. 33616// * We could probably create a mixer that runs at the start of the animation but 33617// * the idea behind the crossfader is that it runs dynamically between two potentially 33618// * changing targets (ie opacity or borderRadius may be animating independently via variants) 33619// */ 33620// leadState.backgroundColor = followState.backgroundColor = mixColor( 33621// latestFollowValues.backgroundColor as string, 33622// latestLeadValues.backgroundColor as string 33623// )(p) 33624// } 33625const easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut); 33626const easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop
vendor: 9,766 bytes, lines 33626-33902
33626); 33627function compress(min, max, easing) { 33628 return (p) => { 33629 // Could replace ifs with clamp 33630 if (p < min) 33631 return 0; 33632 if (p > max) 33633 return 1; 33634 return easing(progress(min, max, p)); 33635 }; 33636} 33637 33638/** 33639 * Reset an axis to the provided origin box. 33640 * 33641 * This is a mutative operation. 33642 */ 33643function copyAxisInto(axis, originAxis) { 33644 axis.min = originAxis.min; 33645 axis.max = originAxis.max; 33646} 33647/** 33648 * Reset a box to the provided origin box. 33649 * 33650 * This is a mutative operation. 33651 */ 33652function copyBoxInto(box, originBox) { 33653 copyAxisInto(box.x, originBox.x); 33654 copyAxisInto(box.y, originBox.y); 33655} 33656/** 33657 * Reset a delta to the provided origin box. 33658 * 33659 * This is a mutative operation. 33660 */ 33661function copyAxisDeltaInto(delta, originDelta) { 33662 delta.translate = originDelta.translate; 33663 delta.scale = originDelta.scale; 33664 delta.originPoint = originDelta.originPoint; 33665 delta.origin = originDelta.origin; 33666} 33667 33668/** 33669 * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse 33670 */ 33671function removePointDelta(point, translate, scale, originPoint, boxScale) { 33672 point -= translate; 33673 point = scalePoint(point, 1 / scale, originPoint); 33674 if (boxScale !== undefined) { 33675 point = scalePoint(point, 1 / boxScale, originPoint); 33676 } 33677 return point; 33678} 33679/** 33680 * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse 33681 */ 33682function removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) { 33683 if (percent.test(translate)) { 33684 translate = parseFloat(translate); 33685 const relativeProgress = mixNumber$1(sourceAxis.min, sourceAxis.max, translate / 100); 33686 translate = relativeProgress - sourceAxis.min; 33687 } 33688 if (typeof translate !== "number") 33689 return; 33690 let originPoint = mixNumber$1(originAxis.min, originAxis.max, origin); 33691 if (axis === originAxis) 33692 originPoint -= translate; 33693 axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale); 33694 axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale); 33695} 33696/** 33697 * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse 33698 * and acts as a bridge between motion values and removeAxisDelta 33699 */ 33700function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) { 33701 removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis); 33702} 33703/** 33704 * The names of the motion values we want to apply as translation, scale and origin. 33705 */ 33706const xKeys = ["x", "scaleX", "originX"]; 33707const yKeys = ["y", "scaleY", "originY"]; 33708/** 33709 * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse 33710 * and acts as a bridge between motion values and removeAxisDelta 33711 */ 33712function removeBoxTransforms(box, transforms, originBox, sourceBox) { 33713 removeAxisTransforms(box.x, transforms, xKeys, originBox ? originBox.x : undefined, sourceBox ? sourceBox.x : undefined); 33714 removeAxisTransforms(box.y, transforms, yKeys, originBox ? originBox.y : undefined, sourceBox ? sourceBox.y : undefined); 33715} 33716 33717function isAxisDeltaZero(delta) { 33718 return delta.translate === 0 && delta.scale === 1; 33719} 33720function isDeltaZero(delta) { 33721 return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y); 33722} 33723function axisEquals(a, b) { 33724 return a.min === b.min && a.max === b.max; 33725} 33726function boxEquals(a, b) { 33727 return axisEquals(a.x, b.x) && axisEquals(a.y, b.y); 33728} 33729function axisEqualsRounded(a, b) { 33730 return (Math.round(a.min) === Math.round(b.min) && 33731 Math.round(a.max) === Math.round(b.max)); 33732} 33733function boxEqualsRounded(a, b) { 33734 return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y); 33735} 33736function aspectRatio(box) { 33737 return calcLength(box.x) / calcLength(box.y); 33738} 33739function axisDeltaEquals(a, b) { 33740 return (a.translate === b.translate && 33741 a.scale === b.scale && 33742 a.originPoint === b.originPoint); 33743} 33744 33745class NodeStack { 33746 constructor() { 33747 this.members = []; 33748 } 33749 add(node) { 33750 addUniqueItem(this.members, node); 33751 node.scheduleRender(); 33752 } 33753 remove(node) { 33754 removeItem(this.members, node); 33755 if (node === this.prevLead) { 33756 this.prevLead = undefined; 33757 } 33758 if (node === this.lead) { 33759 const prevLead = this.members[this.members.length - 1]; 33760 if (prevLead) { 33761 this.promote(prevLead); 33762 } 33763 } 33764 } 33765 relegate(node) { 33766 const indexOfNode = this.members.findIndex((member) => node === member); 33767 if (indexOfNode === 0) 33768 return false; 33769 /** 33770 * Find the next projection node that is present 33771 */ 33772 let prevLead; 33773 for (let i = indexOfNode; i >= 0; i--) { 33774 const member = this.members[i]; 33775 if (member.isPresent !== false) { 33776 prevLead = member; 33777 break; 33778 } 33779 } 33780 if (prevLead) { 33781 this.promote(prevLead); 33782 return true; 33783 } 33784 else { 33785 return false; 33786 } 33787 } 33788 promote(node, preserveFollowOpacity) { 33789 const prevLead = this.lead; 33790 if (node === prevLead) 33791 return; 33792 this.prevLead = prevLead; 33793 this.lead = node; 33794 node.show(); 33795 if (prevLead) { 33796 prevLead.instance && prevLead.scheduleRender(); 33797 node.scheduleRender(); 33798 node.resumeFrom = prevLead; 33799 if (preserveFollowOpacity) { 33800 node.resumeFrom.preserveOpacity = true; 33801 } 33802 if (prevLead.snapshot) { 33803 node.snapshot = prevLead.snapshot; 33804 node.snapshot.latestValues = 33805 prevLead.animationValues || prevLead.latestValues; 33806 } 33807 if (node.root && node.root.isUpdating) { 33808 node.isLayoutDirty = true; 33809 } 33810 const { crossfade } = node.options; 33811 if (crossfade === false) { 33812 prevLead.hide(); 33813 } 33814 /** 33815 * TODO: 33816 * - Test border radius when previous node was deleted 33817 * - boxShadow mixing 33818 * - Shared between element A in scrolled container and element B (scroll stays the same or changes) 33819 * - Shared between element A in transformed container and element B (transform stays the same or changes) 33820 * - Shared between element A in scrolled page and element B (scroll stays the same or changes) 33821 * --- 33822 * - Crossfade opacity of root nodes 33823 * - layoutId changes after animation 33824 * - layoutId changes mid animation 33825 */ 33826 } 33827 } 33828 exitAnimationComplete() { 33829 this.members.forEach((node) => { 33830 const { options, resumingFrom } = node; 33831 options.onExitComplete && options.onExitComplete(); 33832 if (resumingFrom) { 33833 resumingFrom.options.onExitComplete && 33834 resumingFrom.options.onExitComplete(); 33835 } 33836 }); 33837 } 33838 scheduleRender() { 33839 this.members.forEach((node) => { 33840 node.instance && node.scheduleRender(false); 33841 }); 33842 } 33843 /** 33844 * Clear any leads that have been removed this render to prevent them from being 33845 * used in future animations and to prevent memory leaks 33846 */ 33847 removeLeadSnapshot() { 33848 if (this.lead && this.lead.snapshot) { 33849 this.lead.snapshot = undefined; 33850 } 33851 } 33852} 33853 33854function buildProjectionTransform(delta, treeScale, latestTransform) { 33855 let transform = ""; 33856 /** 33857 * The translations we use to calculate are always relative to the viewport coordinate space. 33858 * But when we apply scales, we also scale the coordinate space of an element and its children. 33859 * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need 33860 * to move an element 100 pixels, we actually need to move it 200 in within that scaled space. 33861 */ 33862 const xTranslate = delta.x.translate / treeScale.x; 33863 const yTranslate = delta.y.translate / treeScale.y; 33864 const zTranslate = latestTransform?.z || 0; 33865 if (xTranslate || yTranslate || zTranslate) { 33866 transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `; 33867 } 33868 /** 33869 * Apply scale correction for the tree transform. 33870 * This will apply scale to the screen-orientated axes. 33871 */ 33872 if (treeScale.x !== 1 || treeScale.y !== 1) { 33873 transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `; 33874 } 33875 if (latestTransform) { 33876 const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY } = latestTransform; 33877 if (transformPerspective) 33878 transform = `perspective(${transformPerspective}px) ${transform}`; 33879 if (rotate) 33880 transform += `rotate(${rotate}deg) `; 33881 if (rotateX) 33882 transform += `rotateX(${rotateX}deg) `; 33883 if (rotateY) 33884 transform += `rotateY(${rotateY}deg) `; 33885 if (skewX) 33886 transform += `skewX(${skewX}deg) `; 33887 if (skewY) 33888 transform += `skewY(${skewY}deg) `; 33889 } 33890 /** 33891 * Apply scale to match the size of the element to the size we want it. 33892 * This will apply scale to the element-orientated axes. 33893 */ 33894 const elementScaleX = delta.x.scale * treeScale.x; 33895 const elementScaleY = delta.y.scale * treeScale.y; 33896 if (elementScaleX !== 1 || elementScaleY !== 1) { 33897 transform += `scale(${elementScaleX}, ${elementScaleY})`; 33898 } 33899 return transform || "none"; 33900} 33901 33902const transformAxes = ["", "X", "Y", "Z"];
vendor: 3,742 bytes, lines 33903-33984
33903const hiddenVisibility = { visibility: "hidden" }; 33904/** 33905 * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1 33906 * which has a noticeable difference in spring animations 33907 */ 33908const animationTarget = 1000; 33909let id = 0; 33910function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) { 33911 const { latestValues } = visualElement; 33912 // Record the distorting transform and then temporarily set it to 0 33913 if (latestValues[key]) { 33914 values[key] = latestValues[key]; 33915 visualElement.setStaticValue(key, 0); 33916 if (sharedAnimationValues) { 33917 sharedAnimationValues[key] = 0; 33918 } 33919 } 33920} 33921function cancelTreeOptimisedTransformAnimations(projectionNode) { 33922 projectionNode.hasCheckedOptimisedAppear = true; 33923 if (projectionNode.root === projectionNode) 33924 return; 33925 const { visualElement } = projectionNode.options; 33926 if (!visualElement) 33927 return; 33928 const appearId = getOptimisedAppearId(visualElement); 33929 if (window.MotionHasOptimisedAnimation(appearId, "transform")) { 33930 const { layout, layoutId } = projectionNode.options; 33931 window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId)); 33932 } 33933 const { parent } = projectionNode; 33934 if (parent && !parent.hasCheckedOptimisedAppear) { 33935 cancelTreeOptimisedTransformAnimations(parent); 33936 } 33937} 33938function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) { 33939 return class ProjectionNode { 33940 constructor(latestValues = {}, parent = defaultParent?.()) { 33941 /** 33942 * A unique ID generated for every projection node. 33943 */ 33944 this.id = id++; 33945 /** 33946 * An id that represents a unique session instigated by startUpdate. 33947 */ 33948 this.animationId = 0; 33949 /** 33950 * A Set containing all this component's children. This is used to iterate 33951 * through the children. 33952 * 33953 * TODO: This could be faster to iterate as a flat array stored on the root node. 33954 */ 33955 this.children = new Set(); 33956 /** 33957 * Options for the node. We use this to configure what kind of layout animations 33958 * we should perform (if any). 33959 */ 33960 this.options = {}; 33961 /** 33962 * We use this to detect when its safe to shut down part of a projection tree. 33963 * We have to keep projecting children for scale correction and relative projection 33964 * until all their parents stop performing layout animations. 33965 */ 33966 this.isTreeAnimating = false; 33967 this.isAnimationBlocked = false; 33968 /** 33969 * Flag to true if we think this layout has been changed. We can't always know this, 33970 * currently we set it to true every time a component renders, or if it has a layoutDependency 33971 * if that has changed between renders. Additionally, components can be grouped by LayoutGroup 33972 * and if one node is dirtied, they all are. 33973 */ 33974 this.isLayoutDirty = false; 33975 /** 33976 * Flag to true if we think the projection calculations for this node needs 33977 * recalculating as a result of an updated transform or layout animation. 33978 */ 33979 this.isProjectionDirty = false; 33980 /** 33981 * Flag to true if the layout *or* transform has changed. This then gets propagated 33982 * throughout the projection tree, forcing any element below to recalculate on the next frame. 33983 */ 33984 this.isSharedProjectionDirty = false;
vendor: 5,487 bytes, lines 33985-34114
33985 /** 33986 * Flag transform dirty. This gets propagated throughout the whole tree but is only 33987 * respected by shared nodes. 33988 */ 33989 this.isTransformDirty = false; 33990 /** 33991 * Block layout updates for instant layout transitions throughout the tree. 33992 */ 33993 this.updateManuallyBlocked = false; 33994 this.updateBlockedByResize = false; 33995 /** 33996 * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate` 33997 * call. 33998 */ 33999 this.isUpdating = false; 34000 /** 34001 * If this is an SVG element we currently disable projection transforms 34002 */ 34003 this.isSVG = false; 34004 /** 34005 * Flag to true (during promotion) if a node doing an instant layout transition needs to reset 34006 * its projection styles. 34007 */ 34008 this.needsReset = false; 34009 /** 34010 * Flags whether this node should have its transform reset prior to measuring. 34011 */ 34012 this.shouldResetTransform = false; 34013 /** 34014 * Store whether this node has been checked for optimised appear animations. As 34015 * effects fire bottom-up, and we want to look up the tree for appear animations, 34016 * this makes sure we only check each path once, stopping at nodes that 34017 * have already been checked. 34018 */ 34019 this.hasCheckedOptimisedAppear = false; 34020 /** 34021 * An object representing the calculated contextual/accumulated/tree scale. 34022 * This will be used to scale calculcated projection transforms, as these are 34023 * calculated in screen-space but need to be scaled for elements to layoutly 34024 * make it to their calculated destinations. 34025 * 34026 * TODO: Lazy-init 34027 */ 34028 this.treeScale = { x: 1, y: 1 }; 34029 /** 34030 * 34031 */ 34032 this.eventHandlers = new Map(); 34033 this.hasTreeAnimated = false; 34034 // Note: Currently only running on root node 34035 this.updateScheduled = false; 34036 this.scheduleUpdate = () => this.update(); 34037 this.projectionUpdateScheduled = false; 34038 this.checkUpdateFailed = () => { 34039 if (this.isUpdating) { 34040 this.isUpdating = false; 34041 this.clearAllSnapshots(); 34042 } 34043 }; 34044 /** 34045 * This is a multi-step process as shared nodes might be of different depths. Nodes 34046 * are sorted by depth order, so we need to resolve the entire tree before moving to 34047 * the next step. 34048 */ 34049 this.updateProjection = () => { 34050 this.projectionUpdateScheduled = false; 34051 this.nodes.forEach(propagateDirtyNodes); 34052 this.nodes.forEach(resolveTargetDelta); 34053 this.nodes.forEach(calcProjection); 34054 this.nodes.forEach(cleanDirtyNodes); 34055 }; 34056 /** 34057 * Frame calculations 34058 */ 34059 this.resolvedRelativeTargetAt = 0.0; 34060 this.hasProjected = false; 34061 this.isVisible = true; 34062 this.animationProgress = 0; 34063 /** 34064 * Shared layout 34065 */ 34066 // TODO Only running on root node 34067 this.sharedNodes = new Map(); 34068 this.latestValues = latestValues; 34069 this.root = parent ? parent.root || parent : this; 34070 this.path = parent ? [...parent.path, parent] : []; 34071 this.parent = parent; 34072 this.depth = parent ? parent.depth + 1 : 0; 34073 for (let i = 0; i < this.path.length; i++) { 34074 this.path[i].shouldResetTransform = true; 34075 } 34076 if (this.root === this) 34077 this.nodes = new FlatTree(); 34078 } 34079 addEventListener(name, handler) { 34080 if (!this.eventHandlers.has(name)) { 34081 this.eventHandlers.set(name, new SubscriptionManager()); 34082 } 34083 return this.eventHandlers.get(name).add(handler); 34084 } 34085 notifyListeners(name, ...args) { 34086 const subscriptionManager = this.eventHandlers.get(name); 34087 subscriptionManager && subscriptionManager.notify(...args); 34088 } 34089 hasListeners(name) { 34090 return this.eventHandlers.has(name); 34091 } 34092 /** 34093 * Lifecycles 34094 */ 34095 mount(instance) { 34096 if (this.instance) 34097 return; 34098 this.isSVG = isSVGElement(instance); 34099 this.instance = instance; 34100 const { layoutId, layout, visualElement } = this.options; 34101 if (visualElement && !visualElement.current) { 34102 visualElement.mount(instance); 34103 } 34104 this.root.nodes.add(this); 34105 this.parent && this.parent.children.add(this); 34106 if (this.root.hasTreeAnimated && (layout || layoutId)) { 34107 this.isLayoutDirty = true; 34108 } 34109 if (attachResizeListener) { 34110 let cancelDelay; 34111 const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false); 34112 attachResizeListener(instance, () => { 34113 this.root.updateBlockedByResize = true; 34114 cancelDelay && cancelDelay();
vendor: 3,546 bytes, lines 34115-34176
34115 cancelDelay = delay(resizeUnblockUpdate, 250); 34116 if (globalProjectionState.hasAnimatedSinceResize) { 34117 globalProjectionState.hasAnimatedSinceResize = false; 34118 this.nodes.forEach(finishAnimation); 34119 } 34120 }); 34121 } 34122 if (layoutId) { 34123 this.root.registerSharedNode(layoutId, this); 34124 } 34125 // Only register the handler if it requires layout animation 34126 if (this.options.animate !== false && 34127 visualElement && 34128 (layoutId || layout)) { 34129 this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeLayoutChanged, layout: newLayout, }) => { 34130 if (this.isTreeAnimationBlocked()) { 34131 this.target = undefined; 34132 this.relativeTarget = undefined; 34133 return; 34134 } 34135 // TODO: Check here if an animation exists 34136 const layoutTransition = this.options.transition || 34137 visualElement.getDefaultTransition() || 34138 defaultLayoutTransition; 34139 const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps(); 34140 /** 34141 * The target layout of the element might stay the same, 34142 * but its position relative to its parent has changed. 34143 */ 34144 const hasTargetChanged = !this.targetLayout || 34145 !boxEqualsRounded(this.targetLayout, newLayout); 34146 /* 34147 * Note: Disabled to fix relative animations always triggering new 34148 * layout animations. If this causes further issues, we can try 34149 * a different approach to detecting relative target changes. 34150 */ 34151 // || hasRelativeLayoutChanged 34152 /** 34153 * If the layout hasn't seemed to have changed, it might be that the 34154 * element is visually in the same place in the document but its position 34155 * relative to its parent has indeed changed. So here we check for that. 34156 */ 34157 const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeLayoutChanged; 34158 if (this.options.layoutRoot || 34159 this.resumeFrom || 34160 hasOnlyRelativeTargetChanged || 34161 (hasLayoutChanged && 34162 (hasTargetChanged || !this.currentAnimation))) { 34163 if (this.resumeFrom) { 34164 this.resumingFrom = this.resumeFrom; 34165 this.resumingFrom.resumingFrom = undefined; 34166 } 34167 this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged); 34168 const animationOptions = { 34169 ...getValueTransition(layoutTransition, "layout"), 34170 onPlay: onLayoutAnimationStart, 34171 onComplete: onLayoutAnimationComplete, 34172 }; 34173 if (visualElement.shouldReduceMotion || 34174 this.options.layoutRoot) { 34175 animationOptions.delay = 0; 34176 animationOptions.type = false;
vendor: 7,987 bytes, lines 34177-34370
34177 } 34178 this.startAnimation(animationOptions); 34179 } 34180 else { 34181 /** 34182 * If the layout hasn't changed and we have an animation that hasn't started yet, 34183 * finish it immediately. Otherwise it will be animating from a location 34184 * that was probably never commited to screen and look like a jumpy box. 34185 */ 34186 if (!hasLayoutChanged) { 34187 finishAnimation(this); 34188 } 34189 if (this.isLead() && this.options.onExitComplete) { 34190 this.options.onExitComplete(); 34191 } 34192 } 34193 this.targetLayout = newLayout; 34194 }); 34195 } 34196 } 34197 unmount() { 34198 this.options.layoutId && this.willUpdate(); 34199 this.root.nodes.remove(this); 34200 const stack = this.getStack(); 34201 stack && stack.remove(this); 34202 this.parent && this.parent.children.delete(this); 34203 this.instance = undefined; 34204 this.eventHandlers.clear(); 34205 cancelFrame(this.updateProjection); 34206 } 34207 // only on the root 34208 blockUpdate() { 34209 this.updateManuallyBlocked = true; 34210 } 34211 unblockUpdate() { 34212 this.updateManuallyBlocked = false; 34213 } 34214 isUpdateBlocked() { 34215 return this.updateManuallyBlocked || this.updateBlockedByResize; 34216 } 34217 isTreeAnimationBlocked() { 34218 return (this.isAnimationBlocked || 34219 (this.parent && this.parent.isTreeAnimationBlocked()) || 34220 false); 34221 } 34222 // Note: currently only running on root node 34223 startUpdate() { 34224 if (this.isUpdateBlocked()) 34225 return; 34226 this.isUpdating = true; 34227 this.nodes && this.nodes.forEach(resetSkewAndRotation); 34228 this.animationId++; 34229 } 34230 getTransformTemplate() { 34231 const { visualElement } = this.options; 34232 return visualElement && visualElement.getProps().transformTemplate; 34233 } 34234 willUpdate(shouldNotifyListeners = true) { 34235 this.root.hasTreeAnimated = true; 34236 if (this.root.isUpdateBlocked()) { 34237 this.options.onExitComplete && this.options.onExitComplete(); 34238 return; 34239 } 34240 /** 34241 * If we're running optimised appear animations then these must be 34242 * cancelled before measuring the DOM. This is so we can measure 34243 * the true layout of the element rather than the WAAPI animation 34244 * which will be unaffected by the resetSkewAndRotate step. 34245 * 34246 * Note: This is a DOM write. Worst case scenario is this is sandwiched 34247 * between other snapshot reads which will cause unnecessary style recalculations. 34248 * This has to happen here though, as we don't yet know which nodes will need 34249 * snapshots in startUpdate(), but we only want to cancel optimised animations 34250 * if a layout animation measurement is actually going to be affected by them. 34251 */ 34252 if (window.MotionCancelOptimisedAnimation && 34253 !this.hasCheckedOptimisedAppear) { 34254 cancelTreeOptimisedTransformAnimations(this); 34255 } 34256 !this.root.isUpdating && this.root.startUpdate(); 34257 if (this.isLayoutDirty) 34258 return; 34259 this.isLayoutDirty = true; 34260 for (let i = 0; i < this.path.length; i++) { 34261 const node = this.path[i]; 34262 node.shouldResetTransform = true; 34263 node.updateScroll("snapshot"); 34264 if (node.options.layoutRoot) { 34265 node.willUpdate(false); 34266 } 34267 } 34268 const { layoutId, layout } = this.options; 34269 if (layoutId === undefined && !layout) 34270 return; 34271 const transformTemplate = this.getTransformTemplate(); 34272 this.prevTransformTemplateValue = transformTemplate 34273 ? transformTemplate(this.latestValues, "") 34274 : undefined; 34275 this.updateSnapshot(); 34276 shouldNotifyListeners && this.notifyListeners("willUpdate"); 34277 } 34278 update() { 34279 this.updateScheduled = false; 34280 const updateWasBlocked = this.isUpdateBlocked(); 34281 // When doing an instant transition, we skip the layout update, 34282 // but should still clean up the measurements so that the next 34283 // snapshot could be taken correctly. 34284 if (updateWasBlocked) { 34285 this.unblockUpdate(); 34286 this.clearAllSnapshots(); 34287 this.nodes.forEach(clearMeasurements); 34288 return; 34289 } 34290 if (!this.isUpdating) { 34291 this.nodes.forEach(clearIsLayoutDirty); 34292 } 34293 this.isUpdating = false; 34294 /** 34295 * Write 34296 */ 34297 this.nodes.forEach(resetTransformStyle); 34298 /** 34299 * Read ================== 34300 */ 34301 // Update layout measurements of updated children 34302 this.nodes.forEach(updateLayout); 34303 /** 34304 * Write 34305 */ 34306 // Notify listeners that the layout is updated 34307 this.nodes.forEach(notifyLayoutUpdate); 34308 this.clearAllSnapshots(); 34309 /** 34310 * Manually flush any pending updates. Ideally 34311 * we could leave this to the following requestAnimationFrame but this seems 34312 * to leave a flash of incorrectly styled content. 34313 */ 34314 const now = time.now(); 34315 frameData.delta = clamp(0, 1000 / 60, now - frameData.timestamp); 34316 frameData.timestamp = now; 34317 frameData.isProcessing = true; 34318 frameSteps.update.process(frameData); 34319 frameSteps.preRender.process(frameData); 34320 frameSteps.render.process(frameData); 34321 frameData.isProcessing = false; 34322 } 34323 didUpdate() { 34324 if (!this.updateScheduled) { 34325 this.updateScheduled = true; 34326 microtask.read(this.scheduleUpdate); 34327 } 34328 } 34329 clearAllSnapshots() { 34330 this.nodes.forEach(clearSnapshot); 34331 this.sharedNodes.forEach(removeLeadSnapshots); 34332 } 34333 scheduleUpdateProjection() { 34334 if (!this.projectionUpdateScheduled) { 34335 this.projectionUpdateScheduled = true; 34336 frame.preRender(this.updateProjection, false, true); 34337 } 34338 } 34339 scheduleCheckAfterUnmount() { 34340 /** 34341 * If the unmounting node is in a layoutGroup and did trigger a willUpdate, 34342 * we manually call didUpdate to give a chance to the siblings to animate. 34343 * Otherwise, cleanup all snapshots to prevents future nodes from reusing them. 34344 */ 34345 frame.postRender(() => { 34346 if (this.isLayoutDirty) { 34347 this.root.didUpdate(); 34348 } 34349 else { 34350 this.root.checkUpdateFailed(); 34351 } 34352 }); 34353 } 34354 /** 34355 * Update measurements 34356 */ 34357 updateSnapshot() { 34358 if (this.snapshot || !this.instance) 34359 return; 34360 this.snapshot = this.measure(); 34361 if (this.snapshot && 34362 !calcLength(this.snapshot.measuredBox.x) && 34363 !calcLength(this.snapshot.measuredBox.y)) { 34364 this.snapshot = undefined; 34365 } 34366 } 34367 updateLayout() { 34368 if (!this.instance) 34369 return; 34370 // TODO: Incorporate into a forwarded scroll offset
vendor: 24,150 bytes, lines 34370-34902
34370 34371 this.updateScroll(); 34372 if (!(this.options.alwaysMeasureLayout && this.isLead()) && 34373 !this.isLayoutDirty) { 34374 return; 34375 } 34376 /** 34377 * When a node is mounted, it simply resumes from the prevLead's 34378 * snapshot instead of taking a new one, but the ancestors scroll 34379 * might have updated while the prevLead is unmounted. We need to 34380 * update the scroll again to make sure the layout we measure is 34381 * up to date. 34382 */ 34383 if (this.resumeFrom && !this.resumeFrom.instance) { 34384 for (let i = 0; i < this.path.length; i++) { 34385 const node = this.path[i]; 34386 node.updateScroll(); 34387 } 34388 } 34389 const prevLayout = this.layout; 34390 this.layout = this.measure(false); 34391 this.layoutCorrected = createBox(); 34392 this.isLayoutDirty = false; 34393 this.projectionDelta = undefined; 34394 this.notifyListeners("measure", this.layout.layoutBox); 34395 const { visualElement } = this.options; 34396 visualElement && 34397 visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined); 34398 } 34399 updateScroll(phase = "measure") { 34400 let needsMeasurement = Boolean(this.options.layoutScroll && this.instance); 34401 if (this.scroll && 34402 this.scroll.animationId === this.root.animationId && 34403 this.scroll.phase === phase) { 34404 needsMeasurement = false; 34405 } 34406 if (needsMeasurement && this.instance) { 34407 const isRoot = checkIsScrollRoot(this.instance); 34408 this.scroll = { 34409 animationId: this.root.animationId, 34410 phase, 34411 isRoot, 34412 offset: measureScroll(this.instance), 34413 wasRoot: this.scroll ? this.scroll.isRoot : isRoot, 34414 }; 34415 } 34416 } 34417 resetTransform() { 34418 if (!resetTransform) 34419 return; 34420 const isResetRequested = this.isLayoutDirty || 34421 this.shouldResetTransform || 34422 this.options.alwaysMeasureLayout; 34423 const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta); 34424 const transformTemplate = this.getTransformTemplate(); 34425 const transformTemplateValue = transformTemplate 34426 ? transformTemplate(this.latestValues, "") 34427 : undefined; 34428 const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue; 34429 if (isResetRequested && 34430 this.instance && 34431 (hasProjection || 34432 hasTransform(this.latestValues) || 34433 transformTemplateHasChanged)) { 34434 resetTransform(this.instance, transformTemplateValue); 34435 this.shouldResetTransform = false; 34436 this.scheduleRender(); 34437 } 34438 } 34439 measure(removeTransform = true) { 34440 const pageBox = this.measurePageBox(); 34441 let layoutBox = this.removeElementScroll(pageBox); 34442 /** 34443 * Measurements taken during the pre-render stage 34444 * still have transforms applied so we remove them 34445 * via calculation. 34446 */ 34447 if (removeTransform) { 34448 layoutBox = this.removeTransform(layoutBox); 34449 } 34450 roundBox(layoutBox); 34451 return { 34452 animationId: this.root.animationId, 34453 measuredBox: pageBox, 34454 layoutBox, 34455 latestValues: {}, 34456 source: this.id, 34457 }; 34458 } 34459 measurePageBox() { 34460 const { visualElement } = this.options; 34461 if (!visualElement) 34462 return createBox(); 34463 const box = visualElement.measureViewportBox(); 34464 const wasInScrollRoot = this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot); 34465 if (!wasInScrollRoot) { 34466 // Remove viewport scroll to give page-relative coordinates 34467 const { scroll } = this.root; 34468 if (scroll) { 34469 translateAxis(box.x, scroll.offset.x); 34470 translateAxis(box.y, scroll.offset.y); 34471 } 34472 } 34473 return box; 34474 } 34475 removeElementScroll(box) { 34476 const boxWithoutScroll = createBox(); 34477 copyBoxInto(boxWithoutScroll, box); 34478 if (this.scroll?.wasRoot) { 34479 return boxWithoutScroll; 34480 } 34481 /** 34482 * Performance TODO: Keep a cumulative scroll offset down the tree 34483 * rather than loop back up the path. 34484 */ 34485 for (let i = 0; i < this.path.length; i++) { 34486 const node = this.path[i]; 34487 const { scroll, options } = node; 34488 if (node !== this.root && scroll && options.layoutScroll) { 34489 /** 34490 * If this is a new scroll root, we want to remove all previous scrolls 34491 * from the viewport box. 34492 */ 34493 if (scroll.wasRoot) { 34494 copyBoxInto(boxWithoutScroll, box); 34495 } 34496 translateAxis(boxWithoutScroll.x, scroll.offset.x); 34497 translateAxis(boxWithoutScroll.y, scroll.offset.y); 34498 } 34499 } 34500 return boxWithoutScroll; 34501 } 34502 applyTransform(box, transformOnly = false) { 34503 const withTransforms = createBox(); 34504 copyBoxInto(withTransforms, box); 34505 for (let i = 0; i < this.path.length; i++) { 34506 const node = this.path[i]; 34507 if (!transformOnly && 34508 node.options.layoutScroll && 34509 node.scroll && 34510 node !== node.root) { 34511 transformBox(withTransforms, { 34512 x: -node.scroll.offset.x, 34513 y: -node.scroll.offset.y, 34514 }); 34515 } 34516 if (!hasTransform(node.latestValues)) 34517 continue; 34518 transformBox(withTransforms, node.latestValues); 34519 } 34520 if (hasTransform(this.latestValues)) { 34521 transformBox(withTransforms, this.latestValues); 34522 } 34523 return withTransforms; 34524 } 34525 removeTransform(box) { 34526 const boxWithoutTransform = createBox(); 34527 copyBoxInto(boxWithoutTransform, box); 34528 for (let i = 0; i < this.path.length; i++) { 34529 const node = this.path[i]; 34530 if (!node.instance) 34531 continue; 34532 if (!hasTransform(node.latestValues)) 34533 continue; 34534 hasScale(node.latestValues) && node.updateSnapshot(); 34535 const sourceBox = createBox(); 34536 const nodeBox = node.measurePageBox(); 34537 copyBoxInto(sourceBox, nodeBox); 34538 removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : undefined, sourceBox); 34539 } 34540 if (hasTransform(this.latestValues)) { 34541 removeBoxTransforms(boxWithoutTransform, this.latestValues); 34542 } 34543 return boxWithoutTransform; 34544 } 34545 setTargetDelta(delta) { 34546 this.targetDelta = delta; 34547 this.root.scheduleUpdateProjection(); 34548 this.isProjectionDirty = true; 34549 } 34550 setOptions(options) { 34551 this.options = { 34552 ...this.options, 34553 ...options, 34554 crossfade: options.crossfade !== undefined ? options.crossfade : true, 34555 }; 34556 } 34557 clearMeasurements() { 34558 this.scroll = undefined; 34559 this.layout = undefined; 34560 this.snapshot = undefined; 34561 this.prevTransformTemplateValue = undefined; 34562 this.targetDelta = undefined; 34563 this.target = undefined; 34564 this.isLayoutDirty = false; 34565 } 34566 forceRelativeParentToResolveTarget() { 34567 if (!this.relativeParent) 34568 return; 34569 /** 34570 * If the parent target isn't up-to-date, force it to update. 34571 * This is an unfortunate de-optimisation as it means any updating relative 34572 * projection will cause all the relative parents to recalculate back 34573 * up the tree. 34574 */ 34575 if (this.relativeParent.resolvedRelativeTargetAt !== 34576 frameData.timestamp) { 34577 this.relativeParent.resolveTargetDelta(true); 34578 } 34579 } 34580 resolveTargetDelta(forceRecalculation = false) { 34581 /** 34582 * Once the dirty status of nodes has been spread through the tree, we also 34583 * need to check if we have a shared node of a different depth that has itself 34584 * been dirtied. 34585 */ 34586 const lead = this.getLead(); 34587 this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty); 34588 this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty); 34589 this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty); 34590 const isShared = Boolean(this.resumingFrom) || this !== lead; 34591 /** 34592 * We don't use transform for this step of processing so we don't 34593 * need to check whether any nodes have changed transform. 34594 */ 34595 const canSkip = !(forceRecalculation || 34596 (isShared && this.isSharedProjectionDirty) || 34597 this.isProjectionDirty || 34598 this.parent?.isProjectionDirty || 34599 this.attemptToResolveRelativeTarget || 34600 this.root.updateBlockedByResize); 34601 if (canSkip) 34602 return; 34603 const { layout, layoutId } = this.options; 34604 /** 34605 * If we have no layout, we can't perform projection, so early return 34606 */ 34607 if (!this.layout || !(layout || layoutId)) 34608 return; 34609 this.resolvedRelativeTargetAt = frameData.timestamp; 34610 /** 34611 * If we don't have a targetDelta but do have a layout, we can attempt to resolve 34612 * a relativeParent. This will allow a component to perform scale correction 34613 * even if no animation has started. 34614 */ 34615 if (!this.targetDelta && !this.relativeTarget) { 34616 const relativeParent = this.getClosestProjectingParent(); 34617 if (relativeParent && 34618 relativeParent.layout && 34619 this.animationProgress !== 1) { 34620 this.relativeParent = relativeParent; 34621 this.forceRelativeParentToResolveTarget(); 34622 this.relativeTarget = createBox(); 34623 this.relativeTargetOrigin = createBox(); 34624 calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox); 34625 copyBoxInto(this.relativeTarget, this.relativeTargetOrigin); 34626 } 34627 else { 34628 this.relativeParent = this.relativeTarget = undefined; 34629 } 34630 } 34631 /** 34632 * If we have no relative target or no target delta our target isn't valid 34633 * for this frame. 34634 */ 34635 if (!this.relativeTarget && !this.targetDelta) 34636 return; 34637 /** 34638 * Lazy-init target data structure 34639 */ 34640 if (!this.target) { 34641 this.target = createBox(); 34642 this.targetWithTransforms = createBox(); 34643 } 34644 /** 34645 * If we've got a relative box for this component, resolve it into a target relative to the parent. 34646 */ 34647 if (this.relativeTarget && 34648 this.relativeTargetOrigin && 34649 this.relativeParent && 34650 this.relativeParent.target) { 34651 this.forceRelativeParentToResolveTarget(); 34652 calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target); 34653 /** 34654 * If we've only got a targetDelta, resolve it into a target 34655 */ 34656 } 34657 else if (this.targetDelta) { 34658 if (Boolean(this.resumingFrom)) { 34659 // TODO: This is creating a new object every frame 34660 this.target = this.applyTransform(this.layout.layoutBox); 34661 } 34662 else { 34663 copyBoxInto(this.target, this.layout.layoutBox); 34664 } 34665 applyBoxDelta(this.target, this.targetDelta); 34666 } 34667 else { 34668 /** 34669 * If no target, use own layout as target 34670 */ 34671 copyBoxInto(this.target, this.layout.layoutBox); 34672 } 34673 /** 34674 * If we've been told to attempt to resolve a relative target, do so. 34675 */ 34676 if (this.attemptToResolveRelativeTarget) { 34677 this.attemptToResolveRelativeTarget = false; 34678 const relativeParent = this.getClosestProjectingParent(); 34679 if (relativeParent && 34680 Boolean(relativeParent.resumingFrom) === 34681 Boolean(this.resumingFrom) && 34682 !relativeParent.options.layoutScroll && 34683 relativeParent.target && 34684 this.animationProgress !== 1) { 34685 this.relativeParent = relativeParent; 34686 this.forceRelativeParentToResolveTarget(); 34687 this.relativeTarget = createBox(); 34688 this.relativeTargetOrigin = createBox(); 34689 calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target); 34690 copyBoxInto(this.relativeTarget, this.relativeTargetOrigin); 34691 } 34692 else { 34693 this.relativeParent = this.relativeTarget = undefined; 34694 } 34695 } 34696 } 34697 getClosestProjectingParent() { 34698 if (!this.parent || 34699 hasScale(this.parent.latestValues) || 34700 has2DTranslate(this.parent.latestValues)) { 34701 return undefined; 34702 } 34703 if (this.parent.isProjecting()) { 34704 return this.parent; 34705 } 34706 else { 34707 return this.parent.getClosestProjectingParent(); 34708 } 34709 } 34710 isProjecting() { 34711 return Boolean((this.relativeTarget || 34712 this.targetDelta || 34713 this.options.layoutRoot) && 34714 this.layout); 34715 } 34716 calcProjection() { 34717 const lead = this.getLead(); 34718 const isShared = Boolean(this.resumingFrom) || this !== lead; 34719 let canSkip = true; 34720 /** 34721 * If this is a normal layout animation and neither this node nor its nearest projecting 34722 * is dirty then we can't skip. 34723 */ 34724 if (this.isProjectionDirty || this.parent?.isProjectionDirty) { 34725 canSkip = false; 34726 } 34727 /** 34728 * If this is a shared layout animation and this node's shared projection is dirty then 34729 * we can't skip. 34730 */ 34731 if (isShared && 34732 (this.isSharedProjectionDirty || this.isTransformDirty)) { 34733 canSkip = false; 34734 } 34735 /** 34736 * If we have resolved the target this frame we must recalculate the 34737 * projection to ensure it visually represents the internal calculations. 34738 */ 34739 if (this.resolvedRelativeTargetAt === frameData.timestamp) { 34740 canSkip = false; 34741 } 34742 if (canSkip) 34743 return; 34744 const { layout, layoutId } = this.options; 34745 /** 34746 * If this section of the tree isn't animating we can 34747 * delete our target sources for the following frame. 34748 */ 34749 this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) || 34750 this.currentAnimation || 34751 this.pendingAnimation); 34752 if (!this.isTreeAnimating) { 34753 this.targetDelta = this.relativeTarget = undefined; 34754 } 34755 if (!this.layout || !(layout || layoutId)) 34756 return; 34757 /** 34758 * Reset the corrected box with the latest values from box, as we're then going 34759 * to perform mutative operations on it. 34760 */ 34761 copyBoxInto(this.layoutCorrected, this.layout.layoutBox); 34762 /** 34763 * Record previous tree scales before updating. 34764 */ 34765 const prevTreeScaleX = this.treeScale.x; 34766 const prevTreeScaleY = this.treeScale.y; 34767 /** 34768 * Apply all the parent deltas to this box to produce the corrected box. This 34769 * is the layout box, as it will appear on screen as a result of the transforms of its parents. 34770 */ 34771 applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared); 34772 /** 34773 * If this layer needs to perform scale correction but doesn't have a target, 34774 * use the layout as the target. 34775 */ 34776 if (lead.layout && 34777 !lead.target && 34778 (this.treeScale.x !== 1 || this.treeScale.y !== 1)) { 34779 lead.target = lead.layout.layoutBox; 34780 lead.targetWithTransforms = createBox(); 34781 } 34782 const { target } = lead; 34783 if (!target) { 34784 /** 34785 * If we don't have a target to project into, but we were previously 34786 * projecting, we want to remove the stored transform and schedule 34787 * a render to ensure the elements reflect the removed transform. 34788 */ 34789 if (this.prevProjectionDelta) { 34790 this.createProjectionDeltas(); 34791 this.scheduleRender(); 34792 } 34793 return; 34794 } 34795 if (!this.projectionDelta || !this.prevProjectionDelta) { 34796 this.createProjectionDeltas(); 34797 } 34798 else { 34799 copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x); 34800 copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y); 34801 } 34802 /** 34803 * Update the delta between the corrected box and the target box before user-set transforms were applied. 34804 * This will allow us to calculate the corrected borderRadius and boxShadow to compensate 34805 * for our layout reprojection, but still allow them to be scaled correctly by the user. 34806 * It might be that to simplify this we may want to accept that user-set scale is also corrected 34807 * and we wouldn't have to keep and calc both deltas, OR we could support a user setting 34808 * to allow people to choose whether these styles are corrected based on just the 34809 * layout reprojection or the final bounding box. 34810 */ 34811 calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues); 34812 if (this.treeScale.x !== prevTreeScaleX || 34813 this.treeScale.y !== prevTreeScaleY || 34814 !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || 34815 !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) { 34816 this.hasProjected = true; 34817 this.scheduleRender(); 34818 this.notifyListeners("projectionUpdate", target); 34819 } 34820 } 34821 hide() { 34822 this.isVisible = false; 34823 // TODO: Schedule render 34824 } 34825 show() { 34826 this.isVisible = true; 34827 // TODO: Schedule render 34828 } 34829 scheduleRender(notifyAll = true) { 34830 this.options.visualElement?.scheduleRender(); 34831 if (notifyAll) { 34832 const stack = this.getStack(); 34833 stack && stack.scheduleRender(); 34834 } 34835 if (this.resumingFrom && !this.resumingFrom.instance) { 34836 this.resumingFrom = undefined; 34837 } 34838 } 34839 createProjectionDeltas() { 34840 this.prevProjectionDelta = createDelta(); 34841 this.projectionDelta = createDelta(); 34842 this.projectionDeltaWithTransform = createDelta(); 34843 } 34844 setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) { 34845 const snapshot = this.snapshot; 34846 const snapshotLatestValues = snapshot ? snapshot.latestValues : {}; 34847 const mixedValues = { ...this.latestValues }; 34848 const targetDelta = createDelta(); 34849 if (!this.relativeParent || 34850 !this.relativeParent.options.layoutRoot) { 34851 this.relativeTarget = this.relativeTargetOrigin = undefined; 34852 } 34853 this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged; 34854 const relativeLayout = createBox(); 34855 const snapshotSource = snapshot ? snapshot.source : undefined; 34856 const layoutSource = this.layout ? this.layout.source : undefined; 34857 const isSharedLayoutAnimation = snapshotSource !== layoutSource; 34858 const stack = this.getStack(); 34859 const isOnlyMember = !stack || stack.members.length <= 1; 34860 const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && 34861 !isOnlyMember && 34862 this.options.crossfade === true && 34863 !this.path.some(hasOpacityCrossfade)); 34864 this.animationProgress = 0; 34865 let prevRelativeTarget; 34866 this.mixTargetDelta = (latest) => { 34867 const progress = latest / 1000; 34868 mixAxisDelta(targetDelta.x, delta.x, progress); 34869 mixAxisDelta(targetDelta.y, delta.y, progress); 34870 this.setTargetDelta(targetDelta); 34871 if (this.relativeTarget && 34872 this.relativeTargetOrigin && 34873 this.layout && 34874 this.relativeParent && 34875 this.relativeParent.layout) { 34876 calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox); 34877 mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress); 34878 /** 34879 * If this is an unchanged relative target we can consider the 34880 * projection not dirty. 34881 */ 34882 if (prevRelativeTarget && 34883 boxEquals(this.relativeTarget, prevRelativeTarget)) { 34884 this.isProjectionDirty = false; 34885 } 34886 if (!prevRelativeTarget) 34887 prevRelativeTarget = createBox(); 34888 copyBoxInto(prevRelativeTarget, this.relativeTarget); 34889 } 34890 if (isSharedLayoutAnimation) { 34891 this.animationValues = mixedValues; 34892 mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember); 34893 } 34894 this.root.scheduleUpdateProjection(); 34895 this.scheduleRender(); 34896 this.animationProgress = progress; 34897 }; 34898 this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0); 34899 } 34900 startAnimation(options) { 34901 this.notifyListeners("animationStart"); 34902 this.currentAnimation?.stop(
vendor: 6,011 bytes, lines 34902-35035
34902false); 34903 this.resumingFrom?.currentAnimation?.stop(false); 34904 if (this.pendingAnimation) { 34905 cancelFrame(this.pendingAnimation); 34906 this.pendingAnimation = undefined; 34907 } 34908 /** 34909 * Start the animation in the next frame to have a frame with progress 0, 34910 * where the target is the same as when the animation started, so we can 34911 * calculate the relative positions correctly for instant transitions. 34912 */ 34913 this.pendingAnimation = frame.update(() => { 34914 globalProjectionState.hasAnimatedSinceResize = true; 34915 this.motionValue || (this.motionValue = motionValue(0)); 34916 this.currentAnimation = animateSingleValue(this.motionValue, [0, 1000], { 34917 ...options, 34918 isSync: true, 34919 onUpdate: (latest) => { 34920 this.mixTargetDelta(latest); 34921 options.onUpdate && options.onUpdate(latest); 34922 }, 34923 onStop: () => { 34924 }, 34925 onComplete: () => { 34926 options.onComplete && options.onComplete(); 34927 this.completeAnimation(); 34928 }, 34929 }); 34930 if (this.resumingFrom) { 34931 this.resumingFrom.currentAnimation = this.currentAnimation; 34932 } 34933 this.pendingAnimation = undefined; 34934 }); 34935 } 34936 completeAnimation() { 34937 if (this.resumingFrom) { 34938 this.resumingFrom.currentAnimation = undefined; 34939 this.resumingFrom.preserveOpacity = undefined; 34940 } 34941 const stack = this.getStack(); 34942 stack && stack.exitAnimationComplete(); 34943 this.resumingFrom = 34944 this.currentAnimation = 34945 this.animationValues = 34946 undefined; 34947 this.notifyListeners("animationComplete"); 34948 } 34949 finishAnimation() { 34950 if (this.currentAnimation) { 34951 this.mixTargetDelta && this.mixTargetDelta(animationTarget); 34952 this.currentAnimation.stop(false); 34953 } 34954 this.completeAnimation(); 34955 } 34956 applyTransformsToTarget() { 34957 const lead = this.getLead(); 34958 let { targetWithTransforms, target, layout, latestValues } = lead; 34959 if (!targetWithTransforms || !target || !layout) 34960 return; 34961 /** 34962 * If we're only animating position, and this element isn't the lead element, 34963 * then instead of projecting into the lead box we instead want to calculate 34964 * a new target that aligns the two boxes but maintains the layout shape. 34965 */ 34966 if (this !== lead && 34967 this.layout && 34968 layout && 34969 shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) { 34970 target = this.target || createBox(); 34971 const xLength = calcLength(this.layout.layoutBox.x); 34972 target.x.min = lead.target.x.min; 34973 target.x.max = target.x.min + xLength; 34974 const yLength = calcLength(this.layout.layoutBox.y); 34975 target.y.min = lead.target.y.min; 34976 target.y.max = target.y.min + yLength; 34977 } 34978 copyBoxInto(targetWithTransforms, target); 34979 /** 34980 * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal. 34981 * This is the final box that we will then project into by calculating a transform delta and 34982 * applying it to the corrected box. 34983 */ 34984 transformBox(targetWithTransforms, latestValues); 34985 /** 34986 * Update the delta between the corrected box and the final target box, after 34987 * user-set transforms are applied to it. This will be used by the renderer to 34988 * create a transform style that will reproject the element from its layout layout 34989 * into the desired bounding box. 34990 */ 34991 calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues); 34992 } 34993 registerSharedNode(layoutId, node) { 34994 if (!this.sharedNodes.has(layoutId)) { 34995 this.sharedNodes.set(layoutId, new NodeStack()); 34996 } 34997 const stack = this.sharedNodes.get(layoutId); 34998 stack.add(node); 34999 const config = node.options.initialPromotionConfig; 35000 node.promote({ 35001 transition: config ? config.transition : undefined, 35002 preserveFollowOpacity: config && config.shouldPreserveFollowOpacity 35003 ? config.shouldPreserveFollowOpacity(node) 35004 : undefined, 35005 }); 35006 } 35007 isLead() { 35008 const stack = this.getStack(); 35009 return stack ? stack.lead === this : true; 35010 } 35011 getLead() { 35012 const { layoutId } = this.options; 35013 return layoutId ? this.getStack()?.lead || this : this; 35014 } 35015 getPrevLead() { 35016 const { layoutId } = this.options; 35017 return layoutId ? this.getStack()?.prevLead : undefined; 35018 } 35019 getStack() { 35020 const { layoutId } = this.options; 35021 if (layoutId) 35022 return this.root.sharedNodes.get(layoutId); 35023 } 35024 promote({ needsReset, transition, preserveFollowOpacity, } = {}) { 35025 const stack = this.getStack(); 35026 if (stack) 35027 stack.promote(this, preserveFollowOpacity); 35028 if (needsReset) { 35029 this.projectionDelta = undefined; 35030 this.needsReset = true; 35031 } 35032 if (transition) 35033 this.setOptions({ transition }); 35034 } 35035 relegate() {
35036 const stack = this.getStack(); 35037 if (stack) { 35038 return stack.relegate(this); 35039 } 35040 else { 35041 return false; 35042 } 35043 } 35044 resetSkewAndRotation() { 35045 const { visualElement } = this.options; 35046 if (!visualElement) 35047 return; 35048 // If there's no detected skew or rotation values, we can early return without a forced render. 35049 let hasDistortingTransform = false; 35050 /** 35051 * An unrolled check for rotation values. Most elements don't have any rotation and 35052 * skipping the nested loop and new object creation is 50% faster. 35053 */ 35054 const { latestValues } = visualElement; 35055 if (latestValues.z || 35056 latestValues.rotate || 35057 latestValues.rotateX || 35058 latestValues.rotateY || 35059 latestValues.rotateZ || 35060 latestValues.skewX || 35061 latestValues.skewY) { 35062 hasDistortingTransform = true; 35063 } 35064 // If there's no distorting values, we don't need to do any more. 35065 if (!hasDistortingTransform) 35066 return; 35067 const resetValues = {}; 35068 if (latestValues.z) { 35069 resetDistortingTransform("z", visualElement, resetValues, this.animationValues); 35070 } 35071 // Check the skew and rotate value of all axes and reset to 0 35072 for (let i = 0; i < transformAxes.length; i++) { 35073 resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues); 35074 resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues); 35075 } 35076 // Force a render of this element to apply the transform with all skews and rotations 35077 // set to 0. 35078 visualElement.render(); 35079 // Put back all the values we reset 35080 for (const key in resetValues) { 35081 visualElement.setStaticValue(key, resetValues[key]); 35082 if (this.animationValues) { 35083 this.animationValues[key] = resetValues[key]; 35084 } 35085 } 35086 // Schedule a render for the next frame. This ensures we won't visually 35087 // see the element with the reset rotate value applied. 35088 visualElement.scheduleRender(); 35089 } 35090 getProjectionStyles(styleProp) { 35091 if (!this.instance || this.isSVG) 35092 return undefined; 35093 if (!this.isVisible) { 35094 return hiddenVisibility; 35095 } 35096 const styles = { 35097 visibility: "", 35098 }; 35099 const transformTemplate = this.getTransformTemplate(); 35100 if (this.needsReset) { 35101 this.needsReset = false; 35102 styles.opacity = ""; 35103 styles.pointerEvents = 35104 resolveMotionValue(styleProp?.pointerEvents) || ""; 35105 styles.transform = transformTemplate 35106 ? transformTemplate(this.latestValues, "") 35107 : "none"; 35108 return styles; 35109 } 35110 const lead = this.getLead(); 35111 if (!this.projectionDelta || !this.layout || !lead.target) { 35112 const emptyStyles = {}; 35113 if (this.options.layoutId) { 35114 emptyStyles.opacity = 35115 this.latestValues.opacity !== undefined 35116 ? this.latestValues.opacity 35117 : 1; 35118 emptyStyles.pointerEvents = 35119 resolveMotionValue(styleProp?.pointerEvents) || ""; 35120 } 35121 if (this.hasProjected && !hasTransform(this.latestValues)) { 35122 emptyStyles.transform = transformTemplate 35123 ? transformTemplate({}, "") 35124 : "none"; 35125 this.hasProjected = false; 35126 } 35127 return emptyStyles; 35128 } 35129 const valuesToRender = lead.animationValues || lead.latestValues; 35130 this.applyTransformsToTarget(); 35131 styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender); 35132 if (transformTemplate) { 35133 styles.transform = transformTemplate(valuesToRender, styles.transform); 35134 } 35135 const { x, y } = this.projectionDelta; 35136 styles.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`; 35137 if (lead.animationValues) { 35138 /** 35139 * If the lead component is animating, assign this either the entering/leaving 35140 * opacity 35141 */ 35142 styles.opacity = 35143 lead === this 35144 ? valuesToRender.opacity ?? 35145 this.latestValues.opacity ?? 35146 1 35147 : this.preserveOpacity 35148 ? this.latestValues.opacity 35149 : valuesToRender.opacityExit; 35150 } 35151 else { 35152 /** 35153 * Or we're not animating at all, set the lead component to its layout 35154 * opacity and other components to hidden. 35155 */ 35156 styles.opacity = 35157 lead === this 35158 ? valuesToRender.opacity !== undefined 35159 ? valuesToRender.opacity 35160 : "" 35161 : valuesToRender.opacityExit !== undefined 35162 ? valuesToRender.opacityExit 35163 : 0; 35164 } 35165 /** 35166 * Apply scale correction 35167 */ 35168 for (const key in scaleCorrectors) { 35169 if (valuesToRender[key] === undefined) 35170 continue; 35171 const { correct, applyTo, isCSSVariable } = scaleCorrectors[key]; 35172 /** 35173 * Only apply scale correction to the value if we have an 35174 * active projection transform. Otherwise these values become 35175 * vulnerable to distortion if the element changes size without 35176 * a corresponding layout animation. 35177 */ 35178 const corrected = styles.transform === "none" 35179 ? valuesToRender[key] 35180 : correct(valuesToRender[key], lead);
vendor: 29,671 bytes, lines 35181-36014
35181 if (applyTo) { 35182 const num = applyTo.length; 35183 for (let i = 0; i < num; i++) { 35184 styles[applyTo[i]] = corrected; 35185 } 35186 } 35187 else { 35188 // If this is a CSS variable, set it directly on the instance. 35189 // Replacing this function from creating styles to setting them 35190 // would be a good place to remove per frame object creation 35191 if (isCSSVariable) { 35192 this.options.visualElement.renderState.vars[key] = corrected; 35193 } 35194 else { 35195 styles[key] = corrected; 35196 } 35197 } 35198 } 35199 /** 35200 * Disable pointer events on follow components. This is to ensure 35201 * that if a follow component covers a lead component it doesn't block 35202 * pointer events on the lead. 35203 */ 35204 if (this.options.layoutId) { 35205 styles.pointerEvents = 35206 lead === this 35207 ? resolveMotionValue(styleProp?.pointerEvents) || "" 35208 : "none"; 35209 } 35210 return styles; 35211 } 35212 clearSnapshot() { 35213 this.resumeFrom = this.snapshot = undefined; 35214 } 35215 // Only run on root 35216 resetTree() { 35217 this.root.nodes.forEach((node) => node.currentAnimation?.stop(false)); 35218 this.root.nodes.forEach(clearMeasurements); 35219 this.root.sharedNodes.clear(); 35220 } 35221 }; 35222} 35223function updateLayout(node) { 35224 node.updateLayout(); 35225} 35226function notifyLayoutUpdate(node) { 35227 const snapshot = node.resumeFrom?.snapshot || node.snapshot; 35228 if (node.isLead() && 35229 node.layout && 35230 snapshot && 35231 node.hasListeners("didUpdate")) { 35232 const { layoutBox: layout, measuredBox: measuredLayout } = node.layout; 35233 const { animationType } = node.options; 35234 const isShared = snapshot.source !== node.layout.source; 35235 // TODO Maybe we want to also resize the layout snapshot so we don't trigger 35236 // animations for instance if layout="size" and an element has only changed position 35237 if (animationType === "size") { 35238 eachAxis((axis) => { 35239 const axisSnapshot = isShared 35240 ? snapshot.measuredBox[axis] 35241 : snapshot.layoutBox[axis]; 35242 const length = calcLength(axisSnapshot); 35243 axisSnapshot.min = layout[axis].min; 35244 axisSnapshot.max = axisSnapshot.min + length; 35245 }); 35246 } 35247 else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) { 35248 eachAxis((axis) => { 35249 const axisSnapshot = isShared 35250 ? snapshot.measuredBox[axis] 35251 : snapshot.layoutBox[axis]; 35252 const length = calcLength(layout[axis]); 35253 axisSnapshot.max = axisSnapshot.min + length; 35254 /** 35255 * Ensure relative target gets resized and rerendererd 35256 */ 35257 if (node.relativeTarget && !node.currentAnimation) { 35258 node.isProjectionDirty = true; 35259 node.relativeTarget[axis].max = 35260 node.relativeTarget[axis].min + length; 35261 } 35262 }); 35263 } 35264 const layoutDelta = createDelta(); 35265 calcBoxDelta(layoutDelta, layout, snapshot.layoutBox); 35266 const visualDelta = createDelta(); 35267 if (isShared) { 35268 calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox); 35269 } 35270 else { 35271 calcBoxDelta(visualDelta, layout, snapshot.layoutBox); 35272 } 35273 const hasLayoutChanged = !isDeltaZero(layoutDelta); 35274 let hasRelativeLayoutChanged = false; 35275 if (!node.resumeFrom) { 35276 const relativeParent = node.getClosestProjectingParent(); 35277 /** 35278 * If the relativeParent is itself resuming from a different element then 35279 * the relative snapshot is not relavent 35280 */ 35281 if (relativeParent && !relativeParent.resumeFrom) { 35282 const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent; 35283 if (parentSnapshot && parentLayout) { 35284 const relativeSnapshot = createBox(); 35285 calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox); 35286 const relativeLayout = createBox(); 35287 calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox); 35288 if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) { 35289 hasRelativeLayoutChanged = true; 35290 } 35291 if (relativeParent.options.layoutRoot) { 35292 node.relativeTarget = relativeLayout; 35293 node.relativeTargetOrigin = relativeSnapshot; 35294 node.relativeParent = relativeParent; 35295 } 35296 } 35297 } 35298 } 35299 node.notifyListeners("didUpdate", { 35300 layout, 35301 snapshot, 35302 delta: visualDelta, 35303 layoutDelta, 35304 hasLayoutChanged, 35305 hasRelativeLayoutChanged, 35306 }); 35307 } 35308 else if (node.isLead()) { 35309 const { onExitComplete } = node.options; 35310 onExitComplete && onExitComplete(); 35311 } 35312 /** 35313 * Clearing transition 35314 * TODO: Investigate why this transition is being passed in as {type: false } from Framer 35315 * and why we need it at all 35316 */ 35317 node.options.transition = undefined; 35318} 35319function propagateDirtyNodes(node) { 35320 if (!node.parent) 35321 return; 35322 /** 35323 * If this node isn't projecting, propagate isProjectionDirty. It will have 35324 * no performance impact but it will allow the next child that *is* projecting 35325 * but *isn't* dirty to just check its parent to see if *any* ancestor needs 35326 * correcting. 35327 */ 35328 if (!node.isProjecting()) { 35329 node.isProjectionDirty = node.parent.isProjectionDirty; 35330 } 35331 /** 35332 * Propagate isSharedProjectionDirty and isTransformDirty 35333 * throughout the whole tree. A future revision can take another look at 35334 * this but for safety we still recalcualte shared nodes. 35335 */ 35336 node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty || 35337 node.parent.isProjectionDirty || 35338 node.parent.isSharedProjectionDirty)); 35339 node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty); 35340} 35341function cleanDirtyNodes(node) { 35342 node.isProjectionDirty = 35343 node.isSharedProjectionDirty = 35344 node.isTransformDirty = 35345 false; 35346} 35347function clearSnapshot(node) { 35348 node.clearSnapshot(); 35349} 35350function clearMeasurements(node) { 35351 node.clearMeasurements(); 35352} 35353function clearIsLayoutDirty(node) { 35354 node.isLayoutDirty = false; 35355} 35356function resetTransformStyle(node) { 35357 const { visualElement } = node.options; 35358 if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) { 35359 visualElement.notify("BeforeLayoutMeasure"); 35360 } 35361 node.resetTransform(); 35362} 35363function finishAnimation(node) { 35364 node.finishAnimation(); 35365 node.targetDelta = node.relativeTarget = node.target = undefined; 35366 node.isProjectionDirty = true; 35367} 35368function resolveTargetDelta(node) { 35369 node.resolveTargetDelta(); 35370} 35371function calcProjection(node) { 35372 node.calcProjection(); 35373} 35374function resetSkewAndRotation(node) { 35375 node.resetSkewAndRotation(); 35376} 35377function removeLeadSnapshots(stack) { 35378 stack.removeLeadSnapshot(); 35379} 35380function mixAxisDelta(output, delta, p) { 35381 output.translate = mixNumber$1(delta.translate, 0, p); 35382 output.scale = mixNumber$1(delta.scale, 1, p); 35383 output.origin = delta.origin; 35384 output.originPoint = delta.originPoint; 35385} 35386function mixAxis(output, from, to, p) { 35387 output.min = mixNumber$1(from.min, to.min, p); 35388 output.max = mixNumber$1(from.max, to.max, p); 35389} 35390function mixBox(output, from, to, p) { 35391 mixAxis(output.x, from.x, to.x, p); 35392 mixAxis(output.y, from.y, to.y, p); 35393} 35394function hasOpacityCrossfade(node) { 35395 return (node.animationValues && node.animationValues.opacityExit !== undefined); 35396} 35397const defaultLayoutTransition = { 35398 duration: 0.45, 35399 ease: [0.4, 0, 0.1, 1], 35400}; 35401const userAgentContains = (string) => typeof navigator !== "undefined" && 35402 navigator.userAgent && 35403 navigator.userAgent.toLowerCase().includes(string); 35404/** 35405 * Measured bounding boxes must be rounded in Safari and 35406 * left untouched in Chrome, otherwise non-integer layouts within scaled-up elements 35407 * can appear to jump. 35408 */ 35409const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") 35410 ? Math.round 35411 : noop; 35412function roundAxis(axis) { 35413 // Round to the nearest .5 pixels to support subpixel layouts 35414 axis.min = roundPoint(axis.min); 35415 axis.max = roundPoint(axis.max); 35416} 35417function roundBox(box) { 35418 roundAxis(box.x); 35419 roundAxis(box.y); 35420} 35421function shouldAnimatePositionOnly(animationType, snapshot, layout) { 35422 return (animationType === "position" || 35423 (animationType === "preserve-aspect" && 35424 !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2))); 35425} 35426function checkNodeWasScrollRoot(node) { 35427 return node !== node.root && node.scroll?.wasRoot; 35428} 35429 35430const DocumentProjectionNode = createProjectionNode({ 35431 attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify), 35432 measureScroll: () => ({ 35433 x: document.documentElement.scrollLeft || document.body.scrollLeft, 35434 y: document.documentElement.scrollTop || document.body.scrollTop, 35435 }), 35436 checkIsScrollRoot: () => true, 35437}); 35438 35439const rootProjectionNode = { 35440 current: undefined, 35441}; 35442const HTMLProjectionNode = createProjectionNode({ 35443 measureScroll: (instance) => ({ 35444 x: instance.scrollLeft, 35445 y: instance.scrollTop, 35446 }), 35447 defaultParent: () => { 35448 if (!rootProjectionNode.current) { 35449 const documentNode = new DocumentProjectionNode({}); 35450 documentNode.mount(window); 35451 documentNode.setOptions({ layoutScroll: true }); 35452 rootProjectionNode.current = documentNode; 35453 } 35454 return rootProjectionNode.current; 35455 }, 35456 resetTransform: (instance, value) => { 35457 instance.style.transform = value !== undefined ? value : "none"; 35458 }, 35459 checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed"), 35460}); 35461 35462const drag = { 35463 pan: { 35464 Feature: PanGesture, 35465 }, 35466 drag: { 35467 Feature: DragGesture, 35468 ProjectionNode: HTMLProjectionNode, 35469 MeasureLayout, 35470 }, 35471}; 35472 35473function handleHoverEvent(node, event, lifecycle) { 35474 const { props } = node; 35475 if (node.animationState && props.whileHover) { 35476 node.animationState.setActive("whileHover", lifecycle === "Start"); 35477 } 35478 const eventName = ("onHover" + lifecycle); 35479 const callback = props[eventName]; 35480 if (callback) { 35481 frame.postRender(() => callback(event, extractEventInfo(event))); 35482 } 35483} 35484class HoverGesture extends Feature { 35485 mount() { 35486 const { current } = this.node; 35487 if (!current) 35488 return; 35489 this.unmount = hover(current, (_element, startEvent) => { 35490 handleHoverEvent(this.node, startEvent, "Start"); 35491 return (endEvent) => handleHoverEvent(this.node, endEvent, "End"); 35492 }); 35493 } 35494 unmount() { } 35495} 35496 35497class FocusGesture extends Feature { 35498 constructor() { 35499 super(...arguments); 35500 this.isActive = false; 35501 } 35502 onFocus() { 35503 let isFocusVisible = false; 35504 /** 35505 * If this element doesn't match focus-visible then don't 35506 * apply whileHover. But, if matches throws that focus-visible 35507 * is not a valid selector then in that browser outline styles will be applied 35508 * to the element by default and we want to match that behaviour with whileFocus. 35509 */ 35510 try { 35511 isFocusVisible = this.node.current.matches(":focus-visible"); 35512 } 35513 catch (e) { 35514 isFocusVisible = true; 35515 } 35516 if (!isFocusVisible || !this.node.animationState) 35517 return; 35518 this.node.animationState.setActive("whileFocus", true); 35519 this.isActive = true; 35520 } 35521 onBlur() { 35522 if (!this.isActive || !this.node.animationState) 35523 return; 35524 this.node.animationState.setActive("whileFocus", false); 35525 this.isActive = false; 35526 } 35527 mount() { 35528 this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur())); 35529 } 35530 unmount() { } 35531} 35532 35533function handlePressEvent(node, event, lifecycle) { 35534 const { props } = node; 35535 if (node.current instanceof HTMLButtonElement && node.current.disabled) { 35536 return; 35537 } 35538 if (node.animationState && props.whileTap) { 35539 node.animationState.setActive("whileTap", lifecycle === "Start"); 35540 } 35541 const eventName = ("onTap" + (lifecycle === "End" ? "" : lifecycle)); 35542 const callback = props[eventName]; 35543 if (callback) { 35544 frame.postRender(() => callback(event, extractEventInfo(event))); 35545 } 35546} 35547class PressGesture extends Feature { 35548 mount() { 35549 const { current } = this.node; 35550 if (!current) 35551 return; 35552 this.unmount = press(current, (_element, startEvent) => { 35553 handlePressEvent(this.node, startEvent, "Start"); 35554 return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel"); 35555 }, { useGlobalTarget: this.node.props.globalTapTarget }); 35556 } 35557 unmount() { } 35558} 35559 35560/** 35561 * Map an IntersectionHandler callback to an element. We only ever make one handler for one 35562 * element, so even though these handlers might all be triggered by different 35563 * observers, we can keep them in the same map. 35564 */ 35565const observerCallbacks = new WeakMap(); 35566/** 35567 * Multiple observers can be created for multiple element/document roots. Each with 35568 * different settings. So here we store dictionaries of observers to each root, 35569 * using serialised settings (threshold/margin) as lookup keys. 35570 */ 35571const observers = new WeakMap(); 35572const fireObserverCallback = (entry) => { 35573 const callback = observerCallbacks.get(entry.target); 35574 callback && callback(entry); 35575}; 35576const fireAllObserverCallbacks = (entries) => { 35577 entries.forEach(fireObserverCallback); 35578}; 35579function initIntersectionObserver({ root, ...options }) { 35580 const lookupRoot = root || document; 35581 /** 35582 * If we don't have an observer lookup map for this root, create one. 35583 */ 35584 if (!observers.has(lookupRoot)) { 35585 observers.set(lookupRoot, {}); 35586 } 35587 const rootObservers = observers.get(lookupRoot); 35588 const key = JSON.stringify(options); 35589 /** 35590 * If we don't have an observer for this combination of root and settings, 35591 * create one. 35592 */ 35593 if (!rootObservers[key]) { 35594 rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options }); 35595 } 35596 return rootObservers[key]; 35597} 35598function observeIntersection(element, options, callback) { 35599 const rootInteresectionObserver = initIntersectionObserver(options); 35600 observerCallbacks.set(element, callback); 35601 rootInteresectionObserver.observe(element); 35602 return () => { 35603 observerCallbacks.delete(element); 35604 rootInteresectionObserver.unobserve(element); 35605 }; 35606} 35607 35608const thresholdNames = { 35609 some: 0, 35610 all: 1, 35611}; 35612class InViewFeature extends Feature { 35613 constructor() { 35614 super(...arguments); 35615 this.hasEnteredView = false; 35616 this.isInView = false; 35617 } 35618 startObserver() { 35619 this.unmount(); 35620 const { viewport = {} } = this.node.getProps(); 35621 const { root, margin: rootMargin, amount = "some", once } = viewport; 35622 const options = { 35623 root: root ? root.current : undefined, 35624 rootMargin, 35625 threshold: typeof amount === "number" ? amount : thresholdNames[amount], 35626 }; 35627 const onIntersectionUpdate = (entry) => { 35628 const { isIntersecting } = entry; 35629 /** 35630 * If there's been no change in the viewport state, early return. 35631 */ 35632 if (this.isInView === isIntersecting) 35633 return; 35634 this.isInView = isIntersecting; 35635 /** 35636 * Handle hasEnteredView. If this is only meant to run once, and 35637 * element isn't visible, early return. Otherwise set hasEnteredView to true. 35638 */ 35639 if (once && !isIntersecting && this.hasEnteredView) { 35640 return; 35641 } 35642 else if (isIntersecting) { 35643 this.hasEnteredView = true; 35644 } 35645 if (this.node.animationState) { 35646 this.node.animationState.setActive("whileInView", isIntersecting); 35647 } 35648 /** 35649 * Use the latest committed props rather than the ones in scope 35650 * when this observer is created 35651 */ 35652 const { onViewportEnter, onViewportLeave } = this.node.getProps(); 35653 const callback = isIntersecting ? onViewportEnter : onViewportLeave; 35654 callback && callback(entry); 35655 }; 35656 return observeIntersection(this.node.current, options, onIntersectionUpdate); 35657 } 35658 mount() { 35659 this.startObserver(); 35660 } 35661 update() { 35662 if (typeof IntersectionObserver === "undefined") 35663 return; 35664 const { props, prevProps } = this.node; 35665 const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps)); 35666 if (hasOptionsChanged) { 35667 this.startObserver(); 35668 } 35669 } 35670 unmount() { } 35671} 35672function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) { 35673 return (name) => viewport[name] !== prevViewport[name]; 35674} 35675 35676const gestureAnimations = { 35677 inView: { 35678 Feature: InViewFeature, 35679 }, 35680 tap: { 35681 Feature: PressGesture, 35682 }, 35683 focus: { 35684 Feature: FocusGesture, 35685 }, 35686 hover: { 35687 Feature: HoverGesture, 35688 }, 35689}; 35690 35691const layout = { 35692 layout: { 35693 ProjectionNode: HTMLProjectionNode, 35694 MeasureLayout, 35695 }, 35696}; 35697 35698// Does this device prefer reduced motion? Returns `null` server-side. 35699const prefersReducedMotion = { current: null }; 35700const hasReducedMotionListener = { current: false }; 35701 35702function initPrefersReducedMotion() { 35703 hasReducedMotionListener.current = true; 35704 if (!isBrowser) 35705 return; 35706 if (window.matchMedia) { 35707 const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)"); 35708 const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches); 35709 motionMediaQuery.addListener(setReducedMotionPreferences); 35710 setReducedMotionPreferences(); 35711 } 35712 else { 35713 prefersReducedMotion.current = false; 35714 } 35715} 35716 35717const visualElementStore = new WeakMap(); 35718 35719function updateMotionValuesFromProps(element, next, prev) { 35720 for (const key in next) { 35721 const nextValue = next[key]; 35722 const prevValue = prev[key]; 35723 if (isMotionValue(nextValue)) { 35724 /** 35725 * If this is a motion value found in props or style, we want to add it 35726 * to our visual element's motion value map. 35727 */ 35728 element.addValue(key, nextValue); 35729 } 35730 else if (isMotionValue(prevValue)) { 35731 /** 35732 * If we're swapping from a motion value to a static value, 35733 * create a new motion value from that 35734 */ 35735 element.addValue(key, motionValue(nextValue, { owner: element })); 35736 } 35737 else if (prevValue !== nextValue) { 35738 /** 35739 * If this is a flat value that has changed, update the motion value 35740 * or create one if it doesn't exist. We only want to do this if we're 35741 * not handling the value with our animation state. 35742 */ 35743 if (element.hasValue(key)) { 35744 const existingValue = element.getValue(key); 35745 if (existingValue.liveStyle === true) { 35746 existingValue.jump(nextValue); 35747 } 35748 else if (!existingValue.hasAnimated) { 35749 existingValue.set(nextValue); 35750 } 35751 } 35752 else { 35753 const latestValue = element.getStaticValue(key); 35754 element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element })); 35755 } 35756 } 35757 } 35758 // Handle removed values 35759 for (const key in prev) { 35760 if (next[key] === undefined) 35761 element.removeValue(key); 35762 } 35763 return next; 35764} 35765 35766const propEventHandlers = [ 35767 "AnimationStart", 35768 "AnimationComplete", 35769 "Update", 35770 "BeforeLayoutMeasure", 35771 "LayoutMeasure", 35772 "LayoutAnimationStart", 35773 "LayoutAnimationComplete" 35774]; 35775class VisualElement { 35776 /** 35777 * This method takes React props and returns found MotionValues. For example, HTML 35778 * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. 35779 * 35780 * This isn't an abstract method as it needs calling in the constructor, but it is 35781 * intended to be one. 35782 */ 35783 scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) { 35784 return {}; 35785 } 35786 constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState }, options = {}) { 35787 this.current = null; 35788 this.children = /* @__PURE__ */ new Set(); 35789 this.isVariantNode = false; 35790 this.isControllingVariants = false; 35791 this.shouldReduceMotion = null; 35792 this.values = /* @__PURE__ */ new Map(); 35793 this.KeyframeResolver = KeyframeResolver; 35794 this.features = {}; 35795 this.valueSubscriptions = /* @__PURE__ */ new Map(); 35796 this.prevMotionValues = {}; 35797 this.events = {}; 35798 this.propEventSubscriptions = {}; 35799 this.notifyUpdate = () => this.notify("Update", this.latestValues); 35800 this.render = () => { 35801 if (!this.current) 35802 return; 35803 this.triggerBuild(); 35804 this.renderInstance(this.current, this.renderState, this.props.style, this.projection); 35805 }; 35806 this.renderScheduledAt = 0; 35807 this.scheduleRender = () => { 35808 const now = time.now(); 35809 if (this.renderScheduledAt < now) { 35810 this.renderScheduledAt = now; 35811 frame.render(this.render, false, true); 35812 } 35813 }; 35814 const { latestValues, renderState } = visualState; 35815 this.latestValues = latestValues; 35816 this.baseTarget = { ...latestValues }; 35817 this.initialValues = props.initial ? { ...latestValues } : {}; 35818 this.renderState = renderState; 35819 this.parent = parent; 35820 this.props = props; 35821 this.presenceContext = presenceContext; 35822 this.depth = parent ? parent.depth + 1 : 0; 35823 this.reducedMotionConfig = reducedMotionConfig; 35824 this.options = options; 35825 this.blockInitialAnimation = Boolean(blockInitialAnimation); 35826 this.isControllingVariants = isControllingVariants(props); 35827 this.isVariantNode = isVariantNode(props); 35828 if (this.isVariantNode) { 35829 this.variantChildren = /* @__PURE__ */ new Set(); 35830 } 35831 this.manuallyAnimateOnMount = Boolean(parent && parent.current); 35832 const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this); 35833 for (const key in initialMotionValues) { 35834 const value = initialMotionValues[key]; 35835 if (latestValues[key] !== void 0 && isMotionValue(value)) { 35836 value.set(latestValues[key], false); 35837 } 35838 } 35839 } 35840 mount(instance) { 35841 this.current = instance; 35842 visualElementStore.set(instance, this); 35843 if (this.projection && !this.projection.instance) { 35844 this.projection.mount(instance); 35845 } 35846 if (this.parent && this.isVariantNode && !this.isControllingVariants) { 35847 this.removeFromVariantTree = this.parent.addVariantChild(this); 35848 } 35849 this.values.forEach((value, key) => this.bindToMotionValue(key, value)); 35850 if (!hasReducedMotionListener.current) { 35851 initPrefersReducedMotion(); 35852 } 35853 this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : prefersReducedMotion.current; 35854 if (this.parent) 35855 this.parent.children.add(this); 35856 this.update(this.props, this.presenceContext); 35857 } 35858 unmount() { 35859 this.projection && this.projection.unmount(); 35860 cancelFrame(this.notifyUpdate); 35861 cancelFrame(this.render); 35862 this.valueSubscriptions.forEach((remove) => remove()); 35863 this.valueSubscriptions.clear(); 35864 this.removeFromVariantTree && this.removeFromVariantTree(); 35865 this.parent && this.parent.children.delete(this); 35866 for (const key in this.events) { 35867 this.events[key].clear(); 35868 } 35869 for (const key in this.features) { 35870 const feature = this.features[key]; 35871 if (feature) { 35872 feature.unmount(); 35873 feature.isMounted = false; 35874 } 35875 } 35876 this.current = null; 35877 } 35878 bindToMotionValue(key, value) { 35879 if (this.valueSubscriptions.has(key)) { 35880 this.valueSubscriptions.get(key)(); 35881 } 35882 const valueIsTransform = transformProps.has(key); 35883 if (valueIsTransform && this.onBindTransform) { 35884 this.onBindTransform(); 35885 } 35886 const removeOnChange = value.on("change", (latestValue) => { 35887 this.latestValues[key] = latestValue; 35888 this.props.onUpdate && frame.preRender(this.notifyUpdate); 35889 if (valueIsTransform && this.projection) { 35890 this.projection.isTransformDirty = true; 35891 } 35892 }); 35893 const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender); 35894 let removeSyncCheck; 35895 if (window.MotionCheckAppearSync) { 35896 removeSyncCheck = window.MotionCheckAppearSync(this, key, value); 35897 } 35898 this.valueSubscriptions.set(key, () => { 35899 removeOnChange(); 35900 removeOnRenderRequest(); 35901 if (removeSyncCheck) 35902 removeSyncCheck(); 35903 if (value.owner) 35904 value.stop(); 35905 }); 35906 } 35907 sortNodePosition(other) { 35908 if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) { 35909 return 0; 35910 } 35911 return this.sortInstanceNodePosition(this.current, other.current); 35912 } 35913 updateFeatures() { 35914 let key = "animation"; 35915 for (key in featureDefinitions) { 35916 const featureDefinition = featureDefinitions[key]; 35917 if (!featureDefinition) 35918 continue; 35919 const { isEnabled, Feature: FeatureConstructor } = featureDefinition; 35920 if (!this.features[key] && FeatureConstructor && isEnabled(this.props)) { 35921 this.features[key] = new FeatureConstructor(this); 35922 } 35923 if (this.features[key]) { 35924 const feature = this.features[key]; 35925 if (feature.isMounted) { 35926 feature.update(); 35927 } else { 35928 feature.mount(); 35929 feature.isMounted = true; 35930 } 35931 } 35932 } 35933 } 35934 triggerBuild() { 35935 this.build(this.renderState, this.latestValues, this.props); 35936 } 35937 /** 35938 * Measure the current viewport box with or without transforms. 35939 * Only measures axis-aligned boxes, rotate and skew must be manually 35940 * removed with a re-render to work. 35941 */ 35942 measureViewportBox() { 35943 return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox(); 35944 } 35945 getStaticValue(key) { 35946 return this.latestValues[key]; 35947 } 35948 setStaticValue(key, value) { 35949 this.latestValues[key] = value; 35950 } 35951 /** 35952 * Update the provided props. Ensure any newly-added motion values are 35953 * added to our map, old ones removed, and listeners updated. 35954 */ 35955 update(props, presenceContext) { 35956 if (props.transformTemplate || this.props.transformTemplate) { 35957 this.scheduleRender(); 35958 } 35959 this.prevProps = this.props; 35960 this.props = props; 35961 this.prevPresenceContext = this.presenceContext; 35962 this.presenceContext = presenceContext; 35963 for (let i = 0; i < propEventHandlers.length; i++) { 35964 const key = propEventHandlers[i]; 35965 if (this.propEventSubscriptions[key]) { 35966 this.propEventSubscriptions[key](); 35967 delete this.propEventSubscriptions[key]; 35968 } 35969 const listenerName = "on" + key; 35970 const listener = props[listenerName]; 35971 if (listener) { 35972 this.propEventSubscriptions[key] = this.on(key, listener); 35973 } 35974 } 35975 this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues); 35976 if (this.handleChildMotionValue) { 35977 this.handleChildMotionValue(); 35978 } 35979 } 35980 getProps() { 35981 return this.props; 35982 } 35983 /** 35984 * Returns the variant definition with a given name. 35985 */ 35986 getVariant(name) { 35987 return this.props.variants ? this.props.variants[name] : void 0; 35988 } 35989 /** 35990 * Returns the defined default transition on this component. 35991 */ 35992 getDefaultTransition() { 35993 return this.props.transition; 35994 } 35995 getTransformPagePoint() { 35996 return this.props.transformPagePoint; 35997 } 35998 getClosestVariantNode() { 35999 return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0; 36000 } 36001 /** 36002 * Add a child visual element to our set of children. 36003 */ 36004 addVariantChild(child) { 36005 const closestVariantNode = this.getClosestVariantNode(); 36006 if (closestVariantNode) { 36007 closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child); 36008 return () => closestVariantNode.variantChildren.delete(child); 36009 } 36010 } 36011 /** 36012 * Add a motion value and bind it to this visual element. 36013 */ 36014 addValue(key, value) {
vendor: 6,165 bytes, lines 36015-36197
36015 const existingValue = this.values.get(key); 36016 if (value !== existingValue) { 36017 if (existingValue) 36018 this.removeValue(key); 36019 this.bindToMotionValue(key, value); 36020 this.values.set(key, value); 36021 this.latestValues[key] = value.get(); 36022 } 36023 } 36024 /** 36025 * Remove a motion value and unbind any active subscriptions. 36026 */ 36027 removeValue(key) { 36028 this.values.delete(key); 36029 const unsubscribe = this.valueSubscriptions.get(key); 36030 if (unsubscribe) { 36031 unsubscribe(); 36032 this.valueSubscriptions.delete(key); 36033 } 36034 delete this.latestValues[key]; 36035 this.removeValueFromRenderState(key, this.renderState); 36036 } 36037 /** 36038 * Check whether we have a motion value for this key 36039 */ 36040 hasValue(key) { 36041 return this.values.has(key); 36042 } 36043 getValue(key, defaultValue) { 36044 if (this.props.values && this.props.values[key]) { 36045 return this.props.values[key]; 36046 } 36047 let value = this.values.get(key); 36048 if (value === void 0 && defaultValue !== void 0) { 36049 value = motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this }); 36050 this.addValue(key, value); 36051 } 36052 return value; 36053 } 36054 /** 36055 * If we're trying to animate to a previously unencountered value, 36056 * we need to check for it in our state and as a last resort read it 36057 * directly from the instance (which might have performance implications). 36058 */ 36059 readValue(key, target) { 36060 let value = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : this.getBaseTargetFromProps(this.props, key) ?? this.readValueFromInstance(this.current, key, this.options); 36061 if (value !== void 0 && value !== null) { 36062 if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) { 36063 value = parseFloat(value); 36064 } else if (!findValueType(value) && complex.test(target)) { 36065 value = getAnimatableNone(key, target); 36066 } 36067 this.setBaseTarget(key, isMotionValue(value) ? value.get() : value); 36068 } 36069 return isMotionValue(value) ? value.get() : value; 36070 } 36071 /** 36072 * Set the base target to later animate back to. This is currently 36073 * only hydrated on creation and when we first read a value. 36074 */ 36075 setBaseTarget(key, value) { 36076 this.baseTarget[key] = value; 36077 } 36078 /** 36079 * Find the base target for a value thats been removed from all animation 36080 * props. 36081 */ 36082 getBaseTarget(key) { 36083 const { initial } = this.props; 36084 let valueFromInitial; 36085 if (typeof initial === "string" || typeof initial === "object") { 36086 const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom); 36087 if (variant) { 36088 valueFromInitial = variant[key]; 36089 } 36090 } 36091 if (initial && valueFromInitial !== void 0) { 36092 return valueFromInitial; 36093 } 36094 const target = this.getBaseTargetFromProps(this.props, key); 36095 if (target !== void 0 && !isMotionValue(target)) 36096 return target; 36097 return this.initialValues[key] !== void 0 && valueFromInitial === void 0 ? void 0 : this.baseTarget[key]; 36098 } 36099 on(eventName, callback) { 36100 if (!this.events[eventName]) { 36101 this.events[eventName] = new SubscriptionManager(); 36102 } 36103 return this.events[eventName].add(callback); 36104 } 36105 notify(eventName, ...args) { 36106 if (this.events[eventName]) { 36107 this.events[eventName].notify(...args); 36108 } 36109 } 36110} 36111 36112class DOMVisualElement extends VisualElement { 36113 constructor() { 36114 super(...arguments); 36115 this.KeyframeResolver = DOMKeyframesResolver; 36116 } 36117 sortInstanceNodePosition(a, b) { 36118 /** 36119 * compareDocumentPosition returns a bitmask, by using the bitwise & 36120 * we're returning true if 2 in that bitmask is set to true. 2 is set 36121 * to true if b preceeds a. 36122 */ 36123 return a.compareDocumentPosition(b) & 2 ? 1 : -1; 36124 } 36125 getBaseTargetFromProps(props, key) { 36126 return props.style 36127 ? props.style[key] 36128 : undefined; 36129 } 36130 removeValueFromRenderState(key, { vars, style }) { 36131 delete vars[key]; 36132 delete style[key]; 36133 } 36134 handleChildMotionValue() { 36135 if (this.childSubscription) { 36136 this.childSubscription(); 36137 delete this.childSubscription; 36138 } 36139 const { children } = this.props; 36140 if (isMotionValue(children)) { 36141 this.childSubscription = children.on("change", (latest) => { 36142 if (this.current) { 36143 this.current.textContent = `${latest}`; 36144 } 36145 }); 36146 } 36147 } 36148} 36149 36150function renderHTML(element, { style, vars }, styleProp, projection) { 36151 Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp)); 36152 // Loop over any CSS variables and assign those. 36153 for (const key in vars) { 36154 element.style.setProperty(key, vars[key]); 36155 } 36156} 36157 36158function getComputedStyle$1(element) { 36159 return window.getComputedStyle(element); 36160} 36161class HTMLVisualElement extends DOMVisualElement { 36162 constructor() { 36163 super(...arguments); 36164 this.type = "html"; 36165 this.renderInstance = renderHTML; 36166 } 36167 readValueFromInstance(instance, key) { 36168 if (transformProps.has(key)) { 36169 return readTransformValue(instance, key); 36170 } 36171 else { 36172 const computedStyle = getComputedStyle$1(instance); 36173 const value = (isCSSVariableName(key) 36174 ? computedStyle.getPropertyValue(key) 36175 : computedStyle[key]) || 0; 36176 return typeof value === "string" ? value.trim() : value; 36177 } 36178 } 36179 measureInstanceViewportBox(instance, { transformPagePoint }) { 36180 return measureViewportBox(instance, transformPagePoint); 36181 } 36182 build(renderState, latestValues, props) { 36183 buildHTMLStyles(renderState, latestValues, props.transformTemplate); 36184 } 36185 scrapeMotionValuesFromProps(props, prevProps, visualElement) { 36186 return scrapeMotionValuesFromProps$1(props, prevProps, visualElement); 36187 } 36188} 36189 36190/** 36191 * A set of attribute names that are always read/written as camel case. 36192 */ 36193const camelCaseAttributes = new Set([ 36194 "baseFrequency", 36195 "diffuseConstant", 36196 "kernelMatrix", 36197 "kernelUnitLength",
36198 "keySplines", 36199 "keyTimes", 36200 "limitingConeAngle", 36201 "markerHeight", 36202 "markerWidth", 36203 "numOctaves", 36204 "targetX", 36205 "targetY", 36206 "surfaceScale", 36207 "specularConstant", 36208 "specularExponent", 36209 "stdDeviation", 36210 "tableValues", 36211 "viewBox", 36212 "gradientTransform", 36213 "pathLength", 36214 "startOffset", 36215 "textLength", 36216 "lengthAdjust", 36217]); 36218 36219function renderSVG(element, renderState, _styleProp, projection) { 36220 renderHTML(element, renderState, undefined, projection); 36221 for (const key in renderState.attrs) { 36222 element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]); 36223 } 36224} 36225 36226class SVGVisualElement extends DOMVisualElement { 36227 constructor() { 36228 super(...arguments); 36229 this.type = "svg"; 36230 this.isSVGTag = false; 36231 this.measureInstanceViewportBox = createBox; 36232 } 36233 getBaseTargetFromProps(props, key) { 36234 return props[key]; 36235 } 36236 readValueFromInstance(instance, key) { 36237 if (transformProps.has(key)) { 36238 const defaultType = getDefaultValueType(key); 36239 return defaultType ? defaultType.default || 0 : 0; 36240 } 36241 key = !camelCaseAttributes.has(key) ? camelToDash(key) : key; 36242 return instance.getAttribute(key); 36243 } 36244 scrapeMotionValuesFromProps(props, prevProps, visualElement) { 36245 return scrapeMotionValuesFromProps(props, prevProps, visualElement); 36246 } 36247 build(renderState, latestValues, props) { 36248 buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate, props.style); 36249 } 36250 renderInstance(instance, renderState, styleProp, projection) { 36251 renderSVG(instance, renderState, styleProp, projection); 36252 } 36253 mount(instance) { 36254 this.isSVGTag = isSVGTag(instance.tagName); 36255 super.mount(instance); 36256 } 36257} 36258 36259const createDomVisualElement = (Component, options) => { 36260 return isSVGComponent(Component) 36261 ? new SVGVisualElement(options) 36262 : new HTMLVisualElement(options, { 36263 allowProjection: Component !== reactExports.Fragment, 36264 }); 36265}; 36266 36267const createMotionComponent = /*@__PURE__*/ createMotionComponentFactory({ 36268 ...animations, 36269 ...gestureAnimations, 36270 ...drag, 36271 ...layout, 36272}, createDomVisualElement); 36273 36274const motion = /*@__PURE__*/ createDOMMotionComponentProxy(createMotionComponent); 36275 36276const Accordion = ({ items, className, collapsible = false }) => { 36277 const [openIndex, setOpenIndex] = reactExports.useState(collapsible ? null : 0); 36278 const contentRefs = reactExports.useRef([]); 36279 reactExports.useEffect(() => { 36280 contentRefs.current = items.map(() => null); 36281 }, [items]); 36282 const toggleItem = (index) => { 36283 if (collapsible) { 36284 setOpenIndex(openIndex === index ? null : index); 36285 } else { 36286 setOpenIndex(openIndex === index ? 0 : index); 36287 } 36288 }; 36289 const getAccordionItemClasses = (index) => { 36290 return cn( 36291 "border border-lavender/15 bg-nightfall rounded-3xl overflow-hidden transition-all duration-300" 36292 ); 36293 }; 36294 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("w-full", className), children: items.map((item, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs( 36295 "div", 36296 { 36297 className: getAccordionItemClasses(), 36298 children: [
36299 /* @__PURE__ */ jsxRuntimeExports.jsxs( 36300 "button", 36301 { 36302 className: cn( 36303 "flex w-full items-center justify-between p-6 text-left bg-nightfall text-base", 36304 "transition-colors duration-200", 36305 "hover:bg-muted focus:outline-none focus:ring-0" 36306 ), 36307 onClick: () => toggleItem(index), 36308 "aria-expanded": openIndex === index, 36309 children: [ 36310 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold", children: item.title }), 36311 /* @__PURE__ */ jsxRuntimeExports.jsx( 36312 "span", 36313 { 36314 className: cn( 36315 "shrink-0 icon-[solar--arrow-right-down-outline] text-2xl leading-none text-lavender transition-transform duration-300", 36316 openIndex === index ? "-rotate-90" : "rotate-0" 36317 ) 36318 } 36319 ) 36320 ] 36321 } 36322 ), 36323 /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: openIndex === index && /* @__P
36323URE__ */ jsxRuntimeExports.jsx( 36324 motion.div, 36325 { 36326 ref: contentRefs.current[index], 36327 initial: { height: 0, opacity: 0 }, 36328 animate: { height: "auto", opacity: 1 }, 36329 exit: { height: 0, opacity: 0 }, 36330 transition: { duration: 0.3, ease: "easeInOut" }, 36331 className: "overflow-hidden", 36332 children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pb-6 px-6 text-base text-textSecondary2", children: item.content }) 36333 } 36334 ) }) 36335 ] 36336 }, 36337 index 36338 )) }); 36339}; 36340 36341const iconBrain = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAAC+lBMVEUAAACHO0T0tcj5rcWEQUxmKS5vFjB2HTdxKDX6uM70q8N7MkKsTVrzp8D0t8qIKkXxpr5gGSj4rcX0qsF2IDloHy/SgplbIij4pr9mGyv0qL/3v9L5rMXPbov7t86TN0/2pL5lGSr2n7moSlxUJiv1orv5us6VO1N3LT31pb1yGjOML0r3nbm6WnaiR1r2pr/1nbhbJCtzLza3U2vFX36LMUxSHiPkh6KHLkT5schwOz/ohaP5t82pVGrBXXugQl7miKPzkK6DJkHymrP5uM1zLzY7ISPlfp6xUGzQc47OcIy6WWXDZYHfgJzXcI/4lLKhPlvwi6m7bIP+ytz/x9r+zN7BXXr8vtOpRmT+vtP9wdb+ssr+1OP7u9D+qsT+z+D9xNj+1uX+psL+n7z+r8j/2ef/ob/Yc5HVb43+u9DqgqG9Wnj+0eH+rMb0k7Dzj63cc5PQaIe0UG79t83+nbr5nbn9mLf8lrXmh6PfdpbIYH+9V3WWNlL+mrnqhaSsSWamRGGcPFmMLUn/3Or8x9r7qsP7obz0nbf0mLTjfJrfeZjVbIu5VnT/5fD7wtb6tMv7rsb7qMH/pMD2obzwnLb6k7L3j6/viKfTaYnNaYf+tMz6scj5mbbxi6nqiabigJ3Yb47JZILDZXjBWnihQFyfPFmaOFWRMU33sMbwl7Luj6v1jKvtiafacJDIaX+1U3GuTWr/4e3/3+z+uM74pL7vk67uhqTmfZzbdpTNZIOxS2mCJUBwLTX4qsP8pb/mhKDffpvae5fMboSxTmywWGijQl/4psDmgJ7deZbRbovFYn/FX324UW/3lLLtjKnScozPcYnLYoHFXHuRNFBSER72tMrieZjWd5LKZ4W8XGueSlaFKER+Iz56NDz/xNjof5/Pa4m7U3LCYH28YXR8Hzvpla9VHCP/wdbmjKi3V2RxHDVJHB//6fLvorrCYXBfECZJDxpAFBg6DxQvDBCrUl+iT12WRlJpGS5pESvTfpiXQErcg57djKWPQ02XLEyeAAAAU3RSTlMA/gn+Cf78/hb+/Db+/SD+Of52TUkhFP7rXkP9yW3k4tvJrJeXjomJd2jizLyYWCv148/MurSsqaGdjX1cJvXy7+XbzbKxpKB5RzLw397d2NehJbgpfz0AAAuvSURBVFjD7JLb78tgHMbF3GzJREhEnCISREK4kIgQISRCiEjbNT2t7daOsgP660wcQtaudWpXLWKdIYRt5vDbATfb7GYOieFiuJARiXDBHyBceIc4n689F33f9/u+7yfP+/Q75L/+66caOnzUyCkjpy9YMGrU2OH/iBg6esT0eUsnzbbVtqvr8no840f2maOG/xVlxJQZM2aMaTuOk/fk3Tot19065R7nVL2AN3zoH75mxNgpi7PVdr5OMTIEJCM0+szuuihEptqvvN5Jk8f+AWbslCVjxlyO1p38M5vSGYbRGVnuvrjzIu9GIUQ2HAql8mOmD/0NZtTkMVWXYVlpStft4wXTqVSUwivvm9deiE+yiN595TVQWabGzBsx7FePmjpGcRyX5aJQhuk+e2YgLBvG7ZsXXo/jBw8M8pD39VuPDiE0glITp/409eFTx7vSbbtQzKl1g/Ko7nBy8AC4jrfujkseePmyHO56x5HlcjnJkiStu5f+hDRrvGWptZrX7c6rNfvZC4ovA87LA4PQs/ecA6SbYgcPAPRgnxRmqKk/5Ixdoh2/c9yiEJYnIU/rrodNlst9VFnv8oMAmGTSyPvSILAE0zwLTRzxI84k9YXvloeBwiwPztx5TfNJnmWTg2VegJJ9Ho3KJE8iNNjnEZhN8qQ8/vs2GDHeQKt3XsEQw8AIycpvuyzP0jS
36341ZTPIIGuaTyWQYl0mWpdGMjCBQhSF5sE9NGvUNZ/RkhcLtZzjUcylpDEE8NsKSEA6RPEvieJhlQSQCFAbJwG2r7moXRIQEC7Q+ceTQr3Ke3NEco5iH4ef2DRWDZLsbJmmsgoDDiIgi4AuhAhIOh2m4fv5GrrlHE2E6DED4uKlDv/SjXW2m25rQw7FCk8AhporTNEwICE0jsINCNCTLRgWiacCzXtQp1KhKCo7QTJdi3CM/g0bN1m4UCKkhYAIRNTEYEhQYXOnPIAjN6zJIjnFRYAFjiokhNBmGUAWQwCEUnbjgU0PPLUZz6XSWq1TEVDSDwTDBwXDPMTEGhmERgBhdR6sUWOCOgsHAJx2GKIWAEQQWBfFTFwxfVSxqRCPLEQQX1TJY77lfZHpYVREwvNdz8rqu47hhUQwoGlgPBgKGdSPCQBDjEGJ63seYli8qdkxOyka4SOCYlMGeY6aIYxnVrAASVs+jOI6623UwPBcEHHxxlALmDBOH4OeudoabNOvjy3JNrRGIZgN+v7RTIgSs4hcFIV0zMwKGVSwPhaJG3WWgGCaIoNIfABx1vULhHmYVlPTsUR96cdG1hCRJiWjo4MHbV1KcWCFMkcpUOw0uU6lwBTvfzVtVRxTFTCZTEQRBzNQLdcOxn1HPsUxxb02tTX8PmvDgWi2q1a7G4sFgbE8qQmQipigSViIFQiOkRMF+ZRfaaTDnQCFDcP5Uraaq9ps3+QphrS9JZmrG6Pegm4lOp9h6WLodj5f2DPg5QqkaRtpuZf0EF0k1qmqt9cJS0hyXBlIaqds5ye9XGmrBVl/sXS9FuMDt+YAzbM6DRCJxbdPRXOzQofU3QFKcv+pyWYmj0QDX9xAJqA+uaVZbUdpVS83e3rk3CtL0RzgiXe1s3XM7EDiYnQv+24qVrUQz0bx8fWcxdm7P2tvBg4FGyjTVlu9IyvRHIpHAwaDWytUKWqFWLHZKa5+WgsFgKBQAGRCR1JHL2VBox+pZ4GULHzSbuVistLNUOnL1ZCmbajRMv5nK+fZGpUag0UjtyMZubrh67dqN1tW163xnbsZ39DUQ8vf7ZeDysYHQwJY1Q4fM3PDk2vFEp1gs5XI79244HpVSQJIUPbnperGgqVo0dnnPtkdnd23e5vOdunh69/odAzviWw6dOwS8A7exK4fj2cOLRwyZecn3AJByOZBUc4/vZq6gaVq0Fo2d3HziRhMUH185v2379s03r5eOHYtFY3vPBYM74oeO7TkXjw8EgwOHt66PHY6V5g+ZtvvSw3Wta8ff6/49394cSCKXaF73nfVtWrf26sZN2zbvv9nJhg6GgsDDwdBAKLhjy6ErJ44d2hKP74gf3rfx8rFjO5e9Y7PaQZ2GwnAGtYJDEXzgIA4OCqKLCoKo4OJjEHEIZ3K4wm1J0SahWvMwr0Ft00mwScBHSpJ2qKVdbJtU9Eoo7W16hbZSCy30wcXhLo7X0b8ooui3hJBzPr7H/0OwYwM5sxitRyNfPn5s1w2v115bS7cjUQrtKnTxoCv67Oun76GmldXEozswtKurdx4k4yZL3HueBBRVaqppxBXsqMijMocvOjljPRp1Pcly3Z7l2bwS+t4oKLb+6sUKdHd75VkiCRoeJRIQ0Ua1RzNaPJt9/rzIkFVNeH0eO5mRBnwTVTIxvJNz2W5eycuFcN4LolFamdDao2e374IcsJTMFovZ54CNrMZ0nd6Q0F4Wi9qwRAjT9mHsqC/yY16W5eaSy+o2w99D+SAVv//4/gtBja8CydINyHhZmxJV7eXLl9Waas3puc7UCKJKkOpwyNy4jp26ZCu271eQw8uS6KP8ZLObiidWboOd1WJiZWUVSkomn2/Eo2KXVUmSLOlzzqxNS33XJKfCVFXTjHrmALb77GAgigiJCGIZh5XNhkVsJO5ARRBsEp6JpFbMZuMa43kWbnFzruugknbvxb26OCcFoaa77bQORNj+s7KIHLkpSXY+vPUthE+L0Gsym00+WhqCkaFKNaJGWv1aVXgdnTtjvtd6+wRGduSTApEyWT2in1z+m+y7JCJ5rPCO7fCN72K9tVSQbU2LUO9Gtlg1OTxgLdoaQj5vhFRvgPTam08wnJ8MtdUakj2Wcg8DD5iTUFPZmih8vrA5zkXaLeGNJqhGTagSKVJnc+kPa1+MnJkiBAKQ4rrqsNVqEdU36RkzZEpuvxcA0VLSEWAqhLa3JqFdzZGxXl973aY8ZLFsjPbo3Jrw8MOH12kGkE6nainV0sl0mhmmpkPKLJVUNwguXsN+Mp2wpWZhPJ5sb5U7nc7I6HDd5Sz0YxVuPZ1K16GrSCRSMiP1OsNAKCXorkQypK6ruu72rdOQNQACP37iCD9QwhOF6+TwCqLx9Y8fl5ciZoSEddGjAFV3KTMCElgK3ijKNE2qp1Mu259fxX5j955958KN0CAD801njGjkF6KAnOcvRqPlhb4xoyi371IUxbIz1QxivR7b507fwv7EjuOXQwMaLMVys9nMMIzZ+swYGbOOmM83EZJsx6HxxWKBc32WZTkuZ6h41+p3LA8E/c20/9AR0Ssvly43CoBxgcdimYotZWJlJCubuxo88mm6O59zHOd5eM4Y4RCmd/MC9g+O2ZIITEHAdtDAaTZtmXcqMTzjIynf+P4tFB7IcMLzYUGlzCII8AwsxDHsX+w5kndEsAf+EPLLZRo1K+VyRZILja29nz9/3bsdaih5x3EKYwc+wAG5cOJfQeDunFKQpYpPl2kf6DLlCoQjDybbQHJw5zvA9t69uzYnYLNgSwghWzmxB/sf9vxon35aEwTjAI4/gpWgEINceBqSsOgQ1CBGsMugLnsDezFB1EvxYDfpniexc8KEoc2TIYhQ/mcIg/0e225blLvuc374+vupzyO+LGs4M10up8/r2QRmORi+W1FsIks1LckI5co1DtXddv6yqNc6XfSzRmdVny8mkiTNpMV8+wYbBaHfxB1LE1VdV0XPIhQ3MCDW4QUa/abB13a7FYAL834wgiCKfLzWsbPZ6KosmkxuwwN4mkInsG2+inV6cDaKozDEITvTHPUVQEl0TNNjcuKeRKdRDY7jGjQr+GEcQ8n/HmgDdBWPpCUMw3TRma6HPT+K49CtVGwidWRdLzKyLIp7j7FaFDob3RbG40HzK6TizLGz35t3D+giJKKE42pOEQFQMc2nLroYO4Cv/5Fqjig6jgMRD7RIdDlKwCUr0bAkYQC8oDJIji9+bctKLSvL85tbCpVEcYOeYttEYUiTqDyS5oajfr8/akPmr0iKZUn0r5xPW8N7+XGOJj4AAAAASUVORK5CYII="; 36342 36343const iconGear = ""+new URL('icon-gear.png', import.meta.url).href+""; 36344 36345const iconLightning = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAAC+lBMVEUAAADVrxz/qAD3pAfMlTH6rQP/pADklxrptQ39qwDQoS/+rQH9lQL5mQf8mQL/qAD9mgT6mgb4pgr7twPloBzmoRrrmxP/lQD/mQH+pwH/mwH+lwL/nwD+ugD9sgD7rAL1mQz1mwzinhrxuQf+nwLvmBP+kQL+oAH+mAH6qhP/sQD9rAH5lwb0mwr9tgD1nw3snhH4ngf9mAHiqyT0mwbRpCz+mgr9pxL+lAD+wgH+sQH+rwH9ogb6mwX7qBT6pAX9lwL5rxb4phX2vCL5rw70xxH4pw79mQL1oxD/mgD8mgP8ogT3pBD8ngP5nwXwsh7uqRTouSzqtCT4mQXuqxj2vBDprR7zrQbnrB/2mwbYri7qnhbtnxP9rhf9oQH8xgT8zAT/zAD8pxL+tgH8pxP/uAD3tB7/nQD8lgL1sRn0zQzzsRn1ohX9nAPwrhn+uwDzrRT3yAfmwSH1mQf8mALkwiDopxz8wQH/uwDopx/YsDj//9j//9r//93+uwr/kgD/jgD//+D/qAD/kQD/0wD/owD/mgD/oRD/sBH/nhH/mxD//97//9z/50D/qA7/mAH/qwD//8X//7b/rRL/lQL/rgD/ngD//9P//8v//8j/+ID/6GL/sQD//9b//9D//87//7//63D/6jv/vhX/pBL/tgD/nAD//9///a/++Xz/40n/sxv/tgv/rAv/qAj/lAH/rQD/rAD//+L//Kn++Xr/62r/7V3/4Ub/qxT/pxT/mA//nQf/oAH/0AD/xQD/wgD/vgD/ugD//7r//rP//Z7/+Jj++YL/8oL/6Fr/4Fn/5lb/20f/5EH/xy3/3in/2Sj/wSf/zyD
36345/zhr/uBn/xRb+phL9pQv/kwj/owb/zQD/yQD/yAD/pQD//8//+6L//ZX/+ZL/+Yn/9n3/8Xv/73n/8mr/+Gf/1UT/4ED/zDr/1Dn/3TT/yjP/uSH/1Af/mQf/uAT/9Xr/+Hb/8WT/5FD/7E//7UP/4jr/0TX/5DD/3SH/0RX9sgr/nwh6YywzAAAAe3RSTlMAA0NHBtnZCUSbH/TtlBLZzlhFRSIXDvz49PPw2J6cmVRPTkRCJf7z8+Pa2cvHnI6LgVw3NxT8+vb09PTv7Orp5NfX1cvIxcK/u7apoZ6ZkoeCdnRrWk5DQj8sKxv+/Pr49/X08ODf29q8vLCtqaKemJhqZ2djW1BJPTHCvUMbAAAEOElEQVRYw63WZVRTYRjA8TudoogISigqit3d3d3d3d21zbvtsp4LNhhjmw7nAFk5EaQk7FYESbu7O87xZTt+8ByP97jn/j/cj7/zPnd77r3YfzezIkZJTfz8qXGWD/elwqlQr3Ynahz+SF9KHLn7QPDzyNGB4E7lYnuIPwVODW6BfZQvBY7imql5GCXOFe7oIArmuvbJ2qcm/D7fKHj0jDfGC+zwTPce2PrvhDu77594wdtAhzqZ1tjoWHvLzuDzWHX7Eq7KxtOADvfNea3mnGzZLrCTaOScejl3Ig34u5s/n+BoH6cOngVxptfgmp8nSaRn8i0TQU5rrvnKSSbn+BfLYG+AU6USV3/lNiPekLzbNAno5N01SCRJeTlDvSEOj1vwViOR7D2bPX8TxInimR5Gs6SsU9+zhgZCnDhhihI5yj1lC7aCHNt5o1TKYsS8KlnVFeLYEyOYTCYr4uux8I21alX8s5qoJk26eJE7/OILCciRah6+Cg9f2LPn4l69eveu5qoOqnnzkBYtQsaSvAoaV4rjZzxLYjBRt76Fo46VlGVlZefk5Obmms16BS9OjeN48Og5ZA5fHvfipIHBYDA1KeEu6FhJaWlpWVZ2dk6uWR+ZiRyi9rhAUschv3pHw3BB9/fsL2+Pu4sXLz55ctmUoXYUhbQPInFa83E8/95el8NkGvZptdGofaibe1E3Tz5PE6en9+lIcqNrteYTbNV7LWLcFPoHlCeJ53A4h1ERR1NFYnG/KXQSp1WUg51x+VEM6nTMwSNHDh4sv8ScPn03gclBRRwVHhCJWk6lkTk8OU6oCwsLbT+s1t1/lMz47QgGTiNxdrS6wcfZrtSZPK5CoXA6D6EiDzm5l5Ik8S5HcGDgDOzfbV+qiFITBIGj5FEIckZGRur1enRV5J8xxMdHJCLn+hDS19LU9aENUFXdhYaGtmtXH9VuiJNr00VLJG5n5SyMNNpf8x7Gy3x8nMU6nigUCK6vDsA8jD5hHv/qLSbL+EElEHRf5/mjslF/ueqMgWU8rxKJuo/v6rHjPYL/85yWZTyLnEUTgjx26B348qcnpMqzKrFoySTA91GjvvjLUwylDjkka0EyWFs87YFGqUtNF7fcRsMAgwW/PqdU6mTp4kHTMAwyGPE0QauTFYkHobWADMa23FHq7EXiYWgtIIM1E8Qak2WEeMRsDDSYj/pCQqyM6LYmAOQEtCUu3Y6VsbuNCQQ59PbNLO+QU7t9VwxUmI8gJTmN3aJjEMwJaKO+kJLGrjvZC+bQqze79DGV7bOZjsFq6GPZr2IP8KcBnaZtBJeFxIowqONV/XWekPCbiWHgwUxCYngXKIMGk9nwUWgtwINlFAevDcDA+deVB4+dA3ea+jl6VPfFKBjM0cO1FvDB3GsBH8xnCx3OoB0b0ImGUVBDv4aUOIHjwsCGG+ri6Xl+AUeB58N/SCCyAAAAAElFTkSuQmCC"; 36346 36347const iconRocket = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAAC/VBMVEUAAACMNCkQMlNRWlq8JQTmwAgeRmw1O0DyDwEmGSZjZWwsNTvOOwojMEn2ZAT4jgJgZ2eytrPSJAX86DwRTIZtLjAgMlH0qwkcLkT3pAPuFQ7qYALjigfVFA3cZwDcqge9JgKQsMqmp6kkLTH1mgfqBwTnfQPaEgzkdwPhVgSFjpoZJS3iEw+5sZ7zfwXnDwo2ODrpDQcfKTGTj47pnwzbEwjhWQbeVAKaQwjRfALwNgDtNDO6Fxn90w783RL4yA1ncnenVQ0NQnzKEhDODQx/nLsNO3NaW2N8lbDLGAr82xf0fQmlFRP0RxfPXwD6YiDMWAb40C8UKT2bqbWMLxCmpqbWyXV3XxdKY5CFhYqdoqGppaPyAwDsAwACAwRTBAjmBAByDAQaQGH/CQbc5N00fLMMDRHL0cc7g7x6gn/5rweCvOqQmZWGjYr8GxmNs9T/9WaTyvEwdKr8vwnKBgPaBwHk7OdFjMLCx7z/8Er4BQGUwuXe6ORZoNexxs23vbWTprE6RkgSGyH8fwX8RgWqCgXp8u1/q9K+zdHW3NCpsKuip6QnUHX/9nFbXmP/81hETE38cgi5CAXx9vOmucCHnaubop1me4r/+XtrcnD+2Bc9DxT/sRD9pQ3+Wgn9FwmBs91tos5PlczULC+cDAZwsOOesbr/+qNxjZ9PUVYeJjL+jhb+yQ/7NQh9Dwie1fbH1NdhmciJpr9Yjr1EcJr+940vWn9yeXhha3gfJUHLHB/+nA2HCgz5JwLN2tsoY5lxh5U4ZYq6cnhgHiViBAbvIAWy5/pGhLdbhal9kqT53DD/8Spqp9tzmblRepvBLTA5HDCUTSqELwuvv8Hs33U8UWQlMU7pS0z6yibZHx3Kr69UbIGCbXb//m+uWmHeWlz//UGSGhypGBjdNgrCRQWmLgXtTgTI8fz9+r7f2q5DbpLDjI/6fXp/UFxkZ0/BREhLNz3HnTO5v8TVenzRw2y7o2L9Yl/NxlDbvC7PxIdDWnWdiFjd11W/hRifjpHLrKySAAAAXHRSTlMACf7+Ewz+/v7+Kf0gP/7+/fws/fz2b7cT5d/ZVD44H/vz3NzQop6AdXNfVP786ci/tZ+Le2JiS0Ir/v37xaySSeDb06+upaOM+efFvri28O/fy7yalTrV1MKlgz08fYEAAAirSURBVFjD3dZ3UJJhHAdwEExR09KsHO0y27ts7733NMKZoDggjRyhZlkqjkRM0zBIQXGmucvcI1dm2d577931e17R6o6Ot/qv73mn552f+/2+z/O+SPj/QiQS/1XQmDF4wYK5kAWDNf5a6T5jweo+fRz3QYRCYe2Gjn/HrFu7keuV6sw4dubMmWMMhvu+zHnd/4LRGNO386twriPjjKenJ0DO7nGZszr+DfPK378pPJxf63nU0xMcZ0Z6Zpeuf874p6V5hcdz47lVlZiT6iw8/qcQcXDf3ZceFxc/DuBy+XwuvxY5qanC46f+DNLYNOy1aIpYHDZ0cjGfy40PD+/jnFpeXs74MwjGeS26WfJCkxJNE10oBsfL39+r/P79cmHFqT8oW2PtsOu39LNzeN6aPjYpky9EgJOWlma79+B9oUuXWRq4ndWXLtw8VJRDUkv0sdkaLWIWe/mftGpqsnq4tzzOpQvuezS4787rN7OLcqSayNlqUw/QSQ9XV9eDVjvdoaJ5eOvpnFY8hSfghcBaNlsBev6u2N/K9SDKbok13q6JYzqfDKjXzyF5JyIHEn39yeOTrnuB2Wu1M/tUlw4d8Tr+1+pfQD3IQSl59+SSR6tjG+DQ3GVWd3xOmn/8tXq1dgdVdMF2L8TVyvaAvQPJAk9FqpsPwCMRca2+Qe5ACpjM1x7AeOy37Rxh14m
36347kiWezGRGvvOK59s9FJe1OChMGQuPst90d4JDdKWRkdzznHtAUz+VXPc8TlbQ6VD/mkcmXXNE4O3cH2NsdIoXMV95Pxz73vfj8KknR0zyRaEoBjVYQZm5pOfmSB4wDDhSUzQsZOUOZQ16j71WemlFUFS8QPK0XXWSzd5jv2qV+fWebE+Fg10mqNkSZo7vk5pXyVIawVmAvEAh4jbf8wtjsvOdwg9octJi30oZ6LLlV4pgKL9T0ustFRRJJkeDKlSvfOqd5uHq0OgHYYsoG0ho45RbtsjPjTPpRN7fMy5IqPrw40IP6i9OJpDaaqKBbXV0yEYVsNnD2wjBxQxwjLt3Nbfv27ZmCdgcxcgct1k/RHRpnaDhi1BzI7IU72GF+1E/74o4CA3HLLEJOGuYA07nVgcW6KirFkMk8csRy165dW8x3sP0KKHXpxyu2W1uD43a0zr4JDWT1iyNVG91dgTObecQSBaBt7DAx9XylW4U1BCD44JEMawq3BQZzIpDTSapwMd0RF+UOGijML4Vi4WJtDV/IOep5TBjxZth++TitDslbU8GJaY26OLTdgcXEVEqHUy4uAGEO+kD9eO7hw5+dEE0FJ0YewLwI/bQ6sBg0lBgIkHwxcJxT3d+cezgMMW2OgoKIA5llAGFNq2+DxfxKKedPYAO1Oc7ujhlv3wyLQONkI0dtlYaCg5+cfLussBAodXV1dPTiaIrFKbkTd4zhDs6+2lrJ57f2Dm0OFK3g4PfsuZ0MKSwsLCuDgaDq3EDkVLilxwkZ7u7u3OKqysrKumfZdrAW7zcOeWlsbOy92D2Q5EmTbi/s7SeGzU67WFdUHAcHGEcHkeW1yrq6zNPez+x4PCk4ih6xgctDQ7W1AQPr3qTbve/eFUcndsjEmH1CRyjnSp6lKKcu89Hp04GaUlKIt6ZCp8fypCTfUAho2vfu3blz9+5ZSu6JyuPIcXR0zKh6mmeZl/MImBMnAjtoeit2YLEkiG+Sr68vooyWLZs5U59y/hFiwMngC/SnMPN4pzEmsEMHlURNksK3/fikmJj8/KT8JB0doIx6qqpqacxvbq7EmD4ZkpySW8yL0hOQQORYqKiMVvhu1Vp8GBKDsHwdneET4B+G+fM7NV+uxZgqgZR688kFfTBAAQacror/sx50WMZisRCGLBMiQWMkRaqWK0EMvyjnBZV2/clTCzDkzKohih3d/lEQmUyGYf0nguNDUfPx+ZSRwZcIpCXU0rx3185boCAmd7QGQXFMFy2aOm3a9OnTpk2bOnWqMYHQkULxtjjv43NZIuC9oFKpYqZITUVFBWNUGpaQCb9Jr3W9VFXhO1EVgn6YuN4b/ijRJrFZGg0ObShTHwSU3IaC2boEnCEbT60mWVjAVbHxQQ58rublIiS3oaSAPXQcXse426Iazvtm75AcOzUb+UAlgDRQaWL2NvNRZHzMxLErOcHBTk7vn+XY2ZGiqaWltDvJedHwQ4Efe8c2c3OcA/VcXO0EiQxy+uJgx4N5aAV3koanlBaIw4ABxxBfQ6rd6MFOQUGRkUEgPQOnNKW3+tI14jBgMGfLCFybEY0NWsDJyooE7NxZzCkcoWXWGzGYs2UAEQ803oDFcQrKSsiKBKeRBrmjvcKMYNa7zQFIKdLLWJXcny4LboUwJyVlRb6RGYHQtfc25OCExhr0NKazogCKTEjIyvqMnK9RJmaE7l31UT2Yg2e1icbjh8ewajjBTlkJCQkfz9JoZ1/WTFcldBypz5Y7KKOUQsSe4Mg4HI5TQsKDB43gfKjppkXsqn93qLncQTHUUvZcjB8UI4uKAigInLfIubGyJ6HXzNvJZeZyB2WEltKJTOnVwXowUGRkQlYjrbH6hp4xHEH/2OQy9R/OqB5Ky9Y1AahaL9gp8urVl7SZejf0xkIdqv1j9xSqyxVz8wHKr+MEo1C6LKo6ODj46tX3Z7/q1UR1I2NXXRsgJKH1BuK41oO0femsFg4HoHONL2/UGIztRcCg0D2w2xbUt/pAIp6nVaeFxdLj6OlFOb38cKOGZSr/PQZht9pwHDg4IANOCz2quoVOp7fURLEWtx3O9NB7k2AiOC6sZhyr6bBi6HSWDD7YYuj9TcGRQ75Y2+oDdPE5ZCMduq+ODl2Wr71s0Ph2BjrCIEOoGV+0hsv06DGHfY1MJmiNnUj4FZoEtwdvdA3odB06y2ACmCbtELqQvtpG42AcvBlvZDLI1NS0J3bHCT9BBsNNoB3cIQ6a8Jt379gJyMUfGP7f8x30kIhjrw84BgAAAABJRU5ErkJggg=="; 36348 36349const imgEstimation = ""+new URL('landing-estimation.png', import.meta.url).href+""; 36350 36351const imgBusiness = ""+new URL('landing-business.png', import.meta.url).href+""; 36352 36353const imgPatent = ""+new URL('landing-patent.png', import.meta.url).href+""; 36354 36355const imgDavidJ = ""+new URL('DavidJ.png', import.meta.url).href+""; 36356 36357const imgDinaL = ""+new URL('DinaL.png', import.meta.url).href+""; 36358 36359const imgMarcusB = ""+new URL('MarcusB.png', import.meta.url).href+""; 36360 36361const imgNinaZ = ""+new URL('NinaZ.png', import.meta.url).href+""; 36362 36363const imgRaviP = ""+new URL('RaviP.png', import.meta.url).href+""; 36364 36365const imgSofiaJ = ""+new URL('SofiaJ.png', import.meta.url).href+""; 36366 36367const imgSofiaR = ""+new URL('SofiaR.png', import.meta.url).href+""; 36368 36369const Landing = () => { 36370 const { user, logout } = useAuth(); 36371 const [showLoginModal, setShowLoginModal] = reactExports.useState(false); 36372 const handleAuthModal = () => { 36373 setShowLoginModal(!showLoginModal); 36374 }; 36375 const sectionStart = reactExports.useRef(null); 36376 const sectionEstimation = reactExports.useRef(null); 36377 const sectionBusiness = reactExports.useRef(null); 36378 const sectionPatent = reactExports.useRef(null); 36379 const sectionMarketing = reactExports.useRef(null); 36380 const sectionWhy = reactExports.useRef(null); 36381 const sectionFaq = reactExports.useRef(null); 36382 const scrollToSection = (ref) => { 36383 ref.current?.scrollIntoView({ behavior: "smooth" }); 36384 }; 36385 const accordionItems = [ 36386 { 36387 title: "Can I use just one tool, or do I need to go through all four?", 36388 content: "You can start with any tool individually. Each one works independently, but theyâre most powerful when used together as part of your startup journey." 36389 }, 36390 { 36391 title: "How long does it take to get results?", 36392 content: "Most results are generated in less than a minute. The process is fully automated and optimized for speed." 36393 }, 36394 { 36395 title: "What kind of input is required from me?", 36396 content: "You only need to provide a short written description of your idea or product. The more details you include, the more tailored your results will be." 36397 }, 36398 { 36399 title: "What happens after I receive my results?", 36400 content: "You can download them, share them, or move on to the next step â whether itâs refining your business plan, launching your marketing strategy, or drafting your patent." 36401 }, 36402 { 36403 title: "Is my idea protected? Do you sign an NDA?", 36404 content: "Yes. Each tool includes a built-in NDA agreement to protect your intellectual property. We guarantee that your ideas will never be shared, used, or disclosed â your innovation stays 100% yours." 36405 }, 36406 { 36407 title: "What kind of input is required from me?", 36408 content: "Our tools are designed to work with minimal input. You'll typically need to provide a brief description of your startup idea, industry, and basic business details. The more information you provide, the more tailored your results will be, but even basic information can generate valuable insights." 36409 }, 36410 { 36411 title: "What happens after I receive my results?", 36412 content: "All results are saved in your dashboard for you to review, download, or share with your team. You can make adjustments to your inputs and regenerate results as needed. Our tools also provide actionable next steps based on your specific findings." 36413 }, 36414 { 36415 title: "Is my idea protected? Do you sign an NDA?", 36416 content: "We take your intellectual property seriously. All data shared with CostQuest is encrypted and confidential. While we don't require a formal NDA, our terms of service explicitly prohibit us from sharing or using your idea for any purpose other than providing our services to you." 36417 } 36418 ]; 36419 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
36420 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pt-10 pb-20 px-4 flex flex-col gap-6 md:pt-[100px] md:pb-[300px] md:px-20 gradient-bg", children: [ 36421 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 xl:max-w-[1204px] xl:mx-auto", children: [ 36422 /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "self-center border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium", children: [ 36423 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconBrain, width: 16, alt: "Icon" }), 36424 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "AI-powered tools for early-stage founders" }) 36425 ] }), 36426 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xxl font-medium text-center bg-gradient-to-r from-white to-textSecondary2 bg-clip-text text-transparent md:text-mainTitleMD md:font-bold", children: "Turn Your Startup Idea into Reality Without Leaving Success to Chance" }),
36427 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base text-textSecondary2 text-center", children: "Get precise AI-generated cost estimations, business plans, marketing strategies, and patentsâin minutes, not months." }) 36428 ] }), 36429 /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn-lavender self-center", onClick: () => scrollToSection(sectionStart), children: [ 36430 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Start Your Journey" }), 36431 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-down-outline] text-2xl leading-none" }) 36432 ] }) 36433 ] }), 36434 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionStart, className: "relative py-10 px-4 flex flex-col gap-10 md:p-20 md:gap-20", children: [ 36435 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hidden md:block absolute top-10 right-10 w-[580px] h-[430px] blur-[12.5px]", children: [ 36436 /* @__PURE__ */ jsxRuntimeExports.jsx(Video, {}), 36437 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-denim/60" }) 36438 ] }),
36439 /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "relative text-2xl font-medium md:text-xl", children: [ 36440 "Validate faster. Plan smarter. ", 36441 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "md:block", children: "Launch louder. Protect everything." }) 36442 ] }), 36443 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col gap-4 md:flex-row md:flex-wrap xl:flex-nowrap", children: [ 36444 /* @__PURE__ */ jsxRuntimeExports.jsxs( 36445 "button", 36446 { 36447 className: "flex flex-col gap-4 p-6 rounded-[40px] border border-lavender/15 bg-deepTransparent cursor-pointer group card-bordered before:rounded-[40px] text-left md:flex-1 md:min-w-[calc(50%-8px)] md:p-10 xl:min-w-[calc(25%-8px)]", 36448 onClick: () => scrollToSection(sectionEstimation), 36449 children: [ 36450 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36451 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex gap-1 items-center flex-grow md:flex-row-reverse md:justify-between", children: [
36452 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-2xl text-lavender", children: "1." }), 36453 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-m font-medium", children: "CQ Estimation" }) 36454 ] }), 36455 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 inline-flex items-center justify-center w-10 h-10 rounded-full border border-current text-white group-hover:text-lavender transition-colors md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36456 ] }), 36457 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-textSecondary2", children: "Instant AI-powered cost estimation for your product. Describe your idea, and get a development cost estimate in minutes â clear, accurate, and ready to act on." }), 36458 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-end hidden md:inline-flex items-center justify-center w-14 h-14 rounded-full border border-current text-white group-hover:text-lavender transition-colors", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36459 ] 36460 } 36461 ),
36462 /* @__PURE__ */ jsxRuntimeExports.jsxs( 36463 "button", 36464 { 36465 className: "flex flex-col gap-4 p-6 rounded-[40px] border border-lavender/15 bg-deepTransparent cursor-pointer group card-bordered before:rounded-[40px] text-left md:flex-1 md:min-w-[calc(50%-8px)] md:p-10 xl:min-w-[calc(25%-8px)]", 36466 onClick: () => scrollToSection(sectionBusiness), 36467 children: [ 36468 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36469 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex gap-1 items-center flex-grow md:flex-row-reverse md:justify-between", children: [ 36470 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-2xl text-lavender", children: "2." }), 36471 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-m font-medium", children: "CQ Business" }) 36472 ] }), 36473 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 inline-flex items-center justify-center w-10 h-10 rounded-full border border-current text-white group-hover:text-lavender transition-colors md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36474 ] }),
36475 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-textSecondary2", children: "Turn your idea into an investor-ready blueprint. Define your audience, business model, key steps, and go-to-market logic â all structured by AI to impress and execute." }), 36476 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-end hidden md:inline-flex items-center justify-center w-14 h-14 rounded-full border border-current text-white group-hover:text-lavender transition-colors", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36477 ] 36478 } 36479 ), 36480 /* @__PURE__ */ jsxRuntimeExports.jsxs( 36481 "button", 36482 { 36483 className: "flex flex-col gap-4 p-6 rounded-[40px] border border-lavender/15 bg-deepTransparent cursor-pointer group card-bordered before:rounded-[40px] text-left md:flex-1 md:min-w-[calc(50%-8px)] md:p-10 xl:min-w-[calc(25%-8px)]", 36484 onClick: () => scrollToSection(sectionPatent), 36485 children: [
36486 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36487 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex gap-1 items-center flex-grow md:flex-row-reverse md:justify-between", children: [ 36488 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-2xl text-lavender", children: "3." }), 36489 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-m font-medium", children: "CQ Patent" }) 36490 ] }), 36491 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 inline-flex items-center justify-center w-10 h-10 rounded-full border border-current text-white group-hover:text-lavender transition-colors md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36492 ] }), 36493 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-textSecondary2", children: "Protect your innovation before it hits the market. Let AI draft your patent documentation in minutes â cutting costs by 40% while boosting accuracy and approval rates." }),
36494 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-end hidden md:inline-flex items-center justify-center w-14 h-14 rounded-full border border-current text-white group-hover:text-lavender transition-colors", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36495 ] 36496 } 36497 ), 36498 /* @__PURE__ */ jsxRuntimeExports.jsxs( 36499 "button", 36500 { 36501 className: "flex flex-col gap-4 p-6 rounded-[40px] border border-lavender/15 bg-deepTransparent cursor-pointer group card-bordered before:rounded-[40px] text-left md:flex-1 md:min-w-[calc(50%-8px)] md:p-10 xl:min-w-[calc(25%-8px)]", 36502 onClick: () => scrollToSection(sectionMarketing), 36503 children: [ 36504 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36505 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex gap-1 items-center flex-grow md:flex-row-reverse md:justify-between", children: [
36506 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-2xl text-lavender", children: "4." }), 36507 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-m font-medium", children: "CQ Marketing" }) 36508 ] }), 36509 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 inline-flex items-center justify-center w-10 h-10 rounded-full border border-current text-white group-hover:text-lavender transition-colors md:hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36510 ] }), 36511 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-textSecondary2", children: "Launch with a strategy, not hope. Generate a tailored marketing plan with the right channels, messaging, and positioning to grow your startup from day one." }), 36512 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-end hidden md:inline-flex items-center justify-center w-14 h-14 rounded-full border border-current text-white group-hover:text-lavender transition-colors", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-up-outline] text-2xl leading-none" }) }) 36513 ] 36514 } 36515 ) 36516 ] }) 36517 ] }), 36518 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative my-10 px-4 flex flex-col md:my-20 md:px-20", children: [
36519 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-10 top-0 left-0 w-full h-px bg-muted" }), 36520 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden xl:block absolute z-10 bottom-0 left-0 w-full h-px bg-muted" }), 36521 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionEstimation, className: "relative flex", children: [ 36522 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 bottom-0 left-0 w-full h-px", children: [ 36523 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }), 36524 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36525 ] }), 36526 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 top-0 left-0 w-full h-px", children: [ 36527 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }),
36528 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36529 ] }), 36530 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 py-10 px-4 border border-muted w-full md:p-[100px] xl:shrink-0 xl:w-2/4 bg-ellipse-t-l", children: [ 36531 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "self-start border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "Stop guessing. Start knowing." }) }), 36532 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [ 36533 /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-l font-medium md:text-xl", children: "CQ Estimation â Know Before You Build" }),
36534 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "Quickly find out how much it would take to build your product â just describe your idea and get an AI-powered estimate in minutes." }) 36535 ] }), 36536 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 36537 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36538 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36539 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Fast and accurate estimates" }) 36540 ] }), 36541 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36542 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36543 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "No technical input required" }) 36544 ] }),
36545 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36546 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36547 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Helps plan ahead with clarity" }) 36548 ] }) 36549 ] }), 36550 /* @__PURE__ */ jsxRuntimeExports.jsx(NavLink, { to: "/estimation", className: "btn-lavender self-start", children: "Go to Estimation" }) 36551 ] }), 36552 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative hidden xl:flex xl:shrink-0 xl:w-2/4 border-r border-muted xl:justify-center xl:items-center", children: [ 36553 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 top-0 left-0 w-px h-full", children: [ 36554 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-0 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }),
36555 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-0 left-0 -translate-x-2 translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36556 ] }), 36557 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgEstimation, width: 500, alt: "Illustration" }) 36558 ] }) 36559 ] }), 36560 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionBusiness, className: "relative flex xl:flex-row-reverse", children: [ 36561 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 bottom-0 left-0 w-full h-px", children: [ 36562 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }), 36563 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36564 ] }), 36565 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 top-0 left-0 w-full h-px", children: [
36566 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }), 36567 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36568 ] }), 36569 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 py-10 px-4 border border-muted w-full md:p-[100px] xl:shrink-0 xl:w-2/4", children: [ 36570 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "self-start border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "Turn your vision to clear next steps." }) }), 36571 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
36572 /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-l font-medium md:text-xl", children: "CQ Business â From Idea to Clarity" }), 36573 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "Transform your product vision into actionable clarity. Our AI pinpoints your audience, captures their needs, and crafts ready-to-use documentation. Accelerate developer alignment and get estimates faster than ever." }) 36574 ] }), 36575 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 36576 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36577 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36578 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "High-Level Product Blueprint" }) 36579 ] }), 36580 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [
36581 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36582 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Clear Customer Segments & Needs" }) 36583 ] }), 36584 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36585 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36586 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "MVP Focus & Clarity" }) 36587 ] }), 36588 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36589 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36590 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Documentation Ready for Technical Partners" }) 36591 ] }) 36592 ] }),
36593 /* @__PURE__ */ jsxRuntimeExports.jsx(NavLink, { to: "/business", className: "btn-lavender self-start", children: "Go to document builder" }) 36594 ] }), 36595 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative hidden xl:flex xl:shrink-0 xl:w-2/4 border-l border-muted xl:justify-center xl:items-center", children: [ 36596 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-10 top-0 right-0 w-px h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-0 right-0 translate-x-2 translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) }), 36597 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgBusiness, width: 500, alt: "Illustration" }) 36598 ] }) 36599 ] }), 36600 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionPatent, className: "relative flex", children: [ 36601 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 bottom-0 left-0 w-full h-px", children: [ 36602 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }),
36603 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36604 ] }), 36605 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 top-0 left-0 w-full h-px", children: [ 36606 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }), 36607 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36608 ] }), 36609 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 py-10 px-4 border border-muted w-full md:p-[100px] xl:shrink-0 xl:w-2/4 bg-ellipse-t-r", children: [ 36610 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "self-start border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "Innovation without protection is just a hobby." }) }),
36611 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [ 36612 /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-l font-medium md:text-xl", children: "CQ Patent â Prepare to Protect Your Innovation" }), 36613 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "Create professional, AI-assisted patent documentation tailored to your invention â including clear technical descriptions and visual outlines." }) 36614 ] }), 36615 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 36616 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36617 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36618 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Structured and detailed documentation" }) 36619 ] }),
36620 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36621 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36622 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Faster than writing it from scratch" }) 36623 ] }), 36624 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36625 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36626 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Built for inventors" }) 36627 ] }) 36628 ] }), 36629 /* @__PURE__ */ jsxRuntimeExports.jsx(NavLink, { to: "/patent", className: "btn-lavender self-start", children: "Go to Patent Assistant" }) 36630 ] }), 36631 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative hidden xl:flex xl:shrink-0 xl:w-2/4 border-r border-muted xl:justify-center xl:items-center", children: [
36632 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 top-0 left-0 w-px h-full", children: [ 36633 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-0 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }), 36634 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-0 left-0 -translate-x-2 translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36635 ] }), 36636 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgPatent, width: 500, alt: "Illustration" }) 36637 ] }) 36638 ] }), 36639 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionMarketing, className: "relative flex xl:flex-row-reverse", children: [ 36640 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 bottom-0 left-0 w-full h-px", children: [ 36641 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }),
36642 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36643 ] }), 36644 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute z-10 top-0 left-0 w-full h-px", children: [ 36645 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-0 -translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }), 36646 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 right-0 translate-x-2 -translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) 36647 ] }), 36648 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 py-10 px-4 border border-muted w-full md:p-[100px] xl:shrink-0 xl:w-2/4", children: [ 36649 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "self-start border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "No marketing team? No problem." }) }),
36650 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [ 36651 /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-l font-medium md:text-xl", children: "CQ Marketing â Launch Like a Pro" }), 36652 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "Get your startup noticed without burning through your budget. Our AI creates targeted marketing strategies based on whatâs working in your industry, not just generic advice." }) 36653 ] }), 36654 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 36655 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36656 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36657 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Market Research & Competitive Analysis" }) 36658 ] }),
36659 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36660 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36661 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Top Marketing Channels & Strategies" }) 36662 ] }), 36663 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36664 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }), 36665 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Tailored, Audience-Focused Messaging" }) 36666 ] }), 36667 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [ 36668 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-base leading-none text-iconsDark shrink-0" }),
36669 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Strategic Budget Recommendations" }) 36670 ] }) 36671 ] }), 36672 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { disabled: true, className: "btn-outlined self-start", children: "Coming soon" }) 36673 ] }), 36674 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative hidden xl:flex xl:shrink-0 xl:w-2/4 border-l border-muted", children: [ 36675 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-10 top-0 right-0 w-px h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute bottom-0 right-0 translate-x-2 translate-y-1/2 w-4 h-4 rounded-full border border-muted bg-denim" }) }), 36676 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative blur-[12.5px]", children: [ 36677 /* @__PURE__ */ jsxRuntimeExports.jsx(Video, {}), 36678 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-denim/60" }) 36679 ] }) 36680 ] }) 36681 ] }) 36682 ] }), 36683 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionWhy, className: "py-10 px-4 flex flex-col gap-10 md:p-20 xl:flex-row xl:gap-1 xl:justify-between", children: [
36684 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 xl:max-w-[500px] xl:justify-between", children: [ 36685 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [ 36686 /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-center text-l font-medium md:text-xl xl:text-left", children: "Why We Built This?" }), 36687 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-center text-textSecondary2 xl:text-left", children: [ 36688 "We believe every founder deserves clarity, speed, and support â from day one. ", 36689 /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}), 36690 /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}), 36691 "Having experienced firsthand the frustrations of vague estimates, wasted resources, and costly mistakes in our own startups, weâre committed to helping new founders avoid these pitfalls. Our mission is simple: empower early-stage startups with the precise tools and clear guidance we wished weâd had, so they can succeed faster and smarter." 36692 ] }) 36693 ] }),
36694 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "self-center border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium xl:self-start", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "Helping you avoid the hard way" }) }) 36695 ] }), 36696 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap md:max-w-[700px] md:mx-auto xl:mx-0", children: [ 36697 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-[50%] p-6 space-y-4", children: [ 36698 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start gap-4 md:flex-row md:items-center", children: [ 36699 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 shrink-0 inline-flex items-center justify-center rounded-2xl bg-muted", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconBrain, width: 24, alt: "Icon" }) }),
36700 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-m font-medium", children: "Clarity from the Start" }) 36701 ] }), 36702 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "No vague advice. Just clear, actionable insights tailored to your idea." }) 36703 ] }), 36704 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-[50%] p-6 space-y-4 border-l border-muted", children: [ 36705 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start gap-4 md:flex-row md:items-center", children: [ 36706 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 shrink-0 inline-flex items-center justify-center rounded-2xl bg-muted", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconGear, width: 24, alt: "Icon" }) }), 36707 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-m font-medium", children: "Built for Speed" }) 36708 ] }), 36709 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "Minutes, not weeks â everything is automated and instant, so you can focus on building." }) 36710 ] }),
36711 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-[50%] p-6 space-y-4 border-t border-muted", children: [ 36712 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start gap-4 md:flex-row md:items-center", children: [ 36713 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 shrink-0 inline-flex items-center justify-center rounded-2xl bg-muted", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconLightning, width: 24, alt: "Icon" }) }), 36714 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-m font-medium", children: "Support at Every Step" }) 36715 ] }), 36716 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "From idea to launch. Every feature is built to solve real problems we faced as founders." }) 36717 ] }), 36718 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex-1 min-w-[50%] p-6 space-y-4 border-l border-t border-muted", children: [
36719 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start gap-4 md:flex-row md:items-center", children: [ 36720 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 shrink-0 inline-flex items-center justify-center rounded-2xl bg-muted", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconRocket, width: 24, alt: "Icon" }) }), 36721 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-m font-medium", children: "Made by Founders" }) 36722 ] }), 36723 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "We know how it feels to start from scratch. This is the platform we wish we had." }), 36724 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-0 left-0 -translate-x-2 -translate-y-6 w-4 h-4 rounded-full border border-muted bg-denim" }) 36725 ] }) 36726 ] }) 36727 ] }), 36728 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-10 px-4 flex flex-col gap-10 md:p-20 md:gap-20", children: [
36729 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 max-w-[600px] mx-auto", children: [ 36730 /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-center text-l font-medium md:text-xl", children: "What Founders Are Saying" }), 36731 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-textSecondary2", children: "Whether theyâre validating an idea or preparing for investors â our tools help founders move smarter and faster." }) 36732 ] }), 36733 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "-mx-4 overflow-x-auto md:-mx-20 flex gap-2 md:gap-10 md:flex-wrap md:justify-center", children: [ 36734 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 pl-4 md:gap-10 md:pl-0 md:justify-center", children: [ 36735 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36736 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [
36737 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgDavidJ, alt: "David J.", className: "w-full h-full object-cover" }) }), 36738 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [ 36739 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "David. J" }), 36740 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Co-founder at PetMatch" }) 36741 ] }) 36742 ] }), 36743 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "I was skeptical about AI tools, but CostQuest helped us create a business plan that got us funded in our first pitch meeting. The data-backed projections made all the difference." }), 36744 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [
36745 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36746 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36747 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36748 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36749 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36750 ] }) 36751 ] }), 36752 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36753 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36754 /* @__P
36754URE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgDinaL, alt: "Dina L.", className: "w-full h-full object-cover" }) }), 36755 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [ 36756 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "Dina L." }), 36757 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Founder, HealthTrack App" }) 36758 ] }) 36759 ] }), 36760 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "As a non-technical founder, I was flying blind on development costs. CQ Estimation gave me the confidence to negotiate with developers and avoid getting overcharged." }), 36761 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [
36762 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36763 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36764 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36765 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36766 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36767 ] }) 36768 ] }), 36769 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36770 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36771 /* @__P
36771URE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgSofiaR, alt: "Sofia R.", className: "w-full h-full object-cover" }) }), 36772 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [ 36773 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "Sofia R." }), 36774 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Founder" }) 36775 ] }) 36776 ] }), 36777 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "I went from âI think this could workâ to a PDF I could show to advisors â in the same day. Nice!" }), 36778 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [ 36779 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }),
36780 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36781 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36782 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36783 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36784 ] }) 36785 ] }), 36786 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36787 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36788 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgMarcusB, alt: "Marcus B.", className: "w-full h-full object-cover" }) }),
36789 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [ 36790 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "Marcus B." }), 36791 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Product Manager, Side Project Enthusiast" }) 36792 ] }) 36793 ] }), 36794 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "The patent tool flagged a potential IP conflict we had no idea about. Saved us months of work and possibly a lawsuit." }), 36795 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [ 36796 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36797 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }),
36798 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36799 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36800 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36801 ] }) 36802 ] }) 36803 ] }), 36804 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 md:gap-10 md:pl-0 md:justify-center", children: [ 36805 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36806 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36807 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgRaviP, alt: "Ravi P.", className: "w-full h-full object-cover" }) }),
36808 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [ 36809 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "Ravi P." }), 36810 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Early-stage SaaS founder" }) 36811 ] }) 36812 ] }), 36813 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "CQ Business helped me organize my whole pitch logic. I sent the AI-generated doc to my mentor â he thought I worked on it for days." }), 36814 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [ 36815 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36816 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }),
36817 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36818 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36819 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36820 ] }) 36821 ] }), 36822 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36823 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36824 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgNinaZ, alt: "Nina Z.", className: "w-full h-full object-cover" }) }), 36825 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [
36826 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "Nina Z." }), 36827 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Founder, FitPets" }) 36828 ] }) 36829 ] }), 36830 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "Our marketing budget was tight, and CQ Marketing helped us focus on channels that actually delivered results. We doubled our user acquisition while spending 30% less" }), 36831 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [ 36832 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36833 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36834 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }),
36835 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36836 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36837 ] }) 36838 ] }), 36839 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex flex-col gap-4 p-6 rounded-3xl bg-deepTransparent max-w-[300px] md:max-w-[420px]", children: [ 36840 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [ 36841 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 w-12 h-12 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: imgSofiaJ, alt: "Sophia J.", className: "w-full h-full object-cover" }) }), 36842 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-[2px]", children: [ 36843 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-base font-medium", children: "Sophia J." }),
36844 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs text-textSecondary2", children: "Inventor" }) 36845 ] }) 36846 ] }), 36847 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: "I was ready to spend $5K on a patent attorney just for initial advice. CQ Patent gave me the same preliminary guidance for a fraction of the cost." }), 36848 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-auto", children: [ 36849 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36850 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36851 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }), 36852 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }),
36853 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--star-bold] text-[18px] leading-none text-yellow" }) 36854 ] }) 36855 ] }) 36856 ] }) 36857 ] }) 36858 ] }), 36859 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: sectionFaq, className: "py-10 px-4 flex flex-col gap-10 md:p-20 bg-ellipses-light", children: [ 36860 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 max-w-[700px] mx-auto", children: [ 36861 /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-center text-l font-medium md:text-xl", children: "FAQ" }), 36862 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-textSecondary2", children: "Clear answers to help you understand how our tools work, what to expect, and how to get the most value from them." }) 36863 ] }), 36864 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full max-w-[700px] mx-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { items: accordionItems, className: "space-y-4", variant: "primary", collapsible: true }) }) 36865 ] }), 36866 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-10 px-4 flex flex-col gap-10 md:p-10", children: [
36867 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 md:flex-row", children: [ 36868 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 items-start md:flex-1 lg:max-w-[500px]", children: [ 36869 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 items-start", children: [ 36870 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai/", target: "_self", rel: "noreferrer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, width: "83", alt: "Costquest" }) }), 36871 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-textSecondary2", children: "Built to help founders move fast, think smart, and launch with confidence â one AI-powered step at a time." }) 36872 ] }), 36873 !user?.isAuth && (!showLoginModal ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: cn("w-auto", "btn-outlined"), onClick: handleAuthModal, children: "Sign In" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AuthorizationModal, { onCloseDialog: handleAuthModal })) 36874 ] }),
36875 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-10 items-start md:flex-1 md:flex-row lg:flex-none lg:shrink-0 lg:ml-auto", children: [ 36876 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 items-start md:flex-1 lg:min-w-[200px]", children: [ 36877 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base text-textSecondary2", children: "Get to Know Us:" }), 36878 /* @__PURE__ */ jsxRuntimeExports.jsx( 36879 "button", 36880 { 36881 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36882 onClick: () => scrollToSection(sectionStart), 36883 children: "Explore Our Tools" 36884 } 36885 ), 36886 /* @__PURE__ */ jsxRuntimeExports.jsx( 36887 "button", 36888 { 36889 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36890 onClick: () => scrollToSection(sectionWhy), 36891 children: "Why Choose Us?" 36892 } 36893 ),
36894 /* @__PURE__ */ jsxRuntimeExports.jsx( 36895 "button", 36896 { 36897 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36898 onClick: () => scrollToSection(sectionFaq), 36899 children: "FAQ" 36900 } 36901 ) 36902 ] }), 36903 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 items-start md:flex-1 lg:min-w-[200px]", children: [ 36904 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base text-textSecondary2", children: "Products:" }), 36905 /* @__PURE__ */ jsxRuntimeExports.jsx( 36906 NavLink, 36907 { 36908 to: "/estimation", 36909 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36910 children: "CQ Estimation" 36911 } 36912 ), 36913 /* @__PURE__ */ jsxRuntimeExports.jsx( 36914 NavLink, 36915 { 36916 to: "/business", 36917 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36918 children: "CQ Business" 36919 } 36920 ),
36921 /* @__PURE__ */ jsxRuntimeExports.jsx( 36922 NavLink, 36923 { 36924 to: "/patent", 36925 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36926 children: "CQ Patent" 36927 } 36928 ), 36929 /* @__PURE__ */ jsxRuntimeExports.jsx( 36930 "button", 36931 { 36932 disabled: true, 36933 className: "text-xs font-semibold hover:text-lavender active:text-lavender disabled:text-greyGentle", 36934 children: "CQ Marketing" 36935 } 36936 ) 36937 ] }) 36938 ] }) 36939 ] }), 36940 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-px bg-lavender/15" }), 36941 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-center text-xxs text-textSecondary2 uppercase", children: [ 36942 "© ", 36943 (/* @__PURE__ */ new Date()).getFullYear(), 36944 " CQ Platform. All rights reserved." 36945 ] }) 36946 ] }) 36947 ] }); 36948}; 36949 36950const EMAIL_REGEX = new RegExp( 36951 "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" 36952); 36953const Waitlist = () => { 36954 const navigate = useNavigate(); 36955 const [email, setEmail] = reactExports.useState(""); 36956 const [status, setStatus] = reactExports.useState("idle"); 36957 const [error, setError] = reactExports.useState(null); 36958 const handleSubmit = async (e) => { 36959 e.preventDefault(); 36960 const value = email.trim(); 36961 if (!EMAIL_REGEX.test(value)) { 36962 setError("Please enter a valid email address."); 36963 return; 36964 } 36965 setError(null); 36966 setStatus("loading"); 36967 try { 36968 await axios.post(API_URLS.WAITLIST, { email: value }); 36969 setStatus("success"); 36970 } catch { 36971 setStatus("idle"); 36972 setError("Something went wrong. Please try again."); 36973 } 36974 }; 36975 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col grow", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grow flex flex-col items-center justify-center gap-6 py-16 px-4 md:py-24 md:px-20 gradient-bg", children: [ 36976 /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "border-gradient before:rounded-button inline-flex gap-1 items-center py-2 px-4 text-xxxs font-semibold md:text-xs md:font-medium", children: [
36977 /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconBrain, width: 16, alt: "Icon" }), 36978 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-gradient-to-r from-redLight to-sapphireLight bg-clip-text text-transparent", children: "CostQuest V2 · Early Access" }) 36979 ] }), 36980 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "max-w-[820px] text-xxl font-medium text-center bg-gradient-to-r from-white to-textSecondary2 bg-clip-text text-transparent md:text-xl xl:text-mainTitleMD md:font-bold", children: "Join the Early Access waitlist" }), 36981 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-[640px] text-base text-textSecondary2 text-center", children: "The next generation of CostQuest is coming. Transform any idea into a complete product package with AI-generated estimates, implementation documentation, developer-ready tasks, and interactive clickable prototypes. Be the first to get in." }), 36982 status === "success" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full max-w-[480px] flex flex-col items-center gap-4 p-8 rounded-3xl border border-lavender/15 bg-deepTransparent text-center", children: [
36983 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--check-circle-bold] text-5xl leading-none text-lavender" }), 36984 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-l font-medium", children: "You're on the list!" }), 36985 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-textSecondary2", children: "Thanks for joining. We'll email you as soon as CostQuest V2 Early Access opens up." }), 36986 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-lavender", onClick: () => navigate("/"), children: "Back to home" }) 36987 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, className: "w-full max-w-[480px] flex flex-col gap-3", children: [ 36988 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 sm:flex-row", children: [ 36989 /* @__PURE__ */ jsxRuntimeExports.jsx( 36990 "input", 36991 { 36992 type: "email", 36993 name: "email", 36994 autoComplete: "email", 36995 placeholder: "Enter your email", 36996 value: email, 36997 onChange: (e) => { 36998 setEmail(e.target.value); 36999 setError(null); 37000 }, 37001 "aria-invalid": !!error, 37002 className: cn( 37003 "flex-1 min-w-0 rounded-button bg-deepTransparent border py-3 px-5 text-grey placeholder:text-greyGentle transition-colors focus:outline-none", 37004 error ? "border-redLight" : "border-lavender/15 focus:border-lavender/40" 37005 ) 37006 } 37007 ),
37008 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "submit", className: "btn-lavender shrink-0", disabled: status === "loading", children: status === "loading" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[svg-spinners--90-ring-with-bg] text-xl leading-none" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 37009 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Join the waitlist" }), 37010 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon-[solar--arrow-right-outline] text-2xl leading-none" }) 37011 ] }) }) 37012 ] }), 37013 error && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-redLight", children: error }), 37014 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xxs text-greyGentle text-center", children: "No spam. We'll only reach out about CostQuest V2 Early Access." }) 37015 ] }) 37016 ] }) }); 37017}; 37018 37019const inboxGroup = ""+new URL('inbox-group.png', import.meta.url).href+""; 37020 37021const modalContainer = "_modalContainer_1bl2q_8"; 37022const modalBackdrop = "_modalBackdrop_1bl2q_20"; 37023const modalBody = "_modalBody_1bl2q_36"; 37024const styles = { 37025 modalContainer: modalContainer, 37026 modalBackdrop: modalBackdrop, 37027 modalBody: modalBody}; 37028 37029const GetResultModal = ({ onBack, url, onGetOffer }) => { 37030 const [step, setStep] = reactExports.useState(1); 37031 const [isLoading, setIsLoading] = reactExports.useState(false); 37032 const formRef = reactExports.useRef(null); 37033 const [authData, setAuthData] = reactExports.useState({ 37034 first_name: "", 37035 last_name: "", 37036 email: "", 37037 company_name: "" 37038 }); 37039 const handleInputChange = (e) => { 37040 const { name, value } = e.target; 37041 setAuthData((prev) => ({ ...prev, [name]: value })); 37042 }; 37043 const handleSubmit = async (e) => { 37044 e.preventDefault(); 37045 setIsLoading(true); 37046 try { 37047 const sessionId = localStorage.getItem(SESSION_ID_NAME); 37048 await axios.post(url, { 37049 session_id: sessionId, 37050 ...authData 37051 }); 37052 setStep(2); 37053 } catch (e2) { 37054 console.log(e2); 37055 } finally { 37056 setIsLoading(false); 37057 } 37058 }; 37059 const onBackdropClick = (e) => { 37060 e.stopPropagation(); 37061 }; 37062 const emailRegex = new RegExp(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/); 37063 const isSubmitDisabled = !authData.first_name || !authData.last_name || !emailRegex.test(authData.email); 37064 return reactDomExports.createPortal( 37065 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.modalContainer, children: [
37066 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.modalBackdrop, onClick: onBackdropClick }), 37067 step === 1 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { className: styles.modalBody, ref: formRef, onChange: handleInputChange, onSubmit: handleSubmit, children: [ 37068 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center !mt-0", children: [ 37069 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-medium text-grey", children: "Get Your Full Result" }), 37070 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "inline-block mr-2 text-greyGentle mt-2 leading-6", children: "Just one step left â enter your email to access the full result. Weâll store your data securely for 90 days for document access purposes only." }) 37071 ] }), 37072 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [ 37073 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-3", children: [
37074 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [ 37075 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-semibold text-white", children: "First name" }), 37076 /* @__PURE__ */ jsxRuntimeExports.jsx( 37077 "input", 37078 { 37079 type: "text", 37080 id: "first_name", 37081 name: "first_name", 37082 placeholder: "Enter your first name", 37083 className: cn( 37084 "w-full p-3 bg-deep placeholder:text-greyGentle placeholder:font-normal rounded-[40px] border border-deep focus:border-lavender text-xs font-semibold focus:outline-none" 37085 ) 37086 } 37087 ) 37088 ] }), 37089 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [ 37090 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-semibold text-white", children: "Last name" }),
37091 /* @__PURE__ */ jsxRuntimeExports.jsx( 37092 "input", 37093 { 37094 type: "text", 37095 id: "last_name", 37096 name: "last_name", 37097 placeholder: "Enter your last name", 37098 className: cn( 37099 "w-full p-3 bg-deep placeholder:text-greyGentle placeholder:font-normal rounded-[40px] border border-deep focus:border-lavender text-xs font-semibold focus:outline-none" 37100 ) 37101 } 37102 ) 37103 ] }) 37104 ] }), 37105 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [ 37106 /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-semibold text-white", children: [ 37107 "Company name ", 37108 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-normal text-greyGentle", children: "(optional)" }) 37109 ] }), 37110 /* @__PURE__ */ jsxRuntimeExports.jsx( 37111 "input", 37112 { 37113 type: "text", 37114 id: "company_name", 37115 name: "company_name", 37116 placeholder: "Enter your company name", 37117 className: cn( 37118 "w-full p-3 bg-deep placeholder:text-greyGentle placeholder:font-normal rounded-[40px] border border-deep focus:border-lavender text-xs font-semibold focus:outline-none" 37119 ) 37120 } 37121 ) 37122 ] }),
37123 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [ 37124 /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-semibold text-white", children: "Email" }), 37125 /* @__PURE__ */ jsxRuntimeExports.jsx( 37126 "input", 37127 { 37128 type: "email", 37129 id: "email", 37130 name: "email", 37131 placeholder: "Enter your email", 37132 className: cn( 37133 "w-full p-3 bg-deep placeholder:text-greyGentle placeholder:font-normal rounded-[40px] border border-deep focus:border-lavender text-xs font-semibold focus:outline-none" 37134 ) 37135 } 37136 ) 37137 ] }), 37138 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "submit", className: "btn-lavender w-full min-h-[33px]", disabled: isLoading || isSubmitDisabled, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-white font-semibold", children: "Send My Result" }) }),
37139 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "text-xs font-semibold text-white hover:text-lavender", type: "button", onClick: onBack, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Cancel" }) }) }), 37140 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center space-x-1", children: [ 37141 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle", children: "By continuing, you agree to our" }), 37142 /* @__PURE__ */ jsxRuntimeExports.jsx( 37143 NavLink, 37144 { 37145 to: "/terms-of-use", 37146 target: "_blank", 37147 className: "text-xs font-semibold text-white hover:text-lavender", 37148 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Terms of Use" }) 37149 } 37150 ), 37151 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle", children: "and" }),
37152 /* @__PURE__ */ jsxRuntimeExports.jsx( 37153 NavLink, 37154 { 37155 to: "/privacy-policy", 37156 target: "_blank", 37157 className: "text-xs font-semibold text-white hover:text-lavender", 37158 children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Privacy Policy." }) 37159 } 37160 ) 37161 ] }) 37162 ] }) 37163 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.modalBody, children: [ 37164 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: inboxGroup, width: "123", alt: "Costquest" }) }), 37165 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center !mt-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-medium text-grey", children: "Check your inbox" }) }), 37166 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "btn-lavender w-full min-h-[33px]", onClick: () => onGetOffer(authData.email), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-white font-semibold", children: "Go for a new estimate" }) }) 37167 ] }) 37168 ] }), 37169 document.body 37170 ); 37171}; 37172 37173const FinalPage = ({ url }) => { 37174 const navigate = useNavigate(); 37175 const { appState } = useAppData(); 37176 const { user } = useAuth(); 37177 const [email, setEmail] = reactExports.useState(user?.isAuth ? user.email : ""); 37178 const shortVersionHtml = appState.shortVersionHtml; 37179 const [showModal, setShowModal] = reactExports.useState(false); 37180 const autoModalShownRef = reactExports.useRef(false); 37181 reactExports.useEffect(() => { 37182 if (!shortVersionHtml || user?.isAuth || autoModalShownRef.current) return; 37183 const timer = setTimeout(() => { 37184 autoModalShownRef.current = true; 37185 setShowModal(true); 37186 }, 1e4); 37187 return () => clearTimeout(timer); 37188 }, [shortVersionHtml, user?.isAuth]); 37189 reactExports.useEffect(() => { 37190 if (user?.isAuth) return; 37191 const handleIframeMessage = (event) => { 37192 if (event.data?.type === "open-result-modal") { 37193 setShowModal(true); 37194 } 37195 }; 37196 window.addEventListener("message", handleIframeMessage); 37197 return () => window.removeEventListener("message", handleIframeMessage); 37198 }, [user?.isAuth]); 37199 const handleShowModal = () => { 37200 setShowModal(true); 37201 }; 37202 const handleCloseModal = () => { 37203 setShowModal(false); 37204 }; 37205 const handleRedirect = () => { 37206 navigate("/workspace"); 37207 }; 37208 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative grow rounded-2xl px-4 py-6 md:p-0 md:overflow-hidden md:mt-10", children: [ 37209 /* @__PURE__ */ jsxRuntimeExports.jsx(DesktopBG, {}), 37210 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative max-w-[900px] mx-auto flex flex-col gap-10", children: [
37211 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [ 37212 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-center mb-2 text-l md:text-xl", children: "ð Your Result Is Ready!" }), 37213 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-s dark:text-greyGentle", children: "Success! Based on the info you shared, weâve generated a tailored draft." }) 37214 ] }), 37215 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 rounded-2xl bg-nightfall text-grey overflow-auto flex gap-4 flex-col md:flex-row", children: [ 37216 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 text-[16px] w-full", children: [ 37217 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "", children: "Want to get the full result?" }), 37218 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "dark:text-greyGentle", children: "Access your full result and manage all your projects in one place." }) 37219 ] }), 37220 !user?.isAuth ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main w-fit whitespace-nowrap", onClick: handleShowModal, children: "Get Full Result" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col md:flex-row gap-4 items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "btn-main-outlined w-full whitespace-nowrap", onClick: handleRedirect, children: "Go to My Workspace" }) }) 37221 ] }),
37222 shortVersionHtml ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative rounded-2xl bg-white overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 37223 "iframe", 37224 { 37225 title: "Estimate preview", 37226 className: "block w-full", 37227 style: { height: "600px", border: "none" }, 37228 srcDoc: shortVersionHtml, 37229 sandbox: "allow-same-origin allow-scripts" 37230 } 37231 ) }) : ( 37232 /* Fallback: original brief_project_description block (commented out) */ 37233 // <div className="flex flex-col gap-3 relative p-6 rounded-2xl bg-nightfall text-grey overflow-auto flex gap-4 flex-row"> 37234 // <p className="text-[20px]">{estimationData?.name}</p> 37235 // <div className="relative"> 37236 // <p className="whitespace-break-spaces text-ellipsis overflow-hidden text-[16px] leading-6 "> 37237 // {estimationData?.brief_project_description} 37238 // </p> 37239 // <div className={styles.blurWrapper} /> 37240 // </div> 37241 // </div>
37242 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 rounded-2xl bg-nightfall text-grey", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-greyGentle", children: "Estimate preview is not available yet." }) }) 37243 ) 37244 ] }), 37245 showModal && /* @__PURE__ */ jsxRuntimeExports.jsx( 37246 GetResultModal, 37247 { 37248 url, 37249 onBack: handleCloseModal, 37250 onGetOffer: (email2) => { 37251 setEmail(email2); 37252 handleCloseModal(); 37253 } 37254 } 37255 ) 37256 ] }); 37257}; 37258 37259const PrivacyPolicy = () => { 37260 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "start", className: "px-4 md:px-10 max-w-[105rem] mx-auto", children: [ 37261 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-32 p-8 space-y-4 text-center md:p-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-l font-bold md:text-xxl", children: "Privacy Policy" }) }), 37262 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-4 py-8 md:p-10 max-w-[105rem] mx-auto space-y-6 text-base", children: [
37263 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37264 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Introduction" }), 37265 /* @__PURE__ */ jsxRuntimeExports.jsx("p", {}) 37266 ] }), 37267 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37268 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold" }), 37269 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37270 " ", 37271 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "costquest.ai" }), 37272 " (operated by  ", 37273 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://sdh.global", className: "text-pink underline hover:text-blue", target: "_blank", children: "sdh.global" }), 37274 " ) is committed to protecting the privacy of its users. This Privacy Policy outlines how we collect, use, and safeguard your personal information when you interact with our website ",
37275 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37276 "Â website. By using our website, you agree to the terms of this Privacy Policy." 37277 ] }) 37278 ] }), 37279 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37280 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Information We Collect" }), 37281 /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc pl-6", children: [ 37282 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Personal Information: We may collect personal information such as your name, email address, contact details, and any other information you provide voluntarily." }), 37283 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Usage Information: We automatically collect non-personal information about your interactions with our website, including IP address, device information, browser type, and operating system." }) 37284 ] }) 37285 ] }),
37286 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37287 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Sharing of Information" }), 37288 /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc pl-6", children: [ 37289 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "With Third Parties: We may share personal information with trusted third-party service providers that assist us in operating our website and conducting our business. These third-party providers are obligated to maintain the confidentiality of your information." }), 37290 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Legal Requirements: We may disclose personal information if required to do so by law or in response to valid requests by public authorities." }) 37291 ] }) 37292 ] }), 37293 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37294 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Data Security" }),
37295 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "We implement reasonable security measures to protect your personal information from unauthorized access, disclosure, alteration, or destruction. However, no method of transmission over the internet or electronic storage is 100% secure." }) 37296 ] }), 37297 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37298 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Third-Party Links" }), 37299 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Our website may contain links to third-party websites or services. We are not responsible for the privacy practices or content of such websites or services. We encourage you to review the privacy policies of those third parties." }) 37300 ] }), 37301 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37302 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Children's Privacy" }),
37303 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Our service is not intended for children under the age of 18. We do not knowingly collect or solicit personal information from children. If you are under 13, please do not use our website or provide any personal information." }) 37304 ] }), 37305 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37306 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Changes to This Privacy Policy" }), 37307 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "We reserve the right to update or modify this Privacy Policy at any time. We will notify you of any changes by posting the revised Privacy Policy on our website here. Your continued use of our website/service following the posting of changes constitutes your acceptance of such changes." }) 37308 ] }), 37309 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37310 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Your Rights" }),
37311 /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc pl-6", children: [ 37312 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: 'Access and Rectification: You have the right to access and update your personal information held by us. If you believe that any information, we hold about you is incorrect or incomplete, please contact us using the information provided in the "Contact Us" section below.' }), 37313 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Data Portability: You have the right to request a copy of your personal information in a structured, commonly used, and machine-readable format." }), 37314 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Erasure: You have the right to request the erasure of your personal information under certain circumstances." }), 37315 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Objection and Restriction: You have the right to object to the processing of your personal information and request restriction of processing under certain circumstances." }),
37316 /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: "Consent Withdrawal: If we rely on your consent for the processing of your personal information, you have the right to withdraw that consent at any time." }) 37317 ] }) 37318 ] }), 37319 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37320 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "International Data Transfers" }), 37321 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37322 "If you are accessing our website from outside the jurisdiction in which our servers are located, your personal information may be transferred to and stored on servers located in that jurisdiction or other locations. By using ", 37323 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37324 " , you consent to the transfer of your personal information to jurisdictions that may have different data protection laws than your country of residence." 37325 ] }) 37326 ] }),
37327 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37328 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "Contact Us" }), 37329 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37330 "If you have any questions or concerns about this Privacy Policy or our privacy practices, please contact us at ", 37331 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "mailto:[email protected]", children: "[email protected]" }) 37332 ] }), 37333 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Thanks for using CostQuest." }) 37334 ] }) 37335 ] }), 37336 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-10 px-4 flex flex-col gap-10 md:p-10", children: [ 37337 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-px bg-lavender/15" }), 37338 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-center text-xxs text-textSecondary2 uppercase", children: [ 37339 "© ", 37340 (/* @__PURE__ */ new Date()).getFullYear(), 37341 " CQ Platform. All rights reserved." 37342 ] }) 37343 ] }) 37344 ] }); 37345}; 37346 37347const TermsOfUse = () => { 37348 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "start", className: "px-4 md:px-10 max-w-[105rem] mx-auto", children: [ 37349 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-32 p-8 space-y-4 text-center md:p-10", children: [
37350 /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-l font-bold md:text-xxl", children: "Terms and Conditions" }), 37351 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-m font-semibold", children: "Welcome to Copatent!" }), 37352 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-small md:text-base", children: "By accessing or using our website, you agree to comply with and be bound by the following Terms and Conditions. If you disagree with any part of these terms, please refrain from using our website." }) 37353 ] }), 37354 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-4 py-8 md:p-10 max-w-[105rem] mx-auto space-y-6 text-base", children: [ 37355 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37356 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "1. User Eligibility:" }), 37357 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "1.1. You must be at least 18 years old or have the consent of a legal guardian to use our website." }),
37358 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "1.2. By using our website, you acknowledge that you have the legal capacity to enter into these Terms and Conditions." }) 37359 ] }), 37360 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37361 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "2. User Conduct:" }), 37362 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "2.1. Use CostQuest.AI for lawful purposes only." }), 37363 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "2.2. You are responsible for any content you contribute." }), 37364 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "2.3. Do not upload unlawful, offensive, or infringing content." }) 37365 ] }), 37366 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37367 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "3. Intellectual Property:" }), 37368 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37369 "3.1. Content on  ",
37370 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37371 " is protected by intellectual property rights owned or licensed by  ", 37372 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://sdh.global", className: "text-pink underline hover:text-blue", target: "_blank", children: "Software Development Hub | Custom Software Development Company" }), 37373 " ." 37374 ] }), 37375 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "3.2. You may not reproduce, distribute, or modify user-generated content without permission." }) 37376 ] }), 37377 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37378 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "4. Privacy:" }), 37379 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37380 "4.1.  ", 37381 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37382 " respects your privacy as described in our", 37383 " ",
37384 /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/privacy-policy", className: "text-pink underline hover:text-blue", target: "_blank", children: "Privacy Policy" }), 37385 "." 37386 ] }), 37387 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "4.2. By using our website, you consent to the collection, use, and disclosure of your personal information." }) 37388 ] }), 37389 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37390 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "5. Limitation of Liability:" }), 37391 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37392 "5.1.  ", 37393 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37394 " is not liable for any damages arising out of or in connection with the use of our website." 37395 ] }), 37396 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37397 "5.2. We do not guarantee the accuracy or completeness of the content on  ",
37398 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37399 "Â ." 37400 ] }) 37401 ] }), 37402 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37403 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "6. Modifications to the Terms and Conditions:" }), 37404 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37405 "6.1. Â ", 37406 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37407 "Â may revise these Terms and Conditions at any time." 37408 ] }), 37409 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "6.2. It is your responsibility to review the most current version regularly." }), 37410 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "6.3. By continuing to use our website after any modifications, you agree to be bound by the updated Terms and Conditions." }) 37411 ] }),
37412 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37413 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "7. Termination:" }), 37414 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37415 "7.1. Â ", 37416 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://costquest.ai", className: "text-pink underline hover:text-blue", target: "_blank", children: "https://costquest.ai" }), 37417 "Â reserves the right to terminate or suspend your access to the website at any time." 37418 ] }), 37419 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "7.2. Upon termination, all provisions that should reasonably survive will remain in effect." }) 37420 ] }), 37421 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ 37422 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-m font-semibold", children: "8. Governing Law:" }), 37423 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "8.1. These Terms and Conditions shall be governed by the laws of Germany." }),
37424 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "8.2. Any dispute shall be subject to the exclusive jurisdiction of the courts of Germany." }) 37425 ] }), 37426 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37427 "This website is operated and maintained with â¤ï¸ by  ", 37428 /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://sdh.global", className: "text-pink underline hover:text-blue", target: "_blank", children: "Software Development Hub | Custom Software Development Company" }), 37429 " s.r.o., registered in Germany." 37430 ] }), 37431 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [ 37432 "For further information, you may want to check our ", 37433 /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/privacy-policy", className: "text-pink underline hover:text-blue", target: "_blank", children: "Privacy Policy" }), 37434 "." 37435 ] }) 37436 ] }), 37437 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-10 px-4 flex flex-col gap-10 md:p-10", children: [
37438 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-px bg-lavender/15" }), 37439 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-center text-xxs text-textSecondary2 uppercase", children: [ 37440 "© ", 37441 (/* @__PURE__ */ new Date()).getFullYear(), 37442 " CQ Platform. All rights reserved." 37443 ] }) 37444 ] }) 37445 ] }); 37446}; 37447 37448var lib$1 = {exports: {}}; 37449 37450var _FullInternals = {}; 37451 37452var _CoreInternals = {}; 37453 37454var Global = {}; 37455 37456(function (exports) { 37457 Object.defineProperty(exports, "__esModule", { value: true }); 37458 exports._registerNode = exports.Konva = exports.glob = void 0; 37459 const PI_OVER_180 = Math.PI / 180; 37460 function detectBrowser() { 37461 return (typeof window !== 'undefined' && 37462 ({}.toString.call(window) === '[object Window]' || 37463 {}.toString.call(window) === '[object global]')); 37464 } 37465 exports.glob = typeof commonjsGlobal !== 'undefined' 37466 ? commonjsGlobal 37467 : typeof window !== 'undefined' 37468 ? window 37469 : typeof WorkerGlobalScope !== 'undefined' 37470 ? self 37471 : {}; 37472 exports.Konva = { 37473 _global: exports.glob, 37474 version: '9.3.20', 37475 isBrowser: detectBrowser(), 37476 isUnminified: /param/.test(function (param) { }.toString()), 37477 dblClickWindow: 400, 37478 getAngle(angle) { 37479 return exports.Konva.angleDeg ? angle * PI_OVER_180 : angle; 37480 }, 37481 enableTrace: false, 37482 pointerEventsEnabled: true, 37483 autoDrawEnabled: true, 37484 hitOnDragEnabled: false, 37485 capturePointerEventsEnabled: false, 37486 _mouseListenClick: false, 37487 _touchListenClick: false, 37488 _pointerListenClick: false, 37489 _mouseInDblClickWindow: false, 37490 _touchInDblClickWindow: false, 37491 _pointerInDblClickWindow: false, 37492 _mouseDblClickPointerId: null, 37493 _touchDblClickPointerId: null, 37494 _pointerDblClickPointerId: null, 37495 _fixTextRendering: false, 37496 pixelRatio: (typeof window !== 'undefined' && window.devicePixelRatio) || 1, 37497 dragDistance: 3, 37498 angleDeg: true, 37499 showWarnings: true, 37500 dragButtons: [0, 1], 37501 isDragging() { 37502 return exports.Konva['DD'].isDragging; 37503 }, 37504 isTransforming() { 37505 var _a; 37506 return (_a = exports.Konva['Transformer']) === null || _a === void 0 ? void 0 : _a.isTransforming(); 37507 }, 37508 isDragReady() { 37509 return !!exports.Konva['DD'].node; 37510 }, 37511 releaseCanvasOnDestroy: true, 37512 document: exports.glob.document, 37513 _injectGlobal(Konva) { 37514 exports.glob.Konva = Konva; 37515 }, 37516 }; 37517 const _registerNode = (NodeClass) => { 37518 exports.Konva[NodeClass.prototype.getClassName()] = NodeClass; 37519 }; 37520 exports._registerNode = _registerNode; 37521 exports.Konva._injectGlobal(exports.Konva); 37522} (Global)); 37523 37524var Util = {}; 37525 37526(function (exports) { 37527 Object.defineProperty(exports, "__esModule", { value: true }); 37528 exports.Util = exports.Transform = void 0; 37529 const Global_1 = Global; 37530 class Transform { 37531 constructor(m = [1, 0, 0, 1, 0, 0]) { 37532 this.dirty = false; 37533 this.m = (m && m.slice()) || [1, 0, 0, 1, 0, 0]; 37534 } 37535 reset() { 37536 this.m[0] = 1; 37537 this.m[1] = 0; 37538 this.m[2] = 0; 37539 this.m[3] = 1; 37540 this.m[4] = 0; 37541 this.m[5] = 0; 37542 } 37543 copy() { 37544 return new Transform(this.m); 37545 } 37546 copyInto(tr) { 37547 tr.m[0] = this.m[0]; 37548 tr.m[1] = this.m[1]; 37549 tr.m[2] = this.m[2]; 37550 tr.m[3] = this.m[3]; 37551 tr.m[4] = this.m[4]; 37552 tr.m[5] = this.m[5]; 37553 } 37554 point(point) { 37555 const m = this.m; 37556 return { 37557 x: m[0] * point.x + m[2] * point.y + m[4], 37558 y: m[1] * point.x + m[3] * point.y + m[5], 37559 }; 37560 } 37561 translate(x, y) { 37562 this.m[4] += this.m[0] * x + this.m[2] * y; 37563 this.m[5] += this.m[1] * x + this.m[3] * y; 37564 return this; 37565 } 37566 scale(sx, sy) { 37567 this.m[0] *= sx; 37568 this.m[1] *= sx; 37569 this.m[2] *= sy; 37570 this.m[3] *= sy; 37571 return this; 37572 } 37573 rotate(rad) { 37574 const c = Math.cos(rad); 37575 const s = Math.sin(rad); 37576 const m11 = this.m[0] * c + this.m[2] * s; 37577 const m12 = this.m[1] * c + this.m[3] * s; 37578 const m21 = this.m[0] * -s + this.m[2] * c; 37579 const m22 = this.m[1] * -s + this.m[3] * c; 37580 this.m[0] = m11; 37581 this.m[1] = m12; 37582 this.m[2] = m21; 37583 this.m[3] = m22; 37584 return this; 37585 } 37586 getTranslation() { 37587 return { 37588 x: this.m[4], 37589 y: this.m[5], 37590 }; 37591 } 37592 skew(sx, sy) { 37593 const m11 = this.m[0] + this.m[2] * sy; 37594 const m12 = this.m[1] + this.m[3] * sy; 37595 const m21 = this.m[2] + this.m[0] * sx; 37596 const m22 = this.m[3] + this.m[1] * sx; 37597 this.m[0] = m11; 37598 this.m[1] = m12; 37599 this.m[2] = m21; 37600 this.m[3] = m22; 37601 return this; 37602 } 37603 multiply(matrix) { 37604 const m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1]; 37605 const m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1]; 37606 const m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3]; 37607 const m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3]; 37608 const dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4]; 37609 const dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5]; 37610 this.m[0] = m11; 37611 this.m[1] = m12; 37612 this.m[2] = m21; 37613 this.m[3] = m22; 37614 this.m[4] = dx; 37615 this.m[5] = dy; 37616 return this; 37617 } 37618 invert() { 37619 const d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]); 37620 const m0 = this.m[3] * d; 37621 const m1 = -this.m[1] * d; 37622 const m2 = -this.m[2] * d; 37623 const m3 = this.m[0] * d; 37624 const m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]); 37625 const m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]); 37626 this.m[0] = m0; 37627 this.m[1] = m1; 37628 this.m[2] = m2; 37629 this.m[3] = m3; 37630 this.m[4] = m4; 37631 this.m[5] = m5; 37632 return this; 37633 } 37634 getMatrix() { 37635 return this.m; 37636 } 37637 decompose() { 37638 const a = this.m[0]; 37639 const b = this.m[1]; 37640 const c = this.m[2]; 37641 const d = this.m[3]; 37642 const e = this.m[4]; 37643 const f = this.m[5]; 37644 const delta = a * d - b * c; 37645 const result = { 37646 x: e, 37647 y: f, 37648 rotation: 0, 37649 scaleX: 0, 37650 scaleY: 0, 37651 skewX: 0, 37652 skewY: 0, 37653 }; 37654 if (a != 0 || b != 0) { 37655 const r = Math.sqrt(a * a + b * b); 37656 result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r); 37657 result.scaleX = r; 37658 result.scaleY = delta / r;
vendor: 5,446 bytes, lines 37659-37817
37659 result.skewX = (a * c + b * d) / delta; 37660 result.skewY = 0; 37661 } 37662 else if (c != 0 || d != 0) { 37663 const s = Math.sqrt(c * c + d * d); 37664 result.rotation = 37665 Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); 37666 result.scaleX = delta / s; 37667 result.scaleY = s; 37668 result.skewX = 0; 37669 result.skewY = (a * c + b * d) / delta; 37670 } 37671 else ; 37672 result.rotation = exports.Util._getRotation(result.rotation); 37673 return result; 37674 } 37675 } 37676 exports.Transform = Transform; 37677 const OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = { 37678 aliceblue: [240, 248, 255], 37679 antiquewhite: [250, 235, 215], 37680 aqua: [0, 255, 255], 37681 aquamarine: [127, 255, 212], 37682 azure: [240, 255, 255], 37683 beige: [245, 245, 220], 37684 bisque: [255, 228, 196], 37685 black: [0, 0, 0], 37686 blanchedalmond: [255, 235, 205], 37687 blue: [0, 0, 255], 37688 blueviolet: [138, 43, 226], 37689 brown: [165, 42, 42], 37690 burlywood: [222, 184, 135], 37691 cadetblue: [95, 158, 160], 37692 chartreuse: [127, 255, 0], 37693 chocolate: [210, 105, 30], 37694 coral: [255, 127, 80], 37695 cornflowerblue: [100, 149, 237], 37696 cornsilk: [255, 248, 220], 37697 crimson: [220, 20, 60], 37698 cyan: [0, 255, 255], 37699 darkblue: [0, 0, 139], 37700 darkcyan: [0, 139, 139], 37701 darkgoldenrod: [184, 132, 11], 37702 darkgray: [169, 169, 169], 37703 darkgreen: [0, 100, 0], 37704 darkgrey: [169, 169, 169], 37705 darkkhaki: [189, 183, 107], 37706 darkmagenta: [139, 0, 139], 37707 darkolivegreen: [85, 107, 47], 37708 darkorange: [255, 140, 0], 37709 darkorchid: [153, 50, 204], 37710 darkred: [139, 0, 0], 37711 darksalmon: [233, 150, 122], 37712 darkseagreen: [143, 188, 143], 37713 darkslateblue: [72, 61, 139], 37714 darkslategray: [47, 79, 79], 37715 darkslategrey: [47, 79, 79], 37716 darkturquoise: [0, 206, 209], 37717 darkviolet: [148, 0, 211], 37718 deeppink: [255, 20, 147], 37719 deepskyblue: [0, 191, 255], 37720 dimgray: [105, 105, 105], 37721 dimgrey: [105, 105, 105], 37722 dodgerblue: [30, 144, 255], 37723 firebrick: [178, 34, 34], 37724 floralwhite: [255, 255, 240], 37725 forestgreen: [34, 139, 34], 37726 fuchsia: [255, 0, 255], 37727 gainsboro: [220, 220, 220], 37728 ghostwhite: [248, 248, 255], 37729 gold: [255, 215, 0], 37730 goldenrod: [218, 165, 32], 37731 gray: [128, 128, 128], 37732 green: [0, 128, 0], 37733 greenyellow: [173, 255, 47], 37734 grey: [128, 128, 128], 37735 honeydew: [240, 255, 240], 37736 hotpink: [255, 105, 180], 37737 indianred: [205, 92, 92], 37738 indigo: [75, 0, 130], 37739 ivory: [255, 255, 240], 37740 khaki: [240, 230, 140], 37741 lavender: [230, 230, 250], 37742 lavenderblush: [255, 240, 245], 37743 lawngreen: [124, 252, 0], 37744 lemonchiffon: [255, 250, 205], 37745 lightblue: [173, 216, 230], 37746 lightcoral: [240, 128, 128], 37747 lightcyan: [224, 255, 255], 37748 lightgoldenrodyellow: [250, 250, 210], 37749 lightgray: [211, 211, 211], 37750 lightgreen: [144, 238, 144], 37751 lightgrey: [211, 211, 211], 37752 lightpink: [255, 182, 193], 37753 lightsalmon: [255, 160, 122], 37754 lightseagreen: [32, 178, 170], 37755 lightskyblue: [135, 206, 250], 37756 lightslategray: [119, 136, 153], 37757 lightslategrey: [119, 136, 153], 37758 lightsteelblue: [176, 196, 222], 37759 lightyellow: [255, 255, 224], 37760 lime: [0, 255, 0], 37761 limegreen: [50, 205, 50], 37762 linen: [250, 240, 230], 37763 magenta: [255, 0, 255], 37764 maroon: [128, 0, 0], 37765 mediumaquamarine: [102, 205, 170], 37766 mediumblue: [0, 0, 205], 37767 mediumorchid: [186, 85, 211], 37768 mediumpurple: [147, 112, 219], 37769 mediumseagreen: [60, 179, 113], 37770 mediumslateblue: [123, 104, 238], 37771 mediumspringgreen: [0, 250, 154], 37772 mediumturquoise: [72, 209, 204], 37773 mediumvioletred: [199, 21, 133], 37774 midnightblue: [25, 25, 112], 37775 mintcream: [245, 255, 250], 37776 mistyrose: [255, 228, 225], 37777 moccasin: [255, 228, 181], 37778 navajowhite: [255, 222, 173], 37779 navy: [0, 0, 128], 37780 oldlace: [253, 245, 230], 37781 olive: [128, 128, 0], 37782 olivedrab: [107, 142, 35], 37783 orange: [255, 165, 0], 37784 orangered: [255, 69, 0], 37785 orchid: [218, 112, 214], 37786 palegoldenrod: [238, 232, 170], 37787 palegreen: [152, 251, 152], 37788 paleturquoise: [175, 238, 238], 37789 palevioletred: [219, 112, 147], 37790 papayawhip: [255, 239, 213], 37791 peachpuff: [255, 218, 185], 37792 peru: [205, 133, 63], 37793 pink: [255, 192, 203], 37794 plum: [221, 160, 203], 37795 powderblue: [176, 224, 230], 37796 purple: [128, 0, 128], 37797 rebeccapurple: [102, 51, 153], 37798 red: [255, 0, 0], 37799 rosybrown: [188, 143, 143], 37800 royalblue: [65, 105, 225], 37801 saddlebrown: [139, 69, 19], 37802 salmon: [250, 128, 114], 37803 sandybrown: [244, 164, 96], 37804 seagreen: [46, 139, 87], 37805 seashell: [255, 245, 238], 37806 sienna: [160, 82, 45], 37807 silver: [192, 192, 192], 37808 skyblue: [135, 206, 235], 37809 slateblue: [106, 90, 205], 37810 slategray: [119, 128, 144], 37811 slategrey: [119, 128, 144], 37812 snow: [255, 255, 250], 37813 springgreen: [0, 255, 127], 37814 steelblue: [70, 130, 180], 37815 tan: [210, 180, 140], 37816 teal: [0, 128, 128], 37817 thistle: [216, 191, 216],
37818 transparent: [255, 255, 255, 0], 37819 tomato: [255, 99, 71], 37820 turquoise: [64, 224, 208], 37821 violet: [238, 130, 238], 37822 wheat: [245, 222, 179], 37823 white: [255, 255, 255], 37824 whitesmoke: [245, 245, 245], 37825 yellow: [255, 255, 0], 37826 yellowgreen: [154, 205, 5], 37827 }, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/; 37828 let animQueue = []; 37829 const req = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame) || 37830 function (f) { 37831 setTimeout(f, 60); 37832 }; 37833 exports.Util = { 37834 _isElement(obj) { 37835 return !!(obj && obj.nodeType == 1); 37836 }, 37837 _isFunction(obj) { 37838 return !!(obj && obj.constructor && obj.call && obj.apply); 37839 }, 37840 _isPlainObject(obj) { 37841 return !!obj && obj.constructor === Object; 37842 }, 37843 _isArray(obj) { 37844 return Object.prototype.toString.call(obj) === OBJECT_ARRAY; 37845 }, 37846 _isNumber(obj) { 37847 return (Object.prototype.toString.call(obj) === OBJECT_NUMBER && 37848 !isNaN(obj) && 37849 isFinite(obj)); 37850 }, 37851 _isString(obj) { 37852 return Object.prototype.toString.call(obj) === OBJECT_STRING; 37853 }, 37854 _isBoolean(obj) { 37855 return Object.prototype.toString.call(obj) === OBJECT_BOOLEAN; 37856 }, 37857 isObject(val) { 37858 return val instanceof Object; 37859 }, 37860 isValidSelector(selector) { 37861 if (typeof selector !== 'string') { 37862 return false; 37863 } 37864 const firstChar = selector[0]; 37865 return (firstChar === '#' || 37866 firstChar === '.' || 37867 firstChar === firstChar.toUpperCase()); 37868 }, 37869 _sign(number) { 37870 if (number === 0) { 37871 return 1; 37872 } 37873 if (number > 0) { 37874 return 1; 37875 } 37876 else { 37877 return -1; 37878 } 37879 }, 37880 requestAnimFrame(callback) { 37881 animQueue.push(callback); 37882 if (animQueue.length === 1) { 37883 req(function () { 37884 const queue = animQueue; 37885 animQueue = []; 37886 queue.forEach(function (cb) { 37887 cb(); 37888 }); 37889 }); 37890 } 37891 }, 37892 createCanvasElement() { 37893 const canvas = document.createElement('canvas'); 37894 try { 37895 canvas.style = canvas.style || {}; 37896 } 37897 catch (e) { } 37898 return canvas; 37899 }, 37900 createImageElement() { 37901 return document.createElement('img'); 37902 }, 37903 _isInDocument(el) { 37904 while ((el = el.parentNode)) { 37905 if (el == document) { 37906 return true; 37907 } 37908 } 37909 return false; 37910 }, 37911 _urlToImage(url, callback) { 37912 const imageObj = exports.Util.createImageElement(); 37913 imageObj.onload = function () { 37914 callback(imageObj); 37915 }; 37916 imageObj.src = url; 37917 }, 37918 _rgbToHex(r, g, b) { 37919 return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); 37920 }, 37921 _hexToRgb(hex) { 37922 hex = hex.replace(HASH, EMPTY_STRING); 37923 const bigint = parseInt(hex, 16); 37924 return { 37925 r: (bigint >> 16) & 255, 37926 g: (bigint >> 8) & 255, 37927 b: bigint & 255, 37928 }; 37929 }, 37930 getRandomColor() { 37931 let randColor = ((Math.random() * 0xffffff) << 0).toString(16); 37932 while (randColor.length < 6) { 37933 randColor = ZERO + randColor; 37934 } 37935 return HASH + randColor; 37936 }, 37937 getRGB(color) { 37938 let rgb; 37939 if (color in COLORS) { 37940 rgb = COLORS[color]; 37941 return { 37942 r: rgb[0], 37943 g: rgb[1], 37944 b: rgb[2], 37945 }; 37946 } 37947 else if (color[0] === HASH) { 37948 return this._hexToRgb(color.substring(1)); 37949 } 37950 else if (color.substr(0, 4) === RGB_PAREN) { 37951 rgb = RGB_REGEX.exec(color.replace(/ /g, '')); 37952 return { 37953 r: parseInt(rgb[1], 10), 37954 g: parseInt(rgb[2], 10), 37955 b: parseInt(rgb[3], 10), 37956 }; 37957 } 37958 else { 37959 return { 37960 r: 0, 37961 g: 0, 37962 b: 0, 37963 }; 37964 } 37965 }, 37966 colorToRGBA(str) { 37967 str = str || 'black'; 37968 return (exports.Util._namedColorToRBA(str) || 37969 exports.Util._hex3ColorToRGBA(str) || 37970 exports.Util._hex4ColorToRGBA(str) || 37971 exports.Util._hex6ColorToRGBA(str) || 37972 exports.Util._hex8ColorToRGBA(str) || 37973 exports.Util._rgbColorToRGBA(str) || 37974 exports.Util._rgbaColorToRGBA(str) || 37975 exports.Util._hslColorToRGBA(str)); 37976 }, 37977 _namedColorToRBA(str) { 37978 const c = COLORS[str.toLowerCase()]; 37979 if (!c) { 37980 return null; 37981 } 37982 return { 37983 r: c[0], 37984 g: c[1], 37985 b: c[2], 37986 a: 1, 37987 }; 37988 }, 37989 _rgbColorToRGBA(str) { 37990 if (str.indexOf('rgb(') === 0) { 37991 str = str.match(/rgb\(([^)]+)\)/)[1]; 37992 const parts = str.split(/ *, */).map(Number); 37993 return { 37994 r: parts[0], 37995 g: parts[1], 37996 b: parts[2], 37997 a: 1, 37998 }; 37999 } 38000 }, 38001 _rgbaColorToRGBA(str) { 38002 if (str.indexOf('rgba(') === 0) { 38003 str = str.match(/rgba\(([^)]+)\)/)[1]; 38004 const parts = str.split(/ *, */).map((n, index) => { 38005 if (n.slice(-1) === '%') { 38006 return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255; 38007 } 38008 return Number(n); 38009 }); 38010 return { 38011 r: parts[0], 38012 g: parts[1], 38013 b: parts[2], 38014 a: parts[3], 38015 }; 38016 } 38017 }, 38018 _hex8ColorToRGBA(str) { 38019 if (str[0] === '#' && str.length === 9) { 38020 return { 38021 r: parseInt(str.slice(1, 3), 16), 38022 g: parseInt(str.slice(3, 5), 16), 38023 b: parseInt(str.slice(5, 7), 16), 38024 a: parseInt(str.slice(7, 9), 16) / 0xff, 38025 }; 38026 } 38027 }, 38028 _hex6ColorToRGBA(str) { 38029 if (str[0] === '#' && str.length === 7) { 38030 return { 38031 r: parseInt(str.slice(1, 3), 16), 38032 g: parseInt(str.slice(3, 5), 16), 38033 b: parseInt(str.slice(5, 7), 16), 38034 a: 1, 38035 }; 38036 } 38037 }, 38038 _hex4ColorToRGBA(str) { 38039 if (str[0] === '#' && str.length === 5) { 38040 return { 38041 r: parseInt(str[1] + str[1], 16), 38042 g: parseInt(str[2] + str[2], 16), 38043 b: parseInt(str[3] + str[3], 16), 38044 a: parseInt(str[4] + str[4], 16) / 0xff, 38045 }; 38046 } 38047 }, 38048 _hex3ColorToRGBA(str) { 38049 if (str[0] === '#' && str.length === 4) { 38050 return { 38051 r: parseInt(str[1] + str[1], 16), 38052 g: parseInt(str[2] + str[2], 16), 38053 b: parseInt(str[3] + str[3], 16), 38054 a: 1, 38055 }; 38056 } 38057 }, 38058 _hslColorToRGBA(str) { 38059 if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(str)) { 38060 const [_, ...hsl] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(str); 38061 const h = Number(hsl[0]) / 360;
38062 const s = Number(hsl[1]) / 100; 38063 const l = Number(hsl[2]) / 100; 38064 let t2; 38065 let t3; 38066 let val; 38067 if (s === 0) { 38068 val = l * 255; 38069 return { 38070 r: Math.round(val), 38071 g: Math.round(val), 38072 b: Math.round(val), 38073 a: 1, 38074 }; 38075 } 38076 if (l < 0.5) { 38077 t2 = l * (1 + s); 38078 } 38079 else { 38080 t2 = l + s - l * s; 38081 } 38082 const t1 = 2 * l - t2; 38083 const rgb = [0, 0, 0]; 38084 for (let i = 0; i < 3; i++) { 38085 t3 = h + (1 / 3) * -(i - 1); 38086 if (t3 < 0) { 38087 t3++; 38088 } 38089 if (t3 > 1) { 38090 t3--; 38091 } 38092 if (6 * t3 < 1) { 38093 val = t1 + (t2 - t1) * 6 * t3; 38094 } 38095 else if (2 * t3 < 1) { 38096 val = t2; 38097 } 38098 else if (3 * t3 < 2) { 38099 val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; 38100 } 38101 else { 38102 val = t1; 38103 } 38104 rgb[i] = val * 255; 38105 } 38106 return { 38107 r: Math.round(rgb[0]), 38108 g: Math.round(rgb[1]), 38109 b: Math.round(rgb[2]), 38110 a: 1, 38111 }; 38112 } 38113 }, 38114 haveIntersection(r1, r2) { 38115 return !(r2.x > r1.x + r1.width || 38116 r2.x + r2.width < r1.x || 38117 r2.y > r1.y + r1.height || 38118 r2.y + r2.height < r1.y); 38119 }, 38120 cloneObject(obj) { 38121 const retObj = {}; 38122 for (const key in obj) { 38123 if (this._isPlainObject(obj[key])) { 38124 retObj[key] = this.cloneObject(obj[key]); 38125 } 38126 else if (this._isArray(obj[key])) { 38127 retObj[key] = this.cloneArray(obj[key]); 38128 } 38129 else { 38130 retObj[key] = obj[key]; 38131 } 38132 } 38133 return retObj; 38134 }, 38135 cloneArray(arr) { 38136 return arr.slice(0); 38137 }, 38138 degToRad(deg) { 38139 return deg * PI_OVER_DEG180; 38140 }, 38141 radToDeg(rad) { 38142 return rad * DEG180_OVER_PI; 38143 }, 38144 _degToRad(deg) { 38145 exports.Util.warn('Util._degToRad is removed. Please use public Util.degToRad instead.'); 38146 return exports.Util.degToRad(deg); 38147 }, 38148 _radToDeg(rad) { 38149 exports.Util.warn('Util._radToDeg is removed. Please use public Util.radToDeg instead.'); 38150 return exports.Util.radToDeg(rad); 38151 }, 38152 _getRotation(radians) { 38153 return Global_1.Konva.angleDeg ? exports.Util.radToDeg(radians) : radians; 38154 }, 38155 _capitalize(str) { 38156 return str.charAt(0).toUpperCase() + str.slice(1); 38157 }, 38158 throw(str) { 38159 throw new Error(KONVA_ERROR + str); 38160 }, 38161 error(str) { 38162 console.error(KONVA_ERROR + str); 38163 }, 38164 warn(str) { 38165 if (!Global_1.Konva.showWarnings) { 38166 return; 38167 } 38168 console.warn(KONVA_WARNING + str); 38169 }, 38170 each(obj, func) { 38171 for (const key in obj) { 38172 func(key, obj[key]); 38173 } 38174 }, 38175 _inRange(val, left, right) { 38176 return left <= val && val < right; 38177 }, 38178 _getProjectionToSegment(x1, y1, x2, y2, x3, y3) { 38179 let x, y, dist; 38180 const pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); 38181 if (pd2 == 0) { 38182 x = x1; 38183 y = y1; 38184 dist = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2); 38185 } 38186 else { 38187 const u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2; 38188 if (u < 0) { 38189 x = x1; 38190 y = y1; 38191 dist = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3); 38192 } 38193 else if (u > 1.0) { 38194 x = x2; 38195 y = y2; 38196 dist = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3); 38197 } 38198 else { 38199 x = x1 + u * (x2 - x1); 38200 y = y1 + u * (y2 - y1); 38201 dist = (x - x3) * (x - x3) + (y - y3) * (y - y3); 38202 } 38203 } 38204 return [x, y, dist]; 38205 }, 38206 _getProjectionToLine(pt, line, isClosed) { 38207 const pc = exports.Util.cloneObject(pt); 38208 let dist = Number.MAX_VALUE; 38209 line.forEach(function (p1, i) { 38210 if (!isClosed && i === line.length - 1) { 38211 return; 38212 } 38213 const p2 = line[(i + 1) % line.length]; 38214 const proj = exports.Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y); 38215 const px = proj[0], py = proj[1], pdist = proj[2]; 38216 if (pdist < dist) { 38217 pc.x = px; 38218 pc.y = py; 38219 dist = pdist; 38220 } 38221 }); 38222 return pc; 38223 }, 38224 _prepareArrayForTween(startArray, endArray, isClosed) { 38225 const start = [], end = []; 38226 if (startArray.length > endArray.length) { 38227 const temp = endArray; 38228 endArray = startArray; 38229 startArray = temp; 38230 } 38231 for (let n = 0; n < startArray.length; n += 2) { 38232 start.push({ 38233 x: startArray[n], 38234 y: startArray[n + 1], 38235 }); 38236 } 38237 for (let n = 0; n < endArray.length; n += 2) { 38238 end.push({ 38239 x: endArray[n], 38240 y: endArray[n + 1], 38241 }); 38242 } 38243 const newStart = [];
38244 end.forEach(function (point) { 38245 const pr = exports.Util._getProjectionToLine(point, start, isClosed); 38246 newStart.push(pr.x); 38247 newStart.push(pr.y); 38248 }); 38249 return newStart; 38250 }, 38251 _prepareToStringify(obj) { 38252 let desc; 38253 obj.visitedByCircularReferenceRemoval = true; 38254 for (const key in obj) { 38255 if (!(obj.hasOwnProperty(key) && obj[key] && typeof obj[key] == 'object')) { 38256 continue; 38257 } 38258 desc = Object.getOwnPropertyDescriptor(obj, key); 38259 if (obj[key].visitedByCircularReferenceRemoval || 38260 exports.Util._isElement(obj[key])) { 38261 if (desc.configurable) { 38262 delete obj[key]; 38263 } 38264 else { 38265 return null; 38266 } 38267 } 38268 else if (exports.Util._prepareToStringify(obj[key]) === null) { 38269 if (desc.configurable) { 38270 delete obj[key]; 38271 } 38272 else { 38273 return null; 38274 } 38275 } 38276 } 38277 delete obj.visitedByCircularReferenceRemoval; 38278 return obj; 38279 }, 38280 _assign(target, source) { 38281 for (const key in source) { 38282 target[key] = source[key]; 38283 } 38284 return target; 38285 }, 38286 _getFirstPointerId(evt) { 38287 if (!evt.touches) { 38288 return evt.pointerId || 999; 38289 } 38290 else { 38291 return evt.changedTouches[0].identifier; 38292 } 38293 }, 38294 releaseCanvas(...canvases) { 38295 if (!Global_1.Konva.releaseCanvasOnDestroy) 38296 return; 38297 canvases.forEach((c) => { 38298 c.width = 0; 38299 c.height = 0; 38300 }); 38301 }, 38302 drawRoundedRectPath(context, width, height, cornerRadius) { 38303 let topLeft = 0; 38304 let topRight = 0; 38305 let bottomLeft = 0; 38306 let bottomRight = 0; 38307 if (typeof cornerRadius === 'number') { 38308 topLeft = 38309 topRight = 38310 bottomLeft = 38311 bottomRight = 38312 Math.min(cornerRadius, width / 2, height / 2); 38313 } 38314 else { 38315 topLeft = Math.min(cornerRadius[0] || 0, width / 2, height / 2); 38316 topRight = Math.min(cornerRadius[1] || 0, width / 2, height / 2); 38317 bottomRight = Math.min(cornerRadius[2] || 0, width / 2, height / 2); 38318 bottomLeft = Math.min(cornerRadius[3] || 0, width / 2, height / 2); 38319 } 38320 context.moveTo(topLeft, 0); 38321 context.lineTo(width - topRight, 0); 38322 context.arc(width - topRight, topRight, topRight, (Math.PI * 3) / 2, 0, false); 38323 context.lineTo(width, height - bottomRight); 38324 context.arc(width - bottomRight, height - bottomRight, bottomRight, 0, Math.PI / 2, false); 38325 context.lineTo(bottomLeft, height); 38326 context.arc(bottomLeft, height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false); 38327 context.lineTo(0, topLeft); 38328 context.arc(topLeft, topLeft, topLeft, Math.PI, (Math.PI * 3) / 2, false); 38329 }, 38330 }; 38331} (Util)); 38332 38333var Node$2 = {}; 38334 38335var Factory = {}; 38336 38337var Validators = {}; 38338 38339Object.defineProperty(Validators, "__esModule", { value: true }); 38340Validators.RGBComponent = RGBComponent; 38341Validators.alphaComponent = alphaComponent; 38342Validators.getNumberValidator = getNumberValidator; 38343Validators.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator; 38344Validators.getNumberOrAutoValidator = getNumberOrAutoValidator; 38345Validators.getStringValidator = getStringValidator; 38346Validators.getStringOrGradientValidator = getStringOrGradientValidator; 38347Validators.getFunctionValidator = getFunctionValidator; 38348Validators.getNumberArrayValidator = getNumberArrayValidator; 38349Validators.getBooleanValidator = getBooleanValidator; 38350Validators.getComponentValidator = getComponentValidator; 38351const Global_1$p = Global; 38352const Util_1$f = Util; 38353function _formatValue(val) { 38354 if (Util_1$f.Util._isString(val)) { 38355 return '"' + val + '"'; 38356 } 38357 if (Object.prototype.toString.call(val) === '[object Number]') { 38358 return val; 38359 } 38360 if (Util_1$f.Util._isBoolean(val)) { 38361 return val; 38362 } 38363 return Object.prototype.toString.call(val); 38364} 38365function RGBComponent(val) { 38366 if (val > 255) { 38367 return 255; 38368 } 38369 else if (val < 0) { 38370 return 0; 38371 } 38372 return Math.round(val); 38373} 38374function alphaComponent(val) { 38375 if (val > 1) { 38376 return 1; 38377 } 38378 else if (val < 0.0001) { 38379 return 0.0001; 38380 } 38381 return val; 38382} 38383function getNumberValidator() { 38384 if (Global_1$p.Konva.isUnminified) { 38385 return function (val, attr) { 38386 if (!Util_1$f.Util._isNumber(val)) { 38387 Util_1$f.Util.warn(_formatValue(val) +
38388 ' is a not valid value for "' + 38389 attr + 38390 '" attribute. The value should be a number.'); 38391 } 38392 return val; 38393 }; 38394 } 38395} 38396function getNumberOrArrayOfNumbersValidator(noOfElements) { 38397 if (Global_1$p.Konva.isUnminified) { 38398 return function (val, attr) { 38399 let isNumber = Util_1$f.Util._isNumber(val); 38400 let isValidArray = Util_1$f.Util._isArray(val) && val.length == noOfElements; 38401 if (!isNumber && !isValidArray) { 38402 Util_1$f.Util.warn(_formatValue(val) + 38403 ' is a not valid value for "' + 38404 attr + 38405 '" attribute. The value should be a number or Array<number>(' + 38406 noOfElements + 38407 ')'); 38408 } 38409 return val; 38410 }; 38411 } 38412} 38413function getNumberOrAutoValidator() { 38414 if (Global_1$p.Konva.isUnminified) { 38415 return function (val, attr) { 38416 var isNumber = Util_1$f.Util._isNumber(val); 38417 var isAuto = val === 'auto'; 38418 if (!(isNumber || isAuto)) { 38419 Util_1$f.Util.warn(_formatValue(val) +
38420 ' is a not valid value for "' + 38421 attr + 38422 '" attribute. The value should be a number or "auto".'); 38423 } 38424 return val; 38425 }; 38426 } 38427} 38428function getStringValidator() { 38429 if (Global_1$p.Konva.isUnminified) { 38430 return function (val, attr) { 38431 if (!Util_1$f.Util._isString(val)) { 38432 Util_1$f.Util.warn(_formatValue(val) + 38433 ' is a not valid value for "' + 38434 attr + 38435 '" attribute. The value should be a string.'); 38436 } 38437 return val; 38438 }; 38439 } 38440} 38441function getStringOrGradientValidator() { 38442 if (Global_1$p.Konva.isUnminified) { 38443 return function (val, attr) { 38444 const isString = Util_1$f.Util._isString(val); 38445 const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' || 38446 (val && val['addColorStop']); 38447 if (!(isString || isGradient)) { 38448 Util_1$f.Util.warn(_formatValue(val) +
38449 ' is a not valid value for "' + 38450 attr + 38451 '" attribute. The value should be a string or a native gradient.'); 38452 } 38453 return val; 38454 }; 38455 } 38456} 38457function getFunctionValidator() { 38458 if (Global_1$p.Konva.isUnminified) { 38459 return function (val, attr) { 38460 if (!Util_1$f.Util._isFunction(val)) { 38461 Util_1$f.Util.warn(_formatValue(val) + 38462 ' is a not valid value for "' + 38463 attr + 38464 '" attribute. The value should be a function.'); 38465 } 38466 return val; 38467 }; 38468 } 38469} 38470function getNumberArrayValidator() { 38471 if (Global_1$p.Konva.isUnminified) { 38472 return function (val, attr) { 38473 const TypedArray = Int8Array ? Object.getPrototypeOf(Int8Array) : null; 38474 if (TypedArray && val instanceof TypedArray) { 38475 return val; 38476 } 38477 if (!Util_1$f.Util._isArray(val)) { 38478 Util_1$f.Util.warn(_formatValue(val) +
38479 ' is a not valid value for "' + 38480 attr + 38481 '" attribute. The value should be a array of numbers.'); 38482 } 38483 else { 38484 val.forEach(function (item) { 38485 if (!Util_1$f.Util._isNumber(item)) { 38486 Util_1$f.Util.warn('"' + 38487 attr + 38488 '" attribute has non numeric element ' + 38489 item + 38490 '. Make sure that all elements are numbers.'); 38491 } 38492 }); 38493 } 38494 return val; 38495 }; 38496 } 38497} 38498function getBooleanValidator() { 38499 if (Global_1$p.Konva.isUnminified) { 38500 return function (val, attr) { 38501 var isBool = val === true || val === false; 38502 if (!isBool) { 38503 Util_1$f.Util.warn(_formatValue(val) + 38504 ' is a not valid value for "' + 38505 attr + 38506 '" attribute. The value should be a boolean.'); 38507 } 38508 return val; 38509 }; 38510 } 38511} 38512function getComponentValidator(components) { 38513 if (Global_1$p.Konva.isUnminified) { 38514 return function (val, attr) { 38515 if (val === undefined || val === null) { 38516 return val; 38517 } 38518 if (!Util_1$f.Util.isObject(val)) { 38519 Util_1$f.Util.warn(_formatValue(val) +
38520 ' is a not valid value for "' + 38521 attr + 38522 '" attribute. The value should be an object with properties ' + 38523 components); 38524 } 38525 return val; 38526 }; 38527 } 38528} 38529 38530(function (exports) { 38531 Object.defineProperty(exports, "__esModule", { value: true }); 38532 exports.Factory = void 0; 38533 const Util_1 = Util; 38534 const Validators_1 = Validators; 38535 const GET = 'get'; 38536 const SET = 'set'; 38537 exports.Factory = { 38538 addGetterSetter(constructor, attr, def, validator, after) { 38539 exports.Factory.addGetter(constructor, attr, def); 38540 exports.Factory.addSetter(constructor, attr, validator, after); 38541 exports.Factory.addOverloadedGetterSetter(constructor, attr); 38542 }, 38543 addGetter(constructor, attr, def) { 38544 var method = GET + Util_1.Util._capitalize(attr); 38545 constructor.prototype[method] = 38546 constructor.prototype[method] || 38547 function () { 38548 const val = this.attrs[attr]; 38549 return val === undefined ? def : val; 38550 }; 38551 }, 38552 addSetter(constructor, attr, validator, after) { 38553 var method = SET + Util_1.Util._capitalize(attr); 38554 if (!constructor.prototype[method]) { 38555 exports.Factory.overWriteSetter(constructor, attr, validator, after); 38556 } 38557 }, 38558 overWriteSetter(constructor, attr, validator, after) { 38559 var method = SET + Util_1.Util._capitalize(attr); 38560 constructor.prototype[method] = function (val) { 38561 if (validator && val !== undefined && val !== null) { 38562 val = validator.call(this, val, attr); 38563 } 38564 this._setAttr(attr, val); 38565 if (after) { 38566 after.call(this); 38567 } 38568 return this; 38569 }; 38570 }, 38571 addComponentsGetterSetter(constructor, attr, components, validator, after) { 38572 const len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr); 38573 constructor.prototype[getter] = function () { 38574 const ret = {}; 38575 for (let n = 0; n < len; n++) { 38576 const component = components[n]; 38577 ret[component] = this.getAttr(attr + capitalize(component)); 38578 } 38579 return ret; 38580 }; 38581 const basicValidator = (0, Validators_1.getComponentValidator)(components); 38582 constructor.prototype[setter] = function (val) { 38583 const oldVal = this.attrs[attr]; 38584 if (validator) { 38585 val = validator.call(this, val, attr); 38586 } 38587 if (basicValidator) { 38588 basicValidator.call(this, val, attr); 38589 } 38590 for (const key in val) { 38591 if (!val.hasOwnProperty(key)) { 38592 continue; 38593 } 38594 this._setAttr(attr + capitalize(key), val[key]); 38595 } 38596 if (!val) { 38597 components.forEach((component) => { 38598 this._setAttr(attr + capitalize(component), undefined); 38599 }); 38600 } 38601 this._fireChangeEvent(attr, oldVal, val); 38602 if (after) { 38603 after.call(this); 38604 } 38605 return this; 38606 }; 38607 exports.Factory.addOverloadedGetterSetter(constructor, attr); 38608 }, 38609 addOverloadedGetterSetter(constructor, attr) { 38610 var capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr; 38611 constructor.prototype[attr] = function () { 38612 if (arguments.length) { 38613 this[setter](arguments[0]); 38614 return this; 38615 } 38616 return this[getter](); 38617 }; 38618 }, 38619 addDeprecatedGetterSetter(constructor, attr, def, validator) { 38620 Util_1.Util.error('Adding deprecated ' + attr); 38621 const method = GET + Util_1.Util._capitalize(attr); 38622 const message = attr + 38623 ' property is deprecated and will be removed soon. Look at Konva change log for more information.'; 38624 constructor.prototype[method] = function () { 38625 Util_1.Util.error(message); 38626 const val = this.attrs[attr]; 38627 return val === undefined ? def : val; 38628 }; 38629 exports.Factory.addSetter(constructor, attr, validator, function () { 38630 Util_1.Util.error(message); 38631 }); 38632 exports.Factory.addOverloadedGetterSetter(constructor, attr); 38633 }, 38634 backCompat(constructor, methods) { 38635 Util_1.Util.each(methods, function (oldMethodName, newMethodName) { 38636 const method = constructor.prototype[newMethodName]; 38637 const oldGetter = GET + Util_1.Util._capitalize(oldMethodName); 38638 const oldSetter = SET + Util_1.Util._capitalize(oldMethodName); 38639 function deprecated() { 38640 method.apply(this, arguments); 38641 Util_1.Util.error('"' + 38642 oldMethodName + 38643 '" method is deprecated and will be removed soon. Use ""' + 38644 newMethodName + 38645 '" instead.'); 38646 } 38647 constructor.prototype[oldMethodName] = deprecated; 38648 constructor.prototype[oldGetter] = deprecated; 38649 constructor.prototype[oldSetter] = deprecated; 38650 }); 38651 }, 38652 afterSetFilter() { 38653 this._filterUpToDate = false;
38654 }, 38655 }; 38656} (Factory)); 38657 38658var Canvas$1 = {}; 38659 38660var Context$1 = {}; 38661 38662Object.defineProperty(Context$1, "__esModule", { value: true }); 38663Context$1.HitContext = Context$1.SceneContext = Context$1.Context = void 0; 38664const Util_1$e = Util; 38665const Global_1$o = Global; 38666function simplifyArray(arr) { 38667 const retArr = [], len = arr.length, util = Util_1$e.Util; 38668 for (let n = 0; n < len; n++) { 38669 let val = arr[n]; 38670 if (util._isNumber(val)) { 38671 val = Math.round(val * 1000) / 1000; 38672 } 38673 else if (!util._isString(val)) { 38674 val = val + ''; 38675 } 38676 retArr.push(val); 38677 } 38678 return retArr; 38679} 38680const COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()', EQUALS = '=', CONTEXT_METHODS = [ 38681 'arc', 38682 'arcTo', 38683 'beginPath', 38684 'bezierCurveTo', 38685 'clearRect', 38686 'clip', 38687 'closePath', 38688 'createLinearGradient', 38689 'createPattern', 38690 'createRadialGradient', 38691 'drawImage', 38692 'ellipse', 38693 'fill', 38694 'fillText', 38695 'getImageData', 38696 'createImageData', 38697 'lineTo', 38698 'moveTo', 38699 'putImageData', 38700 'quadraticCurveTo', 38701 'rect', 38702 'roundRect', 38703 'restore', 38704 'rotate', 38705 'save', 38706 'scale', 38707 'setLineDash', 38708 'setTransform', 38709 'stroke', 38710 'strokeText', 38711 'transform', 38712 'translate', 38713]; 38714const CONTEXT_PROPERTIES = [ 38715 'fillStyle', 38716 'strokeStyle', 38717 'shadowColor', 38718 'shadowBlur', 38719 'shadowOffsetX', 38720 'shadowOffsetY', 38721 'letterSpacing', 38722 'lineCap', 38723 'lineDashOffset', 38724 'lineJoin', 38725 'lineWidth', 38726 'miterLimit', 38727 'direction', 38728 'font', 38729 'textAlign', 38730 'textBaseline', 38731 'globalAlpha', 38732 'globalCompositeOperation', 38733 'imageSmoothingEnabled', 38734]; 38735const traceArrMax = 100; 38736class Context { 38737 constructor(canvas) { 38738 this.canvas = canvas; 38739 if (Global_1$o.Konva.enableTrace) { 38740 this.traceArr = []; 38741 this._enableTrace(); 38742 } 38743 } 38744 fillShape(shape) { 38745 if (shape.fillEnabled()) { 38746 this._fill(shape); 38747 } 38748 } 38749 _fill(shape) { 38750 } 38751 strokeShape(shape) { 38752 if (shape.hasStroke()) { 38753 this._stroke(shape); 38754 } 38755 } 38756 _stroke(shape) { 38757 } 38758 fillStrokeShape(shape) { 38759 if (shape.attrs.fillAfterStrokeEnabled) { 38760 this.strokeShape(shape); 38761 this.fillShape(shape); 38762 } 38763 else { 38764 this.fillShape(shape); 38765 this.strokeShape(shape); 38766 } 38767 }
vendor: 4,547 bytes, lines 38768-38904
38768 getTrace(relaxed, rounded) { 38769 let traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args; 38770 for (n = 0; n < len; n++) { 38771 trace = traceArr[n]; 38772 method = trace.method; 38773 if (method) { 38774 args = trace.args; 38775 str += method; 38776 if (relaxed) { 38777 str += DOUBLE_PAREN; 38778 } 38779 else { 38780 if (Util_1$e.Util._isArray(args[0])) { 38781 str += OPEN_PAREN_BRACKET + args.join(COMMA) + CLOSE_BRACKET_PAREN; 38782 } 38783 else { 38784 if (rounded) { 38785 args = args.map((a) => typeof a === 'number' ? Math.floor(a) : a); 38786 } 38787 str += OPEN_PAREN + args.join(COMMA) + CLOSE_PAREN; 38788 } 38789 } 38790 } 38791 else { 38792 str += trace.property; 38793 if (!relaxed) { 38794 str += EQUALS + trace.val; 38795 } 38796 } 38797 str += SEMICOLON; 38798 } 38799 return str; 38800 } 38801 clearTrace() { 38802 this.traceArr = []; 38803 } 38804 _trace(str) { 38805 let traceArr = this.traceArr, len; 38806 traceArr.push(str); 38807 len = traceArr.length; 38808 if (len >= traceArrMax) { 38809 traceArr.shift(); 38810 } 38811 } 38812 reset() { 38813 const pixelRatio = this.getCanvas().getPixelRatio(); 38814 this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0); 38815 } 38816 getCanvas() { 38817 return this.canvas; 38818 } 38819 clear(bounds) { 38820 const canvas = this.getCanvas(); 38821 if (bounds) { 38822 this.clearRect(bounds.x || 0, bounds.y || 0, bounds.width || 0, bounds.height || 0); 38823 } 38824 else { 38825 this.clearRect(0, 0, canvas.getWidth() / canvas.pixelRatio, canvas.getHeight() / canvas.pixelRatio); 38826 } 38827 } 38828 _applyLineCap(shape) { 38829 const lineCap = shape.attrs.lineCap; 38830 if (lineCap) { 38831 this.setAttr('lineCap', lineCap); 38832 } 38833 } 38834 _applyOpacity(shape) { 38835 const absOpacity = shape.getAbsoluteOpacity(); 38836 if (absOpacity !== 1) { 38837 this.setAttr('globalAlpha', absOpacity); 38838 } 38839 } 38840 _applyLineJoin(shape) { 38841 const lineJoin = shape.attrs.lineJoin; 38842 if (lineJoin) { 38843 this.setAttr('lineJoin', lineJoin); 38844 } 38845 } 38846 setAttr(attr, val) { 38847 this._context[attr] = val; 38848 } 38849 arc(x, y, radius, startAngle, endAngle, counterClockwise) { 38850 this._context.arc(x, y, radius, startAngle, endAngle, counterClockwise); 38851 } 38852 arcTo(x1, y1, x2, y2, radius) { 38853 this._context.arcTo(x1, y1, x2, y2, radius); 38854 } 38855 beginPath() { 38856 this._context.beginPath(); 38857 } 38858 bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) { 38859 this._context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y); 38860 } 38861 clearRect(x, y, width, height) { 38862 this._context.clearRect(x, y, width, height); 38863 } 38864 clip(...args) { 38865 this._context.clip.apply(this._context, args); 38866 } 38867 closePath() { 38868 this._context.closePath(); 38869 } 38870 createImageData(width, height) { 38871 const a = arguments; 38872 if (a.length === 2) { 38873 return this._context.createImageData(width, height); 38874 } 38875 else if (a.length === 1) { 38876 return this._context.createImageData(width); 38877 } 38878 } 38879 createLinearGradient(x0, y0, x1, y1) { 38880 return this._context.createLinearGradient(x0, y0, x1, y1); 38881 } 38882 createPattern(image, repetition) { 38883 return this._context.createPattern(image, repetition); 38884 } 38885 createRadialGradient(x0, y0, r0, x1, y1, r1) { 38886 return this._context.createRadialGradient(x0, y0, r0, x1, y1, r1); 38887 } 38888 drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) { 38889 const a = arguments, _context = this._context; 38890 if (a.length === 3) { 38891 _context.drawImage(image, sx, sy); 38892 } 38893 else if (a.length === 5) { 38894 _context.drawImage(image, sx, sy, sWidth, sHeight); 38895 } 38896 else if (a.length === 9) { 38897 _context.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); 38898 } 38899 } 38900 ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) { 38901 this._context.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise); 38902 } 38903 isPointInPath(x, y, path, fillRule) { 38904 if (path) {
38905 return this._context.isPointInPath(path, x, y, fillRule); 38906 } 38907 return this._context.isPointInPath(x, y, fillRule); 38908 } 38909 fill(...args) { 38910 this._context.fill.apply(this._context, args); 38911 } 38912 fillRect(x, y, width, height) { 38913 this._context.fillRect(x, y, width, height); 38914 } 38915 strokeRect(x, y, width, height) { 38916 this._context.strokeRect(x, y, width, height); 38917 } 38918 fillText(text, x, y, maxWidth) { 38919 if (maxWidth) { 38920 this._context.fillText(text, x, y, maxWidth); 38921 } 38922 else { 38923 this._context.fillText(text, x, y); 38924 } 38925 } 38926 measureText(text) { 38927 return this._context.measureText(text); 38928 } 38929 getImageData(sx, sy, sw, sh) { 38930 return this._context.getImageData(sx, sy, sw, sh); 38931 } 38932 lineTo(x, y) { 38933 this._context.lineTo(x, y); 38934 } 38935 moveTo(x, y) { 38936 this._context.moveTo(x, y); 38937 } 38938 rect(x, y, width, height) { 38939 this._context.rect(x, y, width, height); 38940 } 38941 roundRect(x, y, width, height, radii) { 38942 this._context.roundRect(x, y, width, height, radii); 38943 } 38944 putImageData(imageData, dx, dy) { 38945 this._context.putImageData(imageData, dx, dy); 38946 } 38947 quadraticCurveTo(cpx, cpy, x, y) { 38948 this._context.quadraticCurveTo(cpx, cpy, x, y); 38949 } 38950 restore() { 38951 this._context.restore(); 38952 } 38953 rotate(angle) { 38954 this._context.rotate(angle); 38955 } 38956 save() { 38957 this._context.save(); 38958 } 38959 scale(x, y) { 38960 this._context.scale(x, y); 38961 } 38962 setLineDash(segments) { 38963 if (this._context.setLineDash) { 38964 this._context.setLineDash(segments); 38965 } 38966 else if ('mozDash' in this._context) { 38967 this._context['mozDash'] = segments; 38968 } 38969 else if ('webkitLineDash' in this._context) { 38970 this._context['webkitLineDash'] = segments; 38971 } 38972 } 38973 getLineDash() { 38974 return this._context.getLineDash(); 38975 } 38976 setTransform(a, b, c, d, e, f) { 38977 this._context.setTransform(a, b, c, d, e, f); 38978 } 38979 stroke(path2d) { 38980 if (path2d) { 38981 this._context.stroke(path2d); 38982 } 38983 else { 38984 this._context.stroke(); 38985 } 38986 } 38987 strokeText(text, x, y, maxWidth) { 38988 this._context.strokeText(text, x, y, maxWidth); 38989 } 38990 transform(a, b, c, d, e, f) { 38991 this._context.transform(a, b, c, d, e, f); 38992 } 38993 translate(x, y) { 38994 this._context.translate(x, y); 38995 } 38996 _enableTrace() { 38997 let that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args; 38998 const func = function (methodName) { 38999 let origMethod = that[methodName], ret; 39000 that[methodName] = function () { 39001 args = simplifyArray(Array.prototype.slice.call(arguments, 0)); 39002 ret = origMethod.apply(that, arguments); 39003 that._trace({ 39004 method: methodName, 39005 args: args, 39006 }); 39007 return ret; 39008 }; 39009 }; 39010 for (n = 0; n < len; n++) { 39011 func(CONTEXT_METHODS[n]); 39012 } 39013 that.setAttr = function () { 39014 origSetter.apply(that, arguments); 39015 const prop = arguments[0]; 39016 let val = arguments[1]; 39017 if (prop === 'shadowOffsetX' || 39018 prop === 'shadowOffsetY' || 39019 prop === 'shadowBlur') { 39020 val = val / this.canvas.getPixelRatio(); 39021 } 39022 that._trace({ 39023 property: prop, 39024 val: val, 39025 }); 39026 }; 39027 } 39028 _applyGlobalCompositeOperation(node) { 39029 const op = node.attrs.globalCompositeOperation; 39030 const def = !op || op === 'source-over'; 39031 if (!def) { 39032 this.setAttr('globalCompositeOperation', op); 39033 } 39034 } 39035} 39036Context$1.Context = Context; 39037CONTEXT_PROPERTIES.forEach(function (prop) { 39038 Object.defineProperty(Context.prototype, prop, { 39039 get() { 39040 return this._context[prop]; 39041 }, 39042 set(val) { 39043 this._context[prop] = val; 39044 }, 39045 }); 39046}); 39047class SceneContext extends Context { 39048 constructor(canvas, { willReadFrequently = false } = {}) { 39049 super(canvas); 39050 this._context = canvas._canvas.getContext('2d', { 39051 willReadFrequently, 39052 }); 39053 } 39054 _fillColor(shape) { 39055 const fill = shape.fill(); 39056 this.setAttr('fillStyle', fill); 39057 shape._fillFunc(this); 39058 } 39059 _fillPattern(shape) { 39060 this.setAttr('fillStyle', shape._getFillPattern()); 39061 shape._fillFunc(this); 39062 } 39063 _fillLinearGradient(shape) { 39064 const grd = shape._getLinearGradient(); 39065 if (grd) { 39066 this.setAttr('fillStyle', grd); 39067 shape._fillFunc(this); 39068 } 39069 } 39070 _fillRadialGradient(shape) { 39071 const grd = shape._getRadialGradient(); 39072 if (grd) { 39073 this.setAttr('fillStyle', grd); 39074 shape._fillFunc(this); 39075 } 39076 } 39077 _fill(shape) { 39078 const hasColor = shape.fill(), fillPriority = shape.getFillPriority(); 39079 if (hasColor && fillPriority === 'color') { 39080 this._fillColor(shape); 39081 return; 39082 } 39083 const hasPattern = shape.getFillPatternImage(); 39084 if (hasPattern && fillPriority === 'pattern') { 39085 this._fillPattern(shape); 39086 return; 39087 } 39088 const hasLinearGradient = shape.getFillLinearGradientColorStops(); 39089 if (hasLinearGradient && fillPriority === 'linear-gradient') { 39090 this._fillLinearGradient(shape); 39091 return; 39092 } 39093 const hasRadialGradient = shape.getFillRadialGradientColorStops(); 39094 if (hasRadialGradient && fillPriority === 'radial-gradient') { 39095 this._fillRadialGradient(shape); 39096 return; 39097 } 39098 if (hasColor) { 39099 this._fillColor(shape); 39100 } 39101 else if (hasPattern) { 39102 this._fillPattern(shape); 39103 } 39104 else if (hasLinearGradient) { 39105 this._fillLinearGradient(shape); 39106 } 39107 else if (hasRadialGradient) { 39108 this._fillRadialGradient(shape); 39109 } 39110 } 39111 _strokeLinearGradient(shape) { 39112 const start = shape.getStrokeLinearGradientStartPoint(), end = shape.getStrokeLinearGradientEndPoint(), colorStops = shape.getStrokeLinearGradientColorStops(), grd = this.createLinearGradient(start.x, start.y, end.x, end.y); 39113 if (colorStops) { 39114 for (let n = 0; n < colorStops.length; n += 2) { 39115 grd.addColorStop(colorStops[n], colorStops[n + 1]); 39116 } 39117 this.setAttr('strokeStyle', grd); 39118 } 39119 } 39120 _stroke(shape) { 39121 const dash = shape.dash(), strokeScaleEnabled = shape.getStrokeScaleEnabled(); 39122 if (shape.hasStroke()) { 39123 if (!strokeScaleEnabled) { 39124 this.save(); 39125 const pixelRatio = this.getCanvas().getPixelRatio(); 39126 this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); 39127 } 39128 this._applyLineCap(shape); 39129 if (dash && shape.dashEnabled()) { 39130 this.setLineDash(dash); 39131 this.setAttr('lineDashOffset', shape.dashOffset()); 39132 } 39133 this.setAttr('lineWidth', shape.strokeWidth()); 39134 if (!shape.getShadowForStrokeEnabled()) { 39135 this.setAttr('shadowColor', 'rgba(0,0,0,0)'); 39136 } 39137 const hasLinearGradient = shape.getStrokeLinearGradientColorStops(); 39138 if (hasLinearGradient) { 39139 this._strokeLinearGradient(shape); 39140 } 39141 else { 39142 this.setAttr('strokeStyle', shape.stroke()); 39143 } 39144 shape._strokeFunc(this); 39145 if (!strokeScaleEnabled) {
39146 this.restore(); 39147 } 39148 } 39149 } 39150 _applyShadow(shape) { 39151 var _a, _b, _c; 39152 const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : { 39153 x: 0, 39154 y: 0, 39155 }, scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio; 39156 this.setAttr('shadowColor', color); 39157 this.setAttr('shadowBlur', blur * Math.min(Math.abs(scaleX), Math.abs(scaleY))); 39158 this.setAttr('shadowOffsetX', offset.x * scaleX); 39159 this.setAttr('shadowOffsetY', offset.y * scaleY); 39160 } 39161} 39162Context$1.SceneContext = SceneContext; 39163class HitContext extends Context { 39164 constructor(canvas) { 39165 super(canvas); 39166 this._context = canvas._canvas.getContext('2d', { 39167 willReadFrequently: true, 39168 }); 39169 } 39170 _fill(shape) { 39171 this.save(); 39172 this.setAttr('fillStyle', shape.colorKey); 39173 shape._fillFuncHit(this); 39174 this.restore(); 39175 } 39176 strokeShape(shape) { 39177 if (shape.hasHitStroke()) { 39178 this._stroke(shape); 39179 } 39180 } 39181 _stroke(shape) { 39182 if (shape.hasHitStroke()) { 39183 const strokeScaleEnabled = shape.getStrokeScaleEnabled(); 39184 if (!strokeScaleEnabled) { 39185 this.save(); 39186 const pixelRatio = this.getCanvas().getPixelRatio(); 39187 this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); 39188 } 39189 this._applyLineCap(shape); 39190 const hitStrokeWidth = shape.hitStrokeWidth(); 39191 const strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth; 39192 this.setAttr('lineWidth', strokeWidth); 39193 this.setAttr('strokeStyle', shape.colorKey); 39194 shape._strokeFuncHit(this); 39195 if (!strokeScaleEnabled) { 39196 this.restore(); 39197 } 39198 } 39199 } 39200} 39201Context$1.HitContext = HitContext; 39202 39203Object.defineProperty(Canvas$1, "__esModule", { value: true }); 39204Canvas$1.HitCanvas = Canvas$1.SceneCanvas = Canvas$1.Canvas = void 0; 39205const Util_1$d = Util; 39206const Context_1 = Context$1; 39207const Global_1$n = Global; 39208let _pixelRatio; 39209function getDevicePixelRatio() { 39210 if (_pixelRatio) { 39211 return _pixelRatio; 39212 } 39213 const canvas = Util_1$d.Util.createCanvasElement(); 39214 const context = canvas.getContext('2d'); 39215 _pixelRatio = (function () { 39216 const devicePixelRatio = Global_1$n.Konva._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio || 39217 context.mozBackingStorePixelRatio || 39218 context.msBackingStorePixelRatio || 39219 context.oBackingStorePixelRatio || 39220 context.backingStorePixelRatio || 39221 1; 39222 return devicePixelRatio / backingStoreRatio; 39223 })(); 39224 Util_1$d.Util.releaseCanvas(canvas); 39225 return _pixelRatio; 39226} 39227class Canvas { 39228 constructor(config) { 39229 this.pixelRatio = 1; 39230 this.width = 0; 39231 this.height = 0; 39232 this.isCache = false; 39233 const conf = config || {}; 39234 const pixelRatio = conf.pixelRatio || Global_1$n.Konva.pixelRatio || getDevicePixelRatio(); 39235 this.pixelRatio = pixelRatio; 39236 this._canvas = Util_1$d.Util.createCanvasElement(); 39237 this._canvas.style.padding = '0'; 39238 this._canvas.style.margin = '0'; 39239 this._canvas.style.border = '0'; 39240 this._canvas.style.background = 'transparent'; 39241 this._canvas.style.position = 'absolute'; 39242 this._canvas.style.top = '0'; 39243 this._canvas.style.left = '0'; 39244 } 39245 getContext() { 39246 return this.context; 39247 } 39248 getPixelRatio() { 39249 return this.pixelRatio; 39250 } 39251 setPixelRatio(pixelRatio) { 39252 const previousRatio = this.pixelRatio; 39253 this.pixelRatio = pixelRatio; 39254 this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio); 39255 } 39256 setWidth(width) { 39257 this.width = this._canvas.width = width * this.pixelRatio; 39258 this._canvas.style.width = width + 'px'; 39259 const pixelRatio = this.pixelRatio, _context = this.getContext()._context; 39260 _context.scale(pixelRatio, pixelRatio); 39261 } 39262 setHeight(height) { 39263 this.height = this._canvas.height = height * this.pixelRatio; 39264 this._canvas.style.height = height + 'px'; 39265 const pixelRatio = this.pixelRatio, _context = this.getContext()._context; 39266 _context.scale(pixelRatio, pixelRatio); 39267 } 39268 getWidth() { 39269 return this.width; 39270 } 39271 getHeight() { 39272 return this.height; 39273 } 39274 setSize(width, height) { 39275 this.setWidth(width || 0);
39276 this.setHeight(height || 0); 39277 } 39278 toDataURL(mimeType, quality) { 39279 try { 39280 return this._canvas.toDataURL(mimeType, quality); 39281 } 39282 catch (e) { 39283 try { 39284 return this._canvas.toDataURL(); 39285 } 39286 catch (err) { 39287 Util_1$d.Util.error('Unable to get data URL. ' + 39288 err.message + 39289 ' For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.'); 39290 return ''; 39291 } 39292 } 39293 } 39294} 39295Canvas$1.Canvas = Canvas; 39296class SceneCanvas extends Canvas { 39297 constructor(config = { width: 0, height: 0, willReadFrequently: false }) { 39298 super(config); 39299 this.context = new Context_1.SceneContext(this, { 39300 willReadFrequently: config.willReadFrequently, 39301 }); 39302 this.setSize(config.width, config.height); 39303 } 39304} 39305Canvas$1.SceneCanvas = SceneCanvas; 39306class HitCanvas extends Canvas { 39307 constructor(config = { width: 0, height: 0 }) { 39308 super(config); 39309 this.hitCanvas = true; 39310 this.context = new Context_1.HitContext(this); 39311 this.setSize(config.width, config.height); 39312 } 39313} 39314Canvas$1.HitCanvas = HitCanvas; 39315 39316var DragAndDrop = {}; 39317 39318(function (exports) { 39319 Object.defineProperty(exports, "__esModule", { value: true }); 39320 exports.DD = void 0; 39321 const Global_1 = Global; 39322 const Util_1 = Util; 39323 exports.DD = { 39324 get isDragging() { 39325 let flag = false; 39326 exports.DD._dragElements.forEach((elem) => { 39327 if (elem.dragStatus === 'dragging') { 39328 flag = true; 39329 } 39330 }); 39331 return flag; 39332 }, 39333 justDragged: false, 39334 get node() { 39335 let node; 39336 exports.DD._dragElements.forEach((elem) => { 39337 node = elem.node;
39338 }); 39339 return node; 39340 }, 39341 _dragElements: new Map(), 39342 _drag(evt) { 39343 const nodesToFireEvents = []; 39344 exports.DD._dragElements.forEach((elem, key) => { 39345 const { node } = elem; 39346 const stage = node.getStage(); 39347 stage.setPointersPositions(evt); 39348 if (elem.pointerId === undefined) { 39349 elem.pointerId = Util_1.Util._getFirstPointerId(evt); 39350 } 39351 const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId); 39352 if (!pos) { 39353 return; 39354 } 39355 if (elem.dragStatus !== 'dragging') { 39356 const dragDistance = node.dragDistance(); 39357 const distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y)); 39358 if (distance < dragDistance) { 39359 return; 39360 } 39361 node.startDrag({ evt }); 39362 if (!node.isDragging()) { 39363 return; 39364 } 39365 } 39366 node._setDragPosition(evt, elem); 39367 nodesToFireEvents.push(node); 39368 }); 39369 nodesToFireEvents.forEach((node) => { 39370 node.fire('dragmove', { 39371 type: 'dragmove', 39372 target: node, 39373 evt: evt, 39374 }, true); 39375 }); 39376 }, 39377 _endDragBefore(evt) { 39378 const drawNodes = []; 39379 exports.DD._dragElements.forEach((elem) => { 39380 const { node } = elem; 39381 const stage = node.getStage(); 39382 if (evt) { 39383 stage.setPointersPositions(evt); 39384 } 39385 const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId); 39386 if (!pos) { 39387 return; 39388 } 39389 if (elem.dragStatus === 'dragging' || elem.dragStatus === 'stopped') { 39390 exports.DD.justDragged = true; 39391 Global_1.Konva._mouseListenClick = false; 39392 Global_1.Konva._touchListenClick = false; 39393 Global_1.Konva._pointerListenClick = false; 39394 elem.dragStatus = 'stopped'; 39395 } 39396 const drawNode = elem.node.getLayer() || 39397 (elem.node instanceof Global_1.Konva['Stage'] && elem.node); 39398 if (drawNode && drawNodes.indexOf(drawNode) === -1) { 39399 drawNodes.push(drawNode); 39400 } 39401 }); 39402 drawNodes.forEach((drawNode) => { 39403 drawNode.draw(); 39404 }); 39405 }, 39406 _endDragAfter(evt) { 39407 exports.DD._dragElements.forEach((elem, key) => { 39408 if (elem.dragStatus === 'stopped') { 39409 elem.node.fire('dragend', { 39410 type: 'dragend', 39411 target: elem.node, 39412 evt: evt, 39413 }, true); 39414 } 39415 if (elem.dragStatus !== 'dragging') { 39416 exports.DD._dragElements.delete(key); 39417 } 39418 }); 39419 }, 39420 }; 39421 if (Global_1.Konva.isBrowser) { 39422 window.addEventListener('mouseup', exports.DD._endDragBefore, true); 39423 window.addEventListener('touchend', exports.DD._endDragBefore, true); 39424 window.addEventListener('touchcancel', exports.DD._endDragBefore, true); 39425 window.addEventListener('mousemove', exports.DD._drag); 39426 window.addEventListener('touchmove', exports.DD._drag); 39427 window.addEventListener('mouseup', exports.DD._endDragAfter, false); 39428 window.addEventListener('touchend', exports.DD._endDragAfter, false); 39429 window.addEventListener('touchcancel', exports.DD._endDragAfter, false); 39430 } 39431} (DragAndDrop)); 39432 39433Object.defineProperty(Node$2, "__esModule", { value: true }); 39434Node$2.Node = void 0; 39435const Util_1$c = Util; 39436const Factory_1$y = Factory; 39437const Canvas_1$1 = Canvas$1; 39438const Global_1$m = Global; 39439const DragAndDrop_1 = DragAndDrop; 39440const Validators_1$x = Validators; 39441const ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER = 'mouseenter', MOUSELEAVE = 'mouseleave', SET = 'set', SHAPE = 'Shape', SPACE$1 = ' ', STAGE = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR$1 = [ 39442 'xChange.konva', 39443 'yChange.konva', 39444 'scaleXChange.konva', 39445 'scaleYChange.konva', 39446 'skewXChange.konva', 39447 'skewYChange.konva', 39448 'rotationChange.konva', 39449 'offsetXChange.konva', 39450 'offsetYChange.konva', 39451 'transformsEnabledChange.konva', 39452].join(SPACE$1); 39453let idCounter = 1; 39454let Node$1 = class Node { 39455 constructor(config) { 39456 this._id = idCounter++; 39457 this.eventListeners = {}; 39458 this.attrs = {}; 39459 this.index = 0; 39460 this._allEventListeners = null; 39461 this.parent = null; 39462 this._cache = new Map(); 39463 this._attachedDepsListeners = new Map();
39464 this._lastPos = null; 39465 this._batchingTransformChange = false; 39466 this._needClearTransformCache = false; 39467 this._filterUpToDate = false; 39468 this._isUnderCache = false; 39469 this._dragEventId = null; 39470 this._shouldFireChangeEvents = false; 39471 this.setAttrs(config); 39472 this._shouldFireChangeEvents = true; 39473 } 39474 hasChildren() { 39475 return false; 39476 } 39477 _clearCache(attr) { 39478 if ((attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM) && 39479 this._cache.get(attr)) { 39480 this._cache.get(attr).dirty = true; 39481 } 39482 else if (attr) { 39483 this._cache.delete(attr); 39484 } 39485 else { 39486 this._cache.clear(); 39487 } 39488 } 39489 _getCache(attr, privateGetter) { 39490 let cache = this._cache.get(attr); 39491 const isTransform = attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM; 39492 const invalid = cache === undefined || (isTransform && cache.dirty === true); 39493 if (invalid) { 39494 cache = privateGetter.call(this); 39495 this._cache.set(attr, cache); 39496 } 39497 return cache; 39498 } 39499 _calculate(name, deps, getter) { 39500 if (!this._attachedDepsListeners.get(name)) { 39501 const depsString = deps.map((dep) => dep + 'Change.konva').join(SPACE$1); 39502 this.on(depsString, () => { 39503 this._clearCache(name); 39504 }); 39505 this._attachedDepsListeners.set(name, true); 39506 } 39507 return this._getCache(name, getter); 39508 } 39509 _getCanvasCache() { 39510 return this._cache.get(CANVAS); 39511 } 39512 _clearSelfAndDescendantCache(attr) { 39513 this._clearCache(attr); 39514 if (attr === ABSOLUTE_TRANSFORM) { 39515 this.fire('absoluteTransformChange'); 39516 } 39517 } 39518 clearCache() { 39519 if (this._cache.has(CANVAS)) { 39520 const { scene, filter, hit } = this._cache.get(CANVAS); 39521 Util_1$c.Util.releaseCanvas(scene, filter, hit); 39522 this._cache.delete(CANVAS); 39523 } 39524 this._clearSelfAndDescendantCache(); 39525 this._requestDraw(); 39526 return this; 39527 } 39528 cache(config) { 39529 const conf = config || {}; 39530 let rect = {}; 39531 if (conf.x === undefined || 39532 conf.y === undefined || 39533 conf.width === undefined || 39534 conf.height === undefined) { 39535 rect = this.getClientRect({ 39536 skipTransform: true, 39537 relativeTo: this.getParent() || undefined, 39538 }); 39539 } 39540 let width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1; 39541 if (!width || !height) { 39542 Util_1$c.Util.error('Can not cache the node. Width or height of the node equals 0. Caching is skipped.'); 39543 return; 39544 } 39545 const extraPaddingX = Math.abs(Math.round(rect.x) - x) > 0.5 ? 1 : 0; 39546 const extraPaddingY = Math.abs(Math.round(rect.y) - y) > 0.5 ? 1 : 0; 39547 width += offset * 2 + extraPaddingX; 39548 height += offset * 2 + extraPaddingY; 39549 x -= offset; 39550 y -= offset; 39551 const cachedSceneCanvas = new Canvas_1$1.SceneCanvas({ 39552 pixelRatio: pixelRatio, 39553 width: width, 39554 height: height, 39555 }), cachedFilterCanvas = new Canvas_1$1.SceneCanvas({ 39556 pixelRatio: pixelRatio, 39557 width: 0, 39558 height: 0, 39559 willReadFrequently: true, 39560 }), cachedHitCanvas = new Canvas_1$1.HitCanvas({ 39561 pixelRatio: hitCanvasPixelRatio, 39562 width: width, 39563 height: height, 39564 }), sceneContext = cachedSceneCanvas.getContext(), hitContext = cachedHitCanvas.getContext(); 39565 cachedHitCanvas.isCache = true; 39566 cachedSceneCanvas.isCache = true; 39567 this._cache.delete(CANVAS); 39568 this._filterUpToDate = false; 39569 if (conf.imageSmoothingEnabled === false) {
39570 cachedSceneCanvas.getContext()._context.imageSmoothingEnabled = false; 39571 cachedFilterCanvas.getContext()._context.imageSmoothingEnabled = false; 39572 } 39573 sceneContext.save(); 39574 hitContext.save(); 39575 sceneContext.translate(-x, -y); 39576 hitContext.translate(-x, -y); 39577 this._isUnderCache = true; 39578 this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); 39579 this._clearSelfAndDescendantCache(ABSOLUTE_SCALE); 39580 this.drawScene(cachedSceneCanvas, this); 39581 this.drawHit(cachedHitCanvas, this); 39582 this._isUnderCache = false; 39583 sceneContext.restore(); 39584 hitContext.restore(); 39585 if (drawBorder) { 39586 sceneContext.save(); 39587 sceneContext.beginPath(); 39588 sceneContext.rect(0, 0, width, height); 39589 sceneContext.closePath(); 39590 sceneContext.setAttr('strokeStyle', 'red'); 39591 sceneContext.setAttr('lineWidth', 5); 39592 sceneContext.stroke(); 39593 sceneContext.restore(); 39594 } 39595 this._cache.set(CANVAS, { 39596 scene: cachedSceneCanvas, 39597 filter: cachedFilterCanvas, 39598 hit: cachedHitCanvas, 39599 x: x, 39600 y: y, 39601 }); 39602 this._requestDraw(); 39603 return this; 39604 } 39605 isCached() { 39606 return this._cache.has(CANVAS); 39607 } 39608 getClientRect(config) { 39609 throw new Error('abstract "getClientRect" method call'); 39610 } 39611 _transformedRect(rect, top) { 39612 const points = [ 39613 { x: rect.x, y: rect.y }, 39614 { x: rect.x + rect.width, y: rect.y }, 39615 { x: rect.x + rect.width, y: rect.y + rect.height }, 39616 { x: rect.x, y: rect.y + rect.height }, 39617 ]; 39618 let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity; 39619 const trans = this.getAbsoluteTransform(top); 39620 points.forEach(function (point) { 39621 const transformed = trans.point(point); 39622 if (minX === undefined) { 39623 minX = maxX = transformed.x; 39624 minY = maxY = transformed.y; 39625 } 39626 minX = Math.min(minX, transformed.x); 39627 minY = Math.min(minY, transformed.y); 39628 maxX = Math.max(maxX, transformed.x); 39629 maxY = Math.max(maxY, transformed.y); 39630 }); 39631 return { 39632 x: minX, 39633 y: minY, 39634 width: maxX - minX, 39635 height: maxY - minY, 39636 }; 39637 } 39638 _drawCachedSceneCanvas(context) { 39639 context.save(); 39640 context._applyOpacity(this); 39641 context._applyGlobalCompositeOperation(this); 39642 const canvasCache = this._getCanvasCache(); 39643 context.translate(canvasCache.x, canvasCache.y); 39644 const cacheCanvas = this._getCachedSceneCanvas(); 39645 const ratio = cacheCanvas.pixelRatio; 39646 context.drawImage(cacheCanvas._canvas, 0, 0, cacheCanvas.width / ratio, cacheCanvas.height / ratio); 39647 context.restore(); 39648 } 39649 _drawCachedHitCanvas(context) { 39650 const canvasCache = this._getCanvasCache(), hitCanvas = canvasCache.hit; 39651 context.save(); 39652 context.translate(canvasCache.x, canvasCache.y); 39653 context.drawImage(hitCanvas._canvas, 0, 0, hitCanvas.width / hitCanvas.pixelRatio, hitCanvas.height / hitCanvas.pixelRatio); 39654 context.restore(); 39655 } 39656 _getCachedSceneCanvas() { 39657 let filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter; 39658 if (filters) { 39659 if (!this._filterUpToDate) { 39660 const ratio = sceneCanvas.pixelRatio; 39661 filterCanvas.setSize(sceneCanvas.width / sceneCanvas.pixelRatio, sceneCanvas.height / sceneCanvas.pixelRatio); 39662 try { 39663 len = filters.length; 39664 filterContext.clear(); 39665 filterContext.drawImage(sceneCanvas._canvas, 0, 0, sceneCanvas.getWidth() / ratio, sceneCanvas.getHeight() / ratio); 39666 imageData = filterContext.getImageData(0, 0, filterCanvas.getWidth(), filterCanvas.getHeight()); 39667 for (n = 0; n < len; n++) {
39668 filter = filters[n]; 39669 if (typeof filter !== 'function') { 39670 Util_1$c.Util.error('Filter should be type of function, but got ' + 39671 typeof filter + 39672 ' instead. Please check correct filters'); 39673 continue; 39674 } 39675 filter.call(this, imageData); 39676 filterContext.putImageData(imageData, 0, 0); 39677 } 39678 } 39679 catch (e) { 39680 Util_1$c.Util.error('Unable to apply filter. ' + 39681 e.message + 39682 ' This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.'); 39683 } 39684 this._filterUpToDate = true; 39685 } 39686 return filterCanvas; 39687 } 39688 return sceneCanvas; 39689 } 39690 on(evtStr, handler) { 39691 this._cache && this._cache.delete(ALL_LISTENERS); 39692 if (arguments.length === 3) { 39693 return this._delegate.apply(this, arguments); 39694 } 39695 let events = evtStr.split(SPACE$1), len = events.length, n, event, parts, baseEvent, name; 39696 for (n = 0; n < len; n++) { 39697 event = events[n]; 39698 parts = event.split('.'); 39699 baseEvent = parts[0]; 39700 name = parts[1] || ''; 39701 if (!this.eventListeners[baseEvent]) { 39702 this.eventListeners[baseEvent] = []; 39703 } 39704 this.eventListeners[baseEvent].push({ 39705 name: name, 39706 handler: handler, 39707 }); 39708 } 39709 return this; 39710 } 39711 off(evtStr, callback) { 39712 let events = (evtStr || '').split(SPACE$1), len = events.length, n, t, event, parts, baseEvent, name; 39713 this._cache && this._cache.delete(ALL_LISTENERS); 39714 if (!evtStr) { 39715 for (t in this.eventListeners) { 39716 this._off(t); 39717 } 39718 } 39719 for (n = 0; n < len; n++) { 39720 event = events[n]; 39721 parts = event.split('.'); 39722 baseEvent = parts[0]; 39723 name = parts[1]; 39724 if (baseEvent) { 39725 if (this.eventListeners[baseEvent]) { 39726 this._off(baseEvent, name, callback); 39727 } 39728 } 39729 else { 39730 for (t in this.eventListeners) { 39731 this._off(t, name, callback); 39732 } 39733 } 39734 } 39735 return this; 39736 } 39737 dispatchEvent(evt) { 39738 const e = { 39739 target: this, 39740 type: evt.type, 39741 evt: evt, 39742 }; 39743 this.fire(evt.type, e); 39744 return this; 39745 } 39746 addEventListener(type, handler) { 39747 this.on(type, function (evt) { 39748 handler.call(this, evt.evt); 39749 }); 39750 return this; 39751 } 39752 removeEventListener(type) { 39753 this.off(type); 39754 return this; 39755 } 39756 _delegate(event, selector, handler) { 39757 const stopNode = this; 39758 this.on(event, function (evt) { 39759 const targets = evt.target.findAncestors(selector, true, stopNode); 39760 for (let i = 0; i < targets.length; i++) { 39761 evt = Util_1$c.Util.cloneObject(evt); 39762 evt.currentTarget = targets[i]; 39763 handler.call(targets[i], evt); 39764 } 39765 }); 39766 } 39767 remove() { 39768 if (this.isDragging()) {
39769 this.stopDrag(); 39770 } 39771 DragAndDrop_1.DD._dragElements.delete(this._id); 39772 this._remove(); 39773 return this; 39774 } 39775 _clearCaches() { 39776 this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); 39777 this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); 39778 this._clearSelfAndDescendantCache(ABSOLUTE_SCALE); 39779 this._clearSelfAndDescendantCache(STAGE); 39780 this._clearSelfAndDescendantCache(VISIBLE); 39781 this._clearSelfAndDescendantCache(LISTENING); 39782 } 39783 _remove() { 39784 this._clearCaches(); 39785 const parent = this.getParent(); 39786 if (parent && parent.children) { 39787 parent.children.splice(this.index, 1); 39788 parent._setChildrenIndices(); 39789 this.parent = null; 39790 } 39791 } 39792 destroy() { 39793 this.remove(); 39794 this.clearCache(); 39795 return this; 39796 } 39797 getAttr(attr) { 39798 const method = 'get' + Util_1$c.Util._capitalize(attr); 39799 if (Util_1$c.Util._isFunction(this[method])) { 39800 return this[method](); 39801 } 39802 return this.attrs[attr]; 39803 } 39804 getAncestors() { 39805 let parent = this.getParent(), ancestors = []; 39806 while (parent) { 39807 ancestors.push(parent); 39808 parent = parent.getParent(); 39809 } 39810 return ancestors; 39811 } 39812 getAttrs() { 39813 return (this.attrs || {}); 39814 } 39815 setAttrs(config) { 39816 this._batchTransformChanges(() => { 39817 let key, method; 39818 if (!config) { 39819 return this; 39820 } 39821 for (key in config) { 39822 if (key === CHILDREN) { 39823 continue; 39824 } 39825 method = SET + Util_1$c.Util._capitalize(key); 39826 if (Util_1$c.Util._isFunction(this[method])) { 39827 this[method](config[key]); 39828 } 39829 else { 39830 this._setAttr(key, config[key]); 39831 } 39832 } 39833 }); 39834 return this; 39835 } 39836 isListening() { 39837 return this._getCache(LISTENING, this._isListening); 39838 } 39839 _isListening(relativeTo) { 39840 const listening = this.listening(); 39841 if (!listening) { 39842 return false; 39843 } 39844 const parent = this.getParent(); 39845 if (parent && parent !== relativeTo && this !== relativeTo) { 39846 return parent._isListening(relativeTo); 39847 } 39848 else { 39849 return true; 39850 } 39851 } 39852 isVisible() { 39853 return this._getCache(VISIBLE, this._isVisible); 39854 } 39855 _isVisible(relativeTo) { 39856 const visible = this.visible(); 39857 if (!visible) { 39858 return false; 39859 } 39860 const parent = this.getParent(); 39861 if (parent && parent !== relativeTo && this !== relativeTo) { 39862 return parent._isVisible(relativeTo); 39863 } 39864 else { 39865 return true; 39866 } 39867 } 39868 shouldDrawHit(top, skipDragCheck = false) { 39869 if (top) { 39870 return this._isVisible(top) && this._isListening(top); 39871 } 39872 const layer = this.getLayer(); 39873 let layerUnderDrag = false; 39874 DragAndDrop_1.DD._dragElements.forEach((elem) => { 39875 if (elem.dragStatus !== 'dragging') { 39876 return; 39877 } 39878 else if (elem.node.nodeType === 'Stage') { 39879 layerUnderDrag = true; 39880 } 39881 else if (elem.node.getLayer() === layer) { 39882 layerUnderDrag = true; 39883 } 39884 }); 39885 const dragSkip = !skipDragCheck && 39886 !Global_1$m.Konva.hitOnDragEnabled && 39887 (layerUnderDrag || Global_1$m.Konva.isTransforming()); 39888 return this.isListening() && this.isVisible() && !dragSkip; 39889 } 39890 show() { 39891 this.visible(true); 39892 return this; 39893 } 39894 hide() { 39895 this.visible(false); 39896 return this; 39897 } 39898 getZIndex() { 39899 return this.index || 0; 39900 } 39901 getAbsoluteZIndex() { 39902 let depth = this.getDepth(), that = this, index = 0, nodes, len, n, child; 39903 function addChildren(children) { 39904 nodes = []; 39905 len = children.length; 39906 for (n = 0; n < len; n++) { 39907 child = children[n]; 39908 index++; 39909 if (child.nodeType !== SHAPE) { 39910 nodes = nodes.concat(child.getChildren().slice()); 39911 } 39912 if (child._id === that._id) { 39913 n = len; 39914 } 39915 } 39916 if (nodes.length > 0 && nodes[0].getDepth() <= depth) { 39917 addChildren(nodes); 39918 } 39919 }
39920 const stage = this.getStage(); 39921 if (that.nodeType !== UPPER_STAGE && stage) { 39922 addChildren(stage.getChildren()); 39923 } 39924 return index; 39925 } 39926 getDepth() { 39927 let depth = 0, parent = this.parent; 39928 while (parent) { 39929 depth++; 39930 parent = parent.parent; 39931 } 39932 return depth; 39933 } 39934 _batchTransformChanges(func) { 39935 this._batchingTransformChange = true; 39936 func(); 39937 this._batchingTransformChange = false; 39938 if (this._needClearTransformCache) { 39939 this._clearCache(TRANSFORM); 39940 this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); 39941 } 39942 this._needClearTransformCache = false; 39943 } 39944 setPosition(pos) { 39945 this._batchTransformChanges(() => { 39946 this.x(pos.x); 39947 this.y(pos.y); 39948 }); 39949 return this; 39950 } 39951 getPosition() { 39952 return { 39953 x: this.x(), 39954 y: this.y(), 39955 }; 39956 } 39957 getRelativePointerPosition() { 39958 const stage = this.getStage(); 39959 if (!stage) { 39960 return null; 39961 } 39962 const pos = stage.getPointerPosition(); 39963 if (!pos) { 39964 return null; 39965 } 39966 const transform = this.getAbsoluteTransform().copy(); 39967 transform.invert(); 39968 return transform.point(pos); 39969 } 39970 getAbsolutePosition(top) { 39971 let haveCachedParent = false; 39972 let parent = this.parent; 39973 while (parent) { 39974 if (parent.isCached()) { 39975 haveCachedParent = true; 39976 break; 39977 } 39978 parent = parent.parent; 39979 } 39980 if (haveCachedParent && !top) { 39981 top = true; 39982 } 39983 const absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Util_1$c.Transform(), offset = this.offset(); 39984 absoluteTransform.m = absoluteMatrix.slice(); 39985 absoluteTransform.translate(offset.x, offset.y); 39986 return absoluteTransform.getTranslation(); 39987 } 39988 setAbsolutePosition(pos) { 39989 const { x, y, ...origTrans } = this._clearTransform(); 39990 this.attrs.x = x; 39991 this.attrs.y = y; 39992 this._clearCache(TRANSFORM); 39993 const it = this._getAbsoluteTransform().copy(); 39994 it.invert(); 39995 it.translate(pos.x, pos.y); 39996 pos = { 39997 x: this.attrs.x + it.getTranslation().x, 39998 y: this.attrs.y + it.getTranslation().y, 39999 }; 40000 this._setTransform(origTrans); 40001 this.setPosition({ x: pos.x, y: pos.y }); 40002 this._clearCache(TRANSFORM); 40003 this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); 40004 return this; 40005 } 40006 _setTransform(trans) { 40007 let key; 40008 for (key in trans) { 40009 this.attrs[key] = trans[key]; 40010 } 40011 } 40012 _clearTransform() { 40013 const trans = { 40014 x: this.x(), 40015 y: this.y(), 40016 rotation: this.rotation(), 40017 scaleX: this.scaleX(), 40018 scaleY: this.scaleY(), 40019 offsetX: this.offsetX(), 40020 offsetY: this.offsetY(), 40021 skewX: this.skewX(), 40022 skewY: this.skewY(), 40023 }; 40024 this.attrs.x = 0; 40025 this.attrs.y = 0; 40026 this.attrs.rotation = 0; 40027 this.attrs.scaleX = 1; 40028 this.attrs.scaleY = 1; 40029 this.attrs.offsetX = 0; 40030 this.attrs.offsetY = 0; 40031 this.attrs.skewX = 0; 40032 this.attrs.skewY = 0; 40033 return trans; 40034 } 40035 move(change) { 40036 let changeX = change.x, changeY = change.y, x = this.x(), y = this.y(); 40037 if (changeX !== undefined) { 40038 x += changeX; 40039 } 40040 if (changeY !== undefined) { 40041 y += changeY; 40042 } 40043 this.setPosition({ x: x, y: y }); 40044 return this; 40045 } 40046 _eachAncestorReverse(func, top) { 40047 let family = [], parent = this.getParent(), len, n; 40048 if (top && top._id === this._id) { 40049 return; 40050 } 40051 family.unshift(this); 40052 while (parent && (!top || parent._id !== top._id)) { 40053 family.unshift(parent); 40054 parent = parent.parent; 40055 } 40056 len = family.length; 40057 for (n = 0; n < len; n++) { 40058 func(family[n]); 40059 } 40060 } 40061 rotate(theta) { 40062 this.rotation(this.rotation() + theta); 40063 return this; 40064 } 40065 moveToTop() { 40066 if (!this.parent) { 40067 Util_1$c.Util.warn('Node has no parent. moveToTop function is ignored.'); 40068 return false;
40069 } 40070 const index = this.index, len = this.parent.getChildren().length; 40071 if (index < len - 1) { 40072 this.parent.children.splice(index, 1); 40073 this.parent.children.push(this); 40074 this.parent._setChildrenIndices(); 40075 return true; 40076 } 40077 return false; 40078 } 40079 moveUp() { 40080 if (!this.parent) { 40081 Util_1$c.Util.warn('Node has no parent. moveUp function is ignored.'); 40082 return false; 40083 } 40084 const index = this.index, len = this.parent.getChildren().length; 40085 if (index < len - 1) { 40086 this.parent.children.splice(index, 1); 40087 this.parent.children.splice(index + 1, 0, this); 40088 this.parent._setChildrenIndices(); 40089 return true; 40090 } 40091 return false; 40092 } 40093 moveDown() { 40094 if (!this.parent) { 40095 Util_1$c.Util.warn('Node has no parent. moveDown function is ignored.'); 40096 return false; 40097 } 40098 const index = this.index; 40099 if (index > 0) { 40100 this.parent.children.splice(index, 1); 40101 this.parent.children.splice(index - 1, 0, this); 40102 this.parent._setChildrenIndices(); 40103 return true; 40104 } 40105 return false; 40106 } 40107 moveToBottom() { 40108 if (!this.parent) { 40109 Util_1$c.Util.warn('Node has no parent. moveToBottom function is ignored.'); 40110 return false; 40111 } 40112 const index = this.index; 40113 if (index > 0) { 40114 this.parent.children.splice(index, 1); 40115 this.parent.children.unshift(this); 40116 this.parent._setChildrenIndices(); 40117 return true; 40118 } 40119 return false; 40120 } 40121 setZIndex(zIndex) { 40122 if (!this.parent) { 40123 Util_1$c.Util.warn('Node has no parent. zIndex parameter is ignored.'); 40124 return this; 40125 } 40126 if (zIndex < 0 || zIndex >= this.parent.children.length) { 40127 Util_1$c.Util.warn('Unexpected value ' + 40128 zIndex + 40129 ' for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to ' + 40130 (this.parent.children.length - 1) + 40131 '.'); 40132 } 40133 const index = this.index; 40134 this.parent.children.splice(index, 1); 40135 this.parent.children.splice(zIndex, 0, this); 40136 this.parent._setChildrenIndices(); 40137 return this; 40138 } 40139 getAbsoluteOpacity() { 40140 return this._getCache(ABSOLUTE_OPACITY, this._getAbsoluteOpacity); 40141 } 40142 _getAbsoluteOpacity() { 40143 let absOpacity = this.opacity(); 40144 const parent = this.getParent(); 40145 if (parent && !parent._isUnderCache) { 40146 absOpacity *= parent.getAbsoluteOpacity(); 40147 } 40148 return absOpacity; 40149 } 40150 moveTo(newContainer) { 40151 if (this.getParent() !== newContainer) { 40152 this._remove(); 40153 newContainer.add(this); 40154 } 40155 return this; 40156 } 40157 toObject() { 40158 let attrs = this.getAttrs(), key, val, getter, defaultValue, nonPlainObject; 40159 const obj = { 40160 attrs: {}, 40161 className: this.getClassName(), 40162 }; 40163 for (key in attrs) { 40164 val = attrs[key]; 40165 nonPlainObject = 40166 Util_1$c.Util.isObject(val) && !Util_1$c.Util._isPlainObject(val) && !Util_1$c.Util._isArray(val); 40167 if (nonPlainObject) { 40168 continue; 40169 } 40170 getter = typeof this[key] === 'function' && this[key]; 40171 delete attrs[key]; 40172 defaultValue = getter ? getter.call(this) : null; 40173 attrs[key] = val; 40174 if (defaultValue !== val) { 40175 obj.attrs[key] = val; 40176 } 40177 } 40178 return Util_1$c.Util._prepareToStringify(obj); 40179 } 40180 toJSON() { 40181 return JSON.stringify(this.toObject()); 40182 } 40183 getParent() { 40184 return this.parent; 40185 } 40186 findAncestors(selector, includeSelf, stopNode) { 40187 const res = []; 40188 if (includeSelf && this._isMatch(selector)) { 40189 res.push(this); 40190 } 40191 let ancestor = this.parent; 40192 while (ancestor) { 40193 if (ancestor === stopNode) { 40194 return res; 40195 } 40196 if (ancestor._isMatch(selector)) { 40197 res.push(ancestor); 40198 } 40199 ancestor = ancestor.parent; 40200 } 40201 return res; 40202 } 40203 isAncestorOf(node) { 40204 return false;
40205 } 40206 findAncestor(selector, includeSelf, stopNode) { 40207 return this.findAncestors(selector, includeSelf, stopNode)[0]; 40208 } 40209 _isMatch(selector) { 40210 if (!selector) { 40211 return false; 40212 } 40213 if (typeof selector === 'function') { 40214 return selector(this); 40215 } 40216 let selectorArr = selector.replace(/ /g, '').split(','), len = selectorArr.length, n, sel; 40217 for (n = 0; n < len; n++) { 40218 sel = selectorArr[n]; 40219 if (!Util_1$c.Util.isValidSelector(sel)) { 40220 Util_1$c.Util.warn('Selector "' + 40221 sel + 40222 '" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'); 40223 Util_1$c.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'); 40224 Util_1$c.Util.warn('Konva is awesome, right?'); 40225 } 40226 if (sel.charAt(0) === '#') { 40227 if (this.id() === sel.slice(1)) { 40228 return true; 40229 } 40230 } 40231 else if (sel.charAt(0) === '.') { 40232 if (this.hasName(sel.slice(1))) { 40233 return true; 40234 } 40235 } 40236 else if (this.className === sel || this.nodeType === sel) { 40237 return true; 40238 } 40239 } 40240 return false; 40241 } 40242 getLayer() { 40243 const parent = this.getParent(); 40244 return parent ? parent.getLayer() : null; 40245 } 40246 getStage() { 40247 return this._getCache(STAGE, this._getStage); 40248 } 40249 _getStage() { 40250 const parent = this.getParent(); 40251 if (parent) { 40252 return parent.getStage(); 40253 } 40254 else { 40255 return null; 40256 } 40257 } 40258 fire(eventType, evt = {}, bubble) { 40259 evt.target = evt.target || this; 40260 if (bubble) { 40261 this._fireAndBubble(eventType, evt); 40262 } 40263 else { 40264 this._fire(eventType, evt); 40265 } 40266 return this; 40267 } 40268 getAbsoluteTransform(top) { 40269 if (top) { 40270 return this._getAbsoluteTransform(top); 40271 } 40272 else { 40273 return this._getCache(ABSOLUTE_TRANSFORM, this._getAbsoluteTransform); 40274 } 40275 } 40276 _getAbsoluteTransform(top) { 40277 let at; 40278 if (top) { 40279 at = new Util_1$c.Transform(); 40280 this._eachAncestorReverse(function (node) { 40281 const transformsEnabled = node.transformsEnabled(); 40282 if (transformsEnabled === 'all') { 40283 at.multiply(node.getTransform()); 40284 } 40285 else if (transformsEnabled === 'position') { 40286 at.translate(node.x() - node.offsetX(), node.y() - node.offsetY()); 40287 } 40288 }, top); 40289 return at; 40290 } 40291 else { 40292 at = this._cache.get(ABSOLUTE_TRANSFORM) || new Util_1$c.Transform(); 40293 if (this.parent) { 40294 this.parent.getAbsoluteTransform().copyInto(at); 40295 } 40296 else { 40297 at.reset(); 40298 } 40299 const transformsEnabled = this.transformsEnabled(); 40300 if (transformsEnabled === 'all') { 40301 at.multiply(this.getTransform()); 40302 } 40303 else if (transformsEnabled === 'position') { 40304 const x = this.attrs.x || 0; 40305 const y = this.attrs.y || 0; 40306 const offsetX = this.attrs.offsetX || 0; 40307 const offsetY = this.attrs.offsetY || 0; 40308 at.translate(x - offsetX, y - offsetY); 40309 } 40310 at.dirty = false; 40311 return at; 40312 } 40313 } 40314 getAbsoluteScale(top) { 40315 let parent = this; 40316 while (parent) { 40317 if (parent._isUnderCache) { 40318 top = parent; 40319 } 40320 parent = parent.getParent(); 40321 } 40322 const transform = this.getAbsoluteTransform(top); 40323 const attrs = transform.decompose(); 40324 return { 40325 x: attrs.scaleX, 40326 y: attrs.scaleY, 40327 }; 40328 } 40329 getAbsoluteRotation() { 40330 return this.getAbsoluteTransform().decompose().rotation; 40331 } 40332 getTransform() { 40333 return this._getCache(TRANSFORM, this._getTransform); 40334 } 40335 _getTransform() { 40336 var _a, _b; 40337 const m = this._cache.get(TRANSFORM) || new Util_1$c.Transform(); 40338 m.reset(); 40339 const x = this.x(), y = this.y(), rotation = Global_1$m.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0; 40340 if (x !== 0 || y !== 0) { 40341 m.translate(x, y); 40342 } 40343 if (rotation !== 0) { 40344 m.rotate(rotation); 40345 }
40346 if (skewX !== 0 || skewY !== 0) { 40347 m.skew(skewX, skewY); 40348 } 40349 if (scaleX !== 1 || scaleY !== 1) { 40350 m.scale(scaleX, scaleY); 40351 } 40352 if (offsetX !== 0 || offsetY !== 0) { 40353 m.translate(-1 * offsetX, -1 * offsetY); 40354 } 40355 m.dirty = false; 40356 return m; 40357 } 40358 clone(obj) { 40359 let attrs = Util_1$c.Util.cloneObject(this.attrs), key, allListeners, len, n, listener; 40360 for (key in obj) { 40361 attrs[key] = obj[key]; 40362 } 40363 const node = new this.constructor(attrs); 40364 for (key in this.eventListeners) { 40365 allListeners = this.eventListeners[key]; 40366 len = allListeners.length; 40367 for (n = 0; n < len; n++) { 40368 listener = allListeners[n]; 40369 if (listener.name.indexOf(KONVA) < 0) { 40370 if (!node.eventListeners[key]) { 40371 node.eventListeners[key] = []; 40372 } 40373 node.eventListeners[key].push(listener); 40374 } 40375 } 40376 } 40377 return node; 40378 } 40379 _toKonvaCanvas(config) { 40380 config = config || {}; 40381 const box = this.getClientRect(); 40382 const stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new Canvas_1$1.SceneCanvas({ 40383 width: config.width || Math.ceil(box.width) || (stage ? stage.width() : 0), 40384 height: config.height || 40385 Math.ceil(box.height) || 40386 (stage ? stage.height() : 0), 40387 pixelRatio: pixelRatio, 40388 }), context = canvas.getContext(); 40389 const bufferCanvas = new Canvas_1$1.SceneCanvas({ 40390 width: canvas.width / canvas.pixelRatio + Math.abs(x), 40391 height: canvas.height / canvas.pixelRatio + Math.abs(y), 40392 pixelRatio: canvas.pixelRatio, 40393 }); 40394 if (config.imageSmoothingEnabled === false) { 40395 context._context.imageSmoothingEnabled = false; 40396 } 40397 context.save(); 40398 if (x || y) { 40399 context.translate(-1 * x, -1 * y); 40400 } 40401 this.drawScene(canvas, undefined, bufferCanvas); 40402 context.restore(); 40403 return canvas; 40404 } 40405 toCanvas(config) { 40406 return this._toKonvaCanvas(config)._canvas; 40407 } 40408 toDataURL(config) { 40409 config = config || {}; 40410 const mimeType = config.mimeType || null, quality = config.quality || null; 40411 const url = this._toKonvaCanvas(config).toDataURL(mimeType, quality); 40412 if (config.callback) { 40413 config.callback(url); 40414 } 40415 return url; 40416 } 40417 toImage(config) { 40418 return new Promise((resolve, reject) => { 40419 try { 40420 const callback = config === null || config === void 0 ? void 0 : config.callback; 40421 if (callback) 40422 delete config.callback; 40423 Util_1$c.Util._urlToImage(this.toDataURL(config), function (img) { 40424 resolve(img); 40425 callback === null || callback === void 0 ? void 0 : callback(img); 40426 }); 40427 } 40428 catch (err) { 40429 reject(err); 40430 } 40431 }); 40432 } 40433 toBlob(config) { 40434 return new Promise((resolve, reject) => { 40435 try { 40436 const callback = config === null || config === void 0 ? void 0 : config.callback; 40437 if (callback) 40438 delete config.callback; 40439 this.toCanvas(config).toBlob((blob) => { 40440 resolve(blob); 40441 callback === null || callback === void 0 ? void 0 : callback(blob); 40442 }, config === null || config === void 0 ? void 0 : config.mimeType, config === null || config === void 0 ? void 0 : config.quality); 40443 } 40444 catch (err) { 40445 reject(err); 40446 } 40447 }); 40448 } 40449 setSize(size) { 40450 this.width(size.width); 40451 this.height(size.height); 40452 return this; 40453 } 40454 getSize() { 40455 return { 40456 width: this.width(), 40457 height: this.height(), 40458 }; 40459 } 40460 getClassName() { 40461 return this.className || this.nodeType; 40462 } 40463 getType() { 40464 return this.nodeType; 40465 } 40466 getDragDistance() { 40467 if (this.attrs.dragDistance !== undefined) { 40468 return this.attrs.dragDistance; 40469 } 40470 else if (this.parent) { 40471 return this.parent.getDragDistance(); 40472 } 40473 else { 40474 return Global_1$m.Konva.dragDistance; 40475 } 40476 } 40477 _off(type, name, callback) { 40478 let evtListeners = this.eventListeners[type], i, evtName, handler; 40479 for (i = 0; i < evtListeners.length; i++) { 40480 evtName = evtListeners[i].name; 40481 handler = evtListeners[i].handler; 40482 if ((evtName !== 'konva' || name === 'konva') && 40483 (!name || evtName === name) && 40484 (!callback || callback === handler)) { 40485 evtListeners.splice(i, 1); 40486 if (evtListeners.length === 0) { 40487 delete this.eventListeners[type]; 40488 break; 40489 } 40490 i--; 40491 } 40492 } 40493 } 40494 _fireChangeEvent(attr, oldVal, newVal) { 40495 this._fire(attr + CHANGE, { 40496 oldVal: oldVal, 40497 newVal: newVal, 40498 }); 40499 } 40500 addName(name) { 40501 if (!this.hasName(name)) { 40502 const oldName = this.name(); 40503 const newName = oldName ? oldName + ' ' + name : name; 40504 this.name(newName); 40505 } 40506 return this; 40507 } 40508 hasName(name) { 40509 if (!name) { 40510 return false;
40511 } 40512 const fullName = this.name(); 40513 if (!fullName) { 40514 return false; 40515 } 40516 const names = (fullName || '').split(/\s/g); 40517 return names.indexOf(name) !== -1; 40518 } 40519 removeName(name) { 40520 const names = (this.name() || '').split(/\s/g); 40521 const index = names.indexOf(name); 40522 if (index !== -1) { 40523 names.splice(index, 1); 40524 this.name(names.join(' ')); 40525 } 40526 return this; 40527 } 40528 setAttr(attr, val) { 40529 const func = this[SET + Util_1$c.Util._capitalize(attr)]; 40530 if (Util_1$c.Util._isFunction(func)) { 40531 func.call(this, val); 40532 } 40533 else { 40534 this._setAttr(attr, val); 40535 } 40536 return this; 40537 } 40538 _requestDraw() { 40539 if (Global_1$m.Konva.autoDrawEnabled) { 40540 const drawNode = this.getLayer() || this.getStage(); 40541 drawNode === null || drawNode === void 0 ? void 0 : drawNode.batchDraw(); 40542 } 40543 } 40544 _setAttr(key, val) { 40545 const oldVal = this.attrs[key]; 40546 if (oldVal === val && !Util_1$c.Util.isObject(val)) { 40547 return; 40548 } 40549 if (val === undefined || val === null) { 40550 delete this.attrs[key]; 40551 } 40552 else { 40553 this.attrs[key] = val; 40554 } 40555 if (this._shouldFireChangeEvents) { 40556 this._fireChangeEvent(key, oldVal, val); 40557 } 40558 this._requestDraw(); 40559 } 40560 _setComponentAttr(key, component, val) { 40561 let oldVal; 40562 if (val !== undefined) { 40563 oldVal = this.attrs[key]; 40564 if (!oldVal) { 40565 this.attrs[key] = this.getAttr(key); 40566 } 40567 this.attrs[key][component] = val; 40568 this._fireChangeEvent(key, oldVal, val); 40569 } 40570 } 40571 _fireAndBubble(eventType, evt, compareShape) { 40572 if (evt && this.nodeType === SHAPE) { 40573 evt.target = this; 40574 } 40575 const shouldStop = (eventType === MOUSEENTER || eventType === MOUSELEAVE) && 40576 ((compareShape && 40577 (this === compareShape || 40578 (this.isAncestorOf && this.isAncestorOf(compareShape)))) || 40579 (this.nodeType === 'Stage' && !compareShape)); 40580 if (!shouldStop) { 40581 this._fire(eventType, evt); 40582 const stopBubble = (eventType === MOUSEENTER || eventType === MOUSELEAVE) && 40583 compareShape && 40584 compareShape.isAncestorOf && 40585 compareShape.isAncestorOf(this) && 40586 !compareShape.isAncestorOf(this.parent); 40587 if (((evt && !evt.cancelBubble) || !evt) && 40588 this.parent && 40589 this.parent.isListening() && 40590 !stopBubble) { 40591 if (compareShape && compareShape.parent) { 40592 this._fireAndBubble.call(this.parent, eventType, evt, compareShape); 40593 } 40594 else { 40595 this._fireAndBubble.call(this.parent, eventType, evt); 40596 } 40597 } 40598 } 40599 } 40600 _getProtoListeners(eventType) { 40601 var _a, _b, _c; 40602 const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !== void 0 ? _a : {}; 40603 let events = allListeners === null || allListeners === void 0 ? void 0 : allListeners[eventType]; 40604 if (events === undefined) { 40605 events = []; 40606 let obj = Object.getPrototypeOf(this); 40607 while (obj) { 40608 const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b === void 0 ? void 0 : _b[eventType]) !== null && _c !== void 0 ? _c : []; 40609 events.push(...hierarchyEvents); 40610 obj = Object.getPrototypeOf(obj); 40611 } 40612 allListeners[eventType] = events; 40613 this._cache.set(ALL_LISTENERS, allListeners); 40614 } 40615 return events; 40616 } 40617 _fire(eventType, evt) { 40618 evt = evt || {}; 40619 evt.currentTarget = this; 40620 evt.type = eventType; 40621 const topListeners = this._getProtoListeners(eventType); 40622 if (topListeners) { 40623 for (var i = 0; i < topListeners.length; i++) { 40624 topListeners[i].handler.call(this, evt); 40625 } 40626 } 40627 const selfListeners = this.eventListeners[eventType]; 40628 if (selfListeners) { 40629 for (var i = 0; i < selfListeners.length; i++) { 40630 selfListeners[i].handler.call(this, evt); 40631 } 40632 } 40633 } 40634 draw() { 40635 this.drawScene(); 40636 this.drawHit(); 40637 return this; 40638 } 40639 _createDragElement(evt) { 40640 const pointerId = evt ? evt.pointerId : undefined;
40641 const stage = this.getStage(); 40642 const ap = this.getAbsolutePosition(); 40643 if (!stage) { 40644 return; 40645 } 40646 const pos = stage._getPointerById(pointerId) || 40647 stage._changedPointerPositions[0] || 40648 ap; 40649 DragAndDrop_1.DD._dragElements.set(this._id, { 40650 node: this, 40651 startPointerPos: pos, 40652 offset: { 40653 x: pos.x - ap.x, 40654 y: pos.y - ap.y, 40655 }, 40656 dragStatus: 'ready', 40657 pointerId, 40658 }); 40659 } 40660 startDrag(evt, bubbleEvent = true) { 40661 if (!DragAndDrop_1.DD._dragElements.has(this._id)) { 40662 this._createDragElement(evt); 40663 } 40664 const elem = DragAndDrop_1.DD._dragElements.get(this._id); 40665 elem.dragStatus = 'dragging'; 40666 this.fire('dragstart', { 40667 type: 'dragstart', 40668 target: this, 40669 evt: evt && evt.evt, 40670 }, bubbleEvent); 40671 } 40672 _setDragPosition(evt, elem) { 40673 const pos = this.getStage()._getPointerById(elem.pointerId); 40674 if (!pos) { 40675 return; 40676 } 40677 let newNodePos = { 40678 x: pos.x - elem.offset.x, 40679 y: pos.y - elem.offset.y, 40680 }; 40681 const dbf = this.dragBoundFunc(); 40682 if (dbf !== undefined) { 40683 const bounded = dbf.call(this, newNodePos, evt); 40684 if (!bounded) { 40685 Util_1$c.Util.warn('dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.'); 40686 } 40687 else { 40688 newNodePos = bounded; 40689 } 40690 } 40691 if (!this._lastPos || 40692 this._lastPos.x !== newNodePos.x || 40693 this._lastPos.y !== newNodePos.y) { 40694 this.setAbsolutePosition(newNodePos); 40695 this._requestDraw(); 40696 } 40697 this._lastPos = newNodePos; 40698 } 40699 stopDrag(evt) { 40700 const elem = DragAndDrop_1.DD._dragElements.get(this._id); 40701 if (elem) { 40702 elem.dragStatus = 'stopped'; 40703 } 40704 DragAndDrop_1.DD._endDragBefore(evt); 40705 DragAndDrop_1.DD._endDragAfter(evt); 40706 } 40707 setDraggable(draggable) { 40708 this._setAttr('draggable', draggable); 40709 this._dragChange(); 40710 } 40711 isDragging() { 40712 const elem = DragAndDrop_1.DD._dragElements.get(this._id); 40713 return elem ? elem.dragStatus === 'dragging' : false; 40714 } 40715 _listenDrag() { 40716 this._dragCleanup(); 40717 this.on('mousedown.konva touchstart.konva', function (evt) { 40718 const shouldCheckButton = evt.evt['button'] !== undefined; 40719 const canDrag = !shouldCheckButton || Global_1$m.Konva.dragButtons.indexOf(evt.evt['button']) >= 0; 40720 if (!canDrag) { 40721 return; 40722 } 40723 if (this.isDragging()) { 40724 return; 40725 } 40726 let hasDraggingChild = false; 40727 DragAndDrop_1.DD._dragElements.forEach((elem) => { 40728 if (this.isAncestorOf(elem.node)) { 40729 hasDraggingChild = true; 40730 } 40731 }); 40732 if (!hasDraggingChild) { 40733 this._createDragElement(evt); 40734 } 40735 }); 40736 } 40737 _dragChange() { 40738 if (this.attrs.draggable) { 40739 this._listenDrag(); 40740 } 40741 else { 40742 this._dragCleanup(); 40743 const stage = this.getStage(); 40744 if (!stage) { 40745 return; 40746 } 40747 const dragElement = DragAndDrop_1.DD._dragElements.get(this._id); 40748 const isDragging = dragElement && dragElement.dragStatus === 'dragging'; 40749 const isReady = dragElement && dragElement.dragStatus === 'ready'; 40750 if (isDragging) {
40751 this.stopDrag(); 40752 } 40753 else if (isReady) { 40754 DragAndDrop_1.DD._dragElements.delete(this._id); 40755 } 40756 } 40757 } 40758 _dragCleanup() { 40759 this.off('mousedown.konva'); 40760 this.off('touchstart.konva'); 40761 } 40762 isClientRectOnScreen(margin = { x: 0, y: 0 }) { 40763 const stage = this.getStage(); 40764 if (!stage) { 40765 return false; 40766 } 40767 const screenRect = { 40768 x: -margin.x, 40769 y: -margin.y, 40770 width: stage.width() + 2 * margin.x, 40771 height: stage.height() + 2 * margin.y, 40772 }; 40773 return Util_1$c.Util.haveIntersection(screenRect, this.getClientRect()); 40774 } 40775 static create(data, container) { 40776 if (Util_1$c.Util._isString(data)) { 40777 data = JSON.parse(data); 40778 } 40779 return this._createNode(data, container); 40780 } 40781 static _createNode(obj, container) { 40782 let className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n; 40783 if (container) { 40784 obj.attrs.container = container; 40785 } 40786 if (!Global_1$m.Konva[className]) { 40787 Util_1$c.Util.warn('Can not find a node with class name "' + 40788 className + 40789 '". Fallback to "Shape".'); 40790 className = 'Shape'; 40791 } 40792 const Class = Global_1$m.Konva[className]; 40793 no = new Class(obj.attrs); 40794 if (children) { 40795 len = children.length; 40796 for (n = 0; n < len; n++) { 40797 no.add(Node._createNode(children[n])); 40798 } 40799 } 40800 return no; 40801 } 40802}; 40803Node$2.Node = Node$1; 40804Node$1.prototype.nodeType = 'Node'; 40805Node$1.prototype._attrsAffectingSize = []; 40806Node$1.prototype.eventListeners = {}; 40807Node$1.prototype.on.call(Node$1.prototype, TRANSFORM_CHANGE_STR$1, function () { 40808 if (this._batchingTransformChange) { 40809 this._needClearTransformCache = true; 40810 return; 40811 } 40812 this._clearCache(TRANSFORM); 40813 this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM); 40814}); 40815Node$1.prototype.on.call(Node$1.prototype, 'visibleChange.konva', function () { 40816 this._clearSelfAndDescendantCache(VISIBLE); 40817}); 40818Node$1.prototype.on.call(Node$1.prototype, 'listeningChange.konva', function () { 40819 this._clearSelfAndDescendantCache(LISTENING); 40820}); 40821Node$1.prototype.on.call(Node$1.prototype, 'opacityChange.konva', function () { 40822 this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY); 40823}); 40824const addGetterSetter = Factory_1$y.Factory.addGetterSetter; 40825addGetterSetter(Node$1, 'zIndex'); 40826addGetterSetter(Node$1, 'absolutePosition'); 40827addGetterSetter(Node$1, 'position'); 40828addGetterSetter(Node$1, 'x', 0, (0, Validators_1$x.getNumberValidator)()); 40829addGetterSetter(Node$1, 'y', 0, (0, Validators_1$x.getNumberValidator)()); 40830addGetterSetter(Node$1, 'globalCompositeOperation', 'source-over', (0, Validators_1$x.getStringValidator)()); 40831addGetterSetter(Node$1, 'opacity', 1, (0, Validators_1$x.getNumberValidator)()); 40832addGetterSetter(Node$1, 'name', '', (0, Validators_1$x.getStringValidator)()); 40833addGetterSetter(Node$1, 'id', '', (0, Validators_1$x.getStringValidator)()); 40834addGetterSetter(Node$1, 'rotation', 0, (0, Validators_1$x.getNumberValidator)()); 40835Factory_1$y.Factory.addComponentsGetterSetter(Node$1, 'scale', ['x', 'y']); 40836addGetterSetter(Node$1, 'scaleX', 1, (0, Validators_1$x.getNumberValidator)()); 40837addGetterSetter(Node$1, 'scaleY', 1, (0, Validators_1$x.getNumberValidator)()); 40838Factory_1$y.Factory.addComponentsGetterSetter(Node$1, 'skew', ['x', 'y']); 40839addGetterSetter(Node$1, 'skewX', 0, (0, Validators_1$x.getNumberValidator)()); 40840addGetterSetter(Node$1, 'skewY', 0, (0, Validators_1$x.getNumberValidator)()); 40841Factory_1$y.Factory.addComponentsGetterSetter(Node$1, 'offset', ['x', 'y']); 40842addGetterSetter(Node$1, 'offsetX', 0, (0, Validators_1$x.getNumberValidator)()); 40843addGetterSetter(Node$1, 'offsetY', 0, (0, Validators_1$x.getNumberValidator)()); 40844addGetterSetter(Node$1, 'dragDistance', undefined, (0, Validators_1$x.getNumberValidator)()); 40845addGetterSetter(Node$1, 'width', 0, (0, Validators_1$x.getNumberValidator)()); 40846addGetterSetter(Node$1, 'height', 0, (0, Validators_1$x.getNumberValidator)()); 40847addGetterSetter(Node$1, 'listening', true, (0, Validators_1$x.getBooleanValidator)()); 40848addGetterSetter(Node$1, 'preventDefault', true, (0, Validators_1$x.getBooleanValidator)()); 40849addGetterSetter(Node$1, 'filters', undefined, function (val) { 40850 this._filterUpToDate = false;
40851 return val; 40852}); 40853addGetterSetter(Node$1, 'visible', true, (0, Validators_1$x.getBooleanValidator)()); 40854addGetterSetter(Node$1, 'transformsEnabled', 'all', (0, Validators_1$x.getStringValidator)()); 40855addGetterSetter(Node$1, 'size'); 40856addGetterSetter(Node$1, 'dragBoundFunc'); 40857addGetterSetter(Node$1, 'draggable', false, (0, Validators_1$x.getBooleanValidator)()); 40858Factory_1$y.Factory.backCompat(Node$1, { 40859 rotateDeg: 'rotate', 40860 setRotationDeg: 'setRotation', 40861 getRotationDeg: 'getRotation', 40862}); 40863 40864var Container$1 = {}; 40865 40866Object.defineProperty(Container$1, "__esModule", { value: true }); 40867Container$1.Container = void 0; 40868const Factory_1$x = Factory; 40869const Node_1$h = Node$2; 40870const Validators_1$w = Validators; 40871class Container extends Node_1$h.Node { 40872 constructor() { 40873 super(...arguments); 40874 this.children = []; 40875 } 40876 getChildren(filterFunc) { 40877 if (!filterFunc) { 40878 return this.children || []; 40879 } 40880 const children = this.children || []; 40881 const results = []; 40882 children.forEach(function (child) { 40883 if (filterFunc(child)) { 40884 results.push(child); 40885 } 40886 }); 40887 return results; 40888 } 40889 hasChildren() { 40890 return this.getChildren().length > 0; 40891 } 40892 removeChildren() {
vendor: 2,550 bytes, lines 40893-40986
40893 this.getChildren().forEach((child) => { 40894 child.parent = null; 40895 child.index = 0; 40896 child.remove(); 40897 }); 40898 this.children = []; 40899 this._requestDraw(); 40900 return this; 40901 } 40902 destroyChildren() { 40903 this.getChildren().forEach((child) => { 40904 child.parent = null; 40905 child.index = 0; 40906 child.destroy(); 40907 }); 40908 this.children = []; 40909 this._requestDraw(); 40910 return this; 40911 } 40912 add(...children) { 40913 if (children.length === 0) { 40914 return this; 40915 } 40916 if (children.length > 1) { 40917 for (let i = 0; i < children.length; i++) { 40918 this.add(children[i]); 40919 } 40920 return this; 40921 } 40922 const child = children[0]; 40923 if (child.getParent()) { 40924 child.moveTo(this); 40925 return this; 40926 } 40927 this._validateAdd(child); 40928 child.index = this.getChildren().length; 40929 child.parent = this; 40930 child._clearCaches(); 40931 this.getChildren().push(child); 40932 this._fire('add', { 40933 child: child, 40934 }); 40935 this._requestDraw(); 40936 return this; 40937 } 40938 destroy() { 40939 if (this.hasChildren()) { 40940 this.destroyChildren(); 40941 } 40942 super.destroy(); 40943 return this; 40944 } 40945 find(selector) { 40946 return this._generalFind(selector, false); 40947 } 40948 findOne(selector) { 40949 const result = this._generalFind(selector, true); 40950 return result.length > 0 ? result[0] : undefined; 40951 } 40952 _generalFind(selector, findOne) { 40953 const retArr = []; 40954 this._descendants((node) => { 40955 const valid = node._isMatch(selector); 40956 if (valid) { 40957 retArr.push(node); 40958 } 40959 if (valid && findOne) { 40960 return true; 40961 } 40962 return false; 40963 }); 40964 return retArr; 40965 } 40966 _descendants(fn) { 40967 let shouldStop = false; 40968 const children = this.getChildren(); 40969 for (const child of children) { 40970 shouldStop = fn(child); 40971 if (shouldStop) { 40972 return true; 40973 } 40974 if (!child.hasChildren()) { 40975 continue; 40976 } 40977 shouldStop = child._descendants(fn); 40978 if (shouldStop) { 40979 return true; 40980 } 40981 } 40982 return false; 40983 } 40984 toObject() { 40985 const obj = Node_1$h.Node.prototype.toObject.call(this); 40986 obj.children = [];
40987 this.getChildren().forEach((child) => { 40988 obj.children.push(child.toObject()); 40989 }); 40990 return obj; 40991 } 40992 isAncestorOf(node) { 40993 let parent = node.getParent(); 40994 while (parent) { 40995 if (parent._id === this._id) { 40996 return true; 40997 } 40998 parent = parent.getParent(); 40999 } 41000 return false; 41001 } 41002 clone(obj) { 41003 const node = Node_1$h.Node.prototype.clone.call(this, obj); 41004 this.getChildren().forEach(function (no) { 41005 node.add(no.clone()); 41006 }); 41007 return node; 41008 } 41009 getAllIntersections(pos) { 41010 const arr = []; 41011 this.find('Shape').forEach((shape) => { 41012 if (shape.isVisible() && shape.intersects(pos)) { 41013 arr.push(shape); 41014 } 41015 }); 41016 return arr; 41017 } 41018 _clearSelfAndDescendantCache(attr) { 41019 var _a; 41020 super._clearSelfAndDescendantCache(attr); 41021 if (this.isCached()) { 41022 return; 41023 } 41024 (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (node) { 41025 node._clearSelfAndDescendantCache(attr); 41026 }); 41027 } 41028 _setChildrenIndices() { 41029 var _a; 41030 (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child, n) { 41031 child.index = n; 41032 }); 41033 this._requestDraw(); 41034 } 41035 drawScene(can, top, bufferCanvas) { 41036 const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene; 41037 const caching = canvas && canvas.isCache; 41038 if (!this.isVisible() && !caching) { 41039 return this; 41040 } 41041 if (cachedSceneCanvas) { 41042 context.save(); 41043 const m = this.getAbsoluteTransform(top).getMatrix(); 41044 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 41045 this._drawCachedSceneCanvas(context); 41046 context.restore(); 41047 } 41048 else { 41049 this._drawChildren('drawScene', canvas, top, bufferCanvas); 41050 } 41051 return this; 41052 } 41053 drawHit(can, top) { 41054 if (!this.shouldDrawHit(top)) { 41055 return this; 41056 } 41057 const layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit; 41058 if (cachedHitCanvas) { 41059 context.save(); 41060 const m = this.getAbsoluteTransform(top).getMatrix(); 41061 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 41062 this._drawCachedHitCanvas(context); 41063 context.restore(); 41064 } 41065 else { 41066 this._drawChildren('drawHit', canvas, top); 41067 } 41068 return this; 41069 } 41070 _drawChildren(drawMethod, canvas, top, bufferCanvas) { 41071 var _a; 41072 const context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = (typeof clipWidth === 'number' && typeof clipHeight === 'number') || 41073 clipFunc; 41074 const selfCache = top === this; 41075 if (hasClip) { 41076 context.save(); 41077 const transform = this.getAbsoluteTransform(top); 41078 let m = transform.getMatrix(); 41079 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 41080 context.beginPath(); 41081 let clipArgs; 41082 if (clipFunc) { 41083 clipArgs = clipFunc.call(this, context, this); 41084 } 41085 else { 41086 const clipX = this.clipX(); 41087 const clipY = this.clipY(); 41088 context.rect(clipX || 0, clipY || 0, clipWidth, clipHeight); 41089 } 41090 context.clip.apply(context, clipArgs); 41091 m = transform.copy().invert().getMatrix(); 41092 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 41093 } 41094 const hasComposition = !selfCache && 41095 this.globalCompositeOperation() !== 'source-over' && 41096 drawMethod === 'drawScene'; 41097 if (hasComposition) { 41098 context.save(); 41099 context._applyGlobalCompositeOperation(this); 41100 } 41101 (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { 41102 child[drawMethod](canvas, top, bufferCanvas); 41103 }); 41104 if (hasComposition) {
41105 context.restore(); 41106 } 41107 if (hasClip) { 41108 context.restore(); 41109 } 41110 } 41111 getClientRect(config = {}) { 41112 var _a; 41113 const skipTransform = config.skipTransform; 41114 const relativeTo = config.relativeTo; 41115 let minX, minY, maxX, maxY; 41116 let selfRect = { 41117 x: Infinity, 41118 y: Infinity, 41119 width: 0, 41120 height: 0, 41121 }; 41122 const that = this; 41123 (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { 41124 if (!child.visible()) { 41125 return; 41126 } 41127 const rect = child.getClientRect({ 41128 relativeTo: that, 41129 skipShadow: config.skipShadow, 41130 skipStroke: config.skipStroke, 41131 }); 41132 if (rect.width === 0 && rect.height === 0) { 41133 return; 41134 } 41135 if (minX === undefined) { 41136 minX = rect.x; 41137 minY = rect.y; 41138 maxX = rect.x + rect.width; 41139 maxY = rect.y + rect.height; 41140 } 41141 else { 41142 minX = Math.min(minX, rect.x); 41143 minY = Math.min(minY, rect.y); 41144 maxX = Math.max(maxX, rect.x + rect.width); 41145 maxY = Math.max(maxY, rect.y + rect.height); 41146 } 41147 }); 41148 const shapes = this.find('Shape'); 41149 let hasVisible = false; 41150 for (let i = 0; i < shapes.length; i++) { 41151 const shape = shapes[i]; 41152 if (shape._isVisible(this)) { 41153 hasVisible = true; 41154 break; 41155 } 41156 } 41157 if (hasVisible && minX !== undefined) { 41158 selfRect = { 41159 x: minX, 41160 y: minY, 41161 width: maxX - minX, 41162 height: maxY - minY, 41163 }; 41164 } 41165 else { 41166 selfRect = { 41167 x: 0, 41168 y: 0, 41169 width: 0, 41170 height: 0, 41171 }; 41172 } 41173 if (!skipTransform) { 41174 return this._transformedRect(selfRect, relativeTo); 41175 } 41176 return selfRect; 41177 } 41178} 41179Container$1.Container = Container; 41180Factory_1$x.Factory.addComponentsGetterSetter(Container, 'clip', [ 41181 'x', 41182 'y', 41183 'width', 41184 'height', 41185]); 41186Factory_1$x.Factory.addGetterSetter(Container, 'clipX', undefined, (0, Validators_1$w.getNumberValidator)()); 41187Factory_1$x.Factory.addGetterSetter(Container, 'clipY', undefined, (0, Validators_1$w.getNumberValidator)()); 41188Factory_1$x.Factory.addGetterSetter(Container, 'clipWidth', undefined, (0, Validators_1$w.getNumberValidator)()); 41189Factory_1$x.Factory.addGetterSetter(Container, 'clipHeight', undefined, (0, Validators_1$w.getNumberValidator)()); 41190Factory_1$x.Factory.addGetterSetter(Container, 'clipFunc'); 41191 41192var Stage$1 = {}; 41193 41194var PointerEvents = {}; 41195 41196Object.defineProperty(PointerEvents, "__esModule", { value: true }); 41197PointerEvents.getCapturedShape = getCapturedShape; 41198PointerEvents.createEvent = createEvent; 41199PointerEvents.hasPointerCapture = hasPointerCapture; 41200PointerEvents.setPointerCapture = setPointerCapture; 41201PointerEvents.releaseCapture = releaseCapture; 41202const Global_1$l = Global; 41203const Captures = new Map(); 41204const SUPPORT_POINTER_EVENTS = Global_1$l.Konva._global['PointerEvent'] !== undefined; 41205function getCapturedShape(pointerId) { 41206 return Captures.get(pointerId); 41207} 41208function createEvent(evt) { 41209 return { 41210 evt, 41211 pointerId: evt.pointerId, 41212 }; 41213} 41214function hasPointerCapture(pointerId, shape) { 41215 return Captures.get(pointerId) === shape; 41216} 41217function setPointerCapture(pointerId, shape) { 41218 releaseCapture(pointerId); 41219 const stage = shape.getStage(); 41220 if (!stage) 41221 return; 41222 Captures.set(pointerId, shape); 41223 if (SUPPORT_POINTER_EVENTS) { 41224 shape._fire('gotpointercapture', createEvent(new PointerEvent('gotpointercapture'))); 41225 } 41226} 41227function releaseCapture(pointerId, target) { 41228 const shape = Captures.get(pointerId); 41229 if (!shape) 41230 return; 41231 const stage = shape.getStage(); 41232 if (stage && stage.content) ; 41233 Captures.delete(pointerId); 41234 if (SUPPORT_POINTER_EVENTS) { 41235 shape._fire('lostpointercapture', createEvent(new PointerEvent('lostpointercapture'))); 41236 } 41237} 41238 41239(function (exports) { 41240 Object.defineProperty(exports, "__esModule", { value: true }); 41241 exports.Stage = exports.stages = void 0; 41242 const Util_1 = Util; 41243 const Factory_1 = Factory; 41244 const Container_1 = Container$1; 41245 const Global_1 = Global; 41246 const Canvas_1 = Canvas$1; 41247 const DragAndDrop_1 = DragAndDrop; 41248 const Global_2 = Global; 41249 const PointerEvents$1 = PointerEvents; 41250 const STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [ 41251 [MOUSEENTER, '_pointerenter'], 41252 [MOUSEDOWN, '_pointerdown'], 41253 [MOUSEMOVE, '_pointermove'], 41254 [MOUSEUP, '_pointerup'], 41255 [MOUSELEAVE, '_pointerleave'], 41256 [TOUCHSTART, '_pointerdown'], 41257 [TOUCHMOVE, '_pointermove'], 41258 [TOUCHEND, '_pointerup'], 41259 [TOUCHCANCEL, '_pointercancel'], 41260 [MOUSEOVER, '_pointerover'], 41261 [WHEEL, '_wheel'], 41262 [CONTEXTMENU, '_contextmenu'], 41263 [POINTERDOWN, '_pointerdown'], 41264 [POINTERMOVE, '_pointermove'], 41265 [POINTERUP, '_pointerup'], 41266 [POINTERCANCEL, '_pointercancel'], 41267 [LOSTPOINTERCAPTURE, '_lostpointercapture'], 41268 ]; 41269 const EVENTS_MAP = { 41270 mouse: { 41271 [POINTEROUT]: MOUSEOUT, 41272 [POINTERLEAVE]: MOUSELEAVE, 41273 [POINTEROVER]: MOUSEOVER, 41274 [POINTERENTER]: MOUSEENTER, 41275 [POINTERMOVE]: MOUSEMOVE, 41276 [POINTERDOWN]: MOUSEDOWN, 41277 [POINTERUP]: MOUSEUP, 41278 [POINTERCANCEL]: 'mousecancel', 41279 pointerclick: 'click', 41280 pointerdblclick: 'dblclick', 41281 }, 41282 touch: { 41283 [POINTEROUT]: 'touchout', 41284 [POINTERLEAVE]: 'touchleave', 41285 [POINTEROVER]: 'touchover', 41286 [POINTERENTER]: 'touchenter', 41287 [POINTERMOVE]: TOUCHMOVE, 41288 [POINTERDOWN]: TOUCHSTART, 41289 [POINTERUP]: TOUCHEND, 41290 [POINTERCANCEL]: TOUCHCANCEL, 41291 pointerclick: 'tap', 41292 pointerdblclick: 'dbltap', 41293 }, 41294 pointer: { 41295 [POINTEROUT]: POINTEROUT, 41296 [POINTERLEAVE]: POINTERLEAVE, 41297 [POINTEROVER]: POINTEROVER, 41298 [POINTERENTER]: POINTERENTER, 41299 [POINTERMOVE]: POINTERMOVE, 41300 [POINTERDOWN]: POINTERDOWN, 41301 [POINTERUP]: POINTERUP, 41302 [POINTERCANCEL]: POINTERCANCEL, 41303 pointerclick: 'pointerclick', 41304 pointerdblclick: 'pointerdblclick', 41305 }, 41306 }; 41307 const getEventType = (type) => { 41308 if (type.indexOf('pointer') >= 0) { 41309 return 'pointer'; 41310 } 41311 if (type.indexOf('touch') >= 0) { 41312 return 'touch'; 41313 } 41314 return 'mouse'; 41315 }; 41316 const getEventsMap = (eventType) => { 41317 const type = getEventType(eventType); 41318 if (type === 'pointer') { 41319 return Global_1.Konva.pointerEventsEnabled && EVENTS_MAP.pointer; 41320 } 41321 if (type === 'touch') { 41322 return EVENTS_MAP.touch; 41323 } 41324 if (type === 'mouse') { 41325 return EVENTS_MAP.mouse; 41326 } 41327 }; 41328 function checkNoClip(attrs = {}) { 41329 if (attrs.clipFunc || attrs.clipWidth || attrs.clipHeight) { 41330 Util_1.Util.warn('Stage does not support clipping. Please use clip for Layers or Groups.'); 41331 } 41332 return attrs; 41333 } 41334 const NO_POINTERS_MESSAGE = `Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);`; 41335 exports.stages = []; 41336 class Stage extends Container_1.Container { 41337 constructor(config) { 41338 super(checkNoClip(config)); 41339 this._pointerPositions = []; 41340 this._changedPointerPositions = []; 41341 this._buildDOM(); 41342 this._bindContentEvents(); 41343 exports.stages.push(this); 41344 this.on('widthChange.konva heightChange.konva', this._resizeDOM); 41345 this.on('visibleChange.konva', this._checkVisibility); 41346 this.on('clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva', () => { 41347 checkNoClip(this.attrs); 41348 }); 41349 this._checkVisibility(); 41350 } 41351 _validateAdd(child) { 41352 const isLayer = child.getType() === 'Layer'; 41353 const isFastLayer = child.getType() === 'FastLayer'; 41354 const valid = isLayer || isFastLayer; 41355 if (!valid) { 41356 Util_1.Util.throw('You may only add layers to the stage.'); 41357 } 41358 } 41359 _checkVisibility() { 41360 if (!this.content) { 41361 return; 41362 } 41363 const style = this.visible() ? '' : 'none'; 41364 this.content.style.display = style; 41365 } 41366 setContainer(container) { 41367 if (typeof container === STRING) { 41368 if (container.charAt(0) === '.') { 41369 const className = container.slice(1); 41370 container = document.getElementsByClassName(className)[0]; 41371 } 41372 else { 41373 var id; 41374 if (container.charAt(0) !== '#') { 41375 id = container; 41376 } 41377 else { 41378 id = container.slice(1); 41379 } 41380 container = document.getElementById(id); 41381 } 41382 if (!container) { 41383 throw 'Can not find container in document with id ' + id; 41384 } 41385 } 41386 this._setAttr('container', container); 41387 if (this.content) { 41388 if (this.content.parentElement) { 41389 this.content.parentElement.removeChild(this.content); 41390 } 41391 container.appendChild(this.content); 41392 } 41393 return this; 41394 } 41395 shouldDrawHit() { 41396 return true; 41397 } 41398 clear() { 41399 const layers = this.children, len = layers.length; 41400 for (let n = 0; n < len; n++) { 41401 layers[n].clear(); 41402 } 41403 return this; 41404 } 41405 clone(obj) { 41406 if (!obj) { 41407 obj = {}; 41408 } 41409 obj.container = 41410 typeof document !== 'undefined' && document.createElement('div'); 41411 return Container_1.Container.prototype.clone.call(this, obj); 41412 } 41413 destroy() { 41414 super.destroy(); 41415 const content = this.content; 41416 if (content && Util_1.Util._isInDocument(content)) { 41417 this.container().removeChild(content); 41418 } 41419 const index = exports.stages.indexOf(this); 41420 if (index > -1) { 41421 exports.stages.splice(index, 1); 41422 } 41423 Util_1.Util.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas); 41424 return this; 41425 } 41426 getPointerPosition() { 41427 const pos = this._pointerPositions[0] || this._changedPointerPositions[0]; 41428 if (!pos) { 41429 Util_1.Util.warn(NO_POINTERS_MESSAGE); 41430 return null; 41431 } 41432 return { 41433 x: pos.x, 41434 y: pos.y, 41435 }; 41436 } 41437 _getPointerById(id) { 41438 return this._pointerPositions.find((p) => p.id === id); 41439 } 41440 getPointersPositions() { 41441 return this._pointerPositions; 41442 } 41443 getStage() { 41444 return this; 41445 } 41446 getContent() { 41447 return this.content; 41448 } 41449 _toKonvaCanvas(config) { 41450 config = config || {}; 41451 config.x = config.x || 0; 41452 config.y = config.y || 0; 41453 config.width = config.width || this.width(); 41454 config.height = config.height || this.height(); 41455 const canvas = new Canvas_1.SceneCanvas({ 41456 width: config.width, 41457 height: config.height, 41458 pixelRatio: config.pixelRatio || 1, 41459 }); 41460 const _context = canvas.getContext()._context; 41461 const layers = this.children; 41462 if (config.x || config.y) { 41463 _context.translate(-1 * config.x, -1 * config.y); 41464 }
41465 layers.forEach(function (layer) { 41466 if (!layer.isVisible()) { 41467 return; 41468 } 41469 const layerCanvas = layer._toKonvaCanvas(config); 41470 _context.drawImage(layerCanvas._canvas, config.x, config.y, layerCanvas.getWidth() / layerCanvas.getPixelRatio(), layerCanvas.getHeight() / layerCanvas.getPixelRatio()); 41471 }); 41472 return canvas; 41473 } 41474 getIntersection(pos) { 41475 if (!pos) { 41476 return null; 41477 } 41478 const layers = this.children, len = layers.length, end = len - 1; 41479 for (let n = end; n >= 0; n--) { 41480 const shape = layers[n].getIntersection(pos); 41481 if (shape) { 41482 return shape; 41483 } 41484 } 41485 return null; 41486 } 41487 _resizeDOM() { 41488 const width = this.width(); 41489 const height = this.height(); 41490 if (this.content) { 41491 this.content.style.width = width + PX; 41492 this.content.style.height = height + PX; 41493 } 41494 this.bufferCanvas.setSize(width, height); 41495 this.bufferHitCanvas.setSize(width, height); 41496 this.children.forEach((layer) => { 41497 layer.setSize({ width, height }); 41498 layer.draw(); 41499 }); 41500 } 41501 add(layer, ...rest) { 41502 if (arguments.length > 1) { 41503 for (let i = 0; i < arguments.length; i++) { 41504 this.add(arguments[i]); 41505 } 41506 return this; 41507 } 41508 super.add(layer); 41509 const length = this.children.length; 41510 if (length > MAX_LAYERS_NUMBER) { 41511 Util_1.Util.warn('The stage has ' + 41512 length + 41513 ' layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.'); 41514 } 41515 layer.setSize({ width: this.width(), height: this.height() }); 41516 layer.draw(); 41517 if (Global_1.Konva.isBrowser) { 41518 this.content.appendChild(layer.canvas._canvas); 41519 } 41520 return this; 41521 } 41522 getParent() { 41523 return null; 41524 } 41525 getLayer() { 41526 return null; 41527 } 41528 hasPointerCapture(pointerId) { 41529 return PointerEvents$1.hasPointerCapture(pointerId, this); 41530 } 41531 setPointerCapture(pointerId) { 41532 PointerEvents$1.setPointerCapture(pointerId, this); 41533 } 41534 releaseCapture(pointerId) { 41535 PointerEvents$1.releaseCapture(pointerId, this); 41536 } 41537 getLayers() { 41538 return this.children; 41539 } 41540 _bindContentEvents() { 41541 if (!Global_1.Konva.isBrowser) { 41542 return; 41543 } 41544 EVENTS.forEach(([event, methodName]) => { 41545 this.content.addEventListener(event, (evt) => { 41546 this[methodName](evt); 41547 }, { passive: false }); 41548 }); 41549 } 41550 _pointerenter(evt) { 41551 this.setPointersPositions(evt); 41552 const events = getEventsMap(evt.type); 41553 if (events) { 41554 this._fire(events.pointerenter, { 41555 evt: evt, 41556 target: this, 41557 currentTarget: this, 41558 }); 41559 } 41560 } 41561 _pointerover(evt) { 41562 this.setPointersPositions(evt); 41563 const events = getEventsMap(evt.type); 41564 if (events) { 41565 this._fire(events.pointerover, { 41566 evt: evt, 41567 target: this, 41568 currentTarget: this, 41569 }); 41570 } 41571 } 41572 _getTargetShape(evenType) { 41573 let shape = this[evenType + 'targetShape']; 41574 if (shape && !shape.getStage()) { 41575 shape = null; 41576 } 41577 return shape; 41578 } 41579 _pointerleave(evt) { 41580 const events = getEventsMap(evt.type); 41581 const eventType = getEventType(evt.type); 41582 if (!events) { 41583 return; 41584 } 41585 this.setPointersPositions(evt); 41586 const targetShape = this._getTargetShape(eventType); 41587 const eventsEnabled = !(Global_1.Konva.isDragging() || Global_1.Konva.isTransforming()) || Global_1.Konva.hitOnDragEnabled;
41588 if (targetShape && eventsEnabled) { 41589 targetShape._fireAndBubble(events.pointerout, { evt: evt }); 41590 targetShape._fireAndBubble(events.pointerleave, { evt: evt }); 41591 this._fire(events.pointerleave, { 41592 evt: evt, 41593 target: this, 41594 currentTarget: this, 41595 }); 41596 this[eventType + 'targetShape'] = null; 41597 } 41598 else if (eventsEnabled) { 41599 this._fire(events.pointerleave, { 41600 evt: evt, 41601 target: this, 41602 currentTarget: this, 41603 }); 41604 this._fire(events.pointerout, { 41605 evt: evt, 41606 target: this, 41607 currentTarget: this, 41608 }); 41609 } 41610 this.pointerPos = null; 41611 this._pointerPositions = []; 41612 } 41613 _pointerdown(evt) { 41614 const events = getEventsMap(evt.type); 41615 const eventType = getEventType(evt.type); 41616 if (!events) { 41617 return; 41618 } 41619 this.setPointersPositions(evt); 41620 let triggeredOnShape = false;
41621 this._changedPointerPositions.forEach((pos) => { 41622 const shape = this.getIntersection(pos); 41623 DragAndDrop_1.DD.justDragged = false; 41624 Global_1.Konva['_' + eventType + 'ListenClick'] = true; 41625 if (!shape || !shape.isListening()) { 41626 this[eventType + 'ClickStartShape'] = undefined; 41627 return; 41628 } 41629 if (Global_1.Konva.capturePointerEventsEnabled) { 41630 shape.setPointerCapture(pos.id); 41631 } 41632 this[eventType + 'ClickStartShape'] = shape; 41633 shape._fireAndBubble(events.pointerdown, { 41634 evt: evt, 41635 pointerId: pos.id, 41636 }); 41637 triggeredOnShape = true; 41638 const isTouch = evt.type.indexOf('touch') >= 0; 41639 if (shape.preventDefault() && evt.cancelable && isTouch) { 41640 evt.preventDefault(); 41641 } 41642 }); 41643 if (!triggeredOnShape) { 41644 this._fire(events.pointerdown, { 41645 evt: evt, 41646 target: this, 41647 currentTarget: this, 41648 pointerId: this._pointerPositions[0].id, 41649 }); 41650 } 41651 } 41652 _pointermove(evt) { 41653 const events = getEventsMap(evt.type); 41654 const eventType = getEventType(evt.type); 41655 if (!events) { 41656 return; 41657 } 41658 if (Global_1.Konva.isDragging() && DragAndDrop_1.DD.node.preventDefault() && evt.cancelable) { 41659 evt.preventDefault(); 41660 } 41661 this.setPointersPositions(evt); 41662 const eventsEnabled = !(Global_1.Konva.isDragging() || Global_1.Konva.isTransforming()) || Global_1.Konva.hitOnDragEnabled; 41663 if (!eventsEnabled) { 41664 return; 41665 } 41666 const processedShapesIds = {}; 41667 let triggeredOnShape = false;
41668 const targetShape = this._getTargetShape(eventType); 41669 this._changedPointerPositions.forEach((pos) => { 41670 const shape = (PointerEvents$1.getCapturedShape(pos.id) || 41671 this.getIntersection(pos)); 41672 const pointerId = pos.id; 41673 const event = { evt: evt, pointerId }; 41674 const differentTarget = targetShape !== shape; 41675 if (differentTarget && targetShape) { 41676 targetShape._fireAndBubble(events.pointerout, { ...event }, shape); 41677 targetShape._fireAndBubble(events.pointerleave, { ...event }, shape); 41678 } 41679 if (shape) { 41680 if (processedShapesIds[shape._id]) { 41681 return; 41682 } 41683 processedShapesIds[shape._id] = true; 41684 } 41685 if (shape && shape.isListening()) { 41686 triggeredOnShape = true; 41687 if (differentTarget) { 41688 shape._fireAndBubble(events.pointerover, { ...event }, targetShape); 41689 shape._fireAndBubble(events.pointerenter, { ...event }, targetShape); 41690 this[eventType + 'targetShape'] = shape; 41691 } 41692 shape._fireAndBubble(events.pointermove, { ...event }); 41693 } 41694 else { 41695 if (targetShape) { 41696 this._fire(events.pointerover, { 41697 evt: evt, 41698 target: this, 41699 currentTarget: this, 41700 pointerId, 41701 }); 41702 this[eventType + 'targetShape'] = null; 41703 } 41704 } 41705 }); 41706 if (!triggeredOnShape) { 41707 this._fire(events.pointermove, { 41708 evt: evt, 41709 target: this, 41710 currentTarget: this, 41711 pointerId: this._changedPointerPositions[0].id, 41712 }); 41713 } 41714 } 41715 _pointerup(evt) { 41716 const events = getEventsMap(evt.type); 41717 const eventType = getEventType(evt.type); 41718 if (!events) { 41719 return; 41720 } 41721 this.setPointersPositions(evt); 41722 const clickStartShape = this[eventType + 'ClickStartShape']; 41723 const clickEndShape = this[eventType + 'ClickEndShape']; 41724 const processedShapesIds = {}; 41725 let triggeredOnShape = false;
41726 this._changedPointerPositions.forEach((pos) => { 41727 const shape = (PointerEvents$1.getCapturedShape(pos.id) || 41728 this.getIntersection(pos)); 41729 if (shape) { 41730 shape.releaseCapture(pos.id); 41731 if (processedShapesIds[shape._id]) { 41732 return; 41733 } 41734 processedShapesIds[shape._id] = true; 41735 } 41736 const pointerId = pos.id; 41737 const event = { evt: evt, pointerId }; 41738 let fireDblClick = false; 41739 if (Global_1.Konva['_' + eventType + 'InDblClickWindow']) { 41740 fireDblClick = true; 41741 clearTimeout(this[eventType + 'DblTimeout']); 41742 } 41743 else if (!DragAndDrop_1.DD.justDragged) { 41744 Global_1.Konva['_' + eventType + 'InDblClickWindow'] = true; 41745 clearTimeout(this[eventType + 'DblTimeout']); 41746 } 41747 this[eventType + 'DblTimeout'] = setTimeout(function () { 41748 Global_1.Konva['_' + eventType + 'InDblClickWindow'] = false; 41749 }, Global_1.Konva.dblClickWindow); 41750 if (shape && shape.isListening()) { 41751 triggeredOnShape = true; 41752 this[eventType + 'ClickEndShape'] = shape; 41753 shape._fireAndBubble(events.pointerup, { ...event });
41754 if (Global_1.Konva['_' + eventType + 'ListenClick'] && 41755 clickStartShape && 41756 clickStartShape === shape) { 41757 shape._fireAndBubble(events.pointerclick, { ...event }); 41758 if (fireDblClick && clickEndShape && clickEndShape === shape) { 41759 shape._fireAndBubble(events.pointerdblclick, { ...event }); 41760 } 41761 } 41762 } 41763 else { 41764 this[eventType + 'ClickEndShape'] = null; 41765 if (Global_1.Konva['_' + eventType + 'ListenClick']) { 41766 this._fire(events.pointerclick, { 41767 evt: evt, 41768 target: this, 41769 currentTarget: this, 41770 pointerId, 41771 }); 41772 } 41773 if (fireDblClick) { 41774 this._fire(events.pointerdblclick, { 41775 evt: evt, 41776 target: this, 41777 currentTarget: this, 41778 pointerId, 41779 }); 41780 } 41781 } 41782 }); 41783 if (!triggeredOnShape) { 41784 this._fire(events.pointerup, { 41785 evt: evt, 41786 target: this, 41787 currentTarget: this, 41788 pointerId: this._changedPointerPositions[0].id, 41789 }); 41790 }
41791 Global_1.Konva['_' + eventType + 'ListenClick'] = false; 41792 if (evt.cancelable && eventType !== 'touch' && eventType !== 'pointer') { 41793 evt.preventDefault(); 41794 } 41795 } 41796 _contextmenu(evt) { 41797 this.setPointersPositions(evt); 41798 const shape = this.getIntersection(this.getPointerPosition()); 41799 if (shape && shape.isListening()) { 41800 shape._fireAndBubble(CONTEXTMENU, { evt: evt }); 41801 } 41802 else { 41803 this._fire(CONTEXTMENU, { 41804 evt: evt, 41805 target: this, 41806 currentTarget: this, 41807 }); 41808 } 41809 } 41810 _wheel(evt) { 41811 this.setPointersPositions(evt); 41812 const shape = this.getIntersection(this.getPointerPosition()); 41813 if (shape && shape.isListening()) { 41814 shape._fireAndBubble(WHEEL, { evt: evt }); 41815 } 41816 else { 41817 this._fire(WHEEL, { 41818 evt: evt, 41819 target: this, 41820 currentTarget: this, 41821 }); 41822 } 41823 } 41824 _pointercancel(evt) { 41825 this.setPointersPositions(evt); 41826 const shape = PointerEvents$1.getCapturedShape(evt.pointerId) || 41827 this.getIntersection(this.getPointerPosition()); 41828 if (shape) { 41829 shape._fireAndBubble(POINTERUP, PointerEvents$1.createEvent(evt)); 41830 } 41831 PointerEvents$1.releaseCapture(evt.pointerId); 41832 } 41833 _lostpointercapture(evt) { 41834 PointerEvents$1.releaseCapture(evt.pointerId); 41835 } 41836 setPointersPositions(evt) { 41837 const contentPosition = this._getContentPosition(); 41838 let x = null, y = null; 41839 evt = evt ? evt : window.event; 41840 if (evt.touches !== undefined) { 41841 this._pointerPositions = []; 41842 this._changedPointerPositions = []; 41843 Array.prototype.forEach.call(evt.touches, (touch) => { 41844 this._pointerPositions.push({ 41845 id: touch.identifier, 41846 x: (touch.clientX - contentPosition.left) / contentPosition.scaleX, 41847 y: (touch.clientY - contentPosition.top) / contentPosition.scaleY, 41848 }); 41849 }); 41850 Array.prototype.forEach.call(evt.changedTouches || evt.touches, (touch) => { 41851 this._changedPointerPositions.push({ 41852 id: touch.identifier, 41853 x: (touch.clientX - contentPosition.left) / contentPosition.scaleX, 41854 y: (touch.clientY - contentPosition.top) / contentPosition.scaleY, 41855 }); 41856 }); 41857 } 41858 else { 41859 x = (evt.clientX - contentPosition.left) / contentPosition.scaleX; 41860 y = (evt.clientY - contentPosition.top) / contentPosition.scaleY; 41861 this.pointerPos = { 41862 x: x, 41863 y: y, 41864 }; 41865 this._pointerPositions = [{ x, y, id: Util_1.Util._getFirstPointerId(evt) }]; 41866 this._changedPointerPositions = [ 41867 { x, y, id: Util_1.Util._getFirstPointerId(evt) }, 41868 ]; 41869 } 41870 } 41871 _setPointerPosition(evt) { 41872 Util_1.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'); 41873 this.setPointersPositions(evt); 41874 } 41875 _getContentPosition() { 41876 if (!this.content || !this.content.getBoundingClientRect) { 41877 return { 41878 top: 0, 41879 left: 0, 41880 scaleX: 1, 41881 scaleY: 1, 41882 }; 41883 } 41884 const rect = this.content.getBoundingClientRect(); 41885 return { 41886 top: rect.top, 41887 left: rect.left, 41888 scaleX: rect.width / this.content.clientWidth || 1, 41889 scaleY: rect.height / this.content.clientHeight || 1, 41890 }; 41891 } 41892 _buildDOM() { 41893 this.bufferCanvas = new Canvas_1.SceneCanvas({ 41894 width: this.width(), 41895 height: this.height(), 41896 }); 41897 this.bufferHitCanvas = new Canvas_1.HitCanvas({ 41898 pixelRatio: 1, 41899 width: this.width(), 41900 height: this.height(), 41901 }); 41902 if (!Global_1.Konva.isBrowser) { 41903 return; 41904 } 41905 const container = this.container(); 41906 if (!container) { 41907 throw 'Stage has no container. A container is required.'; 41908 } 41909 container.innerHTML = ''; 41910 this.content = document.createElement('div'); 41911 this.content.style.position = 'relative'; 41912 this.content.style.userSelect = 'none'; 41913 this.content.className = 'konvajs-content'; 41914 this.content.setAttribute('role', 'presentation'); 41915 container.appendChild(this.content); 41916 this._resizeDOM(); 41917 } 41918 cache() { 41919 Util_1.Util.warn('Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.'); 41920 return this; 41921 } 41922 clearCache() { 41923 return this; 41924 } 41925 batchDraw() {
41926 this.getChildren().forEach(function (layer) { 41927 layer.batchDraw(); 41928 }); 41929 return this; 41930 } 41931 } 41932 exports.Stage = Stage; 41933 Stage.prototype.nodeType = STAGE; 41934 (0, Global_2._registerNode)(Stage); 41935 Factory_1.Factory.addGetterSetter(Stage, 'container'); 41936 if (Global_1.Konva.isBrowser) { 41937 document.addEventListener('visibilitychange', () => { 41938 exports.stages.forEach((stage) => { 41939 stage.batchDraw(); 41940 }); 41941 }); 41942 } 41943} (Stage$1)); 41944 41945var Layer$2 = {}; 41946 41947var Shape = {}; 41948 41949(function (exports) { 41950 Object.defineProperty(exports, "__esModule", { value: true }); 41951 exports.Shape = exports.shapes = void 0; 41952 const Global_1 = Global; 41953 const Util_1 = Util; 41954 const Factory_1 = Factory; 41955 const Node_1 = Node$2; 41956 const Validators_1 = Validators; 41957 const Global_2 = Global; 41958 const PointerEvents$1 = PointerEvents; 41959 const HAS_SHADOW = 'hasShadow'; 41960 const SHADOW_RGBA = 'shadowRGBA'; 41961 const patternImage = 'patternImage'; 41962 const linearGradient = 'linearGradient'; 41963 const radialGradient = 'radialGradient'; 41964 let dummyContext; 41965 function getDummyContext() { 41966 if (dummyContext) { 41967 return dummyContext; 41968 } 41969 dummyContext = Util_1.Util.createCanvasElement().getContext('2d'); 41970 return dummyContext; 41971 } 41972 exports.shapes = {}; 41973 function _fillFunc(context) { 41974 const fillRule = this.attrs.fillRule; 41975 if (fillRule) { 41976 context.fill(fillRule); 41977 } 41978 else { 41979 context.fill(); 41980 } 41981 } 41982 function _strokeFunc(context) { 41983 context.stroke(); 41984 } 41985 function _fillFuncHit(context) { 41986 const fillRule = this.attrs.fillRule; 41987 if (fillRule) { 41988 context.fill(fillRule); 41989 } 41990 else { 41991 context.fill(); 41992 } 41993 } 41994 function _strokeFuncHit(context) { 41995 context.stroke(); 41996 } 41997 function _clearHasShadowCache() { 41998 this._clearCache(HAS_SHADOW); 41999 } 42000 function _clearGetShadowRGBACache() { 42001 this._clearCache(SHADOW_RGBA); 42002 } 42003 function _clearFillPatternCache() { 42004 this._clearCache(patternImage); 42005 } 42006 function _clearLinearGradientCache() { 42007 this._clearCache(linearGradient); 42008 } 42009 function _clearRadialGradientCache() { 42010 this._clearCache(radialGradient); 42011 } 42012 class Shape extends Node_1.Node { 42013 constructor(config) { 42014 super(config); 42015 let key; 42016 while (true) { 42017 key = Util_1.Util.getRandomColor(); 42018 if (key && !(key in exports.shapes)) { 42019 break; 42020 } 42021 } 42022 this.colorKey = key; 42023 exports.shapes[key] = this; 42024 } 42025 getContext() { 42026 Util_1.Util.warn('shape.getContext() method is deprecated. Please do not use it.'); 42027 return this.getLayer().getContext(); 42028 } 42029 getCanvas() { 42030 Util_1.Util.warn('shape.getCanvas() method is deprecated. Please do not use it.'); 42031 return this.getLayer().getCanvas(); 42032 } 42033 getSceneFunc() { 42034 return this.attrs.sceneFunc || this['_sceneFunc']; 42035 } 42036 getHitFunc() { 42037 return this.attrs.hitFunc || this['_hitFunc']; 42038 } 42039 hasShadow() { 42040 return this._getCache(HAS_SHADOW, this._hasShadow); 42041 } 42042 _hasShadow() { 42043 return (this.shadowEnabled() && 42044 this.shadowOpacity() !== 0 && 42045 !!(this.shadowColor() || 42046 this.shadowBlur() || 42047 this.shadowOffsetX() || 42048 this.shadowOffsetY())); 42049 } 42050 _getFillPattern() { 42051 return this._getCache(patternImage, this.__getFillPattern); 42052 } 42053 __getFillPattern() { 42054 if (this.fillPatternImage()) { 42055 const ctx = getDummyContext(); 42056 const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat'); 42057 if (pattern && pattern.setTransform) { 42058 const tr = new Util_1.Transform(); 42059 tr.translate(this.fillPatternX(), this.fillPatternY()); 42060 tr.rotate(Global_1.Konva.getAngle(this.fillPatternRotation())); 42061 tr.scale(this.fillPatternScaleX(), this.fillPatternScaleY()); 42062 tr.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY()); 42063 const m = tr.getMatrix(); 42064 const matrix = typeof DOMMatrix === 'undefined' 42065 ? { 42066 a: m[0], 42067 b: m[1], 42068 c: m[2], 42069 d: m[3], 42070 e: m[4], 42071 f: m[5], 42072 } 42073 : new DOMMatrix(m); 42074 pattern.setTransform(matrix); 42075 } 42076 return pattern; 42077 } 42078 } 42079 _getLinearGradient() { 42080 return this._getCache(linearGradient, this.__getLinearGradient); 42081 } 42082 __getLinearGradient() { 42083 const colorStops = this.fillLinearGradientColorStops(); 42084 if (colorStops) { 42085 const ctx = getDummyContext(); 42086 const start = this.fillLinearGradientStartPoint(); 42087 const end = this.fillLinearGradientEndPoint(); 42088 const grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y); 42089 for (let n = 0; n < colorStops.length; n += 2) { 42090 grd.addColorStop(colorStops[n], colorStops[n + 1]); 42091 } 42092 return grd; 42093 } 42094 } 42095 _getRadialGradient() { 42096 return this._getCache(radialGradient, this.__getRadialGradient); 42097 } 42098 __getRadialGradient() { 42099 const colorStops = this.fillRadialGradientColorStops(); 42100 if (colorStops) { 42101 const ctx = getDummyContext(); 42102 const start = this.fillRadialGradientStartPoint(); 42103 const end = this.fillRadialGradientEndPoint(); 42104 const grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius()); 42105 for (let n = 0; n < colorStops.length; n += 2) { 42106 grd.addColorStop(colorStops[n], colorStops[n + 1]); 42107 } 42108 return grd; 42109 } 42110 } 42111 getShadowRGBA() { 42112 return this._getCache(SHADOW_RGBA, this._getShadowRGBA); 42113 } 42114 _getShadowRGBA() { 42115 if (!this.hasShadow()) { 42116 return; 42117 } 42118 const rgba = Util_1.Util.colorToRGBA(this.shadowColor()); 42119 if (rgba) { 42120 return ('rgba(' + 42121 rgba.r + 42122 ',' + 42123 rgba.g + 42124 ',' + 42125 rgba.b + 42126 ',' + 42127 rgba.a * (this.shadowOpacity() || 1) + 42128 ')'); 42129 } 42130 } 42131 hasFill() { 42132 return this._calculate('hasFill', [ 42133 'fillEnabled', 42134 'fill', 42135 'fillPatternImage', 42136 'fillLinearGradientColorStops', 42137 'fillRadialGradientColorStops', 42138 ], () => { 42139 return (this.fillEnabled() && 42140 !!(this.fill() || 42141 this.fillPatternImage() || 42142 this.fillLinearGradientColorStops() || 42143 this.fillRadialGradientColorStops())); 42144 }); 42145 } 42146 hasStroke() { 42147 return this._calculate('hasStroke', [ 42148 'strokeEnabled', 42149 'strokeWidth', 42150 'stroke', 42151 'strokeLinearGradientColorStops', 42152 ], () => { 42153 return (this.strokeEnabled() && 42154 this.strokeWidth() && 42155 !!(this.stroke() || this.strokeLinearGradientColorStops())); 42156 }); 42157 } 42158 hasHitStroke() { 42159 const width = this.hitStrokeWidth(); 42160 if (width === 'auto') { 42161 return this.hasStroke(); 42162 } 42163 return this.strokeEnabled() && !!width; 42164 } 42165 intersects(point) {
42166 const stage = this.getStage(); 42167 if (!stage) { 42168 return false; 42169 } 42170 const bufferHitCanvas = stage.bufferHitCanvas; 42171 bufferHitCanvas.getContext().clear(); 42172 this.drawHit(bufferHitCanvas, undefined, true); 42173 const p = bufferHitCanvas.context.getImageData(Math.round(point.x), Math.round(point.y), 1, 1).data; 42174 return p[3] > 0; 42175 } 42176 destroy() { 42177 Node_1.Node.prototype.destroy.call(this); 42178 delete exports.shapes[this.colorKey]; 42179 delete this.colorKey; 42180 return this; 42181 } 42182 _useBufferCanvas(forceFill) { 42183 var _a; 42184 const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !== void 0 ? _a : true; 42185 if (!perfectDrawEnabled) { 42186 return false; 42187 } 42188 const hasFill = forceFill || this.hasFill(); 42189 const hasStroke = this.hasStroke(); 42190 const isTransparent = this.getAbsoluteOpacity() !== 1; 42191 if (hasFill && hasStroke && isTransparent) { 42192 return true; 42193 } 42194 const hasShadow = this.hasShadow(); 42195 const strokeForShadow = this.shadowForStrokeEnabled(); 42196 if (hasFill && hasStroke && hasShadow && strokeForShadow) { 42197 return true; 42198 } 42199 return false; 42200 } 42201 setStrokeHitEnabled(val) { 42202 Util_1.Util.warn('strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.'); 42203 if (val) { 42204 this.hitStrokeWidth('auto'); 42205 } 42206 else { 42207 this.hitStrokeWidth(0); 42208 } 42209 } 42210 getStrokeHitEnabled() { 42211 if (this.hitStrokeWidth() === 0) { 42212 return false; 42213 } 42214 else { 42215 return true; 42216 } 42217 } 42218 getSelfRect() { 42219 const size = this.size(); 42220 return { 42221 x: this._centroid ? -size.width / 2 : 0, 42222 y: this._centroid ? -size.height / 2 : 0, 42223 width: size.width, 42224 height: size.height, 42225 }; 42226 } 42227 getClientRect(config = {}) { 42228 let hasCachedParent = false; 42229 let parent = this.getParent(); 42230 while (parent) { 42231 if (parent.isCached()) { 42232 hasCachedParent = true; 42233 break; 42234 } 42235 parent = parent.getParent(); 42236 } 42237 const skipTransform = config.skipTransform; 42238 const relativeTo = config.relativeTo || (hasCachedParent && this.getStage()) || undefined; 42239 const fillRect = this.getSelfRect(); 42240 const applyStroke = !config.skipStroke && this.hasStroke(); 42241 const strokeWidth = (applyStroke && this.strokeWidth()) || 0; 42242 const fillAndStrokeWidth = fillRect.width + strokeWidth; 42243 const fillAndStrokeHeight = fillRect.height + strokeWidth; 42244 const applyShadow = !config.skipShadow && this.hasShadow(); 42245 const shadowOffsetX = applyShadow ? this.shadowOffsetX() : 0; 42246 const shadowOffsetY = applyShadow ? this.shadowOffsetY() : 0; 42247 const preWidth = fillAndStrokeWidth + Math.abs(shadowOffsetX); 42248 const preHeight = fillAndStrokeHeight + Math.abs(shadowOffsetY); 42249 const blurRadius = (applyShadow && this.shadowBlur()) || 0; 42250 const width = preWidth + blurRadius * 2; 42251 const height = preHeight + blurRadius * 2; 42252 const rect = { 42253 width: width, 42254 height: height, 42255 x: -(strokeWidth / 2 + blurRadius) + 42256 Math.min(shadowOffsetX, 0) + 42257 fillRect.x, 42258 y: -(strokeWidth / 2 + blurRadius) + 42259 Math.min(shadowOffsetY, 0) + 42260 fillRect.y, 42261 }; 42262 if (!skipTransform) { 42263 return this._transformedRect(rect, relativeTo); 42264 } 42265 return rect; 42266 } 42267 drawScene(can, top, bufferCanvas) { 42268 const layer = this.getLayer(); 42269 let canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext; 42270 const skipBuffer = canvas.isCache; 42271 const cachingSelf = top === this; 42272 if (!this.isVisible() && !cachingSelf) { 42273 return this; 42274 } 42275 if (cachedCanvas) { 42276 context.save(); 42277 const m = this.getAbsoluteTransform(top).getMatrix(); 42278 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 42279 this._drawCachedSceneCanvas(context);
42280 context.restore(); 42281 return this; 42282 } 42283 if (!drawFunc) { 42284 return this; 42285 } 42286 context.save(); 42287 if (this._useBufferCanvas() && !skipBuffer) { 42288 stage = this.getStage(); 42289 const bc = bufferCanvas || stage.bufferCanvas; 42290 bufferContext = bc.getContext(); 42291 bufferContext.clear(); 42292 bufferContext.save(); 42293 bufferContext._applyLineJoin(this); 42294 var o = this.getAbsoluteTransform(top).getMatrix(); 42295 bufferContext.transform(o[0], o[1], o[2], o[3], o[4], o[5]); 42296 drawFunc.call(this, bufferContext, this); 42297 bufferContext.restore(); 42298 const ratio = bc.pixelRatio; 42299 if (hasShadow) { 42300 context._applyShadow(this); 42301 } 42302 context._applyOpacity(this); 42303 context._applyGlobalCompositeOperation(this); 42304 context.drawImage(bc._canvas, 0, 0, bc.width / ratio, bc.height / ratio); 42305 } 42306 else { 42307 context._applyLineJoin(this); 42308 if (!cachingSelf) { 42309 var o = this.getAbsoluteTransform(top).getMatrix(); 42310 context.transform(o[0], o[1], o[2], o[3], o[4], o[5]); 42311 context._applyOpacity(this); 42312 context._applyGlobalCompositeOperation(this); 42313 } 42314 if (hasShadow) { 42315 context._applyShadow(this); 42316 } 42317 drawFunc.call(this, context, this); 42318 } 42319 context.restore(); 42320 return this; 42321 } 42322 drawHit(can, top, skipDragCheck = false) { 42323 if (!this.shouldDrawHit(top, skipDragCheck)) { 42324 return this; 42325 } 42326 const layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit; 42327 if (!this.colorKey) { 42328 Util_1.Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()'); 42329 } 42330 if (cachedHitCanvas) { 42331 context.save(); 42332 const m = this.getAbsoluteTransform(top).getMatrix(); 42333 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 42334 this._drawCachedHitCanvas(context); 42335 context.restore(); 42336 return this; 42337 } 42338 if (!drawFunc) { 42339 return this; 42340 } 42341 context.save(); 42342 context._applyLineJoin(this); 42343 const selfCache = this === top; 42344 if (!selfCache) { 42345 const o = this.getAbsoluteTransform(top).getMatrix(); 42346 context.transform(o[0], o[1], o[2], o[3], o[4], o[5]); 42347 } 42348 drawFunc.call(this, context, this); 42349 context.restore(); 42350 return this; 42351 } 42352 drawHitFromCache(alphaThreshold = 0) { 42353 const cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(); 42354 hitContext.clear(); 42355 hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth, hitHeight); 42356 try { 42357 const hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight); 42358 const hitData = hitImageData.data; 42359 const len = hitData.length; 42360 const rgbColorKey = Util_1.Util._hexToRgb(this.colorKey); 42361 for (let i = 0; i < len; i += 4) { 42362 const alpha = hitData[i + 3]; 42363 if (alpha > alphaThreshold) { 42364 hitData[i] = rgbColorKey.r; 42365 hitData[i + 1] = rgbColorKey.g; 42366 hitData[i + 2] = rgbColorKey.b; 42367 hitData[i + 3] = 255; 42368 } 42369 else { 42370 hitData[i + 3] = 0; 42371 } 42372 } 42373 hitContext.putImageData(hitImageData, 0, 0); 42374 } 42375 catch (e) { 42376 Util_1.Util.error('Unable to draw hit graph from cached sce
42376ne canvas. ' + e.message); 42377 } 42378 return this; 42379 } 42380 hasPointerCapture(pointerId) { 42381 return PointerEvents$1.hasPointerCapture(pointerId, this); 42382 } 42383 setPointerCapture(pointerId) { 42384 PointerEvents$1.setPointerCapture(pointerId, this); 42385 } 42386 releaseCapture(pointerId) { 42387 PointerEvents$1.releaseCapture(pointerId, this); 42388 } 42389 } 42390 exports.Shape = Shape; 42391 Shape.prototype._fillFunc = _fillFunc; 42392 Shape.prototype._strokeFunc = _strokeFunc; 42393 Shape.prototype._fillFuncHit = _fillFuncHit; 42394 Shape.prototype._strokeFuncHit = _strokeFuncHit; 42395 Shape.prototype._centroid = false; 42396 Shape.prototype.nodeType = 'Shape'; 42397 (0, Global_2._registerNode)(Shape); 42398 Shape.prototype.eventListeners = {}; 42399 Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearHasShadowCache); 42400 Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearGetShadowRGBACache); 42401 Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva', _clearFillPatternCache); 42402 Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva', _clearLinearGradientCache); 42403 Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva', _clearRadialGradientCache); 42404 Factory_1.Factory.addGetterSetter(Shape, 'stroke', undefined, (0, Validators_1.getStringOrGradientValidator)()); 42405 Factory_1.Factory.addGetterSetter(Shape, 'strokeWidth', 2, (0, Validators_1.getNumberValidator)()); 42406 Factory_1.Factory.addGetterSetter(Shape, 'fillAfterStrokeEnabled', false); 42407 Factory_1.Factory.addGetterSetter(Shape, 'hitStrokeWidth', 'auto', (0, Validators_1.getNumberOrAutoValidator)()); 42408 Factory_1.Factory.addGetterSetter(Shape, 'strokeHitEnabled', true, (0, Validators_1.getBooleanValidator)()); 42409 Factory_1.Factory.addGetterSetter(Shape, 'perfectDrawEnabled', true, (0, Validators_1.getBooleanValidator)()); 42410 Factory_1.Factory.addGetterSetter(Shape, 'shadowForStrokeEnabled', true, (0, Validators_1.getBooleanValidator)()); 42411 Factory_1.Factory.addGetterSetter(Shape, 'lineJoin'); 42412 Factory_1.Factory.addGetterSetter(Shape, 'lineCap'); 42413 Factory_1.Factory.addGetterSetter(Shape, 'sceneFunc'); 42414 Factory_1.Factory.addGetterSetter(Shape, 'hitFunc'); 42415 Factory_1.Factory.addGetterSetter(Shape, 'dash'); 42416 Factory_1.Factory.addGetterSetter(Shape, 'dashOffset', 0, (0, Validators_1.getNumberValidator)()); 42417 Factory_1.Factory.addGetterSetter(Shape, 'shadowColor', undefined, (0, Validators_1.getStringValidator)()); 42418 Factory_1.Factory.addGetterSetter(Shape, 'shadowBlur', 0, (0, Validators_1.getNumberValidator)()); 42419 Factory_1.Factory.addGetterSetter(Shape, 'shadowOpacity', 1, (0, Validators_1.getNumberValidator)()); 42420 Factory_1.Factory.addComponentsGetterSetter(Shape, 'shadowOffset', ['x', 'y']); 42421 Factory_1.Factory.addGetterSetter(Shape, 'shadowOffsetX', 0, (0, Validators_1.getNumberValidator)()); 42422 Factory_1.Factory.addGetterSetter(Shape, 'shadowOffsetY', 0, (0, Validators_1.getNumberValidator)()); 42423 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternImage'); 42424 Factory_1.Factory.addGetterSetter(Shape, 'fill', undefined, (0, Validators_1.getStringOrGradientValidator)()); 42425 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternX', 0, (0, Validators_1.getNumberValidator)()); 42426 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternY', 0, (0, Validators_1.getNumberValidator)()); 42427 Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientColorStops'); 42428 Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientColorStops'); 42429 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientStartRadius', 0); 42430 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientEndRadius', 0); 42431 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientColorStops'); 42432 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternRepeat', 'repeat'); 42433 Factory_1.Factory.addGetterSetter(Shape, 'fillEnabled', true); 42434 Factory_1.Factory.addGetterSetter(Shape, 'strokeEnabled', true); 42435 Factory_1.Factory.addGetterSetter(Shape, 'shadowEnabled', true); 42436 Factory_1.Factory.addGetterSetter(Shape, 'dashEnabled', true); 42437 Factory_1.Factory.addGetterSetter(Shape, 'strokeScaleEnabled', true); 42438 Factory_1.Factory.addGetterSetter(Shape, 'fillPriority', 'color'); 42439 Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillPatternOffset', ['x', 'y']); 42440 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternOffsetX', 0, (0, Validators_1.getNumberValidator)()); 42441 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternOffsetY', 0, (0, Validators_1.getNumberValidator)()); 42442 Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillPatternScale', ['x', 'y']); 42443 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternScaleX', 1, (0, Validators_1.getNumberValidator)()); 42444 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternScaleY', 1, (0, Validators_1.getNumberValidator)()); 42445 Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientStartPoint', [ 42446 'x', 42447 'y', 42448 ]); 42449 Factory_1.Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientStartPoint', [ 42450 'x', 42451 'y', 42452 ]); 42453 Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointX', 0); 42454 Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointX', 0); 42455 Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointY', 0); 42456 Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointY', 0); 42457 Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientEndPoint', [ 42458 'x', 42459 'y', 42460 ]); 42461 Factory_1.Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientEndPoint', [ 42462 'x', 42463 'y', 42464 ]); 42465 Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointX', 0); 42466 Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointX', 0); 42467 Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointY', 0); 42468 Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointY', 0); 42469 Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientStartPoint', [ 42470 'x', 42471 'y', 42472 ]); 42473 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointX', 0); 42474 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointY', 0); 42475 Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientEndPoint', [ 42476 'x', 42477 'y', 42478 ]); 42479 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointX', 0); 42480 Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointY', 0); 42481 Factory_1.Factory.addGetterSetter(Shape, 'fillPatternRotation', 0); 42482 Factory_1.Factory.addGetterSetter(Shape, 'fillRule', undefined, (0, Validators_1.getStringValidator)()); 42483 Factory_1.Factory.backCompat(Shape, { 42484 dashArray: 'dash', 42485 getDashArray: 'getDash', 42486 setDashArray: 'getDash', 42487 drawFunc: 'sceneFunc',
42488 getDrawFunc: 'getSceneFunc', 42489 setDrawFunc: 'setSceneFunc', 42490 drawHitFunc: 'hitFunc', 42491 getDrawHitFunc: 'getHitFunc', 42492 setDrawHitFunc: 'setHitFunc', 42493 }); 42494} (Shape)); 42495 42496Object.defineProperty(Layer$2, "__esModule", { value: true }); 42497Layer$2.Layer = void 0; 42498const Util_1$b = Util; 42499const Container_1$1 = Container$1; 42500const Node_1$g = Node$2; 42501const Factory_1$w = Factory; 42502const Canvas_1 = Canvas$1; 42503const Validators_1$v = Validators; 42504const Shape_1$g = Shape; 42505const Global_1$k = Global; 42506const HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw', INTERSECTION_OFFSETS = [ 42507 { x: 0, y: 0 }, 42508 { x: -1, y: -1 }, 42509 { x: 1, y: -1 }, 42510 { x: 1, y: 1 }, 42511 { x: -1, y: 1 }, 42512], INTERSECTION_OFFSETS_LEN = INTERSECTION_OFFSETS.length; 42513let Layer$1 = class Layer extends Container_1$1.Container { 42514 constructor(config) { 42515 super(config); 42516 this.canvas = new Canvas_1.SceneCanvas(); 42517 this.hitCanvas = new Canvas_1.HitCanvas({ 42518 pixelRatio: 1, 42519 }); 42520 this._waitingForDraw = false; 42521 this.on('visibleChange.konva', this._checkVisibility); 42522 this._checkVisibility(); 42523 this.on('imageSmoothingEnabledChange.konva', this._setSmoothEnabled); 42524 this._setSmoothEnabled(); 42525 } 42526 createPNGStream() { 42527 const c = this.canvas._canvas; 42528 return c.createPNGStream(); 42529 } 42530 getCanvas() { 42531 return this.canvas; 42532 } 42533 getNativeCanvasElement() { 42534 return this.canvas._canvas; 42535 } 42536 getHitCanvas() { 42537 return this.hitCanvas; 42538 } 42539 getContext() { 42540 return this.getCanvas().getContext(); 42541 } 42542 clear(bounds) { 42543 this.getContext().clear(bounds); 42544 this.getHitCanvas().getContext().clear(bounds); 42545 return this; 42546 } 42547 setZIndex(index) { 42548 super.setZIndex(index); 42549 const stage = this.getStage(); 42550 if (stage && stage.content) { 42551 stage.content.removeChild(this.getNativeCanvasElement()); 42552 if (index < stage.children.length - 1) { 42553 stage.content.insertBefore(this.getNativeCanvasElement(), stage.children[index + 1].getCanvas()._canvas); 42554 } 42555 else { 42556 stage.content.appendChild(this.getNativeCanvasElement()); 42557 } 42558 } 42559 return this; 42560 } 42561 moveToTop() { 42562 Node_1$g.Node.prototype.moveToTop.call(this); 42563 const stage = this.getStage(); 42564 if (stage && stage.content) { 42565 stage.content.removeChild(this.getNativeCanvasElement()); 42566 stage.content.appendChild(this.getNativeCanvasElement()); 42567 } 42568 return true; 42569 } 42570 moveUp() { 42571 const moved = Node_1$g.Node.prototype.moveUp.call(this); 42572 if (!moved) { 42573 return false; 42574 } 42575 const stage = this.getStage(); 42576 if (!stage || !stage.content) { 42577 return false; 42578 } 42579 stage.content.removeChild(this.getNativeCanvasElement()); 42580 if (this.index < stage.children.length - 1) { 42581 stage.content.insertBefore(this.getNativeCanvasElement(), stage.children[this.index + 1].getCanvas()._canvas); 42582 } 42583 else { 42584 stage.content.appendChild(this.getNativeCanvasElement()); 42585 } 42586 return true; 42587 } 42588 moveDown() { 42589 if (Node_1$g.Node.prototype.moveDown.call(this)) { 42590 const stage = this.getStage(); 42591 if (stage) { 42592 const children = stage.children; 42593 if (stage.content) { 42594 stage.content.removeChild(this.getNativeCanvasElement()); 42595 stage.content.insertBefore(this.getNativeCanvasElement(), children[this.index + 1].getCanvas()._canvas); 42596 } 42597 } 42598 return true; 42599 } 42600 return false; 42601 } 42602 moveToBottom() { 42603 if (Node_1$g.Node.prototype.moveToBottom.call(this)) { 42604 const stage = this.getStage(); 42605 if (stage) { 42606 const children = stage.children; 42607 if (stage.content) { 42608 stage.content.removeChild(this.getNativeCanvasElement()); 42609 stage.content.insertBefore(this.getNativeCanvasElement(), children[1].getCanvas()._canvas); 42610 } 42611 } 42612 return true; 42613 } 42614 return false;
42615 } 42616 getLayer() { 42617 return this; 42618 } 42619 remove() { 42620 const _canvas = this.getNativeCanvasElement(); 42621 Node_1$g.Node.prototype.remove.call(this); 42622 if (_canvas && _canvas.parentNode && Util_1$b.Util._isInDocument(_canvas)) { 42623 _canvas.parentNode.removeChild(_canvas); 42624 } 42625 return this; 42626 } 42627 getStage() { 42628 return this.parent; 42629 } 42630 setSize({ width, height }) { 42631 this.canvas.setSize(width, height); 42632 this.hitCanvas.setSize(width, height); 42633 this._setSmoothEnabled(); 42634 return this; 42635 } 42636 _validateAdd(child) { 42637 const type = child.getType(); 42638 if (type !== 'Group' && type !== 'Shape') { 42639 Util_1$b.Util.throw('You may only add groups and shapes to a layer.'); 42640 } 42641 } 42642 _toKonvaCanvas(config) { 42643 config = config || {}; 42644 config.width = config.width || this.getWidth(); 42645 config.height = config.height || this.getHeight(); 42646 config.x = config.x !== undefined ? config.x : this.x(); 42647 config.y = config.y !== undefined ? config.y : this.y(); 42648 return Node_1$g.Node.prototype._toKonvaCanvas.call(this, config); 42649 } 42650 _checkVisibility() { 42651 const visible = this.visible(); 42652 if (visible) { 42653 this.canvas._canvas.style.display = 'block'; 42654 } 42655 else { 42656 this.canvas._canvas.style.display = 'none'; 42657 } 42658 } 42659 _setSmoothEnabled() { 42660 this.getContext()._context.imageSmoothingEnabled = 42661 this.imageSmoothingEnabled(); 42662 } 42663 getWidth() { 42664 if (this.parent) { 42665 return this.parent.width(); 42666 } 42667 } 42668 setWidth() { 42669 Util_1$b.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.'); 42670 } 42671 getHeight() { 42672 if (this.parent) { 42673 return this.parent.height(); 42674 } 42675 } 42676 setHeight() { 42677 Util_1$b.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.'); 42678 } 42679 batchDraw() { 42680 if (!this._waitingForDraw) { 42681 this._waitingForDraw = true; 42682 Util_1$b.Util.requestAnimFrame(() => { 42683 this.draw(); 42684 this._waitingForDraw = false; 42685 }); 42686 } 42687 return this; 42688 } 42689 getIntersection(pos) { 42690 if (!this.isListening() || !this.isVisible()) { 42691 return null; 42692 } 42693 let spiralSearchDistance = 1; 42694 let continueSearch = false; 42695 while (true) { 42696 for (let i = 0; i < INTERSECTION_OFFSETS_LEN; i++) { 42697 const intersectionOffset = INTERSECTION_OFFSETS[i]; 42698 const obj = this._getIntersection({ 42699 x: pos.x + intersectionOffset.x * spiralSearchDistance, 42700 y: pos.y + intersectionOffset.y * spiralSearchDistance, 42701 }); 42702 const shape = obj.shape; 42703 if (shape) { 42704 return shape; 42705 } 42706 continueSearch = !!obj.antialiased; 42707 if (!obj.antialiased) { 42708 break; 42709 } 42710 } 42711 if (continueSearch) { 42712 spiralSearchDistance += 1; 42713 } 42714 else { 42715 return null; 42716 } 42717 } 42718 } 42719 _getIntersection(pos) { 42720 const ratio = this.hitCanvas.pixelRatio; 42721 const p = this.hitCanvas.context.getImageData(Math.round(pos.x * ratio), Math.round(pos.y * ratio), 1, 1).data; 42722 const p3 = p[3]; 42723 if (p3 === 255) { 42724 const colorKey = Util_1$b.Util._rgbToHex(p[0], p[1], p[2]); 42725 const shape = Shape_1$g.shapes[HASH + colorKey]; 42726 if (shape) { 42727 return { 42728 shape: shape, 42729 }; 42730 } 42731 return { 42732 antialiased: true, 42733 }; 42734 } 42735 else if (p3 > 0) { 42736 return { 42737 antialiased: true, 42738 }; 42739 } 42740 return {}; 42741 } 42742 drawScene(can, top) { 42743 const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()); 42744 this._fire(BEFORE_DRAW, { 42745 node: this, 42746 }); 42747 if (this.clearBeforeDraw()) { 42748 canvas.getContext().clear(); 42749 } 42750 Container_1$1.Container.prototype.drawScene.call(this, canvas, top); 42751 this._fire(DRAW, { 42752 node: this, 42753 }); 42754 return this; 42755 } 42756 drawHit(can, top) { 42757 const layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas); 42758 if (layer && layer.clearBeforeDraw()) { 42759 layer.getHitCanvas().getContext().clear(); 42760 } 42761 Container_1$1.Container.prototype.drawHit.call(this, canvas, top); 42762 return this; 42763 } 42764 enableHitGraph() { 42765 this.hitGraphEnabled(true); 42766 return this; 42767 } 42768 disableHitGraph() { 42769 this.hitGraphEnabled(false); 42770 return this; 42771 } 42772 setHitGraphEnabled(val) { 42773 Util_1$b.Util.warn('hitGraphEnabled method is deprecated. Please use layer.listening() instead.'); 42774 this.listening(val); 42775 } 42776 getHitGraphEnabled(val) { 42777 Util_1$b.Util.warn('hitGraphEnabled method is deprecated. Please use layer.listening() instead.'); 42778 return this.listening(); 42779 } 42780 toggleHitCanvas() { 42781 if (!this.parent || !this.parent['content']) { 42782 return; 42783 } 42784 const parent = this.parent; 42785 const added = !!this.hitCanvas._canvas.parentNode; 42786 if (added) { 42787 parent.content.removeChild(this.hitCanvas._canvas); 42788 } 42789 else { 42790 parent.content.appendChild(this.hitCanvas._canvas); 42791 } 42792 } 42793 destroy() { 42794 Util_1$b.Util.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas); 42795 return super.destroy(); 42796 } 42797}; 42798Layer$2.Layer = Layer$1; 42799Layer$1.prototype.nodeType = 'Layer'; 42800(0, Global_1$k._registerNode)(Layer$1); 42801Factory_1$w.Factory.addGetterSetter(Layer$1, 'imageSmoothingEnabled', true); 42802Factory_1$w.Factory.addGetterSetter(Layer$1, 'clearBeforeDraw', true); 42803Factory_1$w.Factory.addGetterSetter(Layer$1, 'hitGraphEnabled', true, (0, Validators_1$v.getBooleanValidator)()); 42804 42805var FastLayer$1 = {}; 42806 42807Object.defineProperty(FastLayer$1, "__esModule", { value: true }); 42808FastLayer$1.FastLayer = void 0; 42809const Util_1$a = Util; 42810const Layer_1 = Layer$2; 42811const Global_1$j = Global;
42812class FastLayer extends Layer_1.Layer { 42813 constructor(attrs) { 42814 super(attrs); 42815 this.listening(false); 42816 Util_1$a.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.'); 42817 } 42818} 42819FastLayer$1.FastLayer = FastLayer; 42820FastLayer.prototype.nodeType = 'FastLayer'; 42821(0, Global_1$j._registerNode)(FastLayer); 42822 42823var Group$2 = {}; 42824 42825Object.defineProperty(Group$2, "__esModule", { value: true }); 42826Group$2.Group = void 0; 42827const Util_1$9 = Util; 42828const Container_1 = Container$1; 42829const Global_1$i = Global; 42830let Group$1 = class Group extends Container_1.Container { 42831 _validateAdd(child) { 42832 const type = child.getType(); 42833 if (type !== 'Group' && type !== 'Shape') { 42834 Util_1$9.Util.throw('You may only add groups and shapes to groups.'); 42835 } 42836 } 42837}; 42838Group$2.Group = Group$1; 42839Group$1.prototype.nodeType = 'Group'; 42840(0, Global_1$i._registerNode)(Group$1); 42841 42842var Animation$1 = {}; 42843 42844Object.defineProperty(Animation$1, "__esModule", { value: true }); 42845Animation$1.Animation = void 0; 42846const Global_1$h = Global; 42847const Util_1$8 = Util; 42848const now = (function () { 42849 if (Global_1$h.glob.performance && Global_1$h.glob.performance.now) { 42850 return function () { 42851 return Global_1$h.glob.performance.now(); 42852 }; 42853 } 42854 return function () { 42855 return new Date().getTime(); 42856 }; 42857})(); 42858class Animation { 42859 constructor(func, layers) { 42860 this.id = Animation.animIdCounter++; 42861 this.frame = { 42862 time: 0, 42863 timeDiff: 0, 42864 lastTime: now(), 42865 frameRate: 0, 42866 }; 42867 this.func = func; 42868 this.setLayers(layers); 42869 } 42870 setLayers(layers) { 42871 let lays = []; 42872 if (layers) { 42873 lays = Array.isArray(layers) ? layers : [layers]; 42874 } 42875 this.layers = lays; 42876 return this; 42877 } 42878 getLayers() { 42879 return this.layers; 42880 } 42881 addLayer(layer) { 42882 const layers = this.layers; 42883 const len = layers.length; 42884 for (let n = 0; n < len; n++) { 42885 if (layers[n]._id === layer._id) { 42886 return false; 42887 } 42888 } 42889 this.layers.push(layer); 42890 return true; 42891 } 42892 isRunning() { 42893 const a = Animation; 42894 const animations = a.animations; 42895 const len = animations.length; 42896 for (let n = 0; n < len; n++) { 42897 if (animations[n].id === this.id) { 42898 return true; 42899 } 42900 } 42901 return false; 42902 } 42903 start() { 42904 this.stop(); 42905 this.frame.timeDiff = 0; 42906 this.frame.lastTime = now(); 42907 Animation._addAnimation(this); 42908 return this; 42909 } 42910 stop() { 42911 Animation._removeAnimation(this); 42912 return this; 42913 } 42914 _updateFrameObject(time) { 42915 this.frame.timeDiff = time - this.frame.lastTime; 42916 this.frame.lastTime = time; 42917 this.frame.time += this.frame.timeDiff; 42918 this.frame.frameRate = 1000 / this.frame.timeDiff; 42919 } 42920 static _addAnimation(anim) { 42921 this.animations.push(anim); 42922 this._handleAnimation(); 42923 } 42924 static _removeAnimation(anim) { 42925 const id = anim.id; 42926 const animations = this.animations; 42927 const len = animations.length; 42928 for (let n = 0; n < len; n++) { 42929 if (animations[n].id === id) { 42930 this.animations.splice(n, 1); 42931 break; 42932 } 42933 } 42934 } 42935 static _runFrames() { 42936 const layerHash = {}; 42937 const animations = this.animations; 42938 for (let n = 0; n < animations.length; n++) { 42939 const anim = animations[n]; 42940 const layers = anim.layers; 42941 const func = anim.func; 42942 anim._updateFrameObject(now()); 42943 const layersLen = layers.length; 42944 let needRedraw; 42945 if (func) { 42946 needRedraw = func.call(anim, anim.frame) !== false; 42947 } 42948 else { 42949 needRedraw = true; 42950 } 42951 if (!needRedraw) { 42952 continue; 42953 } 42954 for (let i = 0; i < layersLen; i++) { 42955 const layer = layers[i]; 42956 if (layer._id !== undefined) { 42957 layerHash[layer._id] = layer; 42958 } 42959 } 42960 } 42961 for (const key in layerHash) { 42962 if (!layerHash.hasOwnProperty(key)) { 42963 continue; 42964 } 42965 layerHash[key].batchDraw(); 42966 } 42967 } 42968 static _animationLoop() { 42969 const Anim = Animation; 42970 if (Anim.animations.length) { 42971 Anim._runFrames();
42972 Util_1$8.Util.requestAnimFrame(Anim._animationLoop); 42973 } 42974 else { 42975 Anim.animRunning = false; 42976 } 42977 } 42978 static _handleAnimation() { 42979 if (!this.animRunning) { 42980 this.animRunning = true; 42981 Util_1$8.Util.requestAnimFrame(this._animationLoop); 42982 } 42983 } 42984} 42985Animation$1.Animation = Animation; 42986Animation.animations = []; 42987Animation.animIdCounter = 0; 42988Animation.animRunning = false; 42989 42990var Tween = {}; 42991 42992(function (exports) { 42993 Object.defineProperty(exports, "__esModule", { value: true }); 42994 exports.Easings = exports.Tween = void 0; 42995 const Util_1 = Util; 42996 const Animation_1 = Animation$1; 42997 const Node_1 = Node$2; 42998 const Global_1 = Global; 42999 const blacklist = { 43000 node: 1, 43001 duration: 1, 43002 easing: 1, 43003 onFinish: 1, 43004 yoyo: 1, 43005 }, PAUSED = 1, PLAYING = 2, REVERSING = 3, colorAttrs = ['fill', 'stroke', 'shadowColor']; 43006 let idCounter = 0; 43007 class TweenEngine { 43008 constructor(prop, propFunc, func, begin, finish, duration, yoyo) { 43009 this.prop = prop; 43010 this.propFunc = propFunc; 43011 this.begin = begin; 43012 this._pos = begin; 43013 this.duration = duration; 43014 this._change = 0; 43015 this.prevPos = 0; 43016 this.yoyo = yoyo; 43017 this._time = 0; 43018 this._position = 0; 43019 this._startTime = 0; 43020 this._finish = 0; 43021 this.func = func; 43022 this._change = finish - this.begin; 43023 this.pause(); 43024 } 43025 fire(str) { 43026 const handler = this[str]; 43027 if (handler) { 43028 handler(); 43029 } 43030 } 43031 setTime(t) { 43032 if (t > this.duration) { 43033 if (this.yoyo) { 43034 this._time = this.duration; 43035 this.reverse(); 43036 } 43037 else { 43038 this.finish(); 43039 } 43040 } 43041 else if (t < 0) { 43042 if (this.yoyo) { 43043 this._time = 0; 43044 this.play(); 43045 } 43046 else { 43047 this.reset(); 43048 } 43049 } 43050 else { 43051 this._time = t; 43052 this.update(); 43053 } 43054 } 43055 getTime() { 43056 return this._time; 43057 } 43058 setPosition(p) { 43059 this.prevPos = this._pos; 43060 this.propFunc(p); 43061 this._pos = p; 43062 } 43063 getPosition(t) { 43064 if (t === undefined) { 43065 t = this._time; 43066 } 43067 return this.func(t, this.begin, this._change, this.duration); 43068 } 43069 play() { 43070 this.state = PLAYING; 43071 this._startTime = this.getTimer() - this._time; 43072 this.onEnterFrame(); 43073 this.fire('onPlay'); 43074 } 43075 reverse() { 43076 this.state = REVERSING; 43077 this._time = this.duration - this._time; 43078 this._startTime = this.getTimer() - this._time; 43079 this.onEnterFrame(); 43080 this.fire('onReverse'); 43081 } 43082 seek(t) { 43083 this.pause(); 43084 this._time = t; 43085 this.update(); 43086 this.fire('onSeek'); 43087 } 43088 reset() { 43089 this.pause(); 43090 this._time = 0; 43091 this.update(); 43092 this.fire('onReset'); 43093 } 43094 finish() { 43095 this.pause(); 43096 this._time = this.duration; 43097 this.update(); 43098 this.fire('onFinish'); 43099 } 43100 update() { 43101 this.setPosition(this.getPosition(this._time)); 43102 this.fire('onUpdate'); 43103 } 43104 onEnterFrame() { 43105 const t = this.getTimer() - this._startTime; 43106 if (this.state === PLAYING) { 43107 this.setTime(t); 43108 } 43109 else if (this.state === REVERSING) { 43110 this.setTime(this.duration - t); 43111 } 43112 } 43113 pause() { 43114 this.state = PAUSED; 43115 this.fire('onPause'); 43116 } 43117 getTimer() { 43118 return new Date().getTime(); 43119 } 43120 } 43121 class Tween { 43122 constructor(config) { 43123 const that = this, node = config.node, nodeId = node._id, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo; 43124 let duration, key; 43125 if (typeof config.duration === 'undefined') { 43126 duration = 0.3; 43127 } 43128 else if (config.duration === 0) { 43129 duration = 0.001; 43130 } 43131 else { 43132 duration = config.duration; 43133 } 43134 this.node = node; 43135 this._id = idCounter++; 43136 const layers = node.getLayer() || 43137 (node instanceof Global_1.Konva['Stage'] ? node.getLayers() : null); 43138 if (!layers) { 43139 Util_1.Util.error('Tween constructor have `node` that is not in a layer. Please add node into layer first.'); 43140 } 43141 this.anim = new Animation_1.Animation(function () {
43142 that.tween.onEnterFrame(); 43143 }, layers); 43144 this.tween = new TweenEngine(key, function (i) { 43145 that._tweenFunc(i); 43146 }, easing, 0, 1, duration * 1000, yoyo); 43147 this._addListeners(); 43148 if (!Tween.attrs[nodeId]) { 43149 Tween.attrs[nodeId] = {}; 43150 } 43151 if (!Tween.attrs[nodeId][this._id]) { 43152 Tween.attrs[nodeId][this._id] = {}; 43153 } 43154 if (!Tween.tweens[nodeId]) { 43155 Tween.tweens[nodeId] = {}; 43156 } 43157 for (key in config) { 43158 if (blacklist[key] === undefined) { 43159 this._addAttr(key, config[key]); 43160 } 43161 } 43162 this.reset(); 43163 this.onFinish = config.onFinish; 43164 this.onReset = config.onReset; 43165 this.onUpdate = config.onUpdate; 43166 } 43167 _addAttr(key, end) { 43168 const node = this.node, nodeId = node._id; 43169 let diff, len, trueEnd, trueStart, endRGBA; 43170 const tweenId = Tween.tweens[nodeId][key]; 43171 if (tweenId) { 43172 delete Tween.attrs[nodeId][tweenId][key]; 43173 } 43174 let start = node.getAttr(key); 43175 if (Util_1.Util._isArray(end)) { 43176 diff = []; 43177 len = Math.max(end.length, start.length); 43178 if (key === 'points' && end.length !== start.length) { 43179 if (end.length > start.length) { 43180 trueStart = start; 43181 start = Util_1.Util._prepareArrayForTween(start, end, node.closed()); 43182 } 43183 else { 43184 trueEnd = end; 43185 end = Util_1.Util._prepareArrayForTween(end, start, node.closed()); 43186 } 43187 } 43188 if (key.indexOf('fill') === 0) { 43189 for (let n = 0; n < len; n++) { 43190 if (n % 2 === 0) { 43191 diff.push(end[n] - start[n]); 43192 } 43193 else { 43194 const startRGBA = Util_1.Util.colorToRGBA(start[n]); 43195 endRGBA = Util_1.Util.colorToRGBA(end[n]); 43196 start[n] = startRGBA; 43197 diff.push({ 43198 r: endRGBA.r - startRGBA.r, 43199 g: endRGBA.g - startRGBA.g, 43200 b: endRGBA.b - startRGBA.b, 43201 a: endRGBA.a - startRGBA.a, 43202 }); 43203 } 43204 } 43205 } 43206 else { 43207 for (let n = 0; n < len; n++) { 43208 diff.push(end[n] - start[n]); 43209 } 43210 } 43211 } 43212 else if (colorAttrs.indexOf(key) !== -1) { 43213 start = Util_1.Util.colorToRGBA(start); 43214 endRGBA = Util_1.Util.colorToRGBA(end); 43215 diff = { 43216 r: endRGBA.r - start.r, 43217 g: endRGBA.g - start.g, 43218 b: endRGBA.b - start.b, 43219 a: endRGBA.a - start.a, 43220 }; 43221 } 43222 else { 43223 diff = end - start; 43224 } 43225 Tween.attrs[nodeId][this._id][key] = { 43226 start: start, 43227 diff: diff, 43228 end: end, 43229 trueEnd: trueEnd, 43230 trueStart: trueStart, 43231 }; 43232 Tween.tweens[nodeId][key] = this._id; 43233 } 43234 _tweenFunc(i) { 43235 const node = this.node, attrs = Tween.attrs[node._id][this._id]; 43236 let key, attr, start, diff, newVal, n, len, end; 43237 for (key in attrs) { 43238 attr = attrs[key]; 43239 start = attr.start; 43240 diff = attr.diff; 43241 end = attr.end; 43242 if (Util_1.Util._isArray(start)) { 43243 newVal = []; 43244 len = Math.max(start.length, end.length); 43245 if (key.indexOf('fill') === 0) { 43246 for (n = 0; n < len; n++) { 43247 if (n % 2 === 0) { 43248 newVal.push((start[n] || 0) + diff[n] * i); 43249 } 43250 else { 43251 newVal.push('rgba(' + 43252 Math.round(start[n].r + diff[n].r * i) + 43253 ',' + 43254 Math.round(start[n].g + diff[n].g *
43254i) + 43255 ',' + 43256 Math.round(start[n].b + diff[n].b * i) + 43257 ',' + 43258 (start[n].a + diff[n].a * i) + 43259 ')'); 43260 } 43261 } 43262 } 43263 else { 43264 for (n = 0; n < len; n++) { 43265 newVal.push((start[n] || 0) + diff[n] * i); 43266 } 43267 } 43268 } 43269 else if (colorAttrs.indexOf(key) !== -1) { 43270 newVal = 43271 'rgba(' + 43272 Math.round(start.r + diff.r * i) + 43273 ',' + 43274 Math.round(start.g + diff.g * i) + 43275 ',' + 43276 Math.round(start.b + diff.b * i) + 43277 ',' + 43278 (start.a + diff.a * i) + 43279 ')'; 43280 } 43281 else { 43282 newVal = start + diff * i; 43283 } 43284 node.setAttr(key, newVal); 43285 } 43286 } 43287 _addListeners() { 43288 this.tween.onPlay = () => { 43289 this.anim.start(); 43290 }; 43291 this.tween.onReverse = () => { 43292 this.anim.start(); 43293 }; 43294 this.tween.onPause = () => { 43295 this.anim.stop(); 43296 }; 43297 this.tween.onFinish = () => { 43298 const node = this.node; 43299 const attrs = Tween.attrs[node._id][this._id]; 43300 if (attrs.points && attrs.points.trueEnd) { 43301 node.setAttr('points', attrs.points.trueEnd); 43302 } 43303 if (this.onFinish) { 43304 this.onFinish.call(this); 43305 } 43306 }; 43307 this.tween.onReset = () => { 43308 const node = this.node; 43309 const attrs = Tween.attrs[node._id][this._id]; 43310 if (attrs.points && attrs.points.trueStart) { 43311 node.points(attrs.points.trueStart); 43312 } 43313 if (this.onReset) { 43314 this.onReset(); 43315 } 43316 }; 43317 this.tween.onUpdate = () => { 43318 if (this.onUpdate) { 43319 this.onUpdate.call(this); 43320 } 43321 }; 43322 } 43323 play() { 43324 this.tween.play(); 43325 return this; 43326 } 43327 reverse() { 43328 this.tween.reverse(); 43329 return this; 43330 } 43331 reset() { 43332 this.tween.reset(); 43333 return this; 43334 } 43335 seek(t) { 43336 this.tween.seek(t * 1000); 43337 return this; 43338 } 43339 pause() { 43340 this.tween.pause(); 43341 return this; 43342 } 43343 finish() { 43344 this.tween.finish(); 43345 return this; 43346 } 43347 destroy() { 43348 const nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId]; 43349 this.pause(); 43350 for (const key in attrs) { 43351 delete Tween.tweens[nodeId][key]; 43352 } 43353 delete Tween.attrs[nodeId][thisId]; 43354 } 43355 } 43356 exports.Tween = Tween; 43357 Tween.attrs = {}; 43358 Tween.tweens = {}; 43359 Node_1.Node.prototype.to = function (params) { 43360 const onFinish = params.onFinish; 43361 params.node = this; 43362 params.onFinish = function () { 43363 this.destroy(); 43364 if (onFinish) { 43365 onFinish(); 43366 } 43367 }; 43368 const tween = new Tween(params); 43369 tween.play(); 43370 }; 43371 exports.Easings = { 43372 BackEaseIn(t, b, c, d) { 43373 const s = 1.70158; 43374 return c * (t /= d) * t * ((s + 1) * t - s) + b; 43375 }, 43376 BackEaseOut(t, b, c, d) { 43377 const s = 1.70158; 43378 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; 43379 }, 43380 BackEaseInOut(t, b, c, d) { 43381 let s = 1.70158; 43382 if ((t /= d / 2) < 1) { 43383 return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b; 43384 } 43385 return (c / 2) * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; 43386 }, 43387 ElasticEaseIn(t, b, c, d, a, p) { 43388 let s = 0; 43389 if (t === 0) { 43390 return b; 43391 } 43392 if ((t /= d) === 1) { 43393 return b + c; 43394 } 43395 if (!p) { 43396 p = d * 0.3; 43397 } 43398 if (!a || a < Math.abs(c)) { 43399 a = c; 43400 s = p / 4; 43401 } 43402 else { 43403 s = (p / (2 * Math.PI)) * Math.asin(c / a); 43404 } 43405 return (-(a * 43406 Math.pow(2, 10 * (t -= 1)) * 43407 Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + b); 43408 }, 43409 ElasticEaseOut(t, b, c, d, a, p) { 43410 let s = 0; 43411 if (t === 0) { 43412 return b; 43413 } 43414 if ((t /= d) === 1) { 43415 return b + c; 43416 } 43417 if (!p) { 43418 p = d * 0.3; 43419 } 43420 if (!a || a < Math.abs(c)) { 43421 a = c; 43422 s = p / 4; 43423 } 43424 else { 43425 s = (p / (2 * Math.PI)) * Math.asin(c / a); 43426 } 43427 return (a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) + 43428 c + 43429 b); 43430 }, 43431 ElasticEaseInOut(t, b, c, d, a, p) { 43432 let s = 0; 43433 if (t === 0) { 43434 return b; 43435 } 43436 if ((t /= d / 2) === 2) { 43437 return b + c; 43438 } 43439 if (!p) { 43440 p = d * (0.3 * 1.5); 43441 } 43442 if (!a || a < Math.abs(c)) { 43443 a = c; 43444 s = p / 4; 43445 } 43446 else { 43447 s = (p / (2 * Math.PI)) * Math.asin(c / a); 43448 } 43449 if (t < 1) { 43450 return (-0.5 * 43451 (a * 43452 Math.pow(2, 10 * (t -= 1)) * 43453 Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + 43454 b); 43455 } 43456 return (a * 43457 Math.pow(2, -10 * (t -= 1)) * 43458 Math.sin(((t * d - s) * (2 * Math.PI)) / p) * 43459 0.5 + 43460 c + 43461 b); 43462 }, 43463 BounceEaseOut(t, b, c, d) { 43464 if ((t /= d) < 1 / 2.75) { 43465 return c * (7.5625 * t * t) + b; 43466 } 43467 else if (t < 2 / 2.75) { 43468 return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b; 43469 } 43470 else if (t < 2.5 / 2.75) { 43471 return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b; 43472 } 43473 else { 43474 return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b; 43475 } 43476 }, 43477 BounceEaseIn(t, b, c, d) { 43478 return c - exports.Easings.BounceEaseOut(d - t, 0, c, d) + b; 43479 }, 43480 BounceEaseInOut(t, b, c, d) { 43481 if (t < d / 2) { 43482 return exports.Easings.BounceEaseIn(t * 2, 0, c, d) * 0.5 + b; 43483 } 43484 else { 43485 return exports.Easings.BounceEaseOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b; 43486 } 43487 }, 43488 EaseIn(t, b, c, d) { 43489 return c * (t /= d) * t + b; 43490 }, 43491 EaseOut(t, b, c, d) { 43492 return -c * (t /= d) * (t - 2) + b; 43493 }, 43494 EaseInOut(t, b, c, d) { 43495 if ((t /= d / 2) < 1) { 43496 return (c / 2) * t * t + b; 43497 } 43498 return (-c / 2) * (--t * (t - 2) - 1) + b; 43499 }, 43500 StrongEaseIn(t, b, c, d) { 43501 return c * (t /= d) * t * t * t * t + b; 43502 }, 43503 StrongEaseOut(t, b, c, d) { 43504 return c * ((t = t / d - 1) * t * t * t * t + 1) + b; 43505 }, 43506 StrongEaseInOut(t, b, c, d) { 43507 if ((t /= d / 2) < 1) { 43508 return (c / 2) * t * t * t * t * t + b; 43509 } 43510 return (c / 2) * ((t -= 2) * t * t * t * t + 2) + b; 43511 }, 43512 Linear(t, b, c, d) { 43513 return (c * t) / d + b; 43514 }, 43515 }; 43516} (Tween)); 43517 43518(function (exports) { 43519 Object.defineProperty(exports, "__esModule", { value: true }); 43520 exports.Konva = void 0; 43521 const Global_1 = Global; 43522 const Util_1 = Util; 43523 const Node_1 = Node$2; 43524 const Container_1 = Container$1; 43525 const Stage_1 = Stage$1; 43526 const Layer_1 = Layer$2; 43527 const FastLayer_1 = FastLayer$1; 43528 const Group_1 = Group$2; 43529 const DragAndDrop_1 = DragAndDrop; 43530 const Shape_1 = Shape; 43531 const Animation_1 = Animation$1; 43532 const Tween_1 = Tween; 43533 const Context_1 = Context$1; 43534 const Canvas_1 = Canvas$1; 43535 exports.Konva = Util_1.Util._assign(Global_1.Konva, { 43536 Util: Util_1.Util, 43537 Transform: Util_1.Transform, 43538 Node: Node_1.Node, 43539 Container: Container_1.Container,
43540 Stage: Stage_1.Stage, 43541 stages: Stage_1.stages, 43542 Layer: Layer_1.Layer, 43543 FastLayer: FastLayer_1.FastLayer, 43544 Group: Group_1.Group, 43545 DD: DragAndDrop_1.DD, 43546 Shape: Shape_1.Shape, 43547 shapes: Shape_1.shapes, 43548 Animation: Animation_1.Animation, 43549 Tween: Tween_1.Tween, 43550 Easings: Tween_1.Easings, 43551 Context: Context_1.Context, 43552 Canvas: Canvas_1.Canvas, 43553 }); 43554 exports.default = exports.Konva; 43555} (_CoreInternals)); 43556 43557var Arc$1 = {}; 43558 43559Object.defineProperty(Arc$1, "__esModule", { value: true }); 43560Arc$1.Arc = void 0; 43561const Factory_1$v = Factory; 43562const Shape_1$f = Shape; 43563const Global_1$g = Global; 43564const Validators_1$u = Validators; 43565const Global_2$3 = Global; 43566class Arc extends Shape_1$f.Shape { 43567 _sceneFunc(context) { 43568 const angle = Global_1$g.Konva.getAngle(this.angle()), clockwise = this.clockwise(); 43569 context.beginPath(); 43570 context.arc(0, 0, this.outerRadius(), 0, angle, clockwise); 43571 context.arc(0, 0, this.innerRadius(), angle, 0, !clockwise); 43572 context.closePath(); 43573 context.fillStrokeShape(this); 43574 } 43575 getWidth() { 43576 return this.outerRadius() * 2; 43577 } 43578 getHeight() { 43579 return this.outerRadius() * 2; 43580 } 43581 setWidth(width) { 43582 this.outerRadius(width / 2); 43583 } 43584 setHeight(height) { 43585 this.outerRadius(height / 2); 43586 } 43587 getSelfRect() { 43588 const innerRadius = this.innerRadius(); 43589 const outerRadius = this.outerRadius(); 43590 const clockwise = this.clockwise(); 43591 const angle = Global_1$g.Konva.getAngle(clockwise ? 360 - this.angle() : this.angle()); 43592 const boundLeftRatio = Math.cos(Math.min(angle, Math.PI)); 43593 const boundRightRatio = 1; 43594 const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), (3 * Math.PI) / 2)); 43595 const boundBottomRatio = Math.sin(Math.min(angle, Math.PI / 2)); 43596 const boundLeft = boundLeftRatio * (boundLeftRatio > 0 ? innerRadius : outerRadius); 43597 const boundRight = boundRightRatio * (outerRadius ); 43598 const boundTop = boundTopRatio * (boundTopRatio > 0 ? innerRadius : outerRadius); 43599 const boundBottom = boundBottomRatio * (boundBottomRatio > 0 ? outerRadius : innerRadius); 43600 return { 43601 x: boundLeft, 43602 y: clockwise ? -1 * boundBottom : boundTop, 43603 width: boundRight - boundLeft, 43604 height: boundBottom - boundTop, 43605 }; 43606 } 43607} 43608Arc$1.Arc = Arc; 43609Arc.prototype._centroid = true; 43610Arc.prototype.className = 'Arc'; 43611Arc.prototype._attrsAffectingSize = [ 43612 'innerRadius', 43613 'outerRadius', 43614 'angle', 43615 'clockwise', 43616]; 43617(0, Global_2$3._registerNode)(Arc); 43618Factory_1$v.Factory.addGetterSetter(Arc, 'innerRadius', 0, (0, Validators_1$u.getNumberValidator)()); 43619Factory_1$v.Factory.addGetterSetter(Arc, 'outerRadius', 0, (0, Validators_1$u.getNumberValidator)()); 43620Factory_1$v.Factory.addGetterSetter(Arc, 'angle', 0, (0, Validators_1$u.getNumberValidator)()); 43621Factory_1$v.Factory.addGetterSetter(Arc, 'clockwise', false, (0, Validators_1$u.getBooleanValidator)()); 43622 43623var Arrow$1 = {}; 43624 43625var Line$1 = {}; 43626 43627Object.defineProperty(Line$1, "__esModule", { value: true }); 43628Line$1.Line = void 0; 43629const Factory_1$u = Factory; 43630const Global_1$f = Global; 43631const Shape_1$e = Shape; 43632const Validators_1$t = Validators; 43633function getControlPoints(x0, y0, x1, y1, x2, y2, t) { 43634 const d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0); 43635 return [p1x, p1y, p2x, p2y]; 43636} 43637function expandPoints(p, tension) { 43638 const len = p.length, allPoints = []; 43639 for (let n = 2; n < len - 2; n += 2) { 43640 const cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension); 43641 if (isNaN(cp[0])) { 43642 continue; 43643 } 43644 allPoints.push(cp[0]); 43645 allPoints.push(cp[1]); 43646 allPoints.push(p[n]); 43647 allPoints.push(p[n + 1]); 43648 allPoints.push(cp[2]); 43649 allPoints.push(cp[3]); 43650 } 43651 return allPoints; 43652} 43653class Line extends Shape_1$e.Shape { 43654 constructor(config) { 43655 super(config); 43656 this.on('pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva', function () { 43657 this._clearCache('tensionPoints'); 43658 }); 43659 } 43660 _sceneFunc(context) { 43661 let points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n; 43662 if (!length) { 43663 return; 43664 } 43665 context.beginPath(); 43666 context.moveTo(points[0], points[1]); 43667 if (tension !== 0 && length > 4) { 43668 tp = this.getTensionPoints(); 43669 len = tp.length; 43670 n = closed ? 0 : 4; 43671 if (!closed) { 43672 context.quadraticCurveTo(tp[0], tp[1], tp[2], tp[3]); 43673 } 43674 while (n < len - 2) { 43675 context.bezierCurveTo(tp[n++], tp[n++], tp[n++], tp[n++], tp[n++], tp[n++]); 43676 } 43677 if (!closed) { 43678 context.quadraticCurveTo(tp[len - 2], tp[len - 1], points[length - 2], points[length - 1]); 43679 } 43680 } 43681 else if (bezier) { 43682 n = 2; 43683 while (n < length) { 43684 context.bezierCurveTo(points[n++], points[n++], points[n++], points[n++], points[n++], points[n++]); 43685 } 43686 } 43687 else { 43688 for (n = 2; n < length; n += 2) { 43689 context.lineTo(points[n], points[n + 1]); 43690 } 43691 } 43692 if (closed) { 43693 context.closePath(); 43694 context.fillStrokeShape(this); 43695 } 43696 else { 43697 context.strokeShape(this); 43698 } 43699 } 43700 getTensionPoints() { 43701 return this._getCache('tensionPoints', this._getTensionPoints); 43702 } 43703 _getTensionPoints() { 43704 if (this.closed()) { 43705 return this._getTensionPointsClosed(); 43706 } 43707 else { 43708 return expandPoints(this.points(), this.tension()); 43709 } 43710 } 43711 _getTensionPointsClosed() { 43712 const p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]] 43713 .concat(middle) 43714 .concat([ 43715 lastControlPoints[0], 43716 lastControlPoints[1], 43717 p[len - 2], 43718 p[len - 1], 43719 lastControlPoints[2], 43720 lastControlPoints[3], 43721 firstControlPoints[0], 43722 firstControlPoints[1], 43723 p[0], 43724 p[1], 43725 ]); 43726 return tp; 43727 } 43728 getWidth() {
43729 return this.getSelfRect().width; 43730 } 43731 getHeight() { 43732 return this.getSelfRect().height; 43733 } 43734 getSelfRect() { 43735 let points = this.points(); 43736 if (points.length < 4) { 43737 return { 43738 x: points[0] || 0, 43739 y: points[1] || 0, 43740 width: 0, 43741 height: 0, 43742 }; 43743 } 43744 if (this.tension() !== 0) { 43745 points = [ 43746 points[0], 43747 points[1], 43748 ...this._getTensionPoints(), 43749 points[points.length - 2], 43750 points[points.length - 1], 43751 ]; 43752 } 43753 else { 43754 points = this.points(); 43755 } 43756 let minX = points[0]; 43757 let maxX = points[0]; 43758 let minY = points[1]; 43759 let maxY = points[1]; 43760 let x, y; 43761 for (let i = 0; i < points.length / 2; i++) { 43762 x = points[i * 2]; 43763 y = points[i * 2 + 1]; 43764 minX = Math.min(minX, x); 43765 maxX = Math.max(maxX, x); 43766 minY = Math.min(minY, y); 43767 maxY = Math.max(maxY, y); 43768 } 43769 return { 43770 x: minX, 43771 y: minY, 43772 width: maxX - minX, 43773 height: maxY - minY, 43774 }; 43775 } 43776} 43777Line$1.Line = Line; 43778Line.prototype.className = 'Line'; 43779Line.prototype._attrsAffectingSize = ['points', 'bezier', 'tension']; 43780(0, Global_1$f._registerNode)(Line); 43781Factory_1$u.Factory.addGetterSetter(Line, 'closed', false); 43782Factory_1$u.Factory.addGetterSetter(Line, 'bezier', false); 43783Factory_1$u.Factory.addGetterSetter(Line, 'tension', 0, (0, Validators_1$t.getNumberValidator)()); 43784Factory_1$u.Factory.addGetterSetter(Line, 'points', [], (0, Validators_1$t.getNumberArrayValidator)()); 43785 43786var Path$1 = {}; 43787 43788var BezierFunctions = {}; 43789 43790(function (exports) { 43791 Object.defineProperty(exports, "__esModule", { value: true }); 43792 exports.t2length = exports.getQuadraticArcLength = exports.getCubicArcLength = exports.binomialCoefficients = exports.cValues = exports.tValues = void 0; 43793 exports.tValues = [ 43794 [], 43795 [], 43796 [ 43797 -0.5773502691896257, 43798 0.5773502691896257645091487805019574556476, 43799 ], 43800 [ 43801 0, -0.7745966692414834, 43802 0.7745966692414833770358530799564799221665, 43803 ], 43804 [ 43805 -0.33998104358485626, 43806 0.3399810435848562648026657591032446872005, 43807 -0.8611363115940526, 43808 0.8611363115940525752239464888928095050957, 43809 ], 43810 [ 43811 0, -0.5384693101056831, 43812 0.5384693101056830910363144207002088049672, 43813 -0.906179845938664, 43814 0.9061798459386639927976268782993929651256, 43815 ], 43816 [ 43817 0.6612093864662645136613995950199053470064, 43818 -0.6612093864662645, 43819 -0.2386191860831969, 43820 0.2386191860831969086305017216807119354186, 43821 -0.932469514203152, 43822 0.9324695142031520278123015544939946091347, 43823 ], 43824 [ 43825 0, 0.4058451513773971669066064120769614633473, 43826 -0.4058451513773972, 43827 -0.7415311855993945, 43828 0.7415311855993944398638647732807884070741, 43829 -0.9491079123427585, 43830 0.9491079123427585245261896840478512624007, 43831 ], 43832 [ 43833 -0.1834346424956498, 43834 0.1834346424956498049394761423601839806667, 43835 -0.525532409916329, 43836 0.5255324099163289858177390491892463490419, 43837 -0.7966664774136267, 43838 0.7966664774136267395915539364758304368371, 43839 -0.9602898564975363, 43840 0.9602898564975362316835608685694729904282, 43841 ], 43842 [ 43843 0, -0.8360311073266358, 43844 0.8360311073266357942994297880697348765441, 43845 -0.9681602395076261, 43846 0.9681602395076260898355762029036728700494, 43847 -0.3242534234038089, 43848 0.3242534234038089290385380146433366085719, 43849 -0.6133714327005904, 43850 0.6133714327005903973087020393414741847857, 43851 ], 43852 [ 43853 -0.14887433898163122, 43854 0.1488743389816312108848260011297199846175, 43855 -0.4333953941292472, 43856 0.4333953941292471907992659431657841622, 43857 -0.6794095682990244, 43858 0.6794095682990244062343273651148735757692, 43859 -0.8650633666889845, 43860 0.8650633666889845107320966884234930485275, 43861 -0.9739065285171717, 43862 0.9739065285171717200779640120844520534282, 43863 ], 43864 [ 43865 0, -0.26954315595234496, 43866 0.2695431559523449723315319854008615246796, 43867 -0.5190961292068118, 43868 0.5190961292068118159257256694586095544802, 43869 -0.7301520055740494,
43870 0.7301520055740493240934162520311534580496, 43871 -0.8870625997680953, 43872 0.8870625997680952990751577693039272666316, 43873 -0.978228658146057, 43874 0.9782286581460569928039380011228573907714, 43875 ], 43876 [ 43877 -0.1252334085114689, 43878 0.1252334085114689154724413694638531299833, 43879 -0.3678314989981802, 43880 0.3678314989981801937526915366437175612563, 43881 -0.5873179542866175, 43882 0.587317954286617447296702418940534280369, 43883 -0.7699026741943047, 43884 0.7699026741943046870368938332128180759849, 43885 -0.9041172563704749, 43886 0.9041172563704748566784658661190961925375, 43887 -0.9815606342467192, 43888 0.9815606342467192506905490901492808229601, 43889 ], 43890 [ 43891 0, -0.2304583159551348, 43892 0.2304583159551347940655281210979888352115, 43893 -0.44849275103644687, 43894 0.4484927510364468528779128521276398678019, 43895 -0.6423493394403402, 43896 0.6423493394403402206439846069955156500716, 43897 -0.8015780907333099, 43898 0.8015780907333099127942064895828598903056, 43899 -0.9175983992229779, 43900 0.9175983992229779652065478365007195123904, 43901 -0.9841830547185881, 43902 0.9841830547185881494728294488071096110649, 43903 ], 43904 [ 43905 -0.10805494870734367, 43906 0.1080549487073436620662446502198347476119, 43907 -0.31911236892788974, 43908 0.3191123689278897604356718241684754668342, 43909 -0.5152486363581541, 43910 0.5152486363581540919652907185511886623088, 43911 -0.6872929048116855, 43912 0.6872929048116854701480198030193341375384, 43913 -0.827201315069765, 43914 0.8272013150697649931897947426503949610397, 43915 -0.9284348836635735, 43916 0.928434883663573517336391139377874264477, 43917 -0.9862838086968123, 43918 0.986283808696812338841597266704052801676, 43919 ], 43920 [ 43921 0, -0.20119409399743451, 43922 0.2011940939974345223006283033945962078128, 43923 -0.3941513470775634, 43924 0.3941513470775633698972073709810454683627, 43925 -0.5709721726085388, 43926 0.5709721726085388475372267372539106412383, 43927 -0.7244177313601701, 43928 0.7244177313601700474161860546139380096308, 43929 -0.8482065834104272, 43930 0.8482065834104272162006483207742168513662, 43931 -0.937273392400706, 43932 0.9372733924007059043077589477102094712439, 43933 -0.9879925180204854, 43934 0.9879925180204854284895657185866125811469, 43935 ], 43936 [ 43937 -0.09501250983763744, 43938 0.0950125098376374401853193354249580631303, 43939 -0.2816035507792589, 43940 0.281603550779258913230460501460496106486, 43941 -0.45801677765722737, 43942 0.45801677765722738634241944298357757354, 43943 -0.6178762444026438, 43944 0.6178762444026437484466717640487910189918, 43945 -0.755404408355003, 43946 0.7554044083550030338951011948474422683538, 43947 -0.8656312023878318, 43948 0.8656312023878317438804678977123931323873, 43949 -0.9445750230732326, 43950 0.9445750230732325760779884155346083450911, 43951 -0.9894009349916499, 43952 0.9894009349916499325961541734503326274262, 43953 ], 43954 [ 43955 0, -0.17848418149584785, 43956 0.1784841814958478558506774936540655574754, 43957 -0.3512317634538763, 43958 0.3512317634538763152971855170953460050405, 43959 -0.5126905370864769, 43960 0.5126905370864769678862465686295518745829, 43961 -0.6576711592166907, 43962 0.6576711592166907658503022166430023351478, 43963 -0.7815140038968014, 43964 0.7815140038968014069252300555204760502239, 43965 -0.8802391537269859, 43966 0.8802391537269859021229556944881556926234, 43967 -0.9506755217687678, 43968 0.9506755217687677612227169578958030214433, 43969 -0.9905754753144174, 43970 0.9905754753144173356754340199406652765077, 43971 ], 43972 [ 43973 -0.0847750130417353, 43974 0.0847750130417353012422618529357838117333, 43975 -0.2518862256915055, 43976 0.2518862256915055095889728548779112301628, 43977 -0.41175116146284263, 43978 0.4117511614628426460359317938330516370789, 43979 -0.5597708310739475, 43980 0.5597708310739475346078715485253291369276, 43981 -0.6916870430603532, 43982 0.6916870430603532078748910812888483894522, 43983 -0.8037049589725231, 43984 0.8037049589725231156824174550145907971032, 43985 -0.8926024664975557, 43986 0.8926024664975557392060605911271455154078, 43987 -0.9558239495713977, 43988 0.9558239495713977551811958929297763099728, 43989 -0.9915651684209309, 43990 0.9915651684209309467300160047061507702525, 43991 ], 43992 [ 43993 0, -0.16035864564022537, 43994 0.1603586456402253758680961157407435495048, 43995 -0.31656409996362983, 43996 0.3165640999636298319901173288498449178922, 43997 -0.46457074137596094, 43998 0.4645707413759609457172671481041023679762, 43999 -0.600545304661681, 44000 0.6005453046616810234696381649462392798683, 44001 -0.7209661773352294, 44002 0.7209661773352293786170958608237816296571, 44003 -0.8227146565371428, 44004 0.8227146565371428249789224867127139017745, 44005 -0.9031559036148179, 44006 0.9031559036148179016426609285323124878093, 44007 -0.96020815213483, 44008 0.960208152134830030852778840687651526615, 44009 -0.9924068438435844, 44010 0.9924068438435844031890176702532604935893, 44011 ], 44012 [ 44013 -0.07652652113349734, 44014 0.0765265211334973337546404093988382110047, 44015 -0.22778585114164507, 44016 0.227785851141645078080496195368574624743, 44017 -0.37370608871541955, 44018 0.3737060887154195606725481770249272373957, 44019 -0.5108670019508271, 44020 0.5108670019508270980043640509552509984254, 44021 -0.636053680726515, 44022 0.6360536807265150254528366962262859367433, 44023 -0.7463319064601508, 44024 0.7463319064601507926143050703556415903107, 44025 -0.8391169718222188, 44026 0.8391169718222188233945290617015206853296, 44027 -0.912234428251326, 44028 0.9122344282513259058677524412032981130491, 44029 -0.9639719272779138, 44030 0.963971927277913791267666131197277221912, 44031 -0.9931285991850949, 44032 0.9931285991850949247861223884713202782226, 44033 ], 44034 [ 44035 0, -0.1455618541608951, 44036 0.1455618541608950909370309823386863301163, 44037 -0.2880213168024011, 44038 0.288021316802401096600792516064600319909, 44039 -0.4243421202074388, 44040 0.4243421202074387835736688885437880520964, 44041 -0.5516188358872198, 44042 0.551618835887219807059018796724313286622, 44043 -0.6671388041974123, 44044 0.667138804197412319305966669990339162597, 44045 -0.7684399634756779, 44046 0.7684399634756779086158778513062280348209, 44047 -0.8533633645833173, 44048 0.8533633645833172836472506385875676702761, 44049 -0.9200993341504008, 44050 0.9200993341504008287901871337149688941591, 44051 -0.9672268385663063, 44052 0.9672268385663062943166222149076951614246, 44053 -0.9937521706203895, 44054 0.9937521706203895002602420359379409291933, 44055 ], 44056 [ 44057 -0.06973927331972223, 44058 0.0697392733197222212138417961186280818222, 44059 -0.20786042668822127, 44060 0.2078604266882212854788465339195457342156, 44061 -0.34193582089208424, 44062 0.3419358208920842251581474204273796195591, 44063 -0.469355837986757, 44064 0.4693558379867570264063307109664063460953, 44065 -0.5876404035069116,
44066 0.5876404035069115929588769276386473488776, 44067 -0.6944872631866827, 44068 0.6944872631866827800506898357622567712673, 44069 -0.7878168059792081, 44070 0.7878168059792081620042779554083515213881, 44071 -0.8658125777203002, 44072 0.8658125777203001365364256370193787290847, 44073 -0.926956772187174, 44074 0.9269567721871740005206929392590531966353, 44075 -0.9700604978354287, 44076 0.9700604978354287271239509867652687108059, 44077 -0.9942945854823992, 44078 0.994294585482399292073031421161298980393, 44079 ], 44080 [ 44081 0, -0.1332568242984661, 44082 0.1332568242984661109317426822417661370104, 44083 -0.26413568097034495, 44084 0.264135680970344930533869538283309602979, 44085 -0.3903010380302908, 44086 0.390301038030290831421488872880605458578, 44087 -0.5095014778460075, 44088 0.5095014778460075496897930478668464305448, 44089 -0.6196098757636461, 44090 0.6196098757636461563850973116495956533871, 44091 -0.7186613631319502, 44092 0.7186613631319501944616244837486188483299, 44093 -0.8048884016188399, 44094 0.8048884016188398921511184069967785579414, 44095 -0.8767523582704416, 44096 0.8767523582704416673781568859341456716389, 44097 -0.9329710868260161, 44098 0.9329710868260161023491969890384229782357, 44099 -0.9725424712181152, 44100 0.9725424712181152319560240768207773751816, 44101 -0.9947693349975522, 44102 0.9947693349975521235239257154455743605736, 44103 ], 44104 [ 44105 -0.06405689286260563, 44106 0.0640568928626056260850430826247450385909, 44107 -0.1911188674736163, 44108 0.1911188674736163091586398207570696318404, 44109 -0.3150426796961634, 44110 0.3150426796961633743867932913198102407864, 44111 -0.4337935076260451, 44112 0.4337935076260451384870842319133497124524, 44113 -0.5454214713888396, 44114 0.5454214713888395356583756172183723700107, 44115 -0.6480936519369755, 44116 0.6480936519369755692524957869107476266696, 44117 -0.7401241915785544, 44118 0.7401241915785543642438281030999784255232, 44119 -0.820001985973903, 44120 0.8200019859739029219539498726697452080761, 44121 -0.8864155270044011, 44122 0.8864155270044010342131543419821967550873, 44123 -0.9382745520027328, 44124 0.9382745520027327585236490017087214496548, 44125 -0.9747285559713095, 44126 0.9747285559713094981983919930081690617411, 44127 -0.9951872199970213, 44128 0.9951872199970213601799974097007368118745, 44129 ], 44130 ]; 44131 exports.cValues = [ 44132 [], 44133 [], 44134 [1.0, 1.0], 44135 [ 44136 0.8888888888888888888888888888888888888888, 44137 0.5555555555555555555555555555555555555555, 44138 0.5555555555555555555555555555555555555555, 44139 ], 44140 [ 44141 0.6521451548625461426269360507780005927646, 44142 0.6521451548625461426269360507780005927646, 44143 0.3478548451374538573730639492219994072353, 44144 0.3478548451374538573730639492219994072353, 44145 ], 44146 [ 44147 0.5688888888888888888888888888888888888888, 44148 0.4786286704993664680412915148356381929122, 44149 0.4786286704993664680412915148356381929122, 44150 0.2369268850561890875142640407199173626432, 44151 0.2369268850561890875142640407199173626432, 44152 ], 44153 [ 44154 0.3607615730481386075698335138377161116615, 44155 0.3607615730481386075698335138377161116615, 44156 0.4679139345726910473898703439895509948116, 44157 0.4679139345726910473898703439895509948116, 44158 0.1713244923791703450402961421727328935268, 44159 0.1713244923791703450402961421727328935268, 44160 ], 44161 [ 44162 0.4179591836734693877551020408163265306122, 44163 0.3818300505051189449503697754889751338783, 44164 0.3818300505051189449503697754889751338783, 44165 0.2797053914892766679014677714237795824869, 44166 0.2797053914892766679014677714237795824869, 44167 0.1294849661688696932706114326790820183285, 44168 0.1294849661688696932706114326790820183285, 44169 ], 44170 [ 44171 0.3626837833783619829651504492771956121941, 44172 0.3626837833783619829651504492771956121941, 44173 0.3137066458778872873379622019866013132603, 44174 0.3137066458778872873379622019866013132603, 44175 0.2223810344533744705443559944262408844301, 44176 0.2223810344533744705443559944262408844301, 44177 0.1012285362903762591525313543099621901153, 44178 0.1012285362903762591525313543099621901153, 44179 ], 44180 [ 44181 0.3302393550012597631645250692869740488788, 44182 0.1806481606948574040584720312429128095143, 44183 0.1806481606948574040584720312429128095143, 44184 0.0812743883615744119718921581105236506756, 44185 0.0812743883615744119718921581105236506756, 44186 0.3123470770400028400686304065844436655987, 44187 0.3123470770400028400686304065844436655987, 44188 0.2606106964029354623187428694186328497718, 44189 0.2606106964029354623187428694186328497718, 44190 ], 44191 [ 44192 0.295524224714752870173892994651338329421, 44193 0.295524224714752870173892994651338329421, 44194 0.2692667193099963550912269215694693528597, 44195 0.2692667193099963550912269215694693528597, 44196 0.2190863625159820439955349342281631924587, 44197 0.2190863625159820439955349342281631924587, 44198 0.1494513491505805931457763396576973324025, 44199 0.1494513491505805931457763396576973324025, 44200 0.0666713443086881375935688098933317928578, 44201 0.0666713443086881375935688098933317928578, 44202 ], 44203 [ 44204 0.272925086777900630714483528336342189156, 44205 0.2628045445102466621806888698905091953727, 44206 0.2628045445102466621806888698905091953727, 44207 0.2331937645919904799185237048431751394317, 44208 0.2331937645919904799185237048431751394317, 44209 0.1862902109277342514260976414316558916912, 44210 0.1862902109277342514260976414316558916912, 44211 0.1255803694649046246346942992239401001976, 44212 0.1255803694649046246346942992239401001976, 44213 0.0556685671161736664827537204425485787285, 44214 0.0556685671161736664827537204425485787285, 44215 ], 44216 [ 44217 0.2491470458134027850005624360429512108304, 44218 0.2491470458134027850005624360429512108304, 44219 0.2334925365383548087608498989248780562594, 44220 0.2334925365383548087608498989248780562594,
44221 0.2031674267230659217490644558097983765065, 44222 0.2031674267230659217490644558097983765065, 44223 0.160078328543346226334652529543359071872, 44224 0.160078328543346226334652529543359071872, 44225 0.1069393259953184309602547181939962242145, 44226 0.1069393259953184309602547181939962242145, 44227 0.047175336386511827194615961485017060317, 44228 0.047175336386511827194615961485017060317, 44229 ], 44230 [ 44231 0.2325515532308739101945895152688359481566, 44232 0.2262831802628972384120901860397766184347, 44233 0.2262831802628972384120901860397766184347, 44234 0.2078160475368885023125232193060527633865, 44235 0.2078160475368885023125232193060527633865, 44236 0.1781459807619457382800466919960979955128, 44237 0.1781459807619457382800466919960979955128, 44238 0.1388735102197872384636017768688714676218, 44239 0.1388735102197872384636017768688714676218, 44240 0.0921214998377284479144217759537971209236, 44241 0.0921214998377284479144217759537971209236, 44242 0.0404840047653158795200215922009860600419, 44243 0.0404840047653158795200215922009860600419, 44244 ], 44245 [ 44246 0.2152638534631577901958764433162600352749, 44247 0.2152638534631577901958764433162600352749, 44248 0.2051984637212956039659240656612180557103, 44249 0.2051984637212956039659240656612180557103, 44250 0.1855383974779378137417165901251570362489, 44251 0.1855383974779378137417165901251570362489, 44252 0.1572031671581935345696019386238421566056, 44253 0.1572031671581935345696019386238421566056, 44254 0.1215185706879031846894148090724766259566, 44255 0.1215185706879031846894148090724766259566, 44256 0.0801580871597602098056332770628543095836, 44257 0.0801580871597602098056332770628543095836, 44258 0.0351194603317518630318328761381917806197, 44259 0.0351194603317518630318328761381917806197, 44260 ], 44261 [ 44262 0.2025782419255612728806201999675193148386, 44263 0.1984314853271115764561183264438393248186, 44264 0.1984314853271115764561183264438393248186, 44265 0.1861610000155622110268005618664228245062, 44266 0.1861610000155622110268005618664228245062, 44267 0.1662692058169939335532008604812088111309, 44268 0.1662692058169939335532008604812088111309, 44269 0.1395706779261543144478047945110283225208, 44270 0.1395706779261543144478047945110283225208, 44271 0.1071592204671719350118695466858693034155, 44272 0.1071592204671719350118695466858693034155, 44273 0.0703660474881081247092674164506673384667, 44274 0.0703660474881081247092674164506673384667, 44275 0.0307532419961172683546283935772044177217, 44276 0.0307532419961172683546283935772044177217, 44277 ], 44278 [ 44279 0.1894506104550684962853967232082831051469, 44280 0.1894506104550684962853967232082831051469, 44281 0.1826034150449235888667636679692199393835, 44282 0.1826034150449235888667636679692199393835, 44283 0.1691565193950025381893120790303599622116, 44284 0.1691565193950025381893120790303599622116, 44285 0.1495959888165767320815017305474785489704, 44286 0.1495959888165767320815017305474785489704, 44287 0.1246289712555338720524762821920164201448, 44288 0.1246289712555338720524762821920164201448, 44289 0.0951585116824927848099251076022462263552, 44290 0.0951585116824927848099251076022462263552, 44291 0.0622535239386478928628438369943776942749, 44292 0.0622535239386478928628438369943776942749, 44293 0.0271524594117540948517805724560181035122, 44294 0.0271524594117540948517805724560181035122, 44295 ], 44296 [ 44297 0.1794464703562065254582656442618856214487, 44298 0.1765627053669926463252709901131972391509, 44299 0.1765627053669926463252709901131972391509, 44300 0.1680041021564500445099706637883231550211, 44301 0.1680041021564500445099706637883231550211, 44302 0.1540457610768102880814315948019586119404, 44303 0.1540457610768102880814315948019586119404, 44304 0.1351363684685254732863199817023501973721, 44305 0.1351363684685254732863199817023501973721, 44306 0.1118838471934039710947883856263559267358, 44307 0.1118838471934039710947883856263559267358, 44308 0.0850361483171791808835353701910620738504, 44309 0.0850361483171791808835353701910620738504, 44310 0.0554595293739872011294401653582446605128, 44311 0.0554595293739872011294401653582446605128, 44312 0.0241483028685479319601100262875653246916, 44313 0.0241483028685479319601100262875653246916, 44314 ], 44315 [ 44316 0.1691423829631435918406564701349866103341, 44317 0.1691423829631435918406564701349866103341, 44318 0.1642764837458327229860537764659275904123, 44319 0.1642764837458327229860537764659275904123, 44320 0.1546846751262652449254180038363747721932, 44321 0.1546846751262652449254180038363747721932, 44322 0.1406429146706506512047313037519472280955, 44323 0.1406429146706506512047313037519472280955,
44324 0.1225552067114784601845191268002015552281, 44325 0.1225552067114784601845191268002015552281, 44326 0.1009420441062871655628139849248346070628, 44327 0.1009420441062871655628139849248346070628, 44328 0.0764257302548890565291296776166365256053, 44329 0.0764257302548890565291296776166365256053, 44330 0.0497145488949697964533349462026386416808, 44331 0.0497145488949697964533349462026386416808, 44332 0.0216160135264833103133427102664524693876, 44333 0.0216160135264833103133427102664524693876, 44334 ], 44335 [ 44336 0.1610544498487836959791636253209167350399, 44337 0.1589688433939543476499564394650472016787, 44338 0.1589688433939543476499564394650472016787, 44339 0.152766042065859666778855400897662998461, 44340 0.152766042065859666778855400897662998461, 44341 0.1426067021736066117757461094419029724756, 44342 0.1426067021736066117757461094419029724756, 44343 0.1287539625393362276755157848568771170558, 44344 0.1287539625393362276755157848568771170558, 44345 0.1115666455473339947160239016817659974813, 44346 0.1115666455473339947160239016817659974813, 44347 0.0914900216224499994644620941238396526609, 44348 0.0914900216224499994644620941238396526609, 44349 0.0690445427376412265807082580060130449618, 44350 0.0690445427376412265807082580060130449618, 44351 0.0448142267656996003328381574019942119517, 44352 0.0448142267656996003328381574019942119517, 44353 0.0194617882297264770363120414644384357529, 44354 0.0194617882297264770363120414644384357529, 44355 ], 44356 [ 44357 0.1527533871307258506980843319550975934919, 44358 0.1527533871307258506980843319550975934919, 44359 0.1491729864726037467878287370019694366926, 44360 0.1491729864726037467878287370019694366926, 44361 0.1420961093183820513292983250671649330345, 44362 0.1420961093183820513292983250671649330345, 44363 0.1316886384491766268984944997481631349161, 44364 0.1316886384491766268984944997481631349161, 44365 0.118194531961518417312377377711382287005, 44366 0.118194531961518417312377377711382287005, 44367 0.1019301198172404350367501354803498761666, 44368 0.1019301198172404350367501354803498761666, 44369 0.0832767415767047487247581432220462061001, 44370 0.0832767415767047487247581432220462061001, 44371 0.0626720483341090635695065351870416063516, 44372 0.0626720483341090635695065351870416063516, 44373 0.040601429800386941331039952274932109879, 44374 0.040601429800386941331039952274932109879, 44375 0.0176140071391521183118619623518528163621, 44376 0.0176140071391521183118619623518528163621, 44377 ], 44378 [ 44379 0.1460811336496904271919851476833711882448, 44380 0.1445244039899700590638271665537525436099, 44381 0.1445244039899700590638271665537525436099, 44382 0.1398873947910731547221334238675831108927, 44383 0.1398873947910731547221334238675831108927, 44384 0.132268938633337461781052574496775604329, 44385 0.132268938633337461781052574496775604329, 44386 0.1218314160537285341953671771257335983563, 44387 0.1218314160537285341953671771257335983563, 44388 0.1087972991671483776634745780701056420336, 44389 0.1087972991671483776634745780701056420336, 44390 0.0934444234560338615532897411139320884835, 44391 0.0934444234560338615532897411139320884835, 44392 0.0761001136283793020170516533001831792261, 44393 0.0761001136283793020170516533001831792261, 44394 0.0571344254268572082836358264724479574912, 44395 0.0571344254268572082836358264724479574912, 44396 0.0369537897708524937999506682993296661889, 44397 0.0369537897708524937999506682993296661889, 44398 0.0160172282577743333242246168584710152658, 44399 0.0160172282577743333242246168584710152658, 44400 ], 44401 [ 44402 0.1392518728556319933754102483418099578739, 44403 0.1392518728556319933754102483418099578739, 44404 0.1365414983460151713525738312315173965863, 44405 0.1365414983460151713525738312315173965863, 44406 0.1311735047870623707329649925303074458757, 44407 0.1311735047870623707329649925303074458757, 44408 0.1232523768105124242855609861548144719594, 44409 0.1232523768105124242855609861548144719594, 44410 0.1129322960805392183934006074217843191142, 44411 0.1129322960805392183934006074217843191142, 44412 0.1004141444428809649320788378305362823508, 44413 0.1004141444428809649320788378305362823508, 44414 0.0859416062170677274144436813727028661891, 44415 0.0859416062170677274144436813727028661891, 44416 0.0697964684245204880949614189302176573987, 44417 0.0697964684245204880949614189302176573987, 44418 0.0522933351526832859403120512732112561121, 44419 0.0522933351526832859403120512732112561121, 44420 0.0337749015848141547933022468659129013491, 44421 0.0337749015848141547933022468659129013491, 44422 0.0146279952982722006849910980471854451902, 44423 0.0146279952982722006849910980471854451902, 44424 ], 44425 [ 44426 0.1336545721861061753514571105458443385831, 44427 0.132462039404696617371642464703316925805, 44428 0.132462039404696617371642464703316925805, 44429 0.1289057221880821499785953393997936532597, 44430 0.1289057221880821499785953393997936532597, 44431 0.1230490843067295304675784006720096548158, 44432 0.1230490843067295304675784006720096548158, 44433 0.1149966402224113649416435129339613014914, 44434 0.1149966402224113649416435129339613014914, 44435 0.1048920914645414100740861850147438548584, 44436 0.1048920914645414100740861850147438548584, 44437 0.0929157660600351474770186173697646486034, 44438 0.0929157660600351474770186173697646486034, 44439 0.0792814117767189549228925247420432269137, 44440 0.0792814117767189549228925247420432269137, 44441 0.0642324214085258521271696151589109980391, 44442 0.0642324214085258521271696151589109980391, 44443 0.0480376717310846685716410716320339965612, 44444 0.0480376717310846685716410716320339965612, 44445 0.0309880058569794443106942196418845053837, 44446 0.0309880058569794443106942196418845053837, 44447 0.0134118594871417720813094934586150649766, 44448 0.0134118594871417720813094934586150649766, 44449 ], 44450 [ 44451 0.1279381953467521569740561652246953718517, 44452 0.1279381953467521569740561652246953718517, 44453 0.1258374563468282961213753825111836887264, 44454 0.1258374563468282961213753825111836887264, 44455 0.121670472927803391204463153476262425607, 44456 0.121670472927803391204463153476262425607, 44457 0.1155056680537256013533444839067835598622, 44458 0.1155056680537256013533444839067835598622, 44459 0.1074442701159656347825773424466062227946, 44460 0.1074442701159656347825773424466062227946, 44461 0.0976186521041138882698806644642471544279, 44462 0.0976186521041138882698806644642471544279, 44463 0.086190161531953275917185202983742667185, 44464 0.086190161531953275917185202983742667185, 44465 0.0733464814110803057340336152531165181193, 44466 0.0733464814110803057340336152531165181193, 44467 0.0592985849154367807463677585001085845412, 44468 0.0592985849154367807463677585001085845412, 44469 0.0442774388174198061686027482113382288593, 44470 0.0442774388174198061686027482113382288593, 44471 0.0285313886289336631813078159518782864491, 44472 0.0285313886289336631813078159518782864491, 44473 0.0123412297999871995468056670700372915759, 44474 0.0123412297999871995468056670700372915759, 44475 ], 44476 ]; 44477 exports.binomialCoefficients = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]; 44478 const getCubicArcLength = (xs, ys, t) => { 44479 let sum; 44480 let correctedT; 44481 const n = 20; 44482 const z = t / 2; 44483 sum = 0; 44484 for (let i = 0; i < n; i++) { 44485 correctedT = z * exports.tValues[n][i] + z; 44486 sum += exports.cValues[n][i] * BFunc(xs, ys, correctedT); 44487 } 44488 return z * sum; 44489 }; 44490 exports.getCubicArcLength = getCubicArcLength; 44491 const getQuadraticArcLength = (xs, ys, t) => { 44492 if (t === undefined) { 44493 t = 1; 44494 } 44495 const ax = xs[0] - 2 * xs[1] + xs[2]; 44496 const ay = ys[0] - 2 * ys[1] + ys[2]; 44497 const bx = 2 * xs[1] - 2 * xs[0]; 44498 const by = 2 * ys[1] - 2 * ys[0]; 44499 const A = 4 * (ax * ax + ay * ay); 44500 const B = 4 * (ax * bx + ay * by); 44501 const C = bx * bx + by * by; 44502 if (A === 0) { 44503 return (t * Math.sqrt(Math.pow(xs[2] - xs[0], 2) + Math.pow(ys[2] - ys[0], 2))); 44504 } 44505 const b = B / (2 * A); 44506 const c = C / A; 44507 const u = t + b;
44508 const k = c - b * b; 44509 const uuk = u * u + k > 0 ? Math.sqrt(u * u + k) : 0; 44510 const bbk = b * b + k > 0 ? Math.sqrt(b * b + k) : 0; 44511 const term = b + Math.sqrt(b * b + k) !== 0 44512 ? k * Math.log(Math.abs((u + uuk) / (b + bbk))) 44513 : 0; 44514 return (Math.sqrt(A) / 2) * (u * uuk - b * bbk + term); 44515 }; 44516 exports.getQuadraticArcLength = getQuadraticArcLength; 44517 function BFunc(xs, ys, t) { 44518 const xbase = getDerivative(1, t, xs); 44519 const ybase = getDerivative(1, t, ys); 44520 const combined = xbase * xbase + ybase * ybase; 44521 return Math.sqrt(combined); 44522 } 44523 const getDerivative = (derivative, t, vs) => { 44524 const n = vs.length - 1; 44525 let _vs; 44526 let value; 44527 if (n === 0) { 44528 return 0; 44529 } 44530 if (derivative === 0) { 44531 value = 0; 44532 for (let k = 0; k <= n; k++) { 44533 value += 44534 exports.binomialCoefficients[n][k] * 44535 Math.pow(1 - t, n - k) * 44536 Math.pow(t, k) * 44537 vs[k]; 44538 } 44539 return value; 44540 } 44541 else { 44542 _vs = new Array(n); 44543 for (let k = 0; k < n; k++) { 44544 _vs[k] = n * (vs[k + 1] - vs[k]); 44545 } 44546 return getDerivative(derivative - 1, t, _vs); 44547 } 44548 }; 44549 const t2length = (length, totalLength, func) => { 44550 let error = 1; 44551 let t = length / totalLength; 44552 let step = (length - func(t)) / totalLength; 44553 let numIterations = 0; 44554 while (error > 0.001) { 44555 const increasedTLength = func(t + step); 44556 const increasedTError = Math.abs(length - increasedTLength) / totalLength; 44557 if (increasedTError < error) { 44558 error = increasedTError; 44559 t += step; 44560 } 44561 else { 44562 const decreasedTLength = func(t - step); 44563 const decreasedTError = Math.abs(length - decreasedTLength) / totalLength; 44564 if (decreasedTError < error) { 44565 error = decreasedTError; 44566 t -= step; 44567 } 44568 else { 44569 step /= 2; 44570 } 44571 } 44572 numIterations++; 44573 if (numIterations > 500) { 44574 break; 44575 } 44576 } 44577 return t; 44578 }; 44579 exports.t2length = t2length; 44580} (BezierFunctions)); 44581 44582Object.defineProperty(Path$1, "__esModule", { value: true }); 44583Path$1.Path = void 0; 44584const Factory_1$t = Factory; 44585const Shape_1$d = Shape; 44586const Global_1$e = Global; 44587const BezierFunctions_1 = BezierFunctions; 44588class Path extends Shape_1$d.Shape { 44589 constructor(config) { 44590 super(config); 44591 this.dataArray = []; 44592 this.pathLength = 0; 44593 this._readDataAttribute(); 44594 this.on('dataChange.konva', function () { 44595 this._readDataAttribute(); 44596 }); 44597 } 44598 _readDataAttribute() { 44599 this.dataArray = Path.parsePathData(this.data()); 44600 this.pathLength = Path.getPathLength(this.dataArray); 44601 } 44602 _sceneFunc(context) { 44603 const ca = this.dataArray; 44604 context.beginPath(); 44605 let isClosed = false; 44606 for (let n = 0; n < ca.length; n++) { 44607 const c = ca[n].command; 44608 const p = ca[n].points; 44609 switch (c) { 44610 case 'L': 44611 context.lineTo(p[0], p[1]); 44612 break; 44613 case 'M': 44614 context.moveTo(p[0], p[1]); 44615 break; 44616 case 'C': 44617 context.bezierCurveTo(p[0], p[1], p[2], p[3], p[4], p[5]); 44618 break; 44619 case 'Q': 44620 context.quadraticCurveTo(p[0], p[1], p[2], p[3]); 44621 break; 44622 case 'A': 44623 var cx = p[0], cy = p[1], rx = p[2], ry = p[3], theta = p[4], dTheta = p[5], psi = p[6], fs = p[7]; 44624 var r = rx > ry ? rx : ry; 44625 var scaleX = rx > ry ? 1 : rx / ry; 44626 var scaleY = rx > ry ? ry / rx : 1; 44627 context.translate(cx, cy); 44628 context.rotate(psi); 44629 context.scale(scaleX, scaleY); 44630 context.arc(0, 0, r, theta, theta + dTheta, 1 - fs); 44631 context.scale(1 / scaleX, 1 / scaleY); 44632 context.rotate(-psi); 44633 context.translate(-cx, -cy); 44634 break; 44635 case 'z': 44636 isClosed = true; 44637 context.closePath(); 44638 break; 44639 } 44640 } 44641 if (!isClosed && !this.hasFill()) { 44642 context.strokeShape(this); 44643 } 44644 else { 44645 context.fillStrokeShape(this); 44646 } 44647 } 44648 getSelfRect() { 44649 let points = []; 44650 this.dataArray.forEach(function (data) { 44651 if (data.command === 'A') { 44652 const start = data.points[4]; 44653 const dTheta = data.points[5]; 44654 const end = data.points[4] + dTheta; 44655 let inc = Math.PI / 180.0; 44656 if (Math.abs(start - end) < inc) { 44657 inc = Math.abs(start - end); 44658 } 44659 if (dTheta < 0) { 44660 for (let t = start - inc; t > end; t -= inc) { 44661 const point = Path.getPointOnEllipticalArc(data.points[0], data.points[1], data.points[2], data.points[3], t, 0); 44662 points.push(point.x, point.y); 44663 } 44664 } 44665 else { 44666 for (let t = start + inc; t < end; t += inc) { 44667 const point = Path.getPointOnEllipticalArc(data.points[0], data.points[1], data.points[2], data.points[3], t, 0); 44668 points.push(point.x, point.y); 44669 } 44670 } 44671 } 44672 else if (data.command === 'C') { 44673 for (let t = 0.0; t <= 1; t += 0.01) { 44674 const point = Path.getPointOnCubicBezier(t, data.start.x, data.start.y, data.points[0], data.points[1], data.points[2], data.points[3], data.points[4], data.points[5]); 44675 points.push(point.x, point.y); 44676 } 44677 } 44678 else { 44679 points = points.concat(data.points); 44680 } 44681 }); 44682 let minX = points[0]; 44683 let maxX = points[0]; 44684 let minY = points[1]; 44685 let maxY = points[1]; 44686 let x, y; 44687 for (let i = 0; i < points.length / 2; i++) { 44688 x = points[i * 2]; 44689 y = points[i * 2 + 1]; 44690 if (!isNaN(x)) { 44691 minX = Math.min(minX, x); 44692 maxX = Math.max(maxX, x); 44693 } 44694 if (!isNaN(y)) { 44695 minY = Math.min(minY, y); 44696 maxY = Math.max(maxY, y); 44697 } 44698 } 44699 return { 44700 x: minX, 44701 y: minY, 44702 width: maxX - minX, 44703 height: maxY - minY, 44704 }; 44705 } 44706 getLength() { 44707 return this.pathLength; 44708 } 44709 getPointAtLength(length) { 44710 return Path.getPointAtLengthOfDataArray(length, this.dataArray); 44711 } 44712 static getLineLength(x1, y1, x2, y2) {
44713 return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); 44714 } 44715 static getPathLength(dataArray) { 44716 let pathLength = 0; 44717 for (let i = 0; i < dataArray.length; ++i) { 44718 pathLength += dataArray[i].pathLength; 44719 } 44720 return pathLength; 44721 } 44722 static getPointAtLengthOfDataArray(length, dataArray) { 44723 let points, i = 0, ii = dataArray.length; 44724 if (!ii) { 44725 return null; 44726 } 44727 while (i < ii && length > dataArray[i].pathLength) { 44728 length -= dataArray[i].pathLength; 44729 ++i; 44730 } 44731 if (i === ii) { 44732 points = dataArray[i - 1].points.slice(-2); 44733 return { 44734 x: points[0], 44735 y: points[1], 44736 }; 44737 } 44738 if (length < 0.01) { 44739 points = dataArray[i].points.slice(0, 2); 44740 return { 44741 x: points[0], 44742 y: points[1], 44743 }; 44744 } 44745 const cp = dataArray[i]; 44746 const p = cp.points; 44747 switch (cp.command) { 44748 case 'L': 44749 return Path.getPointOnLine(length, cp.start.x, cp.start.y, p[0], p[1]); 44750 case 'C': 44751 return Path.getPointOnCubicBezier((0, BezierFunctions_1.t2length)(length, Path.getPathLength(dataArray), (i) => { 44752 return (0, BezierFunctions_1.getCubicArcLength)([cp.start.x, p[0], p[2], p[4]], [cp.start.y, p[1], p[3], p[5]], i); 44753 }), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3], p[4], p[5]); 44754 case 'Q': 44755 return Path.getPointOnQuadraticBezier((0, BezierFunctions_1.t2length)(length, Path.getPathLength(dataArray), (i) => { 44756 return (0, BezierFunctions_1.getQuadraticArcLength)([cp.start.x, p[0], p[2]], [cp.start.y, p[1], p[3]], i); 44757 }), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3]); 44758 case 'A': 44759 var cx = p[0], cy = p[1], rx = p[2], ry = p[3], theta = p[4], dTheta = p[5], psi = p[6]; 44760 theta += (dTheta * length) / cp.pathLength; 44761 return Path.getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi); 44762 } 44763 return null; 44764 } 44765 static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) { 44766 fromX = fromX !== null && fromX !== void 0 ? fromX : P1x; 44767 fromY = fromY !== null && fromY !== void 0 ? fromY : P1y; 44768 const len = this.getLineLength(P1x, P1y, P2x, P2y); 44769 if (len < 1e-10) { 44770 return { x: P1x, y: P1y }; 44771 } 44772 if (P2x === P1x) { 44773 return { x: fromX, y: fromY + (P2y > P1y ? dist : -dist) }; 44774 } 44775 const m = (P2y - P1y) / (P2x - P1x); 44776 const run = Math.sqrt((dist * dist) / (1 + m * m)) * (P2x < P1x ? -1 : 1); 44777 const rise = m * run; 44778 if (Math.abs(fromY - P1y - m * (fromX - P1x)) < 1e-10) { 44779 return { x: fromX + run, y: fromY + rise }; 44780 } 44781 const u = ((fromX - P1x) * (P2x - P1x) + (fromY - P1y) * (P2y - P1y)) / (len * len); 44782 const ix = P1x + u * (P2x - P1x); 44783 const iy = P1y + u * (P2y - P1y); 44784 const pRise = this.getLineLength(fromX, fromY, ix, iy); 44785 const pRun = Math.sqrt(dist * dist - pRise * pRise); 44786 const adjustedRun = Math.sqrt((pRun * pRun) / (1 + m * m)) * (P2x < P1x ? -1 : 1); 44787 const adjustedRise = m * adjustedRun; 44788 return { x: ix + adjustedRun, y: iy + adjustedRise }; 44789 } 44790 static getPointOnCubicBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y, P4x, P4y) { 44791 function CB1(t) { 44792 return t * t * t; 44793 } 44794 function CB2(t) { 44795 return 3 * t * t * (1 - t); 44796 } 44797 function CB3(t) { 44798 return 3 * t * (1 - t) * (1 - t); 44799 } 44800 function CB4(t) { 44801 return (1 - t) * (1 - t) * (1 - t); 44802 } 44803 const x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct); 44804 const y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct); 44805 return { 44806 x: x, 44807 y: y, 44808 }; 44809 } 44810 static getPointOnQuadraticBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y) { 44811 function QB1(t) { 44812 return t * t; 44813 } 44814 function QB2(t) { 44815 return 2 * t * (1 - t); 44816 } 44817 function QB3(t) { 44818 return (1 - t) * (1 - t); 44819 } 44820 const x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct); 44821 const y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct); 44822 return { 44823 x: x, 44824 y: y, 44825 }; 44826 } 44827 static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) { 44828 const cosPsi = Math.cos(psi), sinPsi = Math.sin(psi); 44829 const pt = { 44830 x: rx * Math.cos(theta), 44831 y: ry * Math.sin(theta), 44832 }; 44833 return { 44834 x: cx + (pt.x * cosPsi - pt.y * sinPsi), 44835 y: cy + (pt.x * sinPsi + pt.y * cosPsi), 44836 }; 44837 } 44838 static parsePathData(data) { 44839 if (!data) { 44840 return []; 44841 } 44842 let cs = data; 44843 const cc = [ 44844 'm', 44845 'M', 44846 'l', 44847 'L', 44848 'v', 44849 'V', 44850 'h', 44851 'H', 44852 'z', 44853 'Z', 44854 'c', 44855 'C', 44856 'q', 44857 'Q', 44858 't', 44859 'T', 44860 's', 44861 'S', 44862 'a', 44863 'A', 44864 ]; 44865 cs = cs.replace(new RegExp(' ', 'g'), ','); 44866 for (var n = 0; n < cc.length; n++) { 44867 cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]); 44868 } 44869 const arr = cs.split('|'); 44870 const ca = []; 44871 const coords = []; 44872 let cpx = 0; 44873 let cpy = 0; 44874 const re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi; 44875 let match; 44876 for (n = 1; n < arr.length; n++) { 44877 let str = arr[n]; 44878 let c = str.charAt(0); 44879 str = str.slice(1); 44880 coords.length = 0; 44881 while ((match = re.exec(str))) { 44882 coords.push(match[0]); 44883 } 44884 const p = []; 44885 for (let j = 0, jlen = coords.length; j < jlen; j++) { 44886 if (coords[j] === '00') { 44887 p.push(0, 0); 44888 continue; 44889 } 44890 const parsed = parseFloat(coords[j]); 44891 if (!isNaN(parsed)) { 44892 p.push(parsed); 44893 } 44894 else { 44895 p.push(0); 44896 } 44897 } 44898 while (p.length > 0) { 44899 if (isNaN(p[0])) { 44900 break; 44901 } 44902 let cmd = ''; 44903 let points = []; 44904 const startX = cpx, startY = cpy; 44905 var prevCmd, ctlPtx, ctlPty; 44906 var rx, ry, psi, fa, fs, x1, y1; 44907 switch (c) { 44908 case 'l': 44909 cpx += p.shift(); 44910 cpy += p.shift(); 44911 cmd = 'L'; 44912 points.push(cpx, cpy); 44913 break; 44914 case 'L': 44915 cpx = p.shift(); 44916 cpy = p.shift(); 44917 points.push(cpx, cpy); 44918 break; 44919 case 'm': 44920 var dx = p.shift(); 44921 var dy = p.shift(); 44922 cpx += dx; 44923 cpy += dy; 44924 cmd = 'M'; 44925 if (ca.length > 2 && ca[ca.length - 1].command === 'z') { 44926 for (let idx = ca.length - 2; idx >= 0; idx--) { 44927 if (ca[idx].command === 'M') { 44928 cpx = ca[idx].points[0] + dx; 44929 cpy = ca[idx].points[1] + dy; 44930 break; 44931 } 44932 } 44933 } 44934 points.push(cpx, cpy); 44935 c = 'l'; 44936 break; 44937 case 'M': 44938 cpx = p.shift(); 44939 cpy = p.shift(); 44940 cmd = 'M'; 44941 points.push(cpx, cpy); 44942 c = 'L'; 44943 break; 44944 case 'h': 44945 cpx += p.shift(); 44946 cmd = 'L'; 44947 points.push(cpx, cpy); 44948 break; 44949 case 'H': 44950 cpx = p.shift(); 44951 cmd = 'L'; 44952 points.push(cpx, cpy); 44953 break; 44954 case 'v': 44955 cpy += p.shift(); 44956 cmd = 'L'; 44957 points.push(cpx, cpy); 44958 break; 44959 case 'V': 44960 cpy = p.shift(); 44961 cmd = 'L'; 44962 points.push(cpx, cpy); 44963 break; 44964 case 'C': 44965 points.push(p.shift(), p.shift(), p.shift(), p.shift()); 44966 cpx = p.shift(); 44967 cpy = p.shift(); 44968 points.push(cpx, cpy); 44969 break; 44970 case 'c': 44971 points.push(cpx + p.shift(), cpy + p.shift(), cpx + p.shift(), cpy + p.shift()); 44972 cpx += p.shift(); 44973 cpy += p.shift(); 44974 cmd = 'C'; 44975 points.push(cpx, cpy); 44976 break; 44977 case 'S': 44978 ctlPtx = cpx; 44979 ctlPty = cpy; 44980 prevCmd = ca[ca.length - 1]; 44981 if (prevCmd.command === 'C') { 44982 ctlPtx = cpx + (cpx - prevCmd.points[2]); 44983 ctlPty = cpy + (cpy - prevCmd.points[3]); 44984 } 44985 points.push(ctlPtx, ctlPty, p.shift(), p.shift()); 44986 cpx = p.shift(); 44987 cpy = p.shift(); 44988 cmd = 'C'; 44989 points.push(cpx, cpy); 44990 break; 44991 case 's': 44992 ctlPtx = cpx; 44993 ctlPty = cpy; 44994 prevCmd = ca[ca.length - 1]; 44995 if (prevCmd.command === 'C') { 44996 ctlPtx = cpx + (cpx - prevCmd.points[2]); 44997 ctlPty = cpy + (cpy - prevCmd.points[3]); 44998 } 44999 points.push(ctlPtx, ctlPty, cpx + p.shift(), cpy + p.shift()); 45000 cpx += p.shift(); 45001 cpy += p.shift(); 45002 cmd = 'C'; 45003 points.push(cpx, cpy); 45004 break; 45005 case 'Q': 45006 points.push(p.shift(), p.shift()); 45007 cpx = p.shift(); 45008 cpy = p.shift(); 45009 points.push(cpx, cpy); 45010 break; 45011 case 'q': 45012 points.push(cpx + p.shift(), cpy + p.shift()); 45013 cpx += p.shift(); 45014 cpy += p.shift(); 45015 cmd = 'Q'; 45016 points.push(cpx, cpy); 45017 break; 45018 case 'T': 45019 ctlPtx = cpx; 45020 ctlPty = cpy; 45021 prevCmd = ca[ca.length - 1]; 45022 if (prevCmd.command === 'Q') { 45023 ctlPtx = cpx + (cpx - prevCmd.points[0]); 45024 ctlPty = cpy + (cpy - prevCmd.points[1]); 45025 } 45026 cpx = p.shift(); 45027 cpy = p.shift(); 45028 cmd = 'Q'; 45029 points.push(ctlPtx, ctlPty, cpx, cpy); 45030 break; 45031 case 't': 45032 ctlPtx = cpx; 45033 ctlPty = cpy; 45034 prevCmd = ca[ca.length - 1]; 45035 if (prevCmd.command === 'Q') { 45036 ctlPtx = cpx + (cpx - prevCmd.points[0]); 45037 ctlPty = cpy + (cpy - prevCmd.points[1]); 45038 } 45039 cpx += p.shift(); 45040 cpy += p.shift(); 45041 cmd = 'Q'; 45042 points.push(ctlPtx, ctlPty, cpx, cpy); 45043 break; 45044 case 'A': 45045 rx = p.shift(); 45046 ry = p.shift(); 45047 psi = p.shift(); 45048 fa = p.shift(); 45049 fs = p.shift(); 45050 x1 = cpx; 45051 y1 = cpy; 45052 cpx = p.shift(); 45053 cpy = p.shift(); 45054 cmd = 'A'; 45055 points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi); 45056 break; 45057 case 'a': 45058 rx = p.shift(); 45059 ry = p.shift(); 45060 psi = p.shift(); 45061 fa = p.shift(); 45062 fs = p.shift(); 45063 x1 = cpx; 45064 y1 = cpy; 45065 cpx += p.shift(); 45066 cpy += p.shift(); 45067 cmd = 'A'; 45068 points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi); 45069 break; 45070 } 45071 ca.push({ 45072 command: cmd || c, 45073 points: points, 45074 start: { 45075 x: startX, 45076 y: startY, 45077 }, 45078 pathLength: this.calcLength(startX, startY, cmd || c, points), 45079 }); 45080 } 45081 if (c === 'z' || c === 'Z') { 45082 ca.push({ 45083 command: 'z', 45084 points: [], 45085 start: undefined, 45086 pathLength: 0, 45087 }); 45088 } 45089 } 45090 return ca; 45091 } 45092 static calcLength(x, y, cmd, points) { 45093 let len, p1, p2, t; 45094 const path = Path; 45095 switch (cmd) { 45096 case 'L': 45097 return path.getLineLength(x, y, points[0], points[1]); 45098 case 'C': 45099 return (0, BezierFunctions_1.getCubicArcLength)([x, points[0], points[2], points[4]], [y, points[1], points[3], points[5]], 1); 45100 case 'Q': 45101 return (0, BezierFunctions_1.getQuadraticArcLength)([x, points[0], points[2]], [y, points[1], points[3]], 1); 45102 case 'A': 45103 len = 0.0; 45104 var start = points[4]; 45105 var dTheta = points[5]; 45106 var end = points[4] + dTheta; 45107 var inc = Math.PI / 180.0; 45108 if (Math.abs(start - end) < inc) { 45109 inc = Math.abs(start - end); 45110 } 45111 p1 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], start, 0); 45112 if (dTheta < 0) { 45113 for (t = start - inc; t > end; t -= inc) { 45114 p2 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], t, 0); 45115 len += path.getLineLength(p1.x, p1.y, p2.x, p2.y); 45116 p1 = p2; 45117 } 45118 } 45119 else { 45120 for (t = start + inc; t < end; t += inc) { 45121 p2 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], t, 0); 45122 len += path.getLineLength(p1.x, p1.y, p2.x, p2.y); 45123 p1 = p2; 45124 } 45125 } 45126 p2 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], end, 0); 45127 len += path.getLineLength(p1.x, p1.y, p2.x, p2.y); 45128 return len; 45129
vendor: 1,412 bytes, lines 45129-45162
45129 } 45130 return 0; 45131 } 45132 static convertEndpointToCenterParameterization(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) { 45133 const psi = psiDeg * (Math.PI / 180.0); 45134 const xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0; 45135 const yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 + 45136 (Math.cos(psi) * (y1 - y2)) / 2.0; 45137 const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry); 45138 if (lambda > 1) { 45139 rx *= Math.sqrt(lambda); 45140 ry *= Math.sqrt(lambda); 45141 } 45142 let f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) / 45143 (rx * rx * (yp * yp) + ry * ry * (xp * xp))); 45144 if (fa === fs) { 45145 f *= -1; 45146 } 45147 if (isNaN(f)) { 45148 f = 0; 45149 } 45150 const cxp = (f * rx * yp) / ry; 45151 const cyp = (f * -ry * xp) / rx; 45152 const cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp; 45153 const cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp; 45154 const vMag = function (v) { 45155 return Math.sqrt(v[0] * v[0] + v[1] * v[1]); 45156 }; 45157 const vRatio = function (u, v) { 45158 return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)); 45159 }; 45160 const vAngle = function (u, v) { 45161 return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v)); 45162 };
45163 const theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]); 45164 const u = [(xp - cxp) / rx, (yp - cyp) / ry]; 45165 const v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry]; 45166 let dTheta = vAngle(u, v); 45167 if (vRatio(u, v) <= -1) { 45168 dTheta = Math.PI; 45169 } 45170 if (vRatio(u, v) >= 1) { 45171 dTheta = 0; 45172 } 45173 if (fs === 0 && dTheta > 0) { 45174 dTheta = dTheta - 2 * Math.PI; 45175 } 45176 if (fs === 1 && dTheta < 0) { 45177 dTheta = dTheta + 2 * Math.PI; 45178 } 45179 return [cx, cy, rx, ry, theta, dTheta, psi, fs]; 45180 } 45181} 45182Path$1.Path = Path; 45183Path.prototype.className = 'Path'; 45184Path.prototype._attrsAffectingSize = ['data']; 45185(0, Global_1$e._registerNode)(Path); 45186Factory_1$t.Factory.addGetterSetter(Path, 'data'); 45187 45188Object.defineProperty(Arrow$1, "__esModule", { value: true }); 45189Arrow$1.Arrow = void 0; 45190const Factory_1$s = Factory; 45191const Line_1$1 = Line$1; 45192const Validators_1$s = Validators; 45193const Global_1$d = Global; 45194const Path_1$2 = Path$1; 45195class Arrow extends Line_1$1.Line { 45196 _sceneFunc(ctx) { 45197 super._sceneFunc(ctx); 45198 const PI2 = Math.PI * 2; 45199 const points = this.points(); 45200 let tp = points; 45201 const fromTension = this.tension() !== 0 && points.length > 4; 45202 if (fromTension) { 45203 tp = this.getTensionPoints(); 45204 } 45205 const length = this.pointerLength(); 45206 const n = points.length; 45207 let dx, dy; 45208 if (fromTension) { 45209 const lp = [ 45210 tp[tp.length - 4], 45211 tp[tp.length - 3], 45212 tp[tp.length - 2], 45213 tp[tp.length - 1], 45214 points[n - 2], 45215 points[n - 1], 45216 ]; 45217 const lastLength = Path_1$2.Path.calcLength(tp[tp.length - 4], tp[tp.length - 3], 'C', lp); 45218 const previous = Path_1$2.Path.getPointOnQuadraticBezier(Math.min(1, 1 - length / lastLength), lp[0], lp[1], lp[2], lp[3], lp[4], lp[5]); 45219 dx = points[n - 2] - previous.x; 45220 dy = points[n - 1] - previous.y; 45221 } 45222 else { 45223 dx = points[n - 2] - points[n - 4]; 45224 dy = points[n - 1] - points[n - 3]; 45225 } 45226 const radians = (Math.atan2(dy, dx) + PI2) % PI2; 45227 const width = this.pointerWidth(); 45228 if (this.pointerAtEnding()) { 45229 ctx.save(); 45230 ctx.beginPath(); 45231 ctx.translate(points[n - 2], points[n - 1]); 45232 ctx.rotate(radians); 45233 ctx.moveTo(0, 0); 45234 ctx.lineTo(-length, width / 2); 45235 ctx.lineTo(-length, -width / 2); 45236 ctx.closePath(); 45237 ctx.restore(); 45238 this.__fillStroke(ctx); 45239 } 45240 if (this.pointerAtBeginning()) { 45241 ctx.save(); 45242 ctx.beginPath(); 45243 ctx.translate(points[0], points[1]); 45244 if (fromTension) { 45245 dx = (tp[0] + tp[2]) / 2 - points[0]; 45246 dy = (tp[1] + tp[3]) / 2 - points[1]; 45247 } 45248 else { 45249 dx = points[2] - points[0]; 45250 dy = points[3] - points[1]; 45251 } 45252 ctx.rotate((Math.atan2(-dy, -dx) + PI2) % PI2); 45253 ctx.moveTo(0, 0); 45254 ctx.lineTo(-length, width / 2); 45255 ctx.lineTo(-length, -width / 2); 45256 ctx.closePath(); 45257 ctx.restore(); 45258 this.__fillStroke(ctx); 45259 } 45260 } 45261 __fillStroke(ctx) { 45262 const isDashEnabled = this.dashEnabled(); 45263 if (isDashEnabled) { 45264 this.attrs.dashEnabled = false; 45265 ctx.setLineDash([]); 45266 } 45267 ctx.fillStrokeShape(this); 45268 if (isDashEnabled) { 45269 this.attrs.dashEnabled = true; 45270 } 45271 } 45272 getSelfRect() { 45273 const lineRect = super.getSelfRect(); 45274 const offset = this.pointerWidth() / 2; 45275 return { 45276 x: lineRect.x, 45277 y: lineRect.y - offset, 45278 width: lineRect.width, 45279 height: lineRect.height + offset * 2, 45280 }; 45281 } 45282} 45283Arrow$1.Arrow = Arrow; 45284Arrow.prototype.className = 'Arrow'; 45285(0, Global_1$d._registerNode)(Arrow); 45286Factory_1$s.Factory.addGetterSetter(Arrow, 'pointerLength', 10, (0, Validators_1$s.getNumberValidator)()); 45287Factory_1$s.Factory.addGetterSetter(Arrow, 'pointerWidth', 10, (0, Validators_1$s.getNumberValidator)()); 45288Factory_1$s.Factory.addGetterSetter(Arrow, 'pointerAtBeginning', false); 45289Factory_1$s.Factory.addGetterSetter(Arrow, 'pointerAtEnding', true); 45290 45291var Circle$1 = {}; 45292 45293Object.defineProperty(Circle$1, "__esModule", { value: true }); 45294Circle$1.Circle = void 0; 45295const Factory_1$r = Factory; 45296const Shape_1$c = Shape; 45297const Validators_1$r = Validators; 45298const Global_1$c = Global; 45299class Circle extends Shape_1$c.Shape { 45300 _sceneFunc(context) { 45301 context.beginPath(); 45302 context.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, false); 45303 context.closePath(); 45304 context.fillStrokeShape(this); 45305 } 45306 getWidth() { 45307 return this.radius() * 2; 45308 } 45309 getHeight() { 45310 return this.radius() * 2; 45311 } 45312 setWidth(width) { 45313 if (this.radius() !== width / 2) { 45314 this.radius(width / 2); 45315 } 45316 } 45317 setHeight(height) { 45318 if (this.radius() !== height / 2) { 45319 this.radius(height / 2); 45320 } 45321 } 45322} 45323Circle$1.Circle = Circle; 45324Circle.prototype._centroid = true; 45325Circle.prototype.className = 'Circle'; 45326Circle.prototype._attrsAffectingSize = ['radius']; 45327(0, Global_1$c._registerNode)(Circle); 45328Factory_1$r.Factory.addGetterSetter(Circle, 'radius', 0, (0, Validators_1$r.getNumberValidator)()); 45329 45330var Ellipse$1 = {}; 45331 45332Object.defineProperty(Ellipse$1, "__esModule", { value: true }); 45333Ellipse$1.Ellipse = void 0; 45334const Factory_1$q = Factory; 45335const Shape_1$b = Shape; 45336const Validators_1$q = Validators; 45337const Global_1$b = Global; 45338class Ellipse extends Shape_1$b.Shape { 45339 _sceneFunc(context) { 45340 const rx = this.radiusX(), ry = this.radiusY(); 45341 context.beginPath(); 45342 context.save(); 45343 if (rx !== ry) { 45344 context.scale(1, ry / rx); 45345 } 45346 context.arc(0, 0, rx, 0, Math.PI * 2, false);
45347 context.restore(); 45348 context.closePath(); 45349 context.fillStrokeShape(this); 45350 } 45351 getWidth() { 45352 return this.radiusX() * 2; 45353 } 45354 getHeight() { 45355 return this.radiusY() * 2; 45356 } 45357 setWidth(width) { 45358 this.radiusX(width / 2); 45359 } 45360 setHeight(height) { 45361 this.radiusY(height / 2); 45362 } 45363} 45364Ellipse$1.Ellipse = Ellipse; 45365Ellipse.prototype.className = 'Ellipse'; 45366Ellipse.prototype._centroid = true; 45367Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY']; 45368(0, Global_1$b._registerNode)(Ellipse); 45369Factory_1$q.Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']); 45370Factory_1$q.Factory.addGetterSetter(Ellipse, 'radiusX', 0, (0, Validators_1$q.getNumberValidator)()); 45371Factory_1$q.Factory.addGetterSetter(Ellipse, 'radiusY', 0, (0, Validators_1$q.getNumberValidator)()); 45372 45373var Image$3 = {}; 45374 45375Object.defineProperty(Image$3, "__esModule", { value: true }); 45376Image$3.Image = void 0; 45377const Util_1$7 = Util; 45378const Factory_1$p = Factory; 45379const Shape_1$a = Shape; 45380const Global_1$a = Global; 45381const Validators_1$p = Validators; 45382let Image$2 = class Image extends Shape_1$a.Shape { 45383 constructor(attrs) { 45384 super(attrs); 45385 this._loadListener = () => { 45386 this._requestDraw(); 45387 }; 45388 this.on('imageChange.konva', (props) => { 45389 this._removeImageLoad(props.oldVal); 45390 this._setImageLoad(); 45391 }); 45392 this._setImageLoad(); 45393 } 45394 _setImageLoad() { 45395 const image = this.image(); 45396 if (image && image.complete) { 45397 return; 45398 } 45399 if (image && image.readyState === 4) { 45400 return; 45401 } 45402 if (image && image['addEventListener']) { 45403 image['addEventListener']('load', this._loadListener); 45404 } 45405 } 45406 _removeImageLoad(image) { 45407 if (image && image['removeEventListener']) { 45408 image['removeEventListener']('load', this._loadListener); 45409 } 45410 } 45411 destroy() { 45412 this._removeImageLoad(this.image()); 45413 super.destroy(); 45414 return this; 45415 } 45416 _useBufferCanvas() { 45417 const hasCornerRadius = !!this.cornerRadius(); 45418 const hasShadow = this.hasShadow(); 45419 if (hasCornerRadius && hasShadow) { 45420 return true; 45421 } 45422 return super._useBufferCanvas(true); 45423 } 45424 _sceneFunc(context) { 45425 const width = this.getWidth(); 45426 const height = this.getHeight(); 45427 const cornerRadius = this.cornerRadius(); 45428 const image = this.attrs.image; 45429 let params; 45430 if (image) { 45431 const cropWidth = this.attrs.cropWidth; 45432 const cropHeight = this.attrs.cropHeight; 45433 if (cropWidth && cropHeight) { 45434 params = [ 45435 image, 45436 this.cropX(), 45437 this.cropY(), 45438 cropWidth, 45439 cropHeight, 45440 0, 45441 0, 45442 width, 45443 height, 45444 ]; 45445 } 45446 else { 45447 params = [image, 0, 0, width, height]; 45448 } 45449 } 45450 if (this.hasFill() || this.hasStroke() || cornerRadius) { 45451 context.beginPath(); 45452 cornerRadius 45453 ? Util_1$7.Util.drawRoundedRectPath(context, width, height, cornerRadius) 45454 : context.rect(0, 0, width, height); 45455 context.closePath(); 45456 context.fillStrokeShape(this); 45457 } 45458 if (image) { 45459 if (cornerRadius) { 45460 context.clip(); 45461 } 45462 context.drawImage.apply(context, params); 45463 } 45464 } 45465 _hitFunc(context) { 45466 const width = this.width(), height = this.height(), cornerRadius = this.cornerRadius(); 45467 context.beginPath(); 45468 if (!cornerRadius) { 45469 context.rect(0, 0, width, height); 45470 } 45471 else { 45472 Util_1$7.Util.drawRoundedRectPath(context, width, height, cornerRadius); 45473 } 45474 context.closePath(); 45475 context.fillStrokeShape(this); 45476 } 45477 getWidth() { 45478 var _a, _b; 45479 return (_a = this.attrs.width) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.width; 45480 } 45481 getHeight() { 45482 var _a, _b; 45483 return (_a = this.attrs.height) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.height; 45484 } 45485 static fromURL(url, callback, onError = null) { 45486 const img = Util_1$7.Util.createImageElement(); 45487 img.onload = function () { 45488 const image = new Image({ 45489 image: img, 45490 }); 45491 callback(image); 45492 }; 45493 img.onerror = onError; 45494 img.crossOrigin = 'Anonymous'; 45495 img.src = url; 45496 } 45497}; 45498Image$3.Image = Image$2; 45499Image$2.prototype.className = 'Image'; 45500(0, Global_1$a._registerNode)(Image$2); 45501Factory_1$p.Factory.addGetterSetter(Image$2, 'cornerRadius', 0, (0, Validators_1$p.getNumberOrArrayOfNumbersValidator)(4)); 45502Factory_1$p.Factory.addGetterSetter(Image$2, 'image'); 45503Factory_1$p.Factory.addComponentsGetterSetter(Image$2, 'crop', ['x', 'y', 'width', 'height']); 45504Factory_1$p.Factory.addGetterSetter(Image$2, 'cropX', 0, (0, Validators_1$p.getNumberValidator)()); 45505Factory_1$p.Factory.addGetterSetter(Image$2, 'cropY', 0, (0, Validators_1$p.getNumberValidator)()); 45506Factory_1$p.Factory.addGetterSetter(Image$2, 'cropWidth', 0, (0, Validators_1$p.getNumberValidator)()); 45507Factory_1$p.Factory.addGetterSetter(Image$2, 'cropHeight', 0, (0, Validators_1$p.getNumberValidator)()); 45508 45509var Label$1 = {}; 45510 45511Object.defineProperty(Label$1, "__esModule", { value: true }); 45512Label$1.Tag = Label$1.Label = void 0; 45513const Factory_1$o = Factory; 45514const Shape_1$9 = Shape; 45515const Group_1$1 = Group$2; 45516const Validators_1$o = Validators; 45517const Global_1$9 = Global; 45518const ATTR_CHANGE_LIST$2 = [ 45519 'fontFamily', 45520 'fontSize', 45521 'fontStyle', 45522 'padding', 45523 'lineHeight', 45524 'text', 45525 'width', 45526 'height', 45527 'pointerDirection', 45528 'pointerWidth', 45529 'pointerHeight', 45530], CHANGE_KONVA$1 = 'Change.konva', NONE$1 = 'none', UP = 'up', RIGHT$1 = 'right', DOWN = 'down', LEFT$1 = 'left', attrChangeListLen$1 = ATTR_CHANGE_LIST$2.length; 45531class Label extends Group_1$1.Group { 45532 constructor(config) { 45533 super(config); 45534 this.on('add.konva', function (evt) { 45535 this._addListeners(evt.child); 45536 this._sync(); 45537 }); 45538 } 45539 getText() { 45540 return this.find('Text')[0]; 45541 } 45542 getTag() { 45543 return this.find('Tag')[0]; 45544 } 45545 _addListeners(text) { 45546 let that = this, n; 45547 const func = function () { 45548 that._sync(); 45549 }; 45550 for (n = 0; n < attrChangeListLen$1; n++) { 45551 text.on(ATTR_CHANGE_LIST$2[n] + CHANGE_KONVA$1, func); 45552 } 45553 } 45554 getWidth() { 45555 return this.getText().width(); 45556 } 45557 getHeight() { 45558 return this.getText().height(); 45559 } 45560 _sync() { 45561 let text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight; 45562 if (text && tag) { 45563 width = text.width(); 45564 height = text.height(); 45565 pointerDirection = tag.pointerDirection(); 45566 pointerWidth = tag.pointerWidth(); 45567 pointerHeight = tag.pointerHeight(); 45568 x = 0; 45569 y = 0; 45570 switch (pointerDirection) { 45571 case UP: 45572 x = width / 2; 45573 y = -1 * pointerHeight; 45574 break; 45575 case RIGHT$1: 45576 x = width + pointerWidth; 45577 y = height / 2; 45578 break; 45579 case DOWN: 45580 x = width / 2; 45581 y = height + pointerHeight; 45582 break; 45583 case LEFT$1: 45584 x = -1 * pointerWidth; 45585 y = height / 2; 45586 break; 45587 } 45588 tag.setAttrs({ 45589 x: -1 * x, 45590 y: -1 * y, 45591 width: width, 45592 height: height, 45593 }); 45594 text.setAttrs({ 45595 x: -1 * x, 45596 y: -1 * y, 45597 }); 45598 } 45599 } 45600} 45601Label$1.Label = Label; 45602Label.prototype.className = 'Label'; 45603(0, Global_1$9._registerNode)(Label); 45604class Tag extends Shape_1$9.Shape { 45605 _sceneFunc(context) { 45606 const width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius(); 45607 let topLeft = 0;
45608 let topRight = 0; 45609 let bottomLeft = 0; 45610 let bottomRight = 0; 45611 if (typeof cornerRadius === 'number') { 45612 topLeft = 45613 topRight = 45614 bottomLeft = 45615 bottomRight = 45616 Math.min(cornerRadius, width / 2, height / 2); 45617 } 45618 else { 45619 topLeft = Math.min(cornerRadius[0] || 0, width / 2, height / 2); 45620 topRight = Math.min(cornerRadius[1] || 0, width / 2, height / 2); 45621 bottomRight = Math.min(cornerRadius[2] || 0, width / 2, height / 2); 45622 bottomLeft = Math.min(cornerRadius[3] || 0, width / 2, height / 2); 45623 } 45624 context.beginPath(); 45625 context.moveTo(topLeft, 0); 45626 if (pointerDirection === UP) { 45627 context.lineTo((width - pointerWidth) / 2, 0); 45628 context.lineTo(width / 2, -1 * pointerHeight); 45629 context.lineTo((width + pointerWidth) / 2, 0); 45630 } 45631 context.lineTo(width - topRight, 0); 45632 context.arc(width - topRight, topRight, topRight, (Math.PI * 3) / 2, 0, false); 45633 if (pointerDirection === RIGHT$1) { 45634 context.lineTo(width, (height - pointerHeight) / 2); 45635 context.lineTo(width + pointerWidth, height / 2); 45636 context.lineTo(width, (height + pointerHeight) / 2); 45637 } 45638 context.lineTo(width, height - bottomRight); 45639 context.arc(width - bottomRight, height - bottomRight, bottomRight, 0, Math.PI / 2, false); 45640 if (pointerDirection === DOWN) { 45641 context.lineTo((width + pointerWidth) / 2, height); 45642 context.lineTo(width / 2, height + pointerHeight); 45643 context.lineTo((width - pointerWidth) / 2, height); 45644 } 45645 context.lineTo(bottomLeft, height); 45646 context.arc(bottomLeft, height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false); 45647 if (pointerDirection === LEFT$1) { 45648 context.lineTo(0, (height + pointerHeight) / 2); 45649 context.lineTo(-1 * pointerWidth, height / 2); 45650 context.lineTo(0, (height - pointerHeight) / 2); 45651 } 45652 context.lineTo(0, topLeft); 45653 context.arc(topLeft, topLeft, topLeft, Math.PI, (Math.PI * 3) / 2, false); 45654 context.closePath(); 45655 context.fillStrokeShape(this); 45656 } 45657 getSelfRect() { 45658 let x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height(); 45659 if (direction === UP) { 45660 y -= pointerHeight; 45661 height += pointerHeight; 45662 } 45663 else if (direction === DOWN) { 45664 height += pointerHeight; 45665 } 45666 else if (direction === LEFT$1) { 45667 x -= pointerWidth * 1.5; 45668 width += pointerWidth; 45669 } 45670 else if (direction === RIGHT$1) { 45671 width += pointerWidth * 1.5; 45672 } 45673 return { 45674 x: x, 45675 y: y, 45676 width: width, 45677 height: height, 45678 }; 45679 } 45680} 45681Label$1.Tag = Tag; 45682Tag.prototype.className = 'Tag'; 45683(0, Global_1$9._registerNode)(Tag); 45684Factory_1$o.Factory.addGetterSetter(Tag, 'pointerDirection', NONE$1); 45685Factory_1$o.Factory.addGetterSetter(Tag, 'pointerWidth', 0, (0, Validators_1$o.getNumberValidator)()); 45686Factory_1$o.Factory.addGetterSetter(Tag, 'pointerHeight', 0, (0, Validators_1$o.getNumberValidator)()); 45687Factory_1$o.Factory.addGetterSetter(Tag, 'cornerRadius', 0, (0, Validators_1$o.getNumberOrArrayOfNumbersValidator)(4)); 45688 45689var Rect$2 = {}; 45690 45691Object.defineProperty(Rect$2, "__esModule", { value: true }); 45692Rect$2.Rect = void 0; 45693const Factory_1$n = Factory; 45694const Shape_1$8 = Shape; 45695const Global_1$8 = Global; 45696const Util_1$6 = Util; 45697const Validators_1$n = Validators; 45698let Rect$1 = class Rect extends Shape_1$8.Shape { 45699 _sceneFunc(context) { 45700 const cornerRadius = this.cornerRadius(), width = this.width(), height = this.height(); 45701 context.beginPath(); 45702 if (!cornerRadius) { 45703 context.rect(0, 0, width, height); 45704 } 45705 else { 45706 Util_1$6.Util.drawRoundedRectPath(context, width, height, cornerRadius); 45707 } 45708 context.closePath(); 45709 context.fillStrokeShape(this); 45710 } 45711}; 45712Rect$2.Rect = Rect$1; 45713Rect$1.prototype.className = 'Rect'; 45714(0, Global_1$8._registerNode)(Rect$1); 45715Factory_1$n.Factory.addGetterSetter(Rect$1, 'cornerRadius', 0, (0, Validators_1$n.getNumberOrArrayOfNumbersValidator)(4)); 45716 45717var RegularPolygon$1 = {}; 45718 45719Object.defineProperty(RegularPolygon$1, "__esModule", { value: true }); 45720RegularPolygon$1.RegularPolygon = void 0; 45721const Factory_1$m = Factory; 45722const Shape_1$7 = Shape; 45723const Validators_1$m = Validators; 45724const Global_1$7 = Global; 45725class RegularPolygon extends Shape_1$7.Shape { 45726 _sceneFunc(context) { 45727 const points = this._getPoints(); 45728 context.beginPath(); 45729 context.moveTo(points[0].x, points[0].y); 45730 for (let n = 1; n < points.length; n++) { 45731 context.lineTo(points[n].x, points[n].y); 45732 } 45733 context.closePath(); 45734 context.fillStrokeShape(this); 45735 } 45736 _getPoints() { 45737 const sides = this.attrs.sides; 45738 const radius = this.attrs.radius || 0; 45739 const points = []; 45740 for (let n = 0; n < sides; n++) { 45741 points.push({ 45742 x: radius * Math.sin((n * 2 * Math.PI) / sides), 45743 y: -1 * radius * Math.cos((n * 2 * Math.PI) / sides), 45744 }); 45745 } 45746 return points; 45747 } 45748 getSelfRect() { 45749 const points = this._getPoints(); 45750 let minX = points[0].x; 45751 let maxX = points[0].y; 45752 let minY = points[0].x; 45753 let maxY = points[0].y;
45754 points.forEach((point) => { 45755 minX = Math.min(minX, point.x); 45756 maxX = Math.max(maxX, point.x); 45757 minY = Math.min(minY, point.y); 45758 maxY = Math.max(maxY, point.y); 45759 }); 45760 return { 45761 x: minX, 45762 y: minY, 45763 width: maxX - minX, 45764 height: maxY - minY, 45765 }; 45766 } 45767 getWidth() { 45768 return this.radius() * 2; 45769 } 45770 getHeight() { 45771 return this.radius() * 2; 45772 } 45773 setWidth(width) { 45774 this.radius(width / 2); 45775 } 45776 setHeight(height) { 45777 this.radius(height / 2); 45778 } 45779} 45780RegularPolygon$1.RegularPolygon = RegularPolygon; 45781RegularPolygon.prototype.className = 'RegularPolygon'; 45782RegularPolygon.prototype._centroid = true; 45783RegularPolygon.prototype._attrsAffectingSize = ['radius']; 45784(0, Global_1$7._registerNode)(RegularPolygon); 45785Factory_1$m.Factory.addGetterSetter(RegularPolygon, 'radius', 0, (0, Validators_1$m.getNumberValidator)()); 45786Factory_1$m.Factory.addGetterSetter(RegularPolygon, 'sides', 0, (0, Validators_1$m.getNumberValidator)()); 45787 45788var Ring$1 = {}; 45789 45790Object.defineProperty(Ring$1, "__esModule", { value: true }); 45791Ring$1.Ring = void 0; 45792const Factory_1$l = Factory; 45793const Shape_1$6 = Shape; 45794const Validators_1$l = Validators; 45795const Global_1$6 = Global; 45796const PIx2 = Math.PI * 2; 45797class Ring extends Shape_1$6.Shape { 45798 _sceneFunc(context) { 45799 context.beginPath(); 45800 context.arc(0, 0, this.innerRadius(), 0, PIx2, false); 45801 context.moveTo(this.outerRadius(), 0); 45802 context.arc(0, 0, this.outerRadius(), PIx2, 0, true); 45803 context.closePath(); 45804 context.fillStrokeShape(this); 45805 } 45806 getWidth() { 45807 return this.outerRadius() * 2; 45808 } 45809 getHeight() { 45810 return this.outerRadius() * 2; 45811 } 45812 setWidth(width) { 45813 this.outerRadius(width / 2); 45814 } 45815 setHeight(height) { 45816 this.outerRadius(height / 2); 45817 } 45818} 45819Ring$1.Ring = Ring; 45820Ring.prototype.className = 'Ring'; 45821Ring.prototype._centroid = true; 45822Ring.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius']; 45823(0, Global_1$6._registerNode)(Ring); 45824Factory_1$l.Factory.addGetterSetter(Ring, 'innerRadius', 0, (0, Validators_1$l.getNumberValidator)()); 45825Factory_1$l.Factory.addGetterSetter(Ring, 'outerRadius', 0, (0, Validators_1$l.getNumberValidator)()); 45826 45827var Sprite$1 = {}; 45828 45829Object.defineProperty(Sprite$1, "__esModule", { value: true }); 45830Sprite$1.Sprite = void 0; 45831const Factory_1$k = Factory; 45832const Shape_1$5 = Shape; 45833const Animation_1 = Animation$1; 45834const Validators_1$k = Validators; 45835const Global_1$5 = Global; 45836class Sprite extends Shape_1$5.Shape { 45837 constructor(config) { 45838 super(config); 45839 this._updated = true; 45840 this.anim = new Animation_1.Animation(() => { 45841 const updated = this._updated; 45842 this._updated = false; 45843 return updated; 45844 }); 45845 this.on('animationChange.konva', function () { 45846 this.frameIndex(0); 45847 }); 45848 this.on('frameIndexChange.konva', function () { 45849 this._updated = true; 45850 }); 45851 this.on('frameRateChange.konva', function () { 45852 if (!this.anim.isRunning()) { 45853 return; 45854 } 45855 clearInterval(this.interval); 45856 this._setInterval(); 45857 }); 45858 } 45859 _sceneFunc(context) { 45860 const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image(); 45861 if (this.hasFill() || this.hasStroke()) { 45862 context.beginPath(); 45863 context.rect(0, 0, width, height); 45864 context.closePath(); 45865 context.fillStrokeShape(this); 45866 } 45867 if (image) { 45868 if (offsets) { 45869 const offset = offsets[anim], ix2 = index * 2; 45870 context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height); 45871 } 45872 else { 45873 context.drawImage(image, x, y, width, height, 0, 0, width, height); 45874 } 45875 } 45876 } 45877 _hitFunc(context) { 45878 const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3]; 45879 context.beginPath(); 45880 if (offsets) { 45881 const offset = offsets[anim]; 45882 const ix2 = index * 2; 45883 context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height); 45884 } 45885 else { 45886 context.rect(0, 0, width, height); 45887 } 45888 context.closePath(); 45889 context.fillShape(this); 45890 } 45891 _useBufferCanvas() { 45892 return super._useBufferCanvas(true); 45893 } 45894 _setInterval() { 45895 const that = this; 45896 this.interval = setInterval(function () { 45897 that._updateIndex(); 45898 }, 1000 / this.frameRate()); 45899 } 45900 start() { 45901 if (this.isRunning()) { 45902 return; 45903 } 45904 const layer = this.getLayer(); 45905 this.anim.setLayers(layer); 45906 this._setInterval(); 45907 this.anim.start(); 45908 } 45909 stop() { 45910 this.anim.stop(); 45911 clearInterval(this.interval); 45912 } 45913 isRunning() { 45914 return this.anim.isRunning(); 45915 } 45916 _updateIndex() { 45917 const index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4; 45918 if (index < len - 1) { 45919 this.frameIndex(index + 1); 45920 } 45921 else { 45922 this.frameIndex(0); 45923 } 45924 } 45925} 45926Sprite$1.Sprite = Sprite; 45927Sprite.prototype.className = 'Sprite'; 45928(0, Global_1$5._registerNode)(Sprite); 45929Factory_1$k.Factory.addGetterSetter(Sprite, 'animation'); 45930Factory_1$k.Factory.addGetterSetter(Sprite, 'animations'); 45931Factory_1$k.Factory.addGetterSetter(Sprite, 'frameOffsets'); 45932Factory_1$k.Factory.addGetterSetter(Sprite, 'image'); 45933Factory_1$k.Factory.addGetterSetter(Sprite, 'frameIndex', 0, (0, Validators_1$k.getNumberValidator)()); 45934Factory_1$k.Factory.addGetterSetter(Sprite, 'frameRate', 17, (0, Validators_1$k.getNumberValidator)()); 45935Factory_1$k.Factory.backCompat(Sprite, { 45936 index: 'frameIndex', 45937 getIndex: 'getFrameIndex', 45938 setIndex: 'setFrameIndex', 45939}); 45940 45941var Star$1 = {}; 45942 45943Object.defineProperty(Star$1, "__esModule", { value: true }); 45944Star$1.Star = void 0; 45945const Factory_1$j = Factory; 45946const Shape_1$4 = Shape; 45947const Validators_1$j = Validators; 45948const Global_1$4 = Global; 45949class Star extends Shape_1$4.Shape { 45950 _sceneFunc(context) { 45951 const innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints(); 45952 context.beginPath(); 45953 context.moveTo(0, 0 - outerRadius); 45954 for (let n = 1; n < numPoints * 2; n++) { 45955 const radius = n % 2 === 0 ? outerRadius : innerRadius;
45956 const x = radius * Math.sin((n * Math.PI) / numPoints); 45957 const y = -1 * radius * Math.cos((n * Math.PI) / numPoints); 45958 context.lineTo(x, y); 45959 } 45960 context.closePath(); 45961 context.fillStrokeShape(this); 45962 } 45963 getWidth() { 45964 return this.outerRadius() * 2; 45965 } 45966 getHeight() { 45967 return this.outerRadius() * 2; 45968 } 45969 setWidth(width) { 45970 this.outerRadius(width / 2); 45971 } 45972 setHeight(height) { 45973 this.outerRadius(height / 2); 45974 } 45975} 45976Star$1.Star = Star; 45977Star.prototype.className = 'Star'; 45978Star.prototype._centroid = true; 45979Star.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius']; 45980(0, Global_1$4._registerNode)(Star); 45981Factory_1$j.Factory.addGetterSetter(Star, 'numPoints', 5, (0, Validators_1$j.getNumberValidator)()); 45982Factory_1$j.Factory.addGetterSetter(Star, 'innerRadius', 0, (0, Validators_1$j.getNumberValidator)()); 45983Factory_1$j.Factory.addGetterSetter(Star, 'outerRadius', 0, (0, Validators_1$j.getNumberValidator)()); 45984 45985var Text$2 = {}; 45986 45987Object.defineProperty(Text$2, "__esModule", { value: true }); 45988Text$2.Text = void 0; 45989Text$2.stringToArray = stringToArray; 45990const Util_1$5 = Util; 45991const Factory_1$i = Factory; 45992const Shape_1$3 = Shape; 45993const Global_1$3 = Global; 45994const Validators_1$i = Validators; 45995const Global_2$2 = Global; 45996function stringToArray(string) { 45997 return [...string].reduce((acc, char, index, array) => { 45998 if (/\p{Emoji}/u.test(char)) { 45999 const nextChar = array[index + 1]; 46000 if (nextChar && /\p{Emoji_Modifier}|\u200D/u.test(nextChar)) { 46001 acc.push(char + nextChar); 46002 array[index + 1] = ''; 46003 } 46004 else { 46005 acc.push(char); 46006 } 46007 } 46008 else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) { 46009 acc.push(char + array[index + 1]); 46010 } 46011 else if (index > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(char)) { 46012 acc[acc.length - 1] += char; 46013 } 46014 else if (char) { 46015 acc.push(char); 46016 } 46017 return acc; 46018 }, []); 46019} 46020const AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL$1 = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = 'â¦', ATTR_CHANGE_LIST$1 = [ 46021 'direction', 46022 'fontFamily', 46023 'fontSize', 46024 'fontStyle', 46025 'fontVariant', 46026 'padding', 46027 'align', 46028 'verticalAlign', 46029 'lineHeight', 46030 'text', 46031 'width', 46032 'height', 46033 'wrap', 46034 'ellipsis', 46035 'letterSpacing', 46036], attrChangeListLen = ATTR_CHANGE_LIST$1.length; 46037function normalizeFontFamily(fontFamily) { 46038 return fontFamily 46039 .split(',') 46040 .map((family) => { 46041 family = family.trim(); 46042 const hasSpace = family.indexOf(' ') >= 0; 46043 const hasQuotes = family.indexOf('"') >= 0 || family.indexOf("'") >= 0; 46044 if (hasSpace && !hasQuotes) { 46045 family = `"${family}"`; 46046 } 46047 return family; 46048 }) 46049 .join(', '); 46050} 46051let dummyContext; 46052function getDummyContext() { 46053 if (dummyContext) { 46054 return dummyContext; 46055 } 46056 dummyContext = Util_1$5.Util.createCanvasElement().getContext(CONTEXT_2D); 46057 return dummyContext; 46058} 46059function _fillFunc$1(context) { 46060 context.fillText(this._partialText, this._partialTextX, this._partialTextY); 46061} 46062function _strokeFunc$1(context) { 46063 context.setAttr('miterLimit', 2); 46064 context.strokeText(this._partialText, this._partialTextX, this._partialTextY); 46065} 46066function checkDefaultFill(config) { 46067 config = config || {}; 46068 if (!config.fillLinearGradientColorStops && 46069 !config.fillRadialGradientColorStops && 46070 !config.fillPatternImage) { 46071 config.fill = config.fill || 'black'; 46072 } 46073 return config; 46074} 46075let Text$1 = class Text extends Shape_1$3.Shape { 46076 constructor(config) { 46077 super(checkDefaultFill(config)); 46078 this._partialTextX = 0; 46079 this._partialTextY = 0; 46080 for (let n = 0; n < attrChangeListLen; n++) { 46081 this.on(ATTR_CHANGE_LIST$1[n] + CHANGE_KONVA, this._setTextData); 46082 } 46083 this._setTextData(); 46084 } 46085 _sceneFunc(context) { 46086 const textArr = this.textArr, textArrLen = textArr.length; 46087 if (!this.text()) { 46088 return; 46089 } 46090 let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n; 46091 direction = direction === INHERIT ? context.direction : direction; 46092 let translateY = lineHeightPx / 2; 46093 let baseline = MIDDLE; 46094 if (Global_1$3.Konva._fixTextRendering) { 46095 const metrics = this.measureSize('M'); 46096 baseline = 'alphabetic'; 46097 translateY = 46098 (metrics.fontBoundingBoxAscent - metrics.fontBoundingBoxDescent) / 2 + 46099 lineHeightPx / 2; 46100 } 46101 var lineTranslateX = 0; 46102 var lineTranslateY = 0; 46103 if (direction === RTL) { 46104 context.setAttr('direction', direction); 46105 } 46106 context.setAttr('font', this._getContextFont()); 46107 context.setAttr('textBaseline', baseline); 46108 context.setAttr('textAlign', LEFT); 46109 if (verticalAlign === MIDDLE) { 46110 alignY = (this.getHeight() - textArrLen * lineHeightPx - padding * 2) / 2; 46111 } 46112 else if (verticalAlign === BOTTOM) { 46113 alignY = this.getHeight() - textArrLen * lineHeightPx - padding * 2; 46114 } 46115 context.translate(padding, alignY + padding); 46116 for (n = 0; n < textArrLen; n++) { 46117 var lineTranslateX = 0; 46118 var lineTranslateY = 0; 46119 var obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph, space
46119sNumber, lineWidth; 46120 context.save(); 46121 if (align === RIGHT) { 46122 lineTranslateX += totalWidth - width - padding * 2; 46123 } 46124 else if (align === CENTER) { 46125 lineTranslateX += (totalWidth - width - padding * 2) / 2; 46126 } 46127 if (shouldUnderline) { 46128 context.save(); 46129 context.beginPath(); 46130 const yOffset = Global_1$3.Konva._fixTextRendering 46131 ? Math.round(fontSize / 4) 46132 : Math.round(fontSize / 2); 46133 const x = lineTranslateX; 46134 const y = translateY + lineTranslateY + yOffset; 46135 context.moveTo(x, y); 46136 spacesNumber = text.split(' ').length - 1; 46137 lineWidth = 46138 align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width; 46139 context.lineTo(x + Math.round(lineWidth), y); 46140 context.lineWidth = fontSize / 15; 46141 const gradient = this._getLinearGradient(); 46142 context.strokeStyle = gradient || fill; 46143 context.stroke(); 46144 context.restore(); 46145 } 46146 if (shouldLineThrough) { 46147 context.save(); 46148 context.beginPath(); 46149 const yOffset = Global_1$3.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0; 46150 context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset); 46151 spacesNumber = text.split(' ').length - 1; 46152 lineWidth = 46153 align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width; 46154 context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY + yOffset); 46155 context.lineWidth = fontSize / 15; 46156 const gradient = this._getLinearGradient(); 46157 context.strokeStyle = gradient || fill; 46158 context.stroke(); 46159 context.restore(); 46160 } 46161 if (direction !== RTL && (letterSpacing !== 0 || align === JUSTIFY)) { 46162 spacesNumber = text.split(' ').length - 1; 46163 const array = stringToArray(text); 46164 for (let li = 0; li < array.length; li++) { 46165 const letter = array[li]; 46166 if (letter === ' ' && !lastLine && align === JUSTIFY) { 46167 lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber; 46168 } 46169 this._partialTextX = lineTranslateX; 46170 this._partialTextY = translateY + lineTranslateY; 46171 this._partialText = letter; 46172 context.fillStrokeShape(this); 46173 lineTranslateX += this.measureSize(letter).width + letterSpacing; 46174 } 46175 } 46176 else { 46177 if (letterSpacing !== 0) { 46178 context.setAttr('letterSpacing', `${letterSpacing}px`); 46179 } 46180 this._partialTextX = lineTranslateX; 46181 this._partialTextY = translateY + lineTranslateY; 46182 this._partialText = text; 46183 context.fillStrokeShape(this); 46184 } 46185 context.restore(); 46186 if (textArrLen > 1) { 46187 translateY += lineHeightPx; 46188 } 46189 } 46190 } 46191 _hitFunc(context) { 46192 const width = this.getWidth(), height = this.getHeight(); 46193 context.beginPath(); 46194 context.rect(0, 0, width, height); 46195 context.closePath(); 46196 context.fillStrokeShape(this); 46197 } 46198 setText(text) { 46199 const str = Util_1$5.Util._isString(text) 46200 ? text 46201 : text === null || text === undefined 46202 ? '' 46203 : text + ''; 46204 this._setAttr(TEXT, str); 46205 return this; 46206 } 46207 getWidth() { 46208 const isAuto = this.attrs.width === AUTO || this.attrs.width === undefined; 46209 return isAuto ? this.getTextWidth() + this.padding() * 2 : this.attrs.width; 46210 } 46211 getHeight() { 46212 const isAuto = this.attrs.height === AUTO || this.attrs.height === undefined; 46213 return isAuto 46214 ? this.fontSize() * this.textArr.length * this.lineHeight() + 46215 this.padding() * 2 46216 : this.attrs.height; 46217 } 46218 getTextWidth() { 46219 return this.textWidth; 46220 } 46221 getTextHeight() { 46222 Util_1$5.Util.warn('text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.'); 46223 return this.textHeight; 46224 } 46225 measureSize(text) { 46226 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; 46227 let _context = getDummyContext(), fontSize = this.fontSize(), metrics; 46228 _context.save(); 46229 _context.font = this._getContextFont(); 46230 metrics = _context.measureText(text);
46231 _context.restore(); 46232 const scaleFactor = fontSize / 100; 46233 return { 46234 actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== void 0 ? _a : 71.58203125 * scaleFactor, 46235 actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== void 0 ? _b : 0, 46236 actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== void 0 ? _c : -7.421875 * scaleFactor, 46237 actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== void 0 ? _d : 75.732421875 * scaleFactor, 46238 alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== void 0 ? _e : 0, 46239 emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== void 0 ? _f : 100 * scaleFactor, 46240 emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== void 0 ? _g : -20 * scaleFactor, 46241 fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== void 0 ? _h : 91 * scaleFactor, 46242 fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== void 0 ? _j : 21 * scaleFactor, 46243 hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== void 0 ? _k : 72.80000305175781 *
46243scaleFactor, 46244 ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !== void 0 ? _l : -21 * scaleFactor, 46245 width: metrics.width, 46246 height: fontSize, 46247 }; 46248 } 46249 _getContextFont() { 46250 return (this.fontStyle() + 46251 SPACE + 46252 this.fontVariant() + 46253 SPACE + 46254 (this.fontSize() + PX_SPACE) + 46255 normalizeFontFamily(this.fontFamily())); 46256 } 46257 _addTextLine(line) { 46258 const align = this.align(); 46259 if (align === JUSTIFY) { 46260 line = line.trim(); 46261 } 46262 const width = this._getTextWidth(line); 46263 return this.textArr.push({ 46264 text: line, 46265 width: width, 46266 lastInParagraph: false, 46267 }); 46268 } 46269 _getTextWidth(text) { 46270 const letterSpacing = this.letterSpacing(); 46271 const length = text.length; 46272 return getDummyContext().measureText(text).width + letterSpacing * length; 46273 } 46274 _setTextData() { 46275 let lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis(); 46276 this.textArr = []; 46277 getDummyContext().font = this._getContextFont(); 46278 const additionalWidth = shouldAddEllipsis 46279 ? this._getTextWidth(ELLIPSIS) 46280 : 0; 46281 for (let i = 0, max = lines.length; i < max; ++i) { 46282 let line = lines[i]; 46283 let lineWidth = this._getTextWidth(line); 46284 if (fixedWidth && lineWidth > maxWidth) { 46285 while (line.length > 0) { 46286 let low = 0, high = stringToArray(line).length, match = '', matchWidth = 0; 46287 while (low < high) { 46288 const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr); 46289 const shouldConsiderEllipsis = shouldAddEllipsis && 46290 fixedHeight && 46291 currentHeightPx + lineHeightPx > maxHeightPx; 46292 const effectiveWidth = shouldConsiderEllipsis 46293 ? substrWidth + additionalWidth 46294 : substrWidth; 46295 if (effectiveWidth <= maxWidth) { 46296 low = mid + 1; 46297 match = substr; 46298 matchWidth = substrWidth; 46299 } 46300 else { 46301 high = mid; 46302 } 46303 } 46304 if (match) { 46305 if (wrapAtWord) { 46306 const lineArray = stringToArray(line); 46307 const matchArray = stringToArray(match); 46308 const nextChar = lineArray[matchArray.length]; 46309 const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH; 46310 let wrapIndex; 46311 if (nextIsSpaceOrDash && matchWidth <= maxWidth) { 46312 wrapIndex = matchArray.length; 46313 } 46314 else { 46315 const lastSpaceIndex = matchArray.lastIndexOf(SPACE); 46316 const lastDashIndex = matchArray.lastIndexOf(DASH); 46317 wrapIndex = Math.max(lastSpaceIndex, lastDashIndex) + 1; 46318 } 46319 if (wrapIndex > 0) { 46320 low = wrapIndex; 46321 match = lineArray.slice(0, low).join(''); 46322 matchWidth = this._getTextWidth(match); 46323 } 46324 } 46325 match = match.trimRight(); 46326 this._addTextLine(match); 46327 textWidth = Math.max(textWidth, matchWidth); 46328 currentHeightPx += lineHeightPx; 46329 const shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx); 46330 if (shouldHandleEllipsis) { 46331 this._tryToAddEllipsisToLastLine(); 46332 break; 46333 } 46334 const lineArray = stringToArray(line); 46335 line = lineArray.slice(low).join('').trimLeft(); 46336 if (line.length > 0) { 46337 lineWidth = this._getTextWidth(line); 46338 if (lineWidth <= maxWidth) { 46339 this._addTextLine(line); 46340 currentHeightPx += lineHeightPx; 46341 textWidth = Math.max(textWidth, lineWidth); 46342 break; 46343 } 46344 } 46345 } 46346 else { 46347 break; 46348 } 46349 } 46350 } 46351 else { 46352 this._addTextLine(line); 46353 currentHeightPx += lineHeightPx; 46354 textWidth = Math.max(textWidth, lineWidth); 46355 if (this._shouldHandleEllipsis(currentHeightPx) && i < max - 1) { 46356 this._tryToAddEllipsisToLastLine(); 46357 } 46358 } 46359 if (this.textArr[this.textArr.length - 1]) { 46360 this.textArr[this.textArr.length - 1].lastInParagraph = true; 46361 } 46362 if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) { 46363 break; 46364 } 46365 } 46366 this.textHeight = fontSize; 46367 this.textWidth = textWidth; 46368 } 46369 _shouldHandleEllipsis(currentHeightPx) { 46370 const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE; 46371 return (!shouldWrap || 46372 (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx)); 46373 }
46374 _tryToAddEllipsisToLastLine() { 46375 const width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis(); 46376 const lastLine = this.textArr[this.textArr.length - 1]; 46377 if (!lastLine || !shouldAddEllipsis) { 46378 return; 46379 } 46380 if (fixedWidth) { 46381 const haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth; 46382 if (!haveSpace) { 46383 lastLine.text = lastLine.text.slice(0, lastLine.text.length - 3); 46384 } 46385 } 46386 this.textArr.splice(this.textArr.length - 1, 1); 46387 this._addTextLine(lastLine.text + ELLIPSIS); 46388 } 46389 getStrokeScaleEnabled() { 46390 return true; 46391 } 46392 _useBufferCanvas() { 46393 const hasLine = this.textDecoration().indexOf('underline') !== -1 || 46394 this.textDecoration().indexOf('line-through') !== -1; 46395 const hasShadow = this.hasShadow(); 46396 if (hasLine && hasShadow) { 46397 return true; 46398 } 46399 return super._useBufferCanvas(); 46400 } 46401}; 46402Text$2.Text = Text$1; 46403Text$1.prototype._fillFunc = _fillFunc$1; 46404Text$1.prototype._strokeFunc = _strokeFunc$1; 46405Text$1.prototype.className = TEXT_UPPER; 46406Text$1.prototype._attrsAffectingSize = [ 46407 'text', 46408 'fontSize', 46409 'padding', 46410 'wrap', 46411 'lineHeight', 46412 'letterSpacing', 46413]; 46414(0, Global_2$2._registerNode)(Text$1); 46415Factory_1$i.Factory.overWriteSetter(Text$1, 'width', (0, Validators_1$i.getNumberOrAutoValidator)()); 46416Factory_1$i.Factory.overWriteSetter(Text$1, 'height', (0, Validators_1$i.getNumberOrAutoValidator)()); 46417Factory_1$i.Factory.addGetterSetter(Text$1, 'direction', INHERIT); 46418Factory_1$i.Factory.addGetterSetter(Text$1, 'fontFamily', 'Arial'); 46419Factory_1$i.Factory.addGetterSetter(Text$1, 'fontSize', 12, (0, Validators_1$i.getNumberValidator)()); 46420Factory_1$i.Factory.addGetterSetter(Text$1, 'fontStyle', NORMAL$1); 46421Factory_1$i.Factory.addGetterSetter(Text$1, 'fontVariant', NORMAL$1); 46422Factory_1$i.Factory.addGetterSetter(Text$1, 'padding', 0, (0, Validators_1$i.getNumberValidator)()); 46423Factory_1$i.Factory.addGetterSetter(Text$1, 'align', LEFT); 46424Factory_1$i.Factory.addGetterSetter(Text$1, 'verticalAlign', TOP); 46425Factory_1$i.Factory.addGetterSetter(Text$1, 'lineHeight', 1, (0, Validators_1$i.getNumberValidator)()); 46426Factory_1$i.Factory.addGetterSetter(Text$1, 'wrap', WORD); 46427Factory_1$i.Factory.addGetterSetter(Text$1, 'ellipsis', false, (0, Validators_1$i.getBooleanValidator)()); 46428Factory_1$i.Factory.addGetterSetter(Text$1, 'letterSpacing', 0, (0, Validators_1$i.getNumberValidator)()); 46429Factory_1$i.Factory.addGetterSetter(Text$1, 'text', '', (0, Validators_1$i.getStringValidator)()); 46430Factory_1$i.Factory.addGetterSetter(Text$1, 'textDecoration', ''); 46431 46432var TextPath$1 = {}; 46433 46434Object.defineProperty(TextPath$1, "__esModule", { value: true }); 46435TextPath$1.TextPath = void 0; 46436const Util_1$4 = Util; 46437const Factory_1$h = Factory; 46438const Shape_1$2 = Shape; 46439const Path_1$1 = Path$1; 46440const Text_1$1 = Text$2; 46441const Validators_1$h = Validators; 46442const Global_1$2 = Global; 46443const EMPTY_STRING = '', NORMAL = 'normal'; 46444function _fillFunc(context) { 46445 context.fillText(this.partialText, 0, 0); 46446} 46447function _strokeFunc(context) { 46448 context.strokeText(this.partialText, 0, 0); 46449} 46450class TextPath extends Shape_1$2.Shape { 46451 constructor(config) { 46452 super(config); 46453 this.dummyCanvas = Util_1$4.Util.createCanvasElement(); 46454 this.dataArray = []; 46455 this._readDataAttribute(); 46456 this.on('dataChange.konva', function () { 46457 this._readDataAttribute(); 46458 this._setTextData(); 46459 }); 46460 this.on('textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncCh
46460ange.konva fontSizeChange.konva fontFamilyChange.konva', this._setTextData); 46461 this._setTextData(); 46462 } 46463 _getTextPathLength() { 46464 return Path_1$1.Path.getPathLength(this.dataArray); 46465 } 46466 _getPointAtLength(length) { 46467 if (!this.attrs.data) { 46468 return null; 46469 } 46470 const totalLength = this.pathLength; 46471 if (length - 1 > totalLength) { 46472 return null; 46473 } 46474 return Path_1$1.Path.getPointAtLengthOfDataArray(length, this.dataArray); 46475 } 46476 _readDataAttribute() { 46477 this.dataArray = Path_1$1.Path.parsePathData(this.attrs.data); 46478 this.pathLength = this._getTextPathLength(); 46479 } 46480 _sceneFunc(context) { 46481 context.setAttr('font', this._getContextFont()); 46482 context.setAttr('textBaseline', this.textBaseline()); 46483 context.setAttr('textAlign', 'left'); 46484 context.save(); 46485 const textDecoration = this.textDecoration(); 46486 const fill = this.fill(); 46487 const fontSize = this.fontSize(); 46488 const glyphInfo = this.glyphInfo; 46489 if (textDecoration === 'underline') { 46490 context.beginPath(); 46491 } 46492 for (let i = 0; i < glyphInfo.length; i++) { 46493 context.save(); 46494 const p0 = glyphInfo[i].p0; 46495 context.translate(p0.x, p0.y); 46496 context.rotate(glyphInfo[i].rotation); 46497 this.partialText = glyphInfo[i].text; 46498 context.fillStrokeShape(this); 46499 if (textDecoration === 'underline') { 46500 if (i === 0) { 46501 context.moveTo(0, fontSize / 2 + 1); 46502 } 46503 context.lineTo(fontSize, fontSize / 2 + 1); 46504 } 46505 context.restore(); 46506 } 46507 if (textDecoration === 'underline') { 46508 context.strokeStyle = fill; 46509 context.lineWidth = fontSize / 20; 46510 context.stroke(); 46511 } 46512 context.restore(); 46513 } 46514 _hitFunc(context) { 46515 context.beginPath(); 46516 const glyphInfo = this.glyphInfo; 46517 if (glyphInfo.length >= 1) { 46518 const p0 = glyphInfo[0].p0; 46519 context.moveTo(p0.x, p0.y); 46520 } 46521 for (let i = 0; i < glyphInfo.length; i++) { 46522 const p1 = glyphInfo[i].p1; 46523 context.lineTo(p1.x, p1.y); 46524 } 46525 context.setAttr('lineWidth', this.fontSize()); 46526 context.setAttr('strokeStyle', this.colorKey); 46527 context.stroke(); 46528 } 46529 getTextWidth() { 46530 return this.textWidth; 46531 } 46532 getTextHeight() { 46533 Util_1$4.Util.warn('text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.'); 46534 return this.textHeight; 46535 } 46536 setText(text) { 46537 return Text_1$1.Text.prototype.setText.call(this, text); 46538 } 46539 _getContextFont() { 46540 return Text_1$1.Text.prototype._getContextFont.call(this); 46541 } 46542 _getTextSize(text) { 46543 const dummyCanvas = this.dummyCanvas; 46544 const _context = dummyCanvas.getContext('2d'); 46545 _context.save(); 46546 _context.font = this._getContextFont(); 46547 const metrics = _context.measureText(text); 46548 _context.restore(); 46549 return { 46550 width: metrics.width, 46551 height: parseInt(`${this.fontSize()}`, 10), 46552 }; 46553 } 46554 _setTextData() { 46555 const { width, height } = this._getTextSize(this.attrs.text); 46556 this.textWidth = width; 46557 this.textHeight = height; 46558 this.glyphInfo = []; 46559 if (!this.attrs.data) { 46560 return null; 46561 } 46562 const letterSpacing = this.letterSpacing(); 46563 const align = this.align(); 46564 const kerningFunc = this.kerningFunc(); 46565 const textWidth = Math.max(this.textWidth + ((this.attrs.text || '').length - 1) * letterSpacing, 0); 46566 let offset = 0; 46567 if (align === 'center') { 46568 offset = Math.max(0, this.pathLength / 2 - textWidth / 2); 46569 } 46570 if (align === 'right') { 46571 offset = Math.max(0, this.pathLength - textWidth); 46572 } 46573 const charArr = (0, Text_1$1.stringToArray)(this.text()); 46574 let offsetToGlyph = offset; 46575 for (let i = 0; i < charArr.length; i++) { 46576 const charStartPoint = this._getPointAtLength(offsetToGlyph); 46577 if (!charStartPoint) 46578 return; 46579 let glyphWidth = this._getTextSize(charArr[i]).width + letterSpacing; 46580 if (charArr[i] === ' ' && align === 'justify') { 46581 const numberOfSpaces = this.text().split(' ').length - 1; 46582 glyphWidth += (this.pathLength - textWidth) / numberOfSpaces; 46583 } 46584 const charEndPoint = this._getPointAtLength(offsetToGlyph + glyphWidth); 46585 if (!charEndPoint) 46586 return; 46587 const width = Path_1$1.Path.getLineLength(charStartPoint.x, charStartPoint.y, charEndPoint.x, charEndPoint.y); 46588 let kern = 0; 46589 if (kerningFunc) { 46590 try { 46591 kern = kerningFunc(charArr[i - 1], charArr[i]) * this.fontSize(); 46592 } 46593 catch (e) { 46594 kern = 0; 46595 } 46596 } 46597 charStartPoint.x += kern; 46598 charEndPoint.x += kern; 46599 this.textWidth += kern; 46600 const midpoint = Path_1$1.Path.getPointOnLine(kern + width / 2.0, charStartPoint.x, charStartPoint.y, charEndPoint.x, charEndPoint.y); 46601 const rotation = Math.atan2(charEndPoint.y - charStartPoint.y, charEndPoint.x - charStartPoint.x); 46602 this.glyphInfo.push({ 46603 transposeX: midpoint.x, 46604 transposeY: midpoint.y, 46605 text: charArr[i], 46606 rotation: rotation, 46607 p0: charStartPoint, 46608 p1: charEndPoint, 46609 }); 46610 offsetToGlyph += glyphWidth; 46611 } 46612 } 46613 getSelfRect() { 46614 if (!this.glyphInfo.length) { 46615 return { 46616 x: 0, 46617 y: 0, 46618 width: 0, 46619 height: 0, 46620 }; 46621 } 46622 const points = []; 46623 this.glyphInfo.forEach(function (info) { 46624 points.push(info.p0.x); 46625 points.push(info.p0.y); 46626 points.push(info.p1.x); 46627 points.push(info.p1.y); 46628 }); 46629 let minX = points[0] || 0; 46630 let maxX = points[0] || 0; 46631 let minY = points[1] || 0; 46632 let maxY = points[1] || 0; 46633 let x, y; 46634 for (let i = 0; i < points.length / 2; i++) { 46635 x = points[i * 2]; 46636 y = points[i * 2 + 1]; 46637 minX = Math.min(minX, x); 46638 maxX = Math.max(maxX, x); 46639 minY = Math.min(minY, y); 46640 maxY = Math.max(maxY, y); 46641 } 46642 const fontSize = this.fontSize(); 46643 return { 46644 x: minX - fontSize / 2, 46645 y: minY - fontSize / 2, 46646 width: maxX - minX + fontSize, 46647 height: maxY - minY + fontSize, 46648 }; 46649 } 46650 destroy() { 46651 Util_1$4.Util.releaseCanvas(this.dummyCanvas); 46652 return super.destroy(); 46653 } 46654} 46655TextPath$1.TextPath = TextPath; 46656TextPath.prototype._fillFunc = _fillFunc;
46657TextPath.prototype._strokeFunc = _strokeFunc; 46658TextPath.prototype._fillFuncHit = _fillFunc; 46659TextPath.prototype._strokeFuncHit = _strokeFunc; 46660TextPath.prototype.className = 'TextPath'; 46661TextPath.prototype._attrsAffectingSize = ['text', 'fontSize', 'data']; 46662(0, Global_1$2._registerNode)(TextPath); 46663Factory_1$h.Factory.addGetterSetter(TextPath, 'data'); 46664Factory_1$h.Factory.addGetterSetter(TextPath, 'fontFamily', 'Arial'); 46665Factory_1$h.Factory.addGetterSetter(TextPath, 'fontSize', 12, (0, Validators_1$h.getNumberValidator)()); 46666Factory_1$h.Factory.addGetterSetter(TextPath, 'fontStyle', NORMAL); 46667Factory_1$h.Factory.addGetterSetter(TextPath, 'align', 'left'); 46668Factory_1$h.Factory.addGetterSetter(TextPath, 'letterSpacing', 0, (0, Validators_1$h.getNumberValidator)()); 46669Factory_1$h.Factory.addGetterSetter(TextPath, 'textBaseline', 'middle'); 46670Factory_1$h.Factory.addGetterSetter(TextPath, 'fontVariant', NORMAL); 46671Factory_1$h.Factory.addGetterSetter(TextPath, 'text', EMPTY_STRING); 46672Factory_1$h.Factory.addGetterSetter(TextPath, 'textDecoration', ''); 46673Factory_1$h.Factory.addGetterSetter(TextPath, 'kerningFunc', undefined); 46674 46675var Transformer$2 = {}; 46676 46677Object.defineProperty(Transformer$2, "__esModule", { value: true }); 46678Transformer$2.Transformer = void 0; 46679const Util_1$3 = Util; 46680const Factory_1$g = Factory; 46681const Node_1$f = Node$2; 46682const Shape_1$1 = Shape; 46683const Rect_1$1 = Rect$2; 46684const Group_1 = Group$2; 46685const Global_1$1 = Global; 46686const Validators_1$g = Validators; 46687const Global_2$1 = Global; 46688const EVENTS_NAME = 'tr-konva'; 46689const ATTR_CHANGE_LIST = [ 46690 'resizeEnabledChange', 46691 'rotateAnchorOffsetChange', 46692 'rotateEnabledChange', 46693 'enabledAnchorsChange', 46694 'anchorSizeChange', 46695 'borderEnabledChange', 46696 'borderStrokeChange', 46697 'borderStrokeWidthChange', 46698 'borderDashChange', 46699 'anchorStrokeChange', 46700 'anchorStrokeWidthChange', 46701 'anchorFillChange', 46702 'anchorCornerRadiusChange', 46703 'ignoreStrokeChange', 46704 'anchorStyleFuncChange', 46705] 46706 .map((e) => e + `.${EVENTS_NAME}`) 46707 .join(' '); 46708const NODES_RECT = 'nodesRect'; 46709const TRANSFORM_CHANGE_STR = [ 46710 'widthChange', 46711 'heightChange', 46712 'scaleXChange', 46713 'scaleYChange', 46714 'skewXChange', 46715 'skewYChange', 46716 'rotationChange', 46717 'offsetXChange', 46718 'offsetYChange', 46719 'transformsEnabledChange', 46720 'strokeWidthChange', 46721]; 46722const ANGLES = { 46723 'top-left': -45, 46724 'top-center': 0, 46725 'top-right': 45, 46726 'middle-right': -90, 46727 'middle-left': 90, 46728 'bottom-left': -135, 46729 'bottom-center': 180, 46730 'bottom-right': 135, 46731}; 46732const TOUCH_DEVICE = 'ontouchstart' in Global_1$1.Konva._global; 46733function getCursor(anchorName, rad, rotateCursor) { 46734 if (anchorName === 'rotater') { 46735 return rotateCursor; 46736 } 46737 rad += Util_1$3.Util.degToRad(ANGLES[anchorName] || 0); 46738 const angle = ((Util_1$3.Util.radToDeg(rad) % 360) + 360) % 360; 46739 if (Util_1$3.Util._inRange(angle, 315 + 22.5, 360) || Util_1$3.Util._inRange(angle, 0, 22.5)) { 46740 return 'ns-resize'; 46741 } 46742 else if (Util_1$3.Util._inRange(angle, 45 - 22.5, 45 + 22.5)) { 46743 return 'nesw-resize'; 46744 } 46745 else if (Util_1$3.Util._inRange(angle, 90 - 22.5, 90 + 22.5)) { 46746 return 'ew-resize'; 46747 } 46748 else if (Util_1$3.Util._inRange(angle, 135 - 22.5, 135 + 22.5)) { 46749 return 'nwse-resize'; 46750 } 46751 else if (Util_1$3.Util._inRange(angle, 180 - 22.5, 180 + 22.5)) { 46752 return 'ns-resize'; 46753 } 46754 else if (Util_1$3.Util._inRange(angle, 225 - 22.5, 225 + 22.5)) { 46755 return 'nesw-resize'; 46756 } 46757 else if (Util_1$3.Util._inRange(angle, 270 - 22.5, 270 + 22.5)) { 46758 return 'ew-resize'; 46759 } 46760 else if (Util_1$3.Util._inRange(angle, 315 - 22.5, 315 + 22.5)) { 46761 return 'nwse-resize'; 46762 } 46763 else { 46764 Util_1$3.Util.error('Transformer has unknown angle for cursor detection: ' + angle); 46765 return 'pointer'; 46766 } 46767} 46768const ANCHORS_NAMES = [ 46769 'top-left', 46770 'top-center', 46771 'top-right', 46772 'middle-right', 46773 'middle-left', 46774 'bottom-left', 46775 'bottom-center', 46776 'bottom-right', 46777]; 46778function getCenter(shape) { 46779 return { 46780 x: shape.x + 46781 (shape.width / 2) * Math.cos(shape.rotation) + 46782 (shape.height / 2) * Math.sin(-shape.rotation), 46783 y: shape.y + 46784 (shape.height / 2) * Math.cos(shape.rotation) + 46785 (shape.width / 2) * Math.sin(shape.rotation), 46786 }; 46787}
46788function rotateAroundPoint(shape, angleRad, point) { 46789 const x = point.x + 46790 (shape.x - point.x) * Math.cos(angleRad) - 46791 (shape.y - point.y) * Math.sin(angleRad); 46792 const y = point.y + 46793 (shape.x - point.x) * Math.sin(angleRad) + 46794 (shape.y - point.y) * Math.cos(angleRad); 46795 return { 46796 ...shape, 46797 rotation: shape.rotation + angleRad, 46798 x, 46799 y, 46800 }; 46801} 46802function rotateAroundCenter(shape, deltaRad) { 46803 const center = getCenter(shape); 46804 return rotateAroundPoint(shape, deltaRad, center); 46805} 46806function getSnap(snaps, newRotationRad, tol) { 46807 let snapped = newRotationRad; 46808 for (let i = 0; i < snaps.length; i++) { 46809 const angle = Global_1$1.Konva.getAngle(snaps[i]); 46810 const absDiff = Math.abs(angle - newRotationRad) % (Math.PI * 2); 46811 const dif = Math.min(absDiff, Math.PI * 2 - absDiff); 46812 if (dif < tol) { 46813 snapped = angle; 46814 } 46815 } 46816 return snapped; 46817} 46818let activeTransformersCount = 0; 46819let Transformer$1 = class Transformer extends Group_1.Group { 46820 constructor(config) { 46821 super(config); 46822 this._movingAnchorName = null; 46823 this._transforming = false; 46824 this._createElements(); 46825 this._handleMouseMove = this._handleMouseMove.bind(this); 46826 this._handleMouseUp = this._handleMouseUp.bind(this); 46827 this.update = this.update.bind(this); 46828 this.on(ATTR_CHANGE_LIST, this.update); 46829 if (this.getNode()) { 46830 this.update(); 46831 } 46832 } 46833 attachTo(node) { 46834 this.setNode(node); 46835 return this; 46836 } 46837 setNode(node) { 46838 Util_1$3.Util.warn('tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.'); 46839 return this.setNodes([node]); 46840 } 46841 getNode() { 46842 return this._nodes && this._nodes[0]; 46843 } 46844 _getEventNamespace() { 46845 return EVENTS_NAME + this._id; 46846 } 46847 setNodes(nodes = []) { 46848 if (this._nodes && this._nodes.length) { 46849 this.detach(); 46850 } 46851 const filteredNodes = nodes.filter((node) => { 46852 if (node.isAncestorOf(this)) { 46853 Util_1$3.Util.error('Konva.Transformer cannot be an a child of the node you are trying to attach'); 46854 return false; 46855 } 46856 return true; 46857 }); 46858 this._nodes = nodes = filteredNodes; 46859 if (nodes.length === 1 && this.useSingleNodeRotation()) { 46860 this.rotation(nodes[0].getAbsoluteRotation()); 46861 } 46862 else { 46863 this.rotation(0); 46864 } 46865 this._nodes.forEach((node) => { 46866 const onChange = () => { 46867 if (this.nodes().length === 1 && this.useSingleNodeRotation()) { 46868 this.rotation(this.nodes()[0].getAbsoluteRotation()); 46869 } 46870 this._resetTransformCache(); 46871 if (!this._transforming && !this.isDragging()) { 46872 this.update(); 46873 } 46874 }; 46875 if (node._attrsAffectingSize.length) { 46876 const additionalEvents = node._attrsAffectingSize 46877 .map((prop) => prop + 'Change.' + this._getEventNamespace()) 46878 .join(' '); 46879 node.on(additionalEvents, onChange); 46880 } 46881 node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(' '), onChange); 46882 node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange); 46883 this._proxyDrag(node); 46884 }); 46885 this._resetTransformCache(); 46886 const elementsCreated = !!this.findOne('.top-left'); 46887 if (elementsCreated) { 46888 this.update(); 46889 } 46890 return this; 46891 } 46892 _proxyDrag(node) { 46893 let lastPos; 46894 node.on(`dragstart.${this._getEventNamespace()}`, (e) => { 46895 lastPos = node.getAbsolutePosition(); 46896 if (!this.isDragging() && node !== this.findOne('.back')) { 46897 this.startDrag(e, false); 46898 } 46899 }); 46900 node.on(`dragmove.${this._getEventNamespace()}`, (e) => { 46901 if (!lastPos) { 46902 return; 46903 } 46904 const abs = node.getAbsolutePosition(); 46905 const dx = abs.x - lastPos.x; 46906 const dy = abs.y - lastPos.y;
46907 this.nodes().forEach((otherNode) => { 46908 if (otherNode === node) { 46909 return; 46910 } 46911 if (otherNode.isDragging()) { 46912 return; 46913 } 46914 const otherAbs = otherNode.getAbsolutePosition(); 46915 otherNode.setAbsolutePosition({ 46916 x: otherAbs.x + dx, 46917 y: otherAbs.y + dy, 46918 }); 46919 otherNode.startDrag(e); 46920 }); 46921 lastPos = null; 46922 }); 46923 } 46924 getNodes() { 46925 return this._nodes || []; 46926 } 46927 getActiveAnchor() { 46928 return this._movingAnchorName; 46929 } 46930 detach() { 46931 if (this._nodes) { 46932 this._nodes.forEach((node) => { 46933 node.off('.' + this._getEventNamespace()); 46934 }); 46935 } 46936 this._nodes = []; 46937 this._resetTransformCache(); 46938 } 46939 _resetTransformCache() { 46940 this._clearCache(NODES_RECT); 46941 this._clearCache('transform'); 46942 this._clearSelfAndDescendantCache('absoluteTransform'); 46943 } 46944 _getNodeRect() { 46945 return this._getCache(NODES_RECT, this.__getNodeRect); 46946 } 46947 __getNodeShape(node, rot = this.rotation(), relative) { 46948 const rect = node.getClientRect({ 46949 skipTransform: true, 46950 skipShadow: true, 46951 skipStroke: this.ignoreStroke(), 46952 }); 46953 const absScale = node.getAbsoluteScale(relative); 46954 const absPos = node.getAbsolutePosition(relative); 46955 const dx = rect.x * absScale.x - node.offsetX() * absScale.x; 46956 const dy = rect.y * absScale.y - node.offsetY() * absScale.y; 46957 const rotation = (Global_1$1.Konva.getAngle(node.getAbsoluteRotation()) + Math.PI * 2) % 46958 (Math.PI * 2); 46959 const box = { 46960 x: absPos.x + dx * Math.cos(rotation) + dy * Math.sin(-rotation), 46961 y: absPos.y + dy * Math.cos(rotation) + dx * Math.sin(rotation), 46962 width: rect.width * absScale.x, 46963 height: rect.height * absScale.y, 46964 rotation: rotation, 46965 }; 46966 return rotateAroundPoint(box, -Global_1$1.Konva.getAngle(rot), { 46967 x: 0, 46968 y: 0, 46969 }); 46970 } 46971 __getNodeRect() { 46972 const node = this.getNode(); 46973 if (!node) { 46974 return { 46975 x: -1e8, 46976 y: -1e8, 46977 width: 0, 46978 height: 0, 46979 rotation: 0, 46980 }; 46981 } 46982 const totalPoints = []; 46983 this.nodes().map((node) => { 46984 const box = node.getClientRect({ 46985 skipTransform: true, 46986 skipShadow: true, 46987 skipStroke: this.ignoreStroke(), 46988 }); 46989 const points = [ 46990 { x: box.x, y: box.y }, 46991 { x: box.x + box.width, y: box.y }, 46992 { x: box.x + box.width, y: box.y + box.height }, 46993 { x: box.x, y: box.y + box.height }, 46994 ]; 46995 const trans = node.getAbsoluteTransform(); 46996 points.forEach(function (point) { 46997 const transformed = trans.point(point); 46998 totalPoints.push(transformed); 46999 }); 47000 }); 47001 const tr = new Util_1$3.Transform(); 47002 tr.rotate(-Global_1$1.Konva.getAngle(this.rotation())); 47003 let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity; 47004 totalPoints.forEach(function (point) { 47005 const transformed = tr.point(point); 47006 if (minX === undefined) { 47007 minX = maxX = transformed.x; 47008 minY = maxY = transformed.y; 47009 } 47010 minX = Math.min(minX, transformed.x); 47011 minY = Math.min(minY, transformed.y); 47012 maxX = Math.max(maxX, transformed.x); 47013 maxY = Math.max(maxY, transformed.y); 47014 }); 47015 tr.invert(); 47016 const p = tr.point({ x: minX, y: minY }); 47017 return { 47018 x: p.x, 47019 y: p.y, 47020 width: maxX - minX, 47021 height: maxY - minY, 47022 rotation: Global_1$1.Konva.getAngle(this.rotation()), 47023 }; 47024 } 47025 getX() { 47026 return this._getNodeRect().x; 47027 } 47028 getY() { 47029 return this._getNodeRect().y; 47030 } 47031 getWidth() { 47032 return this._getNodeRect().width; 47033 } 47034 getHeight() { 47035 return this._getNodeRect().height; 47036 } 47037 _createElements() { 47038 this._createBack(); 47039 ANCHORS_NAMES.forEach((name) => { 47040 this._createAnchor(name); 47041 }); 47042 this._createAnchor('rotater'); 47043 } 47044 _createAnchor(name) { 47045 const anchor = new Rect_1$1.Rect({ 47046 stroke: 'rgb(0, 161, 255)', 47047 fill: 'white', 47048 strokeWidth: 1, 47049 name: name + ' _anchor', 47050 dragDistance: 0, 47051 draggable: true, 47052 hitStrokeWidth: TOUCH_DEVICE ? 10 : 'auto', 47053 }); 47054 const self = this; 47055 anchor.on('mousedown touchstart', function (e) { 47056 self._handleMouseDown(e); 47057 }); 47058 anchor.on('dragstart', (e) => {
47059 anchor.stopDrag(); 47060 e.cancelBubble = true; 47061 }); 47062 anchor.on('dragend', (e) => { 47063 e.cancelBubble = true; 47064 }); 47065 anchor.on('mouseenter', () => { 47066 const rad = Global_1$1.Konva.getAngle(this.rotation()); 47067 const rotateCursor = this.rotateAnchorCursor(); 47068 const cursor = getCursor(name, rad, rotateCursor); 47069 anchor.getStage().content && 47070 (anchor.getStage().content.style.cursor = cursor); 47071 this._cursorChange = true; 47072 }); 47073 anchor.on('mouseout', () => { 47074 anchor.getStage().content && 47075 (anchor.getStage().content.style.cursor = ''); 47076 this._cursorChange = false; 47077 }); 47078 this.add(anchor); 47079 } 47080 _createBack() { 47081 const back = new Shape_1$1.Shape({ 47082 name: 'back', 47083 width: 0, 47084 height: 0, 47085 draggable: true, 47086 sceneFunc(ctx, shape) { 47087 const tr = shape.getParent(); 47088 const padding = tr.padding(); 47089 ctx.beginPath(); 47090 ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2); 47091 ctx.moveTo(shape.width() / 2, -padding); 47092 if (tr.rotateEnabled() && tr.rotateLineVisible()) { 47093 ctx.lineTo(shape.width() / 2, -tr.rotateAnchorOffset() * Util_1$3.Util._sign(shape.height()) - padding); 47094 } 47095 ctx.fillStrokeShape(shape); 47096 }, 47097 hitFunc: (ctx, shape) => { 47098 if (!this.shouldOverdrawWholeArea()) { 47099 return; 47100 } 47101 const padding = this.padding(); 47102 ctx.beginPath(); 47103 ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2); 47104 ctx.fillStrokeShape(shape); 47105 }, 47106 }); 47107 this.add(back); 47108 this._proxyDrag(back); 47109 back.on('dragstart', (e) => { 47110 e.cancelBubble = true; 47111 }); 47112 back.on('dragmove', (e) => { 47113 e.cancelBubble = true; 47114 }); 47115 back.on('dragend', (e) => { 47116 e.cancelBubble = true; 47117 }); 47118 this.on('dragmove', (e) => { 47119 this.update(); 47120 }); 47121 } 47122 _handleMouseDown(e) { 47123 if (this._transforming) { 47124 return; 47125 } 47126 this._movingAnchorName = e.target.name().split(' ')[0]; 47127 const attrs = this._getNodeRect(); 47128 const width = attrs.width; 47129 const height = attrs.height; 47130 const hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); 47131 this.sin = Math.abs(height / hypotenuse); 47132 this.cos = Math.abs(width / hypotenuse); 47133 if (typeof window !== 'undefined') { 47134 window.addEventListener('mousemove', this._handleMouseMove); 47135 window.addEventListener('touchmove', this._handleMouseMove); 47136 window.addEventListener('mouseup', this._handleMouseUp, true); 47137 window.addEventListener('touchend', this._handleMouseUp, true); 47138 } 47139 this._transforming = true; 47140 const ap = e.target.getAbsolutePosition(); 47141 const pos = e.target.getStage().getPointerPosition(); 47142 this._anchorDragOffset = { 47143 x: pos.x - ap.x, 47144 y: pos.y - ap.y, 47145 }; 47146 activeTransformersCount++; 47147 this._fire('transformstart', { evt: e.evt, target: this.getNode() }); 47148 this._nodes.forEach((target) => { 47149 target._fire('transformstart', { evt: e.evt, target }); 47150 }); 47151 } 47152 _handleMouseMove(e) { 47153 let x, y, newHypotenuse; 47154 const anchorNode = this.findOne('.' + this._movingAnchorName); 47155 const stage = anchorNode.getStage(); 47156 stage.setPointersPositions(e); 47157 const pp = stage.getPointerPosition(); 47158 let newNodePos = { 47159 x: pp.x - this._anchorDragOffset.x, 47160 y: pp.y - this._anchorDragOffset.y, 47161 }; 47162 const oldAbs = anchorNode.getAbsolutePosition(); 47163 if (this.anchorDragBoundFunc()) { 47164 newNodePos = this.anchorDragBoundFunc()(oldAbs, newNodePos, e); 47165 } 47166 anchorNode.setAbsolutePosition(newNodePos); 47167 const newAbs = anchorNode.getAbsolutePosition(); 47168 if (oldAbs.x === newAbs.x && oldAbs.y === newAbs.y) { 47169 return; 47170 } 47171 if (this._movingAnchorName === 'rotater') { 47172 const attrs = this._getNodeRect(); 47173 x = anchorNode.x() - attrs.width / 2; 47174 y = -anchorNode.y() + attrs.height / 2; 47175 let delta = Math.atan2(-y, x) + Math.PI / 2; 47176 if (attrs.height < 0) { 47177 delta -= Math.PI; 47178 } 47179 const oldRotation = Global_1$1.Konva.getAngle(this.rotation()); 47180 const newRotation = oldRotation + delta; 47181 const tol = Global_1$1.Konva.getAngle(this.rotationSnapTolerance()); 47182 const snappedRot = getSnap(this.rotationSnaps(), newRotation, tol); 47183 const diff = snappedRot - attrs.rotation;
47184 const shape = rotateAroundCenter(attrs, diff); 47185 this._fitNodesInto(shape, e); 47186 return; 47187 } 47188 const shiftBehavior = this.shiftBehavior(); 47189 let keepProportion; 47190 if (shiftBehavior === 'inverted') { 47191 keepProportion = this.keepRatio() && !e.shiftKey; 47192 } 47193 else if (shiftBehavior === 'none') { 47194 keepProportion = this.keepRatio(); 47195 } 47196 else { 47197 keepProportion = this.keepRatio() || e.shiftKey; 47198 } 47199 var centeredScaling = this.centeredScaling() || e.altKey; 47200 if (this._movingAnchorName === 'top-left') { 47201 if (keepProportion) { 47202 var comparePoint = centeredScaling 47203 ? { 47204 x: this.width() / 2, 47205 y: this.height() / 2, 47206 } 47207 : { 47208 x: this.findOne('.bottom-right').x(), 47209 y: this.findOne('.bottom-right').y(), 47210 }; 47211 newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) + 47212 Math.pow(comparePoint.y - anchorNode.y(), 2)); 47213 var reverseX = this.findOne('.top-left').x() > comparePoint.x ? -1 : 1; 47214 var reverseY = this.findOne('.top-left').y() > comparePoint.y ? -1 : 1; 47215 x = newHypotenuse * this.cos * reverseX; 47216 y = newHypotenuse * this.sin * reverseY; 47217 this.findOne('.top-left').x(comparePoint.x - x); 47218 this.findOne('.top-left').y(comparePoint.y - y); 47219 } 47220 } 47221 else if (this._movingAnchorName === 'top-center') { 47222 this.findOne('.top-left').y(anchorNode.y()); 47223 } 47224 else if (this._movingAnchorName === 'top-right') { 47225 if (keepProportion) { 47226 var comparePoint = centeredScaling 47227 ? { 47228 x: this.width() / 2, 47229 y: this.height() / 2, 47230 } 47231 : { 47232 x: this.findOne('.bottom-left').x(), 47233 y: this.findOne('.bottom-left').y(), 47234 }; 47235 newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) + 47236 Math.pow(comparePoint.y - anchorNode.y(), 2)); 47237 var reverseX = this.findOne('.top-right').x() < comparePoint.x ? -1 : 1; 47238 var reverseY = this.findOne('.top-right').y() > comparePoint.y ? -1 : 1; 47239 x = newHypotenuse * this.cos * reverseX; 47240 y = newHypotenuse * this.sin * reverseY; 47241 this.findOne('.top-right').x(comparePoint.x + x); 47242 this.findOne('.top-right').y(comparePoint.y - y); 47243 } 47244 var pos = anchorNode.position(); 47245 this.findOne('.top-left').y(pos.y); 47246 this.findOne('.bottom-right').x(pos.x); 47247 } 47248 else if (this._movingAnchorName === 'middle-left') { 47249 this.findOne('.top-left').x(anchorNode.x()); 47250 } 47251 else if (this._movingAnchorName === 'middle-right') { 47252 this.findOne('.bottom-right').x(anchorNode.x()); 47253 } 47254 else if (this._movingAnchorName === 'bottom-left') { 47255 if (keepProportion) { 47256 var comparePoint = centeredScaling 47257 ? { 47258 x: this.width() / 2, 47259 y: this.height() / 2, 47260 } 47261 : { 47262 x: this.findOne('.top-right').x(), 47263 y: this.findOne('.top-right').y(), 47264 }; 47265 newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) + 47266 Math.pow(anchorNode.y() - comparePoint.y, 2)); 47267 var reverseX = comparePoint.x < anchorNode.x() ? -1 : 1; 47268 var reverseY = anchorNode.y() < comparePoint.y ? -1 : 1; 47269 x = newHypotenuse * this.cos * reverseX; 47270 y = newHypotenuse * this.sin * reverseY; 47271 anchorNode.x(comparePoint.x - x); 47272 anchorNode.y(comparePoint.y + y); 47273 } 47274 pos = anchorNode.position(); 47275 this.findOne('.top-left').x(pos.x); 47276 this.findOne('.bottom-right').y(pos.y); 47277 } 47278 else if (this._movingAnchorName === 'bottom-center') { 47279 this.findOne('.bottom-right').y(anchorNode.y()); 47280 } 47281 else if (this._movingAnchorName === 'bottom-right') { 47282 if (keepProportion) { 47283 var comparePoint = centeredScaling 47284 ? { 47285 x: this.width() / 2, 47286 y: this.height() / 2, 47287 } 47288 : { 47289 x: this.findOne('.top-left').x(), 47290 y: this.findOne('.top-left').y(), 47291 }; 47292 newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) + 47293 Math.pow(anchorNode.y() - comparePoint.y, 2)); 47294 var reverseX = this.findOne('.bottom-right').x() < comparePoint.x ? -1 : 1; 47295 var reverseY = this.findOne('.bottom-right').y() < comparePoint.y ? -1 : 1; 47296 x = newHypotenuse * this.cos * reverseX; 47297 y = newHypotenuse * this.sin * reverseY; 47298 this.findOne('.bottom-right').x(comparePoint.x + x); 47299 this.findOne('.bottom-right').y(comparePoint.y + y); 47300 } 47301 } 47302 else { 47303 console.error(new Error('Wrong position argument of selection resizer: ' + 47304 this._movingAnchorName)); 47305 } 47306 var centeredScaling = this.centeredScaling() || e.altKey; 47307 if (centeredScaling) { 47308 const topLeft = this.findOne('.top-left'); 47309 const bottomRight = this.findOne('.bottom-right'); 47310 const topOffsetX = topLeft.x(); 47311 const topOffsetY = topLeft.y(); 47312 const bottomOffsetX = this.getWidth() - bottomRight.x(); 47313 const bottomOffsetY = this.getHeight() - bottomRight.y(); 47314 bottomRight.move({ 47315 x: -topOffsetX, 47316 y: -topOffsetY, 47317 }); 47318 topLeft.move({ 47319 x: bottomOffsetX, 47320 y: bottomOffsetY, 47321 }); 47322 } 47323 const absPos = this.findOne('.top-left').getAbsolutePosition(); 47324 x = absPos.x; 47325 y = absPos.y; 47326 const width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x(); 47327 const height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y(); 47328 this._fitNodesInto({ 47329 x: x, 47330 y: y, 47331 width: width, 47332 height: height, 47333 rotation: Global_1$1.Konva.getAngle(this.rotation()), 47334 }, e); 47335 } 47336 _handleMouseUp(e) { 47337 this._removeEvents(e); 47338 } 47339 getAbsoluteTransform() { 47340 return this.getTransform(); 47341 } 47342 _removeEvents(e) { 47343 var _a; 47344 if (this._transforming) { 47345 this._transforming = false;
47346 if (typeof window !== 'undefined') { 47347 window.removeEventListener('mousemove', this._handleMouseMove); 47348 window.removeEventListener('touchmove', this._handleMouseMove); 47349 window.removeEventListener('mouseup', this._handleMouseUp, true); 47350 window.removeEventListener('touchend', this._handleMouseUp, true); 47351 } 47352 const node = this.getNode(); 47353 activeTransformersCount--; 47354 this._fire('transformend', { evt: e, target: node }); 47355 (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw(); 47356 if (node) { 47357 this._nodes.forEach((target) => { 47358 var _a; 47359 target._fire('transformend', { evt: e, target }); 47360 (_a = target.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw(); 47361 }); 47362 } 47363 this._movingAnchorName = null; 47364 } 47365 } 47366 _fitNodesInto(newAttrs, evt) { 47367 const oldAttrs = this._getNodeRect(); 47368 const minSize = 1; 47369 if (Util_1$3.Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize)) { 47370 this.update(); 47371 return; 47372 } 47373 if (Util_1$3.Util._inRange(newAttrs.height, -this.padding() * 2 - minSize, minSize)) { 47374 this.update(); 47375 return; 47376 } 47377 const t = new Util_1$3.Transform(); 47378 t.rotate(Global_1$1.Konva.getAngle(this.rotation())); 47379 if (this._movingAnchorName && 47380 newAttrs.width < 0 && 47381 this._movingAnchorName.indexOf('left') >= 0) { 47382 const offset = t.point({ 47383 x: -this.padding() * 2, 47384 y: 0, 47385 }); 47386 newAttrs.x += offset.x; 47387 newAttrs.y += offset.y; 47388 newAttrs.width += this.padding() * 2; 47389 this._movingAnchorName = this._movingAnchorName.replace('left', 'right'); 47390 this._anchorDragOffset.x -= offset.x; 47391 this._anchorDragOffset.y -= offset.y; 47392 } 47393 else if (this._movingAnchorName && 47394 newAttrs.width < 0 && 47395 this._movingAnchorName.indexOf('right') >= 0) { 47396 const offset = t.point({ 47397 x: this.padding() * 2, 47398 y: 0, 47399 }); 47400 this._movingAnchorName = this._movingAnchorName.replace('right', 'left'); 47401 this._anchorDragOffset.x -= offset.x; 47402 this._anchorDragOffset.y -= offset.y; 47403 newAttrs.width += this.padding() * 2; 47404 } 47405 if (this._movingAnchorName && 47406 newAttrs.height < 0 && 47407 this._movingAnchorName.indexOf('top') >= 0) { 47408 const offset = t.point({ 47409 x: 0, 47410 y: -this.padding() * 2, 47411 }); 47412 newAttrs.x += offset.x; 47413 newAttrs.y += offset.y; 47414 this._movingAnchorName = this._movingAnchorName.replace('top', 'bottom'); 47415 this._anchorDragOffset.x -= offset.x; 47416 this._anchorDragOffset.y -= offset.y; 47417 newAttrs.height += this.padding() * 2; 47418 } 47419 else if (this._movingAnchorName && 47420 newAttrs.height < 0 && 47421 this._movingAnchorName.indexOf('bottom') >= 0) { 47422 const offset = t.point({ 47423 x: 0, 47424 y: this.padding() * 2, 47425 }); 47426 this._movingAnchorName = this._movingAnchorName.replace('bottom', 'top'); 47427 this._anchorDragOffset.x -= offset.x; 47428 this._anchorDragOffset.y -= offset.y; 47429 newAttrs.height += this.padding() * 2; 47430 } 47431 if (this.boundBoxFunc()) { 47432 const bounded = this.boundBoxFunc()(oldAttrs, newAttrs); 47433 if (bounded) { 47434 newAttrs = bounded; 47435 } 47436 else { 47437 Util_1$3.Util.warn('boundBoxFunc returned falsy. You should return new bound rect from it!'); 47438 } 47439 } 47440 const baseSize = 10000000; 47441 const oldTr = new Util_1$3.Transform(); 47442 oldTr.translate(oldAttrs.x, oldAttrs.y); 47443 oldTr.rotate(oldAttrs.rotation); 47444 oldTr.scale(oldAttrs.width / baseSize, oldAttrs.height / baseSize); 47445 const newTr = new Util_1$3.Transform();
47446 const newScaleX = newAttrs.width / baseSize; 47447 const newScaleY = newAttrs.height / baseSize; 47448 if (this.flipEnabled() === false) { 47449 newTr.translate(newAttrs.x, newAttrs.y); 47450 newTr.rotate(newAttrs.rotation); 47451 newTr.translate(newAttrs.width < 0 ? newAttrs.width : 0, newAttrs.height < 0 ? newAttrs.height : 0); 47452 newTr.scale(Math.abs(newScaleX), Math.abs(newScaleY)); 47453 } 47454 else { 47455 newTr.translate(newAttrs.x, newAttrs.y); 47456 newTr.rotate(newAttrs.rotation); 47457 newTr.scale(newScaleX, newScaleY); 47458 } 47459 const delta = newTr.multiply(oldTr.invert()); 47460 this._nodes.forEach((node) => { 47461 var _a; 47462 const parentTransform = node.getParent().getAbsoluteTransform(); 47463 const localTransform = node.getTransform().copy(); 47464 localTransform.translate(node.offsetX(), node.offsetY()); 47465 const newLocalTransform = new Util_1$3.Transform(); 47466 newLocalTransform 47467 .multiply(parentTransform.copy().invert()) 47468 .multiply(delta) 47469 .multiply(parentTransform) 47470 .multiply(localTransform); 47471 const attrs = newLocalTransform.decompose(); 47472 node.setAttrs(attrs); 47473 (_a = node.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw(); 47474 }); 47475 this.rotation(Util_1$3.Util._getRotation(newAttrs.rotation)); 47476 this._nodes.forEach((node) => { 47477 this._fire('transform', { evt: evt, target: node }); 47478 node._fire('transform', { evt: evt, target: node }); 47479 }); 47480 this._resetTransformCache(); 47481 this.update(); 47482 this.getLayer().batchDraw(); 47483 } 47484 forceUpdate() { 47485 this._resetTransformCache(); 47486 this.update(); 47487 } 47488 _batchChangeChild(selector, attrs) { 47489 const anchor = this.findOne(selector); 47490 anchor.setAttrs(attrs); 47491 } 47492 update() { 47493 var _a; 47494 const attrs = this._getNodeRect(); 47495 this.rotation(Util_1$3.Util._getRotation(attrs.rotation)); 47496 const width = attrs.width; 47497 const height = attrs.height; 47498 const enabledAnchors = this.enabledAnchors(); 47499 const resizeEnabled = this.resizeEnabled(); 47500 const padding = this.padding(); 47501 const anchorSize = this.anchorSize(); 47502 const anchors = this.find('._anchor'); 47503 anchors.forEach((node) => { 47504 node.setAttrs({ 47505 width: anchorSize, 47506 height: anchorSize, 47507 offsetX: anchorSize / 2, 47508 offsetY: anchorSize / 2, 47509 stroke: this.anchorStroke(), 47510 strokeWidth: this.anchorStrokeWidth(), 47511 fill: this.anchorFill(), 47512 cornerRadius: this.anchorCornerRadius(), 47513 }); 47514 }); 47515 this._batchChangeChild('.top-left', { 47516 x: 0, 47517 y: 0, 47518 offsetX: anchorSize / 2 + padding, 47519 offsetY: anchorSize / 2 + padding, 47520 visible: resizeEnabled && enabledAnchors.indexOf('top-left') >= 0, 47521 }); 47522 this._batchChangeChild('.top-center', { 47523 x: width / 2, 47524 y: 0, 47525 offsetY: anchorSize / 2 + padding, 47526 visible: resizeEnabled && enabledAnchors.indexOf('top-center') >= 0, 47527 }); 47528 this._batchChangeChild('.top-right', { 47529 x: width, 47530 y: 0, 47531 offsetX: anchorSize / 2 - padding, 47532 offsetY: anchorSize / 2 + padding, 47533 visible: resizeEnabled && enabledAnchors.indexOf('top-right') >= 0, 47534 }); 47535 this._batchChangeChild('.middle-left', { 47536 x: 0, 47537 y: height / 2, 47538 offsetX: anchorSize / 2 + padding, 47539 visible: resizeEnabled && enabledAnchors.indexOf('middle-left') >= 0, 47540 }); 47541 this._batchChangeChild('.middle-right', { 47542 x: width, 47543 y: height / 2, 47544 offsetX: anchorSize / 2 - padding, 47545 visible: resizeEnabled && enabledAnchors.indexOf('middle-right') >= 0, 47546 }); 47547 this._batchChangeChild('.bottom-left', { 47548 x: 0, 47549 y: height, 47550 offsetX: anchorSize / 2 + padding, 47551 offsetY: anchorSize / 2 - padding, 47552 visible: resizeEnabled && enabledAnchors.indexOf('bottom-left') >= 0, 47553 }); 47554 this._batchChangeChild('.bottom-center', { 47555 x: width / 2, 47556 y: height, 47557 offsetY: anchorSize / 2 - padding, 47558 visible: resizeEnabled && enabledAnchors.indexOf('bottom-center') >= 0, 47559 }); 47560 this._batchChangeChild('.bottom-right', { 47561 x: width, 47562 y: height, 47563 offsetX: anchorSize / 2 - padding, 47564 offsetY: anchorSize / 2 - padding, 47565 visible: resizeEnabled && enabledAnchors.indexOf('bottom-right') >= 0, 47566 }); 47567 this._batchChangeChild('.rotater', { 47568 x: width / 2, 47569 y: -this.rotateAnchorOffset() * Util_1$3.Util._sign(height) - padding, 47570 visible: this.rotateEnabled(), 47571 }); 47572 this._batchChangeChild('.back', { 47573 width: width, 47574 height: height, 47575 visible: this.borderEnabled(), 47576 stroke: this.borderStroke(), 47577 strokeWidth: this.borderStrokeWidth(), 47578 dash: this.borderDash(), 47579 x: 0, 47580 y: 0, 47581 }); 47582 const styleFunc = this.anchorStyleFunc(); 47583 if (styleFunc) {
47584 anchors.forEach((node) => { 47585 styleFunc(node); 47586 }); 47587 } 47588 (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw(); 47589 } 47590 isTransforming() { 47591 return this._transforming; 47592 } 47593 stopTransform() { 47594 if (this._transforming) { 47595 this._removeEvents(); 47596 const anchorNode = this.findOne('.' + this._movingAnchorName); 47597 if (anchorNode) { 47598 anchorNode.stopDrag(); 47599 } 47600 } 47601 } 47602 destroy() { 47603 if (this.getStage() && this._cursorChange) { 47604 this.getStage().content && (this.getStage().content.style.cursor = ''); 47605 } 47606 Group_1.Group.prototype.destroy.call(this); 47607 this.detach(); 47608 this._removeEvents(); 47609 return this; 47610 } 47611 toObject() { 47612 return Node_1$f.Node.prototype.toObject.call(this); 47613 } 47614 clone(obj) { 47615 const node = Node_1$f.Node.prototype.clone.call(this, obj); 47616 return node; 47617 } 47618 getClientRect() { 47619 if (this.nodes().length > 0) { 47620 return super.getClientRect(); 47621 } 47622 else { 47623 return { x: 0, y: 0, width: 0, height: 0 }; 47624 } 47625 } 47626}; 47627Transformer$2.Transformer = Transformer$1; 47628Transformer$1.isTransforming = () => { 47629 return activeTransformersCount > 0; 47630}; 47631function validateAnchors(val) { 47632 if (!(val instanceof Array)) { 47633 Util_1$3.Util.warn('enabledAnchors value should be an array'); 47634 } 47635 if (val instanceof Array) { 47636 val.forEach(function (name) { 47637 if (ANCHORS_NAMES.indexOf(name) === -1) { 47638 Util_1$3.Util.warn('Unknown anchor name: ' + 47639 name + 47640 '. Available names are: ' + 47641 ANCHORS_NAMES.join(', ')); 47642 } 47643 }); 47644 } 47645 return val || []; 47646} 47647Transformer$1.prototype.className = 'Transformer'; 47648(0, Global_2$1._registerNode)(Transformer$1); 47649Factory_1$g.Factory.addGetterSetter(Transformer$1, 'enabledAnchors', ANCHORS_NAMES, validateAnchors); 47650Factory_1$g.Factory.addGetterSetter(Transformer$1, 'flipEnabled', true, (0, Validators_1$g.getBooleanValidator)()); 47651Factory_1$g.Factory.addGetterSetter(Transformer$1, 'resizeEnabled', true); 47652Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorSize', 10, (0, Validators_1$g.getNumberValidator)()); 47653Factory_1$g.Factory.addGetterSetter(Transformer$1, 'rotateEnabled', true); 47654Factory_1$g.Factory.addGetterSetter(Transformer$1, 'rotateLineVisible', true); 47655Factory_1$g.Factory.addGetterSetter(Transformer$1, 'rotationSnaps', []); 47656Factory_1$g.Factory.addGetterSetter(Transformer$1, 'rotateAnchorOffset', 50, (0, Validators_1$g.getNumberValidator)()); 47657Factory_1$g.Factory.addGetterSetter(Transformer$1, 'rotateAnchorCursor', 'crosshair'); 47658Factory_1$g.Factory.addGetterSetter(Transformer$1, 'rotationSnapTolerance', 5, (0, Validators_1$g.getNumberValidator)()); 47659Factory_1$g.Factory.addGetterSetter(Transformer$1, 'borderEnabled', true); 47660Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorStroke', 'rgb(0, 161, 255)'); 47661Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorStrokeWidth', 1, (0, Validators_1$g.getNumberValidator)()); 47662Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorFill', 'white'); 47663Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorCornerRadius', 0, (0, Validators_1$g.getNumberValidator)()); 47664Factory_1$g.Factory.addGetterSetter(Transformer$1, 'borderStroke', 'rgb(0, 161, 255)'); 47665Factory_1$g.Factory.addGetterSetter(Transformer$1, 'borderStrokeWidth', 1, (0, Validators_1$g.getNumberValidator)()); 47666Factory_1$g.Factory.addGetterSetter(Transformer$1, 'borderDash'); 47667Factory_1$g.Factory.addGetterSetter(Transformer$1, 'keepRatio', true); 47668Factory_1$g.Factory.addGetterSetter(Transformer$1, 'shiftBehavior', 'default'); 47669Factory_1$g.Factory.addGetterSetter(Transformer$1, 'centeredScaling', false); 47670Factory_1$g.Factory.addGetterSetter(Transformer$1, 'ignoreStroke', false); 47671Factory_1$g.Factory.addGetterSetter(Transformer$1, 'padding', 0, (0, Validators_1$g.getNumberValidator)()); 47672Factory_1$g.Factory.addGetterSetter(Transformer$1, 'nodes'); 47673Factory_1$g.Factory.addGetterSetter(Transformer$1, 'node'); 47674Factory_1$g.Factory.addGetterSetter(Transformer$1, 'boundBoxFunc'); 47675Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorDragBoundFunc'); 47676Factory_1$g.Factory.addGetterSetter(Transformer$1, 'anchorStyleFunc'); 47677Factory_1$g.Factory.addGetterSetter(Transformer$1, 'shouldOverdrawWholeArea', false); 47678Factory_1$g.Factory.addGetterSetter(Transformer$1, 'useSingleNodeRotation', true); 47679Factory_1$g.Factory.backCompat(Transformer$1, { 47680 lineEnabled: 'borderEnabled', 47681 rotateHandlerOffset: 'rotateAnchorOffset',
47682 enabledHandlers: 'enabledAnchors', 47683}); 47684 47685var Wedge$1 = {}; 47686 47687Object.defineProperty(Wedge$1, "__esModule", { value: true }); 47688Wedge$1.Wedge = void 0; 47689const Factory_1$f = Factory; 47690const Shape_1 = Shape; 47691const Global_1 = Global; 47692const Validators_1$f = Validators; 47693const Global_2 = Global; 47694class Wedge extends Shape_1.Shape { 47695 _sceneFunc(context) { 47696 context.beginPath(); 47697 context.arc(0, 0, this.radius(), 0, Global_1.Konva.getAngle(this.angle()), this.clockwise()); 47698 context.lineTo(0, 0); 47699 context.closePath(); 47700 context.fillStrokeShape(this); 47701 } 47702 getWidth() { 47703 return this.radius() * 2; 47704 } 47705 getHeight() { 47706 return this.radius() * 2; 47707 } 47708 setWidth(width) { 47709 this.radius(width / 2); 47710 } 47711 setHeight(height) { 47712 this.radius(height / 2); 47713 } 47714} 47715Wedge$1.Wedge = Wedge; 47716Wedge.prototype.className = 'Wedge'; 47717Wedge.prototype._centroid = true; 47718Wedge.prototype._attrsAffectingSize = ['radius']; 47719(0, Global_2._registerNode)(Wedge); 47720Factory_1$f.Factory.addGetterSetter(Wedge, 'radius', 0, (0, Validators_1$f.getNumberValidator)()); 47721Factory_1$f.Factory.addGetterSetter(Wedge, 'angle', 0, (0, Validators_1$f.getNumberValidator)()); 47722Factory_1$f.Factory.addGetterSetter(Wedge, 'clockwise', false); 47723Factory_1$f.Factory.backCompat(Wedge, { 47724 angleDeg: 'angle', 47725 getAngleDeg: 'getAngle', 47726 setAngleDeg: 'setAngle', 47727}); 47728 47729var Blur$1 = {}; 47730 47731Object.defineProperty(Blur$1, "__esModule", { value: true }); 47732Blur$1.Blur = void 0; 47733const Factory_1$e = Factory; 47734const Node_1$e = Node$2; 47735const Validators_1$e = Validators; 47736function BlurStack() { 47737 this.r = 0; 47738 this.g = 0; 47739 this.b = 0; 47740 this.a = 0; 47741 this.next = null; 47742} 47743const mul_table = [ 47744 512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 47745 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 47746 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 47747 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 47748 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 47749 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 47750 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 47751 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 47752 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 47753 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 47754 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 47755 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 47756 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 47757 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 47758 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 47759 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 47760 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259, 47761]; 47762const shg_table = [ 47763 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 47764 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 47765 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 47766 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 47767 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 47768 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 47769 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 47770 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 47771 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 47772 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 47773 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 47774 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 47775 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 47776 24, 24, 24, 24, 24, 24, 24, 47777]; 47778function filterGaussBlurRGBA(imageData, radius) { 47779 const pixels = imageData.data, width = imageData.width, height = imageData.height; 47780 let x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs; 47781 const div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radiu
47781s + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), mul_sum = mul_table[radius], shg_sum = shg_table[radius]; 47782 let stackEnd = null, stack = stackStart, stackIn = null, stackOut = null; 47783 for (i = 1; i < div; i++) { 47784 stack = stack.next = new BlurStack(); 47785 if (i === radiusPlus1) { 47786 stackEnd = stack; 47787 } 47788 } 47789 stack.next = stackStart; 47790 yw = yi = 0; 47791 for (y = 0; y < height; y++) { 47792 r_in_sum = 47793 g_in_sum = 47794 b_in_sum = 47795 a_in_sum = 47796 r_sum = 47797 g_sum = 47798 b_sum = 47799 a_sum = 47800 0; 47801 r_out_sum = radiusPlus1 * (pr = pixels[yi]); 47802 g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); 47803 b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); 47804 a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]); 47805 r_sum += sumFactor * pr; 47806 g_sum += sumFactor * pg; 47807 b_sum += sumFactor * pb; 47808 a_sum += sumFactor * pa; 47809 stack = stackStart; 47810 for (i = 0; i < radiusPlus1; i++) { 47811 stack.r = pr; 47812 stack.g = pg; 47813 stack.b = pb; 47814 stack.a = pa; 47815 stack = stack.next; 47816 } 47817 for (i = 1; i < radiusPlus1; i++) { 47818 p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2); 47819 r_sum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i); 47820 g_sum += (stack.g = pg = pixels[p + 1]) * rbs; 47821 b_sum += (stack.b = pb = pixels[p + 2]) * rbs; 47822 a_sum += (stack.a = pa = pixels[p + 3]) * rbs; 47823 r_in_sum += pr; 47824 g_in_sum += pg; 47825 b_in_sum += pb; 47826 a_in_sum += pa; 47827 stack = stack.next; 47828 } 47829 stackIn = stackStart; 47830 stackOut = stackEnd; 47831 for (x = 0; x < width; x++) { 47832 pixels[yi + 3] = pa = (a_sum * mul_sum) >> shg_sum; 47833 if (pa !== 0) { 47834 pa = 255 / pa; 47835 pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa; 47836 pixels[yi + 1] = ((g_sum * mul_sum) >> shg_sum) * pa; 47837 pixels[yi + 2] = ((b_sum * mul_sum) >> shg_sum) * pa; 47838 } 47839 else { 47840 pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0; 47841 } 47842 r_sum -= r_out_sum; 47843 g_sum -= g_out_sum; 47844 b_sum -= b_out_sum; 47845 a_sum -= a_out_sum; 47846 r_out_sum -= stackIn.r; 47847 g_out_sum -= stackIn.g; 47848 b_out_sum -= stackIn.b; 47849 a_out_sum -= stackIn.a; 47850 p = (yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1)) << 2; 47851 r_in_sum += stackIn.r = pixels[p]; 47852 g_in_sum += stackIn.g = pixels[p + 1]; 47853 b_in_sum += stackIn.b = pixels[p + 2]; 47854 a_in_sum += stackIn.a = pixels[p + 3]; 47855 r_sum += r_in_sum; 47856 g_sum += g_in_sum; 47857 b_sum += b_in_sum; 47858 a_sum += a_in_sum; 47859 stackIn = stackIn.next; 47860 r_out_sum += pr = stackOut.r; 47861 g_out_sum += pg = stackOut.g; 47862 b_out_sum += pb = stackOut.b; 47863 a_out_sum += pa = stackOut.a; 47864 r_in_sum -= pr; 47865 g_in_sum -= pg; 47866 b_in_sum -= pb; 47867 a_in_sum -= pa; 47868 stackOut = stackOut.next; 47869 yi += 4; 47870 } 47871 yw += width; 47872 } 47873 for (x = 0; x < width; x++) { 47874 g_in_sum = 47875 b_in_sum = 47876 a_in_sum = 47877 r_in_sum = 47878 g_sum = 47879 b_sum = 47880 a_sum = 47881 r_sum = 47882 0; 47883 yi = x << 2; 47884 r_out_sum = radiusPlus1 * (pr = pixels[yi]); 47885 g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); 47886 b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); 47887 a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]); 47888 r_sum += sumFactor * pr; 47889 g_sum += sumFactor * pg; 47890 b_sum += sumFactor * pb; 47891 a_sum += sumFactor * pa; 47892 stack = stackStart; 47893 for (i = 0; i < radiusPlus1; i++) { 47894 stack.r = pr; 47895 stack.g = pg; 47896 stack.b = pb; 47897 stack.a = pa; 47898 stack = stack.next; 47899 } 47900 yp = width; 47901 for (i = 1; i <= radius; i++) { 47902 yi = (yp + x) << 2;
47903 r_sum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i); 47904 g_sum += (stack.g = pg = pixels[yi + 1]) * rbs; 47905 b_sum += (stack.b = pb = pixels[yi + 2]) * rbs; 47906 a_sum += (stack.a = pa = pixels[yi + 3]) * rbs; 47907 r_in_sum += pr; 47908 g_in_sum += pg; 47909 b_in_sum += pb; 47910 a_in_sum += pa; 47911 stack = stack.next; 47912 if (i < heightMinus1) { 47913 yp += width; 47914 } 47915 } 47916 yi = x; 47917 stackIn = stackStart; 47918 stackOut = stackEnd; 47919 for (y = 0; y < height; y++) { 47920 p = yi << 2; 47921 pixels[p + 3] = pa = (a_sum * mul_sum) >> shg_sum; 47922 if (pa > 0) { 47923 pa = 255 / pa; 47924 pixels[p] = ((r_sum * mul_sum) >> shg_sum) * pa; 47925 pixels[p + 1] = ((g_sum * mul_sum) >> shg_sum) * pa; 47926 pixels[p + 2] = ((b_sum * mul_sum) >> shg_sum) * pa; 47927 } 47928 else { 47929 pixels[p] = pixels[p + 1] = pixels[p + 2] = 0; 47930 } 47931 r_sum -= r_out_sum; 47932 g_sum -= g_out_sum; 47933 b_sum -= b_out_sum; 47934 a_sum -= a_out_sum; 47935 r_out_sum -= stackIn.r; 47936 g_out_sum -= stackIn.g; 47937 b_out_sum -= stackIn.b; 47938 a_out_sum -= stackIn.a; 47939 p = 47940 (x + 47941 ((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width) << 47942 2; 47943 r_sum += r_in_sum += stackIn.r = pixels[p]; 47944 g_sum += g_in_sum += stackIn.g = pixels[p + 1]; 47945 b_sum += b_in_sum += stackIn.b = pixels[p + 2]; 47946 a_sum += a_in_sum += stackIn.a = pixels[p + 3]; 47947 stackIn = stackIn.next; 47948 r_out_sum += pr = stackOut.r; 47949 g_out_sum += pg = stackOut.g; 47950 b_out_sum += pb = stackOut.b; 47951 a_out_sum += pa = stackOut.a; 47952 r_in_sum -= pr; 47953 g_in_sum -= pg; 47954 b_in_sum -= pb; 47955 a_in_sum -= pa; 47956 stackOut = stackOut.next; 47957 yi += width; 47958 } 47959 } 47960} 47961const Blur = function Blur(imageData) { 47962 const radius = Math.round(this.blurRadius()); 47963 if (radius > 0) { 47964 filterGaussBlurRGBA(imageData, radius); 47965 } 47966}; 47967Blur$1.Blur = Blur; 47968Factory_1$e.Factory.addGetterSetter(Node_1$e.Node, 'blurRadius', 0, (0, Validators_1$e.getNumberValidator)(), Factory_1$e.Factory.afterSetFilter); 47969 47970var Brighten$1 = {}; 47971 47972Object.defineProperty(Brighten$1, "__esModule", { value: true }); 47973Brighten$1.Brighten = void 0; 47974const Factory_1$d = Factory; 47975const Node_1$d = Node$2; 47976const Validators_1$d = Validators; 47977const Brighten = function (imageData) { 47978 const brightness = this.brightness() * 255, data = imageData.data, len = data.length; 47979 for (let i = 0; i < len; i += 4) { 47980 data[i] += brightness; 47981 data[i + 1] += brightness; 47982 data[i + 2] += brightness; 47983 } 47984}; 47985Brighten$1.Brighten = Brighten; 47986Factory_1$d.Factory.addGetterSetter(Node_1$d.Node, 'brightness', 0, (0, Validators_1$d.getNumberValidator)(), Factory_1$d.Factory.afterSetFilter); 47987 47988var Contrast$1 = {}; 47989 47990Object.defineProperty(Contrast$1, "__esModule", { value: true }); 47991Contrast$1.Contrast = void 0; 47992const Factory_1$c = Factory; 47993const Node_1$c = Node$2; 47994const Validators_1$c = Validators; 47995const Contrast = function (imageData) { 47996 const adjust = Math.pow((this.contrast() + 100) / 100, 2); 47997 const data = imageData.data, nPixels = data.length; 47998 let red = 150, green = 150, blue = 150; 47999 for (let i = 0; i < nPixels; i += 4) { 48000 red = data[i]; 48001 green = data[i + 1]; 48002 blue = data[i + 2]; 48003 red /= 255; 48004 red -= 0.5; 48005 red *= adjust; 48006 red += 0.5; 48007 red *= 255; 48008 green /= 255; 48009 green -= 0.5; 48010 green *= adjust; 48011 green += 0.5; 48012 green *= 255; 48013 blue /= 255; 48014 blue -= 0.5; 48015 blue *= adjust; 48016 blue += 0.5; 48017 blue *= 255; 48018 red = red < 0 ? 0 : red > 255 ? 255 : red; 48019 green = green < 0 ? 0 : green > 255 ? 255 : green; 48020 blue = blue < 0 ? 0 : blue > 255 ? 255 : blue; 48021 data[i] = red; 48022 data[i + 1] = green; 48023 data[i + 2] = blue; 48024 } 48025}; 48026Contrast$1.Contrast = Contrast; 48027Factory_1$c.Factory.addGetterSetter(Node_1$c.Node, 'contrast', 0, (0, Validators_1$c.getNumberValidator)(), Factory_1$c.Factory.afterSetFilter); 48028 48029var Emboss$1 = {}; 48030 48031Object.defineProperty(Emboss$1, "__esModule", { value: true }); 48032Emboss$1.Emboss = void 0; 48033const Factory_1$b = Factory; 48034const Node_1$b = Node$2; 48035const Util_1$2 = Util; 48036const Validators_1$b = Validators; 48037const Emboss = function (imageData) { 48038 const strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4; 48039 let dirY = 0, dirX = 0, y = h; 48040 switch (direction) { 48041 case 'top-left': 48042 dirY = -1; 48043 dirX = -1; 48044 break; 48045 case 'top': 48046 dirY = -1; 48047 dirX = 0; 48048 break; 48049 case 'top-right': 48050 dirY = -1; 48051 dirX = 1; 48052 break; 48053 case 'right': 48054 dirY = 0; 48055 dirX = 1; 48056 break; 48057 case 'bottom-right': 48058 dirY = 1; 48059 dirX = 1; 48060 break; 48061 case 'bottom': 48062 dirY = 1; 48063 dirX = 0; 48064 break; 48065 case 'bottom-left': 48066 dirY = 1; 48067 dirX = -1; 48068 break; 48069 case 'left': 48070 dirY = 0; 48071 dirX = -1; 48072 break; 48073 default: 48074 Util_1$2.Util.error('Unknown emboss direction: ' + direction); 48075 } 48076 do { 48077 const offsetY = (y - 1) * w4; 48078 let otherY = dirY; 48079 if (y + otherY < 1) { 48080 otherY = 0; 48081 } 48082 if (y + otherY > h) { 48083 otherY = 0; 48084 } 48085 const offsetYOther = (y - 1 + otherY) * w * 4; 48086 let x = w; 48087 do { 48088 const offset = offsetY + (x - 1) * 4; 48089 let otherX = dirX; 48090 if (x + otherX < 1) { 48091 otherX = 0; 48092 } 48093 if (x + otherX > w) { 48094 otherX = 0; 48095 } 48096 const offsetOther = offsetYOther + (x - 1 + otherX) * 4; 48097 const dR = data[offset] - data[offsetOther]; 48098 const dG = data[offset + 1] - data[offsetOther + 1]; 48099 const dB = data[offset + 2] - data[offsetOther + 2]; 48100 let dif = dR; 48101 const absDif = dif > 0 ? dif : -dif; 48102 const absG = dG > 0 ? dG : -dG; 48103 const absB = dB >
48103 0 ? dB : -dB; 48104 if (absG > absDif) { 48105 dif = dG; 48106 } 48107 if (absB > absDif) { 48108 dif = dB; 48109 } 48110 dif *= strength; 48111 if (blend) { 48112 const r = data[offset] + dif; 48113 const g = data[offset + 1] + dif; 48114 const b = data[offset + 2] + dif; 48115 data[offset] = r > 255 ? 255 : r < 0 ? 0 : r; 48116 data[offset + 1] = g > 255 ? 255 : g < 0 ? 0 : g; 48117 data[offset + 2] = b > 255 ? 255 : b < 0 ? 0 : b; 48118 } 48119 else { 48120 let grey = greyLevel - dif; 48121 if (grey < 0) { 48122 grey = 0; 48123 } 48124 else if (grey > 255) { 48125 grey = 255; 48126 } 48127 data[offset] = data[offset + 1] = data[offset + 2] = grey; 48128 } 48129 } while (--x); 48130 } while (--y); 48131}; 48132Emboss$1.Emboss = Emboss; 48133Factory_1$b.Factory.addGetterSetter(Node_1$b.Node, 'embossStrength', 0.5, (0, Validators_1$b.getNumberValidator)(), Factory_1$b.Factory.afterSetFilter); 48134Factory_1$b.Factory.addGetterSetter(Node_1$b.Node, 'embossWhiteLevel', 0.5, (0, Validators_1$b.getNumberValidator)(), Factory_1$b.Factory.afterSetFilter); 48135Factory_1$b.Factory.addGetterSetter(Node_1$b.Node, 'embossDirection', 'top-left', undefined, Factory_1$b.Factory.afterSetFilter); 48136Factory_1$b.Factory.addGetterSetter(Node_1$b.Node, 'embossBlend', false, undefined, Factory_1$b.Factory.afterSetFilter); 48137 48138var Enhance$1 = {}; 48139 48140Object.defineProperty(Enhance$1, "__esModule", { value: true }); 48141Enhance$1.Enhance = void 0; 48142const Factory_1$a = Factory; 48143const Node_1$a = Node$2; 48144const Validators_1$a = Validators; 48145function remap(fromValue, fromMin, fromMax, toMin, toMax) { 48146 const fromRange = fromMax - fromMin, toRange = toMax - toMin; 48147 if (fromRange === 0) { 48148 return toMin + toRange / 2; 48149 } 48150 if (toRange === 0) { 48151 return toMin; 48152 } 48153 let toValue = (fromValue - fromMin) / fromRange; 48154 toValue = toRange * toValue + toMin; 48155 return toValue; 48156} 48157const Enhance = function (imageData) { 48158 const data = imageData.data, nSubPixels = data.length; 48159 let rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b; 48160 const enhanceAmount = this.enhance(); 48161 if (enhanceAmount === 0) { 48162 return; 48163 } 48164 for (let i = 0; i < nSubPixels; i += 4) { 48165 r = data[i + 0]; 48166 if (r < rMin) { 48167 rMin = r; 48168 } 48169 else if (r > rMax) { 48170 rMax = r; 48171 } 48172 g = data[i + 1]; 48173 if (g < gMin) { 48174 gMin = g; 48175 } 48176 else if (g > gMax) { 48177 gMax = g; 48178 } 48179 b = data[i + 2]; 48180 if (b < bMin) { 48181 bMin = b; 48182 } 48183 else if (b > bMax) { 48184 bMax = b; 48185 } 48186 } 48187 if (rMax === rMin) { 48188 rMax = 255; 48189 rMin = 0; 48190 } 48191 if (gMax === gMin) { 48192 gMax = 255; 48193 gMin = 0; 48194 } 48195 if (bMax === bMin) { 48196 bMax = 255; 48197 bMin = 0; 48198 } 48199 let rMid, rGoalMax, rGoalMin, gMid, gGoalMax, gGoalMin, bMid, bGoalMax, bGoalMin; 48200 if (enhanceAmount > 0) { 48201 rGoalMax = rMax + enhanceAmount * (255 - rMax); 48202 rGoalMin = rMin - enhanceAmount * (rMin - 0); 48203 gGoalMax = gMax + enhanceAmount * (255 - gMax); 48204 gGoalMin = gMin - enhanceAmount * (gMin - 0); 48205 bGoalMax = bMax + enhanceAmount * (255 - bMax); 48206 bGoalMin = bMin - enhanceAmount * (bMin - 0); 48207 } 48208 else { 48209 rMid = (rMax + rMin) * 0.5; 48210 rGoalMax = rMax + enhanceAmount * (rMax - rMid); 48211 rGoalMin = rMin + enhanceAmount * (rMin - rMid); 48212 gMid = (gMax + gMin) * 0.5; 48213 gGoalMax = gMax + enhanceAmount * (gMax - gMid); 48214 gGoalMin = gMin + enhanceAmount * (gMin - gMid); 48215 bMid = (bMax + bMin) * 0.5; 48216 bGoalMax = bMax + enhanceAmount * (bMax - bMid); 48217 bGoalMin = bMin + enhanceAmount * (bMin - bMid); 48218 } 48219 for (let i = 0; i < nSubPixels; i += 4) { 48220 data[i + 0] = remap(data[i + 0], rMin, rMax, rGoalMin, rGoalMax); 48221 data[i + 1] = remap(data[i + 1], gMin, gMax, gGoalMin, gGoalMax); 48222 data[i + 2] = remap(data[i + 2], bMin, bMax, bGoalMin, bGoalMax); 48223 } 48224}; 48225Enhance$1.Enhance = Enhance; 48226Factory_1$a.Factory.addGetterSetter(Node_1$a.Node, 'enhance', 0, (0, Validators_1$a.getNumberValidator)(), Factory_1$a.Factory.afterSetFilter); 48227 48228var Grayscale$1 = {}; 48229 48230Object.defineProperty(Grayscale$1, "__esModule", { value: true }); 48231Grayscale$1.Grayscale = void 0; 48232const Grayscale = function (imageData) { 48233 const data = imageData.data, len = data.length; 48234 for (let i = 0; i < len; i += 4) { 48235 const brightness = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2]; 48236 data[i] = brightness; 48237 data[i + 1] = brightness; 48238 data[i + 2] = brightness; 48239 } 48240}; 48241Grayscale$1.Grayscale = Grayscale; 48242 48243var HSL$1 = {}; 48244 48245Object.defineProperty(HSL$1, "__esModule", { value: true }); 48246HSL$1.HSL = void 0; 48247const Factory_1$9 = Factory; 48248const Node_1$9 = Node$2; 48249const Validators_1$9 = Validators; 48250Factory_1$9.Factory.addGetterSetter(Node_1$9.Node, 'hue', 0, (0, Validators_1$9.getNumberValidator)(), Factory_1$9.Factory.afterSetFilter); 48251Factory_1$9.Factory.addGetterSetter(Node_1$9.Node, 'saturation', 0, (0, Validators_1$9.getNumberValidator)(), Factory_1$9.Factory.afterSetFilter); 48252Factory_1$9.Factory.addGetterSetter(Node_1$9.Node, 'luminance', 0, (0, Validators_1$9.getNumberValidator)(), Factory_1$9.Factory.afterSetFilter); 48253const HSL = function (imageData) { 48254 const data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127; 48255 const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180); 48256 const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw; 48257 const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw; 48258 const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw; 48259 let r, g, b, a; 48260 for (let i = 0; i < nPixels; i += 4) { 48261 r = data[i + 0]; 48262 g = data[i + 1]; 48263 b = data[i + 2]; 48264 a = data[i + 3]; 48265 data[i + 0] = rr * r + rg * g + rb * b + l; 48266 data[i + 1] = gr * r + gg * g + gb * b + l; 48267 data[i + 2] = br * r + bg * g + bb * b + l; 48268 data[i + 3] = a; 48269 } 48270}; 48271HSL$1.HSL = HSL; 48272 48273var HSV$1 = {}; 48274 48275Object.defineProperty(HSV$1, "__esModule", { value: true }); 48276HSV$1.HSV = void 0; 48277const Factory_1$8 = Factory; 48278const Node_1$8 = Node$2; 48279const Validators_1$8 = Validators; 48280const HSV = function (imageData) { 48281 const data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360; 48282 const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180); 48283 const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw; 48284 const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw; 48285 const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw; 48286 let r, g, b, a; 48287 for (let i = 0; i < nPixels; i += 4) { 48288 r = data[i + 0]; 48289 g = data[i + 1]; 48290 b = data[i + 2]; 48291 a = data[i + 3]; 48292 data[i + 0] = rr * r + rg * g + rb * b; 48293 data[i + 1] = gr * r + gg * g + gb * b; 48294 data[i + 2] = br * r + bg * g + bb * b; 48295 data[i + 3] = a; 48296 } 48297}; 48298HSV$1.HSV = HSV; 48299Factory_1$8.Factory.addGetterSetter(Node_1$8.Node, 'hue', 0, (0, Validators_1$8.getNumberValidator)(), Factory_1$8.Factory.afterSetFilter); 48300Factory_1$8.Factory.addGetterSetter(Node_1$8.Node, 'saturation', 0, (0, Validators_1$8.getNumberValidator)(), Factory_1$8.Factory.afterSetFilter); 48301Factory_1$8.Factory.addGetterSetter(Node_1$8.Node, 'value', 0, (0, Validators_1$8.getNumberValidator)(), Factory_1$8.Factory.afterSetFilter); 48302 48303var Invert$1 = {}; 48304 48305Object.defineProperty(Invert$1, "__esModule", { value: true }); 48306Invert$1.Invert = void 0; 48307const Invert = function (imageData) { 48308 const data = imageData.data, len = data.length; 48309 for (let i = 0; i < len; i += 4) { 48310 data[i] = 255 - data[i]; 48311 data[i + 1] = 255 - data[i + 1]; 48312 data[i + 2] = 255 - data[i + 2]; 48313 } 48314}; 48315Invert$1.Invert = Invert; 48316 48317var Kaleidoscope$1 = {}; 48318 48319Object.defineProperty(Kaleidoscope$1, "__esModule", { value: true }); 48320Kaleidoscope$1.Kaleidoscope = void 0; 48321const Factory_1$7 = Factory;
vendor: 10,966 bytes, lines 48322-48608
48322const Node_1$7 = Node$2; 48323const Util_1$1 = Util; 48324const Validators_1$7 = Validators; 48325const ToPolar = function (src, dst, opt) { 48326 const srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2; 48327 let rMax = Math.sqrt(xMid * xMid + yMid * yMid); 48328 let x = xSize - xMid; 48329 let y = ySize - yMid; 48330 const rad = Math.sqrt(x * x + y * y); 48331 rMax = rad > rMax ? rad : rMax; 48332 const rSize = ySize, tSize = xSize; 48333 const conversion = ((360 / tSize) * Math.PI) / 180; 48334 for (let theta = 0; theta < tSize; theta += 1) { 48335 const sin = Math.sin(theta * conversion); 48336 const cos = Math.cos(theta * conversion); 48337 for (let radius = 0; radius < rSize; radius += 1) { 48338 x = Math.floor(xMid + ((rMax * radius) / rSize) * cos); 48339 y = Math.floor(yMid + ((rMax * radius) / rSize) * sin); 48340 let i = (y * xSize + x) * 4; 48341 const r = srcPixels[i + 0]; 48342 const g = srcPixels[i + 1]; 48343 const b = srcPixels[i + 2]; 48344 const a = srcPixels[i + 3]; 48345 i = (theta + radius * xSize) * 4; 48346 dstPixels[i + 0] = r; 48347 dstPixels[i + 1] = g; 48348 dstPixels[i + 2] = b; 48349 dstPixels[i + 3] = a; 48350 } 48351 } 48352}; 48353const FromPolar = function (src, dst, opt) { 48354 const srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2; 48355 let rMax = Math.sqrt(xMid * xMid + yMid * yMid); 48356 let x = xSize - xMid; 48357 let y = ySize - yMid; 48358 const rad = Math.sqrt(x * x + y * y); 48359 rMax = rad > rMax ? rad : rMax; 48360 const rSize = ySize, tSize = xSize, phaseShift = 0; 48361 let x1, y1; 48362 for (x = 0; x < xSize; x += 1) { 48363 for (y = 0; y < ySize; y += 1) { 48364 const dx = x - xMid; 48365 const dy = y - yMid; 48366 const radius = (Math.sqrt(dx * dx + dy * dy) * rSize) / rMax; 48367 let theta = ((Math.atan2(dy, dx) * 180) / Math.PI + 360 + phaseShift) % 360; 48368 theta = (theta * tSize) / 360; 48369 x1 = Math.floor(theta); 48370 y1 = Math.floor(radius); 48371 let i = (y1 * xSize + x1) * 4; 48372 const r = srcPixels[i + 0]; 48373 const g = srcPixels[i + 1]; 48374 const b = srcPixels[i + 2]; 48375 const a = srcPixels[i + 3]; 48376 i = (y * xSize + x) * 4; 48377 dstPixels[i + 0] = r; 48378 dstPixels[i + 1] = g; 48379 dstPixels[i + 2] = b; 48380 dstPixels[i + 3] = a; 48381 } 48382 } 48383}; 48384const Kaleidoscope = function (imageData) { 48385 const xSize = imageData.width, ySize = imageData.height; 48386 let x, y, xoff, i, r, g, b, a, srcPos, dstPos; 48387 let power = Math.round(this.kaleidoscopePower()); 48388 const angle = Math.round(this.kaleidoscopeAngle()); 48389 const offset = Math.floor((xSize * (angle % 360)) / 360); 48390 if (power < 1) { 48391 return; 48392 } 48393 const tempCanvas = Util_1$1.Util.createCanvasElement(); 48394 tempCanvas.width = xSize; 48395 tempCanvas.height = ySize; 48396 const scratchData = tempCanvas 48397 .getContext('2d') 48398 .getImageData(0, 0, xSize, ySize); 48399 Util_1$1.Util.releaseCanvas(tempCanvas); 48400 ToPolar(imageData, scratchData, { 48401 polarCenterX: xSize / 2, 48402 polarCenterY: ySize / 2, 48403 }); 48404 let minSectionSize = xSize / Math.pow(2, power); 48405 while (minSectionSize <= 8) { 48406 minSectionSize = minSectionSize * 2; 48407 power -= 1; 48408 } 48409 minSectionSize = Math.ceil(minSectionSize); 48410 let sectionSize = minSectionSize; 48411 let xStart = 0, xEnd = sectionSize, xDelta = 1; 48412 if (offset + minSectionSize > xSize) { 48413 xStart = sectionSize; 48414 xEnd = 0; 48415 xDelta = -1; 48416 } 48417 for (y = 0; y < ySize; y += 1) { 48418 for (x = xStart; x !== xEnd; x += xDelta) { 48419 xoff = Math.round(x + offset) % xSize; 48420 srcPos = (xSize * y + xoff) * 4; 48421 r = scratchData.data[srcPos + 0]; 48422 g = scratchData.data[srcPos + 1]; 48423 b = scratchData.data[srcPos + 2]; 48424 a = scratchData.data[srcPos + 3]; 48425 dstPos = (xSize * y + x) * 4; 48426 scratchData.data[dstPos + 0] = r; 48427 scratchData.data[dstPos + 1] = g; 48428 scratchData.data[dstPos + 2] = b; 48429 scratchData.data[dstPos + 3] = a; 48430 } 48431 } 48432 for (y = 0; y < ySize; y += 1) { 48433 sectionSize = Math.floor(minSectionSize); 48434 for (i = 0; i < power; i += 1) { 48435 for (x = 0; x < sectionSize + 1; x += 1) { 48436 srcPos = (xSize * y + x) * 4; 48437 r = scratchData.data[srcPos + 0]; 48438 g = scratchData.data[srcPos + 1]; 48439 b = scratchData.data[srcPos + 2]; 48440 a = scratchData.data[srcPos + 3]; 48441 dstPos = (xSize * y + sectionSize * 2 - x - 1) * 4; 48442 scratchData.data[dstPos + 0] = r; 48443 scratchData.data[dstPos + 1] = g; 48444 scratchData.data[dstPos + 2] = b; 48445 scratchData.data[dstPos + 3] = a; 48446 } 48447 sectionSize *= 2; 48448 } 48449 } 48450 FromPolar(scratchData, imageData, { }); 48451}; 48452Kaleidoscope$1.Kaleidoscope = Kaleidoscope; 48453Factory_1$7.Factory.addGetterSetter(Node_1$7.Node, 'kaleidoscopePower', 2, (0, Validators_1$7.getNumberValidator)(), Factory_1$7.Factory.afterSetFilter); 48454Factory_1$7.Factory.addGetterSetter(Node_1$7.Node, 'kaleidoscopeAngle', 0, (0, Validators_1$7.getNumberValidator)(), Factory_1$7.Factory.afterSetFilter); 48455 48456var Mask$1 = {}; 48457 48458Object.defineProperty(Mask$1, "__esModule", { value: true }); 48459Mask$1.Mask = void 0; 48460const Factory_1$6 = Factory; 48461const Node_1$6 = Node$2; 48462const Validators_1$6 = Validators; 48463function pixelAt(idata, x, y) { 48464 let idx = (y * idata.width + x) * 4; 48465 const d = []; 48466 d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]); 48467 return d; 48468} 48469function rgbDistance(p1, p2) { 48470 return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + 48471 Math.pow(p1[1] - p2[1], 2) + 48472 Math.pow(p1[2] - p2[2], 2)); 48473} 48474function rgbMean(pTab) { 48475 const m = [0, 0, 0]; 48476 for (let i = 0; i < pTab.length; i++) { 48477 m[0] += pTab[i][0]; 48478 m[1] += pTab[i][1]; 48479 m[2] += pTab[i][2]; 48480 } 48481 m[0] /= pTab.length; 48482 m[1] /= pTab.length; 48483 m[2] /= pTab.length; 48484 return m; 48485} 48486function backgroundMask(idata, threshold) { 48487 const rgbv_no = pixelAt(idata, 0, 0); 48488 const rgbv_ne = pixelAt(idata, idata.width - 1, 0); 48489 const rgbv_so = pixelAt(idata, 0, idata.height - 1); 48490 const rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1); 48491 const thres = threshold || 10; 48492 if (rgbDistance(rgbv_no, rgbv_ne) < thres && 48493 rgbDistance(rgbv_ne, rgbv_se) < thres && 48494 rgbDistance(rgbv_se, rgbv_so) < thres && 48495 rgbDistance(rgbv_so, rgbv_no) < thres) { 48496 const mean = rgbMean([rgbv_ne, rgbv_no, rgbv_se, rgbv_so]); 48497 const mask = []; 48498 for (let i = 0; i < idata.width * idata.height; i++) { 48499 const d = rgbDistance(mean, [ 48500 idata.data[i * 4], 48501 idata.data[i * 4 + 1], 48502 idata.data[i * 4 + 2], 48503 ]); 48504 mask[i] = d < thres ? 0 : 255; 48505 } 48506 return mask; 48507 } 48508} 48509function applyMask(idata, mask) { 48510 for (let i = 0; i < idata.width * idata.height; i++) { 48511 idata.data[4 * i + 3] = mask[i]; 48512 } 48513} 48514function erodeMask(mask, sw, sh) { 48515 const weights = [1, 1, 1, 1, 0, 1, 1, 1, 1]; 48516 const side = Math.round(Math.sqrt(weights.length)); 48517 const halfSide = Math.floor(side / 2); 48518 const maskResult = []; 48519 for (let y = 0; y < sh; y++) { 48520 for (let x = 0; x < sw; x++) { 48521 const so = y * sw + x; 48522 let a = 0; 48523 for (let cy = 0; cy < side; cy++) { 48524 for (let cx = 0; cx < side; cx++) { 48525 const scy = y + cy - halfSide; 48526 const scx = x + cx - halfSide; 48527 if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) { 48528 const srcOff = scy * sw + scx; 48529 const wt = weights[cy * side + cx]; 48530 a += mask[srcOff] * wt; 48531 } 48532 } 48533 } 48534 maskResult[so] = a === 255 * 8 ? 255 : 0; 48535 } 48536 } 48537 return maskResult; 48538} 48539function dilateMask(mask, sw, sh) { 48540 const weights = [1, 1, 1, 1, 1, 1, 1, 1, 1]; 48541 const side = Math.round(Math.sqrt(weights.length)); 48542 const halfSide = Math.floor(side / 2); 48543 const maskResult = []; 48544 for (let y = 0; y < sh; y++) { 48545 for (let x = 0; x < sw; x++) { 48546 const so = y * sw + x; 48547 let a = 0; 48548 for (let cy = 0; cy < side; cy++) { 48549 for (let cx = 0; cx < side; cx++) { 48550 const scy = y + cy - halfSide; 48551 const scx = x + cx - halfSide; 48552 if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) { 48553 const srcOff = scy * sw + scx; 48554 const wt = weights[cy * side + cx]; 48555 a += mask[srcOff] * wt; 48556 } 48557 } 48558 } 48559 maskResult[so] = a >= 255 * 4 ? 255 : 0; 48560 } 48561 } 48562 return maskResult; 48563} 48564function smoothEdgeMask(mask, sw, sh) { 48565 const weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9]; 48566 const side = Math.round(Math.sqrt(weights.length)); 48567 const halfSide = Math.floor(side / 2); 48568 const maskResult = []; 48569 for (let y = 0; y < sh; y++) { 48570 for (let x = 0; x < sw; x++) { 48571 const so = y * sw + x; 48572 let a = 0; 48573 for (let cy = 0; cy < side; cy++) { 48574 for (let cx = 0; cx < side; cx++) { 48575 const scy = y + cy - halfSide; 48576 const scx = x + cx - halfSide; 48577 if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) { 48578 const srcOff = scy * sw + scx; 48579 const wt = weights[cy * side + cx]; 48580 a += mask[srcOff] * wt; 48581 } 48582 } 48583 } 48584 maskResult[so] = a; 48585 } 48586 } 48587 return maskResult; 48588} 48589const Mask = function (imageData) { 48590 const threshold = this.threshold(); 48591 let mask = backgroundMask(imageData, threshold); 48592 if (mask) { 48593 mask = erodeMask(mask, imageData.width, imageData.height); 48594 mask = dilateMask(mask, imageData.width, imageData.height); 48595 mask = smoothEdgeMask(mask, imageData.width, imageData.height); 48596 applyMask(imageData, mask); 48597 } 48598 return imageData; 48599}; 48600Mask$1.Mask = Mask; 48601Factory_1$6.Factory.addGetterSetter(Node_1$6.Node, 'threshold', 0, (0, Validators_1$6.getNumberValidator)(), Factory_1$6.Factory.afterSetFilter); 48602 48603var Noise$1 = {}; 48604 48605Object.defineProperty(Noise$1, "__esModule", { value: true }); 48606Noise$1.Noise = void 0; 48607const Factory_1$5 = Factory; 48608const Node_1$5 = Node$2;
48609const Validators_1$5 = Validators; 48610const Noise = function (imageData) { 48611 const amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2; 48612 for (let i = 0; i < nPixels; i += 4) { 48613 data[i + 0] += half - 2 * half * Math.random(); 48614 data[i + 1] += half - 2 * half * Math.random(); 48615 data[i + 2] += half - 2 * half * Math.random(); 48616 } 48617}; 48618Noise$1.Noise = Noise; 48619Factory_1$5.Factory.addGetterSetter(Node_1$5.Node, 'noise', 0.2, (0, Validators_1$5.getNumberValidator)(), Factory_1$5.Factory.afterSetFilter); 48620 48621var Pixelate$1 = {}; 48622 48623Object.defineProperty(Pixelate$1, "__esModule", { value: true }); 48624Pixelate$1.Pixelate = void 0; 48625const Factory_1$4 = Factory; 48626const Util_1 = Util; 48627const Node_1$4 = Node$2; 48628const Validators_1$4 = Validators; 48629const Pixelate = function (imageData) { 48630 let pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i, red, green, blue, alpha, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), xBinStart, xBinEnd, yBinStart, yBinEnd, xBin, yBin, pixelsInBin, data = imageData.data; 48631 if (pixelSize <= 0) { 48632 Util_1.Util.error('pixelSize value can not be <= 0'); 48633 return; 48634 } 48635 for (xBin = 0; xBin < nBinsX; xBin += 1) { 48636 for (yBin = 0; yBin < nBinsY; yBin += 1) { 48637 red = 0; 48638 green = 0; 48639 blue = 0; 48640 alpha = 0; 48641 xBinStart = xBin * pixelSize; 48642 xBinEnd = xBinStart + pixelSize; 48643 yBinStart = yBin * pixelSize; 48644 yBinEnd = yBinStart + pixelSize; 48645 pixelsInBin = 0; 48646 for (x = xBinStart; x < xBinEnd; x += 1) { 48647 if (x >= width) { 48648 continue; 48649 } 48650 for (y = yBinStart; y < yBinEnd; y += 1) { 48651 if (y >= height) { 48652 continue; 48653 } 48654 i = (width * y + x) * 4; 48655 red += data[i + 0]; 48656 green += data[i + 1]; 48657 blue += data[i + 2]; 48658 alpha += data[i + 3]; 48659 pixelsInBin += 1; 48660 } 48661 } 48662 red = red / pixelsInBin; 48663 green = green / pixelsInBin; 48664 blue = blue / pixelsInBin; 48665 alpha = alpha / pixelsInBin; 48666 for (x = xBinStart; x < xBinEnd; x += 1) { 48667 if (x >= width) { 48668 continue; 48669 } 48670 for (y = yBinStart; y < yBinEnd; y += 1) { 48671 if (y >= height) { 48672 continue; 48673 } 48674 i = (width * y + x) * 4; 48675 data[i + 0] = red; 48676 data[i + 1] = green; 48677 data[i + 2] = blue; 48678 data[i + 3] = alpha; 48679 } 48680 } 48681 } 48682 } 48683}; 48684Pixelate$1.Pixelate = Pixelate; 48685Factory_1$4.Factory.addGetterSetter(Node_1$4.Node, 'pixelSize', 8, (0, Validators_1$4.getNumberValidator)(), Factory_1$4.Factory.afterSetFilter); 48686 48687var Posterize$1 = {}; 48688 48689Object.defineProperty(Posterize$1, "__esModule", { value: true }); 48690Posterize$1.Posterize = void 0; 48691const Factory_1$3 = Factory; 48692const Node_1$3 = Node$2; 48693const Validators_1$3 = Validators; 48694const Posterize = function (imageData) { 48695 const levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels; 48696 for (let i = 0; i < len; i += 1) { 48697 data[i] = Math.floor(data[i] / scale) * scale; 48698 } 48699}; 48700Posterize$1.Posterize = Posterize; 48701Factory_1$3.Factory.addGetterSetter(Node_1$3.Node, 'levels', 0.5, (0, Validators_1$3.getNumberValidator)(), Factory_1$3.Factory.afterSetFilter); 48702 48703var RGB$1 = {}; 48704 48705Object.defineProperty(RGB$1, "__esModule", { value: true }); 48706RGB$1.RGB = void 0; 48707const Factory_1$2 = Factory; 48708const Node_1$2 = Node$2; 48709const Validators_1$2 = Validators; 48710const RGB = function (imageData) { 48711 const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(); 48712 for (let i = 0; i < nPixels; i += 4) { 48713 const brightness = (0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2]) / 255; 48714 data[i] = brightness * red; 48715 data[i + 1] = brightness * green; 48716 data[i + 2] = brightness * blue; 48717 data[i + 3] = data[i + 3]; 48718 } 48719}; 48720RGB$1.RGB = RGB; 48721Factory_1$2.Factory.addGetterSetter(Node_1$2.Node, 'red', 0, function (val) { 48722 this._filterUpToDate = false;
48723 if (val > 255) { 48724 return 255; 48725 } 48726 else if (val < 0) { 48727 return 0; 48728 } 48729 else { 48730 return Math.round(val); 48731 } 48732}); 48733Factory_1$2.Factory.addGetterSetter(Node_1$2.Node, 'green', 0, function (val) { 48734 this._filterUpToDate = false; 48735 if (val > 255) { 48736 return 255; 48737 } 48738 else if (val < 0) { 48739 return 0; 48740 } 48741 else { 48742 return Math.round(val); 48743 } 48744}); 48745Factory_1$2.Factory.addGetterSetter(Node_1$2.Node, 'blue', 0, Validators_1$2.RGBComponent, Factory_1$2.Factory.afterSetFilter); 48746 48747var RGBA$1 = {}; 48748 48749Object.defineProperty(RGBA$1, "__esModule", { value: true }); 48750RGBA$1.RGBA = void 0; 48751const Factory_1$1 = Factory; 48752const Node_1$1 = Node$2; 48753const Validators_1$1 = Validators; 48754const RGBA = function (imageData) { 48755 const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha(); 48756 for (let i = 0; i < nPixels; i += 4) { 48757 const ia = 1 - alpha; 48758 data[i] = red * alpha + data[i] * ia; 48759 data[i + 1] = green * alpha + data[i + 1] * ia; 48760 data[i + 2] = blue * alpha + data[i + 2] * ia; 48761 } 48762}; 48763RGBA$1.RGBA = RGBA; 48764Factory_1$1.Factory.addGetterSetter(Node_1$1.Node, 'red', 0, function (val) { 48765 this._filterUpToDate = false; 48766 if (val > 255) { 48767 return 255; 48768 } 48769 else if (val < 0) { 48770 return 0; 48771 } 48772 else { 48773 return Math.round(val); 48774 } 48775}); 48776Factory_1$1.Factory.addGetterSetter(Node_1$1.Node, 'green', 0, function (val) { 48777 this._filterUpToDate = false; 48778 if (val > 255) { 48779 return 255; 48780 } 48781 else if (val < 0) { 48782 return 0; 48783 } 48784 else { 48785 return Math.round(val); 48786 } 48787}); 48788Factory_1$1.Factory.addGetterSetter(Node_1$1.Node, 'blue', 0, Validators_1$1.RGBComponent, Factory_1$1.Factory.afterSetFilter); 48789Factory_1$1.Factory.addGetterSetter(Node_1$1.Node, 'alpha', 1, function (val) { 48790 this._filterUpToDate = false; 48791 if (val > 1) { 48792 return 1; 48793 } 48794 else if (val < 0) { 48795 return 0; 48796 } 48797 else { 48798 return val; 48799 } 48800}); 48801 48802var Sepia$1 = {}; 48803 48804Object.defineProperty(Sepia$1, "__esModule", { value: true }); 48805Sepia$1.Sepia = void 0; 48806const Sepia = function (imageData) { 48807 const data = imageData.data, nPixels = data.length; 48808 for (let i = 0; i < nPixels; i += 4) { 48809 const r = data[i + 0]; 48810 const g = data[i + 1]; 48811 const b = data[i + 2]; 48812 data[i + 0] = Math.min(255, r * 0.393 + g * 0.769 + b * 0.189); 48813 data[i + 1] = Math.min(255, r * 0.349 + g * 0.686 + b * 0.168); 48814 data[i + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131); 48815 } 48816}; 48817Sepia$1.Sepia = Sepia; 48818 48819var Solarize$1 = {}; 48820 48821Object.defineProperty(Solarize$1, "__esModule", { value: true }); 48822Solarize$1.Solarize = void 0; 48823const Solarize = function (imageData) { 48824 const data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4; 48825 let y = h; 48826 do { 48827 const offsetY = (y - 1) * w4; 48828 let x = w; 48829 do { 48830 const offset = offsetY + (x - 1) * 4; 48831 let r = data[offset]; 48832 let g = data[offset + 1]; 48833 let b = data[offset + 2]; 48834 if (r > 127) { 48835 r = 255 - r; 48836 } 48837 if (g > 127) { 48838 g = 255 - g; 48839 } 48840 if (b > 127) { 48841 b = 255 - b; 48842 } 48843 data[offset] = r; 48844 data[offset + 1] = g; 48845 data[offset + 2] = b; 48846 } while (--x); 48847 } while (--y); 48848}; 48849Solarize$1.Solarize = Solarize; 48850 48851var Threshold$1 = {}; 48852 48853Object.defineProperty(Threshold$1, "__esModule", { value: true }); 48854Threshold$1.Threshold = void 0; 48855const Factory_1 = Factory; 48856const Node_1 = Node$2; 48857const Validators_1 = Validators; 48858const Threshold = function (imageData) { 48859 const level = this.threshold() * 255, data = imageData.data, len = data.length; 48860 for (let i = 0; i < len; i += 1) { 48861 data[i] = data[i] < level ? 0 : 255; 48862 } 48863}; 48864Threshold$1.Threshold = Threshold; 48865Factory_1.Factory.addGetterSetter(Node_1.Node, 'threshold', 0.5, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter); 48866 48867Object.defineProperty(_FullInternals, "__esModule", { value: true }); 48868_FullInternals.Konva = void 0; 48869const _CoreInternals_1 = _CoreInternals; 48870const Arc_1 = Arc$1; 48871const Arrow_1 = Arrow$1; 48872const Circle_1 = Circle$1; 48873const Ellipse_1 = Ellipse$1; 48874const Image_1 = Image$3; 48875const Label_1 = Label$1; 48876const Line_1 = Line$1; 48877const Path_1 = Path$1; 48878const Rect_1 = Rect$2; 48879const RegularPolygon_1 = RegularPolygon$1; 48880const Ring_1 = Ring$1; 48881const Sprite_1 = Sprite$1; 48882const Star_1 = Star$1; 48883const Text_1 = Text$2; 48884const TextPath_1 = TextPath$1; 48885const Transformer_1 = Transformer$2; 48886const Wedge_1 = Wedge$1; 48887const Blur_1 = Blur$1; 48888const Brighten_1 = Brighten$1; 48889const Contrast_1 = Contrast$1; 48890const Emboss_1 = Emboss$1;
vendor: 52,454 bytes, lines 48891-49099
48891const Enhance_1 = Enhance$1; 48892const Grayscale_1 = Grayscale$1; 48893const HSL_1 = HSL$1; 48894const HSV_1 = HSV$1; 48895const Invert_1 = Invert$1; 48896const Kaleidoscope_1 = Kaleidoscope$1; 48897const Mask_1 = Mask$1; 48898const Noise_1 = Noise$1; 48899const Pixelate_1 = Pixelate$1; 48900const Posterize_1 = Posterize$1; 48901const RGB_1 = RGB$1; 48902const RGBA_1 = RGBA$1; 48903const Sepia_1 = Sepia$1; 48904const Solarize_1 = Solarize$1; 48905const Threshold_1 = Threshold$1; 48906_FullInternals.Konva = _CoreInternals_1.Konva.Util._assign(_CoreInternals_1.Konva, { 48907 Arc: Arc_1.Arc, 48908 Arrow: Arrow_1.Arrow, 48909 Circle: Circle_1.Circle, 48910 Ellipse: Ellipse_1.Ellipse, 48911 Image: Image_1.Image, 48912 Label: Label_1.Label, 48913 Tag: Label_1.Tag, 48914 Line: Line_1.Line, 48915 Path: Path_1.Path, 48916 Rect: Rect_1.Rect, 48917 RegularPolygon: RegularPolygon_1.RegularPolygon, 48918 Ring: Ring_1.Ring, 48919 Sprite: Sprite_1.Sprite, 48920 Star: Star_1.Star, 48921 Text: Text_1.Text, 48922 TextPath: TextPath_1.TextPath, 48923 Transformer: Transformer_1.Transformer, 48924 Wedge: Wedge_1.Wedge, 48925 Filters: { 48926 Blur: Blur_1.Blur, 48927 Brighten: Brighten_1.Brighten, 48928 Contrast: Contrast_1.Contrast, 48929 Emboss: Emboss_1.Emboss, 48930 Enhance: Enhance_1.Enhance, 48931 Grayscale: Grayscale_1.Grayscale, 48932 HSL: HSL_1.HSL, 48933 HSV: HSV_1.HSV, 48934 Invert: Invert_1.Invert, 48935 Kaleidoscope: Kaleidoscope_1.Kaleidoscope, 48936 Mask: Mask_1.Mask, 48937 Noise: Noise_1.Noise, 48938 Pixelate: Pixelate_1.Pixelate, 48939 Posterize: Posterize_1.Posterize, 48940 RGB: RGB_1.RGB, 48941 RGBA: RGBA_1.RGBA, 48942 Sepia: Sepia_1.Sepia, 48943 Solarize: Solarize_1.Solarize, 48944 Threshold: Threshold_1.Threshold, 48945 }, 48946}); 48947 48948var lib = lib$1.exports; 48949Object.defineProperty(lib, "__esModule", { value: true }); 48950const _FullInternals_1 = _FullInternals; 48951lib$1.exports = _FullInternals_1.Konva; 48952 48953var Core = {exports: {}}; 48954 48955(function (module, exports) { 48956 Object.defineProperty(exports, "__esModule", { value: true }); 48957 exports.Konva = void 0; 48958 var _CoreInternals_1 = _CoreInternals; 48959 Object.defineProperty(exports, "Konva", { enumerable: true, get: function () { return _CoreInternals_1.Konva; } }); 48960 const _CoreInternals_2 = _CoreInternals; 48961 module.exports = _CoreInternals_2.Konva; 48962} (Core, Core.exports)); 48963 48964var CoreExports = Core.exports; 48965const Konva = /*@__PURE__*/getDefaultExportFromCjs(CoreExports); 48966 48967var reactReconciler = {exports: {}}; 48968 48969/** 48970 * @license React 48971 * react-reconciler.production.min.js 48972 * 48973 * Copyright (c) Facebook, Inc. and its affiliates. 48974 * 48975 * This source code is licensed under the MIT license found in the 48976 * LICENSE file in the root directory of this source tree. 48977 */ 48978 48979var reactReconciler_production_min = function $$$reconciler($$$hostConfig) { 48980 var exports = {}; 48981var aa=reactExports,ba=schedulerExports,ca=Object.assign;function n(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."} 48982var da=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ea=Symbol.for("react.element"),fa=Symbol.for("react.portal"),ha=Symbol.for("react.fragment"),ia=Symbol.for("react.strict_mode"),ja=Symbol.for("react.profiler"),ka=Symbol.for("react.provider"),la=Symbol.for("react.context"),ma=Symbol.for("react.forward_ref"),na=Symbol.for("react.suspense"),oa=Symbol.for("react.suspense_list"),pa=Symbol.for("react.memo"),qa=Symbol.for("react.lazy");var ra=Symbol.for("react.offscreen");var sa=Symbol.iterator;function ta(a){if(null===a||"object"!==typeof a)return null;a=sa&&a[sa]||a["@@iterator"];return "function"===typeof a?a:null} 48983function ua(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case ha:return "Fragment";case fa:return "Portal";case ja:return "Profiler";case ia:return "StrictMode";case na:return "Suspense";case oa:return "SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case la:return (a.displayName||"Context")+".Consumer";case ka:return (a._context.displayName||"Context")+".Provider";case ma:var b=a.render;a=a.displayName;a||(a=b.displayName|| 48984b.name||"",a=""!==a?"ForwardRef("+a+")":"ForwardRef");return a;case pa:return b=a.displayName||null,null!==b?b:ua(a.type)||"Memo";case qa:b=a._payload;a=a._init;try{return ua(a(b))}catch(c){}}return null} 48985function va(a){var b=a.type;switch(a.tag){case 24:return "Cache";case 9:return (b.displayName||"Context")+".Consumer";case 10:return (b._context.displayName||"Context")+".Provider";case 18:return "DehydratedFragment";case 11:return a=b.render,a=a.displayName||a.name||"",b.displayName||(""!==a?"ForwardRef("+a+")":"ForwardRef");case 7:return "Fragment";case 5:return b;case 4:return "Portal";case 3:return "Root";case 6:return "Text";case 16:return ua(b);case 8:return b===ia?"StrictMode":"Mode";case 22:return "Offscreen"; 48986case 12:return "Profiler";case 21:return "Scope";case 13:return "Suspense";case 19:return "SuspenseList";case 25:return "TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof b)return b.displayName||b.name||null;if("string"===typeof b)return b}return null}function wa(a){var b=a,c=a;if(a.alternate)for(;b.return;)b=b.return;else {a=b;do b=a,0!==(b.flags&4098)&&(c=b.return),a=b.return;while(a)}return 3===b.tag?c:null}function xa(a){if(wa(a)!==a)throw Error(n(188));} 48987function za(a){var b=a.alternate;if(!b){b=wa(a);if(null===b)throw Error(n(188));return b!==a?null:a}for(var c=a,d=b;;){var e=c.return;if(null===e)break;var f=e.alternate;if(null===f){d=e.return;if(null!==d){c=d;continue}break}if(e.child===f.child){for(f=e.child;f;){if(f===c)return xa(e),a;if(f===d)return xa(e),b;f=f.sibling;}throw Error(n(188));}if(c.return!==d.return)c=e,d=f;else {for(var g=false,h=e.child;h;){if(h===c){g=true;c=e;d=f;break}if(h===d){g=true;d=e;c=f;break}h=h.sibling;}if(!g){for(h=f.child;h;){if(h=== 48988c){g=true;c=f;d=e;break}if(h===d){g=true;d=f;c=e;break}h=h.sibling;}if(!g)throw Error(n(189));}}if(c.alternate!==d)throw Error(n(190));}if(3!==c.tag)throw Error(n(188));return c.stateNode.current===c?a:b}function Aa(a){a=za(a);return null!==a?Ba(a):null}function Ba(a){if(5===a.tag||6===a.tag)return a;for(a=a.child;null!==a;){var b=Ba(a);if(null!==b)return b;a=a.sibling;}return null} 48989function Ca(a){if(5===a.tag||6===a.tag)return a;for(a=a.child;null!==a;){if(4!==a.tag){var b=Ca(a);if(null!==b)return b}a=a.sibling;}return null} 48990var Da=Array.isArray,Ea=$$$hostConfig.getPublicInstance,Fa=$$$hostConfig.getRootHostContext,Ga=$$$hostConfig.getChildHostContext,Ha=$$$hostConfig.prepareForCommit,Ia=$$$hostConfig.resetAfterCommit,Ja=$$$hostConfig.createInstance,Ka=$$$hostConfig.appendInitialChild,La=$$$hostConfig.finalizeInitialChildren,Ma=$$$hostConfig.prepareUpdate,Na=$$$hostConfig.shouldSetTextContent,Oa=$$$hostConfig.createTextInstance,Pa=$$$hostConfig.scheduleTimeout,Qa=$$$hostConfig.cancelTimeout,Ra=$$$hostConfig.noTimeout, 48991Sa=$$$hostConfig.isPrimaryRenderer,Ta=$$$hostConfig.supportsMutation,Ua=$$$hostConfig.supportsPersistence,Va=$$$hostConfig.supportsHydration,Wa=$$$hostConfig.getInstanceFromNode,Xa=$$$hostConfig.preparePortalMount,Ya=$$$hostConfig.getCurrentEventPriority,Za=$$$hostConfig.detachDeletedInstance,$a=$$$hostConfig.supportsMicrotasks,ab=$$$hostConfig.scheduleMicrotask,bb=$$$hostConfig.supportsTestSelectors,cb=$$$hostConfig.findFiberRoot,db=$$$hostConfig.getBoundingRect,eb=$$$hostConfig.getTextContent,fb= 48992$$$hostConfig.isHiddenSubtree,gb=$$$hostConfig.matchAccessibilityRole,hb=$$$hostConfig.setFocusIfFocusable,ib=$$$hostConfig.setupIntersectionObserver,jb=$$$hostConfig.appendChild,kb=$$$hostConfig.appendChildToContainer,lb=$$$hostConfig.commitTextUpdate,mb=$$$hostConfig.commitMount,nb=$$$hostConfig.commitUpdate,ob=$$$hostConfig.insertBefore,pb=$$$hostConfig.insertInContainerBefore,qb=$$$hostConfig.removeChild,rb=$$$hostConfig.removeChildFromContainer,sb=$$$hostConfig.resetTextContent,tb=$$$hostConfig.hideInstance, 48993ub=$$$hostConfig.hideTextInstance,vb=$$$hostConfig.unhideInstance,wb=$$$hostConfig.unhideTextInstance,xb=$$$hostConfig.clearContainer,yb=$$$hostConfig.cloneInstance,zb=$$$hostConfig.createContainerChildSet,Ab=$$$hostConfig.appendChildToContainerChildSet,Bb=$$$hostConfig.finalizeContainerChildren,Cb=$$$hostConfig.replaceContainerChildren,Eb=$$$hostConfig.cloneHiddenInstance,Fb=$$$hostConfig.cloneHiddenTextInstance,Gb=$$$hostConfig.canHydrateInstance,Hb=$$$hostConfig.canHydrateTextInstance,Ib=$$$hostConfig.canHydrateSuspenseInstance, 48994Jb=$$$hostConfig.isSuspenseInstancePending,Kb=$$$hostConfig.isSuspenseInstanceFallback,Lb=$$$hostConfig.getSuspenseInstanceFallbackErrorDetails,Mb=$$$hostConfig.registerSuspenseInstanceRetry,Nb=$$$hostConfig.getNextHydratableSibling,Ob=$$$hostConfig.getFirstHydratableChild,Pb=$$$hostConfig.getFirstHydratableChildWithinContainer,Qb=$$$hostConfig.getFirstHydratableChildWithinSuspenseInstance,Rb=$$$hostConfig.hydrateInstance,Sb=$$$hostConfig.hydrateTextInstance,Tb=$$$hostConfig.hydrateSuspenseInstance, 48995Ub=$$$hostConfig.getNextHydratableInstanceAfterSuspenseInstance,Vb=$$$hostConfig.commitHydratedContainer,Wb=$$$hostConfig.commitHydratedSuspenseInstance,Xb=$$$hostConfig.clearSuspenseBoundary,Yb=$$$hostConfig.clearSuspenseBoundaryFromContainer,Zb=$$$hostConfig.shouldDeleteUnhydratedTailInstances,$b=$$$hostConfig.didNotMatchHydratedContainerTextInstance,ac=$$$hostConfig.didNotMatchHydratedTextInstance,bc; 48996function cc(a){if(void 0===bc)try{throw Error();}catch(c){var b=c.stack.trim().match(/\n( *(at )?)/);bc=b&&b[1]||"";}return "\n"+bc+a}var dc=false; 48997function ec(a,b){if(!a||dc)return "";dc=true;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(b)if(b=function(){throw Error();},Object.defineProperty(b.prototype,"props",{set:function(){throw Error();}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(b,[]);}catch(l){var d=l;}Reflect.construct(a,[],b);}else {try{b.call();}catch(l){d=l;}a.call(b.prototype);}else {try{throw Error();}catch(l){d=l;}a();}}catch(l){if(l&&d&&"string"===typeof l.stack){for(var e=l.stack.split("\n"), 48998f=d.stack.split("\n"),g=e.length-1,h=f.length-1;1<=g&&0<=h&&e[g]!==f[h];)h--;for(;1<=g&&0<=h;g--,h--)if(e[g]!==f[h]){if(1!==g||1!==h){do if(g--,h--,0>h||e[g]!==f[h]){var k="\n"+e[g].replace(" at new "," at ");a.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{dc=false,Error.prepareStackTrace=c;}return (a=a?a.displayName||a.name:"")?cc(a):""}var fc=Object.prototype.hasOwnProperty,gc=[],hc=-1;function ic(a){return {current:a}} 48999function q(a){0>hc||(a.current=gc[hc],gc[hc]=null,hc--);}function v(a,b){hc++;gc[hc]=a.current;a.current=b;}var jc={},x=ic(jc),z=ic(false),kc=jc;function mc(a,b){var c=a.type.contextTypes;if(!c)return jc;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e} 49000function A(a){a=a.childContextTypes;return null!==a&&void 0!==a}function nc(){q(z);q(x);}function oc(a,b,c){if(x.current!==jc)throw Error(n(168));v(x,b);v(z,c);}function pc(a,b,c){var d=a.stateNode;b=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(n(108,va(a)||"Unknown",e));return ca({},c,d)} 49001function qc(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||jc;kc=x.current;v(x,a);v(z,z.current);return true}function rc(a,b,c){var d=a.stateNode;if(!d)throw Error(n(169));c?(a=pc(a,b,kc),d.__reactInternalMemoizedMergedChildContext=a,q(z),q(x),v(x,a)):q(z);v(z,c);}var tc=Math.clz32?Math.clz32:sc,uc=Math.log,vc=Math.LN2;function sc(a){a>>>=0;return 0===a?32:31-(uc(a)/vc|0)|0}var wc=64,xc=4194304; 49002function yc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824; 49003default:return a}}function zc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=yc(h):(f&=g,0!==f&&(d=yc(f)));}else g=c&~e,0!==g?d=yc(g):0!==f&&(d=yc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0<b;)c=31-tc(b),e=1<<c,d|=a[c],b&=~e;return d} 49004function Ac(a,b){switch(a){case 1:case 2:case 4:return b+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return b+5E3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return -1;case 134217728:case 268435456:case 536870912:case 1073741824:return -1;default:return -1}} 49005function Bc(a,b){for(var c=a.suspendedLanes,d=a.pingedLanes,e=a.expirationTimes,f=a.pendingLanes;0<f;){var g=31-tc(f),h=1<<g,k=e[g];if(-1===k){if(0===(h&c)||0!==(h&d))e[g]=Ac(h,b);}else k<=b&&(a.expiredLanes|=h);f&=~h;}}function Cc(a){a=a.pendingLanes&-1073741825;return 0!==a?a:a&1073741824?1073741824:0}function Dc(){var a=wc;wc<<=1;0===(wc&4194240)&&(wc=64);return a}function Ec(a){for(var b=[],c=0;31>c;c++)b.push(a);return b} 49006function Fc(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-tc(b);a[b]=c;}function Gc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0<c;){var e=31-tc(c),f=1<<e;b[e]=0;d[e]=-1;a[e]=-1;c&=~f;}} 49007function Hc(a,b){var c=a.entangledLanes|=b;for(a=a.entanglements;c;){var d=31-tc(c),e=1<<d;e&b|a[d]&b&&(a[d]|=b);c&=~e;}}var C=0;function Ic(a){a&=-a;return 1<a?4<a?0!==(a&268435455)?16:536870912:4:1}var Jc=ba.unstable_scheduleCallback,Kc=ba.unstable_cancelCallback,Lc=ba.unstable_shouldYield,Mc=ba.unstable_requestPaint,D=ba.unstable_now,Nc=ba.unstable_ImmediatePriority,Oc=ba.unstable_UserBlockingPriority,Pc=ba.unstable_NormalPriority,Qc=ba.unstable_IdlePriority,Rc=null,Sc=null; 49008function Tc(a){if(Sc&&"function"===typeof Sc.onCommitFiberRoot)try{Sc.onCommitFiberRoot(Rc,a,void 0,128===(a.current.flags&128));}catch(b){}}function Uc(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var Vc="function"===typeof Object.is?Object.is:Uc,Wc=null,Xc=false,Yc=false;function Zc(a){null===Wc?Wc=[a]:Wc.push(a);}function $c(a){Xc=true;Zc(a);} 49009function ad(){if(!Yc&&null!==Wc){Yc=true;var a=0,b=C;try{var c=Wc;for(C=1;a<c.length;a++){var d=c[a];do d=d(!0);while(null!==d)}Wc=null;Xc=!1;}catch(e){throw null!==Wc&&(Wc=Wc.slice(a+1)),Jc(Nc,ad),e;}finally{C=b,Yc=false;}}return null}var bd=[],cd=0,dd=null,ed=0,fd=[],gd=0,hd=null,id=1,jd="";function kd(a,b){bd[cd++]=ed;bd[cd++]=dd;dd=a;ed=b;} 49010function ld(a,b,c){fd[gd++]=id;fd[gd++]=jd;fd[gd++]=hd;hd=a;var d=id;a=jd;var e=32-tc(d)-1;d&=~(1<<e);c+=1;var f=32-tc(b)+e;if(30<f){var g=e-e%5;f=(d&(1<<g)-1).toString(32);d>>=g;e-=g;id=1<<32-tc(b)+e|c<<e|d;jd=f+a;}else id=1<<f|c<<e|d,jd=a;}function md(a){null!==a.return&&(kd(a,1),ld(a,1,0));}function nd(a){for(;a===dd;)dd=bd[--cd],bd[cd]=null,ed=bd[--cd],bd[cd]=null;for(;a===hd;)hd=fd[--gd],fd[gd]=null,jd=fd[--gd],fd[gd]=null,id=fd[--gd],fd[gd]=null;}var od=null,pd=null,F=false,qd=false,rd=null; 49011function sd(a,b){var c=td(5,null,null,0);c.elementType="DELETED";c.stateNode=b;c.return=a;b=a.deletions;null===b?(a.deletions=[c],a.flags|=16):b.push(c);} 49012function ud(a,b){switch(a.tag){case 5:return b=Gb(b,a.type,a.pendingProps),null!==b?(a.stateNode=b,od=a,pd=Ob(b),true):false;case 6:return b=Hb(b,a.pendingProps),null!==b?(a.stateNode=b,od=a,pd=null,true):false;case 13:b=Ib(b);if(null!==b){var c=null!==hd?{id:id,overflow:jd}:null;a.memoizedState={dehydrated:b,treeContext:c,retryLane:1073741824};c=td(18,null,null,0);c.stateNode=b;c.return=a;a.child=c;od=a;pd=null;return true}return false;default:return false}}function vd(a){return 0!==(a.mode&1)&&0===(a.flags&128)} 49013function wd(a){if(F){var b=pd;if(b){var c=b;if(!ud(a,b)){if(vd(a))throw Error(n(418));b=Nb(c);var d=od;b&&ud(a,b)?sd(d,c):(a.flags=a.flags&-4097|2,F=false,od=a);}}else {if(vd(a))throw Error(n(418));a.flags=a.flags&-4097|2;F=false;od=a;}}}function xd(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;od=a;} 49014function yd(a){if(!Va||a!==od)return false;if(!F)return xd(a),F=true,false;if(3!==a.tag&&(5!==a.tag||Zb(a.type)&&!Na(a.type,a.memoizedProps))){var b=pd;if(b){if(vd(a))throw zd(),Error(n(418));for(;b;)sd(a,b),b=Nb(b);}}xd(a);if(13===a.tag){if(!Va)throw Error(n(316));a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(n(317));pd=Ub(a);}else pd=od?Nb(a.stateNode):null;return true}function zd(){for(var a=pd;a;)a=Nb(a);}function Ad(){Va&&(pd=od=null,qd=F=false);}function Bd(a){null===rd?rd=[a]:rd.push(a);} 49015var Cd=da.ReactCurrentBatchConfig;function Dd(a,b){if(Vc(a,b))return true;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return false;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return false;for(d=0;d<c.length;d++){var e=c[d];if(!fc.call(b,e)||!Vc(a[e],b[e]))return false}return true} 49016function Ed(a){switch(a.tag){case 5:return cc(a.type);case 16:return cc("Lazy");case 13:return cc("Suspense");case 19:return cc("SuspenseList");case 0:case 2:case 15:return a=ec(a.type,false),a;case 11:return a=ec(a.type.render,false),a;case 1:return a=ec(a.type,true),a;default:return ""}} 49017function Fd(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;if(c){if(1!==c.tag)throw Error(n(309));var d=c.stateNode;}if(!d)throw Error(n(147,a));var e=d,f=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===f)return b.ref;b=function(a){var b=e.refs;null===a?delete b[f]:b[f]=a;};b._stringRef=f;return b}if("string"!==typeof a)throw Error(n(284));if(!c._owner)throw Error(n(290,a));}return a} 49018function Gd(a,b){a=Object.prototype.toString.call(b);throw Error(n(31,"[object Object]"===a?"object with keys {"+Object.keys(b).join(", ")+"}":a));}function Hd(a){var b=a._init;return b(a._payload)} 49019function Id(a){function b(b,c){if(a){var d=b.deletions;null===d?(b.deletions=[c],b.flags|=16):d.push(c);}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b){a=Jd(a,b);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return b.flags|=1048576,c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.flags|=2,c):d;b.flags|=2;return c}function g(b){a&& 49020null===b.alternate&&(b.flags|=2);return b}function h(a,b,c,d){if(null===b||6!==b.tag)return b=Kd(c,a.mode,d),b.return=a,b;b=e(b,c);b.return=a;return b}function k(a,b,c,d){var f=c.type;if(f===ha)return m(a,b,c.props.children,d,c.key);if(null!==b&&(b.elementType===f||"object"===typeof f&&null!==f&&f.$$typeof===qa&&Hd(f)===b.type))return d=e(b,c.props),d.ref=Fd(a,b,c),d.return=a,d;d=Ld(c.type,c.key,c.props,null,a.mode,d);d.ref=Fd(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||4!==b.tag|| 49021b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=Md(c,a.mode,d),b.return=a,b;b=e(b,c.children||[]);b.return=a;return b}function m(a,b,c,d,f){if(null===b||7!==b.tag)return b=Nd(c,a.mode,d,f),b.return=a,b;b=e(b,c);b.return=a;return b}function r(a,b,c){if("string"===typeof b&&""!==b||"number"===typeof b)return b=Kd(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case ea:return c=Ld(b.type,b.key,b.props,null,a.mode,c), 49022c.ref=Fd(a,null,b),c.return=a,c;case fa:return b=Md(b,a.mode,c),b.return=a,b;case qa:var d=b._init;return r(a,d(b._payload),c)}if(Da(b)||ta(b))return b=Nd(b,a.mode,c,null),b.return=a,b;Gd(a,b);}return null}function p(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c&&""!==c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case ea:return c.key===e?k(a,b,c,d):null;case fa:return c.key===e?l(a,b,c,d):null;case qa:return e=c._init,p(a, 49023b,e(c._payload),d)}if(Da(c)||ta(c))return null!==e?null:m(a,b,c,d,null);Gd(a,c);}return null}function B(a,b,c,d,e){if("string"===typeof d&&""!==d||"number"===typeof d)return a=a.get(c)||null,h(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case ea:return a=a.get(null===d.key?c:d.key)||null,k(b,a,d,e);case fa:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e);case qa:var f=d._init;return B(a,b,c,f(d._payload),e)}if(Da(d)||ta(d))return a=a.get(c)||null,m(b,a,d,e,null);Gd(b,d);}return null} 49024function w(e,g,h,k){for(var l=null,m=null,u=g,t=g=0,E=null;null!==u&&t<h.length;t++){u.index>t?(E=u,u=null):E=u.sibling;var y=p(e,u,h[t],k);if(null===y){null===u&&(u=E);break}a&&u&&null===y.alternate&&b(e,u);g=f(y,g,t);null===m?l=y:m.sibling=y;m=y;u=E;}if(t===h.length)return c(e,u),F&&kd(e,t),l;if(null===u){for(;t<h.length;t++)u=r(e,h[t],k),null!==u&&(g=f(u,g,t),null===m?l=u:m.sibling=u,m=u);F&&kd(e,t);return l}for(u=d(e,u);t<h.length;t++)E=B(u,e,t,h[t],k),null!==E&&(a&&null!==E.alternate&&u.delete(null=== 49025E.key?t:E.key),g=f(E,g,t),null===m?l=E:m.sibling=E,m=E);a&&u.forEach(function(a){return b(e,a)});F&&kd(e,t);return l}function Y(e,g,h,k){var l=ta(h);if("function"!==typeof l)throw Error(n(150));h=l.call(h);if(null==h)throw Error(n(151));for(var u=l=null,m=g,t=g=0,E=null,y=h.next();null!==m&&!y.done;t++,y=h.next()){m.index>t?(E=m,m=null):E=m.sibling;var w=p(e,m,y.value,k);if(null===w){null===m&&(m=E);break}a&&m&&null===w.alternate&&b(e,m);g=f(w,g,t);null===u?l=w:u.sibling=w;u=w;m=E;}if(y.done)return c(e, 49026m),F&&kd(e,t),l;if(null===m){for(;!y.done;t++,y=h.next())y=r(e,y.value,k),null!==y&&(g=f(y,g,t),null===u?l=y:u.sibling=y,u=y);F&&kd(e,t);return l}for(m=d(e,m);!y.done;t++,y=h.next())y=B(m,e,t,y.value,k),null!==y&&(a&&null!==y.alternate&&m.delete(null===y.key?t:y.key),g=f(y,g,t),null===u?l=y:u.sibling=y,u=y);a&&m.forEach(function(a){return b(e,a)});F&&kd(e,t);return l}function ya(a,d,f,h){"object"===typeof f&&null!==f&&f.type===ha&&null===f.key&&(f=f.props.children);if("object"===typeof f&&null!== 49027f){switch(f.$$typeof){case ea:a:{for(var k=f.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ha){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||"object"===typeof k&&null!==k&&k.$$typeof===qa&&Hd(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Fd(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling;}f.type===ha?(d=Nd(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Ld(f.type,f.key,f.props,null,a.mode,h),h.ref=Fd(a,d,f),h.return= 49028a,a=h);}return g(a);case fa:a:{for(l=f.key;null!==d;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else {c(a,d);break}else b(a,d);d=d.sibling;}d=Md(f,a.mode,h);d.return=a;a=d;}return g(a);case qa:return l=f._init,ya(a,d,l(f._payload),h)}if(Da(f))return w(a,d,f,h);if(ta(f))return Y(a,d,f,h);Gd(a,f);}return "string"===typeof f&&""!==f||"number"===typeof f?(f=""+f,null!==d&& 490296===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Kd(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return ya}var Od=Id(true),Pd=Id(false),Qd=ic(null),Rd=null,Sd=null,Td=null;function Ud(){Td=Sd=Rd=null;}function Vd(a,b,c){Sa?(v(Qd,b._currentValue),b._currentValue=c):(v(Qd,b._currentValue2),b._currentValue2=c);}function Wd(a){var b=Qd.current;q(Qd);Sa?a._currentValue=b:a._currentValue2=b;} 49030function Xd(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return;}}function Yd(a,b){Rd=a;Td=Sd=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(G=true),a.firstContext=null);} 49031function Zd(a){var b=Sa?a._currentValue:a._currentValue2;if(Td!==a)if(a={context:a,memoizedValue:b,next:null},null===Sd){if(null===Rd)throw Error(n(308));Sd=a;Rd.dependencies={lanes:0,firstContext:a};}else Sd=Sd.next=a;return b}var $d=null;function ae(a){null===$d?$d=[a]:$d.push(a);}function be(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,ae(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ce(a,d)} 49032function ce(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var de=false;function ee(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null};} 49033function fe(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects});}function ge(a,b){return {eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}} 49034function he(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(H&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ce(a,c)}e=d.interleaved;null===e?(b.next=b,ae(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ce(a,c)}function ie(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Hc(a,c);}} 49035function je(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next;}while(null!==c);null===f?e=f=b:f=f.next=b;}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next= 49036b;c.lastBaseUpdate=b;} 49037function ke(a,b,c,d){var e=a.updateQueue;de=false;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k));}if(null!==f){var r=e.baseState;g=0;m=l=k=null;h=f;do{var p=h.lane,B=h.eventTime;if((d&p)===p){null!==m&&(m=m.next={eventTime:B,lane:0,tag:h.tag,payload:h.payload,callback:h.callback, 49038next:null});a:{var w=a,Y=h;p=b;B=c;switch(Y.tag){case 1:w=Y.payload;if("function"===typeof w){r=w.call(B,r,p);break a}r=w;break a;case 3:w.flags=w.flags&-65537|128;case 0:w=Y.payload;p="function"===typeof w?w.call(B,r,p):w;if(null===p||void 0===p)break a;r=ca({},r,p);break a;case 2:de=true;}}null!==h.callback&&0!==h.lane&&(a.flags|=64,p=e.effects,null===p?e.effects=[h]:p.push(h));}else B={eventTime:B,lane:p,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=B,k=r):m=m.next=B,g|= 49039p;h=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else p=h,h=p.next,p.next=null,e.lastBaseUpdate=p,e.shared.pending=null;}while(1);null===m&&(k=r);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);le|=g;a.lanes=g;a.memoizedState=r;}} 49040function me(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;b<a.length;b++){var d=a[b],e=d.callback;if(null!==e){d.callback=null;d=c;if("function"!==typeof e)throw Error(n(191,e));e.call(d);}}}var ne={},oe=ic(ne),pe=ic(ne),qe=ic(ne);function re(a){if(a===ne)throw Error(n(174));return a}function se(a,b){v(qe,b);v(pe,a);v(oe,ne);a=Fa(b);q(oe);v(oe,a);}function te(){q(oe);q(pe);q(qe);}function ue(a){var b=re(qe.current),c=re(oe.current);b=Ga(c,a.type,b);c!==b&&(v(pe,a),v(oe,b));} 49041function ve(a){pe.current===a&&(q(oe),q(pe));}var I=ic(0);function we(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||Jb(c)||Kb(c)))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}return null}var xe=[]; 49042function ye(){for(var a=0;a<xe.length;a++){var b=xe[a];Sa?b._workInProgressVersionPrimary=null:b._workInProgressVersionSecondary=null;}xe.length=0;}var ze=da.ReactCurrentDispatcher,Ae=da.ReactCurrentBatchConfig,Be=0,J=null,K=null,L=null,Ce=false,De=false,Ee=0,Fe=0;function M(){throw Error(n(321));}function Ge(a,b){if(null===b)return false;for(var c=0;c<b.length&&c<a.length;c++)if(!Vc(a[c],b[c]))return false;return true} 49043function He(a,b,c,d,e,f){Be=f;J=b;b.memoizedState=null;b.updateQueue=null;b.lanes=0;ze.current=null===a||null===a.memoizedState?Ie:Je;a=c(d,e);if(De){f=0;do{De=false;Ee=0;if(25<=f)throw Error(n(301));f+=1;L=K=null;b.updateQueue=null;ze.current=Ke;a=c(d,e);}while(De)}ze.current=Le;b=null!==K&&null!==K.next;Be=0;L=K=J=null;Ce=false;if(b)throw Error(n(300));return a}function Me(){var a=0!==Ee;Ee=0;return a} 49044function Ne(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===L?J.memoizedState=L=a:L=L.next=a;return L}function Oe(){if(null===K){var a=J.alternate;a=null!==a?a.memoizedState:null;}else a=K.next;var b=null===L?J.memoizedState:L.next;if(null!==b)L=b,K=a;else {if(null===a)throw Error(n(310));K=a;a={memoizedState:K.memoizedState,baseState:K.baseState,baseQueue:K.baseQueue,queue:K.queue,next:null};null===L?J.memoizedState=L=a:L=L.next=a;}return L} 49045function Pe(a,b){return "function"===typeof b?b(a):b} 49046function Qe(a){var b=Oe(),c=b.queue;if(null===c)throw Error(n(311));c.lastRenderedReducer=a;var d=K,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g;}d.baseQueue=e=f;c.pending=null;}if(null!==e){f=e.next;d=d.baseState;var h=g=null,k=null,l=f;do{var m=l.lane;if((Be&m)===m)null!==k&&(k=k.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),d=l.hasEagerState?l.eagerState:a(d,l.action);else {var r={lane:m,action:l.action,hasEagerState:l.hasEagerState, 49047eagerState:l.eagerState,next:null};null===k?(h=k=r,g=d):k=k.next=r;J.lanes|=m;le|=m;}l=l.next;}while(null!==l&&l!==f);null===k?g=d:k.next=h;Vc(d,b.memoizedState)||(G=true);b.memoizedState=d;b.baseState=g;b.baseQueue=k;c.lastRenderedState=d;}a=c.interleaved;if(null!==a){e=a;do f=e.lane,J.lanes|=f,le|=f,e=e.next;while(e!==a)}else null===e&&(c.lanes=0);return [b.memoizedState,c.dispatch]} 49048function Re(a){var b=Oe(),c=b.queue;if(null===c)throw Error(n(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);Vc(f,b.memoizedState)||(G=true);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f;}return [f,d]}function Se(){} 49049function Te(a,b){var c=J,d=Oe(),e=b(),f=!Vc(d.memoizedState,e);f&&(d.memoizedState=e,G=true);d=d.queue;Ue(Ve.bind(null,c,d,a),[a]);if(d.getSnapshot!==b||f||null!==L&&L.memoizedState.tag&1){c.flags|=2048;We(9,Xe.bind(null,c,d,e,b),void 0,null);if(null===N)throw Error(n(349));0!==(Be&30)||Ye(c,b,e);}return e}function Ye(a,b,c){a.flags|=16384;a={getSnapshot:b,value:c};b=J.updateQueue;null===b?(b={lastEffect:null,stores:null},J.updateQueue=b,b.stores=[a]):(c=b.stores,null===c?b.stores=[a]:c.push(a));} 49050function Xe(a,b,c,d){b.value=c;b.getSnapshot=d;Ze(b)&&$e(a);}function Ve(a,b,c){return c(function(){Ze(b)&&$e(a);})}function Ze(a){var b=a.getSnapshot;a=a.value;try{var c=b();return !Vc(a,c)}catch(d){return true}}function $e(a){var b=ce(a,1);null!==b&&af(b,a,1,-1);} 49051function bf(a){var b=Ne();"function"===typeof a&&(a=a());b.memoizedState=b.baseState=a;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pe,lastRenderedState:a};b.queue=a;a=a.dispatch=cf.bind(null,J,a);return [b.memoizedState,a]} 49052function We(a,b,c,d){a={tag:a,create:b,destroy:c,deps:d,next:null};b=J.updateQueue;null===b?(b={lastEffect:null,stores:null},J.updateQueue=b,b.lastEffect=a.next=a):(c=b.lastEffect,null===c?b.lastEffect=a.next=a:(d=c.next,c.next=a,a.next=d,b.lastEffect=a));return a}function df(){return Oe().memoizedState}function ef(a,b,c,d){var e=Ne();J.flags|=a;e.memoizedState=We(1|b,c,void 0,void 0===d?null:d);} 49053function ff(a,b,c,d){var e=Oe();d=void 0===d?null:d;var f=void 0;if(null!==K){var g=K.memoizedState;f=g.destroy;if(null!==d&&Ge(d,g.deps)){e.memoizedState=We(b,c,f,d);return}}J.flags|=a;e.memoizedState=We(1|b,c,f,d);}function gf(a,b){return ef(8390656,8,a,b)}function Ue(a,b){return ff(2048,8,a,b)}function hf(a,b){return ff(4,2,a,b)}function jf(a,b){return ff(4,4,a,b)} 49054function kf(a,b){if("function"===typeof b)return a=a(),b(a),function(){b(null);};if(null!==b&&void 0!==b)return a=a(),b.current=a,function(){b.current=null;}}function lf(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ff(4,4,kf.bind(null,b,a),c)}function mf(){}function nf(a,b){var c=Oe();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Ge(b,d[1]))return d[0];c.memoizedState=[a,b];return a} 49055function of(a,b){var c=Oe();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Ge(b,d[1]))return d[0];a=a();c.memoizedState=[a,b];return a}function pf(a,b,c){if(0===(Be&21))return a.baseState&&(a.baseState=false,G=true),a.memoizedState=c;Vc(c,b)||(c=Dc(),J.lanes|=c,le|=c,a.baseState=true);return b}function qf(a,b){var c=C;C=0!==c&&4>c?c:4;a(true);var d=Ae.transition;Ae.transition={};try{a(!1),b();}finally{C=c,Ae.transition=d;}}function rf(){return Oe().memoizedState} 49056function sf(a,b,c){var d=tf(a);c={lane:d,action:c,hasEagerState:false,eagerState:null,next:null};if(uf(a))vf(b,c);else if(c=be(a,b,c,d),null!==c){var e=O();af(c,a,d,e);wf(c,b,d);}} 49057function cf(a,b,c){var d=tf(a),e={lane:d,action:c,hasEagerState:false,eagerState:null,next:null};if(uf(a))vf(b,e);else {var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(Vc(h,g)){var k=b.interleaved;null===k?(e.next=e,ae(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=be(a,b,e,d);null!==c&&(e=O(),af(c,a,d,e),wf(c,b,d));}} 49058function uf(a){var b=a.alternate;return a===J||null!==b&&b===J}function vf(a,b){De=Ce=true;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b;}function wf(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Hc(a,c);}} 49059var Le={readContext:Zd,useCallback:M,useContext:M,useEffect:M,useImperativeHandle:M,useInsertionEffect:M,useLayoutEffect:M,useMemo:M,useReducer:M,useRef:M,useState:M,useDebugValue:M,useDeferredValue:M,useTransition:M,useMutableSource:M,useSyncExternalStore:M,useId:M,unstable_isNewReconciler:false},Ie={readContext:Zd,useCallback:function(a,b){Ne().memoizedState=[a,void 0===b?null:b];return a},useContext:Zd,useEffect:gf,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ef(4194308, 490604,kf.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ef(4194308,4,a,b)},useInsertionEffect:function(a,b){return ef(4,2,a,b)},useMemo:function(a,b){var c=Ne();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Ne();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=sf.bind(null,J,a);return [d.memoizedState,a]},useRef:function(a){var b= 49061Ne();a={current:a};return b.memoizedState=a},useState:bf,useDebugValue:mf,useDeferredValue:function(a){return Ne().memoizedState=a},useTransition:function(){var a=bf(false),b=a[0];a=qf.bind(null,a[1]);Ne().memoizedState=a;return [b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=J,e=Ne();if(F){if(void 0===c)throw Error(n(407));c=c();}else {c=b();if(null===N)throw Error(n(349));0!==(Be&30)||Ye(d,b,c);}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;gf(Ve.bind(null,d, 49062f,a),[a]);d.flags|=2048;We(9,Xe.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Ne(),b=N.identifierPrefix;if(F){var c=jd;var d=id;c=(d&~(1<<32-tc(d)-1)).toString(32)+c;b=":"+b+"R"+c;c=Ee++;0<c&&(b+="H"+c.toString(32));b+=":";}else c=Fe++,b=":"+b+"r"+c.toString(32)+":";return a.memoizedState=b},unstable_isNewReconciler:false},Je={readContext:Zd,useCallback:nf,useContext:Zd,useEffect:Ue,useImperativeHandle:lf,useInsertionEffect:hf,useLayoutEffect:jf,useMemo:of,useReducer:Qe,useRef:df,useState:function(){return Qe(Pe)}, 49063useDebugValue:mf,useDeferredValue:function(a){var b=Oe();return pf(b,K.memoizedState,a)},useTransition:function(){var a=Qe(Pe)[0],b=Oe().memoizedState;return [a,b]},useMutableSource:Se,useSyncExternalStore:Te,useId:rf,unstable_isNewReconciler:false},Ke={readContext:Zd,useCallback:nf,useContext:Zd,useEffect:Ue,useImperativeHandle:lf,useInsertionEffect:hf,useLayoutEffect:jf,useMemo:of,useReducer:Re,useRef:df,useState:function(){return Re(Pe)},useDebugValue:mf,useDeferredValue:function(a){var b=Oe();return null=== 49064K?b.memoizedState=a:pf(b,K.memoizedState,a)},useTransition:function(){var a=Re(Pe)[0],b=Oe().memoizedState;return [a,b]},useMutableSource:Se,useSyncExternalStore:Te,useId:rf,unstable_isNewReconciler:false};function xf(a,b){if(a&&a.defaultProps){b=ca({},b);a=a.defaultProps;for(var c in a) void 0===b[c]&&(b[c]=a[c]);return b}return b}function yf(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:ca({},b,c);a.memoizedState=c;0===a.lanes&&(a.updateQueue.baseState=c);} 49065var zf={isMounted:function(a){return (a=a._reactInternals)?wa(a)===a:false},enqueueSetState:function(a,b,c){a=a._reactInternals;var d=O(),e=tf(a),f=ge(d,e);f.payload=b;void 0!==c&&null!==c&&(f.callback=c);b=he(a,f,e);null!==b&&(af(b,a,e,d),ie(b,a,e));},enqueueReplaceState:function(a,b,c){a=a._reactInternals;var d=O(),e=tf(a),f=ge(d,e);f.tag=1;f.payload=b;void 0!==c&&null!==c&&(f.callback=c);b=he(a,f,e);null!==b&&(af(b,a,e,d),ie(b,a,e));},enqueueForceUpdate:function(a,b){a=a._reactInternals;var c=O(),d= 49066tf(a),e=ge(c,d);e.tag=2;void 0!==b&&null!==b&&(e.callback=b);b=he(a,e,d);null!==b&&(af(b,a,d,c),ie(b,a,d));}};function Af(a,b,c,d,e,f,g){a=a.stateNode;return "function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!Dd(c,d)||!Dd(e,f):true} 49067function Bf(a,b,c){var d=false,e=jc;var f=b.contextType;"object"===typeof f&&null!==f?f=Zd(f):(e=A(b)?kc:x.current,d=b.contextTypes,f=(d=null!==d&&void 0!==d)?mc(a,e):jc);b=new b(c,f);a.memoizedState=null!==b.state&&void 0!==b.state?b.state:null;b.updater=zf;a.stateNode=b;b._reactInternals=a;d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=e,a.__reactInternalMemoizedMaskedChildContext=f);return b} 49068function Cf(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&zf.enqueueReplaceState(b,b.state,null);} 49069function Df(a,b,c,d){var e=a.stateNode;e.props=c;e.state=a.memoizedState;e.refs={};ee(a);var f=b.contextType;"object"===typeof f&&null!==f?e.context=Zd(f):(f=A(b)?kc:x.current,e.context=mc(a,f));e.state=a.memoizedState;f=b.getDerivedStateFromProps;"function"===typeof f&&(yf(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||(b=e.state, 49070"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&zf.enqueueReplaceState(e,e.state,null),ke(a,c,e,d),e.state=a.memoizedState);"function"===typeof e.componentDidMount&&(a.flags|=4194308);}function Ef(a,b){try{var c="",d=b;do c+=Ed(d),d=d.return;while(d);var e=c;}catch(f){e="\nError generating stack: "+f.message+"\n"+f.stack;}return {value:a,source:b,stack:e,digest:null}} 49071function Ff(a,b,c){return {value:a,source:null,stack:null!=c?c:null,digest:null!=b?b:null}}function Gf(a,b){try{console.error(b.value);}catch(c){setTimeout(function(){throw c;});}}var Hf="function"===typeof WeakMap?WeakMap:Map;function If(a,b,c){c=ge(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Jf||(Jf=true,Kf=d);Gf(a,b);};return c} 49072function Lf(a,b,c){c=ge(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){return d(e)};c.callback=function(){Gf(a,b);};}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){Gf(a,b);"function"!==typeof d&&(null===Mf?Mf=new Set([this]):Mf.add(this));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""});});return c} 49073function Nf(a,b,c){var d=a.pingCache;if(null===d){d=a.pingCache=new Hf;var e=new Set;d.set(b,e);}else e=d.get(b),void 0===e&&(e=new Set,d.set(b,e));e.has(c)||(e.add(c),a=Of.bind(null,a,b,c),b.then(a,a));}function Pf(a){do{var b;if(b=13===a.tag)b=a.memoizedState,b=null!==b?null!==b.dehydrated?true:false:true;if(b)return a;a=a.return;}while(null!==a);return null} 49074function Qf(a,b,c,d,e){if(0===(a.mode&1))return a===b?a.flags|=65536:(a.flags|=128,c.flags|=131072,c.flags&=-52805,1===c.tag&&(null===c.alternate?c.tag=17:(b=ge(-1,1),b.tag=2,he(c,b,1))),c.lanes|=1),a;a.flags|=65536;a.lanes=e;return a}var Rf=da.ReactCurrentOwner,G=false;function P(a,b,c,d){b.child=null===a?Pd(b,null,c,d):Od(b,a.child,c,d);} 49075function Sf(a,b,c,d,e){c=c.render;var f=b.ref;Yd(b,e);d=He(a,b,c,d,f,e);c=Me();if(null!==a&&!G)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Tf(a,b,e);F&&c&&md(b);b.flags|=1;P(a,b,d,e);return b.child} 49076function Uf(a,b,c,d,e){if(null===a){var f=c.type;if("function"===typeof f&&!Vf(f)&&void 0===f.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=f,Wf(a,b,f,d,e);a=Ld(c.type,null,d,b,b.mode,e);a.ref=b.ref;a.return=b;return b.child=a}f=a.child;if(0===(a.lanes&e)){var g=f.memoizedProps;c=c.compare;c=null!==c?c:Dd;if(c(g,d)&&a.ref===b.ref)return Tf(a,b,e)}b.flags|=1;a=Jd(f,d);a.ref=b.ref;a.return=b;return b.child=a} 49077function Wf(a,b,c,d,e){if(null!==a){var f=a.memoizedProps;if(Dd(f,d)&&a.ref===b.ref)if(G=false,b.pendingProps=d=f,0!==(a.lanes&e))0!==(a.flags&131072)&&(G=true);else return b.lanes=a.lanes,Tf(a,b,e)}return Xf(a,b,c,d,e)} 49078function Yf(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if("hidden"===d.mode)if(0===(b.mode&1))b.memoizedState={baseLanes:0,cachePool:null,transitions:null},v(Zf,$f),$f|=c;else {if(0===(c&1073741824))return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a,cachePool:null,transitions:null},b.updateQueue=null,v(Zf,$f),$f|=a,null;b.memoizedState={baseLanes:0,cachePool:null,transitions:null};d=null!==f?f.baseLanes:c;v(Zf,$f);$f|=d;}else null!== 49079f?(d=f.baseLanes|c,b.memoizedState=null):d=c,v(Zf,$f),$f|=d;P(a,b,e,c);return b.child}function ag(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=512,b.flags|=2097152;}function Xf(a,b,c,d,e){var f=A(c)?kc:x.current;f=mc(b,f);Yd(b,e);c=He(a,b,c,d,f,e);d=Me();if(null!==a&&!G)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Tf(a,b,e);F&&d&&md(b);b.flags|=1;P(a,b,c,e);return b.child} 49080function bg(a,b,c,d,e){if(A(c)){var f=true;qc(b);}else f=false;Yd(b,e);if(null===b.stateNode)cg(a,b),Bf(b,c,d),Df(b,c,d,e),d=true;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;"object"===typeof l&&null!==l?l=Zd(l):(l=A(c)?kc:x.current,l=mc(b,l));var m=c.getDerivedStateFromProps,r="function"===typeof m||"function"===typeof g.getSnapshotBeforeUpdate;r||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!== 49081d||k!==l)&&Cf(b,g,d,l);de=false;var p=b.memoizedState;g.state=p;ke(b,d,g,e);k=b.memoizedState;h!==d||p!==k||z.current||de?("function"===typeof m&&(yf(b,c,m,d),k=b.memoizedState),(h=de||Af(b,c,h,d,p,k,l))?(r||"function"!==typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===typeof g.componentDidMount&&(b.flags|=4194308)): 49082("function"===typeof g.componentDidMount&&(b.flags|=4194308),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):("function"===typeof g.componentDidMount&&(b.flags|=4194308),d=false);}else {g=b.stateNode;fe(a,b);h=b.memoizedProps;l=b.type===b.elementType?h:xf(b.type,h);g.props=l;r=b.pendingProps;p=g.context;k=c.contextType;"object"===typeof k&&null!==k?k=Zd(k):(k=A(c)?kc:x.current,k=mc(b,k));var B=c.getDerivedStateFromProps;(m="function"===typeof B||"function"===typeof g.getSnapshotBeforeUpdate)|| 49083"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==r||p!==k)&&Cf(b,g,d,k);de=false;p=b.memoizedState;g.state=p;ke(b,d,g,e);var w=b.memoizedState;h!==r||p!==w||z.current||de?("function"===typeof B&&(yf(b,c,B,d),w=b.memoizedState),(l=de||Af(b,c,l,d,p,w,k)||false)?(m||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,w,k),"function"===typeof g.UNSAFE_componentWillUpdate&& 49084g.UNSAFE_componentWillUpdate(d,w,k)),"function"===typeof g.componentDidUpdate&&(b.flags|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=1024)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=1024),b.memoizedProps=d,b.memoizedState=w),g.props=d,g.state=w,g.context=k,d=l):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&p=== 49085a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=1024),d=false);}return dg(a,b,c,d,f,e)} 49086function dg(a,b,c,d,e,f){ag(a,b);var g=0!==(b.flags&128);if(!d&&!g)return e&&rc(b,c,false),Tf(a,b,f);d=b.stateNode;Rf.current=b;var h=g&&"function"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=Od(b,a.child,null,f),b.child=Od(b,null,h,f)):P(a,b,h,f);b.memoizedState=d.state;e&&rc(b,c,true);return b.child}function eg(a){var b=a.stateNode;b.pendingContext?oc(a,b.pendingContext,b.pendingContext!==b.context):b.context&&oc(a,b.context,false);se(a,b.containerInfo);} 49087function fg(a,b,c,d,e){Ad();Bd(e);b.flags|=256;P(a,b,c,d);return b.child}var gg={dehydrated:null,treeContext:null,retryLane:0};function hg(a){return {baseLanes:a,cachePool:null,transitions:null}} 49088function ig(a,b,c){var d=b.pendingProps,e=I.current,f=false,g=0!==(b.flags&128),h;(h=g)||(h=null!==a&&null===a.memoizedState?false:0!==(e&2));if(h)f=true,b.flags&=-129;else if(null===a||null!==a.memoizedState)e|=1;v(I,e&1);if(null===a){wd(b);a=b.memoizedState;if(null!==a&&(a=a.dehydrated,null!==a))return 0===(b.mode&1)?b.lanes=1:Kb(a)?b.lanes=8:b.lanes=1073741824,null;g=d.children;a=d.fallback;return f?(d=b.mode,f=b.child,g={mode:"hidden",children:g},0===(d&1)&&null!==f?(f.childLanes=0,f.pendingProps=g): 49089f=jg(g,d,0,null),a=Nd(a,d,c,null),f.return=b,a.return=b,f.sibling=a,b.child=f,b.child.memoizedState=hg(c),b.memoizedState=gg,a):kg(b,g)}e=a.memoizedState;if(null!==e&&(h=e.dehydrated,null!==h))return lg(a,b,g,d,h,e,c);if(f){f=d.fallback;g=b.mode;e=a.child;h=e.sibling;var k={mode:"hidden",children:d.children};0===(g&1)&&b.child!==e?(d=b.child,d.childLanes=0,d.pendingProps=k,b.deletions=null):(d=Jd(e,k),d.subtreeFlags=e.subtreeFlags&14680064);null!==h?f=Jd(h,f):(f=Nd(f,g,c,null),f.flags|=2);f.return= 49090b;d.return=b;d.sibling=f;b.child=d;d=f;f=b.child;g=a.child.memoizedState;g=null===g?hg(c):{baseLanes:g.baseLanes|c,cachePool:null,transitions:g.transitions};f.memoizedState=g;f.childLanes=a.childLanes&~c;b.memoizedState=gg;return d}f=a.child;a=f.sibling;d=Jd(f,{mode:"visible",children:d.children});0===(b.mode&1)&&(d.lanes=c);d.return=b;d.sibling=null;null!==a&&(c=b.deletions,null===c?(b.deletions=[a],b.flags|=16):c.push(a));b.child=d;b.memoizedState=null;return d} 49091function kg(a,b){b=jg({mode:"visible",children:b},a.mode,0,null);b.return=a;return a.child=b}function mg(a,b,c,d){null!==d&&Bd(d);Od(b,a.child,null,c);a=kg(b,b.pendingProps.children);a.flags|=2;b.memoizedState=null;return a} 49092function lg(a,b,c,d,e,f,g){if(c){if(b.flags&256)return b.flags&=-257,d=Ff(Error(n(422))),mg(a,b,g,d);if(null!==b.memoizedState)return b.child=a.child,b.flags|=128,null;f=d.fallback;e=b.mode;d=jg({mode:"visible",children:d.children},e,0,null);f=Nd(f,e,g,null);f.flags|=2;d.return=b;f.return=b;d.sibling=f;b.child=d;0!==(b.mode&1)&&Od(b,a.child,null,g);b.child.memoizedState=hg(g);b.memoizedState=gg;return f}if(0===(b.mode&1))return mg(a,b,g,null);if(Kb(e))return d=Lb(e).digest,f=Error(n(419)),d=Ff(f, 49093d,void 0),mg(a,b,g,d);c=0!==(g&a.childLanes);if(G||c){d=N;if(null!==d){switch(g&-g){case 4:e=2;break;case 16:e=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:e=32;break;case 536870912:e=268435456;break;default:e=0;}e=0!==(e&(d.suspendedLanes|g))?0:e;0!==e&&e!==f.retryLane&&(f.retryLane=e,ce(a,e),af(d,a, 49094e,-1));}ng();d=Ff(Error(n(421)));return mg(a,b,g,d)}if(Jb(e))return b.flags|=128,b.child=a.child,b=og.bind(null,a),Mb(e,b),null;a=f.treeContext;Va&&(pd=Qb(e),od=b,F=true,rd=null,qd=false,null!==a&&(fd[gd++]=id,fd[gd++]=jd,fd[gd++]=hd,id=a.id,jd=a.overflow,hd=b));b=kg(b,d.children);b.flags|=4096;return b}function pg(a,b,c){a.lanes|=b;var d=a.alternate;null!==d&&(d.lanes|=b);Xd(a.return,b,c);} 49095function qg(a,b,c,d,e){var f=a.memoizedState;null===f?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e}:(f.isBackwards=b,f.rendering=null,f.renderingStartTime=0,f.last=d,f.tail=c,f.tailMode=e);} 49096function rg(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;P(a,b,d.children,c);d=I.current;if(0!==(d&2))d=d&1|2,b.flags|=128;else {if(null!==a&&0!==(a.flags&128))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&pg(a,c,b);else if(19===a.tag)pg(a,c,b);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return;}a.sibling.return=a.return;a=a.sibling;}d&=1;}v(I,d);if(0===(b.mode&1))b.memoizedState= 49097null;else switch(e){case "forwards":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===we(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);qg(b,false,e,c,f);break;case "backwards":c=null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===we(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a;}qg(b,true,c,null,f);break;case "together":qg(b,false,null,null,void 0);break;default:b.memoizedState=null;}return b.child} 49098function cg(a,b){0===(b.mode&1)&&null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);}function Tf(a,b,c){null!==a&&(b.dependencies=a.dependencies);le|=b.lanes;if(0===(c&b.childLanes))return null;if(null!==a&&b.child!==a.child)throw Error(n(153));if(null!==b.child){a=b.child;c=Jd(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=Jd(a,a.pendingProps),c.return=b;c.sibling=null;}return b.child} 49099function sg(a,b,c){switch(b.tag){case 3:eg(b);Ad();break;case 5:ue(b);break;case 1:A(b.type)&&qc(b);break;case 4:se(b,b.stateNode.containerInfo);break;
49099case 10:Vd(b,b.type._context,b.memoizedProps.value);break;case 13:var d=b.memoizedState;if(null!==d){if(null!==d.dehydrated)return v(I,I.current&1),b.flags|=128,null;if(0!==(c&b.child.childLanes))return ig(a,b,c);v(I,I.current&1);a=Tf(a,b,c);return null!==a?a.sibling:null}v(I,I.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&128)){if(d)return rg(a, 49100b,c);b.flags|=128;}var e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);v(I,I.current);if(d)break;else return null;case 22:case 23:return b.lanes=0,Yf(a,b,c)}return Tf(a,b,c)}function tg(a){a.flags|=4;}function ug(a,b){if(null!==a&&a.child===b.child)return true;if(0!==(b.flags&16))return false;for(a=b.child;null!==a;){if(0!==(a.flags&12854)||0!==(a.subtreeFlags&12854))return false;a=a.sibling;}return true}var vg,wg,xg,yg; 49101if(Ta)vg=function(a,b){for(var c=b.child;null!==c;){if(5===c.tag||6===c.tag)Ka(a,c.stateNode);else if(4!==c.tag&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;}c.sibling.return=c.return;c=c.sibling;}},wg=function(){},xg=function(a,b,c,d,e){a=a.memoizedProps;if(a!==d){var f=b.stateNode,g=re(oe.current);c=Ma(f,c,a,d,e,g);(b.updateQueue=c)&&tg(b);}},yg=function(a,b,c,d){c!==d&&tg(b);};else if(Ua){vg=function(a, 49102b,c,d){for(var e=b.child;null!==e;){if(5===e.tag){var f=e.stateNode;c&&d&&(f=Eb(f,e.type,e.memoizedProps,e));Ka(a,f);}else if(6===e.tag)f=e.stateNode,c&&d&&(f=Fb(f,e.memoizedProps,e)),Ka(a,f);else if(4!==e.tag)if(22===e.tag&&null!==e.memoizedState)f=e.child,null!==f&&(f.return=e),vg(a,e,true,true);else if(null!==e.child){e.child.return=e;e=e.child;continue}if(e===b)break;for(;null===e.sibling;){if(null===e.return||e.return===b)return;e=e.return;}e.sibling.return=e.return;e=e.sibling;}};var zg=function(a, 49103b,c,d){for(var e=b.child;null!==e;){if(5===e.tag){var f=e.stateNode;c&&d&&(f=Eb(f,e.type,e.memoizedProps,e));Ab(a,f);}else if(6===e.tag)f=e.stateNode,c&&d&&(f=Fb(f,e.memoizedProps,e)),Ab(a,f);else if(4!==e.tag)if(22===e.tag&&null!==e.memoizedState)f=e.child,null!==f&&(f.return=e),zg(a,e,true,true);else if(null!==e.child){e.child.return=e;e=e.child;continue}if(e===b)break;for(;null===e.sibling;){if(null===e.return||e.return===b)return;e=e.return;}e.sibling.return=e.return;e=e.sibling;}};wg=function(a,b){var c= 49104b.stateNode;if(!ug(a,b)){a=c.containerInfo;var d=zb(a);zg(d,b,false,false);c.pendingChildren=d;tg(b);Bb(a,d);}};xg=function(a,b,c,d,e){var f=a.stateNode,g=a.memoizedProps;if((a=ug(a,b))&&g===d)b.stateNode=f;else {var h=b.stateNode,k=re(oe.current),l=null;g!==d&&(l=Ma(h,c,g,d,e,k));a&&null===l?b.stateNode=f:(f=yb(f,l,c,g,d,b,a,h),La(f,c,d,e,k)&&tg(b),b.stateNode=f,a?tg(b):vg(f,b,false,false));}};yg=function(a,b,c,d){c!==d?(a=re(qe.current),c=re(oe.current),b.stateNode=Oa(d,a,c,b),tg(b)):b.stateNode=a.stateNode;};}else wg= 49105function(){},xg=function(){},yg=function(){};function Ag(a,b){if(!F)switch(a.tailMode){case "hidden":b=a.tail;for(var c=null;null!==b;)null!==b.alternate&&(c=b),b=b.sibling;null===c?a.tail=null:c.sibling=null;break;case "collapsed":c=a.tail;for(var d=null;null!==c;)null!==c.alternate&&(d=c),c=c.sibling;null===d?b||null===a.tail?a.tail=null:a.tail.sibling=null:d.sibling=null;}} 49106function Q(a){var b=null!==a.alternate&&a.alternate.child===a.child,c=0,d=0;if(b)for(var e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=e.subtreeFlags&14680064,d|=e.flags&14680064,e.return=a,e=e.sibling;else for(e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=e.subtreeFlags,d|=e.flags,e.return=a,e=e.sibling;a.subtreeFlags|=d;a.childLanes=c;return b} 49107function Bg(a,b,c){var d=b.pendingProps;nd(b);switch(b.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Q(b),null;case 1:return A(b.type)&&nc(),Q(b),null;case 3:c=b.stateNode;te();q(z);q(x);ye();c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null);if(null===a||null===a.child)yd(b)?tg(b):null===a||a.memoizedState.isDehydrated&&0===(b.flags&256)||(b.flags|=1024,null!==rd&&(Cg(rd),rd=null));wg(a,b);Q(b);return null;case 5:ve(b);c=re(qe.current);var e= 49108b.type;if(null!==a&&null!=b.stateNode)xg(a,b,e,d,c),a.ref!==b.ref&&(b.flags|=512,b.flags|=2097152);else {if(!d){if(null===b.stateNode)throw Error(n(166));Q(b);return null}a=re(oe.current);
vendor: 11,686 bytes, lines 49108-49133
49108if(yd(b)){if(!Va)throw Error(n(175));a=Rb(b.stateNode,b.type,b.memoizedProps,c,a,b,!qd);b.updateQueue=a;null!==a&&tg(b);}else {var f=Ja(e,d,c,a,b);vg(f,b,false,false);b.stateNode=f;La(f,e,d,c,a)&&tg(b);}null!==b.ref&&(b.flags|=512,b.flags|=2097152);}Q(b);return null;case 6:if(a&&null!=b.stateNode)yg(a,b,a.memoizedProps,d); 49109else {if("string"!==typeof d&&null===b.stateNode)throw Error(n(166));a=re(qe.current);c=re(oe.current);if(yd(b)){if(!Va)throw Error(n(176));a=b.stateNode;c=b.memoizedProps;if(d=Sb(a,c,b,!qd))if(e=od,null!==e)switch(e.tag){case 3:$b(e.stateNode.containerInfo,a,c,0!==(e.mode&1));break;case 5:ac(e.type,e.memoizedProps,e.stateNode,a,c,0!==(e.mode&1));}d&&tg(b);}else b.stateNode=Oa(d,a,c,b);}Q(b);return null;case 13:q(I);d=b.memoizedState;if(null===a||null!==a.memoizedState&&null!==a.memoizedState.dehydrated){if(F&& 49110null!==pd&&0!==(b.mode&1)&&0===(b.flags&128))zd(),Ad(),b.flags|=98560,e=false;else if(e=yd(b),null!==d&&null!==d.dehydrated){if(null===a){if(!e)throw Error(n(318));if(!Va)throw Error(n(344));e=b.memoizedState;e=null!==e?e.dehydrated:null;if(!e)throw Error(n(317));Tb(e,b);}else Ad(),0===(b.flags&128)&&(b.memoizedState=null),b.flags|=4;Q(b);e=false;}else null!==rd&&(Cg(rd),rd=null),e=true;if(!e)return b.flags&65536?b:null}if(0!==(b.flags&128))return b.lanes=c,b;c=null!==d;c!==(null!==a&&null!==a.memoizedState)&& 49111c&&(b.child.flags|=8192,0!==(b.mode&1)&&(null===a||0!==(I.current&1)?0===R&&(R=3):ng()));null!==b.updateQueue&&(b.flags|=4);Q(b);return null;case 4:return te(),wg(a,b),null===a&&Xa(b.stateNode.containerInfo),Q(b),null;case 10:return Wd(b.type._context),Q(b),null;case 17:return A(b.type)&&nc(),Q(b),null;case 19:q(I);e=b.memoizedState;if(null===e)return Q(b),null;d=0!==(b.flags&128);f=e.rendering;if(null===f)if(d)Ag(e,false);else {if(0!==R||null!==a&&0!==(a.flags&128))for(a=b.child;null!==a;){f=we(a);if(null!== 49112f){b.flags|=128;Ag(e,false);a=f.updateQueue;null!==a&&(b.updateQueue=a,b.flags|=4);b.subtreeFlags=0;a=c;for(c=b.child;null!==c;)d=c,e=a,d.flags&=14680066,f=d.alternate,null===f?(d.childLanes=0,d.lanes=e,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=f.childLanes,d.lanes=f.lanes,d.child=f.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=f.memoizedProps,d.memoizedState=f.memoizedState,d.updateQueue=f.updateQueue, 49113d.type=f.type,e=f.dependencies,d.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),c=c.sibling;v(I,I.current&1|2);return b.child}a=a.sibling;}null!==e.tail&&D()>Dg&&(b.flags|=128,d=true,Ag(e,false),b.lanes=4194304);}else {if(!d)if(a=we(f),null!==a){if(b.flags|=128,d=true,a=a.updateQueue,null!==a&&(b.updateQueue=a,b.flags|=4),Ag(e,true),null===e.tail&&"hidden"===e.tailMode&&!f.alternate&&!F)return Q(b),null}else 2*D()-e.renderingStartTime>Dg&&1073741824!==c&&(b.flags|=128,d=true,Ag(e,false),b.lanes= 491144194304);e.isBackwards?(f.sibling=b.child,b.child=f):(a=e.last,null!==a?a.sibling=f:b.child=f,e.last=f);}if(null!==e.tail)return b=e.tail,e.rendering=b,e.tail=b.sibling,e.renderingStartTime=D(),b.sibling=null,a=I.current,v(I,d?a&1|2:a&1),b;Q(b);return null;case 22:case 23:return Eg(),c=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==c&&(b.flags|=8192),c&&0!==(b.mode&1)?0!==($f&1073741824)&&(Q(b),Ta&&b.subtreeFlags&6&&(b.flags|=8192)):Q(b),null;case 24:return null;case 25:return null}throw Error(n(156, 49115b.tag));} 49116function Fg(a,b){nd(b);switch(b.tag){case 1:return A(b.type)&&nc(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return te(),q(z),q(x),ye(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return ve(b),null;case 13:q(I);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(n(340));Ad();}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return q(I),null;case 4:return te(),null;case 10:return Wd(b.type._context),null;case 22:case 23:return Eg(), 49117null;case 24:return null;default:return null}}var Gg=false,S=false,Hg="function"===typeof WeakSet?WeakSet:Set,T=null;function Ig(a,b){var c=a.ref;if(null!==c)if("function"===typeof c)try{c(null);}catch(d){U(a,b,d);}else c.current=null;}function Jg(a,b,c){try{c();}catch(d){U(a,b,d);}}var Kg=false; 49118function Lg(a,b){Ha(a.containerInfo);for(T=b;null!==T;)if(a=T,b=a.child,0!==(a.subtreeFlags&1028)&&null!==b)b.return=a,T=b;else for(;null!==T;){a=T;try{var c=a.alternate;if(0!==(a.flags&1024))switch(a.tag){case 0:case 11:case 15:break;case 1:if(null!==c){var d=c.memoizedProps,e=c.memoizedState,f=a.stateNode,g=f.getSnapshotBeforeUpdate(a.elementType===a.type?d:xf(a.type,d),e);f.__reactInternalSnapshotBeforeUpdate=g;}break;case 3:Ta&&xb(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break; 49119default:throw Error(n(163));}}catch(h){U(a,a.return,h);}b=a.sibling;if(null!==b){b.return=a.return;T=b;break}T=a.return;}c=Kg;Kg=false;return c}function Mg(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Jg(b,c,f);}e=e.next;}while(e!==d)}}function Ng(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d();}c=c.next;}while(c!==b)}} 49120function Og(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=Ea(c);break;default:a=c;}"function"===typeof b?b(a):b.current=a;}}function Pg(a){var b=a.alternate;null!==b&&(a.alternate=null,Pg(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&Za(b));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null;} 49121function Qg(a){return 5===a.tag||3===a.tag||4===a.tag}function Rg(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Qg(a.return))return null;a=a.return;}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child;}if(!(a.flags&2))return a.stateNode}} 49122function Sg(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?pb(c,a,b):kb(c,a);else if(4!==d&&(a=a.child,null!==a))for(Sg(a,b,c),a=a.sibling;null!==a;)Sg(a,b,c),a=a.sibling;}function Tg(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?ob(c,a,b):jb(c,a);else if(4!==d&&(a=a.child,null!==a))for(Tg(a,b,c),a=a.sibling;null!==a;)Tg(a,b,c),a=a.sibling;}var V=null,Ug=false;function Vg(a,b,c){for(c=c.child;null!==c;)Wg(a,b,c),c=c.sibling;} 49123function Wg(a,b,c){if(Sc&&"function"===typeof Sc.onCommitFiberUnmount)try{Sc.onCommitFiberUnmount(Rc,c);}catch(h){}switch(c.tag){case 5:S||Ig(c,b);case 6:if(Ta){var d=V,e=Ug;V=null;Vg(a,b,c);V=d;Ug=e;null!==V&&(Ug?rb(V,c.stateNode):qb(V,c.stateNode));}else Vg(a,b,c);break;case 18:Ta&&null!==V&&(Ug?Yb(V,c.stateNode):Xb(V,c.stateNode));break;case 4:Ta?(d=V,e=Ug,V=c.stateNode.containerInfo,Ug=true,Vg(a,b,c),V=d,Ug=e):(Ua&&(d=c.stateNode.containerInfo,e=zb(d),Cb(d,e)),Vg(a,b,c));break;case 0:case 11:case 14:case 15:if(!S&& 49124(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Jg(c,b,g):0!==(f&4)&&Jg(c,b,g));e=e.next;}while(e!==d)}Vg(a,b,c);break;case 1:if(!S&&(Ig(c,b),d=c.stateNode,"function"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount();}catch(h){U(c,b,h);}Vg(a,b,c);break;case 21:Vg(a,b,c);break;case 22:c.mode&1?(S=(d=S)||null!==c.memoizedState,Vg(a,b,c),S=d):Vg(a,b,c);break;default:Vg(a,b, 49125c);}}function Xg(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Hg);b.forEach(function(b){var d=Yg.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d));});}} 49126function Zg(a,b){var c=b.deletions;if(null!==c)for(var d=0;d<c.length;d++){var e=c[d];try{var f=a,g=b;if(Ta){var h=g;a:for(;null!==h;){switch(h.tag){case 5:V=h.stateNode;Ug=!1;break a;case 3:V=h.stateNode.containerInfo;Ug=!0;break a;case 4:V=h.stateNode.containerInfo;Ug=!0;break a}h=h.return;}if(null===V)throw Error(n(160));Wg(f,g,e);V=null;Ug=!1;}else Wg(f,g,e);var k=e.alternate;null!==k&&(k.return=null);e.return=null;}catch(l){U(e,b,l);}}if(b.subtreeFlags&12854)for(b=b.child;null!==b;)$g(b,a),b=b.sibling;} 49127function $g(a,b){var c=a.alternate,d=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Zg(b,a);ah(a);if(d&4){try{Mg(3,a,a.return),Ng(3,a);}catch(p){U(a,a.return,p);}try{Mg(5,a,a.return);}catch(p){U(a,a.return,p);}}break;case 1:Zg(b,a);ah(a);d&512&&null!==c&&Ig(c,c.return);break;case 5:Zg(b,a);ah(a);d&512&&null!==c&&Ig(c,c.return);if(Ta){if(a.flags&32){var e=a.stateNode;try{sb(e);}catch(p){U(a,a.return,p);}}if(d&4&&(e=a.stateNode,null!=e)){var f=a.memoizedProps;c=null!==c?c.memoizedProps:f;d=a.type;b= 49128a.updateQueue;a.updateQueue=null;if(null!==b)try{nb(e,b,d,c,f,a);}catch(p){U(a,a.return,p);}}}break;case 6:Zg(b,a);ah(a);if(d&4&&Ta){if(null===a.stateNode)throw Error(n(162));e=a.stateNode;f=a.memoizedProps;c=null!==c?c.memoizedProps:f;try{lb(e,c,f);}catch(p){U(a,a.return,p);}}break;case 3:Zg(b,a);ah(a);if(d&4){if(Ta&&Va&&null!==c&&c.memoizedState.isDehydrated)try{Vb(b.containerInfo);}catch(p){U(a,a.return,p);}if(Ua){e=b.containerInfo;f=b.pendingChildren;try{Cb(e,f);}catch(p){U(a,a.return,p);}}}break;case 4:Zg(b, 49129a);ah(a);if(d&4&&Ua){f=a.stateNode;e=f.containerInfo;f=f.pendingChildren;try{Cb(e,f);}catch(p){U(a,a.return,p);}}break;case 13:Zg(b,a);ah(a);e=a.child;e.flags&8192&&(f=null!==e.memoizedState,e.stateNode.isHidden=f,!f||null!==e.alternate&&null!==e.alternate.memoizedState||(bh=D()));d&4&&Xg(a);break;case 22:var g=null!==c&&null!==c.memoizedState;a.mode&1?(S=(c=S)||g,Zg(b,a),S=c):Zg(b,a);ah(a);if(d&8192){c=null!==a.memoizedState;if((a.stateNode.isHidden=c)&&!g&&0!==(a.mode&1))for(T=a,d=a.child;null!== 49130d;){for(b=T=d;null!==T;){g=T;var h=g.child;switch(g.tag){case 0:case 11:case 14:case 15:Mg(4,g,g.return);break;case 1:Ig(g,g.return);var k=g.stateNode;if("function"===typeof k.componentWillUnmount){var l=g,m=g.return;try{var r=l;k.props=r.memoizedProps;k.state=r.memoizedState;k.componentWillUnmount();}catch(p){U(l,m,p);}}break;case 5:Ig(g,g.return);break;case 22:if(null!==g.memoizedState){ch(b);continue}}null!==h?(h.return=g,T=h):ch(b);}d=d.sibling;}if(Ta)a:if(d=null,Ta)for(b=a;;){if(5===b.tag){if(null=== 49131d){d=b;try{e=b.stateNode,c?tb(e):vb(b.stateNode,b.memoizedProps);}catch(p){U(a,a.return,p);}}}else if(6===b.tag){if(null===d)try{f=b.stateNode,c?ub(f):wb(f,b.memoizedProps);}catch(p){U(a,a.return,p);}}else if((22!==b.tag&&23!==b.tag||null===b.memoizedState||b===a)&&null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break a;for(;null===b.sibling;){if(null===b.return||b.return===a)break a;d===b&&(d=null);b=b.return;}d===b&&(d=null);b.sibling.return=b.return;b=b.sibling;}}break;case 19:Zg(b,a);ah(a); 49132d&4&&Xg(a);break;case 21:break;default:Zg(b,a),ah(a);}}function ah(a){var b=a.flags;if(b&2){try{if(Ta){b:{for(var c=a.return;null!==c;){if(Qg(c)){var d=c;break b}c=c.return;}throw Error(n(160));}switch(d.tag){case 5:var e=d.stateNode;d.flags&32&&(sb(e),d.flags&=-33);var f=Rg(a);Tg(a,f,e);break;case 3:case 4:var g=d.stateNode.containerInfo,h=Rg(a);Sg(a,h,g);break;default:throw Error(n(161));}}}catch(k){U(a,a.return,k);}a.flags&=-3;}b&4096&&(a.flags&=-4097);}function dh(a,b,c){T=a;eh(a);} 49133function eh(a,b,c){for(var d=0!==(a.mode&1);null!==T;){var e=T,f=e.child;if(22===e.tag&&d){var g=null!==e.memoizedState||Gg;if(!g){var h=e.alternate,k=null!==h&&null!==h.memoizedState||S;h=Gg;var l=S;Gg=g;if((S=k)&&!l)for(T=e;null!==T;)g=T,k=g.child,22===g.tag&&null!==g.memoizedState?fh(e):null!==k?(k.return=g,T=k):fh(e);for(;null!==f;
49133)T=f,eh(f),f=f.sibling;T=e;Gg=h;S=l;}gh(a);}else 0!==(e.subtreeFlags&8772)&&null!==f?(f.return=e,T=f):gh(a);}} 49134function gh(a){for(;null!==T;){var b=T;if(0!==(b.flags&8772)){var c=b.alternate;try{if(0!==(b.flags&8772))switch(b.tag){case 0:case 11:case 15:S||Ng(5,b);break;case 1:var d=b.stateNode;if(b.flags&4&&!S)if(null===c)d.componentDidMount();else {var e=b.elementType===b.type?c.memoizedProps:xf(b.type,c.memoizedProps);d.componentDidUpdate(e,c.memoizedState,d.__reactInternalSnapshotBeforeUpdate);}var f=b.updateQueue;null!==f&&me(b,f,d);break;case 3:var g=b.updateQueue;if(null!==g){c=null;if(null!==b.child)switch(b.child.tag){case 5:c= 49135Ea(b.child.stateNode);break;case 1:c=b.child.stateNode;}me(b,g,c);}break;case 5:var h=b.stateNode;null===c&&b.flags&4&&mb(h,b.type,b.memoizedProps,b);break;case 6:break;case 4:break;case 12:break;case 13:if(Va&&null===b.memoizedState){var k=b.alternate;if(null!==k){var l=k.memoizedState;if(null!==l){var m=l.dehydrated;null!==m&&Wb(m);}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163));}S||b.flags&512&&Og(b);}catch(r){U(b,b.return,r);}}if(b===a){T=null;break}c=b.sibling; 49136if(null!==c){c.return=b.return;T=c;break}T=b.return;}}function ch(a){for(;null!==T;){var b=T;if(b===a){T=null;break}var c=b.sibling;if(null!==c){c.return=b.return;T=c;break}T=b.return;}} 49137function fh(a){for(;null!==T;){var b=T;try{switch(b.tag){case 0:case 11:case 15:var c=b.return;try{Ng(4,b);}catch(k){U(b,c,k);}break;case 1:var d=b.stateNode;if("function"===typeof d.componentDidMount){var e=b.return;try{d.componentDidMount();}catch(k){U(b,e,k);}}var f=b.return;try{Og(b);}catch(k){U(b,f,k);}break;case 5:var g=b.return;try{Og(b);}catch(k){U(b,g,k);}}}catch(k){U(b,b.return,k);}if(b===a){T=null;break}var h=b.sibling;if(null!==h){h.return=b.return;T=h;break}T=b.return;}} 49138var hh=0,ih=1,jh=2,kh=3,lh=4;if("function"===typeof Symbol&&Symbol.for){var mh=Symbol.for;hh=mh("selector.component");ih=mh("selector.has_pseudo_class");jh=mh("selector.role");kh=mh("selector.test_id");lh=mh("selector.text");}function nh(a){var b=Wa(a);if(null!=b){if("string"!==typeof b.memoizedProps["data-testname"])throw Error(n(364));return b}a=cb(a);if(null===a)throw Error(n(362));return a.stateNode.current} 49139function oh(a,b){switch(b.$$typeof){case hh:if(a.type===b.value)return true;break;case ih:a:{b=b.value;a=[a,0];for(var c=0;c<a.length;){var d=a[c++],e=a[c++],f=b[e];if(5!==d.tag||!fb(d)){for(;null!=f&&oh(d,f);)e++,f=b[e];if(e===b.length){b=true;break a}else for(d=d.child;null!==d;)a.push(d,e),d=d.sibling;}}b=false;}return b;case jh:if(5===a.tag&&gb(a.stateNode,b.value))return true;break;case lh:if(5===a.tag||6===a.tag)if(a=eb(a),null!==a&&0<=a.indexOf(b.value))return true;break;case kh:if(5===a.tag&&(a=a.memoizedProps["data-testname"], 49140"string"===typeof a&&a.toLowerCase()===b.value.toLowerCase()))return true;break;default:throw Error(n(365));}return false}function ph(a){switch(a.$$typeof){case hh:return "<"+(ua(a.value)||"Unknown")+">";case ih:return ":has("+(ph(a)||"")+")";case jh:return '[role="'+a.value+'"]';case lh:return '"'+a.value+'"';case kh:return '[data-testname="'+a.value+'"]';default:throw Error(n(365));}} 49141function qh(a,b){var c=[];a=[a,0];for(var d=0;d<a.length;){var e=a[d++],f=a[d++],g=b[f];if(5!==e.tag||!fb(e)){for(;null!=g&&oh(e,g);)f++,g=b[f];if(f===b.length)c.push(e);else for(e=e.child;null!==e;)a.push(e,f),e=e.sibling;}}return c}function rh(a,b){if(!bb)throw Error(n(363));a=nh(a);a=qh(a,b);b=[];a=Array.from(a);for(var c=0;c<a.length;){var d=a[c++];if(5===d.tag)fb(d)||b.push(d.stateNode);else for(d=d.child;null!==d;)a.push(d),d=d.sibling;}return b} 49142var sh=Math.ceil,th=da.ReactCurrentDispatcher,uh=da.ReactCurrentOwner,W=da.ReactCurrentBatchConfig,H=0,N=null,X=null,Z=0,$f=0,Zf=ic(0),R=0,vh=null,le=0,wh=0,xh=0,yh=null,zh=null,bh=0,Dg=Infinity,Ah=null;function Bh(){Dg=D()+500;}var Jf=false,Kf=null,Mf=null,Ch=false,Dh=null,Eh=0,Fh=0,Gh=null,Hh=-1,Ih=0;function O(){return 0!==(H&6)?D():-1!==Hh?Hh:Hh=D()}function tf(a){if(0===(a.mode&1))return 1;if(0!==(H&2)&&0!==Z)return Z&-Z;if(null!==Cd.transition)return 0===Ih&&(Ih=Dc()),Ih;a=C;return 0!==a?a:Ya()} 49143function af(a,b,c,d){if(50<Fh)throw Fh=0,Gh=null,Error(n(185));Fc(a,c,d);if(0===(H&2)||a!==N)a===N&&(0===(H&2)&&(wh|=c),4===R&&Jh(a,Z)),Kh(a,d),1===c&&0===H&&0===(b.mode&1)&&(Bh(),Xc&&ad());} 49144function Kh(a,b){var c=a.callbackNode;Bc(a,b);var d=zc(a,a===N?Z:0);if(0===d)null!==c&&Kc(c),a.callbackNode=null,a.callbackPriority=0;else if(b=d&-d,a.callbackPriority!==b){null!=c&&Kc(c);if(1===b)0===a.tag?$c(Lh.bind(null,a)):Zc(Lh.bind(null,a)),$a?ab(function(){0===(H&6)&&ad();}):Jc(Nc,ad),c=null;else {switch(Ic(d)){case 1:c=Nc;break;case 4:c=Oc;break;case 16:c=Pc;break;case 536870912:c=Qc;break;default:c=Pc;}c=Mh(c,Nh.bind(null,a));}a.callbackPriority=b;a.callbackNode=c;}} 49145function Nh(a,b){Hh=-1;Ih=0;if(0!==(H&6))throw Error(n(327));var c=a.callbackNode;if(Oh()&&a.callbackNode!==c)return null;var d=zc(a,a===N?Z:0);if(0===d)return null;if(0!==(d&30)||0!==(d&a.expiredLanes)||b)b=Ph(a,d);else {b=d;var e=H;H|=2;var f=Qh();if(N!==a||Z!==b)Ah=null,Bh(),Rh(a,b);do try{Sh();break}catch(h){Th(a,h);}while(1);Ud();th.current=f;H=e;null!==X?b=0:(N=null,Z=0,b=R);}if(0!==b){2===b&&(e=Cc(a),0!==e&&(d=e,b=Uh(a,e)));if(1===b)throw c=vh,Rh(a,0),Jh(a,d),Kh(a,D()),c;if(6===b)Jh(a,d);else {e= 49146a.current.alternate;if(0===(d&30)&&!Vh(e)&&(b=Ph(a,d),2===b&&(f=Cc(a),0!==f&&(d=f,b=Uh(a,f))),1===b))throw c=vh,Rh(a,0),Jh(a,d),Kh(a,D()),c;a.finishedWork=e;a.finishedLanes=d;switch(b){case 0:case 1:throw Error(n(345));case 2:Wh(a,zh,Ah);break;case 3:Jh(a,d);if((d&130023424)===d&&(b=bh+500-D(),10<b)){if(0!==zc(a,0))break;e=a.suspendedLanes;if((e&d)!==d){O();a.pingedLanes|=a.suspendedLanes&e;break}a.timeoutHandle=Pa(Wh.bind(null,a,zh,Ah),b);break}Wh(a,zh,Ah);break;case 4:Jh(a,d);if((d&4194240)===d)break; 49147b=a.eventTimes;for(e=-1;0<d;){var g=31-tc(d);f=1<<g;g=b[g];g>e&&(e=g);d&=~f;}d=e;d=D()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*sh(d/1960))-d;if(10<d){a.timeoutHandle=Pa(Wh.bind(null,a,zh,Ah),d);break}Wh(a,zh,Ah);break;case 5:Wh(a,zh,Ah);break;default:throw Error(n(329));}}}Kh(a,D());return a.callbackNode===c?Nh.bind(null,a):null} 49148function Uh(a,b){var c=yh;a.current.memoizedState.isDehydrated&&(Rh(a,b).flags|=256);a=Ph(a,b);
vendor: 15,449 bytes, lines 49148-49185
491482!==a&&(b=zh,zh=c,null!==b&&Cg(b));return a}function Cg(a){null===zh?zh=a:zh.push.apply(zh,a);} 49149function Vh(a){for(var b=a;;){if(b.flags&16384){var c=b.updateQueue;if(null!==c&&(c=c.stores,null!==c))for(var d=0;d<c.length;d++){var e=c[d],f=e.getSnapshot;e=e.value;try{if(!Vc(f(),e))return !1}catch(g){return false}}}c=b.child;if(b.subtreeFlags&16384&&null!==c)c.return=b,b=c;else {if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return true;b=b.return;}b.sibling.return=b.return;b=b.sibling;}}return true} 49150function Jh(a,b){b&=~xh;b&=~wh;a.suspendedLanes|=b;a.pingedLanes&=~b;for(a=a.expirationTimes;0<b;){var c=31-tc(b),d=1<<c;a[c]=-1;b&=~d;}}function Lh(a){if(0!==(H&6))throw Error(n(327));Oh();var b=zc(a,0);if(0===(b&1))return Kh(a,D()),null;var c=Ph(a,b);if(0!==a.tag&&2===c){var d=Cc(a);0!==d&&(b=d,c=Uh(a,d));}if(1===c)throw c=vh,Rh(a,0),Jh(a,b),Kh(a,D()),c;if(6===c)throw Error(n(345));a.finishedWork=a.current.alternate;a.finishedLanes=b;Wh(a,zh,Ah);Kh(a,D());return null} 49151function Xh(a){null!==Dh&&0===Dh.tag&&0===(H&6)&&Oh();var b=H;H|=1;var c=W.transition,d=C;try{if(W.transition=null,C=1,a)return a()}finally{C=d,W.transition=c,H=b,0===(H&6)&&ad();}}function Eg(){$f=Zf.current;q(Zf);} 49152function Rh(a,b){a.finishedWork=null;a.finishedLanes=0;var c=a.timeoutHandle;c!==Ra&&(a.timeoutHandle=Ra,Qa(c));if(null!==X)for(c=X.return;null!==c;){var d=c;nd(d);switch(d.tag){case 1:d=d.type.childContextTypes;null!==d&&void 0!==d&&nc();break;case 3:te();q(z);q(x);ye();break;case 5:ve(d);break;case 4:te();break;case 13:q(I);break;case 19:q(I);break;case 10:Wd(d.type._context);break;case 22:case 23:Eg();}c=c.return;}N=a;X=a=Jd(a.current,null);Z=$f=b;R=0;vh=null;xh=wh=le=0;zh=yh=null;if(null!==$d){for(b= 491530;b<$d.length;b++)if(c=$d[b],d=c.interleaved,null!==d){c.interleaved=null;var e=d.next,f=c.pending;if(null!==f){var g=f.next;f.next=e;d.next=g;}c.pending=d;}$d=null;}return a} 49154function Th(a,b){do{var c=X;try{Ud();ze.current=Le;if(Ce){for(var d=J.memoizedState;null!==d;){var e=d.queue;null!==e&&(e.pending=null);d=d.next;}Ce=!1;}Be=0;L=K=J=null;De=!1;Ee=0;uh.current=null;if(null===c||null===c.return){R=1;vh=b;X=null;break}a:{var f=a,g=c.return,h=c,k=b;b=Z;h.flags|=32768;if(null!==k&&"object"===typeof k&&"function"===typeof k.then){var l=k,m=h,r=m.tag;if(0===(m.mode&1)&&(0===r||11===r||15===r)){var p=m.alternate;p?(m.updateQueue=p.updateQueue,m.memoizedState=p.memoizedState, 49155m.lanes=p.lanes):(m.updateQueue=null,m.memoizedState=null);}var B=Pf(g);if(null!==B){B.flags&=-257;Qf(B,g,h,f,b);B.mode&1&&Nf(f,l,b);b=B;k=l;var w=b.updateQueue;if(null===w){var Y=new Set;Y.add(k);b.updateQueue=Y;}else w.add(k);break a}else {if(0===(b&1)){Nf(f,l,b);ng();break a}k=Error(n(426));}}else if(F&&h.mode&1){var ya=Pf(g);if(null!==ya){0===(ya.flags&65536)&&(ya.flags|=256);Qf(ya,g,h,f,b);Bd(Ef(k,h));break a}}f=k=Ef(k,h);4!==R&&(R=2);null===yh?yh=[f]:yh.push(f);f=g;do{switch(f.tag){case 3:f.flags|= 4915665536;b&=-b;f.lanes|=b;var E=If(f,k,b);je(f,E);break a;case 1:h=k;var u=f.type,t=f.stateNode;if(0===(f.flags&128)&&("function"===typeof u.getDerivedStateFromError||null!==t&&"function"===typeof t.componentDidCatch&&(null===Mf||!Mf.has(t)))){f.flags|=65536;b&=-b;f.lanes|=b;var Db=Lf(f,h,b);je(f,Db);break a}}f=f.return;}while(null!==f)}Yh(c);}catch(lc){b=lc;X===c&&null!==c&&(X=c=c.return);continue}break}while(1)}function Qh(){var a=th.current;th.current=Le;return null===a?Le:a} 49157function ng(){if(0===R||3===R||2===R)R=4;null===N||0===(le&268435455)&&0===(wh&268435455)||Jh(N,Z);}function Ph(a,b){var c=H;H|=2;var d=Qh();if(N!==a||Z!==b)Ah=null,Rh(a,b);do try{Zh();break}catch(e){Th(a,e);}while(1);Ud();H=c;th.current=d;if(null!==X)throw Error(n(261));N=null;Z=0;return R}function Zh(){for(;null!==X;)$h(X);}function Sh(){for(;null!==X&&!Lc();)$h(X);}function $h(a){var b=ai(a.alternate,a,$f);a.memoizedProps=a.pendingProps;null===b?Yh(a):X=b;uh.current=null;} 49158function Yh(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&32768)){if(c=Bg(c,b,$f),null!==c){X=c;return}}else {c=Fg(c,b);if(null!==c){c.flags&=32767;X=c;return}if(null!==a)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else {R=6;X=null;return}}b=b.sibling;if(null!==b){X=b;return}X=b=a;}while(null!==b);0===R&&(R=5);}function Wh(a,b,c){var d=C,e=W.transition;try{W.transition=null,C=1,bi(a,b,c,d);}finally{W.transition=e,C=d;}return null} 49159function bi(a,b,c,d){do Oh();while(null!==Dh);if(0!==(H&6))throw Error(n(327));c=a.finishedWork;var e=a.finishedLanes;if(null===c)return null;a.finishedWork=null;a.finishedLanes=0;if(c===a.current)throw Error(n(177));a.callbackNode=null;a.callbackPriority=0;var f=c.lanes|c.childLanes;Gc(a,f);a===N&&(X=N=null,Z=0);0===(c.subtreeFlags&2064)&&0===(c.flags&2064)||Ch||(Ch=true,Mh(Pc,function(){Oh();return null}));f=0!==(c.flags&15990);if(0!==(c.subtreeFlags&15990)||f){f=W.transition;W.transition=null;var g= 49160C;C=1;var h=H;H|=4;uh.current=null;Lg(a,c);$g(c,a);Ia(a.containerInfo);a.current=c;dh(c);Mc();H=h;C=g;W.transition=f;}else a.current=c;Ch&&(Ch=false,Dh=a,Eh=e);f=a.pendingLanes;0===f&&(Mf=null);Tc(c.stateNode);Kh(a,D());if(null!==b)for(d=a.onRecoverableError,c=0;c<b.length;c++)e=b[c],d(e.value,{componentStack:e.stack,digest:e.digest});if(Jf)throw Jf=false,a=Kf,Kf=null,a;0!==(Eh&1)&&0!==a.tag&&Oh();f=a.pendingLanes;0!==(f&1)?a===Gh?Fh++:(Fh=0,Gh=a):Fh=0;ad();return null} 49161function Oh(){if(null!==Dh){var a=Ic(Eh),b=W.transition,c=C;try{W.transition=null;C=16>a?16:a;if(null===Dh)var d=!1;else {a=Dh;Dh=null;Eh=0;if(0!==(H&6))throw Error(n(331));var e=H;H|=4;for(T=a.current;null!==T;){var f=T,g=f.child;if(0!==(T.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;k<h.length;k++){var l=h[k];for(T=l;null!==T;){var m=T;switch(m.tag){case 0:case 11:case 15:Mg(8,m,f);}var r=m.child;if(null!==r)r.return=m,T=r;else for(;null!==T;){m=T;var p=m.sibling,B=m.return;Pg(m);if(m=== 49162l){T=null;break}if(null!==p){p.return=B;T=p;break}T=B;}}}var w=f.alternate;if(null!==w){var Y=w.child;if(null!==Y){w.child=null;do{var ya=Y.sibling;Y.sibling=null;Y=ya;}while(null!==Y)}}T=f;}}if(0!==(f.subtreeFlags&2064)&&null!==g)g.return=f,T=g;else b:for(;null!==T;){f=T;if(0!==(f.flags&2048))switch(f.tag){case 0:case 11:case 15:Mg(9,f,f.return);}var E=f.sibling;if(null!==E){E.return=f.return;T=E;break b}T=f.return;}}var u=a.current;for(T=u;null!==T;){g=T;var t=g.child;if(0!==(g.subtreeFlags&2064)&&null!== 49163t)t.return=g,T=t;else b:for(g=u;null!==T;){h=T;if(0!==(h.flags&2048))try{switch(h.tag){case 0:case 11:case 15:Ng(9,h);}}catch(lc){U(h,h.return,lc);}if(h===g){T=null;break b}var Db=h.sibling;if(null!==Db){Db.return=h.return;T=Db;break b}T=h.return;}}H=e;ad();if(Sc&&"function"===typeof Sc.onPostCommitFiberRoot)try{Sc.onPostCommitFiberRoot(Rc,a);}catch(lc){}d=!0;}return d}finally{C=c,W.transition=b;}}return false}function ci(a,b,c){b=Ef(c,b);b=If(a,b,1);a=he(a,b,1);b=O();null!==a&&(Fc(a,1,b),Kh(a,b));} 49164function U(a,b,c){if(3===a.tag)ci(a,a,c);else for(;null!==b;){if(3===b.tag){ci(b,a,c);break}else if(1===b.tag){var d=b.stateNode;if("function"===typeof b.type.getDerivedStateFromError||"function"===typeof d.componentDidCatch&&(null===Mf||!Mf.has(d))){a=Ef(c,a);a=Lf(b,a,1);b=he(b,a,1);a=O();null!==b&&(Fc(b,1,a),Kh(b,a));break}}b=b.return;}} 49165function Of(a,b,c){var d=a.pingCache;null!==d&&d.delete(b);b=O();a.pingedLanes|=a.suspendedLanes&c;N===a&&(Z&c)===c&&(4===R||3===R&&(Z&130023424)===Z&&500>D()-bh?Rh(a,0):xh|=c);Kh(a,b);}function di(a,b){0===b&&(0===(a.mode&1)?b=1:(b=xc,xc<<=1,0===(xc&130023424)&&(xc=4194304)));var c=O();a=ce(a,b);null!==a&&(Fc(a,b,c),Kh(a,c));}function og(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);di(a,c);} 49166function Yg(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(n(314));}null!==d&&d.delete(b);di(a,c);}var ai; 49167ai=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||z.current)G=true;else {if(0===(a.lanes&c)&&0===(b.flags&128))return G=false,sg(a,b,c);G=0!==(a.flags&131072)?true:false;}else G=false,F&&0!==(b.flags&1048576)&&ld(b,ed,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;cg(a,b);a=b.pendingProps;var e=mc(b,x.current);Yd(b,c);e=He(null,b,d,a,e,c);var f=Me();b.flags|=1;"object"===typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=null, 49168A(d)?(f=true,qc(b)):f=false,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,ee(b),e.updater=zf,b.stateNode=e,e._reactInternals=b,Df(b,d,a,c),b=dg(null,b,d,true,f,c)):(b.tag=0,F&&f&&md(b),P(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{cg(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=ei(d);a=xf(d,a);switch(e){case 0:b=Xf(null,b,d,a,c);break a;case 1:b=bg(null,b,d,a,c);break a;case 11:b=Sf(null,b,d,a,c);break a;case 14:b=Uf(null,b,d,xf(d.type,a),c);break a}throw Error(n(306, 49169d,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:xf(d,e),Xf(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:xf(d,e),bg(a,b,d,e,c);case 3:a:{eg(b);if(null===a)throw Error(n(387));d=b.pendingProps;f=b.memoizedState;e=f.element;fe(a,b);ke(b,d,null,c);var g=b.memoizedState;d=g.element;if(Va&&f.isDehydrated)if(f={element:d,isDehydrated:false,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState= 49170f,b.memoizedState=f,b.flags&256){e=Ef(Error(n(423)),b);b=fg(a,b,d,c,e);break a}else if(d!==e){e=Ef(Error(n(424)),b);b=fg(a,b,d,c,e);break a}else for(Va&&(pd=Pb(b.stateNode.containerInfo),od=b,F=true,rd=null,qd=false),c=Pd(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else {Ad();if(d===e){b=Tf(a,b,c);break a}P(a,b,d,c);}b=b.child;}return b;case 5:return ue(b),null===a&&wd(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Na(d,e)?g=null:null!==f&&Na(d,f)&&(b.flags|=32), 49171ag(a,b),P(a,b,g,c),b.child;case 6:return null===a&&wd(b),null;case 13:return ig(a,b,c);case 4:return se(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Od(b,null,d,c):P(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:xf(d,e),Sf(a,b,d,e,c);case 7:return P(a,b,b.pendingProps,c),b.child;case 8:return P(a,b,b.pendingProps.children,c),b.child;case 12:return P(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps; 49172g=e.value;Vd(b,d,g);if(null!==f)if(Vc(f.value,g)){if(f.children===e.children&&!z.current){b=Tf(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=ge(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k;}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);Xd(f.return,c,b);h.lanes|=c;break}k=k.next;}}else if(10=== 49173f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(n(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);Xd(g,c,b);g=f.sibling;}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return;}f=g;}P(a,b,e.children,c);b=b.child;}return b;case 9:return e=b.type,d=b.pendingProps.children,Yd(b,c),e=Zd(e),d=d(e),b.flags|=1,P(a,b,d,c),b.child;case 14:return d=b.type,e=xf(d,b.pendingProps), 49174e=xf(d.type,e),Uf(a,b,d,e,c);case 15:return Wf(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:xf(d,e),cg(a,b),b.tag=1,A(d)?(a=true,qc(b)):a=false,Yd(b,c),Bf(b,d,e),Df(b,d,e,c),dg(null,b,d,true,a,c);case 19:return rg(a,b,c);case 22:return Yf(a,b,c)}throw Error(n(156,b.tag));};function Mh(a,b){return Jc(a,b)} 49175function fi(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null;}function td(a,b,c,d){return new fi(a,b,c,d)}function Vf(a){a=a.prototype;return !(!a||!a.isReactComponent)} 49176function ei(a){if("function"===typeof a)return Vf(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===ma)return 11;if(a===pa)return 14}return 2} 49177function Jd(a,b){var c=a.alternate;null===c?(c=td(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext}; 49178c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c} 49179function Ld(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)Vf(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ha:return Nd(c.children,e,f,b);case ia:g=8;e|=8;break;case ja:return a=td(12,c,b,e|2),a.elementType=ja,a.lanes=f,a;case na:return a=td(13,c,b,e),a.elementType=na,a.lanes=f,a;case oa:return a=td(19,c,b,e),a.elementType=oa,a.lanes=f,a;case ra:return jg(c,e,f,b);default:if("object"===typeof a&&null!==a)switch(a.$$typeof){case ka:g=10;break a;case la:g=9;break a;case ma:g=11; 49180break a;case pa:g=14;break a;case qa:g=16;d=null;break a}throw Error(n(130,null==a?a:typeof a,""));}b=td(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Nd(a,b,c,d){a=td(7,a,d,b);a.lanes=c;return a}function jg(a,b,c,d){a=td(22,a,d,b);a.elementType=ra;a.lanes=c;a.stateNode={isHidden:false};return a}function Kd(a,b,c){a=td(6,a,null,b);a.lanes=c;return a} 49181function Md(a,b,c){b=td(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b} 49182function gi(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=Ra;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=Ec(0);this.expirationTimes=Ec(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=Ec(0);this.identifierPrefix=d;this.onRecoverableError=e;Va&&(this.mutableSourceEagerHydrationData= 49183null);}function hi(a,b,c,d,e,f,g,h,k){a=new gi(a,b,c,h,k);1===b?(b=1,true===f&&(b|=8)):b=0;f=td(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};ee(f);return a} 49184function ii(a){if(!a)return jc;a=a._reactInternals;a:{if(wa(a)!==a||1!==a.tag)throw Error(n(170));var b=a;do{switch(b.tag){case 3:b=b.stateNode.context;break a;case 1:if(A(b.type)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}}b=b.return;}while(null!==b);throw Error(n(171));}if(1===a.tag){var c=a.type;if(A(c))return pc(a,c,b)}return b} 49185function ji(a){var b=a._reactInternals;if(void 0===b){if("function"===typeof a.render)throw Error(n(188));a=Object.keys(a).join(",");throw Error(n(268,a));}a=Aa(b);return null===a?null:a.stateNode}function ki(a,b){a=a.memoizedState;if(null!==a&&null!==a.dehydrated){var c=a.retryLane;
49185a.retryLane=0!==c&&c<b?c:b;}}function li(a,b){ki(a,b);(a=a.alternate)&&ki(a,b);}function mi(a){a=Aa(a);return null===a?null:a.stateNode}function ni(){return null} 49186exports.attemptContinuousHydration=function(a){if(13===a.tag){var b=ce(a,134217728);if(null!==b){var c=O();af(b,a,134217728,c);}li(a,134217728);}};exports.attemptDiscreteHydration=function(a){if(13===a.tag){var b=ce(a,1);if(null!==b){var c=O();af(b,a,1,c);}li(a,1);}};exports.attemptHydrationAtCurrentPriority=function(a){if(13===a.tag){var b=tf(a),c=ce(a,b);if(null!==c){var d=O();af(c,a,b,d);}li(a,b);}}; 49187exports.attemptSynchronousHydration=function(a){switch(a.tag){case 3:var b=a.stateNode;if(b.current.memoizedState.isDehydrated){var c=yc(b.pendingLanes);0!==c&&(Hc(b,c|1),Kh(b,D()),0===(H&6)&&(Bh(),ad()));}break;case 13:Xh(function(){var b=ce(a,1);if(null!==b){var c=O();af(b,a,1,c);}}),li(a,1);}};exports.batchedUpdates=function(a,b){var c=H;H|=1;try{return a(b)}finally{H=c,0===H&&(Bh(),Xc&&ad());}};exports.createComponentSelector=function(a){return {$$typeof:hh,value:a}}; 49188exports.createContainer=function(a,b,c,d,e,f,g){return hi(a,b,false,null,c,d,e,f,g)};exports.createHasPseudoClassSelector=function(a){return {$$typeof:ih,value:a}};exports.createHydrationContainer=function(a,b,c,d,e,f,g,h,k){a=hi(c,d,true,a,e,f,g,h,k);a.context=ii(null);c=a.current;d=O();e=tf(c);f=ge(d,e);f.callback=void 0!==b&&null!==b?b:null;he(c,f,e);a.current.lanes=e;Fc(a,e,d);Kh(a,d);return a}; 49189exports.createPortal=function(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return {$$typeof:fa,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}};exports.createRoleSelector=function(a){return {$$typeof:jh,value:a}};exports.createTestNameSelector=function(a){return {$$typeof:kh,value:a}};exports.createTextSelector=function(a){return {$$typeof:lh,value:a}}; 49190exports.deferredUpdates=function(a){var b=C,c=W.transition;try{return W.transition=null,C=16,a()}finally{C=b,W.transition=c;}};exports.discreteUpdates=function(a,b,c,d,e){var f=C,g=W.transition;try{return W.transition=null,C=1,a(b,c,d,e)}finally{C=f,W.transition=g,0===H&&Bh();}};exports.findAllNodes=rh; 49191exports.findBoundingRects=function(a,b){if(!bb)throw Error(n(363));b=rh(a,b);a=[];for(var c=0;c<b.length;c++)a.push(db(b[c]));for(b=a.length-1;0<b;b--){c=a[b];for(var d=c.x,e=d+c.width,f=c.y,g=f+c.height,h=b-1;0<=h;h--)if(b!==h){var k=a[h],l=k.x,m=l+k.width,r=k.y,p=r+k.height;if(d>=l&&f>=r&&e<=m&&g<=p){a.splice(b,1);break}else if(!(d!==l||c.width!==k.width||p<f||r>g)){r>f&&(k.height+=r-f,k.y=f);p<g&&(k.height=g-r);a.splice(b,1);break}else if(!(f!==r||c.height!==k.height||m<d||l>e)){l>d&&(k.width+= 49192l-d,k.x=d);m<e&&(k.width=e-l);a.splice(b,1);break}}}return a};exports.findHostInstance=ji;exports.findHostInstanceWithNoPortals=function(a){a=za(a);a=null!==a?Ca(a):null;return null===a?null:a.stateNode};exports.findHostInstanceWithWarning=function(a){return ji(a)};exports.flushControlled=function(a){var b=H;H|=1;var c=W.transition,d=C;try{W.transition=null,C=1,a();}finally{C=d,W.transition=c,H=b,0===H&&(Bh(),ad());}};exports.flushPassiveEffects=Oh;exports.flushSync=Xh; 49193exports.focusWithin=function(a,b){if(!bb)throw Error(n(363));a=nh(a);b=qh(a,b);b=Array.from(b);for(a=0;a<b.length;){var c=b[a++];if(!fb(c)){if(5===c.tag&&hb(c.stateNode))return true;for(c=c.child;null!==c;)b.push(c),c=c.sibling;}}return false};exports.getCurrentUpdatePriority=function(){return C}; 49194exports.getFindAllNodesFailureDescription=function(a,b){if(!bb)throw Error(n(363));var c=0,d=[];a=[nh(a),0];for(var e=0;e<a.length;){var f=a[e++],g=a[e++],h=b[g];if(5!==f.tag||!fb(f))if(oh(f,h)&&(d.push(ph(h)),g++,g>c&&(c=g)),g<b.length)for(f=f.child;null!==f;)a.push(f,g),f=f.sibling;}if(c<b.length){for(a=[];c<b.length;c++)a.push(ph(b[c]));return "findAllNodes was able to match part of the selector:\n "+(d.join(" > ")+"\n\nNo matching component was found for:\n ")+a.join(" > ")}return null}; 49195exports.getPublicRootInstance=function(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return Ea(a.child.stateNode);default:return a.child.stateNode}}; 49196exports.injectIntoDevTools=function(a){a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:da.ReactCurrentDispatcher,findHostInstanceByFiber:mi,findFiberByHostInstance:a.findFiberByHostInstance|| 49197ni,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"};if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)a=false;else {var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)a=true;else {try{Rc=b.inject(a),Sc=b;}catch(c){}a=b.checkDCE?true:false;}}return a};exports.isAlreadyRendering=function(){return false}; 49198exports.observeVisibleRects=function(a,b,c,d){if(!bb)throw Error(n(363));a=rh(a,b);var e=ib(a,c,d).disconnect;return {disconnect:function(){e();}}};exports.registerMutableSourceForHydration=function(a,b){var c=b._getVersion;c=c(b._source);null==a.mutableSourceEagerHydrationData?a.mutableSourceEagerHydrationData=[b,c]:a.mutableSourceEagerHydrationData.push(b,c);};exports.runWithPriority=function(a,b){var c=C;try{return C=a,b()}finally{C=c;}};exports.shouldError=function(){return null}; 49199exports.shouldSuspend=function(){return false};exports.updateContainer=function(a,b,c,d){var e=b.current,f=O(),g=tf(e);c=ii(c);null===b.context?b.context=c:b.pendingContext=c;b=ge(f,g);b.payload={element:a};d=void 0===d?null:d;null!==d&&(b.callback=d);a=he(e,b,g);null!==a&&(af(a,e,g,f),ie(a,e,g));return g}; 49200 49201 return exports; 49202}; 49203 49204{ 49205 reactReconciler.exports = reactReconciler_production_min; 49206} 49207 49208var reactReconcilerExports = reactReconciler.exports; 49209const ReactFiberReconciler = /*@__PURE__*/getDefaultExportFromCjs(reactReconcilerExports); 49210
49211var constants = {exports: {}}; 49212 49213var reactReconcilerConstants_production_min = {}; 49214 49215/** 49216 * @license React 49217 * react-reconciler-constants.production.min.js 49218 * 49219 * Copyright (c) Facebook, Inc. and its affiliates. 49220 * 49221 * This source code is licensed under the MIT license found in the 49222 * LICENSE file in the root directory of this source tree. 49223 */ 49224reactReconcilerConstants_production_min.ConcurrentRoot=1;reactReconcilerConstants_production_min.ContinuousEventPriority=4;reactReconcilerConstants_production_min.DefaultEventPriority=16;reactReconcilerConstants_production_min.DiscreteEventPriority=1;reactReconcilerConstants_production_min.IdleEventPriority=536870912;reactReconcilerConstants_production_min.LegacyRoot=0; 49225 49226{ 49227 constants.exports = reactReconcilerConstants_production_min; 49228} 49229 49230var constantsExports = constants.exports; 49231 49232const propsToSkip = { 49233 children: true, 49234 ref: true, 49235 key: true, 49236 style: true, 49237 forwardedRef: true, 49238 unstable_applyCache: true, 49239 unstable_applyDrawHitFromCache: true, 49240}; 49241let zIndexWarningShowed = false; 49242let dragWarningShowed = false; 49243const EVENTS_NAMESPACE = '.react-konva-event'; 49244const DRAGGABLE_WARNING = `ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. 49245Position of a node will be changed during drag&drop, so you should update state of the react app as well. 49246Consider to add onDragMove or onDragEnd events. 49247For more info see: https://github.com/konvajs/react-konva/issues/256 49248`; 49249const Z_INDEX_WARNING = `ReactKonva: You are using "zIndex" attribute for a Konva node. 49250react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. 49251For more info see: https://github.com/konvajs/react-konva/issues/194 49252`; 49253const EMPTY_PROPS = {}; 49254function applyNodeProps(instance, props, oldProps = EMPTY_PROPS) { 49255 // don't use zIndex in react-konva 49256 if (!zIndexWarningShowed && 'zIndex' in props) { 49257 console.warn(Z_INDEX_WARNING); 49258 zIndexWarningShowed = true; 49259 } 49260 // check correct draggable usage 49261 if (!dragWarningShowed && props.draggable) { 49262 var hasPosition = props.x !== undefined || props.y !== undefined; 49263 var hasEvents = props.onDragEnd || props.onDragMove; 49264 if (hasPosition && !hasEvents) { 49265 console.warn(DRAGGABLE_WARNING); 49266 dragWarningShowed = true; 49267 } 49268 } 49269 // check old props 49270 // we need to unset properties that are not in new props 49271 // and remove all events 49272 for (var key in oldProps) { 49273 if (propsToSkip[key]) { 49274 continue; 49275 } 49276 var isEvent = key.slice(0, 2) === 'on'; 49277 var propChanged = oldProps[key] !== props[key]; 49278 // if that is a changed event, we need to remove it 49279 if (isEvent && propChanged) { 49280 var eventName = key.substr(2).toLowerCase(); 49281 if (eventName.substr(0, 7) === 'content') { 49282 eventName = 49283 'content' + 49284 eventName.substr(7, 1).toUpperCase() + 49285 eventName.substr(8); 49286 } 49287 instance.off(eventName, oldProps[key]); 49288 } 49289 var toRemove = !props.hasOwnProperty(key); 49290 if (toRemove) { 49291 instance.setAttr(key, undefined); 49292 } 49293 } 49294 var strictUpdate = props._useStrictMode; 49295 var updatedProps = {}; 49296 var hasUpdates = false; 49297 const newEvents = {}; 49298 for (var key in props) { 49299 if (propsToSkip[key]) { 49300 continue; 49301 } 49302 var isEvent = key.slice(0, 2) === 'on'; 49303 var toAdd = oldProps[key] !== props[key]; 49304 if (isEvent && toAdd) { 49305 var eventName = key.substr(2).toLowerCase(); 49306 if (eventName.substr(0, 7) === 'content') { 49307 eventName = 49308 'content' + 49309 eventName.substr(7, 1).toUpperCase() + 49310 eventName.substr(8); 49311 } 49312 // check that event is not undefined 49313 if (props[key]) { 49314 newEvents[eventName] = props[key]; 49315 } 49316 } 49317 if (!isEvent && 49318 (props[key] !== oldProps[key] || 49319 (strictUpdate && props[key] !== instance.getAttr(key)))) { 49320 hasUpdates = true; 49321 updatedProps[key] = props[key]; 49322 } 49323 } 49324 if (hasUpdates) { 49325 instance.setAttrs(updatedProps); 49326 updatePicture(instance); 49327 } 49328 // subscribe to events AFTER we set attrs 49329 // we need it to fix https://github.com/konvajs/react-konva/issues/471 49330 // settings attrs may add events. Like "draggable: true" will add "mousedown" listener 49331 for (var eventName in newEvents) { 49332 instance.on(eventName + EVENTS_NAMESPACE, newEvents[eventName]); 49333 } 49334} 49335function updatePicture(node) { 49336 if (!Global.Konva.autoDrawEnabled) { 49337 var drawingNode = node.getLayer() || node.getStage(); 49338 drawingNode && drawingNode.batchDraw(); 49339 } 49340} 49341 49342const NO_CONTEXT = {}; 49343const UPDATE_SIGNAL = {}; 49344// for react-spring capability 49345Konva.Node.prototype._applyProps = applyNodeProps; 49346function appendInitialChild(parentInstance, child) { 49347 if (typeof child === 'string') { 49348 // Noop for string children of Text (eg <Text>foo</Text>) 49349 console.error(`Do not use plain text as child of Konva.Node. You are using text: ${child}`); 49350 return; 49351 } 49352 parentInstance.add(child); 49353 updatePicture(parentInstance); 49354} 49355function createInstance(type, props, internalInstanceHandle) { 49356 let NodeClass = Konva[type]; 49357 if (!NodeClass) { 49358 console.error(`Konva has no node with the type ${type}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${type}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`); 49359 NodeClass = Konva.Group; 49360 } 49361 // we need to split props into events and non events 49362 // we we can pass non events into constructor directly 49363 // that way the performance should be better 49364 // we we apply change "applyNodeProps" 49365 // then it will trigger change events on first run 49366 // but we don't need them! 49367 const propsWithoutEvents = {}; 49368 const propsWithOnlyEvents = {}; 49369 for (var key in props) { 49370 var isEvent = key.slice(0, 2) === 'on'; 49371 if (isEvent) { 49372 propsWithOnlyEvents[key] = props[key]; 49373 } 49374 else { 49375 propsWithoutEvents[key] = props[key]; 49376 } 49377 } 49378 const instance = new NodeClass(propsWithoutEvents); 49379 applyNodeProps(instance, propsWithOnlyEvents); 49380 return instance; 49381} 49382function createTextInstance(text, rootContainerInstance, internalInstanceHandle) { 49383 console.error(`Text components are not supported for now in ReactKonva. Your text is: "${text}"`); 49384} 49385function finalizeInitialChildren(domElement, type, props) { 49386 return false;
49387} 49388function getPublicInstance(instance) { 49389 return instance; 49390} 49391function prepareForCommit() { 49392 return null; 49393} 49394function preparePortalMount() { 49395 return null; 49396} 49397function prepareUpdate(domElement, type, oldProps, newProps) { 49398 return UPDATE_SIGNAL; 49399} 49400function resetAfterCommit() { 49401 // Noop 49402} 49403function resetTextContent(domElement) { 49404 // Noop 49405} 49406function shouldDeprioritizeSubtree(type, props) { 49407 return false; 49408} 49409function getRootHostContext() { 49410 return NO_CONTEXT; 49411} 49412function getChildHostContext() { 49413 return NO_CONTEXT; 49414} 49415const scheduleTimeout = setTimeout; 49416const cancelTimeout = clearTimeout; 49417const noTimeout = -1; 49418// export const schedulePassiveEffects = scheduleDeferredCallback; 49419// export const cancelPassiveEffects = cancelDeferredCallback; 49420function shouldSetTextContent(type, props) { 49421 return false; 49422} 49423// The Konva renderer is secondary to the React DOM renderer. 49424const isPrimaryRenderer = false; 49425const warnsIfNotActing = true; 49426const supportsMutation = true; 49427function appendChild(parentInstance, child) { 49428 if (child.parent === parentInstance) { 49429 child.moveToTop(); 49430 } 49431 else { 49432 parentInstance.add(child); 49433 } 49434 updatePicture(parentInstance); 49435} 49436function appendChildToContainer(parentInstance, child) { 49437 if (child.parent === parentInstance) { 49438 child.moveToTop(); 49439 } 49440 else { 49441 parentInstance.add(child); 49442 } 49443 updatePicture(parentInstance); 49444} 49445function insertBefore(parentInstance, child, beforeChild) { 49446 // child._remove() will not stop dragging 49447 // but child.remove() will stop it, but we don't need it 49448 // removing will reset zIndexes 49449 child._remove(); 49450 parentInstance.add(child); 49451 child.setZIndex(beforeChild.getZIndex()); 49452 updatePicture(parentInstance); 49453} 49454function insertInContainerBefore(parentInstance, child, beforeChild) { 49455 insertBefore(parentInstance, child, beforeChild); 49456} 49457function removeChild(parentInstance, child) { 49458 child.destroy(); 49459 child.off(EVENTS_NAMESPACE); 49460 updatePicture(parentInstance); 49461} 49462function removeChildFromContainer(parentInstance, child) { 49463 child.destroy(); 49464 child.off(EVENTS_NAMESPACE); 49465 updatePicture(parentInstance); 49466} 49467function commitTextUpdate(textInstance, oldText, newText) { 49468 console.error(`Text components are not yet supported in ReactKonva. You text is: "${newText}"`); 49469} 49470function commitMount(instance, type, newProps) { 49471 // Noop 49472} 49473function commitUpdate(instance, updatePayload, type, oldProps, newProps) { 49474 applyNodeProps(instance, newProps, oldProps); 49475} 49476function hideInstance(instance) { 49477 instance.hide(); 49478 updatePicture(instance); 49479} 49480function hideTextInstance(textInstance) { 49481 // Noop 49482} 49483function unhideInstance(instance, props) { 49484 if (props.visible == null || props.visible) { 49485 instance.show(); 49486 } 49487} 49488function unhideTextInstance(textInstance, text) { 49489 // Noop 49490} 49491function clearContainer(container) { 49492 // Noop 49493} 49494function detachDeletedInstance() { } 49495const getCurrentEventPriority = () => constantsExports.DefaultEventPriority; 49496 49497const HostConfig = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 49498 __proto__: null, 49499 appendChild, 49500 appendChildToContainer, 49501 appendInitialChild, 49502 cancelTimeout, 49503 clearContainer, 49504 commitMount, 49505 commitTextUpdate, 49506 commitUpdate, 49507 createInstance, 49508 createTextInstance, 49509 detachDeletedInstance, 49510 finalizeInitialChildren, 49511 getChildHostContext, 49512 getCurrentEventPriority, 49513 getPublicInstance, 49514 getRootHostContext, 49515 hideInstance, 49516 hideTextInstance, 49517 idlePriority: schedulerExports.unstable_IdlePriority, 49518 insertBefore, 49519 insertInContainerBefore, 49520 isPrimaryRenderer, 49521 noTimeout, 49522 now: schedulerExports.unstable_now, 49523 prepareForCommit, 49524 preparePortalMount, 49525 prepareUpdate, 49526 removeChild, 49527 removeChildFromContainer, 49528 resetAfterCommit, 49529 resetTextContent, 49530 run: schedulerExports.unstable_runWithPriority, 49531 scheduleTimeout, 49532 shouldDeprioritizeSubtree, 49533 shouldSetTextContent, 49534 supportsMutation, 49535 unhideInstance, 49536 unhideTextInstance, 49537 warnsIfNotActing 49538}, Symbol.toStringTag, { value: 'Module' })); 49539 49540var __defProp = Object.defineProperty; 49541var __defProps = Object.defineProperties; 49542var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 49543var __getOwnPropSymbols = Object.getOwnPropertySymbols; 49544var __hasOwnProp = Object.prototype.hasOwnProperty; 49545var __propIsEnum = Object.prototype.propertyIsEnumerable; 49546var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 49547var __spreadValues = (a, b) => { 49548 for (var prop in b || (b = {})) 49549 if (__hasOwnProp.call(b, prop)) 49550 __defNormalProp(a, prop, b[prop]); 49551 if (__getOwnPropSymbols) 49552 for (var prop of __getOwnPropSymbols(b)) { 49553 if (__propIsEnum.call(b, prop)) 49554 __defNormalProp(a, prop, b[prop]); 49555 } 49556 return a; 49557}; 49558var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 49559var _a, _b; 49560typeof window !== "undefined" && (((_a = window.document) == null ? void 0 : _a.createElement) || ((_b = window.navigator) == null ? void 0 : _b.product) === "ReactNative") ? reactExports.useLayoutEffect : reactExports.useEffect; 49561function traverseFiber(fiber, ascending, selector) { 49562 if (!fiber) 49563 return; 49564 if (selector(fiber) === true) 49565 return fiber; 49566 let child = fiber.child; 49567 while (child) { 49568 const match = traverseFiber(child, ascending, selector); 49569 if (match) 49570 return match; 49571 child = child.sibling; 49572 } 49573} 49574function wrapContext(context) { 49575 try { 49576 return Object.defineProperties(context, { 49577 _currentRenderer: { 49578 get() { 49579 return null; 49580 }, 49581 set() { 49582 } 49583 }, 49584 _currentRenderer2: { 49585 get() { 49586 return null; 49587 }, 49588 set() { 49589 } 49590 } 49591 }); 49592 } catch (_) { 49593 return context; 49594 } 49595} 49596const error = console.error; 49597console.error = function() { 49598 const message = [...arguments].join(""); 49599 if ((message == null ? void 0 : message.startsWith("Warning:")) && message.includes("useContext")) { 49600 console.error = error; 49601 return; 49602 } 49603 return error.apply(this, arguments); 49604}; 49605const FiberContext = wrapContext(reactExports.createContext(null)); 49606class FiberProvider extends reactExports.Component { 49607 render() { 49608 return /* @__PURE__ */ reactExports.createElement(FiberContext.Provider, { 49609 value: this._reactInternals 49610 }, this.props.children); 49611 } 49612} 49613function useFiber() { 49614 const root = reactExports.useContext(FiberContext); 49615 if (root === null) 49616 throw new Error("its-fine: useFiber must be called within a <FiberProvider />!"); 49617 const id = reactExports.useId(); 49618 const fiber = reactExports.useMemo(() => { 49619 for (const maybeFiber of [root, root == null ? void 0 : root.alternate]) { 49620 if (!maybeFiber) 49621 continue; 49622 const fiber2 = traverseFiber(maybeFiber, false, (node) => { 49623 let state = node.memoizedState; 49624 while (state) { 49625 if (state.memoizedState === id) 49626 return true; 49627 state = state.next; 49628 } 49629 }); 49630 if (fiber2) 49631 return fiber2; 49632 } 49633 }, [root, id]); 49634 return fiber; 49635} 49636function useContextMap() { 49637 const fiber = useFiber(); 49638 const [contextMap] = reactExports.useState(() => /* @__PURE__ */ new Map()); 49639 contextMap.clear(); 49640 let node = fiber; 49641 while (node) { 49642 if (node.type && typeof node.type === "object") {
49643 const enableRenderableContext = node.type._context === void 0 && node.type.Provider === node.type; 49644 const context = enableRenderableContext ? node.type : node.type._context; 49645 if (context && context !== FiberContext && !contextMap.has(context)) { 49646 contextMap.set(context, reactExports.useContext(wrapContext(context))); 49647 } 49648 } 49649 node = node.return; 49650 } 49651 return contextMap; 49652} 49653function useContextBridge() { 49654 const contextMap = useContextMap(); 49655 return reactExports.useMemo( 49656 () => Array.from(contextMap.keys()).reduce( 49657 (Prev, context) => (props) => /* @__PURE__ */ reactExports.createElement(Prev, null, /* @__PURE__ */ reactExports.createElement(context.Provider, __spreadProps(__spreadValues({}, props), { 49658 value: contextMap.get(context) 49659 }))), 49660 (props) => /* @__PURE__ */ reactExports.createElement(FiberProvider, __spreadValues({}, props)) 49661 ), 49662 [contextMap] 49663 ); 49664} 49665 49666function usePrevious(value) { 49667 const ref = e$2.useRef({}); 49668 e$2.useLayoutEffect(() => { 49669 ref.current = value; 49670 }); 49671 e$2.useLayoutEffect(() => { 49672 return () => { 49673 ref.current = {}; 49674 }; 49675 }, []); 49676 return ref.current; 49677} 49678const StageWrap = (props) => { 49679 const container = e$2.useRef(); 49680 const stage = e$2.useRef(); 49681 const fiberRef = e$2.useRef(); 49682 const oldProps = usePrevious(props); 49683 const Bridge = useContextBridge(); 49684 const _setRef = (stage2) => { 49685 const { forwardedRef } = props; 49686 if (!forwardedRef) { 49687 return; 49688 } 49689 if (typeof forwardedRef === "function") { 49690 forwardedRef(stage2); 49691 } else { 49692 forwardedRef.current = stage2; 49693 } 49694 }; 49695 e$2.useLayoutEffect(() => { 49696 stage.current = new Konva.Stage({ 49697 width: props.width, 49698 height: props.height, 49699 container: container.current 49700 }); 49701 _setRef(stage.current); 49702 fiberRef.current = KonvaRenderer.createContainer(stage.current, constantsExports.LegacyRoot, false, null); 49703 KonvaRenderer.updateContainer(e$2.createElement(Bridge, {}, props.children), fiberRef.current); 49704 return () => { 49705 if (!Konva.isBrowser) { 49706 return; 49707 } 49708 _setRef(null); 49709 KonvaRenderer.updateContainer(null, fiberRef.current, null); 49710 stage.current.destroy(); 49711 }; 49712 }, []); 49713 e$2.useLayoutEffect(() => { 49714 _setRef(stage.current); 49715 applyNodeProps(stage.current, props, oldProps); 49716 KonvaRenderer.updateContainer(e$2.createElement(Bridge, {}, props.children), fiberRef.current, null); 49717 }); 49718 return e$2.createElement("div", { 49719 ref: container, 49720 id: props.id, 49721 accessKey: props.accessKey, 49722 className: props.className, 49723 role: props.role, 49724 style: props.style, 49725 tabIndex: props.tabIndex, 49726 title: props.title 49727 }); 49728}; 49729const Layer = "Layer"; 49730const Group = "Group"; 49731const Rect = "Rect"; 49732const Image$1 = "Image"; 49733const Text = "Text"; 49734const Transformer = "Transformer"; 49735const KonvaRenderer = ReactFiberReconciler(HostConfig); 49736KonvaRenderer.injectIntoDevTools({ 49737 // @ts-ignore 49738 findHostInstanceByFiber: () => null, 49739 bundleType: 0, 49740 version: e$2.version, 49741 rendererPackageName: "react-konva" 49742}); 49743const Stage = e$2.forwardRef((props, ref) => { 49744 return e$2.createElement(FiberProvider, {}, e$2.createElement(StageWrap, { ...props, forwardedRef: ref })); 49745}); 49746 49747// Unique ID creation requires a high quality random # generator. In the browser we therefore 49748// require the crypto API and do not support built-in fallback to lower quality random number 49749// generators (like Math.random()). 49750let getRandomValues; 49751const rnds8 = new Uint8Array(16); 49752function rng() { 49753 // lazy load so that environments that need to polyfill have a chance to do so 49754 if (!getRandomValues) { 49755 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 49756 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); 49757 49758 if (!getRandomValues) { 49759 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 49760 } 49761 } 49762 49763 return getRandomValues(rnds8); 49764} 49765 49766/** 49767 * Convert array of 16 byte values to UUID string format of the form: 49768 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 49769 */ 49770 49771const byteToHex = []; 49772 49773for (let i = 0; i < 256; ++i) { 49774 byteToHex.push((i + 0x100).toString(16).slice(1)); 49775} 49776 49777function unsafeStringify(arr, offset = 0) { 49778 // Note: Be careful editing this code! It's been tuned for performance
49779 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 49780 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; 49781} 49782 49783const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); 49784const native = { 49785 randomUUID 49786}; 49787 49788function v4(options, buf, offset) { 49789 if (native.randomUUID && true && !options) { 49790 return native.randomUUID(); 49791 } 49792 49793 options = options || {}; 49794 const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 49795 49796 rnds[6] = rnds[6] & 0x0f | 0x40; 49797 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 49798 49799 return unsafeStringify(rnds); 49800} 49801 49802const URI_IMG_TYPE = "image/png"; 49803 49804class ImageConstruct { 49805 image; 49806 constructor(obj) { 49807 this.image = new Image(); 49808 this.image.crossOrigin = "anonymous"; 49809 this.image.src = obj.image || URL.createObjectURL(obj.file); 49810 } 49811 getImage() { 49812 return this.image; 49813 } 49814} 49815 49816const initialImageProps = { 49817 id: v4(), 49818 x: 20, 49819 y: 20, 49820 width: 0, 49821 height: 0, 49822 scaleX: 1, 49823 scaleY: 1 49824}; 49825const initialMarkerProps = { 49826 color: "#ED3827", 49827 description: "", 49828 x: 50, 49829 y: 50, 49830 width: 50, 49831 height: 50, 49832 scaleY: 1, 49833 scaleX: 1, 49834 textScale: 1, 49835 parentId: null, 49836 isError: false, 49837 isSelectedCopyItem: false, 49838 isMarkerFromAnotherImage: false 49839}; 49840 49841function debounce(fn, delay) { 49842 let timer; 49843 return function(...args) { 49844 clearTimeout(timer); 49845 timer = setTimeout(() => fn(...args), delay); 49846 }; 49847} 49848const useWindowSize = (debounceDelay = 200) => { 49849 const [size, setSize] = reactExports.useState({ 49850 screenWidth: window.innerWidth, 49851 screenHeight: window.innerHeight 49852 }); 49853 reactExports.useEffect(() => { 49854 const handleResize = () => { 49855 setSize({ 49856 screenWidth: window.innerWidth, 49857 screenHeight: window.innerHeight 49858 }); 49859 }; 49860 const debouncedHandleResize = debounce(handleResize, debounceDelay); 49861 window.addEventListener("resize", debouncedHandleResize); 49862 handleResize(); 49863 return () => window.removeEventListener("resize", debouncedHandleResize); 49864 }, [debounceDelay]); 49865 return size; 49866}; 49867const fitImageToStage = (image, stage, gapPercent = 20) => { 49868 const isSmallScreen = window.innerWidth < 992; 49869 const availableWidth = isSmallScreen ? stage.width : stage.width - image.width / gapPercent; 49870 const availableHeight = isSmallScreen ? stage.height : stage.height - image.height / gapPercent; 49871 const imageRatio = image.width / image.height; 49872 const availableRatio = availableWidth / availableHeight; 49873 let width, height; 49874 if (imageRatio > availableRatio) { 49875 width = availableWidth; 49876 height = availableWidth / imageRatio; 49877 } else { 49878 height = availableHeight; 49879 width = availableHeight * imageRatio; 49880 } 49881 const x = (stage.width - width) / 2; 49882 const y = (stage.height - height) / 2; 49883 return { width, height, x, y }; 49884}; 49885const getImageSize = (url) => { 49886 return new Promise((resolve, reject) => { 49887 const img = new Image(); 49888 img.src = url; 49889 img.onload = () => { 49890 resolve({ width: img.width, height: img.height }); 49891 }; 49892 img.onerror = (err) => { 49893 reject(err); 49894 }; 49895 }); 49896}; 49897const dataURLtoFile = (dataurl, filename) => { 49898 const arr = dataurl.split(","); 49899 const mimeMatch = arr[0].match(/:(.*?);/); 49900 const mime = mimeMatch ? mimeMatch[1] : "image/png"; 49901 const bstr = atob(arr[1]); 49902 let n = bstr.length; 49903 const u8arr = new Uint8Array(n); 49904 while (n--) { 49905 u8arr[n] = bstr.charCodeAt(n); 49906 } 49907 return new File([u8arr], filename, { type: mime }); 49908}; 49909const getCorner = (pivotX, pivotY, diffX, diffY, angle) => { 49910 const distance = Math.sqrt(diffX * diffX + diffY * diffY); 49911 angle += Math.atan2(diffY, diffX); 49912 const x = pivotX + distance * Math.cos(angle); 49913 const y = pivotY + distance * Math.sin(angle); 49914 return { x, y }; 49915}; 49916const getClientRect = (rotatedBox) => { 49917 const { x, y, width, height } = rotatedBox; 49918 const rad = rotatedBox.rotation; 49919 const p1 = getCorner(x, y, 0, 0, rad); 49920 const p2 = getCorner(x, y, width, 0, rad); 49921 const p3 = getCorner(x, y, width, height, rad); 49922 const p4 = getCorner(x, y, 0, height, rad); 49923 const minX = Math.min(p1.x, p2.x, p3.x, p4.x); 49924 const minY = Math.min(p1.y, p2.y, p3.y, p4.y); 49925 const maxX = Math.max(p1.x, p2.x, p3.x, p4.x); 49926 const maxY = Math.max(p1.y, p2.y, p3.y, p4.y); 49927 return { 49928 x: minX, 49929 y: minY, 49930 width: maxX - minX, 49931 height: maxY - minY 49932 }; 49933}; 49934const getTotalBox = (boxes) => { 49935 let minX = Infinity; 49936 let minY = Infinity; 49937 let maxX = -Infinity; 49938 let maxY = -Infinity;
49939 boxes.forEach((box) => { 49940 minX = Math.min(minX, box.x); 49941 minY = Math.min(minY, box.y); 49942 maxX = Math.max(maxX, box.x + box.width); 49943 maxY = Math.max(maxY, box.y + box.height); 49944 }); 49945 return { 49946 x: minX, 49947 y: minY, 49948 width: maxX - minX, 49949 height: maxY - minY 49950 }; 49951}; 49952 49953const useMarkers = () => { 49954 const navigate = useNavigate(); 49955 const { screenWidth, screenHeight } = useWindowSize(300); 49956 const { appState, setAppState } = useAppData(); 49957 const groupRef = reactExports.useRef(); 49958 const imageTrRef = reactExports.useRef(); 49959 const markerTrRef = reactExports.useRef(); 49960 const imageRef = reactExports.useRef(); 49961 const stageRef = reactExports.useRef(); 49962 const [stageSize, setStageSize] = reactExports.useState({ width: 0, height: 0 }); 49963 const [originalImageSize, setOriginalImageSize] = reactExports.useState({ width: 0, height: 0 }); 49964 const [saveLoading, setSaveLoading] = reactExports.useState(false); 49965 const [imageAttrs, setImageAttrs] = reactExports.useState(initialImageProps); 49966 const [imageElement, setImageElement] = reactExports.useState(); 49967 const [selectedPictureId, setSelectedPictureId] = reactExports.useState(null); 49968 const [markersList, setMarkersList] = reactExports.useState([]); 49969 const [childMarkersList, setChildMarkersList] = reactExports.useState([]); 49970 const [selectedMarkerId, selectMarkerId] = reactExports.useState(null); 49971 const [selectedCopyMarkerId, setSelectedCopyMarkerId] = reactExports.useState(null); 49972 const postImage = async (uri) => { 49973 const file = dataURLtoFile(uri, "patent-markers.png"); 49974 try { 49975 const sessionId = localStorage.getItem(SESSION_ID_NAME) || ""; 49976 const formData = new FormData(); 49977 formData.append("image", file); 49978 formData.append("session_id", sessionId); 49979 const { data } = await axios.patch(API_URLS.PATENT_IMAGE, formData, { 49980 headers: { "Content-Type": "multipart/form-data" } 49981 }); 49982 if (data.session_id) { 49983 localStorage.setItem(SESSION_ID_NAME, data.session_id); 49984 } 49985 ; 49986 setAppState((prevState) => ({ 49987 ...prevState, 49988 patent: { ...prevState.patent, imageURL: data.image } 49989 })); 49990 } catch (e) { 49991 console.log(e); 49992 throw e; 49993 } 49994 }; 49995 const postMarkersData = async () => { 49996 try { 49997 const sessionId = localStorage.getItem(SESSION_ID_NAME) || ""; 49998 const { data } = await axios.patch(API_URLS.PATENT_MARKERS, { 49999 session_id: sessionId, 50000 image_markers: [...markersList].map((x) => ({ 50001 name: x.name, 50002 color: x.color, 50003 description: x.description 50004 })) 50005 }); 50006 if (data.session_id) { 50007 localStorage.setItem(SESSION_ID_NAME, data.session_id); 50008 } 50009 ; 50010 setAppState((prevState) => ({ 50011 ...prevState, 50012 patent: { ...prevState.patent, markers: data.image_markers } 50013 })); 50014 } catch (e) { 50015 console.log(e); 50016 throw e; 50017 } 50018 }; 50019 const onChangeImageHandler = (newAttrs) => { 50020 setImageAttrs(newAttrs); 50021 }; 50022 const onDeleteMarkerHandler = (item) => { 50023 setMarkersList((prevState) => prevState.filter((prevItem) => { 50024 return prevItem.id !== item.id; 50025 })); 50026 setChildMarkersList((prevState) => prevState.filter((prevItem) => { 50027 return prevItem.parentId !== item.id; 50028 })); 50029 }; 50030 const onSelectMarkerHandler = (id) => () => { 50031 selectMarkerId(id); 50032 setSelectedPictureId(null); 50033 setSelectedCopyMarkerId(null); 50034 clearChildSelectedItemsHandler(); 50035 }; 50036 const onSelectImageHandler = () => { 50037 setSelectedPictureId(imageAttrs.id); 50038 selectMarkerId(null); 50039 setSelectedCopyMarkerId(null); 50040 }; 50041 const clearChildSelectedItemsHandler = () => { 50042 setChildMarkersList((prevState) => { 50043 return prevState.map((item) => { 50044 return { 50045 ...item, 50046 isSelectedCopyItem: false 50047 }; 50048 }); 50049 }); 50050 }; 50051 const onSelectCopyMarkerHandler = (id) => () => { 50052 setSelectedCopyMarkerId(id); 50053 setSelectedPictureId(null); 50054 selectMarkerId(null); 50055 }; 50056 const onClickDeleteCopyItemHandler = (id) => { 50057 setChildMarkersList((prevState) => prevState.filter((item) => item.id !== id)); 50058 };
50059 const onClickCopyIconHandler = (id) => { 50060 const item = markersList.find((item2) => item2.id === id); 50061 if (item) { 50062 const newChildItem = { 50063 ...item, 50064 id: v4(), 50065 parentId: id, 50066 width: initialMarkerProps.width, 50067 height: initialMarkerProps.height, 50068 scaleX: initialMarkerProps.scaleX, 50069 scaleY: initialMarkerProps.scaleY, 50070 textScale: initialMarkerProps.textScale, 50071 x: initialMarkerProps.x, 50072 y: initialMarkerProps.y 50073 }; 50074 setChildMarkersList([...childMarkersList, newChildItem]); 50075 } 50076 }; 50077 const onClickClearSelectedItemsHandler = () => { 50078 selectMarkerId(null); 50079 setSelectedPictureId(null); 50080 setSelectedCopyMarkerId(null); 50081 clearChildSelectedItemsHandler(); 50082 }; 50083 const onUpdateItemHandler = (item) => { 50084 setMarkersList((prevState) => { 50085 return prevState.map((prevItem) => { 50086 return prevItem.id === item.id ? item : prevItem; 50087 }); 50088 }); 50089 setChildMarkersList((prevState) => { 50090 return prevState.map((prevItem) => { 50091 if (prevItem.parentId === item.id) { 50092 return { 50093 ...prevItem, 50094 color: item.color, 50095 scaleY: item.scaleX, 50096 scaleX: item.scaleY 50097 }; 50098 } 50099 return prevItem; 50100 }); 50101 }); 50102 }; 50103 const onClickAddNewMarkerHandler = () => { 50104 let newItem = { 50105 id: v4(), 50106 name: ((+markersList?.[markersList.length - 1]?.name || 0) + 10).toString(), 50107 ...initialMarkerProps 50108 }; 50109 setMarkersList([...markersList, newItem]); 50110 }; 50111 const onImageWithMarkersSave = async () => { 50112 const emptyInteraction = markersList.find((x) => !x.description); 50113 setMarkersList((prevState) => { 50114 return prevState.map((item) => { 50115 return { ...item, isError: item.description.length === 0 }; 50116 }); 50117 }); 50118 if (emptyInteraction) return; 50119 if (!groupRef.current) return; 50120 if (imageTrRef.current) imageTrRef.current.nodes([]); 50121 if (markerTrRef.current) markerTrRef.current.nodes([]); 50122 try { 50123 const uri = groupRef.current.toDataURL({ pixelRatio: 3, mimeType: URI_IMG_TYPE }); 50124 setSaveLoading(true); 50125 await postMarkersData(); 50126 await postImage(uri); 50127 navigate("/patent/markers-interactions/"); 50128 } finally { 50129 setSaveLoading(false); 50130 } 50131 }; 50132 const onStageSizeChange = async (url) => { 50133 const imageSize = await getImageSize(url); 50134 const stageSize2 = { width: stageRef?.current.offsetWidth, height: stageRef?.current.offsetHeight }; 50135 setStageSize(stageSize2); 50136 setOriginalImageSize(imageSize); 50137 setImageAttrs((attrs) => ({ ...attrs, ...fitImageToStage(imageSize, stageSize2) })); 50138 setMarkersList((prevState) => prevState.map((marker) => { 50139 return { ...marker, x: 50, y: 50 }; 50140 })); 50141 }; 50142 const checkInitialData = async () => { 50143 if (!appState.patent?.imageURL) { 50144 navigate("/patent/"); 50145 } else { 50146 const image = new ImageConstruct({ image: appState.patent?.imageURL }); 50147 setImageElement(image.getImage()); 50148 onStageSizeChange(appState.patent?.imageURL); 50149 } 50150 }; 50151 reactExports.useEffect(() => { 50152 checkInitialData(); 50153 }, [appState]); 50154 reactExports.useEffect(() => { 50155 if (appState.patent?.imageURL) { 50156 onStageSizeChange(appState.patent?.imageURL); 50157 } 50158 }, [screenWidth, screenHeight]); 50159 return { 50160 stageRef, 50161 imageRef, 50162 imageAttrs, 50163 groupRef, 50164 imageTrRef, 50165 markerTrRef, 50166 initialImageProps, 50167 selectedPictureId, 50168 markersList, 50169 selectedMarkerId, 50170 selectedCopyMarkerId, 50171 imageElement, 50172 childMarkersList, 50173 saveLoading, 50174 originalImageSize, 50175 stageSize, 50176 setMarkersList, 50177 setChildMarkersList, 50178 onSelectCopyMarkerHandler, 50179 onImageWithMarkersSave, 50180 onClickCopyIconHandler, 50181 onClickDeleteCopyItemHandler, 50182 onDeleteMarkerHandler, 50183 onSelectImageHandler, 50184 onClickClearSelectedItemsHandler, 50185 onUpdateItemHandler, 50186 onClickAddNewMarkerHandler, 50187 onChangeImageHandler, 50188 onSelectMarkerHandler 50189 }; 50190}; 50191 50192const Marker = (props) => { 50193 const { marker, markerTrRef, isSelected, onChange, onSelect, stageWidth, stageHeight } = props; 50194 const groupRef = reactExports.useRef(); 50195 const shapeRef = reactExports.useRef(); 50196 const textRef = reactExports.useRef();
50197 const [width, setWidth] = reactExports.useState({ 50198 textWidth: 1, 50199 textHeight: 1 50200 }); 50201 const onDragHandler = () => { 50202 onSelect(); 50203 if (!markerTrRef.current) return; 50204 const boxes = markerTrRef.current.nodes().map((node) => node.getClientRect()); 50205 const box = getTotalBox(boxes); 50206 markerTrRef.current.nodes().forEach((shape) => { 50207 const absPos = shape.getAbsolutePosition(); 50208 const offsetX = box.x - absPos.x; 50209 const offsetY = box.y - absPos.y; 50210 const newAbsPos = { ...absPos }; 50211 if (box.x < 0) { 50212 newAbsPos.x = -offsetX; 50213 } 50214 if (box.y < 0) { 50215 newAbsPos.y = -offsetY; 50216 } 50217 if (box.x + box.width > stageWidth) { 50218 newAbsPos.x = stageWidth - box.width - offsetX; 50219 } 50220 if (box.y + box.height > stageHeight) { 50221 newAbsPos.y = stageHeight - box.height - offsetY; 50222 } 50223 shape.setAbsolutePosition(newAbsPos); 50224 }); 50225 }; 50226 const onTransformEndHandler = (e) => { 50227 const node = groupRef.current; 50228 if (!node) return; 50229 const scaleX = e.currentTarget.scaleX(); 50230 const scaleY = e.currentTarget.scaleY(); 50231 onChange({ 50232 ...marker, 50233 x: e.target.x(), 50234 y: e.target.y(), 50235 scaleX, 50236 scaleY 50237 }); 50238 }; 50239 reactExports.useEffect(() => { 50240 if (markerTrRef.current && isSelected) { 50241 markerTrRef.current.nodes([groupRef.current]); 50242 markerTrRef.current.getLayer().batchDraw(); 50243 } 50244 }, [isSelected]); 50245 reactExports.useEffect(() => { 50246 if (textRef.current.textWidth && textRef.current.textHeight) { 50247 setWidth({ 50248 textWidth: textRef.current.textWidth * marker.scaleX, 50249 textHeight: textRef.current.textHeight * marker.scaleY 50250 }); 50251 } 50252 }, [marker.name]); 50253 return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 50254 /* @__PURE__ */ jsxRuntimeExports.jsxs( 50255 Group, 50256 { 50257 ref: groupRef, 50258 onClick: onSelect, 50259 onTap: onSelect, 50260 x: marker.x, 50261 y: marker.y, 50262 onDragMove: onDragHandler, 50263 draggable: true, 50264 onDragEnd: (e) => { 50265 onChange({ 50266 ...marker, 50267 x: e.target.x(), 50268 y: e.target.y() 50269 }); 50270 }, 50271 listening: true, 50272 onTransformEnd: (e) => onTransformEndHandler(e), 50273 children: [
50274 /* @__PURE__ */ jsxRuntimeExports.jsx( 50275 Rect, 50276 { 50277 ref: shapeRef, 50278 width: marker.width, 50279 height: marker.height, 50280 cornerRadius: marker.width / 2, 50281 fill: marker.color 50282 } 50283 ), 50284 /* @__PURE__ */ jsxRuntimeExports.jsx( 50285 Text, 50286 { 50287 ref: textRef, 50288 fill: "white", 50289 fontFamily: "Kyiv*Type Sans", 50290 fontWeight: "500", 50291 fontSize: 24, 50292 scaleX: marker.textScale, 50293 scaleY: marker.textScale, 50294 x: marker.width / 2 - width.textWidth / 2, 50295 y: marker.height / 2 - width.textHeight / 2, 50296 text: marker.name 50297 } 50298 ) 50299 ] 50300 } 50301 ), 50302 isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx( 50303 Transformer, 50304 { 50305 ref: markerTrRef, 50306 enabledAnchors: ["top-left", "top-right", "bottom-left", "bottom-right"], 50307 anchorSize: 7, 50308 anchorStrokeWidth: 2, 50309 anchorFill: "#D9D9D9", 50310 anchorCornerRadius: 50, 50311 anchorStroke: "#9B9B9B", 50312 borderStroke: "#9B9B9B", 50313 centeredScaling: true, 50314 rotateEnabled: false, 50315 boundBoxFunc: (oldBox, newBox) => { 50316 const box = getClientRect(newBox); 50317 const isOut = box.x < 0 || box.y < 0 || box.x + box.width > stageWidth || box.y + box.height > stageHeight; 50318 return isOut ? oldBox : newBox; 50319 } 50320 } 50321 ) 50322 ] }); 50323}; 50324 50325const KonvaImage = (props) => { 50326 const { imageRef, imageProps, isSelected, image, imageTrRef, onSelect, onChange, stageWidth, stageHeight } = props; 50327 reactExports.useEffect(() => { 50328 if (imageTrRef.current && isSelected) { 50329 imageTrRef.current.nodes([imageRef.current]); 50330 imageTrRef.current.getLayer().batchDraw(); 50331 } 50332 }, [isSelected]); 50333 const onDragHandler = () => { 50334 onSelect(); 50335 if (!imageTrRef.current) return; 50336 const boxes = imageTrRef.current.nodes().map((node) => node.getClientRect()); 50337 const box = getTotalBox(boxes); 50338 imageTrRef.current.nodes().forEach((shape) => { 50339 const absPos = shape.getAbsolutePosition(); 50340 const offsetX = box.x - absPos.x; 50341 const offsetY = box.y - absPos.y; 50342 const newAbsPos = { ...absPos }; 50343 if (box.x < 0) { 50344 newAbsPos.x = -offsetX; 50345 } 50346 if (box.y < 0) { 50347 newAbsPos.y = -offsetY; 50348 } 50349 if (box.x + box.width > stageWidth) { 50350 newAbsPos.x = stageWidth - box.width - offsetX; 50351 } 50352 if (box.y + box.height > stageHeight) { 50353 newAbsPos.y = stageHeight - box.height - offsetY; 50354 } 50355 shape.setAbsolutePosition(newAbsPos); 50356 }); 50357 }; 50358 const onTransformEndHandler = () => { 50359 const node = imageRef.current; 50360 if (!node) return; 50361 const scaleX = node.attrs.scaleX; 50362 const scaleY = node.attrs.scaleY; 50363 onChange({ 50364 id: imageProps.id, 50365 x: node.attrs.x, 50366 y: node.attrs.y, 50367 width: imageProps.width, 50368 height: imageProps.height, 50369 scaleX, 50370 scaleY 50371 }); 50372 }; 50373 return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 50374 /* @__PURE__ */ jsxRuntimeExports.jsx( 50375 Image$1, 50376 { 50377 x: imageProps.x, 50378 y: imageProps.y, 50379 width: imageProps.width, 50380 height: imageProps.height, 50381 onClick: onSelect, 50382 onTap: onSelect, 50383 ref: imageRef, 50384 image, 50385 draggable: true, 50386 onDragMove: onDragHandler, 50387 onDragEnd: (e) => { 50388 onChange({ 50389 id: imageProps.id, 50390 x: e.target.x(), 50391 y: e.target.y(), 50392 width: imageProps.width, 50393 height: imageProps.height, 50394 scaleX: e.currentTarget.scaleX(), 50395 scaleY: e.currentTarget.scaleY() 50396 }); 50397 }, 50398 onTransformEnd: onTransformEndHandler 50399 } 50400 ),
50401 isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx( 50402 Transformer, 50403 { 50404 ref: imageTrRef, 50405 anchorSize: 7, 50406 anchorStrokeWidth: 2, 50407 anchorFill: "#D9D9D9", 50408 anchorCornerRadius: 50, 50409 anchorStroke: "#9B9B9B", 50410 borderStroke: "#9B9B9B", 50411 rotateEnabled: false, 50412 boundBoxFunc: (oldBox, newBox) => { 50413 const box = getClientRect(newBox); 50414 const isOut = box.x < 0 || box.y < 0 || box.x + box.width > stageWidth || box.y + box.height > stageHeight; 50415 return isOut ? oldBox : newBox; 50416 } 50417 } 50418 ) 50419 ] }); 50420}; 50421 50422const copyIcon = "data:image/svg+xml,%3csvg%20width='16'%20height='18'%20viewBox='0%200%2016%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.7%200.666657H7.45487C5.98466%200.666644%204.82015%200.666634%203.90878%200.789657C2.97084%200.916266%202.21169%201.18303%201.613%201.78412C1.0143%202.38522%200.748611%203.14742%200.622508%204.08913C0.499978%205.00416%200.499988%206.17334%200.5%207.64945V12.514C0.5%2013.7708%201.26663%2014.8478%202.35597%2015.2993C2.2999%2014.5415%202.29995%2013.4781%202.3%2012.5934V8.41867C2.29994%207.35061%202.29989%206.43036%202.39857%205.69342C2.50433%204.90364%202.74282%204.14659%203.35442%203.53254C3.96601%202.91849%204.72003%202.67903%205.50665%202.57285C6.24064%202.47377%207.15722%202.47382%208.221%202.47388H10.779C11.8428%202.47382%2012.7574%202.47377%2013.4914%202.57285C13.0523%201.45648%2011.968%200.666657%2010.7%200.666657Z'%20fill='white'/%3e%3cpath%20d='M3.50008%208.49781C3.50008%206.22599%203.50008%205.09007%204.20302%204.3843C4.90597%203.67854%206.03734%203.67854%208.30008%203.67854H10.7001C12.9628%203.67854%2014.0942%203.67854%2014.7971%204.3843C15.5001%205.09007%2015.5001%206.22599%2015.5001%208.49782V12.5139C15.5001%2014.7857%2015.5001%2015.9216%2014.7971%2016.6274C14.0942%2017.3332%2012.9628%2017.3332%2010.7001%2017.3332H8.30008C6.03734%2017.3332%204.90597%2017.3332%204.20302%2016.6274C3.50008%2015.9216%203.50008%2014.7857%203.50008%2012.5139V8.49781Z'%20fill='white'/%3e%3c/svg%3e"; 50423 50424const TrashIcon = (props) => { 50425 const { color, ...rest } = props; 50426 return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { ...rest, width: "16", height: "18", viewBox: "0 0 16 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ 50427 /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M0.5 4.32163C0.5 3.91792 0.787817 3.59065 1.14286 3.59065L3.36306 3.59025C3.80419 3.57754 4.19335 3.2586 4.34345 2.78675C4.3474 2.77435 4.35193 2.75905 4.36821 2.70352L4.46388 2.37712C4.52242 2.177 4.57342 2.00264 4.64479 1.8468C4.92674 1.23112 5.4484 0.803589 6.05122 0.69413C6.20381 0.666423 6.3654 0.66654 6.55088 0.666675H9.44926C9.63474 0.66654 9.79633 0.666423 9.94892 0.69413C10.5517 0.803589 11.0734 1.23112 11.3554 1.8468C11.4267 2.00264 11.4777 2.177 11.5363 2.37712L11.6319 2.70352C11.6482 2.75905 11.6527 2.77435 11.6567 2.78675C11.8068 3.2586 12.2732 3.57793 12.7143 3.59065H14.8571C15.2122 3.59065 15.5 3.91792 15.5 4.32163C15.5 4.72535 15.2122 5.05262 14.8571 5.05262H1.14286C0.787817 5.05262 0.5 4.72535 0.5 4.32163Z", fill: color || "white" }), 50428 /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.663 17.3334H8.337C10.6559 17.3334 11.8154 17.3334 12.5693 16.5952C13.3231 15.8569 13.4003 14.6459
vendor: 4,049 bytes, lines 50428-50432
5042813.5545 12.2238L13.7768 8.73393C13.8605 7.41977 13.9023 6.76269 13.5241 6.34631C13.1459 5.92992 12.5073 5.92992 11.23 5.92992H4.77004C3.49272 5.92992 2.85407 5.92992 2.47588 6.34631C2.09769 6.76269 2.13953 7.41977 2.22323 8.73393L2.44549 12.2238C2.59975 14.6459 2.67687 15.8569 3.43074 16.5952C4.18461 17.3334 5.34407 17.3334 7.663 17.3334ZM6.53856 9.15716C6.50422 8.79562 6.19794 8.53184 5.85448 8.56799C5.51101 8.60415 5.26042 8.92654 5.29477 9.28809L5.71143 13.6741C5.74578 14.0356 6.05206 14.2994 6.39552 14.2632C6.73899 14.2271 6.98958 13.9047 6.95523 13.5431L6.53856 9.15716ZM10.1455 8.56799C10.489 8.60415 10.7396 8.92654 10.7052 9.28809L10.2886 13.6741C10.2542 14.0356 9.94794 14.2994 9.60448 14.2632C9.26101 14.2271 9.01042 13.9047 9.04477 13.5431L9.46144 9.15716C9.49578 8.79562 9.80206 8.53184 10.1455 8.56799Z", fill: color || "white" }) 50429 ] }); 50430}; 50431 50432function u(){return (u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);}return e}).apply(this,arguments)}function c(e,r){if(null==e)return {};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function i(e){var t=reactExports.useRef(e),n=reactExports.useRef(function(e){t.current&&t.current(e);});return t.current=e,n.current}var s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},f=function(e){return "touches"in e},v=function(e){return e&&e.ownerDocument.defaultView||self},d=function(e,r,t){var n=e.getBoundingClientRect(),o=f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return {left:s((o.pageX-(n.left+v(e).pageXOffset))/n.width),top:s((o.pageY-(n.top+v(e).pageYOffset))/n.height)}},h=function(e){!f(e)&&e.preventDefault();},m=e$2.memo(function(o){var a=o.onMove,l=o.onKey,s=c(o,["onMove","onKey"]),m=reactExports.useRef(null),g=i(a),p=i(l),b=reactExports.useRef(null),_=reactExports.useRef(false),x=reactExports.useMemo(function(){var e=function(e){h(e),(f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(d(m.current,e,b.current)):t(false);},r=function(){return t(false)};function t(t){var n=_.current,o=v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r);}return [function(e){var r=e.nativeEvent,n=m.current;if(n&&(h(r),!function(e,r){return r&&!f(e)}(r,_.current)&&n)){if(f(r)){_.current=true;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier);}n.focus(),g(d(n,r,b.current)),t(true);}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-0.05:0,top:40===r?.05:38===r?-0.05:0}));},t]},[p,g]),C=x[0],E=x[1],H=x[2];return reactExports.useEffect(function(){return H},[H]),e$2.createElement("div",u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),g=function(e){return e.filter(Boolean).join(" ")},p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=g(["react-colorful__pointer",r.className]);return e$2.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},e$2.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},x=function(e){return L(C(e))},C=function(e){return "#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?b(parseInt(e.substring(6,8),16)/255,2):1}},w=function(e){return K(I(e))},y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return {h:b(e.h),s:b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:b(o/2),a:b(n,2)}},q=function(e){var r=y(e);return "hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},I=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;
50432var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return {r:b(255*[n,u,l,l,c,n][i]),g:b(255*[c,n,n,u,l,l][i]),b:b(255*[l,l,c,n,n,u][i]),a:b(o,2)}},D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?D(b(255*o)):"";return "#"+D(r)+D(t)+D(n)+a},L=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return {h:b(60*(u<0?u+6:u)),s:b(a?l/a*100:0),v:b(a/255*100),a:o}},S=e$2.memo(function(r){var t=r.hue,n=r.onChange,o=g(["react-colorful__hue",r.className]);return e$2.createElement("div",{className:o},e$2.createElement(m,{onMove:function(e){n({h:360*e.left});},onKey:function(e){n({h:s(t+360*e.left,0,360)});},"aria-label":"Hue","aria-valuenow":b(t),"aria-valuemax":"360","aria-valuemin":"0"},e$2.createElement(p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),T=e$2.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return e$2.createElement("div",{className:"react-colorful__saturation",style:o},e$2.createElement(m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top});},onKey:function(e){n({s:s(t.s+100*e.left,0,100),v:s(t.v-100*e.top,0,100)});},"aria-label":"Color","aria-valuetext":"Saturation "+b(t.s)+"%, Brightness "+b(t.v)+"%"},e$2.createElement(p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return true;for(var t in e)if(e[t]!==r[t])return false;return true},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(C(e),C(r))};function Y(e,t,l){var u=i(l),c=reactExports.useState(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=reactExports.useRef({color:t,hsva:s});reactExports.useEffect(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r);}},[t,e]),reactExports.useEffect(function(){var r;F(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r));},[s,e,u]);var d=reactExports.useCallback(function(e){f(function(r){return Object.assign({},r,e)});},[]);return [s,d]}var V="undefined"!=typeof window?reactExports.useLayoutEffect:reactExports.useEffect,$=function(){return ("undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0)},J=new Map,Q=function(e){V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',J.set(r,t);var n=$();n&&t.setAttribute("nonce",n),r.head.appendChild(t);}},[]);},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=c(t,["className","colorModel","color","onChange"]),f=reactExports.useRef(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=g(["react-colorful",n]);return e$2.createElement("div",u({},s,{ref:f,className:m}),e$2.createElement(T,{hsva:d,onChange:h}),e$2.createElement(S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:"000",toHsva:x,fromHsva:function(e){return w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return e$2.createElement(U,u({},r,{colorModel:W}))}; 50433 50434const POPUP_WIDTH = 240; 50435const POPUP_HEIGHT = 276; 50436const UiColorPicker = (props) => { 50437 const { color, onChange } = props; 50438 const [isOpen, setIsOpen] = reactExports.useState(false); 50439 const [popupStyle, setPopupStyle] = reactExports.useState(null); 50440 const buttonRef = reactExports.useRef(null); 50441 const popupRef = reactExports.useRef(null); 50442 const portalRoot = document.getElementById("portal-root"); 50443 const calculatePosition = reactExports.useCallback(() => { 50444 if (buttonRef.current) { 50445 const rect = buttonRef.current.getBoundingClientRect(); 50446 const spaceRight = window.innerWidth - rect.left; 50447 const spaceLeft = rect.right; 50448 const spaceBottom = window.innerHeight - rect.bottom; 50449 const spaceTop = rect.top; 50450 const openLeft = spaceRight < POPUP_WIDTH && spaceLeft > POPUP_WIDTH; 50451 const openTop = spaceBottom < POPUP_HEIGHT && spaceTop > POPUP_HEIGHT; 50452 const left = openLeft ? rect.right - POPUP_WIDTH + window.scrollX : rect.left + window.scrollX; 50453 const top = openTop ? rect.top - POPUP_HEIGHT + window.scrollY - 8 : rect.bottom + window.scrollY + 8; 50454 setPopupStyle({ top, left }); 50455 } 50456 }, []); 50457 reactExports.useEffect(() => { 50458 if (isOpen) { 50459 calculatePosition(); 50460 window.addEventListener("resize", calculatePosition); 50461 window.addEventListener("scroll", calculatePosition); 50462 } 50463 return () => { 50464 window.removeEventListener("resize", calculatePosition); 50465 window.removeEventListener("scroll", calculatePosition); 50466 }; 50467 }, [isOpen, calculatePosition]); 50468 reactExports.useEffect(() => { 50469 const handleClickOutside = (event) => { 50470 const target = event.target; 50471 const isPopupClick = popupRef.current && !popupRef.current.contains(target); 50472 const isPopupButtonClick = buttonRef.current && !buttonRef.current.contains(target); 50473 if (isPopupClick && isPopupButtonClick) { 50474 setIsOpen(false); 50475 } 50476 }; 50477 if (isOpen) { 50478 document.addEventListener("mousedown", handleClickOutside); 50479 } else { 50480 document.removeEventListener("mousedown", handleClickOutside); 50481 } 50482 return () => document.removeEventListener("mousedown", handleClickOutside); 50483 }, [isOpen]); 50484 return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
50485 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ref: buttonRef, onClick: () => setIsOpen((v) => !v), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-5 h-5 rounded-[4px] border", style: { backgroundColor: color } }) }), 50486 isOpen && portalRoot && ReactDOM.createPortal( 50487 /* @__PURE__ */ jsxRuntimeExports.jsxs( 50488 "div", 50489 { 50490 ref: popupRef, 50491 className: "absolute z-50 bg-white border rounded shadow p-4 w-60", 50492 style: { 50493 top: popupStyle?.top, 50494 left: popupStyle?.left, 50495 position: "absolute", 50496 opacity: !popupStyle ? 0 : 1 50497 }, 50498 children: [ 50499 /* @__PURE__ */ jsxRuntimeExports.jsx(Z, { color, onChange }), 50500 /* @__PURE__ */ jsxRuntimeExports.jsx( 50501 "input", 50502 { 50503 type: "text", 50504 value: color, 50505 onChange: (e) => onChange(e.target.value), 50506 className: "mt-3 w-full border rounded px-2 py-1 text-sm text-gray-700 focus:outline-none focus:ring focus:border-blue-400" 50507 } 50508 ) 50509 ] 50510 } 50511 ), 50512 portalRoot 50513 ) 50514 ] }); 50515}; 50516 50517const ChildMarkerTags = (props) => { 50518 const { childMarkersList, onClickDeleteCopyItemHandler } = props; 50519 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "child-marker-tags-wrapper", style: { margin: childMarkersList.length > 0 ? void 0 : "0" }, children: childMarkersList.map((child) => { 50520 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tag", children: [
50521 /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "tag-text", children: [ 50522 "Tag: ", 50523 child.name 50524 ] }), 50525 /* @__PURE__ */ jsxRuntimeExports.jsx( 50526 "button", 50527 { 50528 style: { color: child.isSelectedCopyItem ? "#007178" : void 0 }, 50529 className: "tag-close", 50530 "aria-label": "Remove tag", 50531 onClick: () => onClickDeleteCopyItemHandler(child.id), 50532 children: "Ã" 50533 } 50534 ) 50535 ] }, child.id); 50536 }) }); 50537}; 50538 50539const MarkerActions = (props) => { 50540 const { 50541 item, 50542 childMarkersList, 50543 isError, 50544 onDelete, 50545 onUpdateItemHandler, 50546 onClickCopyIconHandler, 50547 onClickDeleteCopyItemHandler 50548 } = props; 50549 const [isItemHasError, setIsItemHasError] = reactExports.useState(isError); 50550 const onTrashClick = () => { 50551 onDelete(item); 50552 }; 50553 const onInputMarkerDescriptionHandler = (value) => { 50554 setIsItemHasError(value.length === 0); 50555 onUpdateItemHandler({ ...item, description: value, isError: value.length === 0 }); 50556 }; 50557 const onColorChangeHandler = (color) => { 50558 const newColor = color; 50559 if (childMarkersList) { 50560 childMarkersList.forEach((childItem) => { 50561 if (childItem.parentId === item.id) { 50562 childItem.color = newColor; 50563 } 50564 }); 50565 } 50566 onUpdateItemHandler({ 50567 ...item, 50568 color: newColor 50569 }); 50570 }; 50571 const copyItem = () => { 50572 onClickCopyIconHandler(item.id); 50573 }; 50574 reactExports.useEffect(() => { 50575 setIsItemHasError(isError); 50576 }, [isError]); 50577 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "marker-component", children: [ 50578 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "header", children: [
50579 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "tag-item", children: `Tag: ${item.name}` }) }), 50580 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "icon-buttons", children: [ 50581 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "icon-button", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 50582 UiColorPicker, 50583 { 50584 color: item.color, 50585 onChange: onColorChangeHandler 50586 } 50587 ) }), 50588 /* @__PURE__ */ jsxRuntimeExports.jsx("hr", {}), 50589 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "icon-button", onClick: copyItem, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: copyIcon, width: "15", alt: "Costquest" }) }), 50590 /* @__PURE__ */ jsxRuntimeExports.jsx("hr", {}), 50591 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "icon-button", onClick: onTrashClick, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TrashIcon, { width: 15, alt: "remove connection button" }) }) 50592 ] }) 50593 ] }), 50594 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content", children: [
50595 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "item-wrapper", children: [ 50596 /* @__PURE__ */ jsxRuntimeExports.jsx( 50597 TextArea, 50598 { 50599 withAutosize: true, 50600 isFocused: false, 50601 maxLength: 250, 50602 rows: 1, 50603 className: `customTextarea rounded-xl ${isItemHasError ? "customTextarea_error" : ""}`, 50604 placeholder: "Enter description", 50605 value: item.description, 50606 onChange: onInputMarkerDescriptionHandler 50607 } 50608 ), 50609 isItemHasError && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "error-message", children: "Description is required" }), 50610 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "counter", children: `${item.description.length} / 250` }) 50611 ] }), 50612 childMarkersList && /* @__PURE__ */ jsxRuntimeExports.jsx( 50613 ChildMarkerTags, 50614 { 50615 childMarkersList, 50616 onClickDeleteCopyItemHandler 50617 } 50618 ) 50619 ] }) 50620 ] }); 50621}; 50622 50623const Markers = () => { 50624 const { 50625 stageRef, 50626 imageRef, 50627 imageAttrs, 50628 groupRef, 50629 imageTrRef, 50630 markerTrRef, 50631 selectedPictureId, 50632 markersList, 50633 selectedMarkerId, 50634 selectedCopyMarkerId, 50635 imageElement, 50636 childMarkersList, 50637 saveLoading, 50638 stageSize, 50639 setMarkersList, 50640 setChildMarkersList, 50641 onSelectCopyMarkerHandler, 50642 onClickCopyIconHandler, 50643 onClickDeleteCopyItemHandler, 50644 onDeleteMarkerHandler, 50645 onSelectImageHandler, 50646 onClickClearSelectedItemsHandler, 50647 onUpdateItemHandler, 50648 onClickAddNewMarkerHandler, 50649 onImageWithMarkersSave, 50650 onChangeImageHandler, 50651 onSelectMarkerHandler 50652 } = useMarkers(); 50653 const checkDeselect = (e) => { 50654 if (!e || !e.target) return; 50655 const clickedOnEmpty = e.target === e.target.getStage(); 50656 if (clickedOnEmpty) onClickClearSelectedItemsHandler(); 50657 };
50658 return saveLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { info: loadingPatentDescription.markers, loading: true, progress: 0 }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "editor-component", children: [ 50659 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "editor-container", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content", children: [ 50660 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content-header", children: [ 50661 /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "title", children: "Let's work on it together now!" }), 50662 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text", children: "Highlight the key features of your invention by placing tags directly on the important parts of the invention." }) 50663 ] }), 50664 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "stage-ref", ref: stageRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 50665 Stage, 50666 { 50667 className: "stage", 50668 width: stageSize?.width, 50669 height: stageSize?.height, 50670 onMouseDown: checkDeselect, 50671 onTouchStart: checkDeselect, 50672 children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layer, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { ref: groupRef, children: [
50673 /* @__PURE__ */ jsxRuntimeExports.jsx( 50674 KonvaImage, 50675 { 50676 stageWidth: stageSize?.width, 50677 stageHeight: stageSize?.height, 50678 imageRef, 50679 imageTrRef, 50680 imageProps: imageAttrs, 50681 image: imageElement, 50682 isSelected: imageAttrs.id === selectedPictureId, 50683 onChange: onChangeImageHandler, 50684 onSelect: onSelectImageHandler 50685 } 50686 ), 50687 markersList.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx( 50688 Marker, 50689 { 50690 stageWidth: stageSize?.width, 50691 stageHeight: stageSize?.height, 50692 marker: item, 50693 markerTrRef, 50694 isSelected: selectedMarkerId === item.id, 50695 onSelect: onSelectMarkerHandler(item.id), 50696 onChange: (newAttrs) => { 50697 const markers = markersList.slice(); 50698 markers[i] = newAttrs; 50699 setMarkersList(markers); 50700 } 50701 }, 50702 item.id 50703 )), 50704 childMarkersList.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx( 50705 Marker, 50706 { 50707 stageWidth: stageSize?.width, 50708 stageHeight: stageSize?.height, 50709 marker: item, 50710 markerTrRef, 50711 isSelected: selectedCopyMarkerId === item.id, 50712 onSelect: onSelectCopyMarkerHandler(item.id), 50713 onChange: (newAttrs) => { 50714 const childMarkers = childMarkersList.slice(); 50715 childMarkers[i] = newAttrs; 50716 setChildMarkersList(childMarkers); 50717 } 50718 }, 50719 item.id 50720 )) 50721 ] }) }) 50722 } 50723 ) }) 50724 ] }) }), 50725 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "markers-container", children: [ 50726 markersList.length !== 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "markers-list", children: markersList.map((item) => { 50727 const currentItemChildList = childMarkersList?.filter( 50728 (child) => child.parentId === item.id 50729 ); 50730 return /* @__PURE__ */ jsxRuntimeExports.jsx( 50731 MarkerActions, 50732 { 50733 item, 50734 isError: item.isError, 50735 childMarkersList: currentItemChildList, 50736 onDelete: onDeleteMarkerHandler, 50737 onClickCopyIconHandler, 50738 onClickDeleteCopyItemHandler, 50739 onUpdateItemHandler 50740 }, 50741 item.id 50742 ); 50743 }) }), 50744 markersList?.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "gradient-content-wrapper", children: [
50745 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "title", children: "Highlight something important?" }), 50746 /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "subtitle", children: [ 50747 "There are no tags in the picture right now. ", 50748 /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}), 50749 "Click Add a Tag to get started." 50750 ] }), 50751 /* @__PURE__ */ jsxRuntimeExports.jsxs( 50752 "button", 50753 { 50754 onClick: onClickAddNewMarkerHandler, 50755 className: "w-auto btn-outlined add-tag-btn", 50756 children: [ 50757 /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "ic:round-add-circle", width: "20", height: "20" }), 50758 "Add a Tag" 50759 ] 50760 } 50761 ) 50762 ] }), 50763 markersList?.length !== 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs( 50764 "button", 50765 { 50766 onClick: onClickAddNewMarkerHandler, 50767 className: "w-auto btn-outlined add-tag-btn mx-[24px]", 50768 children: [
50769 /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "ic:round-add-circle", width: "20", height: "20" }), 50770 "Add a Tag" 50771 ] 50772 } 50773 ), 50774 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "actions", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 50775 "button", 50776 { 50777 onClick: onImageWithMarkersSave, 50778 disabled: saveLoading || markersList.length < 2, 50779 className: "btn-main", 50780 children: "Continue" 50781 } 50782 ) }) 50783 ] }) 50784 ] }); 50785}; 50786 50787const findDuplicateMarkers = (arr) => { 50788 const map = /* @__PURE__ */ new Map(); 50789 arr.forEach((item) => { 50790 const key = item.markers.slice().sort().join(","); 50791 if (!map.has(key)) { 50792 map.set(key, []); 50793 } 50794 map.get(key)?.push(item); 50795 }); 50796 const duplicates = Array.from(map.values()).filter((group) => group.length > 1); 50797 return duplicates; 50798}; 50799 50800const useInteractions = () => { 50801 const navigate = useNavigate(); 50802 const { appState } = useAppData(); 50803 const mainTitle = "Great design! Now lets mark parts of it."; 50804 const errorTitle = "Please add more markers to interact with them. Minimum 2 markers on picture for interaction"; 50805 const [markers, setMarkers] = reactExports.useState([]); 50806 const [saveLoading, setSaveLoading] = reactExports.useState(false); 50807 const [modifiedImage, setModifiedImage] = reactExports.useState(""); 50808 const [optionsForInteraction, setOptionsForInteraction] = reactExports.useState([]); 50809 const [markersInteractions, setMarkersInteractions] = reactExports.useState([]); 50810 const isMarkersInteractionsListNotValid = markers.length < 2; 50811 const saveMarkersInteractionsList = async () => { 50812 try { 50813 const sessionId = localStorage.getItem(SESSION_ID_NAME) || ""; 50814 const { data } = await axios.patch(API_URLS.PATENT_INTERACTIONS, { 50815 session_id: sessionId, 50816 interactions: markersInteractions.map((x) => ({ 50817 markers: x.markers, 50818 description: x.description 50819 })) 50820 }); 50821 if (data.session_id) { 50822 localStorage.setItem(SESSION_ID_NAME, data.session_id); 50823 } 50824 ; 50825 } catch (e) { 50826 console.log(e); 50827 throw e; 50828 } 50829 }; 50830 const onClickAddNewItems = () => { 50831 const initData = { 50832 id: null, 50833 uiId: v4(), 50834 markers: [], 50835 description: "", 50836 markersErrorMessage: "", 50837 isDescriptionError: false, 50838 isMarkersError: false 50839 }; 50840 setMarkersInteractions([...markersInteractions, initData]); 50841 }; 50842 const updateMarkersInteractions = (item) => { 50843 setMarkersInteractions((prevState) => { 50844 return prevState.map((prevItem) => { 50845 return prevItem.uiId === item.uiId ? item : prevItem; 50846 }); 50847 }); 50848 }; 50849 const onClickSaveButtonHandler = async () => { 50850 const emptyInteraction = markersInteractions.find((x) => !x.description || x.markers.length < 2); 50851 const duplicateInteractionPair = findDuplicateMarkers(markersInteractions).flat().length !== 0; 50852 setMarkersInteractions((prevState) => { 50853 return prevState.map((item) => { 50854 return { 50855 ...item, 50856 isDescriptionError: !item.description.length, 50857 isMarkersError: item.markers.length < 2 || duplicateInteractionPair 50858 }; 50859 }); 50860 }); 50861 if (emptyInteraction || duplicateInteractionPair) return; 50862 try { 50863 setSaveLoading(true); 50864 await saveMarkersInteractionsList(); 50865 navigate("/patent/context"); 50866 } finally { 50867 setSaveLoading(false); 50868 } 50869 }; 50870 const onDeleteInteraction = (id) => () => { 50871 setMarkersInteractions(markersInteractions.filter((item) => item.uiId !== id)); 50872 }; 50873 reactExports.useEffect(() => { 50874 if (!appState.patent?.imageURL || !appState.patent?.markers?.length) { 50875 navigate("/patent/"); 50876 } else { 50877 setModifiedImage(appState.patent?.imageURL); 50878 setMarkers(appState.patent?.markers); 50879 setOptionsForInteraction(appState.patent?.markers.map((marker) => { 50880 return { value: marker.id, label: marker.name }; 50881 })); 50882 } 50883 }, [appState]); 50884 return { 50885 mainTitle, 50886 errorTitle, 50887 markers, 50888 saveLoading, 50889 modifiedImage, 50890 optionsForInteraction, 50891 markersInteractions, 50892 isMarkersInteractionsListNotValid, 50893 onClickAddNewItems, 50894 updateMarkersInteractions, 50895 onClickSaveButtonHandler, 50896 onDeleteInteraction 50897 }; 50898}; 50899 50900const getCustomStyles = (props) => ({ 50901 control: (base) => ({ 50902 ...base, 50903 borderRadius: "0.75rem", 50904 borderColor: props.isError ? "red" : "#8D9BE5", 50905 background: "#171824", 50906 padding: "4px 6px", 50907 minHeight: "48px",
50908 boxShadow: "none", 50909 "&:hover": { 50910 borderColor: "#cfd4d9" 50911 } 50912 }), 50913 input: (base) => ({ 50914 ...base, 50915 color: "#fff" 50916 // ÑÐ²ÐµÑ ÑекÑÑа 50917 }), 50918 placeholder: (base) => ({ 50919 ...base, 50920 color: "#555", 50921 fontSize: "20px", 50922 fontWeight: 400 50923 }), 50924 dropdownIndicator: (base) => ({ 50925 ...base, 50926 color: "#333", 50927 paddingRight: 12 50928 }), 50929 indicatorSeparator: () => ({ 50930 display: "none" 50931 }), 50932 menu: (base) => ({ 50933 ...base, 50934 background: "#171824", 50935 borderRadius: "0.75rem" 50936 }), 50937 option: (styles, { isFocused, isSelected }) => { 50938 return { 50939 ...styles, 50940 "color": "#F3F3F3", 50941 "backgroundColor": isSelected ? "#1E1F2D" : isFocused ? "#1E1F2D" : void 0, 50942 ":active": { 50943 ...styles[":active"], 50944 backgroundColor: "#1E1F2D" 50945 }, 50946 "cursor": "pointer", 50947 "padding": "12px 8px", 50948 "borderRadius": "3px" 50949 }; 50950 }, 50951 multiValue: (base) => ({ 50952 ...base, 50953 padding: "2px 6px", 50954 gap: "8px", 50955 justifyContent: "center", 50956 alignItems: "center" 50957 }), 50958 multiValueRemove: (base) => ({ 50959 ...base, 50960 borderRadius: "100%", 50961 border: "1px solid #000", 50962 height: "max-content", 50963 padding: "0px", 50964 color: "#000" 50965 }) 50966}); 50967const CustomDropdownIndicator = (props) => { 50968 return /* @__PURE__ */ jsxRuntimeExports.jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx( 50969 "span", 50970 { 50971 className: clsx( 50972 "icon-[solar--alt-arrow-down-bold] text-[18px] text-lavender shrink-0", 50973 props.selectProps.menuIsOpen ? "rotate-180" : "" 50974 ) 50975 } 50976 ) }); 50977}; 50978const customComponents = { 50979 DropdownIndicator: CustomDropdownIndicator 50980}; 50981const UISelect = (props) => { 50982 const { isMulti = false, value, onChange, options, placeholder = "Select options", className, isError = false } = props; 50983 return /* @__PURE__ */ jsxRuntimeExports.jsx( 50984 StateManagedSelect$1, 50985 { 50986 className, 50987 options, 50988 styles: getCustomStyles({ isError }), 50989 placeholder: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-[10px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-greyGentle grow", children: placeholder }) }), 50990 isMulti, 50991 value, 50992 onChange: (selected) => { 50993 onChange?.(selected); 50994 }, 50995 components: customComponents 50996 } 50997 ); 50998}; 50999 51000const TagsInteractions = (props) => { 51001 const { 51002 item, 51003 markersOptions, 51004 updateMarkersInteractions, 51005 onDeleteInteraction 51006 } = props; 51007 const onChangeDescriptionHandler = (value) => { 51008 updateMarkersInteractions({ 51009 ...item, 51010 description: value, 51011 isDescriptionError: value.length === 0 51012 }); 51013 }; 51014 const onChangeSelector = (options) => { 51015 updateMarkersInteractions({ 51016 ...item, 51017 markers: options.map((x) => x.value), 51018 isMarkersError: options.length < 2 51019 }); 51020 }; 51021 return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tags-interaction-details-wrapper", children: [ 51022 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content-wrapper", children: [
51023 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "item-wrapper", children: [ 51024 /* @__PURE__ */ jsxRuntimeExports.jsx( 51025 UISelect, 51026 { 51027 isMulti: true, 51028 options: markersOptions, 51029 placeholder: "Select Markers", 51030 className: item.markersErrorMessage?.length ? "error" : "", 51031 onChange: onChangeSelector, 51032 isError: item.isMarkersError 51033 } 51034 ), 51035 item.isMarkersError && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "markers-error-message", children: !item.markers.length ? "Markers is required" : item.markers.length < 2 ? "Select at least two markers" : "Markers must have unique pair" }) 51036 ] }), 51037 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "item-wrapper", children: [ 51038 /* @__PURE__ */ jsxRuntimeExports.jsx( 51039 TextArea, 51040 { 51041 withAutosize: true, 51042 isFocused: false, 51043 maxLength: 250, 51044 rows: 1, 51045 className: `customTextarea rounded-xl ${item.isDescriptionError ? "customTextarea_error" : ""}`, 51046 placeholder: "Enter description", 51047 value: item.description, 51048 onChange: onChangeDescriptionHandler 51049 } 51050 ), 51051 item.isDescriptionError && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "error-message", children: "Description is required" }),
51052 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "counter", children: `${item.description.length} / 250` }) 51053 ] }) 51054 ] }), 51055 /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "icon", onClick: onDeleteInteraction, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TrashIcon, { width: 15, alt: "remove connection button", color: "#8D9BE5" }) }) 51056 ] }); 51057}; 51058 51059const ConfirmationListItem = ({ item }) => { 51060 const { name, description } = item; 51061 return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: "confirmation-list-item", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "list-item-text", children: [ 51062 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "icon", children: name }), 51063 " - ", 51064 description 51065 ] }) }); 51066}; 51067 51068const MarkersInteractions = () => { 51069 const { 51070 mainTitle, 51071 errorTitle, 51072 markers, 51073 saveLoading, 51074 modifiedImage, 51075 optionsForInteraction, 51076 markersInteractions, 51077 isMarkersInteractionsListNotValid, 51078 onClickAddNewItems, 51079 updateMarkersInteractions, 51080 onClickSaveButtonHandler, 51081 onDeleteInteraction 51082 } = useInteractions();
51083 return saveLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { info: loadingPatentDescription.markerInteractions, loading: true, progress: 0 }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "confirmation-list", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "wrapper", children: [ 51084 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content-wrapper", children: [ 51085 /* @__PURE__ */ jsxRuntimeExports.jsx( 51086 "img", 51087 { 51088 width: "100%", 51089 style: { borderRadius: "8px" }, 51090 className: "patent-image", 51091 src: modifiedImage || "" 51092 } 51093 ), 51094 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "confirmation-list-wrapper", children: markers.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "confirmation-list", children: markers.map((marker) => { 51095 return /* @__PURE__ */ jsxRuntimeExports.jsx(ConfirmationListItem, { item: marker }, marker.id); 51096 }) }) }) }) 51097 ] }), 51098 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "markers-interaction-wrapper", children: !markersInteractions.length ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "gradient-content-wrapper ", children: [
51099 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "title", children: mainTitle }), 51100 /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "subtitle", children: [ 51101 "There are no interactions between your markers in the picture right now. ", 51102 /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}), 51103 "Click Add Interaction to get started." 51104 ] }), 51105 /* @__PURE__ */ jsxRuntimeExports.jsxs( 51106 "button", 51107 { 51108 disabled: isMarkersInteractionsListNotValid, 51109 onClick: onClickAddNewItems, 51110 className: "w-auto btn-outlined add-connection-btn mx-[24px]", 51111 children: [ 51112 /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "ic:round-add-circle", width: "20", height: "20" }), 51113 "Add Connections" 51114 ] 51115 } 51116 ) 51117 ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ 51118 isMarkersInteractionsListNotValid && /* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "markers-length-error-title", children: errorTitle }), 51119 markersInteractions.map((item) => { 51120 return /* @__PURE__ */ jsxRuntimeExports.jsx( 51121 TagsInteractions, 51122 { 51123 item, 51124 markersOptions: optionsForInteraction, 51125 updateMarkersInteractions, 51126 onDeleteInteraction: onDeleteInteraction(item.uiId) 51127 }, 51128 item.uiId 51129 ); 51130 }),
51131 /* @__PURE__ */ jsxRuntimeExports.jsxs( 51132 "button", 51133 { 51134 disabled: isMarkersInteractionsListNotValid, 51135 onClick: onClickAddNewItems, 51136 className: "w-auto btn-outlined add-connection-btn mx-[24px]", 51137 children: [ 51138 /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { icon: "ic:round-add-circle", width: "20", height: "20" }), 51139 "Add Connections" 51140 ] 51141 } 51142 ) 51143 ] }) }), 51144 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "project-footer-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "right-actions", children: /* @__PURE__ */ jsxRuntimeExports.jsx( 51145 "button", 51146 { 51147 onClick: onClickSaveButtonHandler, 51148 disabled: saveLoading || markersInteractions.length < 1, 51149 className: "btn-main", 51150 children: "Continue" 51151 } 51152 ) }) }) 51153 ] }) }); 51154}; 51155 51156const router = createBrowserRouter([ 51157 { 51158 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Guard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, { showVideo: true }) }), 51159 path: "/business", 51160 children: [ 51161 { index: true, element: /* @__PURE__ */ jsxRuntimeExports.jsx(Business, {}) }, 51162 { path: "check-segments", element: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckSegments, {}) }, 51163 { path: "segment", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Segement, {}) }, 51164 { path: "high-level-components", element: /* @__PURE__ */ jsxRuntimeExports.jsx(HighLevelComponents, {}) }, 51165 { path: "mvp", element: /* @__PURE__ */ jsxRuntimeExports.jsx(MVP, {}) } 51166 ] 51167 }, 51168 { 51169 path: "/patent", 51170 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Guard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, { showVideo: true }) }), 51171 children: [ 51172 { index: true, element: /* @__PURE__ */ jsxRuntimeExports.jsx(Patent, {}) }, 51173 { path: "visual-representation", element: /* @__PURE__ */ jsxRuntimeExports.jsx(VisualRepresentation, {}) }, 51174 { path: "markers", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Markers, {}) }, 51175 { path: "markers-interactions", element: /* @__PURE__ */ jsxRuntimeExports.jsx(MarkersInteractions, {}) }, 51176 { path: "context", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Context$2, {}) }, 51177 { path: "patent-draft", element: /* @__PURE__ */ jsxRuntimeExports.jsx(PatentDraft, {}) } 51178 ] 51179 }, 51180 { 51181 path: "/estimation", 51182 children: [ 51183 { 51184 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Guard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, {}) }), 51185 children: [ 51186 { 51187 index: true, 51188 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Start, {}) 51189 }, 51190 { 51191 path: "check-description", 51192 element: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckDescription, {}) 51193 }, 51194 { 51195 path: "check-file-description", 51196 element: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckFileDescription, {}) 51197 }, 51198 { 51199 path: "check-summary", 51200 element: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckSummary, {}) 51201 }, 51202 { 51203 path: "check-survey", 51204 element: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckSurvey, {}) 51205 } 51206 ] 51207 }, 51208 { 51209 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Guard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, { withActions: true, showVideo: true }) }), 51210 children: [{ path: "limits", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Questions, {}) }] 51211 }, 51212 { 51213 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Guard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, { showVideo: true }) }), 51214 children: [{ path: "survey", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Survey, {}) }] 51215 } 51216 ] 51217 }, 51218 //final page 51219 { 51220 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Guard, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, { showModal: true }) }), 51221 children: [ 51222 { path: "/estimation/final", element: /* @__PURE__ */ jsxRuntimeExports.jsx(FinalPage, { url: API_URLS.SEND_PROPOSAL_ESTIMATE }) }, 51223 { path: "/business/final", element: /* @__PURE__ */ jsxRuntimeExports.jsx(FinalPage, { url: API_URLS.SEND_BUSINESS_ESTIMATE }) }, 51224 { path: "/patent/final", element: /* @__PURE__ */ jsxRuntimeExports.jsx(FinalPage, { url: API_URLS.SEND_PATENT_ESTIMATE }) } 51225 ] 51226 }, 51227 // auth routes 51228 { 51229 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, {}), 51230 children: [ 51231 { 51232 path: "/auth/:social/:action", 51233 element: /* @__PURE__ */ jsxRuntimeExports.jsx(RedirectSocial, {}) 51234 }, 51235 { 51236 path: "/social/:social/success", 51237 element: /* @__PURE__ */ jsxRuntimeExports.jsx(SuccessSocial, {}) 51238 } 51239 ] 51240 }, 51241 { 51242 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, {}), 51243 children: [ 51244 { 51245 path: "/", 51246 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Landing, {}) 51247 }, 51248 { 51249 path: "/waitlist", 51250 element: /* @__PURE__ */ jsxRuntimeExports.jsx(Waitlist, {}) 51251 }, 51252 { 51253 path: "/privacy-policy", 51254 element: /* @__PURE__ */ jsxRuntimeExports.jsx(PrivacyPolicy, {}) 51255 }, 51256 { 51257 path: "/terms-of-use", 51258 element: /* @__PURE__ */ jsxRuntimeExports.jsx(TermsOfUse, {}) 51259 } 51260 ] 51261 }, 51262 { 51263 element: /* @__PURE__ */ jsxRuntimeExports.jsx(ProtectedRoute, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, {}) }), 51264 children: [{ path: "/workspace", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Workspace, {}) }] 51265 }
51266]); 51267client.createRoot(document.getElementById("root")).render( 51268 /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, {}), children: /* @__PURE__ */ jsxRuntimeExports.jsx(AuthProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AppDataProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(RouterProvider, { router }) }) }) }) 51269);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.