import{j as e}from"./ui-vendor-CJlQk0Tq.js";import{S as t}from"./SEOHead-GzrL-58M.js";import{C as r,d2 as s}from"./index-BzXujQ-F.js";import{C as o}from"./CTAButton-CfAJjgj1.js";import{e as n,r as i}from"./react-vendor-f6QdChhz.js";import{s as u,a}from"./slug-parser-8h41spFl.js";const c=()=>{const s=n().pathname.includes("/past-inventory");return e.jsxs(e.Fragment,{children:[e.jsx(t,{title:"Structure Not Found | White Pine Structures",description:"The structure you're looking for doesn't exist or has been removed.",canonical:"https://whitepinestructures.com/stock-structures",noindex:!0,structuredData:{"@context":"https://schema.org","@type":"WebPage",name:"Structure Not Found",description:"The structure you're looking for doesn't exist or has been removed",url:"https://whitepinestructures.com",mainEntity:{"@type":"WebSite","@id":"https://whitepinestructures.com"}}}),e.jsx("main",{className:"min-h-screen py-16",children:e.jsx("div",{className:"container mx-auto px-4 text-center",children:e.jsxs(r,{className:"max-w-2xl mx-auto p-8 shadow-wood",children:[e.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Structure Not Found"}),e.jsx("p",{className:"mb-8",children:"The structure you're looking for doesn't exist or has been removed."}),e.jsx(o,{to:s?"/past-inventory":"/stock-structures",variant:"primary",children:s?"Back to Customer Builds":"Back to Stock Structures"})]})})})]})},d=(e,t,r)=>{const[o,n]=i.useState(null),[c,d]=i.useState(!0),[l,m]=i.useState([]),[f,p]=i.useState(0),[h,x]=i.useState([]),[w,C]=i.useState(0);return i.useEffect(()=>{const t=(()=>{if(!e)return null;let t=null;if(t=s.find(t=>t.id.toLowerCase()===e.toLowerCase()),t)return t;if(e.includes("-")){const r=u(e);if(r!==e&&(t=s.find(e=>e.id.toLowerCase()===r.toLowerCase()),t))return t;const{itemNumber:o}=a(r);if(o){const e=o.toLowerCase();if(t=s.find(t=>{var r;return(null==(r=t.itemNumber)?void 0:r.toLowerCase())===e}),t)return t}const n=r.split("-");for(let e=n.length-1;e>=0;e--){const r=n[e];if(r&&/^[A-Za-z0-9.\-xX]+$/.test(r)&&r.length>=3){const e=r.toLowerCase();if(t=s.find(t=>{var r;return(null==(r=t.itemNumber)?void 0:r.toLowerCase())===e}),t)return t}}}if(!t&&r){const e=r.toLowerCase();if(t=s.find(t=>{var r;return(null==(r=t.itemNumber)?void 0:r.toLowerCase())===e}),t)return t}if(!t){const r=e.toLowerCase().replace(/(\d+)x(\d+)/g,"$1X$2");if(t=s.find(e=>{const t=e.id.toLowerCase().replace(/(\d+)x(\d+)/gi,"$1X$2");return t.includes(r)||r.includes(t)}),t)return t}return!t&&(t=s.find(t=>t.id.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(t.id.toLowerCase())),t)?t:null})();if(t){n(t);const e=s.filter(e=>e.type===t.type&&e.soldOut===t.soldOut);x(e),C(e.length);const r=e.findIndex(e=>e.id===t.id);p(Math.max(0,r));const o=e.filter(e=>e.id!==t.id).slice(0,3);m(o)}else n(null);d(!1)},[e,t,r]),{structure:o,loading:c,similarStructures:l,currentIndex:f,structuresOfSameType:h,typeStructureCount:w}};export{c as S,d as u};