1import{j as t}from"./jsx-runtime-esm-DgZK9P7c.js";import{w as B,a as G,k as K,d as Q,b as E,g}from"./tabs-CHHObJJW.js";import{a as r}from"./index-Dhy1axWM.js";import{aL as Y,ab as H,Q as J,g as W,aM as X,aN as Z,F as ee,o as te}from"./Icon-Ime4wSjK.js";import{p as se,o as re,n as oe,e as ae,a4 as ne,l as le,m as d}from"./app-vP2jhQjT.js";import{R as ie}from"./RecordEmptyState-9etA3du6.js";import{g as ue}from"./project-wd5IloI0.js";import{t as ce}from"./isEqual-BiqEbpPg.js";import{c as de,d as me}from"./useAuthWrapper-CWXjgmIl.js";import"./index-CJZQOLKR.js";import"./_commonjsHelpers-CxYHiaSM.js";import"./index-AmsYr5ik.js";import"./index-B8ov4xfp.js";import"./with-selector-Ce4EAgKw.js";import"./react-redux-Bz8azxLH.js";import"./user-avatar-Zw71S5uB.js";import"./normalizeDates-p6XmbZym.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"967abcd"},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=(function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];if(s!=null)for(var m in s)s.hasOwnProperty(m)&&(o[m]=s[m])}return o})({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:noloco-ui":!0});var x=new e.Error().stack;x&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[x]="7b3ff4c4-454f-44fb-ae4b-21c68ed01b53",e._sentryDebugIdIdentifier="sentry-dbid-7b3ff4c4-454f-44fb-ae4b-21c68ed01b53")}catch{}})();const fe=({children:e,className:x,dataType:o,onChange:l,project:s,recordId:m,stagesField:h,disableEditing:k,value:a})=>{const C=r.useMemo(()=>ue` 2 ${de(Y,o.name,o.fields,{id:!0,uuid:!0,[h.name]:!0})} 3 `,[o.name,o.fields,h.name]),n=r.useMemo(()=>({context:{projectQuery:!0,projectName:s.name}}),[s.name]),[_]=me(C,n),S=r.useMemo(()=>ce(_,500),[_]),L=r.useCallback(()=>{if(k)return null;S({variables:{id:m,[h.name]:a}}),l(a)},[l,m,h.name,S,a,k]);return t.jsx("div",{className:x,"data-testid":"stage-selectable",onClick:L,children:e})},pe=({dataType:e,elementPath:x,editorMode:o,optionsConfig:l,project:s,record:m,recordScope:h,sectionId:k,stages:a,useColors:C,disableEditing:n,theme:_,hasBlockChrome:S})=>{const L=se(),V=re(h),{stages:y}=oe(H,{stages:a},s,x,h),[$,D]=r.useState(void 0),A=ae(y),R=r.useMemo(()=>$||y,[$,y]),T=_.brandColors.primary;r.useEffect(()=>{$!==y&&A===$&&D(y)},[$,A,y]);const[i]=G(),U=r.useMemo(()=>a&&J(a.path.split("."),e,s.dataTypes),[e,s.dataTypes,a]),{field:u}=U??{},b=r.useMemo(()=>W(u,"type")===X,[u]),j=r.useMemo(()=>b&&u?ne(Z(u.options,"order"),{optionsConfig:l},V,s):[],[b,l,s,V,u]),O=r.useMemo(()=>!b||!R?-1:j.findIndex(c=>c.name===R),[R,b,j]),F=le(ee),q=r.useMemo(()=>!b||a.path.split(".").length>1||u.readOnly?!1:te({dataType:e,field:u,permissionsEnabled:F,user:L}).update,[e,F,b,a,u,L]);return b?t.jsx("div",{className:`flex w-full max-w-full items-center justify-between overflow-y-auto rounded-lg ${S?"":"border"} ${i?`${d.surfaces.elevation1} ${d.borders.two}`:S?"bg-white":"border-stone-300 bg-white"}`,"data-testid":"stages-section",children:j.map((c,v)=>{const w=v<O,I=v===O,f=v>O,P=j.length>4&&v<O-1,z=q&&!I?fe:"div",N=C&&c.color,p=N||T,M=N?300:500;return t.jsxs(z,{className:E("group relative flex items-center whitespace-nowrap py-3 pl-6 pr-10 text-sm",{"cursor-pointer":!n&&(w||f),"text-stone-800":w&&!i,[d.text.secondary]:w&&i,[`text-${g(p,500)}`]:I,"border-stone-500 text-stone-500":f&&!i,[`${d.text.secondary} ${d.borders.two}`]:f&&i,"w-full":!P},`stage-option-${c.name}-${k}`),dataType:e,disableEditing:n,onChange:D,project:s,recordId:m.id,stagesField:u,value:c.name,children:[t.jsx(K,{content:t.jsx("span",{className:`${i?d.text.primary:""}`,children:c.display}),disabled:!P,children:t.jsx("div",{className:E("flex h-7 w-7 shrink-0 items-center justify-center rounded-full border-2 text-xs",`${i?d.text.primary:""}`,{[`border-${g(p,M)}`]:w||I,[`${i?d.surfaces.elevation2:"bg-white"} group-hover:bg-${g(p,M+100)}`]:!n&&w,[`bg-${g(p,M)}`]:I,"group-hover:bg-stone-500":f&&!N,[`group-hover:border-${g(p,M-200)} group-hover:bg-${g(p,M-100)}`]:!n&&f&&N}),"data-testid":"stage-option",children:w?t.jsx(Q,{className:E(`text-${g(p,M)}`,{"group-hover:text-white":!n}),size:16}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:E({"group-hover:hidden":!n&&f,"text-white":I}),children:v+1}),t.jsx(Q,{className:E("hidden text-white",{"group-hover:block":!n&&f,[`group-hover:text-${g(p,700)}`]:!n&&f&&N}),size:16})]})})}),!P&&t.jsx("span",{className:"ml-3","data-testid":"stage-label",children:c.display}),v<j.length-1&&t.jsx("div",{"aria-hidden":"true",className:"absolute right-0 top-0 h-full w-5",children:t.jsx("svg",{className:`h-full w-full ${i?d.text.tertiary:"text-stone-300"}`,fill:"none",preserveAspectRatio:"none",viewBox:"0 0 22 80",children:t.jsx("path",{d:"M0 -2L20 40L0 82",stroke:"currentcolor",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})})})]},c.name)})}):o?t.jsx(ie,{}):null},Oe=B(pe);export{Oe 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.