1import{jg as q,b3 as J,r as f,t as Q,b as Z,bo as b,j as x,T as ee,e as te}from"./appBoot-Dxz8j10y.js";import"./index-ljb57BpO.js";const ie=new URL("/assets/fly-visitor-Bmf-ff0S.js",import.meta.url).href,A=`https://media.base44.com/files/public/${q}`,ne={body:`${A}/553ad0b6a_e1bf5a74e_livefly-body-fullbin.gz`,lite:`${A}/2edc2f1b0_74fc24900_screenfly-body-litebin.gz`,tiny:`${A}/5c07f6832_a39e650ae_screenfly-body-tinybin.gz`,escape:`${A}/fd8b9622d_41f19571b_flybrain-c_escapebin.gz`},O={minVisits:4,maxVisits:5,max:4},re={min:2*6e4,max:6*6e4},se={min:18*6e4,max:20*6e4},oe=6e4,k=3e4,ae=3e4,le=2e3,ce=6e4,z=500,fe=500,de=4e3,ue=60,me=900,ye='button, [role="button"], a[href], [role="tab"], [role="menuitem"]',he={minW:14,maxW:480,minH:12,maxH:200},ve=["/toolembed","/toolpicker"],_e="brik-fly:",pe="__flyIsHost",v={visit:"brik-fly:visit",targets:"brik-fly:targets",pointer:"brik-fly:pointer",leave:"brik-fly:leave",press:"brik-fly:press",positions:"brik-fly:positions",left:"brik-fly:left",clean:"brik-fly:clean"},we={play:!0,pointerMode:"scare",swatWith:"finger",maxFlies:1,spawn:!1,exitSides:!0,exitSpeed:.6,dirtLife:.2,arrival:"gradual",spawnEvery:120,startFlies:1,species:"house",size:1.2,sex:"mixed",variety:.6,darkness:.85,eyeColor:"#b3190d",activity:.55,grooming:.6,nervous:1,returnDelay:6,social:!1,buzz:!1,difficulty:.5,explain:!1,pointerLook:"none",lifeStages:"off",trail:!0,trailStyle:"feet",trailFrom:"body",trailColors:{type:"linear",stops:[{offset:0,color:"#3b332c",opacity:100},{offset:100,color:"#3b332c",opacity:100}]},trailWidth:.6,trailOpacity:.22,trailSoft:.4,trailPressure:.5,trailAir:!1,scent:"attract",scentFrom:"text",scentText:"",scentSize:.6,scentStrength:1,scentShow:!1,shadow:.45,shadowSoft:.3,shadowFrom:"above",exposure:1.6,pxPerMm:3.2,bgMode:"transparent"},H={layer:"fly-visitor-layer",dismiss:"fly-visitor-dismiss"},Se=`<script>(function(){var real=window.parent;if(!real||real===window)return;Object.defineProperty(window,${JSON.stringify(pe)},{value:function(w){return w===real;}});var guard={postMessage:function(m,o,t){if(m&&typeof m.type==='string'&&m.type.indexOf(${JSON.stringify(_e)})===0){real.postMessage(m,o,t);}}};try{Object.defineProperty(window,'parent',{value:guard,configurable:true});}catch(e){window.parent=guard;}})();<\/script>`;async function Te(){const e=await fetch(ie);if(!e.ok)throw new Error(`Fly visitor code: HTTP ${e.status}`);const t=`window.__FLY_PACKS = ${JSON.stringify(ne)}; 2${await e.text()}`,n=Object.entries(we).map(([r,i])=>({type:"state",key:r,label:r,default:i})),a=J({name:"Fly visitor",controlsSchema:n,canvasCode:t,libraries:[],customCss:"",fullBleed:!0});if(!a.includes("<head>"))throw new Error("Fly visitor page: no <head> to guard");return a.replace("<head>",`<head>${Se}`)}function $(e,t=Math.random){if(e){const{min:r,max:i}=re;return r+t()*(i-r)}const{min:n,max:a}=se;return n+t()*(a-n)}function D(e=Math.random){return e()<.5?O.minVisits:O.maxVisits}function ge(e){var a,r;const t=((a=e.defaultView)==null?void 0:a.innerWidth)??1,n=((r=e.defaultView)==null?void 0:r.innerHeight)??1;return Array.from(e.querySelectorAll("iframe, canvas")).filter(i=>!i.closest("[data-fly-visitor-layer]")).map((i,d)=>{const m=i.getBoundingClientRect();return{id:String(d),x:m.left/t,y:m.top/n,w:m.width/t,h:m.height/n}}).filter(i=>i.w>0&&i.h>0&&i.x<1&&i.y<1&&i.x+i.w>0&&i.y+i.h>0)}function G(e){const t=e.toLowerCase();return ve.some(n=>t.startsWith(n))}function N(e){return e.hidden||e.reducedMotion||e.viewportWidth<me?!1:!G(e.pathname)}function be(e,t=ue){const n=e.defaultView,a=(n==null?void 0:n.innerWidth)??0,r=(n==null?void 0:n.innerHeight)??0,i=[],d=[];if(!a||!r)return{targets:i,elements:d};const{minW:m,maxW:S,minH:R,maxH:I}=he;for(const o of Array.from(e.querySelectorAll(ye))){if(d.length>=t)break;if(o.closest("[data-fly-visitor-layer]")||Re(o))continue;const s=o.getBoundingClientRect();if(s.width<m||s.width>S||s.height<R||s.height>I||s.left<0||s.top<0||s.right>a||s.bottom>r)continue;const T=e.elementFromPoint(s.left+s.width/2,s.top+s.height/2);!T||!o.contains(T)||(i.push({id:String(d.length),x:s.left/a,y:s.top/r,w:s.width/a,h:s.height/r}),d.push(o))}return{targets:i,elements:d}}function Re(e){return e.getAttribute("aria-disabled")==="true"||e instanceof HTMLButtonElement&&e.disabled}function Ie(e){const t=a=>Array.from(a).map(r=>{if(r instanceof CSSStyleRule&&r.selectorText.includes(":hover"))return`${r.selectorText.replace(/:hover\b/g,"[data-fly-hover]")} { ${r.style.cssText} }`;if("cssRules"in r){const i=t(r.cssRules);return i?`${r.cssText.slice(0,r.cssText.indexOf("{"))} { ${i} }`:""}return""}).join(` 3`),n=e.createElement("style");return n.textContent=Array.from(e.styleSheets).map(a=>{try{return t(a.cssRules)}catch{return""}}).join(` 4`),e.head.appendChild(n),n}const V=()=>{var e;return{pathname:window.location.pathname,hidden:document.visibilityState==="hidden",reducedMotion:((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)").matches)??!1,viewportWidth:window.innerWidth}},j=new WeakMap;function Ee(e){!e||!e.isConnected||(clearTimeout(j.get(e)),e.setAttribute("data-fly-hover",""),j.set(e,setTimeout(()=>e.removeAttribute("data-fly-hover"),fe)))}function Fe(e){return e.slice(0,O.max).filter(t=>!!t&&typeof t=="object"&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1)}function Le(e,t,n){var a;return!!t&&e.source===t.contentWindow&&((a=e.data)==null?void 0:a.type)===n}function xe({firstVisitDelayMs:e}={}){const t=f.useRef(null),n=f.useRef([]),a=f.useRef(!0),r=f.useRef(0),i=f.useRef(D()),d=f.useRef(null),m=f.useRef(!1),[S,R]=f.useState([]),{pathname:I}=Q(),[o,s]=f.useState("idle"),[T,M]=f.useState(0),p=Z({queryKey:["fly-visitor-html"],queryFn:Te,enabled:o!=="idle",staleTime:1/0,gcTime:1/0,retry:1}),g=c=>{var l,u;return(u=(l=t.current)==null?void 0:l.contentWindow)==null?void 0:u.postMessage(c,"*")},P=(c,l={})=>{const{targets:u,elements:h}=be(document);n.current=h,g({type:c,targets:u,avoid:ge(document),...l})},B=()=>(i.current-=1,i.current>0?1:(i.current=D(),V().reducedMotion?1:O.max)),U=()=>{d.current??(d.current=B()),P(v.visit,{count:d.current})};return f.useEffect(()=>{o!=="idle"&&G(I)&&s("idle")},[I,o]),f.useEffect(()=>{if(o!=="idle")return;const c=a.current,l=T>0?oe:c&&e!==void 0?e:c?$(!0):Math.max(0,r.current-Date.now()),u=setTimeout(()=>{const h=V();N(h)?(a.current=!1,r.current=Date.now()+$(!1),m.current=!1,d.current=null,M(0),s("visiting"),b({event:"fly_visit_start",level:"INFO",message:"A fly visit started",fields:{firstVisit:c,viewportWidth:h.viewportWidth}})):M(_=>_+1)},l);return()=>clearTimeout(u)},[o,T,e]),f.useEffect(()=>{p.isError&&o==="visiting"&&(b({event:"fly_visit_error",message:"Fly engine could not be loaded",fields:{reason:"engine_load",error:String(p.error).slice(0,200)}}),s("idle"))},[p.isError,p.error,o]),f.useEffect(()=>{var u,h;if(o!=="visiting"&&o!=="fading")return;const c=()=>{const _=V();N({..._,hidden:!1})||s("clearing")},l=(u=window.matchMedia)==null?void 0:u.call(window,"(prefers-reduced-motion: reduce)");return window.addEventListener("resize",c),(h=l==null?void 0:l.addEventListener)==null||h.call(l,"change",c),()=>{var _;window.removeEventListener("resize",c),(_=l==null?void 0:l.removeEventListener)==null||_.call(l,"change",c)}},[o]),f.useEffect(()=>{if(o!=="visiting"||!p.data)return;let c=!1,l,u;const h=()=>{l||(clearTimeout(_),l=setTimeout(()=>{c=!0,g({type:v.leave})},k),u=setTimeout(()=>{b({event:"fly_visit_error",message:"The flies never left; the layer was removed",fields:{reason:"never_left"}}),s("clearing")},k+le))},_=setTimeout(()=>{b({event:"fly_visit_error",message:"The flies never started; the layer was removed",fields:{reason:"never_started"}}),s("clearing")},ae),Y=w=>{if(!t.current||w.source!==t.current.contentWindow)return;const y=w.data;if((y==null?void 0:y.type)===v.press&&typeof y.id=="string")h(),Ee(n.current[Number(y.id)]);else if((y==null?void 0:y.type)===v.positions&&Array.isArray(y.positions))h(),R(Fe(y.positions));else if((y==null?void 0:y.type)===v.left){const W=m.current;b({event:"fly_visit_success",level:"INFO",message:W?"The flies were shooed":c?"The flies left when asked":"The flies left on their own",fields:{askedToLeave:c,shooed:W}}),s("fading")}},K=Ie(document);let E=0,F=null;const C=w=>{F=w,!E&&(E=window.requestAnimationFrame(()=>{E=0,F&&g({type:v.pointer,x:F.clientX/window.innerWidth,y:F.clientY/window.innerHeight})}))},L=()=>g({type:v.pointer,off:!0}),X=setInterval(()=>P(v.targets),de);return window.addEventListener("message",Y),window.addEventListener("pointermove",C,{passive:!0}),document.addEventListener("pointerleave",L),window.addEventListener("blur",L),()=>{K.remove(),R([]),document.querySelectorAll("[data-fly-hover]").forEach(w=>w.removeAttribute("data-fly-hover")),window.removeEventListener("message",Y),window.removeEventListener("pointermove",C),document.removeEventListener("pointerleave",L),window.removeEventListener("blur",L),clearInterval(X),clearTimeout(_),clearTimeout(l),clearTimeout(u),window.cancelAnimationFrame(E)}},[o,p.data]),f.useEffect(()=>{if(o!=="fading")return;const c=u=>{Le(u,t.current,v.clean)&&s("idle")};window.addEventListener("message",c);const l=setTimeout(()=>s("clearing"),ce);return()=>{window.removeEventListener("message",c),clearTimeout(l)}},[o]),f.useEffect(()=>{if(o!=="clearing")return;const c=setTimeout(()=>s("idle"),z);return()=>clearTimeout(c)},[o]),{phase:o,html:o==="idle"?null:p.data??null,iframeRef:t,handleLoad:U,flyPositions:o==="visiting"?S:[],dismissFly:()=>{m.current=!0,g({type:v.leave})}}}const Ve=({firstVisitDelayMs:e})=>{const{phase:t,html:n,iframeRef:a,handleLoad:r,flyPositions:i,dismissFly:d}=xe({firstVisitDelayMs:e});return n?x.jsxs(x.Fragment,{children:[x.jsx("iframe",{ref:a,srcDoc:n,sandbox:ee,title:"A visiting fly","aria-hidden":"true",tabIndex:-1,"data-testid":H.layer,"data-fly-visitor-layer":"","data-phase":t,className:te("fly-visitor-layer",t==="clearing"?"fly-visitor-layer
4--clearing":null),style:{transitionDuration:`${z}ms`},onLoad:r}),i.map((m,S)=>x.jsx("button",{type:"button","aria-hidden":"true",tabIndex:-1,"data-testid":H.dismiss,"data-fly-visitor-layer":"",className:"fly-visitor-dismiss",style:{left:`${m.x*100}%`,top:`${m.y*100}%`},onPointerEnter:d,onClick:d},S))]}):null};export{Ve as default};
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.