PageSourceSearch

https://www.craft.do/_next/static/chunks/8102.7d528c4dbd32daeb.js

js craft.do collected 2026-10-02 02:39:13 UTC 10,171 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8102],{13902:(e,t,l)=>{l.d(t,{f:()=>s});var r=l(95155);function s(e){let{href:t,className:l=""}=e;return t&&t.includes("craft.do")?(0,r.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center justify-center rounded p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 ".concat(l),title:"Open in Craft",onClick:e=>e.stopPropagation(),children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,r.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,r.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}):null}},35721:(e,t,l)=>{l.r(t),l.d(t,{InventoryLayout:()=>x});var r=l(95155),s=l(12115),a=l(7460),n=l(13902),i=l(50627),o=l(10960),d=l(36956),c=l(79330),u=l(34628);function x(e){let{items:t,schema:l,actions:x,options:m}=e,h=m.categoryField,p=m.quantityField,y=m.statusField,g=m.imageField,f=m.sortBy,v=!0===m.showFileUpload,{currentItems:b,updateField:j,updateTitle:N,deleteItem:k,createItem:C}
1=(0,c.B)(t,x),[w,F]=(0,s.useState)(!1),[S,B]=(0,s.useState)({}),[L,E]=(0,s.useState)("all"),[A,D]=(0,s.useState)(""),[M,_]=(0,s.useState)(null),T=(0,s.useMemo)(()=>{if(!h)return[];let e=l.find(e=>e.key===h);if(null==e?void 0:e.enum)return e.enum;let t=new Set;return b.forEach(e=>{let l=(0,u.Fl)(e.fields[h]);l&&t.add(l)}),Array.from(t).sort()},[h,l,b]),U=(0,s.useMemo)(()=>{let e=[...b];if("all"!==L&&h&&(e=e.filter(e=>(0,u.Fl)(e.fields[h])===L)),A.trim()){let t=A.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t)||Object.values(e.fields).some(e=>(0,u.Fl)(e).toLowerCase().includes(t)))}return f&&e.sort((e,t)=>{let l=(0,u.Fl)(e.fields[f]),r=(0,u.Fl)(t.fields[f]);return l.localeCompare(r)}),e},[b,L,h,A,f]),W=b.length,V=p?b.reduce((e,t)=>e+(Number(t.fields[p])||0),0):null,q=M?b.find(e=>e.id===M):null,z=l.filter(e=>e.key!==h),H=(0,s.useCallback)(e=>{if(!e||!g)return;let t=new FileReader;t.onload=()=>{B(e=>({...e,[g]:t.result}))},t.readAsDataURL(e)},[g]),I=(0,s.useCallback)(async()=>{let e=S.title||"New item",{title:t,...l}=S;await C({title:e,...l}),B({}),F(!1)},[C,S]),O=e=>{let t=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#84cc16"],l=0;for(let t=0;t<e.length;t++)l=e.charCodeAt(t)+((l<<5)-l);return t[Math.abs(l)%t.length]};return(0,r.jsx)(a.G,{children:e=>(0,r.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,r.jsxs)("div",{className:"border-b border-gray-200 px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,r.jsx)("span",{className:"text-2xl font-bold tabular-nums",style:{color:"var(--app-accent, #111827)"},children:W}),(0,r.jsxs)("span",{className:"text-sm text-gray-500",children:[1===W?"item":"items",null!==V&&" \xb7 ".concat(V," total qty")]})]}),(0,r.jsx)(o.n,{items:b,size:"sm"}),(null==x?void 0:x.create)&&(0,r.jsxs)("button",{onClick:()=>F(!0),className:"flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium text-white hover:opacity-90",style:{backgroundColor:"var(--app-accent, #111827)"},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,r.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("input",{type:"text",value:A,onChange:e=>D(e.target.value),placeholder:"Search items...",className:"w-full rounded-md border border-gray-200 bg-gray-50 px-3 py-1.5 text-sm placeholder:text-gray-400 focus:border-gray-300 focus:outline-none"})}),T.length>0&&(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,r.jsx)("button",{onClick:()=>E("all"),className:"rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors ".concat("all"===L?"bg-gray-900 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:"All"}),T.map(e=>(0,r.jsx)("button",{onClick:()=>E(L===e?"all":e),className:"rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors ".concat(L===e?"text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),style:L===e?{backgroundColor:O(e)}:void 0,children:e},e))]})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-auto px-4 py-3",children:[w&&(null==x?void 0:x.create)&&(0,r.jsx)(i.Q,{schema:l,formData:S,setFormData:B,onCreate:I,onCancel:()=>{F(!1),B({})},title:"Add Item",showFileUpload:v||!!g,onFileSelect:H}),(0,r.jsx)("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(".concat("compact"===e?2:"medium"===e?3:4,", minmax(0, 1fr))")},children:U.map(e=>{let t=h?(0,u.Fl)(e.fields[h]):"",l=p?Number(e.fields[p])||0:null,s=y?(0,u.Fl)(e.fields[y]):"",a=g?(0,u.Fl)(e.fields[g]):"";return(0,r.jsxs)("button",{onClick:()=>_(M===e.id?null:e.id),className:"group relative flex flex-col rounded-xl border p-3 text-left transition-all hover:shadow-md ".concat(M===e.id?"border-gray-400 shadow-md":"border-gray-200 hover:border-gray-300"),children:[(0,r.jsx)("div",{className:"mb-2 overflow-hidden rounded-lg",style:{backgroundColor:a&&(0,u.eE)(a)?void 0:"".concat(O(t||e.title),"12")},children:a&&(0,u.eE)(a)?(0,r.jsx)("img",{src:a,alt:e.title,className:"h-20 w-full object-cover",loading:"lazy",onError:e=>{e.currentTarget.style.display="none"}}):(0,r.jsx)("div",{className:"flex h-20 items-center justify-center text-2xl",children:(0,r.jsx)("span",{style:{color:O(t||e.title)},children:e.title.charAt(0).toUpperCase()})})}),(null==x?void 0:x.update)?(0,r.jsx)(d.B,{value:e.title,field:{key:"title",title:"Title",type:"text"},onSave:t=>N(e.id,String(t)),displayClassName:"cursor-pointer truncate rounded px-0.5 hover:bg-gray-100 text-sm font-medium text-gray-900"}):(0,r.jsx)("p",{className:"truncate text-sm font-medium text-gray-900",children:e.title}),(0,r.jsxs)("div",{className:"mt-1 flex items-center gap-1.5",children:[t&&(0,r.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium text-white",style:{backgroundColor:O(t)}
1,children:t}),null!==l&&(0,r.jsxs)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:["\xd7",l]}),s&&(0,r.jsx)("span",{className:"text-[10px] text-gray-400",children:s})]}),(0,r.jsx)(n.f,{href:e.craftLink})]},e.id)})}),!U.length&&(0,r.jsx)("p",{className:"py-8 text-center text-sm text-gray-400",children:A||"all"!==L?"No items match your filters":"No items yet"})]}),q&&(0,r.jsxs)("div",{className:"border-t border-gray-200 bg-white px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(null==x?void 0:x.update)?(0,r.jsx)(d.B,{value:q.title,field:{key:"title",title:"Title",type:"text"},onSave:e=>N(q.id,String(e)),displayClassName:"cursor-pointer rounded px-0.5 hover:bg-gray-100 font-medium text-gray-900"}):(0,r.jsx)("h3",{className:"font-medium text-gray-900",children:q.title}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.f,{href:q.craftLink}),(null==x?void 0:x.delete)&&(0,r.jsx)("button",{onClick:()=>{k(q.id),_(null)},className:"rounded p-1 text-gray-400 hover:bg-red-50 hover:text-red-500",children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),(0,r.jsx)("button",{onClick:()=>_(null),className:"rounded p-1 text-gray-400 hover:bg-gray-100",children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),(0,r.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:z.map(e=>{let t=(0,u.Fl)(q.fields[e.key]);return t?(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[10px] font-medium tracking-wider text-gray-400 uppercase",children:e.title}),(null==x?void 0:x.update)?(0,r.jsx)(d.B,{value:t,field:e,onSave:t=>j(q.id,e.key,t),displayClassName:"cursor-pointer rounded px-0.5 hover:bg-gray-100 text-sm text-gray-700"}):(0,r.jsx)("p",{className:"text-sm text-gray-700",children:t})]},e.key):null})})]})]})})}},36956:(e,t,l)=>{l.d(t,{B:()=>i});var r=l(95155),s=l(12115),a=l(34628),n=l(41813);function i(e){let{value:t,field:l,onSave:i,displayClassName:o="cursor-pointer rounded px-0.5 text-sm text-gray-700 hover:bg-gray-100",emptyText:d="",displayFormat:c}
1=e,[u,x]=(0,s.useState)(!1),[m,h]=(0,s.useState)(String(null!=t?t:"")),[p,y]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{let e=(0,n.CJ)(m,l);if(e)return void y(e);y(null),x(!1);let r="number"===l.type?Number(m):m;if(String(r)!==String(null!=t?t:""))try{await i(r)}catch(e){y("Could not save — try again."),x(!0)}},[m,t,l,i]);return"boolean"===l.type?(0,r.jsx)("input",{type:"checkbox",checked:!!t,onChange:e=>i(e.target.checked),className:"h-4 w-4 cursor-pointer rounded border-gray-300"}):u?"enum"===l.type&&l.enum?(0,r.jsx)("select",{value:m,onChange:e=>{h(e.target.value),x(!1),i(e.target.value)},onBlur:()=>x(!1),autoFocus:!0,className:"w-full rounded border border-blue-300 px-1 py-0.5 text-sm focus:ring-1 focus:ring-blue-400 focus:outline-none",children:l.enum.map(e=>(0,r.jsx)("option",{value:e,children:e},e))}):(0,r.jsxs)("div",{children:[(0,r.jsx)("input",{type:"number"===l.type?"number":"date"===l.type?"date":"text",value:m,onChange:e=>{h(e.target.value),y(null)},onBlur:g,onKeyDown:e=>{"Enter"===e.key&&g(),"Escape"===e.key&&(y(null),x(!1))},autoFocus:!0,className:"w-full rounded border px-1 py-0.5 text-sm focus:ring-1 focus:outline-none ".concat(p?"border-red-400 focus:ring-red-400":"border-blue-300 focus:ring-blue-400")}),p&&(0,r.jsx)("p",{className:"mt-0.5 text-xs text-red-600",children:p})]}):(0,r.jsx)("p",{className:o,onClick:()=>{h(String(null!=t?t:"")),y(null),x(!0)},children:c?(0,a.DC)(t,c):(0,a.Fl)(t)||d})}}}]);

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.