From 677e59a5479ce702b4fd01a33d27c17450be24ba Mon Sep 17 00:00:00 2001 From: Vedanshu Jain Date: Fri, 5 Jun 2026 17:17:04 +0530 Subject: [PATCH] feat: add price slider filter to Shop page Adds a dual-handle price range slider that auto-detects the min/max prices from the catalog and filters products in real-time with 300ms debounce. Pure React, no extra dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../dist/assets/index-DAW23qF1.js | 51 ++++++ .../dist/assets/index-DGnXaPK9.js | 51 ------ .../dist/assets/style-A1w-0fGi.css | 1 + .../dist/assets/style-sOtZaEm7.css | 1 - themes/demo-store-headless/dist/index.html | 4 +- .../demo-store-headless/src/api/products.js | 106 +++++++++++- .../src/components/PriceSlider.jsx | 104 +++++++++++ .../src/components/ProductList.jsx | 17 +- themes/demo-store-headless/src/pages/Shop.jsx | 98 ++++++++++- .../src/styles/PriceSlider.css | 163 ++++++++++++++++++ 10 files changed, 532 insertions(+), 64 deletions(-) create mode 100644 themes/demo-store-headless/dist/assets/index-DAW23qF1.js delete mode 100644 themes/demo-store-headless/dist/assets/index-DGnXaPK9.js create mode 100644 themes/demo-store-headless/dist/assets/style-A1w-0fGi.css delete mode 100644 themes/demo-store-headless/dist/assets/style-sOtZaEm7.css create mode 100644 themes/demo-store-headless/src/components/PriceSlider.jsx create mode 100644 themes/demo-store-headless/src/styles/PriceSlider.css diff --git a/themes/demo-store-headless/dist/assets/index-DAW23qF1.js b/themes/demo-store-headless/dist/assets/index-DAW23qF1.js new file mode 100644 index 00000000..7ae6fc2f --- /dev/null +++ b/themes/demo-store-headless/dist/assets/index-DAW23qF1.js @@ -0,0 +1,51 @@ +(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))f(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const v of h.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&f(v)}).observe(document,{childList:!0,subtree:!0});function s(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function f(d){if(d.ep)return;d.ep=!0;const h=s(d);fetch(d.href,h)}})();var ss={exports:{}},Fr={},as={exports:{}},ne={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Nc;function pp(){if(Nc)return ne;Nc=1;var i=Symbol.for("react.element"),a=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),v=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),S=Symbol.iterator;function P(k){return k===null||typeof k!="object"?null:(k=S&&k[S]||k["@@iterator"],typeof k=="function"?k:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F=Object.assign,z={};function R(k,T,te){this.props=k,this.context=T,this.refs=z,this.updater=te||M}R.prototype.isReactComponent={},R.prototype.setState=function(k,T){if(typeof k!="object"&&typeof k!="function"&&k!=null)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,k,T,"setState")},R.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function A(){}A.prototype=R.prototype;function Q(k,T,te){this.props=k,this.context=T,this.refs=z,this.updater=te||M}var G=Q.prototype=new A;G.constructor=Q,F(G,R.prototype),G.isPureReactComponent=!0;var re=Array.isArray,ee=Object.prototype.hasOwnProperty,b={current:null},ie={key:!0,ref:!0,__self:!0,__source:!0};function Ne(k,T,te){var le,se={},ae=null,he=null;if(T!=null)for(le in T.ref!==void 0&&(he=T.ref),T.key!==void 0&&(ae=""+T.key),T)ee.call(T,le)&&!ie.hasOwnProperty(le)&&(se[le]=T[le]);var de=arguments.length-2;if(de===1)se.children=te;else if(1>>1,T=$[k];if(0>>1;kd(se,V))aed(he,se)?($[k]=he,$[ae]=V,k=ae):($[k]=se,$[le]=V,k=le);else if(aed(he,V))$[k]=he,$[ae]=V,k=ae;else break e}}return J}function d($,J){var V=$.sortIndex-J.sortIndex;return V!==0?V:$.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;i.unstable_now=function(){return h.now()}}else{var v=Date,y=v.now();i.unstable_now=function(){return v.now()-y}}var x=[],_=[],C=1,S=null,P=3,M=!1,F=!1,z=!1,R=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G($){for(var J=s(_);J!==null;){if(J.callback===null)f(_);else if(J.startTime<=$)f(_),J.sortIndex=J.expirationTime,a(x,J);else break;J=s(_)}}function re($){if(z=!1,G($),!F)if(s(x)!==null)F=!0,Ke(ee);else{var J=s(_);J!==null&&Ee(re,J.startTime-$)}}function ee($,J){F=!1,z&&(z=!1,A(Ne),Ne=-1),M=!0;var V=P;try{for(G(J),S=s(x);S!==null&&(!(S.expirationTime>J)||$&&!pe());){var k=S.callback;if(typeof k=="function"){S.callback=null,P=S.priorityLevel;var T=k(S.expirationTime<=J);J=i.unstable_now(),typeof T=="function"?S.callback=T:S===s(x)&&f(x),G(J)}else f(x);S=s(x)}if(S!==null)var te=!0;else{var le=s(_);le!==null&&Ee(re,le.startTime-J),te=!1}return te}finally{S=null,P=V,M=!1}}var b=!1,ie=null,Ne=-1,B=5,ce=-1;function pe(){return!(i.unstable_now()-ce$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<$?Math.floor(1e3/$):5},i.unstable_getCurrentPriorityLevel=function(){return P},i.unstable_getFirstCallbackNode=function(){return s(x)},i.unstable_next=function($){switch(P){case 1:case 2:case 3:var J=3;break;default:J=P}var V=P;P=J;try{return $()}finally{P=V}},i.unstable_pauseExecution=function(){},i.unstable_requestPaint=function(){},i.unstable_runWithPriority=function($,J){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var V=P;P=$;try{return J()}finally{P=V}},i.unstable_scheduleCallback=function($,J,V){var k=i.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0k?($.sortIndex=V,a(_,$),s(x)===null&&$===s(_)&&(z?(A(Ne),Ne=-1):z=!0,Ee(re,V-k))):($.sortIndex=T,a(x,$),F||M||(F=!0,Ke(ee))),$},i.unstable_shouldYield=pe,i.unstable_wrapCallback=function($){var J=P;return function(){var V=P;P=J;try{return $.apply(this,arguments)}finally{P=V}}}})(ds)),ds}var Tc;function yp(){return Tc||(Tc=1,cs.exports=vp()),cs.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Oc;function gp(){if(Oc)return Ze;Oc=1;var i=xs(),a=yp();function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,_=/^[: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]*$/,C={},S={};function P(e){return x.call(S,e)?!0:x.call(C,e)?!1:_.test(e)?S[e]=!0:(C[e]=!0,!1)}function M(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function F(e,t,n,r){if(t===null||typeof t>"u"||M(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function z(e,t,n,r,l,o,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=u}var R={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){R[e]=new z(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];R[t]=new z(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){R[e]=new z(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){R[e]=new z(e,2,!1,e,null,!1,!1)}),"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(e){R[e]=new z(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){R[e]=new z(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){R[e]=new z(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){R[e]=new z(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){R[e]=new z(e,5,!1,e.toLowerCase(),null,!1,!1)});var A=/[\-:]([a-z])/g;function Q(e){return e[1].toUpperCase()}"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(e){var t=e.replace(A,Q);R[t]=new z(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(A,Q);R[t]=new z(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(A,Q);R[t]=new z(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){R[e]=new z(e,1,!1,e.toLowerCase(),null,!1,!1)}),R.xlinkHref=new z("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){R[e]=new z(e,1,!1,e.toLowerCase(),null,!0,!0)});function G(e,t,n,r){var l=R.hasOwnProperty(t)?R[t]:null;(l!==null?l.type!==0:r||!(2p||l[u]!==o[p]){var m=` +`+l[u].replace(" at new "," at ");return e.displayName&&m.includes("")&&(m=m.replace("",e.displayName)),m}while(1<=u&&0<=p);break}}}finally{te=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function se(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function ae(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ie:return"Fragment";case b:return"Portal";case B:return"Profiler";case Ne:return"StrictMode";case Ae:return"Suspense";case Qe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pe:return(e.displayName||"Context")+".Consumer";case ce:return(e._context.displayName||"Context")+".Provider";case xe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Le:return t=e.displayName||null,t!==null?t:ae(e.type)||"Memo";case Ke:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}function he(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(t);case 8:return t===Ne?"StrictMode":"Mode";case 22:return"Offscreen";case 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(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function de(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ge(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function et(e){var t=ge(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){r=""+u,o.call(this,u)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(u){r=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qr(e){e._valueTracker||(e._valueTracker=et(e))}function Os(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ge(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Kr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function pi(e,t){var n=t.checked;return V({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ds(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=de(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ms(e,t){t=t.checked,t!=null&&G(e,"checked",t,!1)}function hi(e,t){Ms(e,t);var n=de(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?mi(e,t.type,n):t.hasOwnProperty("defaultValue")&&mi(e,t.type,de(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Is(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function mi(e,t,n){(t!=="number"||Kr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Zn=Array.isArray;function Sn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var er={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},vd=["Webkit","ms","Moz","O"];Object.keys(er).forEach(function(e){vd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),er[t]=er[e]})});function Bs(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||er.hasOwnProperty(e)&&er[e]?(""+t).trim():t+"px"}function Hs(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Bs(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var yd=V({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function gi(e,t){if(t){if(yd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(s(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(s(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(t.style!=null&&typeof t.style!="object")throw Error(s(62))}}function wi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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!1;default:return!0}}var xi=null;function Si(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ki=null,kn=null,_n=null;function Vs(e){if(e=kr(e)){if(typeof ki!="function")throw Error(s(280));var t=e.stateNode;t&&(t=vl(t),ki(e.stateNode,e.type,t))}}function Ws(e){kn?_n?_n.push(e):_n=[e]:kn=e}function Qs(){if(kn){var e=kn,t=_n;if(_n=kn=null,Vs(e),t)for(e=0;e>>=0,e===0?32:31-(Rd(e)/Pd|0)|0}var Zr=64,br=4194304;function lr(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function el(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,u=n&268435455;if(u!==0){var p=u&~l;p!==0?r=lr(p):(o&=u,o!==0&&(r=lr(o)))}else u=n&~l,u!==0?r=lr(u):o!==0&&(r=lr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ir(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-pt(t),e[t]=n}function Dd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=pr),wa=" ",xa=!1;function Sa(e,t){switch(e){case"keyup":return af.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ka(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nn=!1;function cf(e,t){switch(e){case"compositionend":return ka(t);case"keypress":return t.which!==32?null:(xa=!0,wa);case"textInput":return e=t.data,e===wa&&xa?null:e;default:return null}}function df(e,t){if(Nn)return e==="compositionend"||!Ui&&Sa(e,t)?(e=pa(),il=Mi=Qt=null,Nn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Pa(n)}}function Ta(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ta(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Oa(){for(var e=window,t=Kr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Kr(e.document)}return t}function Vi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function xf(e){var t=Oa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ta(n.ownerDocument.documentElement,n)){if(r!==null&&Vi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=La(n,o);var u=La(n,r);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,jn=null,Wi=null,yr=null,Qi=!1;function Da(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qi||jn==null||jn!==Kr(r)||(r=jn,"selectionStart"in r&&Vi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yr&&vr(yr,r)||(yr=r,r=pl(Wi,"onSelect"),0On||(e.current=ro[On],ro[On]=null,On--)}function me(e,t){On++,ro[On]=e.current,e.current=t}var qt={},$e=Gt(qt),Ye=Gt(!1),un=qt;function Dn(e,t){var n=e.type.contextTypes;if(!n)return qt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Ge(e){return e=e.childContextTypes,e!=null}function yl(){ye(Ye),ye($e)}function Ga(e,t,n){if($e.current!==qt)throw Error(s(168));me($e,t),me(Ye,n)}function qa(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(s(108,he(e)||"Unknown",l));return V({},n,r)}function gl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qt,un=$e.current,me($e,e),me(Ye,Ye.current),!0}function Xa(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=qa(e,t,un),r.__reactInternalMemoizedMergedChildContext=e,ye(Ye),ye($e),me($e,e)):ye(Ye),me(Ye,n)}var Tt=null,wl=!1,lo=!1;function Ja(e){Tt===null?Tt=[e]:Tt.push(e)}function Of(e){wl=!0,Ja(e)}function Xt(){if(!lo&&Tt!==null){lo=!0;var e=0,t=fe;try{var n=Tt;for(fe=1;e>=u,l-=u,Ot=1<<32-pt(t)+l|n<Z?(Ie=X,X=null):Ie=X.sibling;var ue=L(E,X,N[Z],I);if(ue===null){X===null&&(X=Ie);break}e&&X&&ue.alternate===null&&t(E,X),g=o(ue,g,Z),q===null?Y=ue:q.sibling=ue,q=ue,X=Ie}if(Z===N.length)return n(E,X),we&&dn(E,Z),Y;if(X===null){for(;ZZ?(Ie=X,X=null):Ie=X.sibling;var on=L(E,X,ue.value,I);if(on===null){X===null&&(X=Ie);break}e&&X&&on.alternate===null&&t(E,X),g=o(on,g,Z),q===null?Y=on:q.sibling=on,q=on,X=Ie}if(ue.done)return n(E,X),we&&dn(E,Z),Y;if(X===null){for(;!ue.done;Z++,ue=N.next())ue=D(E,ue.value,I),ue!==null&&(g=o(ue,g,Z),q===null?Y=ue:q.sibling=ue,q=ue);return we&&dn(E,Z),Y}for(X=r(E,X);!ue.done;Z++,ue=N.next())ue=U(X,E,Z,ue.value,I),ue!==null&&(e&&ue.alternate!==null&&X.delete(ue.key===null?Z:ue.key),g=o(ue,g,Z),q===null?Y=ue:q.sibling=ue,q=ue);return e&&X.forEach(function(fp){return t(E,fp)}),we&&dn(E,Z),Y}function Re(E,g,N,I){if(typeof N=="object"&&N!==null&&N.type===ie&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case ee:e:{for(var Y=N.key,q=g;q!==null;){if(q.key===Y){if(Y=N.type,Y===ie){if(q.tag===7){n(E,q.sibling),g=l(q,N.props.children),g.return=E,E=g;break e}}else if(q.elementType===Y||typeof Y=="object"&&Y!==null&&Y.$$typeof===Ke&&ru(Y)===q.type){n(E,q.sibling),g=l(q,N.props),g.ref=_r(E,q,N),g.return=E,E=g;break e}n(E,q);break}else t(E,q);q=q.sibling}N.type===ie?(g=wn(N.props.children,E.mode,I,N.key),g.return=E,E=g):(I=Yl(N.type,N.key,N.props,null,E.mode,I),I.ref=_r(E,g,N),I.return=E,E=I)}return u(E);case b:e:{for(q=N.key;g!==null;){if(g.key===q)if(g.tag===4&&g.stateNode.containerInfo===N.containerInfo&&g.stateNode.implementation===N.implementation){n(E,g.sibling),g=l(g,N.children||[]),g.return=E,E=g;break e}else{n(E,g);break}else t(E,g);g=g.sibling}g=ns(N,E.mode,I),g.return=E,E=g}return u(E);case Ke:return q=N._init,Re(E,g,q(N._payload),I)}if(Zn(N))return W(E,g,N,I);if(J(N))return K(E,g,N,I);_l(E,N)}return typeof N=="string"&&N!==""||typeof N=="number"?(N=""+N,g!==null&&g.tag===6?(n(E,g.sibling),g=l(g,N),g.return=E,E=g):(n(E,g),g=ts(N,E.mode,I),g.return=E,E=g),u(E)):n(E,g)}return Re}var Fn=lu(!0),iu=lu(!1),El=Gt(null),Cl=null,An=null,co=null;function fo(){co=An=Cl=null}function po(e){var t=El.current;ye(El),e._currentValue=t}function ho(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function $n(e,t){Cl=e,co=An=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(qe=!0),e.firstContext=null)}function at(e){var t=e._currentValue;if(co!==e)if(e={context:e,memoizedValue:t,next:null},An===null){if(Cl===null)throw Error(s(308));An=e,Cl.dependencies={lanes:0,firstContext:e}}else An=An.next=e;return t}var fn=null;function mo(e){fn===null?fn=[e]:fn.push(e)}function ou(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,mo(t)):(n.next=l.next,l.next=n),t.interleaved=n,Mt(e,r)}function Mt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Jt=!1;function vo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function su(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function It(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Zt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(oe&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Mt(e,n)}return l=r.interleaved,l===null?(t.next=t,mo(r)):(t.next=l.next,l.next=t),r.interleaved=t,Mt(e,n)}function Nl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Pi(e,n)}}function au(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var u={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=u:o=o.next=u,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function jl(e,t,n,r){var l=e.updateQueue;Jt=!1;var o=l.firstBaseUpdate,u=l.lastBaseUpdate,p=l.shared.pending;if(p!==null){l.shared.pending=null;var m=p,j=m.next;m.next=null,u===null?o=j:u.next=j,u=m;var O=e.alternate;O!==null&&(O=O.updateQueue,p=O.lastBaseUpdate,p!==u&&(p===null?O.firstBaseUpdate=j:p.next=j,O.lastBaseUpdate=m))}if(o!==null){var D=l.baseState;u=0,O=j=m=null,p=o;do{var L=p.lane,U=p.eventTime;if((r&L)===L){O!==null&&(O=O.next={eventTime:U,lane:0,tag:p.tag,payload:p.payload,callback:p.callback,next:null});e:{var W=e,K=p;switch(L=t,U=n,K.tag){case 1:if(W=K.payload,typeof W=="function"){D=W.call(U,D,L);break e}D=W;break e;case 3:W.flags=W.flags&-65537|128;case 0:if(W=K.payload,L=typeof W=="function"?W.call(U,D,L):W,L==null)break e;D=V({},D,L);break e;case 2:Jt=!0}}p.callback!==null&&p.lane!==0&&(e.flags|=64,L=l.effects,L===null?l.effects=[p]:L.push(p))}else U={eventTime:U,lane:L,tag:p.tag,payload:p.payload,callback:p.callback,next:null},O===null?(j=O=U,m=D):O=O.next=U,u|=L;if(p=p.next,p===null){if(p=l.shared.pending,p===null)break;L=p,p=L.next,L.next=null,l.lastBaseUpdate=L,l.shared.pending=null}}while(!0);if(O===null&&(m=D),l.baseState=m,l.firstBaseUpdate=j,l.lastBaseUpdate=O,t=l.shared.interleaved,t!==null){l=t;do u|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);mn|=u,e.lanes=u,e.memoizedState=D}}function uu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=So.transition;So.transition={};try{e(!1),t()}finally{fe=n,So.transition=r}}function Ru(){return ut().memoizedState}function zf(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Pu(e))Lu(t,n);else if(n=ou(e,t,n,r),n!==null){var l=We();wt(n,e,r,l),Tu(n,t,r)}}function Ff(e,t,n){var r=nn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pu(e))Lu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var u=t.lastRenderedState,p=o(u,n);if(l.hasEagerState=!0,l.eagerState=p,ht(p,u)){var m=t.interleaved;m===null?(l.next=l,mo(t)):(l.next=m.next,m.next=l),t.interleaved=l;return}}catch{}finally{}n=ou(e,t,l,r),n!==null&&(l=We(),wt(n,e,r,l),Tu(n,t,r))}}function Pu(e){var t=e.alternate;return e===ke||t!==null&&t===ke}function Lu(e,t){jr=Ll=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Tu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Pi(e,n)}}var Dl={readContext:at,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},Af={readContext:at,useCallback:function(e,t){return Nt().memoizedState=[e,t===void 0?null:t],e},useContext:at,useEffect:xu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Tl(4194308,4,_u.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Tl(4,2,e,t)},useMemo:function(e,t){var n=Nt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Nt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=zf.bind(null,ke,e),[r.memoizedState,e]},useRef:function(e){var t=Nt();return e={current:e},t.memoizedState=e},useState:gu,useDebugValue:Ro,useDeferredValue:function(e){return Nt().memoizedState=e},useTransition:function(){var e=gu(!1),t=e[0];return e=If.bind(null,e[1]),Nt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ke,l=Nt();if(we){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Me===null)throw Error(s(349));(hn&30)!==0||pu(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,xu(mu.bind(null,r,o,e),[e]),r.flags|=2048,Lr(9,hu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Nt(),t=Me.identifierPrefix;if(we){var n=Dt,r=Ot;n=(r&~(1<<32-pt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Rr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=u.createElement(n,{is:r.is}):(e=u.createElement(n),n==="select"&&(u=e,r.multiple?u.multiple=!0:r.size&&(u.size=r.size))):e=u.createElementNS(e,n),e[Et]=t,e[Sr]=r,Ju(e,t,!1,!1),t.stateNode=e;e:{switch(u=wi(n,r),n){case"dialog":ve("cancel",e),ve("close",e),l=r;break;case"iframe":case"object":case"embed":ve("load",e),l=r;break;case"video":case"audio":for(l=0;lWn&&(t.flags|=128,r=!0,Tr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Rl(u),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Tr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!u.alternate&&!we)return Be(t),null}else 2*je()-o.renderingStartTime>Wn&&n!==1073741824&&(t.flags|=128,r=!0,Tr(o,!1),t.lanes=4194304);o.isBackwards?(u.sibling=t.child,t.child=u):(n=o.last,n!==null?n.sibling=u:t.child=u,o.last=u)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=je(),t.sibling=null,n=Se.current,me(Se,r?n&1|2:n&1),t):(Be(t),null);case 22:case 23:return Zo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(lt&1073741824)!==0&&(Be(t),t.subtreeFlags&6&&(t.flags|=8192)):Be(t),null;case 24:return null;case 25:return null}throw Error(s(156,t.tag))}function Kf(e,t){switch(oo(t),t.tag){case 1:return Ge(t.type)&&yl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Un(),ye(Ye),ye($e),xo(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return go(t),null;case 13:if(ye(Se),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(Se),null;case 4:return Un(),null;case 10:return po(t.type._context),null;case 22:case 23:return Zo(),null;case 24:return null;default:return null}}var Fl=!1,He=!1,Yf=typeof WeakSet=="function"?WeakSet:Set,H=null;function Hn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function Uo(e,t,n){try{n()}catch(r){Ce(e,t,r)}}var ec=!1;function Gf(e,t){if(Ji=rl,e=Oa(),Vi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var u=0,p=-1,m=-1,j=0,O=0,D=e,L=null;t:for(;;){for(var U;D!==n||l!==0&&D.nodeType!==3||(p=u+l),D!==o||r!==0&&D.nodeType!==3||(m=u+r),D.nodeType===3&&(u+=D.nodeValue.length),(U=D.firstChild)!==null;)L=D,D=U;for(;;){if(D===e)break t;if(L===n&&++j===l&&(p=u),L===o&&++O===r&&(m=u),(U=D.nextSibling)!==null)break;D=L,L=D.parentNode}D=U}n=p===-1||m===-1?null:{start:p,end:m}}else n=null}n=n||{start:0,end:0}}else n=null;for(Zi={focusedElem:e,selectionRange:n},rl=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var W=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(W!==null){var K=W.memoizedProps,Re=W.memoizedState,E=t.stateNode,g=E.getSnapshotBeforeUpdate(t.elementType===t.type?K:vt(t.type,K),Re);E.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var N=t.stateNode.containerInfo;N.nodeType===1?N.textContent="":N.nodeType===9&&N.documentElement&&N.removeChild(N.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(I){Ce(t,t.return,I)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return W=ec,ec=!1,W}function Or(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Uo(t,n,o)}l=l.next}while(l!==r)}}function Al(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Bo(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function tc(e){var t=e.alternate;t!==null&&(e.alternate=null,tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Et],delete t[Sr],delete t[no],delete t[Lf],delete t[Tf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nc(e){return e.tag===5||e.tag===3||e.tag===4}function rc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ho(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ml));else if(r!==4&&(e=e.child,e!==null))for(Ho(e,t,n),e=e.sibling;e!==null;)Ho(e,t,n),e=e.sibling}function Vo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Vo(e,t,n),e=e.sibling;e!==null;)Vo(e,t,n),e=e.sibling}var ze=null,yt=!1;function bt(e,t,n){for(n=n.child;n!==null;)lc(e,t,n),n=n.sibling}function lc(e,t,n){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Jr,n)}catch{}switch(n.tag){case 5:He||Hn(n,t);case 6:var r=ze,l=yt;ze=null,bt(e,t,n),ze=r,yt=l,ze!==null&&(yt?(e=ze,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ze.removeChild(n.stateNode));break;case 18:ze!==null&&(yt?(e=ze,n=n.stateNode,e.nodeType===8?to(e.parentNode,n):e.nodeType===1&&to(e,n),cr(e)):to(ze,n.stateNode));break;case 4:r=ze,l=yt,ze=n.stateNode.containerInfo,yt=!0,bt(e,t,n),ze=r,yt=l;break;case 0:case 11:case 14:case 15:if(!He&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,u=o.destroy;o=o.tag,u!==void 0&&((o&2)!==0||(o&4)!==0)&&Uo(n,t,u),l=l.next}while(l!==r)}bt(e,t,n);break;case 1:if(!He&&(Hn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(p){Ce(n,t,p)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(He=(r=He)||n.memoizedState!==null,bt(e,t,n),He=r):bt(e,t,n);break;default:bt(e,t,n)}}function ic(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Yf),t.forEach(function(r){var l=rp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function gt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=u),r&=~o}if(r=l,r=je()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Xf(r/1960))-r,10e?16:e,tn===null)var r=!1;else{if(e=tn,tn=null,Vl=0,(oe&6)!==0)throw Error(s(331));var l=oe;for(oe|=4,H=e.current;H!==null;){var o=H,u=o.child;if((H.flags&16)!==0){var p=o.deletions;if(p!==null){for(var m=0;mje()-Ko?yn(e,0):Qo|=n),Je(e,t)}function gc(e,t){t===0&&((e.mode&1)===0?t=1:(t=br,br<<=1,(br&130023424)===0&&(br=4194304)));var n=We();e=Mt(e,t),e!==null&&(ir(e,t,n),Je(e,n))}function np(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gc(e,n)}function rp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(s(314))}r!==null&&r.delete(t),gc(e,n)}var wc;wc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ye.current)qe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return qe=!1,Wf(e,t,n);qe=(e.flags&131072)!==0}else qe=!1,we&&(t.flags&1048576)!==0&&Za(t,Sl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zl(e,t),e=t.pendingProps;var l=Dn(t,$e.current);$n(t,n),l=_o(null,t,r,e,l,n);var o=Eo();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ge(r)?(o=!0,gl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,vo(t),l.updater=Ml,t.stateNode=l,l._reactInternals=t,Lo(t,r,e,n),t=Mo(null,t,r,!0,o,n)):(t.tag=0,we&&o&&io(t),Ve(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=ip(r),e=vt(r,e),l){case 0:t=Do(null,t,r,e,n);break e;case 1:t=Qu(null,t,r,e,n);break e;case 11:t=Uu(null,t,r,e,n);break e;case 14:t=Bu(null,t,r,vt(r.type,e),n);break e}throw Error(s(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),Do(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),Qu(e,t,r,l,n);case 3:e:{if(Ku(t),e===null)throw Error(s(387));r=t.pendingProps,o=t.memoizedState,l=o.element,su(e,t),jl(t,r,null,n);var u=t.memoizedState;if(r=u.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Bn(Error(s(423)),t),t=Yu(e,t,r,n,l);break e}else if(r!==l){l=Bn(Error(s(424)),t),t=Yu(e,t,r,n,l);break e}else for(rt=Yt(t.stateNode.containerInfo.firstChild),nt=t,we=!0,mt=null,n=iu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zn(),r===l){t=zt(e,t,n);break e}Ve(e,t,r,n)}t=t.child}return t;case 5:return cu(t),e===null&&ao(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,u=l.children,bi(r,l)?u=null:o!==null&&bi(r,o)&&(t.flags|=32),Wu(e,t),Ve(e,t,u,n),t.child;case 6:return e===null&&ao(t),null;case 13:return Gu(e,t,n);case 4:return yo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fn(t,null,r,n):Ve(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),Uu(e,t,r,l,n);case 7:return Ve(e,t,t.pendingProps,n),t.child;case 8:return Ve(e,t,t.pendingProps.children,n),t.child;case 12:return Ve(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,u=l.value,me(El,r._currentValue),r._currentValue=u,o!==null)if(ht(o.value,u)){if(o.children===l.children&&!Ye.current){t=zt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var p=o.dependencies;if(p!==null){u=o.child;for(var m=p.firstContext;m!==null;){if(m.context===r){if(o.tag===1){m=It(-1,n&-n),m.tag=2;var j=o.updateQueue;if(j!==null){j=j.shared;var O=j.pending;O===null?m.next=m:(m.next=O.next,O.next=m),j.pending=m}}o.lanes|=n,m=o.alternate,m!==null&&(m.lanes|=n),ho(o.return,n,t),p.lanes|=n;break}m=m.next}}else if(o.tag===10)u=o.type===t.type?null:o.child;else if(o.tag===18){if(u=o.return,u===null)throw Error(s(341));u.lanes|=n,p=u.alternate,p!==null&&(p.lanes|=n),ho(u,n,t),u=o.sibling}else u=o.child;if(u!==null)u.return=o;else for(u=o;u!==null;){if(u===t){u=null;break}if(o=u.sibling,o!==null){o.return=u.return,u=o;break}u=u.return}o=u}Ve(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,$n(t,n),l=at(l),r=r(l),t.flags|=1,Ve(e,t,r,n),t.child;case 14:return r=t.type,l=vt(r,t.pendingProps),l=vt(r.type,l),Bu(e,t,r,l,n);case 15:return Hu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),zl(e,t),t.tag=1,Ge(r)?(e=!0,gl(t)):e=!1,$n(t,n),Du(t,r,l),Lo(t,r,l,n),Mo(null,t,r,!0,e,n);case 19:return Xu(e,t,n);case 22:return Vu(e,t,n)}throw Error(s(156,t.tag))};function xc(e,t){return bs(e,t)}function lp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dt(e,t,n,r){return new lp(e,t,n,r)}function es(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ip(e){if(typeof e=="function")return es(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xe)return 11;if(e===Le)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=dt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yl(e,t,n,r,l,o){var u=2;if(r=e,typeof e=="function")es(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case ie:return wn(n.children,l,o,t);case Ne:u=8,l|=8;break;case B:return e=dt(12,n,t,l|2),e.elementType=B,e.lanes=o,e;case Ae:return e=dt(13,n,t,l),e.elementType=Ae,e.lanes=o,e;case Qe:return e=dt(19,n,t,l),e.elementType=Qe,e.lanes=o,e;case Ee:return Gl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ce:u=10;break e;case pe:u=9;break e;case xe:u=11;break e;case Le:u=14;break e;case Ke:u=16,r=null;break e}throw Error(s(130,e==null?e:typeof e,""))}return t=dt(u,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function wn(e,t,n,r){return e=dt(7,e,r,t),e.lanes=n,e}function Gl(e,t,n,r){return e=dt(22,e,r,t),e.elementType=Ee,e.lanes=n,e.stateNode={isHidden:!1},e}function ts(e,t,n){return e=dt(6,e,null,t),e.lanes=n,e}function ns(e,t,n){return t=dt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function op(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ri(0),this.expirationTimes=Ri(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ri(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function rs(e,t,n,r,l,o,u,p,m){return e=new op(e,t,n,p,m),t===1?(t=1,o===!0&&(t|=8)):t=0,o=dt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vo(o),e}function sp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(a){console.error(a)}}return i(),us.exports=gp(),us.exports}var Mc;function xp(){if(Mc)return ti;Mc=1;var i=wp();return ti.createRoot=i.createRoot,ti.hydrateRoot=i.hydrateRoot,ti}var Sp=xp();const kp="modulepreload",_p=function(i){return"/"+i},Ic={},Yn=function(a,s,f){let d=Promise.resolve();if(s&&s.length>0){let v=function(_){return Promise.all(_.map(C=>Promise.resolve(C).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),x=y?.nonce||y?.getAttribute("nonce");d=v(s.map(_=>{if(_=_p(_),_ in Ic)return;Ic[_]=!0;const C=_.endsWith(".css"),S=C?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${S}`))return;const P=document.createElement("link");if(P.rel=C?"stylesheet":kp,C||(P.as="script"),P.crossOrigin="",P.href=_,x&&P.setAttribute("nonce",x),document.head.appendChild(P),C)return new Promise((M,F)=>{P.addEventListener("load",M),P.addEventListener("error",()=>F(new Error(`Unable to preload CSS for ${_}`)))})}))}function h(v){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=v,window.dispatchEvent(y),!y.defaultPrevented)throw v}return d.then(v=>{for(const y of v||[])y.status==="rejected"&&h(y.reason);return a().catch(h)})};/** + * react-router v7.15.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var zc="popstate";function Fc(i){return typeof i=="object"&&i!=null&&"pathname"in i&&"search"in i&&"hash"in i&&"state"in i&&"key"in i}function Ep(i={}){function a(f,d){let h=d.state?.masked,{pathname:v,search:y,hash:x}=h||f.location;return ys("",{pathname:v,search:y,hash:x},d.state&&d.state.usr||null,d.state&&d.state.key||"default",h?{pathname:f.location.pathname,search:f.location.search,hash:f.location.hash}:void 0)}function s(f,d){return typeof d=="string"?d:Ur(d)}return Np(a,s,null,i)}function _e(i,a){if(i===!1||i===null||typeof i>"u")throw new Error(a)}function St(i,a){if(!i){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function Cp(){return Math.random().toString(36).substring(2,10)}function Ac(i,a){return{usr:i.state,key:i.key,idx:a,masked:i.mask?{pathname:i.pathname,search:i.search,hash:i.hash}:void 0}}function ys(i,a,s=null,f,d){return{pathname:typeof i=="string"?i:i.pathname,search:"",hash:"",...typeof a=="string"?Gn(a):a,state:s,key:a&&a.key||f||Cp(),mask:d}}function Ur({pathname:i="/",search:a="",hash:s=""}){return a&&a!=="?"&&(i+=a.charAt(0)==="?"?a:"?"+a),s&&s!=="#"&&(i+=s.charAt(0)==="#"?s:"#"+s),i}function Gn(i){let a={};if(i){let s=i.indexOf("#");s>=0&&(a.hash=i.substring(s),i=i.substring(0,s));let f=i.indexOf("?");f>=0&&(a.search=i.substring(f),i=i.substring(0,f)),i&&(a.pathname=i)}return a}function Np(i,a,s,f={}){let{window:d=document.defaultView,v5Compat:h=!1}=f,v=d.history,y="POP",x=null,_=C();_==null&&(_=0,v.replaceState({...v.state,idx:_},""));function C(){return(v.state||{idx:null}).idx}function S(){y="POP";let R=C(),A=R==null?null:R-_;_=R,x&&x({action:y,location:z.location,delta:A})}function P(R,A){y="PUSH";let Q=Fc(R)?R:ys(z.location,R,A);_=C()+1;let G=Ac(Q,_),re=z.createHref(Q.mask||Q);try{v.pushState(G,"",re)}catch(ee){if(ee instanceof DOMException&&ee.name==="DataCloneError")throw ee;d.location.assign(re)}h&&x&&x({action:y,location:z.location,delta:1})}function M(R,A){y="REPLACE";let Q=Fc(R)?R:ys(z.location,R,A);_=C();let G=Ac(Q,_),re=z.createHref(Q.mask||Q);v.replaceState(G,"",re),h&&x&&x({action:y,location:z.location,delta:0})}function F(R){return jp(R)}let z={get action(){return y},get location(){return i(d,v)},listen(R){if(x)throw new Error("A history only accepts one active listener");return d.addEventListener(zc,S),x=R,()=>{d.removeEventListener(zc,S),x=null}},createHref(R){return a(d,R)},createURL:F,encodeLocation(R){let A=F(R);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:P,replace:M,go(R){return v.go(R)}};return z}function jp(i,a=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),_e(s,"No window.location.(origin|href) available to create URL");let f=typeof i=="string"?i:Ur(i);return f=f.replace(/ $/,"%20"),!a&&f.startsWith("//")&&(f=s+f),new URL(f,s)}function Qc(i,a,s="/"){return Rp(i,a,s,!1)}function Rp(i,a,s,f,d){let h=typeof a=="string"?Gn(a):a,v=Ut(h.pathname||"/",s);if(v==null)return null;let y=Pp(i),x=null,_=Bp(v);for(let C=0;x==null&&C{let C={relativePath:_===void 0?v.path||"":_,caseSensitive:v.caseSensitive===!0,childrenIndex:y,route:v};if(C.relativePath.startsWith("/")){if(!C.relativePath.startsWith(f)&&x)return;_e(C.relativePath.startsWith(f),`Absolute route path "${C.relativePath}" nested under path "${f}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),C.relativePath=C.relativePath.slice(f.length)}let S=xt([f,C.relativePath]),P=s.concat(C);v.children&&v.children.length>0&&(_e(v.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),Kc(v.children,a,P,S,x)),!(v.path==null&&!v.index)&&a.push({path:S,score:Fp(S,v.index),routesMeta:P})};return i.forEach((v,y)=>{if(v.path===""||!v.path?.includes("?"))h(v,y);else for(let x of Yc(v.path))h(v,y,!0,x)}),a}function Yc(i){let a=i.split("/");if(a.length===0)return[];let[s,...f]=a,d=s.endsWith("?"),h=s.replace(/\?$/,"");if(f.length===0)return d?[h,""]:[h];let v=Yc(f.join("/")),y=[];return y.push(...v.map(x=>x===""?h:[h,x].join("/"))),d&&y.push(...v),y.map(x=>i.startsWith("/")&&x===""?"/":x)}function Lp(i){i.sort((a,s)=>a.score!==s.score?s.score-a.score:Ap(a.routesMeta.map(f=>f.childrenIndex),s.routesMeta.map(f=>f.childrenIndex)))}var Tp=/^:[\w-]+$/,Op=3,Dp=2,Mp=1,Ip=10,zp=-2,$c=i=>i==="*";function Fp(i,a){let s=i.split("/"),f=s.length;return s.some($c)&&(f+=zp),a&&(f+=Dp),s.filter(d=>!$c(d)).reduce((d,h)=>d+(Tp.test(h)?Op:h===""?Mp:Ip),f)}function Ap(i,a){return i.length===a.length&&i.slice(0,-1).every((f,d)=>f===a[d])?i[i.length-1]-a[a.length-1]:0}function $p(i,a,s=!1){let{routesMeta:f}=i,d={},h="/",v=[];for(let y=0;y{if(C==="*"){let F=y[P]||"";v=h.slice(0,h.length-F.length).replace(/(.)\/+$/,"$1")}const M=y[P];return S&&!M?_[C]=void 0:_[C]=(M||"").replace(/%2F/g,"/"),_},{}),pathname:h,pathnameBase:v,pattern:i}}function Up(i,a=!1,s=!0){St(i==="*"||!i.endsWith("*")||i.endsWith("/*"),`Route path "${i}" will be treated as if it were "${i.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${i.replace(/\*$/,"/*")}".`);let f=[],d="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(v,y,x,_,C)=>{if(f.push({paramName:y,isOptional:x!=null}),x){let S=C.charAt(_+v.length);return S&&S!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return i.endsWith("*")?(f.push({paramName:"*"}),d+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?d+="\\/*$":i!==""&&i!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,a?void 0:"i"),f]}function Bp(i){try{return i.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return St(!1,`The URL path "${i}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),i}}function Ut(i,a){if(a==="/")return i;if(!i.toLowerCase().startsWith(a.toLowerCase()))return null;let s=a.endsWith("/")?a.length-1:a.length,f=i.charAt(s);return f&&f!=="/"?null:i.slice(s)||"/"}var Hp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Vp(i,a="/"){let{pathname:s,search:f="",hash:d=""}=typeof i=="string"?Gn(i):i,h;return s?(s=qc(s),s.startsWith("/")?h=Uc(s.substring(1),"/"):h=Uc(s,a)):h=a,{pathname:h,search:Kp(f),hash:Yp(d)}}function Uc(i,a){let s=ui(a).split("/");return i.split("/").forEach(d=>{d===".."?s.length>1&&s.pop():d!=="."&&s.push(d)}),s.length>1?s.join("/"):"/"}function fs(i,a,s,f){return`Cannot include a '${i}' character in a manually specified \`to.${a}\` field [${JSON.stringify(f)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Wp(i){return i.filter((a,s)=>s===0||a.route.path&&a.route.path.length>0)}function Gc(i){let a=Wp(i);return a.map((s,f)=>f===a.length-1?s.pathname:s.pathnameBase)}function Ss(i,a,s,f=!1){let d;typeof i=="string"?d=Gn(i):(d={...i},_e(!d.pathname||!d.pathname.includes("?"),fs("?","pathname","search",d)),_e(!d.pathname||!d.pathname.includes("#"),fs("#","pathname","hash",d)),_e(!d.search||!d.search.includes("#"),fs("#","search","hash",d)));let h=i===""||d.pathname==="",v=h?"/":d.pathname,y;if(v==null)y=s;else{let S=a.length-1;if(!f&&v.startsWith("..")){let P=v.split("/");for(;P[0]==="..";)P.shift(),S-=1;d.pathname=P.join("/")}y=S>=0?a[S]:"/"}let x=Vp(d,y),_=v&&v!=="/"&&v.endsWith("/"),C=(h||v===".")&&s.endsWith("/");return!x.pathname.endsWith("/")&&(_||C)&&(x.pathname+="/"),x}var qc=i=>i.replace(/\/\/+/g,"/"),xt=i=>qc(i.join("/")),ui=i=>i.replace(/\/+$/,""),Qp=i=>ui(i).replace(/^\/*/,"/"),Kp=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,Yp=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i,Gp=class{constructor(i,a,s,f=!1){this.status=i,this.statusText=a||"",this.internal=f,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function qp(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}function Xp(i){let a=i.map(s=>s.route.path).filter(Boolean);return xt(a)||"/"}var Xc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jc(i,a){let s=i;if(typeof s!="string"||!Hp.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let f=s,d=!1;if(Xc)try{let h=new URL(window.location.href),v=s.startsWith("//")?new URL(h.protocol+s):new URL(s),y=Ut(v.pathname,a);v.origin===h.origin&&y!=null?s=y+v.search+v.hash:d=!0}catch{St(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:f,isExternal:d,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Zc=["POST","PUT","PATCH","DELETE"];new Set(Zc);var Jp=["GET",...Zc];new Set(Jp);var qn=w.createContext(null);qn.displayName="DataRouter";var ci=w.createContext(null);ci.displayName="DataRouterState";var bc=w.createContext(!1);function Zp(){return w.useContext(bc)}var ed=w.createContext({isTransitioning:!1});ed.displayName="ViewTransition";var bp=w.createContext(new Map);bp.displayName="Fetchers";var eh=w.createContext(null);eh.displayName="Await";var ft=w.createContext(null);ft.displayName="Navigation";var Br=w.createContext(null);Br.displayName="Location";var Rt=w.createContext({outlet:null,matches:[],isDataRoute:!1});Rt.displayName="Route";var ks=w.createContext(null);ks.displayName="RouteError";var td="REACT_ROUTER_ERROR",th="REDIRECT",nh="ROUTE_ERROR_RESPONSE";function rh(i){if(i.startsWith(`${td}:${th}:{`))try{let a=JSON.parse(i.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function lh(i){if(i.startsWith(`${td}:${nh}:{`))try{let a=JSON.parse(i.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new Gp(a.status,a.statusText,a.data)}catch{}}function ih(i,{relative:a}={}){_e(Hr(),"useHref() may be used only in the context of a component.");let{basename:s,navigator:f}=w.useContext(ft),{hash:d,pathname:h,search:v}=Vr(i,{relative:a}),y=h;return s!=="/"&&(y=h==="/"?s:xt([s,h])),f.createHref({pathname:y,search:v,hash:d})}function Hr(){return w.useContext(Br)!=null}function Pt(){return _e(Hr(),"useLocation() may be used only in the context of a component."),w.useContext(Br).location}var nd="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function rd(i){w.useContext(ft).static||w.useLayoutEffect(i)}function Xn(){let{isDataRoute:i}=w.useContext(Rt);return i?gh():oh()}function oh(){_e(Hr(),"useNavigate() may be used only in the context of a component.");let i=w.useContext(qn),{basename:a,navigator:s}=w.useContext(ft),{matches:f}=w.useContext(Rt),{pathname:d}=Pt(),h=JSON.stringify(Gc(f)),v=w.useRef(!1);return rd(()=>{v.current=!0}),w.useCallback((x,_={})=>{if(St(v.current,nd),!v.current)return;if(typeof x=="number"){s.go(x);return}let C=Ss(x,JSON.parse(h),d,_.relative==="path");i==null&&a!=="/"&&(C.pathname=C.pathname==="/"?a:xt([a,C.pathname])),(_.replace?s.replace:s.push)(C,_.state,_)},[a,s,h,d,i])}w.createContext(null);function ld(){let{matches:i}=w.useContext(Rt);return i[i.length-1]?.params??{}}function Vr(i,{relative:a}={}){let{matches:s}=w.useContext(Rt),{pathname:f}=Pt(),d=JSON.stringify(Gc(s));return w.useMemo(()=>Ss(i,JSON.parse(d),f,a==="path"),[i,d,f,a])}function sh(i,a){return id(i,a)}function id(i,a,s){_e(Hr(),"useRoutes() may be used only in the context of a component.");let{navigator:f}=w.useContext(ft),{matches:d}=w.useContext(Rt),h=d[d.length-1],v=h?h.params:{},y=h?h.pathname:"/",x=h?h.pathnameBase:"/",_=h&&h.route;{let R=_&&_.path||"";sd(y,!_||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${y}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let C=Pt(),S;if(a){let R=typeof a=="string"?Gn(a):a;_e(x==="/"||R.pathname?.startsWith(x),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${x}" but pathname "${R.pathname}" was given in the \`location\` prop.`),S=R}else S=C;let P=S.pathname||"/",M=P;if(x!=="/"){let R=x.replace(/^\//,"").split("/");M="/"+P.replace(/^\//,"").split("/").slice(R.length).join("/")}let F=s&&s.state.matches.length?s.state.matches.map(R=>Object.assign(R,{route:s.manifest[R.route.id]||R.route})):Qc(i,{pathname:M});St(_||F!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),St(F==null||F[F.length-1].route.element!==void 0||F[F.length-1].route.Component!==void 0||F[F.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let z=fh(F&&F.map(R=>Object.assign({},R,{params:Object.assign({},v,R.params),pathname:xt([x,f.encodeLocation?f.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?x:xt([x,f.encodeLocation?f.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),d,s);return a&&z?w.createElement(Br.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...S},navigationType:"POP"}},z):z}function ah(){let i=yh(),a=qp(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),s=i instanceof Error?i.stack:null,f="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:f},h={padding:"2px 4px",backgroundColor:f},v=null;return console.error("Error handled by React Router default ErrorBoundary:",i),v=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:h},"ErrorBoundary")," or"," ",w.createElement("code",{style:h},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},a),s?w.createElement("pre",{style:d},s):null,v)}var uh=w.createElement(ah,null),od=class extends w.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,a){return a.location!==i.location||a.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:a.error,location:a.location,revalidation:i.revalidation||a.revalidation}}componentDidCatch(i,a){this.props.onError?this.props.onError(i,a):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const s=lh(i.digest);s&&(i=s)}let a=i!==void 0?w.createElement(Rt.Provider,{value:this.props.routeContext},w.createElement(ks.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?w.createElement(ch,{error:i},a):a}};od.contextType=bc;var ps=new WeakMap;function ch({children:i,error:a}){let{basename:s}=w.useContext(ft);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let f=rh(a.digest);if(f){let d=ps.get(a);if(d)throw d;let h=Jc(f.location,s);if(Xc&&!ps.get(a))if(h.isExternal||f.reloadDocument)window.location.href=h.absoluteURL||h.to;else{const v=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(h.to,{replace:f.replace}));throw ps.set(a,v),v}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${h.absoluteURL||h.to}`})}}return i}function dh({routeContext:i,match:a,children:s}){let f=w.useContext(qn);return f&&f.static&&f.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(f.staticContext._deepestRenderedBoundaryId=a.route.id),w.createElement(Rt.Provider,{value:i},s)}function fh(i,a=[],s){let f=s?.state;if(i==null){if(!f)return null;if(f.errors)i=f.matches;else if(a.length===0&&!f.initialized&&f.matches.length>0)i=f.matches;else return null}let d=i,h=f?.errors;if(h!=null){let C=d.findIndex(S=>S.route.id&&h?.[S.route.id]!==void 0);_e(C>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,C+1))}let v=!1,y=-1;if(s&&f){v=f.renderFallback;for(let C=0;C=0?d=d.slice(0,y+1):d=[d[0]];break}}}}let x=s?.onError,_=f&&x?(C,S)=>{x(C,{location:f.location,params:f.matches?.[0]?.params??{},pattern:Xp(f.matches),errorInfo:S})}:void 0;return d.reduceRight((C,S,P)=>{let M,F=!1,z=null,R=null;f&&(M=h&&S.route.id?h[S.route.id]:void 0,z=S.route.errorElement||uh,v&&(y<0&&P===0?(sd("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),F=!0,R=null):y===P&&(F=!0,R=S.route.hydrateFallbackElement||null)));let A=a.concat(d.slice(0,P+1)),Q=()=>{let G;return M?G=z:F?G=R:S.route.Component?G=w.createElement(S.route.Component,null):S.route.element?G=S.route.element:G=C,w.createElement(dh,{match:S,routeContext:{outlet:C,matches:A,isDataRoute:f!=null},children:G})};return f&&(S.route.ErrorBoundary||S.route.errorElement||P===0)?w.createElement(od,{location:f.location,revalidation:f.revalidation,component:z,error:M,children:Q(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:_}):Q()},null)}function _s(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ph(i){let a=w.useContext(qn);return _e(a,_s(i)),a}function hh(i){let a=w.useContext(ci);return _e(a,_s(i)),a}function mh(i){let a=w.useContext(Rt);return _e(a,_s(i)),a}function Es(i){let a=mh(i),s=a.matches[a.matches.length-1];return _e(s.route.id,`${i} can only be used on routes that contain a unique "id"`),s.route.id}function vh(){return Es("useRouteId")}function yh(){let i=w.useContext(ks),a=hh("useRouteError"),s=Es("useRouteError");return i!==void 0?i:a.errors?.[s]}function gh(){let{router:i}=ph("useNavigate"),a=Es("useNavigate"),s=w.useRef(!1);return rd(()=>{s.current=!0}),w.useCallback(async(d,h={})=>{St(s.current,nd),s.current&&(typeof d=="number"?await i.navigate(d):await i.navigate(d,{fromRouteId:a,...h}))},[i,a])}var Bc={};function sd(i,a,s){!a&&!Bc[i]&&(Bc[i]=!0,St(!1,s))}w.memo(wh);function wh({routes:i,manifest:a,future:s,state:f,isStatic:d,onError:h}){return id(i,void 0,{manifest:a,state:f,isStatic:d,onError:h})}function xn(i){_e(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function xh({basename:i="/",children:a=null,location:s,navigationType:f="POP",navigator:d,static:h=!1,useTransitions:v}){_e(!Hr(),"You cannot render a inside another . You should never have more than one in your app.");let y=i.replace(/^\/*/,"/"),x=w.useMemo(()=>({basename:y,navigator:d,static:h,useTransitions:v,future:{}}),[y,d,h,v]);typeof s=="string"&&(s=Gn(s));let{pathname:_="/",search:C="",hash:S="",state:P=null,key:M="default",mask:F}=s,z=w.useMemo(()=>{let R=Ut(_,y);return R==null?null:{location:{pathname:R,search:C,hash:S,state:P,key:M,mask:F},navigationType:f}},[y,_,C,S,P,M,f,F]);return St(z!=null,` is not able to match the URL "${_}${C}${S}" because it does not start with the basename, so the won't render anything.`),z==null?null:w.createElement(ft.Provider,{value:x},w.createElement(Br.Provider,{children:a,value:z}))}function Sh({children:i,location:a}){return sh(gs(i),a)}function gs(i,a=[]){let s=[];return w.Children.forEach(i,(f,d)=>{if(!w.isValidElement(f))return;let h=[...a,d];if(f.type===w.Fragment){s.push.apply(s,gs(f.props.children,h));return}_e(f.type===xn,`[${typeof f.type=="string"?f.type:f.type.name}] is not a component. All component children of must be a or `),_e(!f.props.index||!f.props.children,"An index route cannot have child routes.");let v={id:f.props.id||h.join("-"),caseSensitive:f.props.caseSensitive,element:f.props.element,Component:f.props.Component,index:f.props.index,path:f.props.path,middleware:f.props.middleware,loader:f.props.loader,action:f.props.action,hydrateFallbackElement:f.props.hydrateFallbackElement,HydrateFallback:f.props.HydrateFallback,errorElement:f.props.errorElement,ErrorBoundary:f.props.ErrorBoundary,hasErrorBoundary:f.props.hasErrorBoundary===!0||f.props.ErrorBoundary!=null||f.props.errorElement!=null,shouldRevalidate:f.props.shouldRevalidate,handle:f.props.handle,lazy:f.props.lazy};f.props.children&&(v.children=gs(f.props.children,h)),s.push(v)}),s}var oi="get",si="application/x-www-form-urlencoded";function di(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function kh(i){return di(i)&&i.tagName.toLowerCase()==="button"}function _h(i){return di(i)&&i.tagName.toLowerCase()==="form"}function Eh(i){return di(i)&&i.tagName.toLowerCase()==="input"}function Ch(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function Nh(i,a){return i.button===0&&(!a||a==="_self")&&!Ch(i)}function ws(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((a,s)=>{let f=i[s];return a.concat(Array.isArray(f)?f.map(d=>[s,d]):[[s,f]])},[]))}function jh(i,a){let s=ws(i);return a&&a.forEach((f,d)=>{s.has(d)||a.getAll(d).forEach(h=>{s.append(d,h)})}),s}var ni=null;function Rh(){if(ni===null)try{new FormData(document.createElement("form"),0),ni=!1}catch{ni=!0}return ni}var Ph=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function hs(i){return i!=null&&!Ph.has(i)?(St(!1,`"${i}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${si}"`),null):i}function Lh(i,a){let s,f,d,h,v;if(_h(i)){let y=i.getAttribute("action");f=y?Ut(y,a):null,s=i.getAttribute("method")||oi,d=hs(i.getAttribute("enctype"))||si,h=new FormData(i)}else if(kh(i)||Eh(i)&&(i.type==="submit"||i.type==="image")){let y=i.form;if(y==null)throw new Error('Cannot submit a + )} + + ); +} + +export default PriceSlider; diff --git a/themes/demo-store-headless/src/components/ProductList.jsx b/themes/demo-store-headless/src/components/ProductList.jsx index 25d2ef31..9564e98b 100644 --- a/themes/demo-store-headless/src/components/ProductList.jsx +++ b/themes/demo-store-headless/src/components/ProductList.jsx @@ -4,13 +4,22 @@ * Port improvements both ways. Identifier mapping when porting: * localStorage key 'demo-store-cart-token' ↔ 'base-headless-cart-token' * script handle 'demo-store-app' ↔ 'base-headless-app' + * + * NOTE: minPrice / maxPrice / currencyMinorUnit props and emptyMessage + * are demo-store specific. base-headless does not use them. */ import { useEffect, useState } from 'react'; import { getProducts } from '../api/products'; import ProductCard from './ProductCard'; -function ProductList({ perPage = 12 }) { +function ProductList({ + perPage = 12, + minPrice, + maxPrice, + currencyMinorUnit, + emptyMessage = 'No products yet.', +}) { const [products, setProducts] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -18,7 +27,7 @@ function ProductList({ perPage = 12 }) { useEffect(() => { let cancelled = false; setLoading(true); - getProducts({ perPage }) + getProducts({ perPage, minPrice, maxPrice, currencyMinorUnit }) .then((data) => { if (cancelled) return; setProducts(Array.isArray(data) ? data : []); @@ -32,7 +41,7 @@ function ProductList({ perPage = 12 }) { if (!cancelled) setLoading(false); }); return () => { cancelled = true; }; - }, [perPage]); + }, [perPage, minPrice, maxPrice, currencyMinorUnit]); if (loading) { return ( @@ -48,7 +57,7 @@ function ProductList({ perPage = 12 }) { } if (products.length === 0) { - return

No products yet.

; + return

{emptyMessage}

; } return ( diff --git a/themes/demo-store-headless/src/pages/Shop.jsx b/themes/demo-store-headless/src/pages/Shop.jsx index 9b95d601..a248a9b6 100644 --- a/themes/demo-store-headless/src/pages/Shop.jsx +++ b/themes/demo-store-headless/src/pages/Shop.jsx @@ -4,11 +4,84 @@ * Port improvements both ways. Identifier mapping when porting: * localStorage key 'demo-store-cart-token' ↔ 'base-headless-cart-token' * script handle 'demo-store-app' ↔ 'base-headless-app' + * + * NOTE: The price filter (PriceSlider, getPriceRange, debounced price state) + * is demo-store specific — do not port to base-headless. */ +import { useState, useEffect, useCallback, useRef } from 'react'; import ProductList from '../components/ProductList'; +import PriceSlider from '../components/PriceSlider'; +import { getPriceRange } from '../api/products'; function Shop() { + const [priceRange, setPriceRange] = useState(null); + const [selectedMin, setSelectedMin] = useState(null); + const [selectedMax, setSelectedMax] = useState(null); + const [debouncedMin, setDebouncedMin] = useState(null); + const [debouncedMax, setDebouncedMax] = useState(null); + + const debounceRef = useRef(null); + + // Fetch price range on mount + useEffect(() => { + let cancelled = false; + getPriceRange() + .then((range) => { + if (cancelled) return; + setPriceRange(range); + setSelectedMin(range.min); + setSelectedMax(range.max); + setDebouncedMin(range.min); + setDebouncedMax(range.max); + }) + .catch(() => { + // Price range fetch failed — slider simply won't render + }); + return () => { cancelled = true; }; + }, []); + + // Debounce selected values + useEffect(() => { + if (selectedMin === null || selectedMax === null) return; + if (debounceRef.current) clearTimeout(debounceRef.current); + debounceRef.current = setTimeout(() => { + setDebouncedMin(selectedMin); + setDebouncedMax(selectedMax); + }, 300); + return () => { + if (debounceRef.current) clearTimeout(debounceRef.current); + }; + }, [selectedMin, selectedMax]); + + const handlePriceChange = useCallback((newMin, newMax) => { + setSelectedMin(newMin); + setSelectedMax(newMax); + }, []); + + const handleReset = useCallback(() => { + if (!priceRange) return; + setSelectedMin(priceRange.min); + setSelectedMax(priceRange.max); + setDebouncedMin(priceRange.min); + setDebouncedMax(priceRange.max); + }, [priceRange]); + + const showSlider = + priceRange !== null && + priceRange.min !== priceRange.max; + + // Determine if a price filter is actively narrowing results + const isFiltered = + priceRange !== null && + debouncedMin !== null && + debouncedMax !== null && + (debouncedMin !== priceRange.min || debouncedMax !== priceRange.max); + + // Only pass price params once range is loaded + const filterMin = priceRange !== null ? debouncedMin : undefined; + const filterMax = priceRange !== null ? debouncedMax : undefined; + return ( <>
@@ -16,7 +89,30 @@ function Shop() {

Shop

- + + {showSlider && ( + + )} + + ); } diff --git a/themes/demo-store-headless/src/styles/PriceSlider.css b/themes/demo-store-headless/src/styles/PriceSlider.css new file mode 100644 index 00000000..a87c6557 --- /dev/null +++ b/themes/demo-store-headless/src/styles/PriceSlider.css @@ -0,0 +1,163 @@ +/** + * PriceSlider styles — Salve cosmetic store + * + * NOTE: demo-store specific — do not port to base-headless. + */ + +.price-slider { + max-width: 320px; + margin: 0 auto var(--space-5); + text-align: center; +} + +.price-slider__label { + font-family: var(--font-body); + font-size: var(--type-eyebrow-size); + font-weight: 600; + letter-spacing: var(--track-widest); + text-transform: uppercase; + color: var(--color-text-secondary); + margin-bottom: var(--space-3); + display: block; +} + +.price-slider__track-wrapper { + position: relative; + height: 36px; + display: flex; + align-items: center; +} + +.price-slider__track { + position: absolute; + left: 0; + right: 0; + height: 1px; + background: var(--color-border-subtle); + pointer-events: none; +} + +.price-slider__range { + position: absolute; + height: 1px; + background: var(--color-border-strong); + pointer-events: none; +} + +/* Shared input styles */ +.price-slider__input { + position: absolute; + width: 100%; + height: 36px; + margin: 0; + padding: 0; + background: none; + pointer-events: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + outline: none; +} + +.price-slider__input::-webkit-slider-runnable-track { + height: 1px; + background: transparent; + border: none; +} + +.price-slider__input::-moz-range-track { + height: 1px; + background: transparent; + border: none; +} + +/* WebKit thumb */ +.price-slider__input::-webkit-slider-thumb { + -webkit-appearance: none; + width: 14px; + height: 14px; + border-radius: 50%; + background: var(--color-bg-elevated); + border: var(--border-width) solid var(--color-border-strong); + cursor: pointer; + pointer-events: auto; + margin-top: -7px; + transition: background-color var(--duration-fast) var(--ease-standard); +} + +.price-slider__input:active::-webkit-slider-thumb { + background: var(--color-text-primary); +} + +/* Firefox thumb */ +.price-slider__input::-moz-range-thumb { + width: 14px; + height: 14px; + border-radius: 50%; + background: var(--color-bg-elevated); + border: var(--border-width) solid var(--color-border-strong); + cursor: pointer; + pointer-events: auto; + transition: background-color var(--duration-fast) var(--ease-standard); +} + +.price-slider__input:active::-moz-range-thumb { + background: var(--color-text-primary); +} + +/* Z-index layering */ +.price-slider__input--min { + z-index: 2; +} + +.price-slider__input--max { + z-index: 1; +} + +.price-slider__input--min.price-slider__input--swap { + z-index: 1; +} + +.price-slider__input--max.price-slider__input--swap { + z-index: 2; +} + +/* Values display */ +.price-slider__values { + display: flex; + justify-content: space-between; + margin-top: var(--space-2); + font-family: var(--font-body); + font-size: var(--type-body-sm-size); + color: var(--color-text-secondary); + letter-spacing: var(--track-wide); +} + +/* Reset button */ +.price-slider__reset { + display: inline-block; + margin-top: var(--space-3); + font-family: var(--font-body); + font-size: var(--type-caption-size); + font-weight: 600; + letter-spacing: var(--track-wider); + text-transform: uppercase; + color: var(--color-text-muted); + background: none; + border: none; + cursor: pointer; + text-decoration: underline; + text-underline-offset: 3px; + padding: 0; + transition: color var(--duration-fast) var(--ease-standard); +} + +.price-slider__reset:hover { + color: var(--color-text-primary); +} + +/* Disabled state */ +.price-slider--disabled { + opacity: 0.4; + pointer-events: none; +}