1import{j as t}from"./jsx-runtime-esm-DgZK9P7c.js";import{w as fe,u as ge,a as xe,I as he,b as T,g as j,L as be,d as ye}from"./tabs-CHHObJJW.js";import{a}from"./index-Dhy1axWM.js";import{g as D,O as L,c as y,A as Ee,C as ve,P as we,D as te,u as Ne,d as R,L as U,e as Ae,h as Ce,T as Fe,H as Ie,i as Te,j as je,I as De,R as Re,k as _e}from"./Icon-Ime4wSjK.js";import{u as ke,a as Me,b as Se,D as Pe,c as Oe,d as Le,e as ae,f as Ue,K as Be,S as He,T as Ke}from"./app-vP2jhQjT.js";import{P as $e,a as ze,b as Ge}from"./user-avatar-Zw71S5uB.js";import{u as Ye}from"./react-redux-Bz8azxLH.js";import"./index-CJZQOLKR.js";import"./_commonjsHelpers-CxYHiaSM.js";import"./index-AmsYr5ik.js";import"./index-B8ov4xfp.js";import"./project-wd5IloI0.js";import"./with-selector-Ce4EAgKw.js";import"./isEqual-BiqEbpPg.js";import"./useAuthWrapper-CWXjgmIl.js";import"./normalizeDates-p6XmbZym.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};o.SENTRY_RELEASE={id:"967abcd"},o._sentryModuleMetadata=o._sentryModuleMetadata||{},o._sentryModuleMetadata[new o.Error().stack]=(function(c){for(var e=1;e<arguments.length;e++){var u=arguments[e];if(u!=null)for(var p in u)u.hasOwnProperty(p)&&(c[p]=u[p])}return c})({},o._sentryModuleMetadata[new o.Error().stack],{"_sentryBundlerPluginAppKey:noloco-ui":!0});var g=new o.Error().stack;g&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[g]="89b805d2-6748-4dcc-81cd-135dc9954c9c",o._sentryDebugIdIdentifier="sentry-dbid-89b805d2-6748-4dcc-81cd-135dc9954c9c")}catch{}})();const ne=a.memo(({className:o,dataType:g,elementId:c,field:e,onClick:u,onLoadingChange:p,layout:oe,project:_,scope:x,surface:h=U,ReadOnlyCell:re,theme:ie,bulkActionsEnabled:B,isRowSelected:H,value:K})=>{const le=a.useRef(),E=a.useRef(!1),k=a.useRef(0),$=a.useRef(null),z=Ye(),{sm:v}=ge(),[d]=xe(),n=ke(Ke)&&oe===_e,[l,w]=a.useState(!1),{selectedRowsCount:G}=Me(),{updateAllRecords:M,setUpdateAllRecords:f}=Se(),m=e&&Pe.includes(e.type),{isLoading:i,formFields:Y,hasChangedMap:q,onSubmit:V,renderFormField:W,setChangedFields:J}=Oe(),N=a.useCallback(s=>{s.stopPropagation(),s.preventDefault(),E.current=!0,z(Le({dataTypeName:g.name,id:D(x,[c,"edges","node","id"]),fieldNames:[e.name],updateTime:Date.now()})),J(r=>({...r,[e.id]:!1})),f(!1),w(!1)},[g.name,z,c,e.id,e.name,x,J,f]),ce=a.useCallback(s=>{s.stopPropagation(),s.preventDefault(),u&&u(),m&&(E.current=!1,k.current+=1,w(!0))},[u,m]),S=ae(i);a.useEffect(()=>{p&&S!==void 0&&S!==i&&p(i)},[p,i,S]);const A=a.useMemo(()=>{const s=Y.find(r=>r.field.name===e.name);
1return s&&l?{field:s.field,config:{...s.config,autoFocus:!v}}:s},[e,Y,l,v]),P=a.useMemo(()=>B&&H&&G>1,[B,H,G]),C=a.useMemo(()=>Object.values(q).filter(Boolean).length===0,[q]),F=a.useCallback(s=>{E.current=!0;const r=k.current;return V(s).then(()=>{f(!1),k.current===r&&w(!1)})},[V,f]),X=ae(l);a.useEffect(()=>{n&&X&&!l&&!E.current&&!C&&F(void 0)},[C,l,X,n,F]),a.useEffect(()=>{if(!n||!l||v)return;const s=requestAnimationFrame(()=>{const r=$.current?.querySelector('textarea, input[type="text"], input:not([type])');if(r instanceof HTMLTextAreaElement||r instanceof HTMLInputElement){const se=r.value.length;r.focus(),r.setSelectionRange(se,se)}});return()=>cancelAnimationFrame(s)},[n,l,v]);const de=a.useCallback(()=>f(!M),[f,M]);Ue(Be,de,{ctrlKey:!0,enabled:m?l&&P:P}),A||console.error(`Config for field ${e.name} not found - have you setup an AutoFormProvider ?`);const b=ie.brandColors.primary,O=e.type===L&&y(e)===Ee,ue=e.type===L&&y(e)===ve,me=e.type===L&&y(e)===we,Q=y(e),Z=e.type===te&&Ne(e),ee=a.useMemo(()=>A&&e&&t.jsxs("form",{className:"flex max-h-full w-full max-w-full items-start overflow-x-hidden p-px",onSubmit:F,children:[t.jsx("div",{className:R("w-full",{"rounded-md p-2 [&_input]:p-0 [&_div:has(>input)]:h-auto [&_textarea]:resize-none [&_textarea]:p-0 [&_textarea]:max-h-60 [&_textarea]:[field-sizing:content]":n,"rounded-lg p-1":!n,"bg-stone-100":!n&&m&&!d&&h===U,"bg-stone-800":!n&&m&&d&&h===U,"bg-transparent":h===Ae}),children:W(A)}),m&&!n&&t.jsxs("div",{className:"ml-3 mt-1 flex items-center space-x-1",children:[t.jsx("button",{className:T("rounded-full p-1 text-stone-400",`hover:text-${j(b,500)}`),disabled:i,onClick:N,type:"button",children:t.jsx(he,{size:16})}),t.jsx("button",{className:T("rounded-full p-1",i?`text-${j(b,500)}`:"text-white",{[`bg-${j(b,500)}`]:!i,[`hover:bg-${j(b,600)}`]:!i}),disabled:i,onClick:C?N:void 0,type:"submit",children:i?t.jsx(be,{size:"xs"}):t.jsx(ye,{size:16})})]})]}),[A,C,e,i,N,F,b,W,m,d,n,h]),pe=a.useMemo(()=>D(x,[c,"edges","node",e.name]),[c,e.name,x]),I=K!==void 0?K:pe;return m?t.jsxs("div",{className:R(o,"flex shrink-0 overflow-x-hidden",{"justify-end":!e.multiple&&[je,De,te].includes(D(e,"type"))&&y(e)!==Re,"opacity-50":l}),onClick:ce,ref:le,children:[t.jsxs($e,{modal:!0,onOpenChange:w,open:l,children:[t.jsx(ze,{asChild:!0,children:t.jsx("div",{className:"h-full"})}),t.jsx(Ge,{align:"start",className:R("sm:max-w-screen",{"rounded-md border border-black/[0.08] shadow-lg dark:border-white/[0.1]":n,"rounded-lg border-2":!n,"border-stone-100":!n&&!d,"border-stone-600":!n&&d,"w-80":O,"w-84":ue,"!w-88 !p-1":me,"w-72 !p-1":Z&&Q===Ie,"!w-auto !p-1":Z&&Q===Fe}),onClick:s=>s.stopPropagation(),onEscapeKeyDown:N,onInteractOutside:s=>{s.detail.originalEvent.target?.closest("[data-radix-popper-content-wrapper]")&&s.preventDefault()},side:"right",sideOffset:-16,sticky:"always",children:t.jsxs("div",{className:R("flex flex-col text-sm",{"min-w-64 max-w-sm":!O,"w-full":O}),onClick:s=>s.stopPropagation(),ref:$,children:[t.jsx("div",{className:"flex items-center",children:ee}),P&&t.jsxs(t.Fragment,{children:[t.jsx("hr",{className:T({"my-3":!n,"my-0":n,"bg-stone-500":!d,"bg-stone-800":d})}),t.jsxs("div",{className:"mr-auto flex w-full items-center p-1.5",children:[t.jsx("label",{className:T("mr-4",{"text-stone-200":d,"text-stone-700":!d,"text-xs":n}),children:Ce("elements.VIEW.display.bulkActions.updateAll")}),t.jsx(He,{className:"ml-auto",onChange:s=>f(s),size:"sm",value:M})]})]})]})})]}),!Te(I)&&(!e.multiple||Array.isArray(I)&&I.length!==0)?t.jsx(re,{dataTypes:_.dataTypes,field:e,id:`input-${e.name}-${D(x,[c,"edges","node","id"])}`,project:_,projectName:_.name,surface:h,value:I}):t.jsx("div",{className:"opacity-75",children:"--"})]}):ee});ne.displayName="InlineAutoForm";const ds=fe(ne);export{ds 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.