PageSourceSearch

https://calabash.app/assets/useVisitorLocation-BKQKnpE8.js

js calabash.app collected 2026-10-04 08:05:16 UTC 5,497 bytes, 9 lines download raw bytes

1import{aq as F,j as b,ar as j,as as U,at as W,au as q,av as B,aw as G,ax as X,ay as J,az as Q,s as Z}from"./index-DyMEJKlS.js";import{k as t}from"./syncfusion-charts-DlApThQX.js";function K(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function ee(...e){return n=>{let o=!1;const s=e.map(i=>{const u=K(i,n);return!o&&typeof u=="function"&&(o=!0),u});if(o)return()=>{for(let i=0;i<s.length;i++){const u=s[i];typeof u=="function"?u():K(e[i],null)}}}}function te(...e){return t.useCallback(ee(...e),e)}class ne extends t.Component{getSnapshotBeforeUpdate(n){const o=this.props.childRef.current;if(j(o)&&n.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=o.offsetParent,i=j(s)&&s.offsetWidth||0,u=j(s)&&s.offsetHeight||0,d=getComputedStyle(o),r=this.props.sizeRef.current;r.height=parseFloat(d.height),r.width=parseFloat(d.width),r.top=o.offsetTop,r.left=o.offsetLeft,r.right=i-r.width-r.left,r.bottom=u-r.height-r.top}return null}componentDidUpdate(){}render(){return this.props.children}}function oe({children:e,isPresent:n,anchorX:o,anchorY:s,root:i,pop:u}){var a;const d=t.useId(),r=t.useRef(null),R=t.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:p}=t.useContext(F),c=((a=e.props)==null?void 0:a.ref)??(e==null?void 0:e.ref),h=te(r,c);return t.useInsertionEffect(()=>{const{width:f,height:m,top:w,left:E,right:I,bottom:L}=R.current;if(n||u===!1||!r.current||!f||!m)return;const _=o==="left"?`left: ${E}`:`right: ${I}`,y=s==="bottom"?`bottom: ${L}`:`top: ${w}`;r.current.dataset.motionPopId=d;const g=document.createElement("style");p&&(g.nonce=p);const S=i??document.head;return S.appendChild(g),g.sheet&&g.sheet.insertRule(`
2          [data-motion-pop-id="${d}"] {
3            position: absolute !important;
4            width: ${f}px !important;
5            height: ${m}px !important;
6            ${_}px !important;
7            ${y}px !important;
8          }
9        `),()=>{var x;(x=r.current)==null||x.removeAttribute("data-motion-pop-id"),S.contains(g)&&S.removeChild(g)}},[n]),b.jsx(ne,{isPresent:n,childRef:r,sizeRef:R,pop:u,children:u===!1?e:t.cloneElement(e,{ref:h})})}const se=({children:e,initial:n,isPresent:o,onExitComplete:s,custom:i,presenceAffectsLayout:u,mode:d,anchorX:r,anchorY:R,root:p})=>{const c=U(re),h=t.useId();let a=!0,f=t.useMemo(()=>(a=!1,{id:h,initial:n,isPresent:o,custom:i,onExitComplete:m=>{c.set(m,!0);for(const w of c.values())if(!w)return;s&&s()},register:m=>(c.set(m,!1),()=>c.delete(m))}),[o,c,s]);return u&&a&&(f={...f}),t.useMemo(()=>{c.forEach((m,w)=>c.set(w,!1))},[o]),t.useEffect(()=>{!o&&!c.size&&s&&s()},[o]),e=b.jsx(oe,{pop:d==="popLayout",isPresent:o,anchorX:r,anchorY:R,root:p,children:e}),b.jsx(W.Provider,{value:f,children:e})};function re(){return new Map}const O=e=>e.key||"";function V(e){const n=[];return t.Children.forEach(e,o=>{t.isValidElement(o)&&n.push(o)}),n}const le=({children:e,custom:n,initial:o=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:u="sync",propagate:d=!1,anchorX:r="left",anchorY:R="top",root:p})=>{const[c,h]=q(d),a=t.useMemo(()=>V(e),[e]),f=d&&!c?[]:a.map(O),m=t.useRef(!0),w=t.useRef(a),E=U(()=>new Map),I=t.useRef(new Set),[L,_]=t.useState(a),[y,g]=t.useState(a);B(()=>{m.current=!1,w.current=a;for(let C=0;C<y.length;C++){const l=O(y[C]);f.includes(l)?(E.delete(l),I.current.delete(l)):E.get(l)!==!0&&E.set(l,!1)}},[y,f.length,f.join("-")]);const S=[];if(a!==L){let C=[...a];for(let l=0;l<y.length;l++){const M=y[l],$=O(M);f.includes($)||(C.splice(l,0,M),S.push(M))}return u==="wait"&&S.length&&(C=S),g(V(C)),_(a),null}const{forceRender:x}=t.useContext(G);return b.jsx(b.Fragment,{children:y.map(C=>{const l=O(C),M=d&&!c?!1:a===y||f.includes(l),$=()=>{if(I.current.has(l))return;if(E.has(l))I.current.add(l),E.set(l,!0);else return;let Y=!0;E.forEach(H=>{H||(Y=!1)}),Y&&(x==null||x(),g(w.current),d&&(h==null||h()),s&&s())};return b.jsx(se,{isPresent:M,initial:!m.current||o?void 0:!1,custom:n,presenceAffectsLayout:i,mode:u,root:p,onExitComplete:M?void 0:$,anchorX:r,anchorY:R,children:C},l)})})};function fe(){!X.current&&J();const[e]=t.useState(Q.current);return e}const T="calabash.selectedCountry",v="calabash.locationOverride",N="calabash.detectedCountry",A="calabash.locationDetectedThisSession";function D(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function P(e,n){if(!(typeof window>"u"))try{window.localStorage.setItem(e,n)}catch{}}function z(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}function ie(){if(typeof window>"u")return!0;try{return window.sessionStorage.getItem(A)==="1"}catch{return!0}}function ue(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(A,"1")}
9catch{}}function k(e){const n=e==null?void 0:e.trim();return n?n.length===2?n.toUpperCase():n:null}function de(){const[e,n]=t.useState(()=>D(v)==="1"),[o,s]=t.useState(()=>D(v)==="1"?k(D(T)):null),[i,u]=t.useState(()=>k(D(N)));t.useEffect(()=>{if(e||ie())return;let p=!1;return ue(),(async()=>{try{const{data:h,error:a}=await Z.functions.invoke("geo-locate");if(p||a)return;const f=k(h==null?void 0:h.countryCode);if(!f)return;P(N,f),u(f)}catch{}})(),()=>{p=!0}},[e]);const d=t.useCallback(p=>{const c=k(p);if(!c){z(T),P(v,"1"),n(!0),s(null);return}P(T,c),P(v,"1"),n(!0),s(c)},[]),r=t.useCallback(()=>{z(T),z(v),n(!1),s(null)},[]);return{selectedCountry:t.useMemo(()=>e?o:i??null,[i,e,o]),detectedCountry:i,setSelectedCountry:d,clearOverride:r}}export{le as A,v as L,T as S,de as a,fe as u};

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.