1 line
No EOL
17 KiB
JavaScript
1 line
No EOL
17 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9934],{2269:(e,t,s)=>{"use strict";var r=s(9509);s(8375);var i=s(2115),n=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(i),o=void 0!==r&&r.env&&!0,a=function(e){return"[object String]"===Object.prototype.toString.call(e)},d=function(){function e(e){var t=void 0===e?{}:e,s=t.name,r=void 0===s?"stylesheet":s,i=t.optimizeForSpeed,n=void 0===i?o:i;c(a(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",c("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var d="undefined"!=typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=d?d.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"undefined"!=typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(o||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(c(a(e),"`insertRule` accepts only strings"),"undefined"==typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return o||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"undefined"==typeof window){var s="undefined"!=typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(r){o||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];c(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},s.deleteRule=function(e){if("undefined"==typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];c(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"undefined"!=typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"undefined"==typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&c(a(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var i=document.head||document.getElementsByTagName("head")[0];return s?i.insertBefore(r,s):i.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function c(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var l=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},f={};function u(e,t){if(!t)return"jsx-"+e;var s=String(t),r=e+s;return f[r]||(f[r]="jsx-"+l(e+"-"+s)),f[r]}function h(e,t){"undefined"==typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return f[s]||(f[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),f[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,r=void 0===s?null:s,i=t.optimizeForSpeed,n=void 0!==i&&i;this._sheet=r||new d({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),r&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),r=s.styleId,i=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var n=i.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=n,this._instancesCounts[r]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],r=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var i=u(r,s);return{styleId:i,rules:Array.isArray(t)?t.map(function(e){return h(i,e)}):[h(i,t)]}}return{styleId:u(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=i.createContext(null);p.displayName="StyleSheetContext";var x=n.default.useInsertionEffect||n.default.useLayoutEffect,_="undefined"!=typeof window?new m:void 0;function v(e){var t=_||i.useContext(p);return t&&("undefined"==typeof window?t.add(e):x(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return u(e[0],e[1])}).join(" ")},t.style=v},2473:(e,t,s)=>{Promise.resolve().then(s.bind(s,5647))},5647:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>f});var r=s(5155),i=s(9137),n=s.n(i),o=s(2115),a=s(5695),d=s(6874),c=s.n(d),l=s(6766);function f(){let e=(0,a.useSearchParams)().get("query")||"",[t,s]=(0,o.useState)(e),[i,d]=(0,o.useState)(e),[f,u]=(0,o.useState)([]),[h,m]=(0,o.useState)([]),[p,x]=(0,o.useState)([]),[_,v]=(0,o.useState)(""),[g,y]=(0,o.useState)(""),[b,j]=(0,o.useState)(!0);(0,o.useEffect)(()=>{let e=setTimeout(()=>d(t),300);return()=>clearTimeout(e)},[t]),(0,o.useEffect)(()=>{(async()=>{try{let[e,t,s]=await Promise.all([fetch("".concat("https://forms.lasereverything.net","/items/bg_entries?fields=id,index.id,index.filename_disk,index.type,header.id,header.filename_disk,product_make,product_model,product_price,review_overview_text,bg_entry_cat,bg_entry_sub_cat&limit=-1&sort[]=sort")),fetch("".concat("https://forms.lasereverything.net","/items/bg_cat?fields=id,name&limit=-1")),fetch("".concat("https://forms.lasereverything.net","/items/bg_sub_cat?fields=id,name,bg_entry_cat&limit=-1"))]),[r,i,n]=await Promise.all([e.json(),t.json(),s.json()]);u((null==r?void 0:r.data)||[]),m((null==i?void 0:i.data)||[]),x((null==n?void 0:n.data)||[]),j(!1)}catch(e){console.error("Error fetching data:",e),j(!1)}})()},[]);let S=e=>null==e?void 0:e.toLowerCase().replace(/[_\s]/g,""),w=(0,o.useMemo)(()=>{let e=S(i);return f.filter(t=>{let s=!_||t.bg_entry_cat===parseInt(_),r=!g||t.bg_entry_sub_cat===parseInt(g),i=!e||[t.product_make,t.product_model,t.review_overview_text].some(t=>S(t||"").includes(e));return s&&r&&i})},[f,i,_,g]),N=(0,o.useMemo)(()=>_?p.filter(e=>e.bg_entry_cat===parseInt(_)):p,[p,_]),k=(0,o.useMemo)(()=>{if(!f.length)return null;let e=Math.floor(Math.random()*f.length);return f[e]},[f]),z=(0,o.useMemo)(()=>{if(f.length<2)return null;let e=Math.floor(Math.random()*f.length);for(;f[e].id===(null==k?void 0:k.id);)e=Math.floor(Math.random()*f.length);return f[e]},[f,k]);return(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 p-6 max-w-7xl mx-auto",children:[(0,r.jsx)(n(),{id:"f771d209fcff5a05",children:"mark{background:#ffde59;color:#242424;padding:0 2px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(500px,1fr));gap:1rem}.entry-card{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;background-color:#242424;color:var(--card-foreground);border:1px solid var(--border);-webkit-border-radius:.5rem;-moz-border-radius:.5rem;border-radius:.5rem;overflow:hidden;height:150px}.entry-image{width:150px;height:150px;-o-object-fit:cover;object-fit:cover}.entry-content{padding:.75rem;-webkit-box-flex:1;-webkit-flex:1;-moz-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.truncate-title{white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}"}),(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h1",{className:"jsx-f771d209fcff5a05 text-2xl font-bold mb-2",children:"Buying Guide"}),(0,r.jsxs)("select",{value:_,onChange:e=>{v(e.target.value),y("")},className:"jsx-f771d209fcff5a05 w-full border rounded px-3 py-2 mb-2",children:[(0,r.jsx)("option",{value:"",className:"jsx-f771d209fcff5a05",children:"All Categories"}),h.map(e=>(0,r.jsx)("option",{value:e.id.toString(),className:"jsx-f771d209fcff5a05",children:e.name},e.id))]}),(0,r.jsxs)("select",{value:g,onChange:e=>y(e.target.value),className:"jsx-f771d209fcff5a05 w-full border rounded px-3 py-2 mb-2",children:[(0,r.jsx)("option",{value:"",className:"jsx-f771d209fcff5a05",children:"All Subcategories"}),N.map(e=>(0,r.jsx)("option",{value:e.id.toString(),className:"jsx-f771d209fcff5a05",children:e.name},e.id))]}),(0,r.jsx)("input",{type:"search",value:t,onChange:e=>s(e.target.value),placeholder:"Search products by make, model, etc...",className:"jsx-f771d209fcff5a05 w-full mb-4 dark:bg-background border border-border rounded-md p-2"}),(0,r.jsx)("p",{className:"jsx-f771d209fcff5a05 text-sm text-muted-foreground mb-2",children:"Discover reviewed laser products and accessories."}),(0,r.jsx)("a",{href:"/",className:"jsx-f771d209fcff5a05 inline-block mt-2 px-4 py-2 bg-accent text-background rounded-md text-sm",children:"← Back to Main Menu"})]}),[k,z].map((e,t)=>{var s,i;return e&&(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-f771d209fcff5a05 text-md font-semibold mb-2",children:"Featured Product"}),(null==(s=e.header)?void 0:s.filename_disk)?(0,r.jsx)(l.default,{src:"https://forms.lasereverything.net/assets/".concat(e.header.filename_disk),alt:"Header image",width:800,height:100,className:"w-full h-[100px] object-cover mb-2 rounded-md",unoptimized:!0}):(0,r.jsx)("div",{className:"jsx-f771d209fcff5a05 w-full h-[100px] bg-zinc-800 flex items-center justify-center text-zinc-400 text-sm rounded-md mb-2",children:"No Header"}),(0,r.jsxs)(c(),{href:"/buying-guide/product/".concat(e.id),className:"text-accent font-semibold text-lg hover:underline",children:[e.product_make," ",e.product_model]}),e.product_price&&(0,r.jsxs)("p",{className:"jsx-f771d209fcff5a05 text-sm text-white",children:["Starting at ",e.product_price]}),(0,r.jsxs)("p",{className:"jsx-f771d209fcff5a05 text-sm text-muted-foreground mt-1",children:[null==(i=e.review_overview_text)?void 0:i.slice(0,140),"..."]})]},t)}),(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-f771d209fcff5a05 text-md font-semibold mb-2",children:"Popular Categories"}),(0,r.jsx)("ul",{className:"jsx-f771d209fcff5a05 text-sm space-y-1",children:h.slice(0,5).map(e=>(0,r.jsx)("li",{className:"jsx-f771d209fcff5a05",children:(0,r.jsx)("button",{onClick:()=>{v(e.id.toString()),y("")},className:"jsx-f771d209fcff5a05 text-accent hover:underline",children:e.name})},e.id))})]}),(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-f771d209fcff5a05 text-md font-semibold mb-2",children:"Recently Added"}),(0,r.jsx)("ul",{className:"jsx-f771d209fcff5a05 text-sm space-y-1",children:f.slice(0,3).map(e=>(0,r.jsx)("li",{className:"jsx-f771d209fcff5a05",children:(0,r.jsxs)(c(),{href:"/buying-guide/product/".concat(e.id),className:"text-accent hover:underline",children:[e.product_make," ",e.product_model]})},e.id))})]}),(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-f771d209fcff5a05 text-md font-semibold mb-2",children:"What Is This?"}),(0,r.jsx)("p",{className:"jsx-f771d209fcff5a05 text-sm text-muted-foreground",children:"This Buying Guide helps you compare laser-related gear with hands-on reviews, scores, and recommendations. Use the filters and search to find what you’re looking for!"})]})]}),(0,r.jsx)("hr",{className:"jsx-f771d209fcff5a05 my-8 border-border"}),b?(0,r.jsx)("p",{className:"jsx-f771d209fcff5a05 text-muted",children:"Loading entries..."}):0===w.length?(0,r.jsx)("p",{className:"jsx-f771d209fcff5a05 text-muted",children:"No entries found."}):(0,r.jsx)("div",{className:"jsx-f771d209fcff5a05 card-grid",children:w.map(e=>{var t,s;let i=null==(t=e.index)?void 0:t.filename_disk;return(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05 entry-card",children:[i?(0,r.jsx)(l.default,{src:"https://forms.lasereverything.net/assets/".concat(i),alt:"".concat(e.product_make," ").concat(e.product_model),width:150,height:150,className:"entry-image",unoptimized:!0}):(0,r.jsx)("div",{className:"jsx-f771d209fcff5a05 entry-image bg-zinc-800 flex items-center justify-center text-zinc-400",children:"No Image"}),(0,r.jsx)("div",{className:"jsx-f771d209fcff5a05 entry-content",children:(0,r.jsxs)("div",{className:"jsx-f771d209fcff5a05",children:[(0,r.jsx)("p",{className:"jsx-f771d209fcff5a05 text-sm font-medium text-muted-foreground truncate-title",children:e.product_make}),(0,r.jsx)(c(),{href:"/buying-guide/product/".concat(e.id),className:"text-lg font-semibold text-accent underline truncate-title",title:e.product_model,children:e.product_model}),void 0!==e.product_price&&(0,r.jsxs)("p",{className:"jsx-f771d209fcff5a05 text-sm text-foreground mt-1 font-medium",children:["Starting at ",e.product_price]}),(0,r.jsxs)("p",{className:"jsx-f771d209fcff5a05 text-xs text-muted-foreground mt-1",children:[null==(s=e.review_overview_text)?void 0:s.slice(0,120),"..."]})]})})]},e.id)})})]})}},8375:()=>{},9137:(e,t,s)=>{"use strict";e.exports=s(2269).style}},e=>{var t=t=>e(e.s=t);e.O(0,[6874,4212,8441,1684,7358],()=>t(2473)),_N_E=e.O()}]); |