@objectstack/console 13.0.0 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-G7o889LL.js → AdapterProvider-BdI1AL8R.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-B_bQ89Ap.js → AiPendingActionsPage-C9rOGWO9.js} +1 -1
- package/dist/assets/{ApiConsolePage-oJexbnMd.js → ApiConsolePage-CTk6_qVK.js} +1 -1
- package/dist/assets/{AppDocsIndex-B2EMS--S.js → AppDocsIndex-BL_J__HY.js} +1 -1
- package/dist/assets/{AppManagementPage-BSLRnX7p.js → AppManagementPage-Co5xg-gQ.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-DkfJVIDO.js +1 -0
- package/dist/assets/{AuditLogPage-JHBVKm-o.js → AuditLogPage-Ctj0habt.js} +1 -1
- package/dist/assets/{ComponentNavView-Be3JMpLK.js → ComponentNavView-2bXBqHvo.js} +1 -1
- package/dist/assets/{ConsoleFloatingChatbot-MtFbTLoq.js → ConsoleFloatingChatbot-C_zzIjTL.js} +1 -1
- package/dist/assets/{CreateViewDialog-CboUdp-q.js → CreateViewDialog-BQ1-ZWYN.js} +1 -1
- package/dist/assets/{DashboardView-1nXwC0y_.js → DashboardView-Cns3m8MX.js} +1 -1
- package/dist/assets/{DeveloperHubPage-B55QdK7b.js → DeveloperHubPage-xHzPIDex.js} +1 -1
- package/dist/assets/{ExpressionProvider-B3pkCzAo.js → ExpressionProvider-BdMK_o7f.js} +1 -1
- package/dist/assets/{FlowRunsPage-CKOKC3O1.js → FlowRunsPage-v43ayfID.js} +1 -1
- package/dist/assets/{IntegrationsPage-gLs4Ms2t.js → IntegrationsPage-B8IBLh_r.js} +2 -2
- package/dist/assets/{InterfaceListPage-CwGb2Th3.js → InterfaceListPage-DAkJEFCf.js} +1 -1
- package/dist/assets/{ManagedByBadge-BtJfBjbT.js → ManagedByBadge-C8RoPUEX.js} +1 -1
- package/dist/assets/{MarketplaceAccessDenied-Bl4faFLm.js → MarketplaceAccessDenied-D3JunScQ.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-BQH-qEi5.js → MarketplaceInstalledPage-IjVxon4M.js} +1 -1
- package/dist/assets/MarketplacePackagePage-BivOR4dD.js +4 -0
- package/dist/assets/{MarketplacePage-C_HnQQYH.js → MarketplacePage-aoYsZs4L.js} +1 -1
- package/dist/assets/{MetadataInspector-DwPx9ueN.js → MetadataInspector-BD4Mhmpt.js} +1 -1
- package/dist/assets/{MetadataProvider-seOmvY8N.js → MetadataProvider-C9mhBo6s.js} +1 -1
- package/dist/assets/ObjectDataPage-C1AX0mJW.js +1 -0
- package/dist/assets/{PageView-cehnKJ9R.js → PageView-CAAHjJzX.js} +1 -1
- package/dist/assets/{ProfilePage-CPk5ilAm.js → ProfilePage-tQyqenRR.js} +1 -1
- package/dist/assets/PublicFormsPage-CkKQzpw_.js +1 -0
- package/dist/assets/RecordDetailView-DcyCqWcp.js +9 -0
- package/dist/assets/{RecordFormPage-Dmw4MMhg.js → RecordFormPage-DPml60ze.js} +1 -1
- package/dist/assets/ReportDefaultInspector-De2iFQ0s.js +11 -0
- package/dist/assets/ReportView-BF5_XOtk.js +2 -0
- package/dist/assets/{SearchResultsPage-quEMr1ZW.js → SearchResultsPage-CiSIs_M4.js} +1 -1
- package/dist/assets/{SettingsHub-B5Y0DjDk.js → SettingsHub-PlVT_0zU.js} +1 -1
- package/dist/assets/{SettingsView-Q3e7GG0S.js → SettingsView-PA2_5adN.js} +1 -1
- package/dist/assets/SystemHubPage-DN6WDMNI.js +1 -0
- package/dist/assets/{conversationLanguage-CgUPnufx.js → conversationLanguage-b5go1PfT.js} +1 -1
- package/dist/assets/{data-adapter-BP-pyfs8.js → data-adapter-CbYJeapt.js} +1 -1
- package/dist/assets/{framework-CBCX6Urh.js → framework-Itfj9AWQ.js} +13 -13
- package/dist/assets/{getIcon-Ci4w4xXM.js → getIcon-DjDksPei.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-B5Pqh6xJ.js → highlighted-body-OFNGDK62-DyDg64aM.js} +1 -1
- package/dist/assets/index-C31fE0Ro.js +2 -0
- package/dist/assets/index-N4ZfDXur.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-Bdn3wVYM.js +1 -0
- package/dist/assets/metadata-admin-Chw3a2T4.js +23 -0
- package/dist/assets/plugin-calendar-C7XgGNhj.js +1 -0
- package/dist/assets/{plugin-charts-DyKYgW3L.js → plugin-charts-DZcrIrvB.js} +2 -2
- package/dist/assets/plugin-chatbot-D0Od_WLT.js +120 -0
- package/dist/assets/plugin-dashboard-CGXhP3SP.js +6 -0
- package/dist/assets/plugin-form-BxGl_G-P.js +1 -0
- package/dist/assets/plugin-gantt-DIXK_GFE.js +93 -0
- package/dist/assets/plugin-grid-BusTOlSB.js +8 -0
- package/dist/assets/plugin-kanban-BORORRbu.js +1 -0
- package/dist/assets/{plugin-map-Co_pYpOZ.js → plugin-map-DhKLo0DD.js} +1 -1
- package/dist/assets/{plugin-markdown-CS5R-t3i.js → plugin-markdown-ByE3Dezt.js} +1 -1
- package/dist/assets/{plugin-report-_y8nt0FZ.js → plugin-report-CJmiocGk.js} +4 -4
- package/dist/assets/plugin-timeline-B5L8EK0C.js +1 -0
- package/dist/assets/{plugin-tree-DCAEE54g.js → plugin-tree-D7mdTkuW.js} +1 -1
- package/dist/assets/plugin-view-CMNOvn0A.js +1 -0
- package/dist/assets/plugins-views-BmubW-ty.js +4 -0
- package/dist/assets/{skeletons-BjaBYe9k.js → skeletons-Ch9F6pA8.js} +1 -1
- package/dist/assets/src-DrSomF2I.js +16 -0
- package/dist/assets/{src-D6ENIa3w.js → src-w44Q32YY.js} +1 -1
- package/dist/assets/{types-DXCQOIiO.js → types-GmZjwWOe.js} +1 -1
- package/dist/assets/ui-components-DTwfkSDm.js +42 -0
- package/dist/assets/{ui-layout-vWAZODrs.js → ui-layout-BHkbFI8f.js} +1 -1
- package/dist/assets/{useMetadata-D-bLZoNN.js → useMetadata-DSuQLgo1.js} +1 -1
- package/dist/assets/{useRecordApprovals-jo_LH43z.js → useRecordApprovals-Bo4WTft1.js} +1 -1
- package/dist/assets/vendor-objectstack-BlgvvNrN.js +108 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ApprovalsInboxPage-DbdgZkz_.js +0 -1
- package/dist/assets/MarketplacePackagePage-B2BXohna.js +0 -4
- package/dist/assets/ObjectDataPage-D8W0OzJe.js +0 -1
- package/dist/assets/PublicFormsPage-5oWNwPiZ.js +0 -1
- package/dist/assets/RecordDetailView-CUcCVoa1.js +0 -9
- package/dist/assets/ReportDefaultInspector-BBTLmEl-.js +0 -11
- package/dist/assets/ReportView-BPkQVP9-.js +0 -2
- package/dist/assets/SystemHubPage-SIzLdDrE.js +0 -1
- package/dist/assets/index-Df624lGg.js +0 -2
- package/dist/assets/index-GDbpsyLD.css +0 -2
- package/dist/assets/mermaid-GHXKKRXX-BlWXnAVk.js +0 -1
- package/dist/assets/metadata-admin-Jkl-QChK.js +0 -23
- package/dist/assets/plugin-calendar-BHRBKeJq.js +0 -1
- package/dist/assets/plugin-chatbot-CNLp4fGv.js +0 -120
- package/dist/assets/plugin-dashboard-uOZwquef.js +0 -6
- package/dist/assets/plugin-form-CX8z6nsj.js +0 -1
- package/dist/assets/plugin-gantt-CyktuI6d.js +0 -93
- package/dist/assets/plugin-grid-DNGRZzGM.js +0 -8
- package/dist/assets/plugin-kanban-B0Dwrpca.js +0 -1
- package/dist/assets/plugin-timeline-Cy03-xov.js +0 -1
- package/dist/assets/plugin-view-OZpEPOgT.js +0 -1
- package/dist/assets/plugins-views-BVxwkRdi.js +0 -4
- package/dist/assets/src-rXeXV_HX.js +0 -16
- package/dist/assets/ui-components-BOOpjWsQ.js +0 -42
- package/dist/assets/vendor-objectstack-Jcqd9154.js +0 -108
package/dist/index.html
CHANGED
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
<script>
|
|
19
19
|
window.process = window.process || { env: { NODE_ENV: 'development' }, version: '', platform: 'browser' };
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="./assets/index-
|
|
21
|
+
<script type="module" crossorigin src="./assets/index-C31fE0Ro.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="./assets/ui-components-BL3SEdAz.css">
|
|
23
23
|
<link rel="stylesheet" crossorigin href="./assets/plugin-dashboard-DnNKJB60.css">
|
|
24
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
25
|
-
<link rel="modulepreload" href="./assets/framework-
|
|
26
|
-
<link rel="modulepreload" href="./assets/ui-components-
|
|
24
|
+
<link rel="stylesheet" crossorigin href="./assets/index-N4ZfDXur.css">
|
|
25
|
+
<link rel="modulepreload" href="./assets/framework-Itfj9AWQ.js" />
|
|
26
|
+
<link rel="modulepreload" href="./assets/ui-components-DTwfkSDm.js" />
|
|
27
27
|
<link rel="modulepreload" href="./assets/vendor-radix-DCTEpigg.js" />
|
|
28
28
|
<link rel="modulepreload" href="./assets/vendor-react-BGDDiZfJ.js" />
|
|
29
29
|
</head>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/console",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "Prebuilt Console SPA pinned to this @objectstack/framework release. Source of truth: @object-ui/console (https://github.com/objectstack-ai/objectui).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/objectstack-ai/framework/tree/main/packages/console",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{a as t,m as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{d as a,f as ee}from"./infrastructure-ASGyCRMg.js";import{l as te}from"./framework-CBCX6Urh.js";import{$n as ne,Bs as re,Bt as ie,Di as ae,Es as oe,G as se,Gt as ce,Hr as le,Ht as ue,J as de,Jo as fe,Jt as o,Kt as pe,Lr as me,Oi as he,Or as ge,Ps as _e,Qn as ve,Rt as s,Sc as ye,Ss as be,Us as xe,Ut as Se,Vi as Ce,Vs as we,Vt as Te,W as Ee,Wt as De,Xt as Oe,Yt as ke,_r as c,_t as Ae,ar as je,as as Me,br as Ne,cs as Pe,ct as Fe,dn as Ie,dt as Le,er as Re,fr as l,ft as ze,gr as u,gs as Be,gt as Ve,hr as d,ht as f,js as He,kc as p,lr as Ue,lt as We,mr as m,mt as h,pc as Ge,pi as Ke,pr as g,pt as qe,qt as Je,sn as Ye,st as Xe,ur as Ze,ut as Qe,vr as _,xr as v,yr as y}from"./ui-components-BOOpjWsQ.js";import{r as b}from"./vendor-ui-utils-BzQBRdq3.js";var x=e(i(),1),$e=`${``.replace(/\/$/,``)}/api/v1`;async function S(e,t){let n=await fetch(`${$e}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...t?.headers||{}},...t}),r=null;try{r=await n.json()}catch{}if(!n.ok){let e=r?.code??`HTTP_${n.status}`,t=r?.message??r?.error??n.statusText,i=Error(`${e}: ${t}`);throw i.code=e,i.status=n.status,i.details=r,i}return r}var C={listProcesses(e={}){let t=new URLSearchParams;e.object&&t.set(`object`,e.object),e.activeOnly&&t.set(`activeOnly`,`true`);let n=t.toString();return S(`/approvals/processes${n?`?${n}`:``}`)},listRequests(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.object&&t.set(`object`,e.object),e.recordId&&t.set(`recordId`,e.recordId);let n=Array.isArray(e.approverId)?e.approverId.filter(Boolean).join(`,`):e.approverId;n&&t.set(`approverId`,n),e.submitterId&&t.set(`submitterId`,e.submitterId),e.q?.trim()&&t.set(`q`,e.q.trim()),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let r=t.toString();return S(`/approvals/requests${r?`?${r}`:``}`)},async getRequest(e){return{data:await S(`/approvals/requests/${encodeURIComponent(e)}`)}},listActions(e){return S(`/approvals/requests/${encodeURIComponent(e)}/actions`)},async approve(e,t){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async reject(e,t){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async recall(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/recall`,{method:`POST`,body:JSON.stringify(t)})).request,finalized:!0}},async reassign(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/reassign`,{method:`POST`,body:JSON.stringify(t)})).request}},async remind(e,t={}){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/remind`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,notified:n.notified}},async requestInfo(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/request-info`,{method:`POST`,body:JSON.stringify(t)})).request}},async sendBack(e,t){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/revise`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,autoRejected:n.autoRejected===!0}},async resubmit(e,t={}){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/resubmit`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,resumed:n.resumed===!0}},async comment(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/comment`,{method:`POST`,body:JSON.stringify(t)})).request}},async submit(e){return S(`/approvals/requests`,{method:`POST`,body:JSON.stringify(e)})}};function et(e){if(!e)return[];let t=new Set;e.id&&t.add(e.id),e.email&&t.add(e.email);let n=[...e.roles||[],...typeof e.role==`string`?e.role.split(`,`):[]];for(let e of n){let n=String(e).trim();n&&t.add(`role:${n}`)}return Array.from(t)}var w=r(),tt=50,nt={pending:`border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-400`,approved:`border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400`,rejected:`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`,recalled:`border-border bg-muted text-muted-foreground`,returned:`border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-400`};function rt(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function T(e){return e?e.includes(`@`)?e:e.startsWith(`role:`)?`Role: ${e.slice(5)}`:e.length>14?`${e.slice(0,6)}…${e.slice(-4)}`:e:`—`}function E(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function it(e){return e.process_label||E(e.process_name)}function at(e){return e.step_label?e.step_label:e.current_step?E(e.current_step):null}function ot(e){return e.submitter_name||T(e.submitter_id)}function st(e,t){return t.pending_approver_names?.[e]||T(e)}function ct(e){return e.object_label||e.object_name}function D(e){return e.submitted_at||e.created_at||void 0}function O(e){let t=D(e);if(!t)return null;let n=Date.parse(t);return Number.isNaN(n)?null:(Date.now()-n)/36e5}function lt(e){if(e.status!==`pending`)return`text-muted-foreground`;let t=O(e);return t==null?`text-muted-foreground`:t>72?`text-red-600 dark:text-red-400 font-medium`:t>24?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function ut(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}var k=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function A(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function j(e,t){if(typeof t==`boolean`)return t?`✓`:`—`;if(typeof t==`number`){if(t>0xe8d4a51000&&/(_at$|_date$|^date_|_time$)/.test(e))try{return new Date(t).toLocaleDateString()}catch{}return t.toLocaleString()}let n=String(t);if(/^\d{4}-\d{2}-\d{2}T\d{2}/.test(n))try{return new Date(n).toLocaleString()}catch{}return n}var dt=/^[A-Za-z0-9_-]{15,}$/;function ft(e,t,n=6){if(!e||typeof e!=`object`||Array.isArray(e))return[];let r=[];for(let[i,a]of Object.entries(e)){if(k.has(i)||a==null||typeof a==`object`||String(a).trim()===``)continue;let e=t?.[i];if(!(!e&&typeof a==`string`&&dt.test(a.trim())&&!/^\d+$/.test(a.trim()))&&(r.push([A(i),e??j(i,a)]),r.length>=n))break}return r}function pt(){let{t:e,language:r}=te(),{user:i}=ee(),$e=a(),{appName:S}=n(),E=(0,x.useMemo)(()=>et(i),[i]),O=(0,x.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),k=(0,x.useCallback)(e=>{if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Math.round((Date.now()-t)/1e3);if(n<45)return O(`justNow`,`just now`);let i=Math.round(n/60);if(i<60)return O(`minutesAgo`,`{{count}}m ago`,{count:i});let a=Math.round(i/60);if(a<24)return O(`hoursAgo`,`{{count}}h ago`,{count:a});let ee=Math.round(a/24);if(ee<30)return O(`daysAgo`,`{{count}}d ago`,{count:ee});try{return new Date(e).toLocaleDateString(r)}catch{return e}},[O,r]),A=(0,x.useCallback)(e=>{switch(e){case`pending`:return O(`statusPending`,`Pending`);case`approved`:return O(`statusApproved`,`Approved`);case`rejected`:return O(`statusRejected`,`Rejected`);case`recalled`:return O(`statusRecalled`,`Recalled`);case`returned`:return O(`statusReturned`,`Returned for revision`);default:return e}},[O]),j=(0,x.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?O(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?O(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?O(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?O(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?O(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[O]);function dt({status:e}){return(0,w.jsx)(je,{variant:`outline`,className:p(`font-medium`,nt[e]??``),children:A(e)})}let pt=(0,x.useCallback)(e=>`/apps/${S||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[S]),[M,mt]=(0,x.useState)(`pending`),[N,ht]=(0,x.useState)([]),[gt,_t]=(0,x.useState)(!1),[vt,yt]=(0,x.useState)(!1),[bt,xt]=(0,x.useState)(null),[St,Ct]=(0,x.useState)(null),[wt,Tt]=(0,x.useState)(0),[P,Et]=(0,x.useState)(null),[F,Dt]=(0,x.useState)(null),[Ot,kt]=(0,x.useState)([]),[At,jt]=(0,x.useState)(!1),[I,L]=(0,x.useState)(``),[R,Mt]=(0,x.useState)(``),[z,Nt]=(0,x.useState)(null),[B,Pt]=(0,x.useState)(``),[Ft,It]=(0,x.useState)(``),[Lt,Rt]=(0,x.useState)(`all`),[zt,Bt]=(0,x.useState)(`all`),[V,Vt]=(0,x.useState)(`all`),[H,Ht]=(0,x.useState)(new Set),[Ut,Wt]=(0,x.useState)(!1),[U,Gt]=(0,x.useState)(null),[Kt,qt]=(0,x.useState)(null),[Jt,Yt]=(0,x.useState)(!1),[Xt,Zt]=(0,x.useState)(``),[Qt,$t]=(0,x.useState)(!1),[en,tn]=(0,x.useState)(``),[nn,rn]=(0,x.useState)(!1),[an,on]=(0,x.useState)(``),[sn,cn]=(0,x.useState)(!1),[ln,un]=(0,x.useState)(``),[W,G]=(0,x.useState)(!1),[dn,fn]=(0,x.useState)([]),[pn,mn]=(0,x.useState)(-1);(0,x.useEffect)(()=>{if(M===`pending`)return;let e=window.setTimeout(()=>It(B),350);return()=>window.clearTimeout(e)},[B,M]);let K=(0,x.useCallback)(async()=>{_t(!0),Ct(null);try{let e=[];if(M===`pending`)e=E.length?(await C.listRequests({status:`pending`,approverId:E})).data:[],Tt(e.length),xt(null);else{let t={q:Ft||void 0,status:V===`all`?void 0:V,limit:tt,offset:0};if(M===`submitted`){let n=i?.id;if(n){let r=await C.listRequests({submitterId:n,...t});e=r.data,xt(r.total??r.data.length)}else e=[],xt(0)}else{let n=await C.listRequests(t);e=n.data,xt(n.total??n.data.length)}E.length&&C.listRequests({status:`pending`,approverId:E}).then(e=>Tt(e.data.length)).catch(()=>{})}e.sort((e,t)=>(D(t)||``).localeCompare(D(e)||``)),ht(e)}catch(e){Ct(e?.message||String(e)),ht([])}finally{_t(!1)}},[M,E,i?.id,Ft,V]);(0,x.useEffect)(()=>{K()},[K]);let hn=(0,x.useCallback)(async()=>{if(!(M===`pending`||vt)){yt(!0);try{let e=await C.listRequests({submitterId:M===`submitted`?i?.id??void 0:void 0,q:Ft||void 0,status:V===`all`?void 0:V,limit:tt,offset:N.length});ht(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&xt(e.total)}catch(e){b.error(j(e,O(`loadFailed`,`Failed to load request`)))}finally{yt(!1)}}},[M,vt,i?.id,Ft,V,N.length,j,O]),q=(0,x.useCallback)(async e=>{Et(e),jt(!0),L(``),Mt(``);try{let[t,n]=await Promise.all([C.getRequest(e),C.listActions(e)]);Dt(t.data),kt(n.data)}catch(e){b.error(j(e,O(`loadFailed`,`Failed to load request`))),Dt(null),kt([])}finally{jt(!1)}},[j,O]),gn=()=>{Et(null),Dt(null),kt([]),L(``),Mt(``)},J=(0,x.useCallback)(e=>{if(R.trim())return R.trim();if(!e)return i?.id||``;let t=new Set(e.pending_approvers||[]);for(let e of E)if(t.has(e))return e;return i?.id||``},[R,E,i?.id]),Y=(0,x.useCallback)(()=>{E.length&&C.listRequests({status:`pending`,approverId:E}).then(e=>Tt(e.data.length)).catch(()=>{})},[E]),_n=(0,x.useCallback)(async e=>{if(!F)return;let t=e===`recall`&&i?.id||J(F);if(!t){b.error(O(`noActor`,`Cannot determine the acting identity`));return}Nt(e);try{let n={actor_id:t,comment:I.trim()||void 0},r=await(e===`approve`?C.approve:e===`reject`?C.reject:C.recall)(F.id,n);if(b.success(e===`approve`?r.finalized?O(`approvedFinal`,`Approved`):O(`approvedWaiting`,`Approved — waiting on the remaining approvers`):e===`reject`?O(`rejectedToast`,`Rejected`):O(`recalledToast`,`Request recalled`)),L(``),e!==`recall`&&M===`pending`){let e=Rn.current,t=e.findIndex(e=>e.id===F.id),n=e[t+1]??e[t-1];K(),n&&n.id!==F.id?q(n.id):gn();return}let[i,a]=await Promise.all([C.getRequest(F.id),C.listActions(F.id)]);Dt(i.data),kt(a.data),K()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{Nt(null)}},[F,J,I,K,i?.id,j,O,M,q]),X=(0,x.useCallback)(async e=>{let[t,n]=await Promise.all([C.getRequest(e),C.listActions(e)]);Dt(t.data),kt(n.data),K()},[K]),vn=(0,x.useCallback)(async()=>{if(!(!F||!Xt.trim())){G(!0);try{await C.reassign(F.id,{actor_id:J(F),to:Xt.trim(),comment:I.trim()||void 0}),b.success(O(`reassignSuccess`,`Handed to {{to}}`,{to:Xt.trim()})),Yt(!1),Zt(``),L(``),await X(F.id),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,Xt,I,J,X,Y,j,O]),yn=(0,x.useCallback)(async()=>{if(F){G(!0);try{let e=await C.remind(F.id,{actor_id:i?.id});b.success(O(`remindSuccess`,`Reminder sent to {{count}} approver(s)`,{count:e.notified})),await X(F.id)}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,i?.id,X,j,O]),bn=(0,x.useCallback)(async()=>{if(!(!F||!en.trim())){G(!0);try{await C.requestInfo(F.id,{actor_id:J(F),comment:en.trim()}),b.success(O(`requestInfoSent`,`Sent back to the requester for more information`)),$t(!1),tn(``),await X(F.id)}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,en,J,X,j,O]),xn=(0,x.useCallback)(async()=>{if(F){G(!0);try{let e=await C.sendBack(F.id,{actor_id:J(F),comment:an.trim()||void 0});b.success(e.autoRejected?O(`sendBackAutoRejected`,`Revision limit reached — the request was auto-rejected`):O(`sendBackSuccess`,`Sent back for revision — the requester can now edit and resubmit`)),rn(!1),on(``),await X(F.id),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,an,J,X,Y,j,O]),Sn=(0,x.useCallback)(async()=>{if(F){cn(!0);try{await C.resubmit(F.id,{actor_id:i?.id,comment:I.trim()||void 0}),b.success(O(`resubmitSuccess`,`Resubmitted — a new approval round has opened`)),L(``),await X(F.id),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{cn(!1)}}},[F,I,i?.id,X,Y,j,O]),Cn=(0,x.useCallback)(async()=>{if(!(!F||!ln.trim())){G(!0);try{await C.comment(F.id,{actor_id:i?.id,comment:ln.trim()}),un(``),await X(F.id)}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,ln,i?.id,X,j,O]),wn=(0,x.useCallback)(async()=>{if(!dn.length)try{let e=``.replace(/\/$/,``),t=await(await fetch(`${e}/api/v1/data/sys_user?limit=100`,{credentials:`include`})).json();fn((t.records||[]).filter(e=>e.email&&e.name&&e.id!==i?.id).map(e=>({name:String(e.name),email:String(e.email)})))}catch{}},[dn.length,i?.id]),Tn=(0,x.useMemo)(()=>{if(!F||F.status!==`pending`)return!1;let e=new Set(F.pending_approvers||[]);return E.some(t=>e.has(t))||R.trim().length>0},[F,E,R]),En=(0,x.useMemo)(()=>!F||F.status!==`pending`?!1:F.submitter_id===i?.id||R.trim().length>0,[F,i?.id,R]),Dn=(0,x.useMemo)(()=>!F||F.status!==`returned`?!1:F.submitter_id===i?.id||R.trim().length>0,[F,i?.id,R]),On=(0,x.useMemo)(()=>{let e=new Set;for(let t of N)e.add(it(t));return Array.from(e).sort()},[N]),kn=(0,x.useMemo)(()=>{let e=new Set;for(let t of N)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[N]),Z=(0,x.useMemo)(()=>{let e=B.trim().toLowerCase();return N.filter(t=>Lt!==`all`&&it(t)!==Lt||zt!==`all`&&t.object_name!==zt||V!==`all`&&t.status!==V?!1:M!==`pending`||!e?!0:[t.process_name,t.process_label,t.step_label,t.object_name,t.record_id,t.record_title,t.submitter_id,t.submitter_name,...t.pending_approvers||[]].filter(Boolean).join(` `).toLowerCase().includes(e))},[N,B,Lt,zt,V,M]),An=(0,x.useMemo)(()=>P?Z.findIndex(e=>e.id===P):-1,[Z,P]);(0,x.useEffect)(()=>{if(H.size===0)return;let e=new Set(Z.map(e=>e.id)),t=!1,n=new Set;for(let r of H)e.has(r)?n.add(r):t=!0;t&&Ht(n)},[Z,H]),(0,x.useEffect)(()=>{pn>=Z.length&&mn(Z.length-1)},[Z.length,pn]);let Q=(0,x.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(E);return(e.pending_approvers||[]).some(e=>t.has(e))},[E]),$=(0,x.useMemo)(()=>Z.filter(e=>H.has(e.id)&&Q(e)),[Z,H,Q]),jn=Z.filter(e=>e.status===`pending`),Mn=jn.length>0&&jn.every(e=>H.has(e.id)),Nn=(0,x.useCallback)(()=>{Ht(e=>{if(Mn)return new Set;let t=new Set(e);for(let e of jn)t.add(e.id);return t})},[Mn,jn]),Pn=(0,x.useCallback)(e=>{Ht(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Fn=(0,x.useCallback)(async e=>{let t=$;if(t.length===0)return;Wt(!0);let n=0,r=[];for(let a of t){let t=new Set(a.pending_approvers||[]),ee=E.find(e=>t.has(e))||i?.id||``;try{await(e===`approve`?C.approve:C.reject)(a.id,{actor_id:ee}),n++}catch{r.push(a.record_title||T(a.record_id))}}if(Wt(!1),Ht(new Set),r.length===0)b.success(e===`approve`?O(`bulkApproved`,`Approved {{count}} requests`,{count:n}):O(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);b.error(O(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}K(),Y()},[$,E,i?.id,K,Y,O]),In=(0,x.useCallback)(async e=>{if(!Q(e)||Kt)return;let t=new Set(e.pending_approvers||[]),n=E.find(e=>t.has(e))||i?.id||``;qt(e.id);try{let t=await C.approve(e.id,{actor_id:n});b.success(t.finalized?O(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||T(e.record_id)}):O(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),K(),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{qt(null)}},[Q,Kt,E,i?.id,K,Y,j,O]),Ln=(0,x.useCallback)(async()=>{let e=U;if(!e)return;let t=new Set(e.pending_approvers||[]),n=E.find(e=>t.has(e))||i?.id||``;qt(e.id),Gt(null);try{await C.reject(e.id,{actor_id:n}),b.success(O(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||T(e.record_id)})),K(),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{qt(null)}},[U,E,i?.id,K,Y,j,O]),Rn=(0,x.useRef)(Z);Rn.current=Z;let zn=(0,x.useRef)(pn);zn.current=pn,(0,x.useEffect)(()=>{let e=e=>{if(P||U)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Rn.current;if(!r.length)return;let i=zn.current;e.key===`j`||e.key===`ArrowDown`?(e.preventDefault(),mn(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),mn(Math.max(i-1,0))):e.key===`Enter`&&i>=0&&r[i]?(e.preventDefault(),q(r[i].id)):(e.key===`x`||e.key===` `)&&i>=0&&r[i]&&M===`pending`?(e.preventDefault(),Pn(r[i].id)):e.key===`a`&&i>=0&&r[i]?(e.preventDefault(),In(r[i])):e.key===`r`&&i>=0&&r[i]&&Q(r[i])&&(e.preventDefault(),Gt(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P,U,M,q,Pn,In,Q]),(0,x.useEffect)(()=>{if(!P)return;let e=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Rn.current,i=r.findIndex(e=>e.id===P);if(i<0)return;let a=e.key===`ArrowLeft`?r[i-1]:r[i+1];a&&(e.preventDefault(),q(a.id))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P,q]);let Bn=!!B||Lt!==`all`||zt!==`all`||V!==`all`,Vn=e=>{mt(e),Vt(`all`),Rt(`all`),Bt(`all`),Pt(``),mn(-1)};function Hn({r:e}){return(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`font-medium truncate`,children:it(e)}),(0,w.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[at(e)||`—`,(e.round??1)>1&&(0,w.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:O(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function Un({r:e}){return(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(t,{to:pt(e),onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1 text-sm hover:underline truncate max-w-full`,title:e.record_id,children:[(0,w.jsx)(`span`,{className:`truncate`,children:e.record_title||T(e.record_id)}),(0,w.jsx)(fe,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:ct(e)})]})}function Wn({r:e}){if(!Q(e))return null;let t=Kt===e.id;return(0,w.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),children:[(0,w.jsx)(v,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-emerald-700 hover:text-emerald-800 hover:bg-emerald-50 dark:text-emerald-400`,disabled:t,onClick:()=>void In(e),"aria-label":O(`approve`,`Approve`),children:(0,w.jsx)(He,{className:`h-4 w-4`})}),(0,w.jsx)(v,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400`,disabled:t,onClick:()=>Gt(e),"aria-label":O(`reject`,`Reject`),children:(0,w.jsx)(be,{className:`h-4 w-4`})})]})}return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,w.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,w.jsx)(Ke,{className:`h-6 w-6`}),O(`title`,`Approvals Inbox`)]}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O(`subtitle`,`Review and act on approval requests.`)})]}),(0,w.jsxs)(v,{variant:`outline`,size:`sm`,onClick:K,disabled:gt,className:`self-start sm:self-auto`,children:[(0,w.jsx)(Ce,{className:`h-4 w-4 mr-2 ${gt?`animate-spin`:``}`}),O(`refresh`,`Refresh`)]})]}),St&&(0,w.jsxs)(Ue,{variant:`destructive`,children:[(0,w.jsx)(_e,{className:`h-4 w-4`}),(0,w.jsx)(Ze,{children:St})]}),(0,w.jsxs)(Fe,{value:M,onValueChange:Vn,children:[(0,w.jsxs)(Qe,{children:[(0,w.jsxs)(Le,{value:`pending`,children:[O(`tabMyPending`,`My Pending`),wt>0&&(0,w.jsx)(je,{variant:`secondary`,className:`ml-2`,children:wt})]}),(0,w.jsx)(Le,{value:`submitted`,children:O(`tabSubmitted`,`Submitted by me`)}),(0,w.jsx)(Le,{value:`all`,children:O(`tabAll`,`All`)})]}),(0,w.jsxs)(We,{value:M,className:`mt-4 space-y-3`,children:[!gt&&(N.length>0||M!==`pending`&&(Ft||V!==`all`))&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,w.jsx)(he,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,w.jsx)(Ye,{value:B,onChange:e=>Pt(e.target.value),placeholder:O(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),B&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>Pt(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":O(`clearSearch`,`Clear search`),children:(0,w.jsx)(ge,{className:`h-3.5 w-3.5`})})]}),M!==`pending`&&(0,w.jsxs)(pe,{value:V,onValueChange:Vt,children:[(0,w.jsx)(ke,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,w.jsx)(Oe,{placeholder:O(`statusFilter`,`Status`)})}),(0,w.jsxs)(Je,{children:[(0,w.jsx)(o,{value:`all`,children:O(`allStatuses`,`All statuses`)}),(0,w.jsx)(o,{value:`pending`,children:A(`pending`)}),(0,w.jsx)(o,{value:`approved`,children:A(`approved`)}),(0,w.jsx)(o,{value:`rejected`,children:A(`rejected`)}),(0,w.jsx)(o,{value:`recalled`,children:A(`recalled`)}),(0,w.jsx)(o,{value:`returned`,children:A(`returned`)})]})]}),On.length>1&&(0,w.jsxs)(pe,{value:Lt,onValueChange:Rt,children:[(0,w.jsx)(ke,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,w.jsx)(Oe,{placeholder:O(`processFilter`,`Process`)})}),(0,w.jsxs)(Je,{children:[(0,w.jsx)(o,{value:`all`,children:O(`allProcesses`,`All processes`)}),On.map(e=>(0,w.jsx)(o,{value:e,children:e},e))]})]}),kn.length>1&&(0,w.jsxs)(pe,{value:zt,onValueChange:Bt,children:[(0,w.jsx)(ke,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,w.jsx)(Oe,{placeholder:O(`objectFilter`,`Object`)})}),(0,w.jsxs)(Je,{children:[(0,w.jsx)(o,{value:`all`,children:O(`allObjects`,`All objects`)}),kn.map(e=>(0,w.jsx)(o,{value:e,children:e},e))]})]}),Bn&&(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`filterCount`,`{{shown}} of {{total}}`,{shown:Z.length,total:N.length})})]}),M===`pending`&&H.size>0&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:H.size}),` `,O(`selected`,`selected`),$.length!==H.size&&(0,w.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:O(`actionableCount`,`({{count}} actionable)`,{count:$.length})})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsxs)(l,{children:[(0,w.jsx)(Ne,{asChild:!0,children:(0,w.jsxs)(v,{size:`sm`,disabled:Ut||$.length===0,children:[(0,w.jsx)(He,{className:`h-3.5 w-3.5 mr-1`}),O(`approveN`,`Approve {{count}}`,{count:$.length||``})]})}),(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:$.length})}),(0,w.jsx)(u,{children:O(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{onClick:()=>Fn(`approve`),children:O(`approveN`,`Approve {{count}}`,{count:$.length})})]})]})]}),(0,w.jsxs)(l,{children:[(0,w.jsx)(Ne,{asChild:!0,children:(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:Ut||$.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,w.jsx)(be,{className:`h-3.5 w-3.5 mr-1`}),O(`rejectN`,`Reject {{count}}`,{count:$.length||``})]})}),(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:$.length})}),(0,w.jsx)(u,{children:O(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{onClick:()=>Fn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O(`rejectN`,`Reject {{count}}`,{count:$.length})})]})]})]}),(0,w.jsx)(v,{size:`sm`,variant:`ghost`,onClick:()=>Ht(new Set),disabled:Ut,children:O(`clear`,`Clear`)})]})]}),gt?(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(s,{className:`h-10 w-full`}),(0,w.jsx)(s,{className:`h-10 w-full`}),(0,w.jsx)(s,{className:`h-10 w-full`})]}):N.length===0?(0,w.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,w.jsxs)(Ee,{children:[(0,w.jsx)(de,{children:O(`emptyTitle`,`No requests`)}),(0,w.jsx)(se,{children:M===`pending`?O(`emptyPending`,`You're all caught up — nothing is waiting on you.`):O(`emptyOther`,`Nothing here yet.`)}),M===`pending`&&(0,w.jsx)(v,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>Vn(`all`),children:O(`emptyViewAll`,`Browse all requests`)})]})}):Z.length===0?(0,w.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:O(`noMatches`,`No matches for current filters.`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ne,{className:`hidden md:block`,children:(0,w.jsx)(Re,{className:`p-0`,children:(0,w.jsxs)(ze,{children:[(0,w.jsx)(Ve,{children:(0,w.jsxs)(Ae,{children:[M===`pending`&&(0,w.jsx)(f,{className:`w-10`,children:(0,w.jsx)(ve,{checked:Mn,onCheckedChange:Nn,"aria-label":O(`selectAll`,`Select all`),disabled:jn.length===0})}),(0,w.jsx)(f,{children:O(`colRequest`,`Request`)}),(0,w.jsx)(f,{children:O(`colRecord`,`Record`)}),(0,w.jsx)(f,{children:O(`colRequester`,`Requester`)}),(0,w.jsx)(f,{children:O(`colStatus`,`Status`)}),(0,w.jsx)(f,{children:O(`colWaiting`,`Submitted`)}),(0,w.jsx)(f,{className:`w-20`,"aria-label":O(`colActions`,`Actions`)})]})}),(0,w.jsx)(qe,{children:Z.map((e,t)=>(0,w.jsxs)(Ae,{className:p(`group cursor-pointer hover:bg-accent/50`,pn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{mn(t),q(e.id)},children:[M===`pending`&&(0,w.jsx)(h,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,w.jsx)(ve,{checked:H.has(e.id),onCheckedChange:()=>Pn(e.id),disabled:e.status!==`pending`,"aria-label":O(`selectRow`,`Select request`)})}),(0,w.jsx)(h,{children:(0,w.jsx)(Hn,{r:e})}),(0,w.jsx)(h,{children:(0,w.jsx)(Un,{r:e})}),(0,w.jsx)(h,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,w.jsx)(me,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,w.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:ot(e)})]})}),(0,w.jsx)(h,{children:(0,w.jsx)(dt,{status:e.status})}),(0,w.jsxs)(h,{className:p(`text-xs whitespace-nowrap`,lt(e)),title:rt(D(e)),children:[(0,w.jsx)(Be,{className:`h-3 w-3 inline mr-1`}),k(D(e)),e.status===`pending`&&e.sla_due_at&&(0,w.jsx)(`div`,{className:p(`mt-0.5 text-[10px] font-medium`,Date.parse(e.sla_due_at)<Date.now()?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:Date.parse(e.sla_due_at)<Date.now()?O(`slaOverdue`,`SLA overdue {{dur}}`,{dur:ut(Date.now()-Date.parse(e.sla_due_at))}):O(`slaRemaining`,`SLA {{dur}} left`,{dur:ut(Date.parse(e.sla_due_at)-Date.now())})})]}),(0,w.jsx)(h,{className:`w-20`,children:(0,w.jsx)(Wn,{r:e})})]},e.id))})]})})}),(0,w.jsx)(`div`,{className:`md:hidden space-y-2`,children:Z.map(e=>(0,w.jsx)(ne,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void q(e.id),children:(0,w.jsxs)(Re,{className:`p-3 space-y-1.5`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsx)(`div`,{className:`font-medium text-sm truncate`,children:it(e)}),(0,w.jsx)(dt,{status:e.status})]}),(0,w.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||T(e.record_id),(0,w.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:ct(e)})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,w.jsx)(me,{className:`h-3 w-3`}),ot(e)]}),(0,w.jsxs)(`span`,{className:p(`inline-flex items-center gap-1 whitespace-nowrap`,lt(e)),children:[(0,w.jsx)(Be,{className:`h-3 w-3`}),k(D(e))]})]}),Q(e)&&(0,w.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(v,{size:`sm`,className:`h-7 flex-1`,disabled:Kt===e.id,onClick:()=>void In(e),children:[(0,w.jsx)(He,{className:`h-3.5 w-3.5 mr-1`}),O(`approve`,`Approve`)]}),(0,w.jsxs)(v,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:Kt===e.id,onClick:()=>Gt(e),children:[(0,w.jsx)(be,{className:`h-3.5 w-3.5 mr-1`}),O(`reject`,`Reject`)]})]})]})},e.id))}),M!==`pending`&&bt!=null&&(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:N.length,total:bt})}),N.length<bt&&(0,w.jsx)(v,{size:`sm`,variant:`outline`,disabled:vt,onClick:()=>void hn(),children:vt?O(`loadingMore`,`Loading…`):O(`loadMore`,`Load more`)})]}),(0,w.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:O(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,w.jsx)(l,{open:Jt,onOpenChange:e=>{e||(Yt(!1),Zt(``))},children:(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`reassignTitle`,`Hand this approval to someone else?`)}),(0,w.jsx)(u,{children:O(`reassignBody`,`Your approver slot moves to the person you pick — they are notified and can act immediately.`)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(Ie,{htmlFor:`reassign-to`,className:`text-xs`,children:O(`reassignTo`,`New approver`)}),(0,w.jsx)(Ye,{id:`reassign-to`,list:`reassign-user-options`,value:Xt,onChange:e=>Zt(e.target.value),placeholder:O(`reassignToPlaceholder`,`Pick a user or type an email / role:<name>`),className:`mt-1`}),(0,w.jsx)(`datalist`,{id:`reassign-user-options`,children:dn.map(e=>(0,w.jsx)(`option`,{value:e.email,children:e.name},e.email))})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{disabled:!Xt.trim()||W,onClick:()=>void vn(),children:O(`reassignBtn`,`Reassign`)})]})]})}),(0,w.jsx)(l,{open:Qt,onOpenChange:e=>{e||($t(!1),tn(``))},children:(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`requestInfoTitle`,`Ask the requester for more information?`)}),(0,w.jsx)(u,{children:O(`requestInfoBody`,`The request stays pending; the requester is notified and can reply on the thread.`)})]}),(0,w.jsx)(Xe,{value:en,onChange:e=>tn(e.target.value),rows:3,placeholder:O(`requestInfoPlaceholder`,`What do you need from the requester?`)}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{disabled:!en.trim()||W,onClick:()=>void bn(),children:O(`requestInfoBtn`,`Request info`)})]})]})}),(0,w.jsx)(l,{open:nn,onOpenChange:e=>{e||(rn(!1),on(``))},children:(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`sendBackTitle`,`Send this request back for revision?`)}),(0,w.jsx)(u,{children:O(`sendBackBody`,`This round ends and the record unlocks so the requester can fix the data. When they resubmit, a fresh approval round opens for all approvers.`)})]}),(0,w.jsx)(Xe,{value:an,onChange:e=>on(e.target.value),rows:3,placeholder:O(`sendBackPlaceholder`,`What needs to be fixed before this can be approved?`)}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{disabled:W,onClick:()=>void xn(),children:O(`sendBackBtn`,`Send back`)})]})]})}),(0,w.jsx)(l,{open:!!U,onOpenChange:e=>!e&&Gt(null),children:(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`rejectOneTitle`,`Reject "{{title}}"?`,{title:U?U.record_title||T(U.record_id):``})}),(0,w.jsx)(u,{children:O(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{onClick:()=>void Ln(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O(`reject`,`Reject`)})]})]})}),(0,w.jsx)(ie,{open:!!P,onOpenChange:e=>!e&&gn(),children:(0,w.jsxs)(Te,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,w.jsxs)(Se,{children:[(0,w.jsx)(De,{children:F?it(F):O(`drawerTitle`,`Approval Request`)}),(0,w.jsx)(ue,{children:F?at(F)||ct(F):``})]}),F&&An>=0&&Z.length>1&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,w.jsxs)(v,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:An<=0,onClick:()=>{let e=Z[An-1];e&&q(e.id)},children:[(0,w.jsx)(we,{className:`h-4 w-4 mr-0.5`}),O(`prevRequest`,`Previous`)]}),(0,w.jsx)(`span`,{children:O(`positionOf`,`{{index}} of {{total}}`,{index:An+1,total:Z.length})}),(0,w.jsxs)(v,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:An>=Z.length-1,onClick:()=>{let e=Z[An+1];e&&q(e.id)},children:[O(`nextRequest`,`Next`),(0,w.jsx)(re,{className:`h-4 w-4 ml-0.5`})]})]}),At?(0,w.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,w.jsx)(s,{className:`h-6 w-3/4`}),(0,w.jsx)(s,{className:`h-6 w-1/2`}),(0,w.jsx)(s,{className:`h-20 w-full`})]}):F?(0,w.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(dt,{status:F.status}),(F.round??1)>1&&(0,w.jsx)(je,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:O(`roundChip`,`Round {{n}}`,{n:F.round})}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:rt(D(F)),children:[(0,w.jsx)(Be,{className:`h-3 w-3`}),O(`submittedAgo`,`Submitted {{when}}`,{when:k(D(F))})]}),F.completed_at&&(0,w.jsxs)(`span`,{children:[`· `,O(`completedAt`,`Completed {{when}}`,{when:k(F.completed_at)})]}),F.status===`pending`&&F.sla_due_at&&(0,w.jsx)(je,{variant:`outline`,className:p(`text-[10px]`,Date.parse(F.sla_due_at)<Date.now()?`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`:`border-border text-muted-foreground`),children:Date.parse(F.sla_due_at)<Date.now()?O(`slaOverdue`,`SLA overdue {{dur}}`,{dur:ut(Date.now()-Date.parse(F.sla_due_at))}):O(`slaRemaining`,`SLA {{dur}} left`,{dur:ut(Date.parse(F.sla_due_at)-Date.now())})})]}),(0,w.jsx)(ne,{children:(0,w.jsxs)(Re,{className:`p-4 space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(t,{to:pt(F),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`truncate`,children:F.record_title||T(F.record_id)}),(0,w.jsx)(fe,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:ct(F)})]}),(0,w.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,w.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,w.jsx)(me,{className:`h-3 w-3`}),(0,w.jsx)(`span`,{title:F.submitter_id||``,children:ot(F)})]})})]}),ft(F.payload,F.payload_display).length>0&&(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-sm border-t pt-3`,children:ft(F.payload,F.payload_display).map(([e,t])=>(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,w.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),F.status===`pending`&&(F.pending_approvers||[]).length>0&&(0,w.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,w.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:O(`waitingOn`,`Waiting on`)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(F.pending_approvers||[]).map((e,t)=>(0,w.jsx)(je,{variant:`outline`,className:`text-[11px]`,title:e,children:st(e,F)},t))})]})]})}),(F.flow_steps?.length??0)>1&&(0,w.jsx)(`div`,{className:`flex items-center px-1`,"aria-label":O(`stepProgress`,`Approval steps`),children:F.flow_steps.map((e,t)=>(0,w.jsxs)(x.Fragment,{children:[t>0&&(0,w.jsx)(`div`,{className:p(`h-px flex-1 mx-2`,e.state===`done`||e.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,w.jsx)(`span`,{className:p(`flex items-center justify-center h-5 w-5 rounded-full text-[10px] font-semibold`,e.state===`done`&&`bg-emerald-500 text-white`,e.state===`current`&&`bg-amber-500 text-white ring-2 ring-amber-200 dark:ring-amber-500/30`,e.state===`upcoming`&&`bg-muted text-muted-foreground border`),children:e.state===`done`?(0,w.jsx)(xe,{className:`h-3 w-3`}):t+1}),(0,w.jsx)(`span`,{className:p(`text-xs`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]})]},e.id))}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:O(`history`,`Activity`)}),Ot.length===0?(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:O(`noActions`,`No actions yet.`)}):(0,w.jsx)(`ol`,{className:`relative space-y-3 pl-5 before:absolute before:left-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border`,children:Ot.map(e=>{let t=e.action===`approve`?`bg-emerald-500`:e.action===`reject`?`bg-destructive`:e.action===`submit`?`bg-blue-500`:e.action===`reassign`?`bg-indigo-500`:e.action===`remind`||e.action===`request_info`?`bg-amber-500`:e.action===`comment`?`bg-slate-400`:e.action===`escalate`?`bg-red-500`:e.action===`revise`?`bg-violet-500`:e.action===`resubmit`?`bg-blue-500`:`bg-muted-foreground`,n=e.actor_id===`system:sla`?O(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===F.submitter_id?ot(F):T(e.actor_id)),r=e.action===`submit`?O(`actSubmit`,`Submitted`):e.action===`approve`?O(`actApprove`,`Approved`):e.action===`reject`?O(`actReject`,`Rejected`):e.action===`recall`?O(`actRecall`,`Recalled`):e.action===`reassign`?O(`actReassign`,`Reassigned`):e.action===`remind`?O(`actRemind`,`Reminder sent`):e.action===`request_info`?O(`actRequestInfo`,`Requested more info`):e.action===`comment`?O(`actComment`,`Commented`):e.action===`escalate`?O(`actEscalate`,`SLA escalated`):e.action===`revise`?O(`actRevise`,`Sent back for revision`):e.action===`resubmit`?O(`actResubmit`,`Resubmitted`):e.action;return(0,w.jsxs)(`li`,{className:`relative text-xs`,children:[(0,w.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${t}`,"aria-hidden":!0}),(0,w.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,w.jsx)(`span`,{className:`font-medium`,children:r}),(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,w.jsx)(`span`,{title:e.actor_id||``,children:n}),(0,w.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:rt(e.created_at),children:k(e.created_at)})]}),e.comment&&(0,w.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]})]},e.id)})}),F.status===`pending`&&(Tn||En)&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,w.jsx)(Ye,{value:ln,onChange:e=>un(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ln.trim()&&(e.preventDefault(),Cn())},placeholder:O(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,w.jsx)(v,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!ln.trim()||W,onClick:()=>void Cn(),children:(0,w.jsx)(ae,{className:`h-3.5 w-3.5`})})]})]}),F.payload!=null&&(0,w.jsxs)(`details`,{className:`group`,children:[(0,w.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:O(`rawData`,`Raw data (JSON)`)}),(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(F.payload,null,2)),b.success(O(`copied`,`Copied`))}catch{b.error(O(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,w.jsx)(Pe,{className:`h-3 w-3`}),O(`copy`,`Copy`)]})}),(0,w.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(F.payload,null,2)})]})]}),F.status===`pending`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ce,{}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[$e&&(0,w.jsxs)(`details`,{className:`group`,children:[(0,w.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:O(`overrideActor`,`Act as another identity (admin)`)}),(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(Ie,{htmlFor:`actor-override`,className:`text-xs`,children:O(`actor`,`Actor`)}),(0,w.jsx)(`input`,{id:`actor-override`,type:`text`,value:R,onChange:e=>Mt(e.target.value),placeholder:`${O(`auto`,`Auto`)}: ${J(F)||`—`}`,className:`w-full mt-1 px-3 py-2 text-sm border rounded-md bg-background`}),(0,w.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:O(`overrideHint`,`e.g. role:sales_manager. Leave blank to use the auto-detected identity.`)})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(Ie,{htmlFor:`comment`,className:`text-xs`,children:O(`comment`,`Comment (optional)`)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1.5`,children:[O(`quickPhrase1`,`Approved — meets requirements.`),O(`quickPhrase2`,`Approved with conditions — please monitor execution.`),O(`quickPhrase3`,`Please add supporting material and resubmit.`)].map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>L(e),className:`text-[11px] px-2 py-0.5 rounded-full border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,children:e},e))}),(0,w.jsx)(Xe,{id:`comment`,value:I,onChange:e=>L(e.target.value),rows:2,className:`mt-1`})]}),(0,w.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,w.jsxs)(v,{size:`sm`,onClick:()=>_n(`approve`),disabled:!Tn||z!==null,children:[(0,w.jsx)(He,{className:`h-4 w-4 mr-1`}),z===`approve`?O(`approving`,`Approving…`):O(`approve`,`Approve`)]}),(0,w.jsxs)(l,{children:[(0,w.jsx)(Ne,{asChild:!0,children:(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:!Tn||z!==null,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,w.jsx)(be,{className:`h-4 w-4 mr-1`}),z===`reject`?O(`rejecting`,`Rejecting…`):O(`reject`,`Reject`)]})}),(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`rejectTitle`,`Reject this request?`)}),(0,w.jsx)(u,{children:O(`rejectBody`,`This marks the request as rejected and notifies the submitter.`)})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{onClick:()=>_n(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O(`reject`,`Reject`)})]})]})]}),Tn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:z!==null||W,className:`border-violet-300 text-violet-700 hover:bg-violet-50 dark:text-violet-400`,onClick:()=>rn(!0),children:[(0,w.jsx)(Me,{className:`h-4 w-4 mr-1`}),O(`sendBackBtn`,`Send back`)]}),(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:z!==null||W,className:`border-amber-300 text-amber-700 hover:bg-amber-50 dark:text-amber-400`,onClick:()=>$t(!0),children:[(0,w.jsx)(oe,{className:`h-4 w-4 mr-1`}),O(`requestInfoBtn`,`Request info`)]}),(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:z!==null||W,onClick:()=>{wn(),Yt(!0)},children:[(0,w.jsx)(ye,{className:`h-4 w-4 mr-1`}),O(`reassignBtn`,`Reassign`)]})]}),En&&(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:W,onClick:()=>void yn(),children:[(0,w.jsx)(Ge,{className:`h-4 w-4 mr-1`}),O(`remindBtn`,`Send reminder`)]}),En&&(0,w.jsxs)(l,{children:[(0,w.jsx)(Ne,{asChild:!0,children:(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:z!==null,children:[(0,w.jsx)(le,{className:`h-4 w-4 mr-1`}),z===`recall`?O(`recalling`,`Recalling…`):O(`recall`,`Recall`)]})}),(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`recallTitle`,`Recall this request?`)}),(0,w.jsx)(u,{children:O(`recallBody`,`This withdraws your request. Approvers can no longer act on it, and the record is unlocked.`)})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{onClick:()=>_n(`recall`),children:O(`recall`,`Recall`)})]})]})]})]}),!Tn&&(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:En?O(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):O(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(F.pending_approvers||[]).map(e=>st(e,F)).join(`, `)||`—`})})]})]}),Dn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ce,{}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:O(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(Ie,{htmlFor:`resubmit-comment`,className:`text-xs`,children:O(`comment`,`Comment (optional)`)}),(0,w.jsx)(Xe,{id:`resubmit-comment`,value:I,onChange:e=>L(e.target.value),rows:2,className:`mt-1`,placeholder:O(`resubmitPlaceholder`,`What did you change?`)})]}),(0,w.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,w.jsx)(v,{asChild:!0,size:`sm`,variant:`outline`,children:(0,w.jsxs)(t,{to:pt(F),children:[(0,w.jsx)(fe,{className:`h-4 w-4 mr-1`}),O(`editRecordBtn`,`Edit record`)]})}),(0,w.jsxs)(v,{size:`sm`,disabled:sn,onClick:()=>void Sn(),children:[(0,w.jsx)(Ce,{className:p(`h-4 w-4 mr-1`,sn&&`animate-spin`)}),sn?O(`resubmitting`,`Resubmitting…`):O(`resubmitBtn`,`Resubmit`)]}),(0,w.jsxs)(l,{children:[(0,w.jsx)(Ne,{asChild:!0,children:(0,w.jsxs)(v,{size:`sm`,variant:`outline`,disabled:sn,children:[(0,w.jsx)(le,{className:`h-4 w-4 mr-1`}),O(`recall`,`Recall`)]})}),(0,w.jsxs)(d,{children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(y,{children:O(`abandonTitle`,`Abandon this revision?`)}),(0,w.jsx)(u,{children:O(`abandonBody`,`This withdraws the request instead of resubmitting it. The approval ends here.`)})]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(m,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(g,{onClick:()=>_n(`recall`),children:O(`recall`,`Recall`)})]})]})]})]})]})]})]}):null]})})]})}export{pt as ApprovalsInboxPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{f as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as ee}from"./infrastructure-ASGyCRMg.js";import{R as te,l as ne}from"./framework-CBCX6Urh.js";import{$n as re,Cc as ie,Ci as o,Do as ae,Gn as oe,Jn as se,Jo as ce,Jt as le,Kn as ue,Kt as de,Mr as s,Ns as fe,Ps as c,Qn as l,Qo as pe,Rt as u,Si as d,Un as me,Wn as he,Xt as ge,Yo as _e,Yt as ve,ar as f,dn as p,ds as m,er as ye,fn as be,ga as xe,hn as h,js as g,nr as Se,ns as Ce,oc as we,pn as Te,qn as Ee,qr as _,qt as De,rr as Oe,va as ke,xn as Ae,xr as v,za as y}from"./ui-components-BOOpjWsQ.js";import"./MetadataProvider-seOmvY8N.js";import{n as je}from"./assistantBus-BFk4fCbM.js";import{S as b,_ as Me,a as Ne,c as Pe,g as Fe,h as Ie,i as Le,m as Re,o as ze,p as Be,r as x,s as Ve,t as He,u as Ue}from"./marketplaceApi-N63OOXW-.js";import{n as We,t as Ge}from"./usePackageL10n-CiFMHfKe.js";import{t as Ke}from"./MarketplaceAccessDenied-Bl4faFLm.js";var S=e(a(),1),C=i();function qe(e){let t=e.replace(/\r\n/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(e.startsWith("```")){let i=e.slice(3).trim();r++;let a=[];for(;r<t.length&&!t[r].startsWith("```");)a.push(t[r]),r++;r++,n.push({type:`code`,text:a.join(`
|
|
4
|
-
`),lang:i});continue}let i=/^(#{1,3})\s+(.*)$/.exec(e);if(i){let e=i[1].length;n.push({type:`h${e}`,text:i[2].trim()}),r++;continue}if(/^[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^[-*]\s+/.test(t[r]);)e.push(t[r].replace(/^[-*]\s+/,``)),r++;n.push({type:`ul`,items:e});continue}if(/^\d+\.\s+/.test(e)){let e=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r]);)e.push(t[r].replace(/^\d+\.\s+/,``)),r++;n.push({type:`ol`,items:e});continue}if(!e.trim()){r++;continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^#{1,3}\s+/.test(t[r])&&!/^[-*]\s+/.test(t[r])&&!/^\d+\.\s+/.test(t[r])&&!t[r].startsWith("```");)a.push(t[r]),r++;n.push({type:`p`,text:a.join(` `)})}return n}function w(e){let t=[],n=e,r=0,i=[{re:/`([^`]+)`/,render:e=>(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[0.85em]`,children:e[1]},`k${r++}`)},{re:/\*\*([^*]+)\*\*/,render:e=>(0,C.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e[1]},`k${r++}`)},{re:/\*([^*]+)\*/,render:e=>(0,C.jsx)(`em`,{children:e[1]},`k${r++}`)},{re:/\[([^\]]+)\]\(([^)]+)\)/,render:e=>(0,C.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noopener noreferrer`,className:`text-violet-600 underline-offset-2 hover:underline dark:text-violet-400`,children:e[1]},`k${r++}`)}];for(;n;){let e=-1,r=null,a=null;for(let t of i){let i=t.re.exec(n);i&&(e===-1||i.index<e)&&(e=i.index,r=i,a=t)}if(!r||!a){t.push(n);break}e>0&&t.push(n.slice(0,e)),t.push(a.render(r)),n=n.slice(e+r[0].length)}return(0,C.jsx)(C.Fragment,{children:t.map((e,t)=>(0,C.jsx)(S.Fragment,{children:e},t))})}function Je({source:e,className:t}){let n=qe(e);return(0,C.jsx)(`div`,{className:`flex flex-col gap-4 text-sm leading-relaxed text-foreground/90 ${t??``}`,children:n.map((e,t)=>{switch(e.type){case`h1`:return(0,C.jsx)(`h2`,{className:`mt-2 text-xl font-bold tracking-tight`,children:w(e.text??``)},t);case`h2`:return(0,C.jsx)(`h3`,{className:`mt-3 text-base font-semibold tracking-tight`,children:w(e.text??``)},t);case`h3`:return(0,C.jsx)(`h4`,{className:`mt-2 text-sm font-semibold tracking-tight text-foreground/80`,children:w(e.text??``)},t);case`p`:return(0,C.jsx)(`p`,{children:w(e.text??``)},t);case`ul`:return(0,C.jsx)(`ul`,{className:`ml-1 flex list-none flex-col gap-1.5`,children:(e.items??[]).map((e,t)=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-violet-500/70`}),(0,C.jsx)(`span`,{children:w(e)})]},t))},t);case`ol`:return(0,C.jsx)(`ol`,{className:`ml-5 flex list-decimal flex-col gap-1.5 marker:text-muted-foreground`,children:(e.items??[]).map((e,t)=>(0,C.jsx)(`li`,{className:`pl-1`,children:w(e)},t))},t);case`code`:return(0,C.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border bg-muted/40 p-3 text-xs leading-relaxed`,children:(0,C.jsx)(`code`,{className:`font-mono`,children:e.text})},t)}return null})})}var T={node:`In-process · full trust`,sandbox:`Sandboxed`,worker:`Out-of-process`};function E({icon:e,label:t,items:n}){return!n||n.length===0?null:(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(e,{className:`h-3.5 w-3.5 mt-0.5 text-muted-foreground shrink-0`,"aria-hidden":`true`}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium`,children:t}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:n.map(e=>(0,C.jsx)(`code`,{className:`font-mono text-[11px] px-1 py-0.5 rounded bg-muted break-all`,children:e},e))})]})]})}function Ye({version:e}){let{t}=ne();if(!e?.contains_code)return null;let n=e.permissions??{},r=(n.services?.length??0)+(n.hooks?.length??0)+(n.network?.length??0)+(n.fs?.length??0)>0;return(0,C.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-3 space-y-3 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,C.jsx)(m,{className:`h-4 w-4 text-amber-600 shrink-0`,"aria-hidden":`true`}),t(`marketplace.disclosure.containsCode`,{defaultValue:`This package contains code`})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.runtime&&(0,C.jsx)(f,{variant:`outline`,children:t(`marketplace.disclosure.runtime.${e.runtime}`,{defaultValue:T[e.runtime]??e.runtime})}),e.platform_verified?(0,C.jsxs)(f,{variant:`outline`,className:`gap-1 border-green-500/40 text-green-700 dark:text-green-400`,children:[(0,C.jsx)(d,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.reviewed`,{defaultValue:`Reviewed & approved`})]}):(0,C.jsxs)(f,{variant:`outline`,className:`gap-1 border-amber-500/40 text-amber-700 dark:text-amber-400`,children:[(0,C.jsx)(o,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.unreviewed`,{defaultValue:`Not yet reviewed`})]}),e.signed&&(0,C.jsxs)(f,{variant:`outline`,className:`gap-1`,children:[(0,C.jsx)(g,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.signed`,{defaultValue:`Signed`})]})]}),r?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t(`marketplace.disclosure.grantsIntro`,{defaultValue:`On install, this package will be granted:`})}),(0,C.jsx)(E,{icon:we,label:t(`marketplace.disclosure.services`,{defaultValue:`Platform services`}),items:n.services??void 0}),(0,C.jsx)(E,{icon:s,label:t(`marketplace.disclosure.hooks`,{defaultValue:`Lifecycle hooks`}),items:n.hooks??void 0}),(0,C.jsx)(E,{icon:ke,label:t(`marketplace.disclosure.network`,{defaultValue:`Network access`}),items:n.network??void 0}),(0,C.jsx)(E,{icon:ae,label:t(`marketplace.disclosure.fs`,{defaultValue:`Filesystem access`}),items:n.fs??void 0})]}):(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t(`marketplace.disclosure.noPermissions`,{defaultValue:`Requests no special permissions.`})})]})}var D=t({MarketplacePackagePage:()=>O});function O(){let e=n(),{packageId:t,appName:i}=r(),a=ee(),{t:o,language:ae}=ne(),s=i?`/apps/${i}`:``,{refresh:d}=te(),[m,we]=(0,S.useState)(null),[ke,qe]=(0,S.useState)(!0),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(!1),[O,Xe]=(0,S.useState)([]),[Ze,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)(``),[Qe,$e]=(0,S.useState)({}),[P,et]=(0,S.useState)(!1),[tt,nt]=(0,S.useState)(!1),[F,rt]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,it]=(0,S.useState)(null),[z,B]=(0,S.useState)(null),[V,H]=(0,S.useState)(null),[U,W]=(0,S.useState)(null),[at,G]=(0,S.useState)([]),[K,q]=(0,S.useState)(!1),[J,Y]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(!b().features.installLocal)return;let e=!1;return(async()=>{let t=await Ue();e||G(t)})(),()=>{e=!0}},[t,J]),(0,S.useEffect)(()=>{if(!t)return;let e=b().defaultEnvironmentId??``,n=!1;return(async()=>{let r=await x(t,e);n||!r||(B(r),it(r.version))})(),()=>{n=!0}},[t]),(0,S.useEffect)(()=>{let e=!1;return(async()=>{if(t){qe(!0),T(null);try{let n=await Le(t);e||we(n)}catch(t){e||T(t?.message??String(t))}finally{e||qe(!1)}}})(),()=>{e=!0}},[t]);let ot=async()=>{D(!0),L(null),j(null);let e=b().defaultEnvironmentId;if(e){k(!1),N(e),Xe([]);return}k(!0);try{let[e,n]=await Promise.all([Ve(),Pe()]),r=e.filter(e=>{let t=e.organization_id;return t?n.has(String(t)):!1});Xe(r),$e({});let i=t;i&&Promise.all(r.map(async e=>{try{let t=await x(i,e.id);return t?[e.id,t.version]:null}catch{return null}})).then(e=>{let t={};for(let n of e)n&&(t[n[0]]=n[1]);$e(t)}),e.length>0&&r.length===0?j(o(`marketplace.install.noPermission`)):r.length===1&&N(r[0].id)}catch(e){let t=e?.status;j(t===401||t===403?o(`marketplace.install.signInFirst`):e?.message??String(e))}finally{k(!1)}},st=async()=>{if(!(!t||!M)){rt(!0),L(null);try{let e=(await ze({packageId:t,environmentId:M,seedSampleData:P}))?.installation?.version??m?.package?.latest_version?.version??m?.versions?.[0]?.version??``;it(e||`installed`);try{let e=b().defaultEnvironmentId||M;if(e){let n=await x(t,e);n&&B(n)}}catch{}let n=b().defaultEnvironmentId;if(!n||n===M)try{if(typeof sessionStorage<`u`)for(let e of Object.keys(sessionStorage))e.startsWith(`objectui:metadata:`)&&sessionStorage.removeItem(e);await d()}catch{}L({ok:!0,message:o(`marketplace.install.success`)}),je()}catch(e){L({ok:!1,message:e?.message??String(e)})}finally{rt(!1)}}},ct=async()=>{if(t){q(!0),Y(null);try{let e=await Ne({packageId:t});try{await d(`app`)}catch{}Y({ok:!0,message:o(`marketplace.install.localSuccess`,{version:e.version,name:m?.package?Ge(m.package,ae).displayName:e.manifestId})}),je()}catch(e){let t=e?.code,n=e?.message??String(e);t===`manifest_conflict`?n=o(`marketplace.install.localManifestConflict`,{message:n}):t===`unauthorized`?n=o(`marketplace.install.localUnauthorized`):t===`marketplace_unavailable`&&(n=o(`marketplace.install.localMarketplaceUnavailable`)),Y({ok:!1,message:n})}finally{q(!1)}}},lt=async()=>{if($&&confirm(o(`marketplace.uninstall.confirm`,{manifestId:$.manifestId,version:$.version}))){q(!0),Y(null);try{await Me($.manifestId);try{await d(`app`)}catch{}Y({ok:!0,message:o(`marketplace.uninstall.successInDetail`,{manifestId:$.manifestId})})}catch(e){Y({ok:!1,message:e?.message??String(e)})}finally{q(!1)}}},ut=async()=>{if(z){H(`reseed`),W(null);try{let e=await Fe(z.installationId);e.ok?(B({...z,withSampleData:!0}),W({ok:!0,text:o(`marketplace.detail.reseedQueued`)||`Sample data will be re-seeded on next environment access.`})):W({ok:!1,text:e.error||`Re-seed failed`})}finally{H(null)}}},dt=async()=>{if(z&&confirm(o(`marketplace.detail.purgeConfirm`)||`Delete all sample records seeded by this package? User-added records will NOT be touched.`)){H(`purge`),W(null);try{let e=await Re(z.installationId);if(e.ok){B({...z,withSampleData:!1});let t=e.deleted??0;W({ok:!0,text:t>0?o(`marketplace.detail.purgeSuccess`,{count:t})||`Removed ${t} sample record(s).`:o(`marketplace.detail.purgeNoData`)||`No sample records found to purge.`})}else W({ok:!1,text:e.error||`Purge failed`})}finally{H(null)}}},ft=async()=>{if($){H(`reseed`),W(null);try{let e=await Ie($.manifestId);G(e=>e.map(e=>e.manifestId===$.manifestId?{...e,withSampleData:!0}:e));let t=e.inserted??0,n=e.updated??0,r=e.errors??0,i=o(`marketplace.detail.reseedLocalSuccess`,{inserted:t,updated:n})||`Sample data re-seeded (inserted=${t}, updated=${n}).`;W(r>0?{ok:!1,text:`${i} ${o(`marketplace.detail.reseedPartialErrors`,{count:r})||`(${r} record(s) failed to write)`}`}:{ok:!0,text:i})}catch(e){W({ok:!1,text:e?.message||`Re-seed failed`})}finally{H(null)}}},pt=async()=>{if($&&confirm(o(`marketplace.detail.purgeConfirm`)||`Delete all sample records seeded by this package? User-added records will NOT be touched.`)){H(`purge`),W(null);try{let e=await Be($.manifestId);G(e=>e.map(e=>e.manifestId===$.manifestId?{...e,withSampleData:!1}:e));let t=e.deleted??0;W({ok:!0,text:t>0?o(`marketplace.detail.purgeSuccess`,{count:t})||`Removed ${t} sample record(s).`:o(`marketplace.detail.purgeNoData`)||`No sample records found to purge.`})}catch(e){W({ok:!1,text:e?.message||`Purge failed`})}finally{H(null)}}};if(ke)return(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsx)(u,{className:`h-8 w-32`}),(0,C.jsx)(u,{className:`h-16 w-full`}),(0,C.jsx)(u,{className:`h-64 w-full`})]});if(w||!m)return(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>e(`${s}/system/marketplace`),children:[(0,C.jsx)(ie,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),o(`marketplace.back`)]}),(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-destructive/30 bg-destructive/5 p-4 text-sm`,children:[(0,C.jsx)(c,{className:`h-4 w-4 mt-0.5 text-destructive`,"aria-hidden":`true`}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-medium text-destructive`,children:o(`marketplace.load.packageFailed`)}),(0,C.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:w??o(`marketplace.load.notFound`)})]})]})]});let X=m.package,Z=Ge(X,ae),Q=X.latest_version?.version??m.versions[0]?.version??null,$=at.find(e=>e.manifestId===X.manifest_id)??null,mt=!!X.latest_version?.contains_code,ht=!!R&&R!==`installed`&&!!Q&&R!==Q,gt=b().features.installLocal,_t=!Q||K||F||!gt&&!!R&&!ht,vt=gt?{label:o(K?`marketplace.action.working`:$?`marketplace.action.reinstall`:`marketplace.action.install`),onClick:ct}:{label:F?o(`marketplace.action.installing`):R?ht?o(`marketplace.action.updateTo`,{defaultValue:`Update`,version:Q}):o(`marketplace.action.installed`,{defaultValue:`Installed`}):o(`marketplace.action.installToCloud`),onClick:ot},yt=X.category?o(`marketplace.category.${X.category}`,{defaultValue:X.category}):null;return a?(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsxs)(v,{variant:`ghost`,size:`sm`,className:`self-start -ml-2 text-muted-foreground hover:text-foreground`,onClick:()=>e(`${s}/system/marketplace`),children:[(0,C.jsx)(ie,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),o(`marketplace.back`)]}),(0,C.jsxs)(`div`,{className:`flex items-start gap-5 flex-wrap sm:flex-nowrap rounded-2xl border bg-gradient-to-br from-primary/5 via-background to-background p-6 sm:p-8`,children:[(0,C.jsx)(We,{iconUrl:X.icon_url,displayName:Z.displayName,manifestId:X.manifest_id,className:`h-20 w-20 rounded-2xl shadow-sm ring-1 ring-border shrink-0`,initialClassName:`text-3xl font-bold`}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,C.jsx)(`h1`,{className:`text-2xl sm:text-3xl font-bold tracking-tight truncate`,children:Z.displayName||X.manifest_id}),X.homepage_url&&(0,C.jsxs)(`a`,{href:X.homepage_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:o(`marketplace.detail.homepage`),children:[(0,C.jsx)(ce,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:o(`marketplace.detail.homepage`)})]})]}),(0,C.jsxs)(`div`,{className:`text-sm text-muted-foreground mt-2 flex flex-wrap items-center gap-1.5`,children:[(0,C.jsx)(`code`,{className:`font-mono text-xs px-1.5 py-0.5 rounded bg-muted`,children:X.manifest_id}),Q&&(0,C.jsx)(f,{variant:`outline`,children:o(`marketplace.versionBadge`,{version:Q})}),X.publisher&&X.publisher!==`private`&&(0,C.jsx)(f,{variant:X.publisher===`objectstack`?`default`:`secondary`,children:X.publisher}),yt&&(0,C.jsx)(f,{variant:`outline`,children:yt}),X.license&&(0,C.jsx)(f,{variant:`outline`,className:`font-normal`,children:X.license}),$&&(0,C.jsxs)(f,{variant:`default`,className:`bg-green-600 hover:bg-green-600 gap-1`,children:[(0,C.jsx)(g,{className:`h-3 w-3`,"aria-hidden":`true`}),o(`marketplace.detail.installedV`,{version:$.version})]}),!$&&R&&(0,C.jsxs)(f,{variant:`default`,className:`bg-green-600 hover:bg-green-600 gap-1`,children:[(0,C.jsx)(g,{className:`h-3 w-3`,"aria-hidden":`true`}),o(`marketplace.detail.installedV`,{version:R})]}),ht&&(0,C.jsxs)(f,{variant:`default`,className:`bg-amber-500 hover:bg-amber-500 gap-1`,children:[(0,C.jsx)(fe,{className:`h-3 w-3`,"aria-hidden":`true`}),o(`marketplace.detail.updateAvailable`,{defaultValue:`Update available`}),` → v`,Q]})]}),Z.description&&(0,C.jsx)(`p`,{className:`text-sm sm:text-base text-foreground/80 mt-3 max-w-2xl leading-relaxed`,children:Z.description})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 self-start`,children:[(0,C.jsxs)(v,{onClick:vt.onClick,disabled:_t,size:`lg`,className:`min-w-[8rem]`,children:[(0,C.jsx)(pe,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),vt.label]}),$&&(0,C.jsxs)(be,{children:[(0,C.jsx)(Ae,{asChild:!0,children:(0,C.jsx)(v,{variant:`outline`,size:`lg`,className:`px-2.5`,"aria-label":o(`marketplace.detail.moreOptions`),children:(0,C.jsx)(_e,{className:`h-4 w-4`,"aria-hidden":`true`})})}),(0,C.jsxs)(Te,{align:`end`,className:`w-56`,children:[(0,C.jsxs)(h,{onSelect:ft,disabled:V!==null,children:[V===`reseed`?(0,C.jsx)(y,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(Ce,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),$.withSampleData?o(`marketplace.detail.reseedAgain`)||`Re-seed sample data`:o(`marketplace.detail.addSampleData`)||`Add sample data`]}),(0,C.jsxs)(h,{onSelect:pt,disabled:V!==null||!$.withSampleData,className:`text-destructive focus:text-destructive`,children:[V===`purge`?(0,C.jsx)(y,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(_,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),o(`marketplace.detail.purgeSampleData`)||`Purge sample data`]}),(0,C.jsxs)(h,{onSelect:lt,disabled:K,className:`text-destructive focus:text-destructive`,children:[(0,C.jsx)(_,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),o(`marketplace.detail.uninstallFromRuntime`)]})]})]}),!$&&z&&!b().cloudUrl&&(0,C.jsxs)(be,{children:[(0,C.jsx)(Ae,{asChild:!0,children:(0,C.jsx)(v,{variant:`outline`,size:`lg`,className:`px-2.5`,"aria-label":o(`marketplace.detail.moreOptions`)||`More options`,children:(0,C.jsx)(_e,{className:`h-4 w-4`,"aria-hidden":`true`})})}),(0,C.jsxs)(Te,{align:`end`,className:`w-56`,children:[(0,C.jsxs)(h,{onSelect:ut,disabled:V!==null,children:[V===`reseed`?(0,C.jsx)(y,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(Ce,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),z.withSampleData?o(`marketplace.detail.reseedAgain`)||`Re-seed sample data`:o(`marketplace.detail.addSampleData`)||`Add sample data`]}),(0,C.jsxs)(h,{onSelect:dt,disabled:V!==null||!z.withSampleData,className:`text-destructive focus:text-destructive`,children:[V===`purge`?(0,C.jsx)(y,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(_,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),o(`marketplace.detail.purgeSampleData`)||`Purge sample data`]})]})]})]})]}),U&&(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border p-3 text-sm ${U.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:[U.ok?(0,C.jsx)(g,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}):(0,C.jsx)(c,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:U.text}),(0,C.jsx)(`button`,{type:`button`,className:`text-xs underline opacity-60 hover:opacity-100`,onClick:()=>W(null),children:o(`marketplace.action.dismiss`)})]}),J&&(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border p-3 text-sm whitespace-pre-wrap ${J.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:[J.ok?(0,C.jsx)(g,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}):(0,C.jsx)(c,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:J.message}),(0,C.jsx)(`button`,{type:`button`,className:`text-xs underline opacity-60 hover:opacity-100`,onClick:()=>Y(null),children:o(`marketplace.action.dismiss`)})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,C.jsx)(`div`,{className:`lg:col-span-2 space-y-4`,children:(0,C.jsxs)(re,{children:[(0,C.jsx)(Se,{children:(0,C.jsx)(Oe,{className:`text-base`,children:o(`marketplace.detail.about`)})}),(0,C.jsx)(ye,{children:Z.readme?(0,C.jsx)(Je,{source:Z.readme}):(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`marketplace.detail.noReadme`)})})]})}),(0,C.jsx)(`div`,{className:`space-y-4`,children:(0,C.jsxs)(re,{children:[(0,C.jsx)(Se,{children:(0,C.jsx)(Oe,{className:`text-base`,children:o(`marketplace.detail.versions`)})}),(0,C.jsx)(ye,{children:m.versions.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`marketplace.detail.noApprovedVersions`)}):(0,C.jsx)(`ul`,{className:`space-y-3`,children:m.versions.map(e=>(0,C.jsxs)(`li`,{className:`space-y-1 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,C.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(xe,{className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,C.jsxs)(`code`,{className:`font-mono`,children:[`v`,e.version]}),e.is_prerelease&&(0,C.jsx)(f,{variant:`outline`,className:`text-xs`,children:o(`marketplace.detail.prerelease`)})]}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.published_at?new Date(e.published_at).toLocaleDateString():`—`})]}),e.release_notes&&e.release_notes.trim()&&(0,C.jsx)(`p`,{className:`whitespace-pre-line pl-5 text-xs text-muted-foreground`,children:e.release_notes.trim()})]},e.id))})})]})})]}),(0,C.jsx)(me,{open:E,onOpenChange:e=>{D(e),e||(L(null),nt(!1))},children:(0,C.jsxs)(he,{children:[(0,C.jsxs)(Ee,{children:[(0,C.jsx)(se,{children:o(`marketplace.install.dialogTitle`,{name:Z.displayName||X.manifest_id})}),(0,C.jsx)(oe,{children:b().defaultEnvironmentId?o(`marketplace.install.dialogDescCurrent`,{host:typeof window<`u`?window.location.host:``}):o(`marketplace.install.dialogDescPicker`)})]}),Ze?(0,C.jsx)(u,{className:`h-10 w-full`}):A?(0,C.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-3 text-sm space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(c,{className:`h-4 w-4 mt-0.5 text-amber-600`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:A})]}),(0,C.jsx)(`a`,{href:He(X.id),target:`_blank`,rel:`noopener noreferrer`,children:(0,C.jsxs)(v,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,C.jsx)(ce,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),o(`marketplace.action.openOnCloud`)]})})]}):b().defaultEnvironmentId?(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(l,{id:`seed`,checked:P,onCheckedChange:e=>et(e===!0)}),(0,C.jsx)(p,{htmlFor:`seed`,className:`text-sm font-normal cursor-pointer`,children:o(`marketplace.install.includeSampleData`)})]}):O.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`marketplace.install.noEnvs`)}):(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(p,{htmlFor:`env-select`,children:o(`marketplace.install.environment`)}),(0,C.jsxs)(de,{value:M,onValueChange:N,children:[(0,C.jsx)(ve,{id:`env-select`,children:(0,C.jsx)(ge,{placeholder:o(`marketplace.install.environmentPlaceholder`)})}),(0,C.jsx)(De,{children:O.map(e=>{let t=Qe[e.id],n=!!t&&!!Q&&t!==`installed`&&t!==Q;return(0,C.jsxs)(le,{value:e.id,children:[e.display_name||e.hostname||e.id,e.plan&&(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.plan]}),t&&(n?(0,C.jsxs)(`span`,{className:`text-amber-600`,children:[` · `,o(`marketplace.install.updateTo`,{defaultValue:`Update → v{{version}}`,version:Q})]}):(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,o(`marketplace.install.installedVersion`,{defaultValue:`Installed v{{version}}`,version:t})]}))]},e.id)})})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(l,{id:`seed`,checked:P,onCheckedChange:e=>et(e===!0)}),(0,C.jsx)(p,{htmlFor:`seed`,className:`text-sm font-normal cursor-pointer`,children:o(`marketplace.install.includeSampleData`)})]})]}),mt&&!A&&(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(Ye,{version:X.latest_version}),(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(l,{id:`ack-perms`,checked:tt,onCheckedChange:e=>nt(e===!0)}),(0,C.jsx)(p,{htmlFor:`ack-perms`,className:`text-sm font-normal cursor-pointer leading-snug`,children:o(`marketplace.disclosure.acknowledge`,{defaultValue:`I understand this package runs code and grants the permissions above.`})})]})]}),I&&(0,C.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${I.ok?`border-green-500/30 bg-green-500/5 text-green-700`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:I.message}),(0,C.jsxs)(ue,{children:[(0,C.jsx)(v,{variant:`outline`,onClick:()=>D(!1),children:o(`marketplace.action.close`)}),!A&&(0,C.jsx)(v,{onClick:st,disabled:!M||F||I?.ok===!0||mt&&!tt,children:o(F?`marketplace.action.installing`:`marketplace.action.install`)})]})]})})]}):(0,C.jsx)(Ke,{})}export{D as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,h as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as ee,f as o,n as s,t as c}from"./infrastructure-ASGyCRMg.js";import{l,q as u}from"./framework-CBCX6Urh.js";import{Fc as te,G as d,J as f,Or as ne,Ra as re,V as ie,W as p,Yi as ae,ji as oe,ns as m,xr as h}from"./ui-components-BOOpjWsQ.js";import{t as se}from"./RecordDetailView-CUcCVoa1.js";import{r as g}from"./useMetadata-D-bLZoNN.js";import{t as _}from"./getIcon-Ci4w4xXM.js";import{n as v,t as y}from"./CreateViewDialog-CboUdp-q.js";import{a as b,i as x,n as ce,o as le,r as ue,s as de}from"./InterfaceListPage-CwGb2Th3.js";import{l as fe}from"./plugins-views-BVxwkRdi.js";import{t as pe}from"./runtime-metadata-persistence-D1KKivGr.js";var S=e(a(),1),C=i();function w(e){let t=[];return e.forEach((e,n)=>{let r=/^filter\[(.+)\]$/.exec(n);r&&r[1]&&e!==``&&t.push([r[1],`=`,e])}),t}var T=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),E=4;function D({dataSource:e,objects:i}){let{appName:a,objectName:D}=r(),{t:O}=l(),{objectLabel:k,fieldLabel:A}=te(),j=t(),[M,N]=n(),{can:P}=s(),{canRead:F}=c(D??``),{user:I}=o(),L=ee(),R=g(),[z,B]=S.useState(!1),V=S.useMemo(()=>(i||[]).find(e=>e.name===D),[i,D]),[me]=S.useState(()=>de(new URLSearchParams(window.location.search))),he=S.useCallback(e=>{N(t=>le(t,e),{replace:!0})},[N]),H=Array.from(M.entries()).filter(([e])=>e.startsWith(`filter[`)).map(([e,t])=>`${e}=${t}`).join(`&`),U=S.useMemo(()=>{let e=w(new URLSearchParams(H)),t=e.filter(([e])=>F(e));if(t.length<e.length){let t=e.filter(([e])=>!F(e)).map(([e])=>e);console.warn(`[ObjectDataPage] Dropped URL filter(s) on unreadable field(s): ${t.join(`, `)}`)}return t.map(([e,t,n])=>n===`{current_user_id}`?[e,t,I?.id??n]:[e,t,n])},[H,F,I?.id]),ge=S.useCallback(e=>{N(t=>{let n=new URLSearchParams(t);return n.delete(`filter[${e}]`),n})},[N]),W=S.useMemo(()=>ue(V).filter(e=>F(e)),[V,F]),G=S.useMemo(()=>{let e=V?.fields;if(!e||typeof e!=`object`)return;let t=Object.entries(e).filter(([e,t])=>t&&!t.hidden&&T.has(t.type)&&F(e)).slice(0,E).map(([e])=>({field:e}));return t.length>0?{element:`dropdown`,fields:t}:void 0},[V,F]),K=S.useCallback(e=>`/apps/${a}/${D}/record/${encodeURIComponent(String(e))}`,[a,D]),q=u({navigation:{mode:`drawer`},objectName:D??``,onNavigate:e=>j(K(e))}),J=M.get(`recordId`),_e=S.useCallback((e,t)=>{let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(K(n),`_blank`);return}n!=null&&N(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t})},[K,N]),ve=S.useCallback(()=>{N(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[N]);S.useEffect(()=>{J&&!q.isOpen?q.open({id:J}):!J&&q.isOpen&&q.close()},[J]);let Y=S.useMemo(()=>b(V),[V]),X=S.useMemo(()=>ce(V),[V]),Z=S.useMemo(()=>x(V),[V]),Q=S.useMemo(()=>{let e=[`grid`];return Y&&e.push(`kanban`),X&&e.push(`calendar`),Z&&e.push(`gallery`),e},[Y,X,Z]),$=S.useMemo(()=>{if(V)return{type:`list-view`,objectName:V.name,viewType:`grid`,fields:W,...U.length?{filters:U}:{},kanban:Y,calendar:X,gallery:Z,userFilters:G,appearance:{allowedVisualizations:Q},showViewSwitcher:Q.length>1,showSearch:!0,showSort:!0,showFilters:!0,showGroup:!0,showHideFields:!0,showDensity:!0,showRecordCount:!0}},[V,W,U,Y,X,Z,G,Q]),ye=S.useCallback(async e=>{try{let t={...e,columns:Array.isArray(e.columns)&&e.columns.length>0?e.columns:W,...U.length?{filter:U}:{}},n=await pe(`view`,String(e?.name??e?.id??``),t,{metadataClient:R});n&&j(`../view/${n}`,{relative:`path`})}catch(e){console.error(`[ObjectDataPage] Failed to save view:`,e)}},[W,U,R,j]);return V?P(V.name,`read`)?(0,C.jsxs)(`div`,{className:`h-full flex flex-col bg-background min-w-0 overflow-hidden`,"data-testid":`object-data-page`,children:[(0,C.jsx)(`div`,{className:`hidden sm:block`,children:(0,C.jsx)(v,{title:(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:k(V)}),(0,C.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:O(`console.objectData.badge`,{defaultValue:`Data`})})]}),description:O(`console.objectData.description`,{defaultValue:`URL-defined data slice — not bound to any saved view.`}),icon:S.createElement(_(V?.icon),{className:`h-4 w-4`}),actions:(0,C.jsxs)(C.Fragment,{children:[P(V.name,`create`)&&(0,C.jsxs)(h,{size:`sm`,onClick:()=>j(`../new`,{relative:`path`}),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-new-button`,children:[(0,C.jsx)(ae,{className:`h-4 w-4`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:O(`console.objectView.new`)})]}),L&&(0,C.jsxs)(h,{size:`sm`,variant:`outline`,onClick:()=>B(!0),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-save-as-view`,children:[(0,C.jsx)(oe,{className:`h-4 w-4`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:O(`console.objectData.saveAsView`,{defaultValue:`Save as view`})})]})]})})}),U.length>0&&(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b px-3 sm:px-4 py-2 shrink-0`,"data-testid":`object-data-filter-chips`,children:[(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`console.objectData.filteredBy`,{defaultValue:`Filtered by`})}),U.map(([e,,t])=>(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted/40 px-2 py-0.5 text-xs`,children:[(0,C.jsx)(`span`,{className:`font-medium`,children:A(V.name,e,e)}),(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[`= `,String(t)]}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>ge(e),className:`ml-0.5 rounded-full hover:bg-muted p-0.5`,"aria-label":O(`console.objectData.removeFilter`,{defaultValue:`Remove filter {{field}}`,field:e}),"data-testid":`object-data-remove-filter-${e}`,children:(0,C.jsx)(ne,{className:`h-3 w-3`})})]},e))]}),(0,C.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:$&&(0,C.jsx)(fe,{schema:$,dataSource:e,userFilterSelections:me,onUserFilterSelectionsChange:he,onRowClick:_e})}),q.isOverlay&&(0,C.jsx)(ie,{...q,setIsOpen:e=>{e||ve()},title:k(V),children:t=>(0,C.jsx)(se,{objectNameOverride:V.name,recordIdOverride:String(t?.id??t?._id??J??``),embedded:!0,dataSource:e,objects:i,onEdit:()=>{}})}),L&&(0,C.jsx)(y,{open:z,onOpenChange:B,onCreate:ye,objectDef:V})]}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,"data-testid":`object-data-403`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(re,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:O(`console.objectData.noAccessTitle`,{defaultValue:`Access denied`})}),(0,C.jsx)(d,{children:O(`console.objectData.noAccess`,{defaultValue:`You do not have permission to view this data.`})})]})}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(m,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:O(`console.objectView.objectNotFound`)}),(0,C.jsx)(d,{children:O(`console.objectView.objectNotFoundDescription`,{objectName:D})})]})})}export{D as ObjectDataPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{r as t,y as n}from"./vendor-react-BGDDiZfJ.js";import{L as r}from"./framework-CBCX6Urh.js";import{$n as i,Ei as a,Gn as o,Jn as s,Jo as ee,Ka as te,Kn as c,Un as l,Vi as ne,Wi as re,Wn as u,Yi as ie,_t as d,ar as ae,cs as oe,dn as f,ds as se,er as ce,ft as le,gt as ue,ht as p,mt as m,nr as de,pt as fe,qn as h,rr as pe,sn as g,tr as me,xr as _}from"./ui-components-BOOpjWsQ.js";import{r as v}from"./vendor-ui-utils-BzQBRdq3.js";import"./src-rXeXV_HX.js";var y=e(n(),1),b=t();function he(e){return e?e.replace(/^\/+/,``).match(/^forms\/([^/?#]+)/i)?.[1]??null:null}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9-_]+/g,`-`).replace(/^-+|-+$/g,``)}function S(){let e=r()?.getClient?.(),[t,n]=(0,y.useState)([]),[S,ge]=(0,y.useState)([]),[C,w]=(0,y.useState)(!0),[T,E]=(0,y.useState)(null),[_e,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)(``),[M,N]=(0,y.useState)(!1),[ve,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(``),[z,B]=(0,y.useState)(`thank-you`),[V,H]=(0,y.useState)(``),[U,W]=(0,y.useState)(``),[G,K]=(0,y.useState)(``),[q,J]=(0,y.useState)(!1),Y=async()=>{if(!e?.meta?.getItems){E(`meta.getItems is not available on this client`),w(!1);return}w(!0),E(null);try{let t=await e.meta.getItems(`view`),r=Array.isArray(t)?t:Array.isArray(t?.items)?t.items:Array.isArray(t?.value)?t.value:[],i=[],a=[];for(let e of r){let t=e?.spec??e;if(!(t?.sections||t?.groups||t?.form||t?.type===`simple`||t?.type===`tabbed`||t?.type===`wizard`||t?.viewType===`form`))continue;let n=t?.sharing,r=n?.publicLink,o=he(r);n?.allowAnonymous&&o&&r?i.push({name:t?.name??e?.name,label:t?.label,object:t?.object,slug:o,publicLink:r,updatedAt:e?.updatedAt??e?.updated_at,spec:t}):a.push({name:t?.name??e?.name,label:t?.label,object:t?.object,spec:t})}n(i),ge(a)}catch(e){E(e?.message??String(e))}finally{w(!1)}};(0,y.useEffect)(()=>{Y()},[]);let ye=typeof window<`u`?window.location.origin:``,X=e=>`${ye}/console/f/${e}`,Z=e=>`<iframe src="${X(e)}" width="100%" height="640" frameborder="0" style="border:0;"></iframe>`,be=e=>`<iframe\n src={\`${X(e)}\`}\n title="Public form"\n style={{ width: '100%', height: 640, border: 0 }}\n/>`,Q=async(e,t)=>{try{await navigator.clipboard.writeText(t),v.success(`Copied ${e}`)}catch{v.error(`Clipboard unavailable`)}},xe=async()=>{if(!O||!A)return;let t=S.find(e=>e.name===O);if(!t)return;let n=x(A);if(!n){v.error(`Invalid slug`);return}let r={...t.spec,sharing:{...t.spec.sharing??{},enabled:!0,allowAnonymous:!0,publicLink:`/forms/${n}`}};N(!0);try{await e.meta.saveItem(`view`,t.name,r),v.success(`Published ${t.name}`),D(!1),k(``),j(``),await Y()}catch(e){v.error(`Publish failed: ${e?.message??e}`)}finally{N(!1)}},Se=e=>{I(e),R(e.slug);let t=e.spec?.submitBehavior,n=t?.kind??`thank-you`;B(n),H(t?.title??``),W(t?.message??``),K(t?.url??``),P(!0)},Ce=async()=>{if(!F)return;let t=x(L);if(!t){v.error(`Invalid slug`);return}let n;switch(z){case`thank-you`:n={kind:`thank-you`},V&&(n.title=V),U&&(n.message=U);break;case`redirect`:if(!G){v.error(`Redirect URL is required`);return}n={kind:`redirect`,url:G};break;case`continue`:case`next-record`:n={kind:z};break}let r={...F.spec,sharing:{...F.spec.sharing??{},enabled:!0,allowAnonymous:!0,publicLink:`/forms/${t}`},submitBehavior:n};J(!0);try{await e.meta.saveItem(`view`,F.name,r),v.success(`Saved ${F.name}`),P(!1),I(null),await Y()}catch(e){v.error(`Save failed: ${e?.message??e}`)}finally{J(!1)}},$=t.length>0;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-4 p-4 md:p-6 overflow-auto`,children:[(0,b.jsxs)(i,{children:[(0,b.jsxs)(de,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(pe,{className:`flex items-center gap-2`,children:[(0,b.jsx)(re,{className:`h-4 w-4`}),`Public Forms`]}),(0,b.jsx)(me,{children:`Forms anyone can fill out — no login required. Publish a form to get a shareable link; submissions land directly in the bound object.`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(_,{variant:`default`,size:`sm`,onClick:()=>D(!0),disabled:S.length===0,title:S.length===0?`No non-public FormViews available`:`Publish a FormView`,children:[(0,b.jsx)(ie,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{className:`ml-1.5`,children:`Publish form…`})]}),(0,b.jsxs)(_,{variant:`outline`,size:`sm`,onClick:Y,disabled:C,children:[(0,b.jsx)(ne,{className:`h-3.5 w-3.5 ${C?`animate-spin`:``}`}),(0,b.jsx)(`span`,{className:`ml-1.5`,children:`Refresh`})]})]})]}),(0,b.jsxs)(ce,{children:[T&&(0,b.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:T}),!C&&!$&&(0,b.jsxs)(`div`,{className:`rounded-md border border-dashed p-6 text-center text-sm text-muted-foreground`,children:[(0,b.jsx)(`p`,{className:`font-medium text-foreground`,children:`No public forms yet`}),(0,b.jsxs)(`p`,{className:`mt-1`,children:[`Click `,(0,b.jsx)(`strong`,{children:`Publish form…`}),` above to share an existing form, or build a new one in Views & Apps and mark it public.`]})]}),$&&(0,b.jsxs)(le,{children:[(0,b.jsx)(ue,{children:(0,b.jsxs)(d,{children:[(0,b.jsx)(p,{children:`Name`}),(0,b.jsx)(p,{children:`Object`}),(0,b.jsx)(p,{children:`Slug`}),(0,b.jsx)(p,{children:`Public URL`}),(0,b.jsx)(p,{className:`text-right`,children:`Actions`})]})}),(0,b.jsx)(fe,{children:t.map(e=>{let t=X(e.slug);return(0,b.jsxs)(d,{children:[(0,b.jsx)(m,{children:(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:e.label??e.name}),(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:e.name})]})}),(0,b.jsx)(m,{children:e.object?(0,b.jsx)(ae,{variant:`secondary`,children:e.object}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,b.jsx)(m,{children:(0,b.jsx)(`code`,{className:`text-xs`,children:e.slug})}),(0,b.jsx)(m,{children:(0,b.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline`,children:[t,(0,b.jsx)(ee,{className:`h-3 w-3`})]})}),(0,b.jsx)(m,{className:`text-right`,children:(0,b.jsxs)(`div`,{className:`inline-flex gap-1`,children:[(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy URL`,onClick:()=>Q(`URL`,t),children:(0,b.jsx)(te,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy <iframe> embed`,onClick:()=>Q(`iframe snippet`,Z(e.slug)),children:(0,b.jsx)(se,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy React snippet`,onClick:()=>Q(`React snippet`,be(e.slug)),children:(0,b.jsx)(oe,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Edit sharing & post-submit behavior`,onClick:()=>Se(e),children:(0,b.jsx)(a,{className:`h-3.5 w-3.5`})})]})})]},e.name)})})]})]})]}),(0,b.jsx)(l,{open:_e,onOpenChange:D,children:(0,b.jsxs)(u,{className:`sm:max-w-md`,children:[(0,b.jsxs)(h,{children:[(0,b.jsx)(s,{children:`Publish a FormView`}),(0,b.jsxs)(o,{children:[`Pick an existing FormView and turn it into a public form by enabling `,(0,b.jsx)(`code`,{className:`text-xs`,children:`sharing.allowAnonymous`}),` `,`and setting `,(0,b.jsx)(`code`,{className:`text-xs`,children:`publicLink`}),`.`]})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`publish-view`,children:`FormView`}),(0,b.jsxs)(`select`,{id:`publish-view`,className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,value:O,onChange:e=>k(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`— Select a FormView —`}),S.map(e=>(0,b.jsxs)(`option`,{value:e.name,children:[e.label??e.name,` (`,e.name,`) `,e.object?`· ${e.object}`:``]},e.name))]})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`publish-slug`,children:`URL slug`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`/console/f/`}),(0,b.jsx)(g,{id:`publish-slug`,placeholder:`contact-us`,value:A,onChange:e=>j(e.target.value)})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits, dashes and underscores only.`})]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(_,{variant:`ghost`,onClick:()=>D(!1),disabled:M,children:`Cancel`}),(0,b.jsx)(_,{onClick:xe,disabled:M||!O||!A,children:M?`Publishing…`:`Publish`})]})]})}),(0,b.jsx)(l,{open:ve,onOpenChange:P,children:(0,b.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,b.jsxs)(h,{children:[(0,b.jsx)(s,{children:F?`Edit ${F.label??F.name}`:`Edit form`}),(0,b.jsx)(o,{children:`Configure the public URL and what happens after submit.`})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-slug`,children:`URL slug`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`/console/f/`}),(0,b.jsx)(g,{id:`edit-slug`,value:L,onChange:e=>R(e.target.value)})]})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-behavior`,children:`After submit`}),(0,b.jsxs)(`select`,{id:`edit-behavior`,className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,value:z,onChange:e=>B(e.target.value),children:[(0,b.jsx)(`option`,{value:`thank-you`,children:`Show a thank-you panel`}),(0,b.jsx)(`option`,{value:`redirect`,children:`Redirect to a URL`}),(0,b.jsx)(`option`,{value:`continue`,children:`Reset for another response`}),(0,b.jsx)(`option`,{value:`next-record`,children:`Advance to next record (internal queues)`})]})]}),z===`thank-you`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-tytitle`,children:`Title`}),(0,b.jsx)(g,{id:`edit-tytitle`,placeholder:`Thanks!`,value:V,onChange:e=>H(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-tymsg`,children:`Message`}),(0,b.jsx)(g,{id:`edit-tymsg`,placeholder:`Your submission has been received.`,value:U,onChange:e=>W(e.target.value)})]})]}),z===`redirect`&&(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-url`,children:`Redirect URL`}),(0,b.jsx)(g,{id:`edit-url`,type:`url`,placeholder:`https://example.com/thanks`,value:G,onChange:e=>K(e.target.value)})]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(_,{variant:`ghost`,onClick:()=>P(!1),disabled:q,children:`Cancel`}),(0,b.jsx)(_,{onClick:Ce,disabled:q||!L,children:q?`Saving…`:`Save`})]})]})})]})}export{S as PublicFormsPage};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t,t as n}from"./rolldown-runtime-DAXXjFlN.js";import{a as r,d as i,f as a,h as o,m as s,r as c,y as l}from"./vendor-react-BGDDiZfJ.js";import{f as u,m as d}from"./infrastructure-ASGyCRMg.js";import{A as f,H as p,O as m,U as h,Ut as g,Y as _,b as v,ct as y,i as b,j as x,l as S,n as C,v as ee,w as te}from"./framework-CBCX6Urh.js";import{Fc as ne,G as re,Gn as w,J as ie,Jn as T,Jt as ae,Kn as oe,Ko as E,Kt as se,Pc as D,Qn as ce,T as le,Un as O,Us as ue,Vs as de,W as fe,Wn as pe,Xt as me,Yt as he,_r as k,cs as ge,dn as _e,fr as ve,gr as ye,hr as be,kc as xe,mr as Se,ns as Ce,pr as we,qn as Te,qo as Ee,qt as De,sn as Oe,st as ke,vr as Ae,xr as A,yr as je}from"./ui-components-BOOpjWsQ.js";import{r as j}from"./vendor-ui-utils-BzQBRdq3.js";import{t as Me}from"./plugin-form-CX8z6nsj.js";import{i as Ne,o as Pe,r as Fe,t as Ie}from"./useRecordApprovals-jo_LH43z.js";import{n as Le}from"./utils-Bixzg6Bz.js";import{n as Re,t as ze}from"./MetadataInspector-DwPx9ueN.js";import{c as Be,i as Ve,n as He,r as Ue,s as We}from"./plugins-views-BVxwkRdi.js";import{t as Ge}from"./ManagedByBadge-BtJfBjbT.js";import{t as Ke}from"./skeletons-BjaBYe9k.js";var M=e(l(),1),N=c(),qe=(0,M.createContext)(void 0);function P({children:e}){let[t,n]=(0,M.useState)(`home`),[r,i]=(0,M.useState)(),[a,o]=(0,M.useState)(),s=(0,M.useMemo)(()=>({context:t,setContext:n,currentAppName:r,setCurrentAppName:i,recordTitle:a,setRecordTitle:o}),[t,r,a]);return(0,N.jsx)(qe.Provider,{value:s,children:e})}function F(){return(0,M.useContext)(qe)||{context:`app`,setContext:()=>{},currentAppName:void 0,setCurrentAppName:()=>{},recordTitle:void 0,setRecordTitle:()=>{}}}function Je(e){let{setRecordTitle:t}=F();(0,M.useEffect)(()=>(t(e),()=>t(void 0)),[e,t])}var Ye=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),I=n((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),L=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Xe=n(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ze=n(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Qe=n((e=>{var t=I().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),$e=n((e=>{var t=I().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),et=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),tt=n((e=>{var t=L(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),R=n((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),nt=n((e=>{var t=R();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),z=n(((e,t)=>{var n=nt();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),B=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),rt=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),V=n((e=>{var t=B(),n=rt();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),it=n((e=>{var t=I(),n=tt(),r=L(),i=V(),a=B(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),H=n((e=>{var t=I(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),at=n(((e,t)=>{var n=V();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),ot=n(((e,t)=>{var n=V(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),st=n(((e,t)=>{var n=V();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),U=n(((e,t)=>{var n=V(),r=I();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),ct=n(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),lt=n((e=>{var t=V(),n=at(),r=ot(),i=st(),a=U(),o=rt(),s=I(),c=ct();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),W=n((e=>{var t=I(),n=L(),r=Xe(),i=Ze(),a=Qe(),o=$e(),s=et(),c=tt(),l=z(),u=it(),d=H(),f=V(),p=lt();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
5
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
-
Minimum version required to store current data is: `+c+`.
|
|
7
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),G=n((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),ut=n((e=>{var t=G();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),dt=n((e=>{var t=G();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
8
|
-
`;return typeof a==`function`&&a(null,p),p}})),K=n((e=>{var t=Ye(),n=W(),r=ut(),i=dt();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}));function ft(e){let{url:t,channel:n,autoReconnect:r=!0,reconnectInterval:i=1e3,maxReconnectAttempts:a=10,authToken:o}=e,[s,c]=(0,M.useState)(`disconnected`),[l,u]=(0,M.useState)(null),[d,f]=(0,M.useState)([]),[p,m]=(0,M.useState)(null),h=(0,M.useRef)(null),g=(0,M.useRef)(0),_=(0,M.useRef)(null),v=(0,M.useRef)(new Map),y=(0,M.useRef)([]),b=(0,M.useRef)(!0),x=(0,M.useRef)(!1),S=(0,M.useCallback)(()=>{_.current!==null&&(clearTimeout(_.current),_.current=null)},[]),C=(0,M.useCallback)(e=>{for(;y.current.length>0;){let t=y.current.shift(),r={type:t.type,channel:n,data:t.data,timestamp:new Date().toISOString()};e.send(JSON.stringify(r))}},[n]),ee=(0,M.useCallback)(()=>{if(typeof WebSocket>`u`){m(Error(`WebSocket is not available in this environment`)),c(`error`);return}if(!t){m(Error(`WebSocket URL is required`)),c(`error`);return}try{let e=new URL(t);if(e.protocol!==`ws:`&&e.protocol!==`wss:`){m(Error(`WebSocket URL must use ws: or wss: protocol`)),c(`error`);return}}catch{m(Error(`Invalid WebSocket URL`)),c(`error`);return}h.current&&=(x.current=!0,h.current.close(),null),x.current=!1,c(`connecting`),m(null);let e=o?`${t}?token=${encodeURIComponent(o)}&channel=${encodeURIComponent(n)}`:`${t}?channel=${encodeURIComponent(n)}`,s;try{s=new WebSocket(e)}catch(e){if(!b.current)return;let t=e instanceof Error?e:Error(`Failed to create WebSocket connection`);m(t),c(`error`);return}h.current=s,s.onopen=()=>{b.current&&(c(`connected`),m(null),g.current=0,C(s))},s.onmessage=e=>{if(b.current)try{let t=JSON.parse(String(e.data));if(t.channel!==n)return;u(t),f(e=>[...e,t]);let r=v.current.get(t.type);r&&r.forEach(e=>e(t.data))}catch{}},s.onerror=()=>{b.current&&(m(Error(`WebSocket connection error`)),c(`error`))},s.onclose=()=>{if(b.current){if(h.current=null,x.current){c(`disconnected`);return}if(r&&g.current<a){c(`reconnecting`);let e=Math.min(i*2**g.current,3e4);g.current+=1,_.current=setTimeout(()=>{b.current&&ee()},e)}else c(`disconnected`)}}},[t,n,o,r,i,a,C]),te=(0,M.useCallback)(()=>{S(),x.current=!0,g.current=0,h.current&&=(h.current.close(),null),c(`disconnected`)},[S]),ne=(0,M.useCallback)(()=>{S(),g.current=0,ee()},[ee,S]),re=(0,M.useCallback)((e,t)=>{let r=h.current;if(r&&r.readyState===WebSocket.OPEN){let i={type:e,channel:n,data:t,timestamp:new Date().toISOString()};r.send(JSON.stringify(i))}else y.current.push({type:e,data:t})},[n]),w=(0,M.useCallback)((e,t)=>(v.current.has(e)||v.current.set(e,new Set),v.current.get(e).add(t),()=>{let n=v.current.get(e);n&&(n.delete(t),n.size===0&&v.current.delete(e))}),[]);return(0,M.useEffect)(()=>(b.current=!0,t&&ee(),()=>{b.current=!1,S(),x.current=!0,h.current&&=(h.current.close(),null)}),[t,n,o]),{connectionState:s,isConnected:s===`connected`,lastMessage:l,messages:d,send:re,subscribe:w,disconnect:te,reconnect:ne,error:p}}var pt=0;function mt(){return pt+=1,`conflict-${Date.now()}-${pt}`}var ht=0;function q(){return ht+=1,`ver-${Date.now()}-${ht}`}function gt(e,t,n){let[r,i]=(0,M.useState)([]),[a,o]=(0,M.useState)([]);return{versions:r,currentVersion:(0,M.useMemo)(()=>r.length===0?0:r[r.length-1].version,[r]),conflicts:a,hasConflicts:a.length>0,recordVersion:(0,M.useCallback)((n,r)=>{i(i=>{let a=i.length===0?1:i[i.length-1].version+1,o={id:q(),version:a,timestamp:new Date().toISOString(),userId:e,userName:t,changes:n,message:r};return[...i,o]})},[e,t]),resolveConflict:(0,M.useCallback)((n,r,a)=>{o(o=>{let s=o.find(e=>e.id===n);if(!s)return o;let c;switch(r){case`local`:c=s.localValue;break;case`remote`:c=s.remoteValue;break;case`merge`:c=a??s.localValue;break}return i(n=>{let i=n.length===0?1:n[n.length-1].version+1,a={id:q(),version:i,timestamp:new Date().toISOString(),userId:e,userName:t,changes:{[s.field]:{before:s.baseValue,after:c}},message:`Resolved conflict on "${s.field}" using ${r} strategy`};return[...n,a]}),o.filter(e=>e.id!==n)})},[e,t]),resolveAllConflicts:(0,M.useCallback)(n=>{o(r=>{if(r.length===0)return r;let a={};for(let e of r)a[e.field]={before:e.baseValue,after:n===`local`?e.localValue:e.remoteValue};return i(r=>{let i=r.length===0?1:r[r.length-1].version+1,o={id:q(),version:i,timestamp:new Date().toISOString(),userId:e,userName:t,changes:a,message:`Resolved all conflicts using ${n} strategy`};return[...r,o]}),[]})},[e,t]),revertToVersion:(0,M.useCallback)(n=>{let a=r.findIndex(e=>e.id===n);if(a===-1)return null;let o={};for(let e=0;e<=a;e++){let t=r[e];for(let[e,n]of Object.entries(t.changes))o[e]=n.after}let s={},c={};for(let e of r)for(let[t,n]of Object.entries(e.changes))c[t]=n.after;for(let[e,t]of Object.entries(o))c[e]!==t&&(s[e]={before:c[e],after:t});return Object.keys(s).length>0&&i(n=>{let i=n.length===0?1:n[n.length-1].version+1,o={id:q(),version:i,timestamp:new Date().toISOString(),userId:e,userName:t,changes:s,message:`Reverted to version ${r[a].version}`};return[...n,o]}),o},[r,e,t]),compareVersions:(0,M.useCallback)((e,t)=>{let n=r.findIndex(t=>t.id===e),i=r.findIndex(e=>e.id===t);if(n===-1||i===-1)return null;let[a,o]=n<i?[n,i]:[i,n],s=e=>{let t={};for(let n=0;n<=e;n++)for(let[e,i]of Object.entries(r[n].changes))t[e]=i.after;return t},c=s(a),l=s(o),u=new Set([...Object.keys(c),...Object.keys(l)]),d={};for(let e of u){let t=c[e],n=l[e];t!==n&&(d[e]={before:t,after:n})}return d},[r]),addConflict:(0,M.useCallback)(e=>{let t={...e,id:mt()};o(e=>[...e,t])},[]),clearHistory:(0,M.useCallback)(()=>{i([]),o([])},[])}}var _t={sm:24,md:32,lg:40},vt={active:`#22c55e`,idle:`#f59e0b`,away:`#94a3b8`};function yt(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function bt({users:e,maxVisible:t=5,size:n=`md`,showStatus:r=!0,className:i}){let a=_t[n],o=Math.round(a*.3),s=Math.round(a*.35),c=Math.max(8,Math.round(a*.28)),l=(0,M.useMemo)(()=>e.slice(0,t),[e,t]),u=Math.max(0,e.length-t),d={display:`inline-flex`,alignItems:`center`,flexDirection:`row-reverse`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`},f={width:`${a}px`,height:`${a}px`,borderRadius:`50%`,border:`2px solid #fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`${s}px`,fontWeight:600,color:`#fff`,position:`relative`,flexShrink:0,overflow:`hidden`,boxSizing:`border-box`},p={...f,backgroundColor:`#e2e8f0`,color:`#475569`,marginLeft:`-${o}px`},m={position:`absolute`,bottom:`-1px`,right:`-1px`,width:`${c}px`,height:`${c}px`,borderRadius:`50%`,border:`2px solid #fff`,boxSizing:`border-box`},h=(0,M.useMemo)(()=>[...l].reverse(),[l]);return M.createElement(`div`,{style:d,className:i,role:`group`,"aria-label":`${e.length} user${e.length===1?``:`s`} present`},u>0&&M.createElement(`div`,{key:`overflow`,style:p,title:`${u} more user${u===1?``:`s`}`},`+${u}`),h.map((e,t)=>M.createElement(`div`,{key:e.userId,style:{...f,backgroundColor:e.color,marginLeft:t>0||u>0?`-${o}px`:`0`},title:`${e.userName} (${e.status})`},e.avatar?M.createElement(`img`,{src:e.avatar,alt:e.userName,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):yt(e.userName),r&&M.createElement(`span`,{style:{...m,backgroundColor:vt[e.status]}}))))}var xt=M.createContext({});function St(){let e=M.useContext(xt),[t,n]=M.useState([]);return M.useEffect(()=>{if(!e.subscribeTenant){n([]);return}return e.subscribeTenant(e=>{n(Array.isArray(e)?e:[])})},[e]),t}function Ct(e,t){let n=M.useContext(xt),[r,i]=M.useState([]);return M.useEffect(()=>{if(!n.subscribeRecord||!e||!t){i([]);return}return n.subscribeRecord({objectName:e,recordId:t},e=>{i(Array.isArray(e)?e:[])})},[n,e,t]),r}var wt=K(),J=`recordId`,Tt=`form`,Et=`formObject`,Dt=`formLink`,Ot=`palette`,kt=`shortcuts`,Y=`from`,At=48;function jt(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>!!e&&typeof e.o==`string`&&e.o.length>0&&typeof e.i==`string`&&e.i.length>0).slice(-8).map(e=>({o:e.o,i:e.i,...typeof e.t==`string`&&e.t.trim()?{t:e.t.trim().slice(0,At)}:{}})):[]}catch{return[]}}function X(e){return JSON.stringify(e.slice(-8))}function Mt(e,t){let n=jt(e),r=n[n.length-1];return(!r||r.o!==t.o||r.i!==t.i)&&n.push({o:t.o,i:t.i,...t.t&&t.t.trim()?{t:t.t.trim().slice(0,At)}:{}}),X(n)}function Nt(e,t,n){let r=`${e}/${t.o}/record/${encodeURIComponent(t.i)}`;if(n.length===0)return r;let i=new URLSearchParams;return i.set(Y,X(n)),`${r}?${i.toString()}`}var Pt={platform:{create:!0,import:!0,edit:!0,delete:!0,exportCsv:!0},config:{create:!0,import:!1,edit:!0,delete:!0,exportCsv:!0},system:{create:!1,import:!1,edit:!1,delete:!1,exportCsv:!0},"append-only":{create:!1,import:!1,edit:!1,delete:!1,exportCsv:!0},"better-auth":{create:!1,import:!1,edit:!1,delete:!1,exportCsv:!0}};function Ft(e){let t=Pt[e?.managedBy??`platform`]??Pt.platform,n=e?.userActions??{};return{create:n.create??t.create,import:n.import??t.import,edit:n.edit??t.edit,delete:n.delete??t.delete,exportCsv:n.exportCsv??t.exportCsv}}var It=new Set([`record:discussion`,`record:chatter`]);function Lt(e){let t=new WeakSet,n=e=>{if(!e||typeof e!=`object`||t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.some(n);let r=e?.type;return typeof r==`string`&&It.has(r)?!0:[e.children,e.items,e.body,e.components,e.properties?.children,e.properties?.items,e.regions].some(n)};return n(e)}function Rt({state:e,onOpenChange:t}){let{t:n}=S(),r=()=>{e.resolve?.(!0),t(!1)},i=()=>{e.resolve?.(!1),t(!1)};return(0,N.jsx)(ve,{open:e.open,onOpenChange:e=>{e||i()},children:(0,N.jsxs)(be,{children:[(0,N.jsxs)(Ae,{children:[(0,N.jsx)(je,{children:e.options?.title||n(`actionConfirm.title`)}),(0,N.jsx)(ye,{children:e.message})]}),(0,N.jsxs)(k,{children:[(0,N.jsx)(Se,{onClick:i,children:e.options?.cancelText||n(`actionConfirm.cancel`)}),(0,N.jsx)(we,{onClick:r,children:e.options?.confirmText||n(`actionConfirm.confirm`)})]})]})})}function zt({state:e,onOpenChange:t}){let{t:n,language:r}=S(),[i,a]=(0,M.useState)({}),[o,s]=(0,M.useState)({});(0,M.useEffect)(()=>{if(e.open){let t={};for(let n of e.params)n.defaultValue!==void 0&&(t[n.name]=n.defaultValue);a(t),s({})}},[e.open,e.params]);let c=e=>e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0:!1,l=()=>{let n={};for(let t of e.params)t.required&&c(i[t.name])&&(n[t.name]=!0);if(Object.keys(n).length>0){s(n);return}e.resolve?.(i),t(!1)},u=()=>{e.resolve?.(null),t(!1)},d=(e,t)=>{a(n=>({...n,[e]:t})),s(t=>({...t,[e]:!1}))};return(0,N.jsx)(O,{open:e.open,onOpenChange:e=>{e||u()},children:(0,N.jsxs)(pe,{children:[(0,N.jsxs)(Te,{children:[(0,N.jsx)(T,{children:e.title||n(`actionDialog.title`)}),(0,N.jsx)(w,{children:e.description||n(`actionDialog.description`)})]}),(0,N.jsx)(`div`,{className:`grid gap-4 py-4`,children:e.params.map(e=>{let t={...e,label:D(e.label,r),helpText:e.helpText==null?e.helpText:D(e.helpText,r),options:e.options?.map(e=>({...e,label:D(e.label,r)}))};if(t.type===`boolean`||t.type===`checkbox`){let e=i[t.name]===!0;return(0,N.jsxs)(`div`,{className:`grid gap-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(ce,{id:t.name,checked:e,onCheckedChange:e=>d(t.name,e===!0),className:`mt-0.5`}),(0,N.jsxs)(_e,{htmlFor:t.name,className:`font-normal cursor-pointer`,children:[t.label,t.required&&(0,N.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]})]}),o[t.name]&&(0,N.jsx)(`p`,{className:`text-xs text-destructive ml-6`,children:n(`actionDialog.requiredError`,{label:t.label})}),t.helpText&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground ml-6`,children:t.helpText})]},t.name)}let a=t.type===`lookup`||t.type===`reference`;return(0,N.jsxs)(`div`,{className:`grid gap-2`,children:[(0,N.jsxs)(_e,{htmlFor:t.name,children:[t.label,t.required&&(0,N.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),t.type===`select`&&t.options?(0,N.jsxs)(se,{value:i[t.name]??``,onValueChange:e=>d(t.name,e),children:[(0,N.jsx)(he,{id:t.name,className:o[t.name]?`border-destructive`:``,children:(0,N.jsx)(me,{placeholder:t.placeholder||n(`actionDialog.selectPlaceholder`,{label:t.label})})}),(0,N.jsx)(De,{children:t.options.map(e=>(0,N.jsx)(ae,{value:e.value,children:e.label},e.value))})]}):a&&t.referenceTo?(0,N.jsx)(le,{value:i[t.name]??null,onChange:e=>d(t.name,e),field:{name:t.name,type:`lookup`,reference_to:t.referenceTo,display_field:t.displayField,id_field:t.idField,description_field:t.descriptionField,multiple:t.multiple,title_format:t.titleFormat,lookup_columns:t.lookupColumns,lookup_filters:t.lookupFilters,lookup_page_size:t.lookupPageSize,depends_on:t.dependsOn,placeholder:t.placeholder}}):t.type===`textarea`?(0,N.jsx)(ke,{id:t.name,value:i[t.name]??``,onChange:e=>d(t.name,e.target.value),placeholder:t.placeholder,className:o[t.name]?`border-destructive`:``}):t.type===`number`?(0,N.jsx)(Oe,{id:t.name,type:`number`,value:i[t.name]??``,onChange:e=>d(t.name,e.target.value===``?void 0:e.target.valueAsNumber),placeholder:t.placeholder,className:o[t.name]?`border-destructive`:``}):(0,N.jsx)(Oe,{id:t.name,type:[`email`,`url`,`date`,`datetime-local`,`time`,`password`].includes(t.type)?t.type:`text`,value:i[t.name]??``,onChange:e=>d(t.name,e.target.value),placeholder:t.placeholder||(a?n(`actionDialog.lookupPlaceholder`,{label:t.label}):void 0),className:o[t.name]?`border-destructive`:``}),o[t.name]&&(0,N.jsx)(`p`,{className:`text-xs text-destructive`,children:n(`actionDialog.requiredError`,{label:t.label})}),t.helpText&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.helpText}),a&&!t.helpText&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`actionDialog.lookupHelpText`)})]},t.name)})}),(0,N.jsxs)(oe,{children:[(0,N.jsx)(A,{variant:`outline`,onClick:u,children:n(`actionDialog.cancel`)}),(0,N.jsx)(A,{onClick:l,children:n(`actionDialog.confirm`)})]})]})})}function Bt(e,t){if(e!=null)return t.split(`.`).reduce((e,t)=>{if(e!=null)return e[t]},e)}function Vt({state:e,onAcknowledge:t}){let{t:n}=S(),{spec:r,data:i}=e,a=(0,M.useMemo)(()=>r?.fields&&r.fields.length>0?r.fields:[{path:``,label:void 0,format:r?.format??`json`}],[r]);return(0,N.jsx)(O,{open:e.open,onOpenChange:e=>{},children:(0,N.jsxs)(pe,{onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),className:`max-w-lg`,children:[(0,N.jsxs)(Te,{children:[(0,N.jsx)(T,{children:r?.title||n(`actions.resultDialog.defaultTitle`)||`Save this value now`}),r?.description?(0,N.jsx)(w,{children:r.description}):null]}),(0,N.jsx)(`div`,{className:`space-y-4 py-2`,children:a.map((e,t)=>(0,N.jsx)(Ht,{field:e,value:e.path===``?i:Bt(i,e.path),defaultFormat:r?.format},`${e.path}-${t}`))}),(0,N.jsx)(oe,{children:(0,N.jsx)(A,{onClick:t,children:r?.acknowledge||n(`actions.resultDialog.acknowledge`)||`I have saved this`})})]})})}function Ht({field:e,value:t,defaultFormat:n}){let r=e.format??n??`json`,i=e.label,a=r===`qrcode`&&typeof t!=`string`||r===`code-list`&&!Array.isArray(t)||(r===`secret`||r===`text`)&&typeof t!=`string`?`json`:r;return(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[i?(0,N.jsx)(`div`,{className:`text-sm font-medium text-foreground/80`,children:i}):null,a===`qrcode`?(0,N.jsx)(Ut,{value:t}):null,a===`code-list`?(0,N.jsx)(Wt,{value:t}):null,a===`secret`?(0,N.jsx)($,{value:t}):null,a===`text`?(0,N.jsx)(Gt,{value:t}):null,a===`json`?(0,N.jsx)(Kt,{value:t}):null]})}function Z(e){let[t,n]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),1500);return()=>clearTimeout(e)},[t]),{copy:async()=>{if(e!=null)try{await navigator.clipboard.writeText(e),n(!0)}catch{}},copied:t}}function Q({value:e,label:t}){let{copy:n,copied:r}=Z(e);return(0,N.jsxs)(A,{type:`button`,variant:`outline`,size:`sm`,onClick:n,children:[r?(0,N.jsx)(ue,{className:`w-4 h-4`}):(0,N.jsx)(ge,{className:`w-4 h-4`}),t?(0,N.jsx)(`span`,{className:`ml-2`,children:t}):null]})}function Ut({value:e}){let[t,n]=(0,M.useState)(null);return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`div`,{className:`flex justify-center rounded-md border bg-white p-3`,children:t?(0,N.jsx)(`span`,{className:`text-sm text-destructive`,children:t}):(0,N.jsx)(`canvas`,{ref:t=>{!t||!e||(0,wt.toCanvas)(t,e,{width:200,margin:1},e=>{e&&n(e.message)})}})}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-2 py-1 text-xs font-mono`,children:e}),(0,N.jsx)(Q,{value:e})]})]})}function Wt({value:e}){let t=e.join(`
|
|
9
|
-
`);return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`div`,{className:`rounded-md border bg-muted/40 p-2`,children:(0,N.jsx)(`ul`,{className:`space-y-1`,children:e.map((e,t)=>(0,N.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`code`,{className:`flex-1 rounded bg-background px-2 py-1 text-sm font-mono`,children:e}),(0,N.jsx)(Q,{value:e})]},`${t}-${e}`))})}),(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.jsx)(Q,{value:t,label:`Copy all`})})]})}function $({value:e}){let[t,n]=(0,M.useState)(!1);return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 text-sm font-mono break-all`,children:t?e:e.replace(/./g,`•`)}),(0,N.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>n(e=>!e),children:t?(0,N.jsx)(Ee,{className:`w-4 h-4`}):(0,N.jsx)(E,{className:`w-4 h-4`})}),(0,N.jsx)(Q,{value:e})]})}function Gt({value:e}){return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 text-sm font-mono break-all`,children:e}),(0,N.jsx)(Q,{value:e})]})}function Kt({value:e}){let t=(0,M.useMemo)(()=>{try{return JSON.stringify(e,null,2)}catch{return String(e)}},[e]);return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`pre`,{className:`max-h-80 overflow-auto rounded-md border bg-muted/40 p-3 text-xs font-mono`,children:t}),(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.jsx)(Q,{value:t})})]})}function qt(e){return e.kind===`object-form`&&!!e.objectName}function Jt(e){let t={};for(let n of e.fields)n.defaultValue!==void 0&&(t[n.name]=n.defaultValue);return t}function Yt({screen:e,values:t,onValueChange:n,dataSource:r,objects:i,objectForm:a,className:o}){if(qt(e)){let t=Array.isArray(i)?i.find(t=>t?.name===e.objectName):void 0,n=t?t.form?.subforms??t.formViews?.default?.subforms:void 0;return(0,N.jsx)(`div`,{className:xe(`py-2`,o),children:r?(0,N.jsx)(Me,{schema:{type:`object-form`,formType:`simple`,objectName:e.objectName,mode:e.mode===`edit`?`edit`:`create`,recordId:e.mode===`edit`?e.recordId:void 0,...e.defaults?{initialValues:e.defaults}:{},layout:`vertical`,subforms:n,onSuccess:a?.onSuccess,onCancel:a?.onCancel,showSubmit:a?.showSubmit??!0,showCancel:a?.showCancel??!0,submitText:a?.submitText??`Save & Continue`,cancelText:a?.cancelText??`Cancel`},dataSource:r},e.nodeId):(0,N.jsx)(`div`,{className:`text-sm text-destructive py-4`,children:a?.noDataSourceMessage??`This step renders an object form but no data source is available.`})})}return(0,N.jsx)(`div`,{className:xe(`space-y-4 py-2`,o),children:e.fields.map(e=>(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsxs)(_e,{htmlFor:`ff-${e.name}`,className:`text-sm`,children:[e.label||e.name,e.required&&(0,N.jsx)(`span`,{className:`text-destructive`,children:` *`})]}),(0,N.jsx)(Xt,{field:e,value:t[e.name],onChange:t=>n(e.name,t)})]},e.name))})}function Xt({field:e,value:t,onChange:n}){let r=`ff-${e.name}`,i=(e.type||`text`).toLowerCase();if(Array.isArray(e.options)&&e.options.length>0)return(0,N.jsxs)(se,{value:t==null?void 0:String(t),onValueChange:e=>n(e),children:[(0,N.jsx)(he,{id:r,children:(0,N.jsx)(me,{placeholder:e.placeholder||`Select…`})}),(0,N.jsx)(De,{children:e.options.map((e,t)=>(0,N.jsx)(ae,{value:String(e.value),children:e.label},t))})]});if(i===`boolean`||i===`checkbox`)return(0,N.jsx)(ce,{id:r,checked:t===!0,onCheckedChange:e=>n(e===!0)});if(i===`textarea`||i===`markdown`)return(0,N.jsx)(ke,{id:r,value:t??``,placeholder:e.placeholder,onChange:e=>n(e.target.value)});let a=i===`number`||i===`currency`?`number`:i===`email`?`email`:i===`date`?`date`:`text`;return(0,N.jsx)(Oe,{id:r,type:a,value:t??``,placeholder:e.placeholder,onChange:e=>n(a===`number`?e.target.value===``?void 0:Number(e.target.value):e.target.value)})}function Zt({state:e,authFetch:t,baseUrl:n,onClose:r,onComplete:i,dataSource:a,objects:o}){let[s,c]=(0,M.useState)(null),[l,u]=(0,M.useState)(``),[d,f]=(0,M.useState)(``),[p,m]=(0,M.useState)({}),[h,g]=(0,M.useState)(!1);if((0,M.useEffect)(()=>{e&&(c(e.screen),u(e.runId),f(e.flowName),m(Jt(e.screen)))},[e]),!e||!s)return null;let _=(e,t)=>m(n=>({...n,[e]:t})),v=async e=>{let a=await t(`${n}/api/v1/automation/${encodeURIComponent(d)}/runs/${encodeURIComponent(l)}/resume`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({inputs:e})}),o=await a.json().catch(()=>null);if(!a.ok||o?.success===!1){j.error(o?.error||`Resume failed (HTTP ${a.status})`);return}let s=o?.data??{};if(s.success===!1||s.status===`failed`){j.error(s.errorMessage||s.error||`The flow failed to complete.`),r();return}s.status===`paused`&&s.screen?(c(s.screen),u(s.runId||l),m(Jt(s.screen)),j.success(`Saved — next step`)):(j.success(s.successMessage||`Done`),i())},y=async()=>{let e=s.fields.filter(e=>e.required&&(p[e.name]===void 0||p[e.name]===``||p[e.name]===null));if(e.length){j.error(`Please fill: ${e.map(e=>e.label||e.name).join(`, `)}`);return}g(!0);try{await v(p)}catch(e){j.error(e.message)}finally{g(!1)}},b=async e=>{let t=e?.id??e?.data?.id??e?.record?.id,n=s.idVariable&&t!=null?{[s.idVariable]:t}:{};g(!0);try{await v(n)}catch(e){j.error(e.message)}finally{g(!1)}},x=qt(s);return(0,N.jsx)(O,{open:!0,onOpenChange:e=>{!e&&!h&&r()},children:(0,N.jsxs)(pe,{className:x?`sm:max-w-3xl max-h-[90vh] overflow-y-auto`:`sm:max-w-md`,children:[(0,N.jsxs)(Te,{children:[(0,N.jsx)(T,{children:s.title||`Input`}),s.description&&(0,N.jsx)(w,{children:s.description})]}),(0,N.jsx)(Yt,{screen:s,values:p,onValueChange:_,dataSource:a,objects:o,objectForm:{onSuccess:b,onCancel:r,showSubmit:!0,showCancel:!0,submitText:`Save & Continue`,cancelText:`Cancel`}}),!x&&(0,N.jsxs)(oe,{children:[(0,N.jsx)(A,{variant:`outline`,onClick:r,disabled:h,children:`Cancel`}),(0,N.jsx)(A,{onClick:y,disabled:h,children:h?`Submitting…`:`Submit`})]})]})})}function Qt(e){C({objectName:e})}function $t(e,t,n){return(Array.isArray(e?.actions)?e.actions:[]).filter(e=>Array.isArray(e?.locations)&&e.locations.includes(n)).map(n=>({...n,label:t(e.name,n.name,n.label||n.name)}))}function en({appName:e,objects:t,dataSource:n,actionLabel:r,parentObjectName:i,parentRecordId:s,parentTitle:c,children:l}){let u=a(),{execute:d}=h(),[,f]=o(),p=e?`/apps/${e}`:``,m=(0,M.useCallback)(e=>{let t=new URLSearchParams(window.location.search);t.set(Tt,e.recordId??`new`),t.set(Et,e.objectName),e.link?t.set(Dt,`${e.link.field}:${e.link.parentId}`):t.delete(Dt),f(t)},[f]),g=(0,M.useCallback)(async(e,t,n)=>{let r=t?.id??t?._id,{params:i,...a}=n,o={...a,objectName:e,...r==null?{}:{recordId:String(r)},params:{_rowRecord:t}};Array.isArray(i)&&i.length>0&&(o.actionParams=i),(await d(o))?.success&&Qt(e)},[d]);return(0,N.jsx)(te,{value:(0,M.useMemo)(()=>({resolve:({objectName:e,relationshipField:a,parentId:o})=>{let l=t.find(t=>t?.name===e);if(!l||!p)return{};let d=Ft(l),f=t=>{let n=`${p}/${e}/record/${encodeURIComponent(String(t))}`;if(i&&s){let e=Mt(new URLSearchParams(window.location.search).get(Y),{o:i,i:s,...c?{t:c}:{}}),t=new URLSearchParams;return t.set(Y,e),`${n}?${t.toString()}`}return n},h={onView:e=>u(f(e))};d.create&&(h.onCreate=()=>{m({objectName:e,link:a&&o!=null&&o!==``?{field:a,parentId:o}:void 0})}),d.edit&&(h.onEdit=t=>m({objectName:e,recordId:String(t)})),d.delete&&(h.onDelete=async t=>{await n?.delete?.(e,String(t))});let _=$t(l,r,`list_item`);_.length>0&&(h.rowActions=_,h.onRowAction=(t,n)=>g(e,n,t));let v=$t(l,r,`list_toolbar`);return v.length>0&&(h.toolbarActions=v,h.onToolbarAction=t=>g(e,void 0,t)),h}}),[t,p,u,n,r,g,m,i,s,c]),children:l})}var tn=[`regions`,`components`,`children`];function nn(e,t){if(Array.isArray(e)){let n=null;return e.forEach((r,i)=>{let a=nn(r,t);a!==r&&(n??=e.slice(),n[i]=a)}),n??e}if(!e||typeof e!=`object`)return e;let n=e,r=null;n.type===`page:tabs`&&(r={...n},t.defaultTab!==void 0&&(r.defaultTab=t.defaultTab),t.onTabChange&&(r.onTabChange=t.onTabChange));for(let e of tn){let i=(r??n)[e];if(i==null)continue;let a=nn(i,t);a!==i&&(r??={...n},r[e]=a)}return r??e}function rn(e,t,n,r){if(!(!Array.isArray(e)||e.length===0))return e.map(e=>{let i=typeof e==`string`?{label:e,value:e}:e;return{label:r?r(t,n,i.value,i.label):i.label,value:i.value}})}function an(e,t){let n=e.field??e.name,r=e.defaultFromRow&&t.row&&n!=null&&Object.prototype.hasOwnProperty.call(t.row,n)?t.row[n]:void 0;if(!e.field)return{name:e.name??``,label:e.label??e.name??``,type:e.type??`text`,required:e.required??!1,options:e.options,placeholder:e.placeholder,helpText:e.helpText,defaultValue:r??e.defaultValue};let i=e.objectOverride??t.objectName,a=t.objects.find(e=>e?.name===i)?.fields?.[e.field];if(!a)return{name:e.name??e.field,label:e.label??t.fieldLabel(i,e.field,e.field),type:e.type??`text`,required:e.required??!1,options:e.options,placeholder:e.placeholder,helpText:e.helpText,defaultValue:r??e.defaultValue};let o=e.type??a.type??`text`,s=e.options??rn(a.options,i,e.field,t.fieldOptionLabel),c=e.label??t.fieldLabel(i,e.field,a.label??e.field),l=o===`lookup`||o===`reference`?{referenceTo:a.reference_to??a.reference,displayField:a.display_field??a.reference_field,idField:a.id_field,descriptionField:a.description_field,multiple:a.multiple,titleFormat:a.title_format,lookupColumns:a.lookup_columns,lookupFilters:a.lookup_filters,lookupPageSize:a.lookup_page_size,dependsOn:a.depends_on}:{};return{name:e.name??e.field,label:c,type:o,required:e.required??a.required??!1,options:s,placeholder:e.placeholder??a.placeholder,helpText:e.helpText??a.help??a.description,defaultValue:r??e.defaultValue??a.defaultValue,...l}}function on(e,t){return Array.isArray(e)?e.map(e=>an(e,t)):[]}var sn=t({RecordDetailView:()=>mn}),cn={id:`current-user`,name:`Demo User`},ln=new Set([`created_at`,`created_by`,`updated_at`,`updated_by`]),un=new Set([`organization_id`,`tenant_id`,`is_deleted`,`deleted_at`]),dn=[`description`,`notes`,`note`,`remark`,`remarks`,`comments`],fn=new Set([`textarea`,`markdown`,`html`,`rich-text`,`json`,`code`]);function pn(e,t){if(fn.has(t?.type))return!0;let n=e.toLowerCase();return dn.some(e=>n===e||n.endsWith(`_${e}`))}function mn({dataSource:e,objects:t,onEdit:n,objectNameOverride:c,recordIdOverride:l,embedded:h}){let te=s(),w=te.appName,T=c??te.objectName,ae=l??te.recordId,{showDebug:oe}=Re(),{user:E,activeOrganization:se}=u(),D=a(),[ce,le]=o(),O=ce.get(`tab`)??void 0,ue=(0,M.useCallback)(e=>{let t=new URLSearchParams(window.location.search);t.get(`tab`)!==e&&(t.set(`tab`,e),le(t,{replace:!0}))},[le]),pe=i(),me=pe.state?.from,he=(0,M.useMemo)(()=>{if(me?.pathname&&me?.label)return me;let e=jt(new URLSearchParams(pe.search).get(Y)),t=e[e.length-1];if(!t)return;let n=w?`/apps/${w}`:``,r=t.i.length>12?`${t.i.slice(0,8)}…`:t.i;return{pathname:Nt(n,t,e.slice(0,-1)),label:t.t||`#${r}`}},[me,pe.search,w]),{t:k}=S(),{objectLabel:ge,viewLabel:_e,sectionLabel:ve,actionLabel:ye,actionConfirm:be,actionSuccess:xe,actionParamText:Se,actionParamOptionLabel:we,actionDescription:Te,fieldLabel:Ee,fieldOptionLabel:De}=ne(),{isFavorite:Oe,toggleFavorite:ke,refreshLabel:Ae}=Fe(),{addRecentItem:A}=Pe(),[je,Me]=(0,M.useState)(!0),[qe,P]=(0,M.useState)([]),[F,Ye]=(0,M.useState)([]),[I,L]=(0,M.useState)(null),[Xe,Ze]=(0,M.useState)({}),[Qe,$e]=(0,M.useState)(null),[et,tt]=(0,M.useState)(!1),[R,nt]=(0,M.useState)(),z=t.find(e=>e.name===T);Je(h?void 0:R);let B=ae,rt=b(T||void 0,B||void 0),V=(0,M.useCallback)(()=>{T&&C({objectName:T,recordId:B||void 0})},[T,B]),it=Ct(T,B),H=(0,M.useMemo)(()=>!T||!B?null:{id:`record:${T}:${B}`,label:R||B||``,href:`/apps/${w}/${T}/record/${B}`,type:`record`},[w,T,B,R]),at=H?Oe(H.id):!1,ot=(0,M.useCallback)(()=>{H&&ke(H)},[H,ke]),{page:st,slots:U}=ee(T),ct=(0,M.useMemo)(()=>{if(typeof window<`u`)try{let e=new URLSearchParams(window.location.search).get(`renderViaSchema`);if(e===`0`||e===`false`)return!1;if(e===`1`||e===`true`)return!0}catch{}return z?.detail?.renderViaSchema!==!1},[z]),lt=(0,M.useMemo)(()=>st||!z||!ct&&!U?null:He(z,U?{slots:U}:void 0),[ct,st,U,z]),W=st||lt,[G,ut]=(0,M.useState)(null),[dt,K]=(0,M.useState)(`idle`);(0,M.useEffect)(()=>{let t=!1;if(!W||!B||!T||!e?.findOne){ut(null),K(`idle`);return}let n=g(z?.fields),r=n.length>0?{$expand:n}:void 0,i=()=>{K(`loading`),(r?e.findOne(T,B,r):e.findOne(T,B)).then(e=>{t||(e&&typeof e==`object`?(ut(e),K(`loaded`)):(ut(null),K(`missing`)))}).catch(()=>{t||(ut(null),K(`missing`))})};i();let a=e=>{let t=e.detail||{};t.objectName!==T||String(t.recordId)!==String(B)||i()};return window.addEventListener(`objectui:record-changed`,a),()=>{t=!0,window.removeEventListener(`objectui:record-changed`,a)}},[W,T,B,e,z,rt]),(0,M.useEffect)(()=>{if(!G||typeof G!=`object`||!z)return;let e=y(z,G);e&&e!==`Untitled`&&e!==R&&nt(e)},[G,z,R]),(0,M.useEffect)(()=>{if(!T||!B||!w||!R)return;let e=`record:${T}:${B}`,t=`/apps/${w}/${T}/record/${B}`;A({id:e,label:R,href:t,type:`record`}),Ae(e,R)},[w,T,B,R,A,Ae]);let[ft,pt]=(0,M.useState)({open:!1,message:``}),[mt,ht]=(0,M.useState)({open:!1,params:[]}),[q,gt]=(0,M.useState)({open:!1}),_t=(0,M.useCallback)((e,t)=>new Promise(n=>{gt({open:!0,spec:e,data:t,resolve:n})}),[]),vt=(0,M.useCallback)((e,t)=>new Promise(n=>{pt({open:!0,message:e,options:t,resolve:n})}),[]),yt=(0,M.useCallback)((e,n)=>new Promise(r=>{let i=typeof n?.objectName==`string`&&n.objectName?n.objectName:void 0,a=n?.params&&!Array.isArray(n.params)?n.params._rowRecord:void 0,o=on(e,{objectName:i||T||z?.name||``,objects:t||[],fieldLabel:Ee,fieldOptionLabel:De,row:a}),s=i||T||z?.name,c=o.map(e=>({...e,label:Se(s,n?.name,e.name,`label`,e.label)??e.label,placeholder:Se(s,n?.name,e.name,`placeholder`,e.placeholder)??e.placeholder,helpText:Se(s,n?.name,e.name,`helpText`,e.helpText)??e.helpText,options:Array.isArray(e.options)?e.options.map(t=>({...t,label:we(s,n?.name,e.name,t.value,t.label)})):e.options}));ht({open:!0,params:c,title:n?.label||n?.title,description:Te(s,n?.name,n?.description),resolve:r})}),[T,z,t,Ee,De,Se,we]),xt=v({dataSource:e,onUndo:e=>{e?.objectName?C({objectName:e.objectName,recordId:e.recordId}):V(),j.success(`Change undone`)}}),St=(0,M.useCallback)((e,t)=>{if(t?.type===`error`){j.error(e);return}if(t?.undo){j.success(e,{duration:t.duration,action:{label:t.undo.label||`Undo`,onClick:()=>{xt.undo()}}});return}j.success(e,{duration:t?.duration})},[xt]),wt=(0,M.useCallback)((e,t)=>{t?.external||t?.newTab?window.open(e,`_blank`,`noopener,noreferrer`):D(e)},[D]),J=(0,M.useMemo)(()=>d(),[]),Tt=(0,M.useCallback)(async t=>{try{let n=t.target||t.name,r=t.params&&!Array.isArray(t.params)?t.params._rowRecord:void 0,i={...t.params||{}};delete i._rowRecord;let a=typeof n==`string`?n:``;if(a.startsWith(`/`)||/^https?:\/\//i.test(a)){let e=a;r&&/\{[a-z_][a-z0-9_]*\}/i.test(e)&&(e=e.replace(/\{([a-z_][a-z0-9_]*)\}/gi,(e,t)=>{let n=r[t];return n==null?``:encodeURIComponent(String(n))}));let n=e.startsWith(`http`)?e:`${e}`,o=t.bodyShape&&typeof t.bodyShape==`object`&&t.bodyShape.wrap?t.bodyShape.wrap:void 0,s=o?{[o]:i}:{...i};if(t.recordIdParam){let e=t.recordIdField||`id`,n=r?.[e]??t.recordId??(!t.objectName||t.objectName===T?G?.[e]:void 0);n!=null&&(s[t.recordIdParam]=n)}/\/api\/v1\/auth\//.test(e)&&!s.organizationId&&se?.id&&(s.organizationId=se.id),t.bodyExtra&&typeof t.bodyExtra==`object`&&Object.assign(s,t.bodyExtra);let c=(t.method||`POST`).toUpperCase(),l={method:c,headers:{"Content-Type":`application/json`},credentials:`include`};c!==`GET`&&c!==`DELETE`&&(l.body=JSON.stringify(s));let u=await J(n,l);if(!u.ok){let e=null;try{e=await u.json()}catch{}let t=e?.error?.message||e?.error||e?.message||`HTTP ${u.status}`;return{success:!1,error:typeof t==`string`?t:`HTTP ${u.status}`}}let d=await u.json().catch(()=>({}));return t.refreshAfter===!0&&V(),{success:!0,data:d,reload:t.refreshAfter===!0}}t.bodyExtra&&typeof t.bodyExtra==`object`&&Object.assign(i,t.bodyExtra);let o;switch(n){case`opportunity_change_stage`:await e.update(T,B,{stage:i.new_stage});break;case`opportunity_mark_won`:await e.update(T,B,{stage:`closed_won`});break;case`opportunity_mark_lost`:await e.update(T,B,{stage:`closed_lost`,loss_reason:i.loss_reason});break;default:{let n=t.objectName??T,r=t.recordId??B,a=n===T&&String(r)===String(B);if(Object.keys(i).length>0&&n&&r!=null){if(t.undoable&&a&&G){let e={};for(let t of Object.keys(i))e[t]=G[t]??null;o={id:`undo-${n}-${r}-${Date.now()}`,type:`update`,objectName:n,recordId:String(r),timestamp:Date.now(),description:t.label||`Undo ${n}`,undoData:e,redoData:{...i}}}await e.update(n,String(r),i)}break}}let s=t.refreshAfter===!0;return(s||o)&&V(),{success:!0,reload:s,undo:o}}catch(e){return{success:!1,error:e.message}}},[e,T,B,G,J,se]),{modalHandler:Et,modalElement:Dt}=Ne(e),Ot=(0,M.useCallback)(async e=>{let t=e.target||e.name;if(!t)return{success:!1,error:`No flow target provided for flow action`};try{let n=await J(`/api/v1/automation/${encodeURIComponent(t)}/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recordId:e.recordId??B,objectName:e.objectName??T,params:e.params??{}})}),r=await n.json().catch(()=>null);if(!n.ok||r&&r.success===!1)return{success:!1,error:r?.error||`Flow "${t}" failed (HTTP ${n.status})`};let i=r?.data??{};if(i.status===`paused`&&i.screen)return L({flowName:t,runId:i.runId,screen:i.screen}),{success:!0,silent:!0};let a=e.refreshAfter!==!1;return a&&V(),{success:!0,data:r?.data,reload:a}}catch(e){return{success:!1,error:e.message}}},[J,B,T]),kt=(0,M.useRef)(new Set),At=(0,M.useCallback)(async e=>{let t=e.target||e.name;if(!t)return{success:!1,error:`No action target provided`};let n=e.params&&!Array.isArray(e.params)?e.params:{},r=`${t}:${B??``}`;if(kt.current.has(r))return{success:!1,error:`Action already in progress`};kt.current.add(r);let i=null;if(e.opensInNewTab)try{i=window.open(`about:blank`,`_blank`),i&&(i.document.write(`<!doctype html><meta charset="utf-8"><title>正在打开… Opening…</title><body style="margin:0;font-family:system-ui,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;gap:16px;color:#4b5563"><div style="width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:#6366f1;border-radius:50%;animation:s .8s linear infinite"></div><div>正在为你打开环境…</div><style>@keyframes s{to{transform:rotate(360deg)}}</style></body>`),i.document.close())}catch{i=null}try{let r=typeof e.newTabUrl==`string`?e.newTabUrl:``;if(e.opensInNewTab&&r){if(B==null){if(i)try{i.close()}catch{}return{success:!1,error:`This action runs on a single record — no record id available.`}}let t=`${window.location.origin}${r.replace(`{recordId}`,encodeURIComponent(String(B)))}`;if(i)try{i.location.href=t}catch{try{i.close()}catch{}window.location.href=t}else{let e=null;try{e=window.open(t,`_blank`)}catch{e=null}e||j(`浏览器拦截了弹窗 / Popup blocked`,{description:`点击在新标签页打开环境`,action:{label:`打开环境`,onClick:()=>{try{window.open(t,`_blank`)}catch{window.location.href=t}}},duration:1e4})}return e.refreshAfter===!0&&V(),{success:!0}}let a=e.objectName||T||`global`,o=await J(`/api/v1/actions/${encodeURIComponent(a)}/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recordId:e.recordId??B,params:n})}),s=await o.json().catch(()=>null),c=s?.data,l=c&&typeof c==`object`&&c.success===!1;if(!o.ok||s&&s.success===!1||l){let e=l&&c.error||s?.error||`Action "${t}" failed (HTTP ${o.status})`;if(i)try{i.close()}catch{}return{success:!1,error:e}}let u=e.refreshAfter!==!1;u&&V();let d=s?.data;if(d&&typeof d==`object`&&typeof d.redirectUrl==`string`){let e=d.redirectUrl;if(i)try{i.location.href=e}catch{try{i.close()}catch{}window.location.href=e}else{let t=null;try{t=window.open(e,`_blank`)}catch{t=null}t||j(`浏览器拦截了弹窗 / Popup blocked`,{description:`点击在新标签页打开环境`,action:{label:`打开环境`,onClick:()=>{try{window.open(e,`_blank`)}catch{window.location.href=e}}},duration:1e4})}}else if(i)try{i.close()}catch{}return{success:!0,data:d,reload:u}}catch(e){if(i)try{i.close()}catch{}return{success:!1,error:e.message}}finally{kt.current.delete(r)}},[J,B,T]),X=Ie(T,B,E?.id),Pt=(0,M.useRef)(X);Pt.current=X;let It=(0,M.useCallback)(async e=>{let t=e.target||e.name,n=e.params&&!Array.isArray(e.params)?e.params:{};try{if(t===`approve_request`)await Pt.current.approve({comment:n.comment});else if(t===`reject_request`)await Pt.current.reject({comment:n.comment});else return{success:!1,error:`Unknown approval target: ${t}`};return V(),{success:!0,reload:!0}}catch(e){return{success:!1,error:e?.message||String(e)}}},[]),Bt=(0,M.useMemo)(()=>Le(z,t),[z,t]);(0,M.useEffect)(()=>{if(W||!e||!B||Bt.length===0)return;let t=!1;return Promise.all(Bt.map(({childObject:t,referenceField:n})=>e.find(t,{$filter:{[n]:B}}).then(e=>({childObject:t,items:Array.isArray(e)?e:e?.data||[]})).catch(e=>(console.warn(`[RecordDetailView] Failed to fetch related ${t}:`,e),{childObject:t,items:[]})))).then(e=>{if(t)return;let n={};for(let{childObject:t,items:r}of e)n[t]=r;Ze(n)}),()=>{t=!0}},[e,B,Bt,z,W]);let Ht=(0,M.useMemo)(()=>!z||z.name===`sys_audit_log`||z.enable?.trackHistory!==!0?!1:t.some(e=>e.name===`sys_audit_log`),[z,t]);(0,M.useEffect)(()=>{if(!e||!B||!z||!Ht){$e(null);return}let t=!1;return tt(!0),e.find(`sys_audit_log`,{$filter:{record_id:B,object_name:z.name},$orderby:{created_at:`desc`},$top:50,$select:[`id`,`created_at`,`action`,`user_id`,`old_value`,`new_value`]}).then(async n=>{if(t)return;let r=Array.isArray(n)?n:n?.data||[],i=Array.from(new Set(r.map(e=>e?.user_id).filter(e=>typeof e==`string`&&e.length>0))),a=new Map;if(i.length>0)try{let t=await e.find(`sys_user`,{$filter:{id:{$in:i}},$top:i.length,$select:[`id`,`name`,`email`,`image`]}),n=Array.isArray(t)?t:t?.data||[];a=new Map(n.map(e=>[e.id,{name:e.name||e.email||null,image:e.image||null}]))}catch(e){console.warn(`[RecordDetailView] Failed to resolve audit user names:`,e)}let o={};for(let[e,t]of Object.entries(z.fields||{}))t?.label&&(o[e]=t.label);let s=e=>{if(!e)return null;if(typeof e==`object`)return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return null},c=r.map(e=>{let t=e?.user_id?a.get(e.user_id):void 0,n=s(e?.old_value)||{},r=s(e?.new_value)||{},i=new Set([...Object.keys(n),...Object.keys(r)]),c=Array.from(i).filter(e=>JSON.stringify(n[e])!==JSON.stringify(r[e])).map(e=>({field:e,label:o[e]||e,from:n[e],to:r[e]}));return{...e,user_name:t?.name??null,user_avatar:t?.image??null,changes:c.length>0?c:void 0}});$e(c)}).catch(e=>{t||(console.warn(`[RecordDetailView] Failed to fetch sys_audit_log:`,e),$e([]))}).finally(()=>{t||tt(!1)}),()=>{t=!0}},[e,B,z,Ht]),(0,M.useEffect)(()=>{if(!e)return;let t=!1,n=E?[{id:String(E.id),label:E.name||E.email||String(E.id),avatarUrl:E.image||void 0}]:[];return(async()=>{try{let r=await e.find(`sys_user`,{$top:50,$select:[`id`,`name`,`email`,`image`]});if(t)return;let i=(Array.isArray(r)?r:r?.data||[]).map(e=>({id:String(e.id),label:e.name||e.email||String(e.id),avatarUrl:e.image||void 0})).filter(e=>e.label),a=new Set(n.map(e=>e.id)),o=[...n,...i.filter(e=>!a.has(e.id))];Ye(o.length>0?o:n)}catch{if(t)return;Ye(n)}})(),()=>{t=!0}},[e,E?.id,E?.name,E?.email]);let Z=(0,M.useMemo)(()=>E?{id:E.id,name:E.name,avatar:E.image}:cn,[E?.id,E?.name,E?.image]);(0,M.useEffect)(()=>{if(!e||!T||!B)return;let t=`${T}:${B}`,n=e=>{if(!e)return;let t;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return}else typeof e==`object`&&(t=e);if(t)return Object.entries(t).map(([e,t])=>({emoji:e,count:Array.isArray(t)?t.length:0,reacted:Array.isArray(t)&&t.includes(Z.id)}))};e.find(`sys_comment`,{$filter:{thread_id:t},$orderby:{created_at:`asc`}}).then(e=>{if(!e?.data?.length)return;let t=e.data.map(e=>({id:e.id,type:`comment`,actor:e.author_name??k(`detail.unknownUser`,{defaultValue:`Unknown`}),actorAvatarUrl:e.author_avatar_url??void 0,body:e.body??``,createdAt:e.created_at,updatedAt:e.updated_at,parentId:e.parent_id??void 0,reactions:n(e.reactions)}));P(e=>{let n=new Map;for(let r of[...e,...t])n.set(String(r.id),r);return Array.from(n.values()).sort((e,t)=>(e.createdAt?Date.parse(e.createdAt):0)-(t.createdAt?Date.parse(t.createdAt):0))})}).catch(()=>{});let r={created:`field_change`,updated:`field_change`,deleted:`field_change`,assigned:`field_change`,shared:`field_change`,system:`system`,completed:`task`,commented:void 0,mentioned:void 0,login:void 0,logout:void 0};e.find(`sys_activity`,{$filter:{object_name:T,record_id:B},$orderby:{timestamp:`asc`},$top:200}).then(e=>{if(!e?.data?.length)return;let t=[];for(let n of e.data){let e=r[n.type];if(!e)continue;let i=n.timestamp;(!i||i===`NOW()`||Number.isNaN(Date.parse(i)))&&(i=n.created_at),t.push({id:n.id,type:e,actor:n.actor_name??k(`detail.systemActor`,{defaultValue:`System`}),actorAvatarUrl:n.actor_avatar_url??void 0,body:n.summary??``,createdAt:i,sourceObject:n.source_object??void 0,sourceId:n.source_id??void 0})}t.length&&P(e=>{let n=new Map;for(let r of[...e,...t])n.set(String(r.id),r);return Array.from(n.values()).sort((e,t)=>(e.createdAt?Date.parse(e.createdAt):0)-(t.createdAt?Date.parse(t.createdAt):0))})}).catch(()=>{})},[e,T,B,Z]);let Q=(0,M.useCallback)(async t=>{let n={id:crypto.randomUUID(),type:`comment`,actor:Z.name,actorAvatarUrl:`avatar`in Z?Z.avatar:void 0,body:t,createdAt:new Date().toISOString()};if(P(e=>[...e,n]),e){let r=`${T}:${B}`,i=Ve(t,F);e.create(`sys_comment`,{id:n.id,thread_id:r,author_id:Z.id,author_name:Z.name,author_avatar_url:`avatar`in Z?Z.avatar:void 0,body:t,mentions:JSON.stringify(i),created_at:n.createdAt}).catch(()=>{})}},[Z,e,T,B,F]),Ut=(0,M.useCallback)(async(t,n)=>{let r={id:crypto.randomUUID(),type:`comment`,actor:Z.name,actorAvatarUrl:`avatar`in Z?Z.avatar:void 0,body:n,createdAt:new Date().toISOString(),parentId:t};if(P(e=>[...e,r].map(e=>e.id===t?{...e,replyCount:(e.replyCount??0)+1}:e)),e){let i=`${T}:${B}`,a=Ve(n,F);e.create(`sys_comment`,{id:r.id,thread_id:i,author_id:Z.id,author_name:Z.name,author_avatar_url:`avatar`in Z?Z.avatar:void 0,body:n,mentions:JSON.stringify(a),created_at:r.createdAt,parent_id:t}).catch(()=>{})}},[Z,e,T,B,F]),Wt=(0,M.useCallback)((t,n)=>{P(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.reactions??[]],a=i.findIndex(e=>e.emoji===n);if(a>=0){let e=i[a];e.reacted?e.count<=1?i.splice(a,1):i[a]={...e,count:e.count-1,reacted:!1}:i[a]={...e,count:e.count+1,reacted:!0}}else i.push({emoji:n,count:1,reacted:!0});let o={...r,reactions:i};if(e){let n=Z.id,r={};for(let e of i){let t=[];for(e.reacted&&t.push(n);t.length<e.count;)t.push(`__other__`);r[e.emoji]=t}e.update(`sys_comment`,String(t),{reactions:JSON.stringify(r)}).catch(()=>{})}return o}))},[Z.id,e]);(0,M.useEffect)(()=>{Me(!0),queueMicrotask(()=>Me(!1))},[T,ae]);let $=(0,M.useMemo)(()=>{if(!z)return{type:`detail-view`};let n=z.primaryField||z.nameField||z.displayNameField||Object.keys(z.fields||{}).find(e=>e===`name`||e===`title`),r=(()=>{let e=e=>{let t=z.fields[e],n=t.reference_to||t.reference;return{name:e,label:t.label||e,type:t.type||`text`,...t.options&&{options:t.options},...n&&{reference_to:n},...t.reference_field&&{reference_field:t.reference_field},...t.currency&&{currency:t.currency}}},t=t=>{let n=t.filter(e=>!pn(e,z.fields[e])),r=t.filter(e=>pn(e,z.fields[e]));return r.length===0||n.length===0?[{showBorder:!1,fields:t.map(e)}]:[{showBorder:!1,fields:n.map(e)},{name:`details`,title:ve(z.name,`details`,k(`detail.sectionMoreDetails`,`More details`)),collapsible:!0,defaultCollapsed:!1,showBorder:!0,fields:r.map(e)}]},n=Ue(z);return n?n.flatMap(e=>e.name?[{...e,title:ve(z.name,e.name,e.title),showBorder:!0}]:t(e.fields.map(e=>e.name))):t(Object.keys(z.fields||{}).filter(e=>!ln.has(e)&&!un.has(e)&&!z.fields[e]?.hidden))})(),i=(()=>{let e=new Set,t=(z.actions||[]).filter(t=>t.locations?.includes(`record_header`)?t.name?e.has(t.name)?!1:(e.add(t.name),!0):!0:!1).map(e=>({...e,label:ye(z.name,e.name,e.label||e.name),...e.confirmText!==void 0&&{confirmText:be(z.name,e.name,e.confirmText)},...e.successMessage!==void 0&&{successMessage:xe(z.name,e.name,e.successMessage)}}));if(X.available&&X.canDecide){let e={name:`comment`,label:k(`approvals.comment`,{defaultValue:`Comment (optional)`}),type:`text`,multiline:!0};t.push({name:`approve_request`,type:`approval`,target:`approve_request`,label:k(`approvals.approve`,{defaultValue:`Approve`}),icon:`check`,variant:`primary`,order:-100,locations:[`record_header`],refreshAfter:!0,collectParams:[e],successMessage:k(`approvals.approveSuccess`,{defaultValue:`Approved`})}),t.push({name:`reject_request`,type:`approval`,target:`reject_request`,label:k(`approvals.reject`,{defaultValue:`Reject`}),icon:`x`,variant:`destructive`,order:-99,locations:[`record_header`],refreshAfter:!0,confirmText:k(`approvals.rejectConfirm`,{defaultValue:`Reject this approval request?`}),collectParams:[e],successMessage:k(`approvals.rejectSuccess`,{defaultValue:`Rejected`})})}return t})(),a=z.highlightFields??[],o=(Array.isArray(a)?a:[]).map(e=>{let t=typeof e==`string`?e:e?.name;if(!t)return null;let n=z.fields?.[t];return{name:t,label:n?.label||t,...n?.type?{type:n.type}:{}}}).filter(e=>!!e),s=w?`/apps/${w}`:``,c=Bt.map(({childObject:n,childLabel:r,referenceField:i,title:a,columns:o})=>{let c=t.find(e=>e.name===n),l=B||``,u=a||(c?ge({name:c.name,label:c.label||r}):r),d=()=>{let e=new URLSearchParams({[i]:l}).toString();return`${s}/${n}/new${e?`?${e}`:``}`},f=()=>{let e=new URLSearchParams({[`filter[${i}]`]:l}).toString();return`${s}/${n}${e?`?${e}`:``}`},p=e=>{let t=e?.id||e?._id;return t?`${s}/${n}/record/${encodeURIComponent(String(t))}/edit`:null},m=e=>{let t=e?.id||e?._id;if(!t)return null;let r=`${s}/${n}/record/${encodeURIComponent(String(t))}`;if(T&&B){let e=Mt(new URLSearchParams(window.location.search).get(Y),{o:T,i:B,...R?{t:R}:{}}),t=new URLSearchParams;return t.set(Y,e),`${r}?${t.toString()}`}return r},h=s?()=>D(d()):void 0,g=s?()=>D(f()):void 0,_=s?e=>{let t=m(e);t&&D(t)}:void 0,v=s?e=>{let t=p(e);t&&D(t)}:void 0,y=e&&l?async t=>{let r=t?.id||t?._id;if(r)try{await e.delete(n,r),j.success(k(`detail.deleteSuccess`,{defaultValue:`Deleted`})),Ze(e=>({...e,[n]:(e[n]||[]).filter(e=>(e.id||e._id)!==r)}))}catch(e){j.error(e?.message||k(`detail.deleteError`,{defaultValue:`Delete failed`}))}}:void 0;return{title:u,type:`table`,api:n,data:Xe[n]||[],referenceField:i,...Array.isArray(o)&&o.length>0?{columns:o}:{},icon:c?.icon,displayField:c?.nameField||c?.displayNameField||(Array.isArray(c?.highlightFields)?c.highlightFields[0]:void 0),onNew:h,onViewAll:g,onRowClick:_,onRowEdit:v,onRowDelete:y}}),l=Ft(z);return{type:`detail-view`,objectName:z.name,resourceId:B,showBack:!h,onBack:`history`,showEdit:l.edit,title:z.label,primaryField:n,sections:r,autoTabs:!0,defaultTab:O,onTabChange:ue,autoDiscoverRelated:!0,...Ht&&{history:{entries:Qe??[],loading:et&&Qe===null}},...c.length>0&&{related:c},...o.length>0&&{highlightFields:o},...i.length>0&&{actions:[{type:`action:bar`,location:`record_header`,actions:i}]}}},[z?.name,B,Xe,w,D,e,k,ge,t,Ht,Qe,et,X.available,X.canDecide,X.pendingRequest,X.latestRequest,h,O,ue]);if(je)return(0,N.jsx)(Ke,{});if(!z)return(0,N.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,N.jsxs)(fe,{children:[(0,N.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,N.jsx)(Ce,{className:`h-6 w-6 text-muted-foreground`})}),(0,N.jsx)(ie,{children:k(`empty.objectNotFound`)}),(0,N.jsx)(re,{children:k(`empty.objectNotFoundDescription`,{name:T})})]})});if(W&&dt===`missing`)return(0,N.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,N.jsxs)(fe,{children:[(0,N.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,N.jsx)(Ce,{className:`h-6 w-6 text-muted-foreground`})}),(0,N.jsx)(ie,{children:k(`empty.recordNotFound`,{defaultValue:`Record not found`})}),(0,N.jsx)(re,{children:k(`empty.recordNotFoundDescription`,{defaultValue:`The record you are looking for does not exist or may have been deleted.`})})]})});if(W){let i=W?.disableDiscussion===!0,a=Lt(W),o=!i&&!a,s=(()=>{let e=$.actions;if(!Array.isArray(e))return[];let t=e.find(e=>Array.isArray(e?.actions))?.actions??e;return Array.isArray(t)?t:[]})(),c=(()=>{let t=Ft(z),r=[];return t.edit&&(r.push({name:`sys_inline_edit`,label:k(`detail.editFieldsInline`,{defaultValue:`Edit fields`}),type:`script`,locations:[`record_header`],variant:`outline`,onClick:()=>{window.dispatchEvent(new CustomEvent(`objectui:record:inline-edit-toggle`,{detail:{recordId:B,objectName:T}}))}}),r.push({name:`sys_edit`,label:k(`detail.edit`,{defaultValue:`Edit`}),type:`script`,locations:[`record_header`],variant:`default`,onClick:()=>n({id:B})})),r.push({name:`sys_share`,label:k(`detail.share`,{defaultValue:`Share`}),type:`script`,locations:[`record_header`],variant:`outline`,onClick:async()=>{try{if(navigator.share){await navigator.share({title:document.title,url:window.location.href});return}}catch{return}try{await navigator.clipboard.writeText(window.location.href),j.success(k(`detail.linkCopied`,{defaultValue:`Link copied`}))}catch(e){j.error(k(`detail.linkCopyFailed`,{defaultValue:`Failed to copy link`})+(e?.message?`: ${e.message}`:``))}}}),t.delete&&r.push({name:`sys_delete`,label:k(`detail.delete`,{defaultValue:`Delete`}),type:`script`,locations:[`record_header`],variant:`destructive`,onClick:async()=>{let t=k(`detail.deleteConfirmation`,{defaultValue:`Are you sure you want to delete this record?`});if(window.confirm(t))try{await e.delete(T,B),j.success(k(`detail.deleted`,{defaultValue:`Record deleted`}));let t=w?`/apps/${w}`:``;D(`${t}/${T}`,{replace:!0})}catch(e){j.error(e?.message||`Delete failed`)}}}),r})(),l=s.length>0?s:void 0,u=Array.isArray($.related)?$.related.filter(e=>e?.api&&e?.referenceField).map(e=>{let t=Bt.find(t=>t.childObject===e.api&&t.referenceField===e.referenceField);return{title:e.title,objectName:e.api,relationshipField:e.referenceField,...Array.isArray(e.columns)?{columns:e.columns}:{},...typeof e.pageSize==`number`?{limit:e.pageSize}:{},...e.icon?{icon:e.icon}:{},...t?.isPrimary?{isPrimary:!0}:{}}}):void 0,d=$.history?{entries:$.history.entries??[],loading:!!$.history.loading,emptyText:$.history.emptyText}:void 0,g=st?W:He(z,{sections:$.sections,highlightFields:Array.isArray($.highlightFields)?$.highlightFields.map(e=>typeof e==`string`?e:e?.name).filter(e=>!!e):void 0,headerActions:l,related:u,history:d,...U?{slots:U}:{}});return(0,N.jsxs)(`div`,{className:`h-full bg-background overflow-hidden flex flex-col relative`,children:[(0,N.jsxs)(`div`,{className:`absolute top-2 sm:top-4 right-2 sm:right-4 z-50 flex items-center gap-2`,children:[it.length>0&&(0,N.jsx)(bt,{users:it,size:`sm`,maxVisible:3,showStatus:!0}),(0,N.jsx)(Ge,{managedBy:z?.managedBy})]}),(0,N.jsx)(x,{objectName:T,recordId:B,data:G,objectSchema:z,dataSource:e,embedded:h,headerSystemActions:c,isFavorite:at,onToggleFavorite:H?ot:void 0,children:(0,N.jsx)(f,{children:(0,N.jsx)(m,{items:qe,onAddComment:Q,onAddReply:Ut,onToggleReaction:Wt,mentionSuggestions:F,children:(0,N.jsxs)(p,{context:{record:G||{},objectName:T,user:Z},onConfirm:vt,onToast:St,onNavigate:wt,onParamCollection:yt,onResultDialog:_t,onModal:Et,handlers:{api:Tt,flow:Ot,script:At,approval:It},children:[(0,N.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-row`,children:[(0,N.jsxs)(`div`,{className:`flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48`,children:[he?.pathname&&he?.label&&(0,N.jsxs)(r,{to:he.pathname,className:`inline-flex items-center gap-1 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,N.jsx)(de,{className:`h-4 w-4`}),(0,N.jsx)(`span`,{children:he.label})]}),(0,N.jsx)(en,{appName:w,objects:t,dataSource:e,actionLabel:ye,parentObjectName:T,parentRecordId:B??void 0,parentTitle:R,children:(0,N.jsx)(_,{schema:nn(g,{defaultTab:O,onTabChange:ue})})}),o&&(0,N.jsx)(`div`,{className:`mt-6`,children:(0,N.jsx)(We,{config:{position:`bottom`,collapsible:!1,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0}},items:qe,onAddComment:Q,onAddReply:Ut,onToggleReaction:Wt,mentionSuggestions:F})})]}),(0,N.jsx)(ze,{open:oe,sections:[{title:`Page Schema`,data:g}]})]}),Dt]})})})}),(0,N.jsx)(Rt,{state:ft,onOpenChange:e=>{e||pt(e=>({...e,open:!1}))}}),(0,N.jsx)(zt,{state:mt,onOpenChange:e=>{e||ht(e=>({...e,open:!1}))}}),(0,N.jsx)(Vt,{state:q,onAcknowledge:()=>{q.resolve?.(),gt({open:!1})}}),(0,N.jsx)(Zt,{state:I,authFetch:J,baseUrl:``,dataSource:e,objects:t,onClose:()=>L(null),onComplete:()=>{L(null),V()}})]})}return(0,N.jsxs)(`div`,{className:`h-full bg-background overflow-hidden flex flex-col relative`,children:[(0,N.jsxs)(`div`,{className:`absolute top-2 sm:top-4 right-2 sm:right-4 z-50 flex items-center gap-2`,children:[it.length>0&&(0,N.jsx)(bt,{users:it,size:`sm`,maxVisible:3,showStatus:!0}),(0,N.jsx)(Ge,{managedBy:z?.managedBy})]}),(0,N.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-row`,children:[(0,N.jsx)(`div`,{className:`flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48`,children:(0,N.jsx)(`div`,{className:`mx-auto w-full max-w-[1400px]`,children:(0,N.jsxs)(p,{context:{record:{},objectName:T,user:Z},onConfirm:vt,onToast:St,onNavigate:wt,onParamCollection:yt,onResultDialog:_t,onModal:Et,handlers:{api:Tt,flow:Ot,script:At,approval:It},children:[(0,N.jsx)(Be,{schema:$,dataSource:e,objectLabel:ge({name:z.name,label:z.label}),isFavorite:at,onToggleFavorite:H?ot:void 0,onDataLoaded:e=>{if(!e||typeof e!=`object`)return;let t=y(z,e);t&&t!==R&&t!==`Untitled`&&nt(t)},onEdit:()=>{n({id:B})},discussionSlot:(0,N.jsx)(We,{config:{position:`bottom`,collapsible:!1,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0}},items:qe,onAddComment:Q,onAddReply:Ut,onToggleReaction:Wt})}),Dt]})})}),(0,N.jsx)(ze,{open:oe,sections:[{title:`View Schema`,data:$}]})]}),(0,N.jsx)(Rt,{state:ft,onOpenChange:e=>{e||pt(e=>({...e,open:!1}))}}),(0,N.jsx)(zt,{state:mt,onOpenChange:e=>{e||ht(e=>({...e,open:!1}))}}),(0,N.jsx)(Vt,{state:q,onAcknowledge:()=>{q.resolve?.(),gt({open:!1})}}),(0,N.jsx)(Zt,{state:I,authFetch:J,baseUrl:``,dataSource:e,objects:t,onClose:()=>L(null),onComplete:()=>{L(null),V()}})]})}export{gt as C,F as D,P as E,bt as S,K as T,Tt as _,Yt as a,jt as b,Vt as c,Ft as d,Ot as f,Et as g,Dt as h,Zt as i,zt as l,J as m,sn as n,Jt as o,kt as p,on as r,qt as s,mn as t,Rt as u,Y as v,ft as w,St as x,Nt as y};
|