@nocobase/client-v2 2.1.0-beta.41 → 2.1.0-beta.42

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/es/index.mjs CHANGED
@@ -162,7 +162,7 @@ import*as __rspack_external__ant_design_icons_a8184985 from"@ant-design/icons";i
162
162
  ... (stack truncated)`}function w(e){let t=String(e||"").split("\n"),l=new Set;for(let e=0;e<t.length;e++){let o=t[e];(f.test(o)||g.test(o))&&l.add(e)}if(0===l.size)return()=>!1;let o=[0];for(let e=1;e<t.length;e++)o[e]=o[e-1]+t[e-1].length+1;let n=e=>{let t=0,l=o.length-1,n=0;for(;t<=l;){let i=t+l>>1;o[i]<=e?(n=i,t=i+1):l=i-1}return n};return e=>l.has(n(e))}function S(e,t){let l=Math.max(0,Math.min(e.length,Math.floor(t))),o=e.lineAt(l);return{line:o.number,column:l-o.from+1}}function k(e){return[...e].sort((e,t)=>{var l,o,n,i,r,a,s,d;let u=+("lint"!==e.type),c=+("lint"!==t.type);if(u!==c)return u-c;let p=(null==(o=e.location)||null==(l=o.start)?void 0:l.line)??Number.MAX_SAFE_INTEGER,m=(null==(i=t.location)||null==(n=i.start)?void 0:n.line)??Number.MAX_SAFE_INTEGER;if(p!==m)return p-m;let h=(null==(a=e.location)||null==(r=a.start)?void 0:r.column)??Number.MAX_SAFE_INTEGER,f=(null==(d=t.location)||null==(s=d.start)?void 0:s.column)??Number.MAX_SAFE_INTEGER;return h!==f?h-f:String(e.ruleId||"").localeCompare(String(t.ruleId||""))})}function F(e){let t={error:0,warn:1,info:2,log:3};return e.map((e,t)=>({log:e,index:t})).sort((e,l)=>{let o=t[e.log.level]??Number.MAX_SAFE_INTEGER,n=t[l.log.level]??Number.MAX_SAFE_INTEGER;return o!==n?o-n:e.index-l.index}).map(e=>e.log)}function C(e){let t,l=String(e||"");if(!l.trim())return[];let o=n.Text.of(l.split("\n")),i=w(l);try{t=h.parse(l).cursor()}catch(e){return[{type:"lint",ruleId:"parse-error",message:`Syntax error: ${y((null==e?void 0:e.message)||e)}`,location:{start:{line:1,column:1}}}]}let r=[],a=new Set,s=e=>{let t=Math.max(0,Math.min(l.length,e));if(i(t)||a.has(t))return;a.add(t);let n=S(o,t),s=l.slice(t,Math.min(l.length,t+24)).replace(/\s+/g," ").trim(),d=s?` near "${s}"`:"";r.push({type:"lint",ruleId:"parse-error",message:`Syntax error${d}.`,location:{start:n}})};do t.type.isError&&s(t.from);while(t.next());return r}function A(e){let t,l=String(e||"");if(!l.trim())return[];let o=w(l),s=n.Text.of(l.split("\n")),u=[],c=(e,t,n)=>{let i=Math.max(0,Math.min(l.length,e));if(o(i))return;let r=S(s,i);u.push({type:"lint",ruleId:t,message:n,location:{start:r}})},p=()=>{let e="no-noncallable-call",t=new Set,n=n=>{let i=Math.max(0,Math.min(l.length,n));o(i)||t.has(i)||(t.add(i),c(i,e,"This expression is not callable."))},i=l.length,r=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||95===t||36===t},a=e=>{if(!e)return!1;let t=e.charCodeAt(0);return r(e)||t>=48&&t<=57},s=e=>{let t=e;for(;t<i&&/\s/.test(l[t]);)t++;return t},d=e=>!(e>=i)&&("("===l[e]||"?"===l[e]&&"."===l[e+1]&&"("===l[e+2]),u=e=>{let t=1,o="code";for(let n=e+1;n<i;n++){let e=l[n],r=n+1<i?l[n+1]:"";if("lineComment"===o){"\n"===e&&(o="code");continue}if("blockComment"===o){"*"===e&&"/"===r&&(o="code",n+=1);continue}if("single"===o){if("\\"===e){n+=1;continue}"'"===e&&(o="code");continue}if("double"===o){if("\\"===e){n+=1;continue}'"'===e&&(o="code");continue}if("template"===o){if("\\"===e){n+=1;continue}"`"===e&&(o="code");continue}if("/"===e&&"/"===r){o="lineComment",n+=1;continue}if("/"===e&&"*"===r){o="blockComment",n+=1;continue}if("'"===e){o="single";continue}if('"'===e){o="double";continue}if("`"===e){o="template";continue}if("("===e)t++;else if(")"===e&&0==--t)return n}return -1},p=e=>"true"===e||"false"===e||"null"===e,m="code";for(let e=0;e<i;e++){let t=l[e],o=e+1<i?l[e+1]:"";if("lineComment"===m){"\n"===t&&(m="code");continue}if("blockComment"===m){"*"===t&&"/"===o&&(m="code",e+=1);continue}if("/"===t&&"/"===o){m="lineComment",e+=1;continue}if("/"===t&&"*"===o){m="blockComment",e+=1;continue}if("'"===t||'"'===t){let o=t,r=e;for(e+=1;e<i;){let t=l[e];if("\\"===t){e+=2;continue}if(t===o)break;e+=1}d(s(Math.min(i,e+1)))&&n(r);continue}if("`"===t){let t=e;for(e+=1;e<i;){let t=l[e];if("\\"===t){e+=2;continue}if("`"===t)break;e+=1}d(s(Math.min(i,e+1)))&&n(t);continue}if(t>="0"&&t<="9"){let t=e;for(e+=1;e<i&&l[e]>="0"&&l[e]<="9";)e++;if("."===l[e])for(e+=1;e<i&&l[e]>="0"&&l[e]<="9";)e++;if("e"===l[e]||"E"===l[e]){let t=l[e+1],o=e+1;if(("+"===t||"-"===t)&&(o+=1),l[o]>="0"&&l[o]<="9")for(e=o+1;e<i&&l[e]>="0"&&l[e]<="9";)e++}"n"===l[e]&&(e+=1),d(s(e))&&n(t),e-=1;continue}if(r(t)){let t=e;for(e+=1;e<i&&a(l[e]);)e++;p(l.slice(t,e))&&d(s(e))&&n(t),e-=1;continue}if("("===t){let t=s(e+1),o=t,c=!1;("+"===l[t]||"-"===l[t])&&(o=t,t=s(t+1));let m=l[t];if("{"===m||"["===m||"'"===m||'"'===m||"`"===m)c=!0;else if(m>="0"&&m<="9")c=!0;else if(r(m)){let e=t+1;for(;e<i&&a(l[e]);)e++;p(l.slice(t,e))&&(c=!0)}if(c){let t=u(e);t>e&&d(s(t+1))&&n(o)}}}};try{let e=i.Parser||i;t=("function"==typeof r.default?e.extend((0,r.default)()):e).parse(l,{ecmaVersion:2022,sourceType:"script",allowAwaitOutsideFunction:!0,allowReturnOutsideFunction:!0,locations:!0})}catch(e){return p(),u}let m=new Set(["ctx","console","window","document","navigator","Math","Date","Array","Object","Number","String","Boolean","Promise","RegExp","Set","Map","WeakSet","WeakMap","JSON","Intl","URL","Error","TypeError","encodeURIComponent","decodeURIComponent","parseInt","parseFloat","isNaN","isFinite","undefined","NaN","Infinity"]),h=e=>{e&&"string"==typeof e.name&&m.add(e.name)},f=e=>{if(!e)return;let t=[e];for(;t.length;){let e=t.pop();e&&("Identifier"===e.type?h(e):"AssignmentPattern"===e.type?t.push(e.left):"ArrayPattern"===e.type?(e.elements||[]).forEach(e=>e&&t.push(e)):"ObjectPattern"===e.type&&(e.properties||[]).forEach(e=>e&&t.push(e.value||e)))}};try{a.full(t,e=>{switch(null==e?void 0:e.type){case"VariableDeclarator":f(e.id);break;case"FunctionDeclaration":case"FunctionExpression":h(e.id),(e.params||[]).forEach(f);break;case"ArrowFunctionExpression":(e.params||[]).forEach(f);break;case"CatchClause":f(e.param);break;case"ClassDeclaration":h(e.id)}},d)}catch(e){}try{a.full(t,e=>{if(!e||"string"!=typeof e.type||"CallExpression"!==e.type)return;let t=e.callee;if(!(t&&("Identifier"===t.type||"MemberExpression"===t.type||"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type||"CallExpression"===t.type||"ChainExpression"===t.type))){let l=(null==t?void 0:t.start)??e.start??0;c(l,"no-noncallable-call","This expression is not callable.")}},d)}catch(e){}try{let e=new Set,l=new Set(["t"]);a.full(t,t=>{var o,n,i;if(!t||"string"!=typeof t.type||"CallExpression"!==t.type)return;let r=t.callee;if((null==r?void 0:r.type)==="ChainExpression"&&(r=r.expression),!r||"MemberExpression"!==r.type)return;let a=r.object;if(!a||"Identifier"!==a.type||"ctx"!==a.name)return;let s=null;if(r.computed||(null==(o=r.property)?void 0:o.type)!=="Identifier"?r.computed&&(null==(n=r.property)?void 0:n.type)==="Literal"&&"string"==typeof r.property.value&&(s=r.property.value):s=r.property.name,!s||"string"!=typeof s)return;let d=s.trim();if(!d||d.startsWith("_")||d.length>2||l.has(d)||e.has(d))return;let u=(null==(i=r.property)?void 0:i.start)??r.start??t.start??0;c(u,"possible-undefined-ctx-member-call",`Possible undefined ctx method call: ctx.${d}(). This may be a typo or not available in the current ctx API.`),e.add(d)},d)}catch(e){}try{let e=new Set;a.ancestor(t,{Identifier(t,l){let o=null==t?void 0:t.name;if(!o||m.has(o)||e.has(o))return;let n=l[l.length-2];if(!n||"VariableDeclarator"===n.type&&n.id===t||"FunctionDeclaration"===n.type&&n.id===t||"FunctionExpression"===n.type&&n.id===t||"ClassDeclaration"===n.type&&n.id===t||"ClassExpression"===n.type&&n.id===t||"Property"===n.type&&n.key===t&&!0!==n.computed||"MemberExpression"===n.type&&n.property===t&&!0!==n.computed||"LabeledStatement"===n.type&&n.label===t||"BreakStatement"===n.type&&n.label===t||"ContinueStatement"===n.type&&n.label===t)return;let i=t.start??0;c(i,"possible-undefined-variable",`Possible undefined variable: ${o}`),e.add(o)}},d)}catch(e){}return u}function P(e){let t=(t,l)=>{let o=l.map(e=>y(e)).join(" ").trim();e.push({level:t,message:o})},l={trace:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("log",l)},debug:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("log",l)},info:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("info",l)},warn:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("warn",l)},error:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("error",l)},fatal:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("error",l)},child:()=>l};return{consoleCapture:{log:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("log",l)},info:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("info",l)},warn:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("warn",l)},error:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("error",l)}},loggerCapture:l}}function T(e){if(!e.length)return;let t={timeout:0,internal:1,"preview-start-failed":2};return[...e].sort((e,l)=>{let o=t[String(e.ruleId||"")]??10,n=t[String(l.ruleId||"")]??10;return o!==n?o-n:0})[0]}function j(e){var t;let l=null==(t=e.location)?void 0:t.start,o=l?`line ${l.line}:${l.column} `:"",n=e.ruleId?`(${e.ruleId}) `:"";return`${o}${n}${e.message}`.trim()}function I(e){if(!e)return"Preview execution: unknown";let t="number"==typeof e.durationMs?`${Math.round(e.durationMs)}ms`:"unknown";return`Preview execution: started=${e.started}, finished=${e.finished}, timeout=${e.timeout}, duration=${t}`}function L(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",o=String(e||"");return o.length<=t?o:`${o.slice(0,Math.max(0,t-l.length))}${l}`}function D(e,t){let{issues:l,logs:o,execution:n}=e,i=l.filter(e=>"lint"===e.type),r=l.filter(e=>"runtime"===e.type),a=F(o),s=T(r),d=[],u=l.length,c=i.length,p=r.length,m=a.length,h=e=>{e.length&&(d.push("Key logs:"),e.forEach(e=>{d.push(`[${e.level}] ${L(e.message,t.maxLogChars)}`)}),a.length>e.length&&d.push(`... ${a.length-e.length} more logs not shown`))};if(0===u){let e=a.some(e=>"warn"===e.level||"error"===e.level);d.push(e?`RunJS preview completed with warning/error logs: no diagnostic issues found. Logs: ${m}.`:`RunJS preview succeeded: no issues found. Logs: ${m}.`),d.push(I(n));let l=a.slice(0,Math.max(0,t.maxLogs));l.length&&(d.push(""),h(l));let o=d.join("\n").trimEnd();return{message:L(o,t.maxChars),truncated:o.length>t.maxChars}}d.push(`RunJS preview failed: ${u} issues (lint ${c} / runtime ${p}), logs: ${m}.`),d.push(I(n)),d.push("");let f=(e,l)=>{if(!l.length)return;d.push(`${e}:`);let o=l.slice(0,Math.max(0,t.maxIssues));o.forEach((e,l)=>{let o=`${l+1}) ${j(e)}`;if(d.push(o),t.includeStack&&e.stack){let l=L(String(e.stack),t.maxStackChars);d.push(L(l,t.maxStackChars))}}),l.length>o.length&&d.push(`... ${l.length-o.length} more not shown`),d.push("")},g=s&&r.length>1?[s,...r.filter(e=>e!==s)]:r;f("Static issues",i),f("Runtime issues",g);let y=a.slice(0,Math.max(0,t.maxLogs));y.length&&h(y);let v=d.join("\n").trimEnd(),_=v.length>t.maxChars;return{message:_?L(v,t.maxChars):v,truncated:_}}function R(e){let t=`(issues total ${e.issues.length}, logs total ${e.logs.length})`,l=!1;for(let o of[{maxLogs:40,maxLogChars:220,maxIssues:12,includeStack:!0,maxStackChars:800},{maxLogs:20,maxLogChars:160,maxIssues:10,includeStack:!0,maxStackChars:400},{maxLogs:12,maxLogChars:140,maxIssues:8,includeStack:!1,maxStackChars:0},{maxLogs:8,maxLogChars:120,maxIssues:5,includeStack:!1,maxStackChars:0},{maxLogs:3,maxLogChars:100,maxIssues:3,includeStack:!1,maxStackChars:0}]){let{message:n,truncated:i}=D(e,{...o,maxChars:u});if(l=l||i,!i){if(!l)return n;return L(`RunJS preview output was truncated.
163
163
  ${t}
164
164
 
165
- ${n}`,u)}}let o=T(e.issues.filter(e=>"runtime"===e.type)),n=o?`Key runtime issue: ${j(o)}`:"",i=["RunJS preview output was truncated.",t,e.execution?I(e.execution):void 0,n||void 0].filter(Boolean).join("\n").trim();return i.length<=u?i:L(i,u-1)+"\n"}function Y(e){return R(e)}async function E(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="string"==typeof e?e:String(e??""),n=[],i=[],r=null==l?void 0:l.version,a=(0,s.shouldPreprocessRunJSTemplates)({version:r});i.push(...C(o)),i.push(...A(o));let d="u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now(),u={started:!1,finished:!1,timeout:!1,durationMs:void 0};try{u.started=!0;let{consoleCapture:e,loggerCapture:l}=P(n),d={console:e};try{if("u">typeof window){let e=(0,s.createSafeNavigator)();d.navigator=e,d.window=(0,s.createSafeWindow)({navigator:e}),d.document=(0,s.createSafeDocument)()}}catch(e){}let p=o;try{p=await (0,s.prepareRunJsCode)(o,{preprocessTemplates:a})}catch(o){let e=String((null==o?void 0:o.name)||""),t=y((null==o?void 0:o.message)||o),l=o instanceof SyntaxError||/^SyntaxError\b/i.test(e)||/SyntaxError\b/i.test(t);return i.push({type:"runtime",ruleId:l?"preview-start-failed":"internal",message:l?t:`Preview internal failure: ${t}`,stack:M(o)}),u.finished=!0,u.timeout=!1,{issues:k(i),logs:n,execution:u}}let m=await t.createJSRunner({globals:d,timeoutMs:c,version:r});m.globals.ctx.defineProperty("logger",{value:l});let h=await m.run(p);if(u.finished=!0,u.timeout=!!(null==h?void 0:h.timeout),!(null==h?void 0:h.success)){let e=null==h?void 0:h.error,t=(null==h?void 0:h.timeout)?"Execution timed out":y((null==e?void 0:e.message)||e||"Unknown error"),l=e instanceof SyntaxError||/^SyntaxError\b/i.test(String((null==e?void 0:e.name)||""));i.push({type:"runtime",ruleId:(null==h?void 0:h.timeout)?"timeout":l?"preview-start-failed":"runtime-error",message:t,stack:M(e)})}}catch(e){u.finished=!0,u.timeout=!1,i.push({type:"runtime",ruleId:"internal",message:`Preview internal failure: ${y((null==e?void 0:e.message)||e)}`,stack:M(e)})}finally{let e=Math.max(0,("u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now())-d);u.durationMs=Number.isFinite(e)?e:void 0}return{issues:k(i),logs:n,execution:u}}function N(e){let t=new s.FlowContext;if(t.addDelegate(e),"u">typeof document&&"function"==typeof document.createElement&&!e.element)try{let e=document.createElement("div");t.defineProperty("element",{value:e})}catch(e){}return t}async function O(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=N(t),n=await E(e,o,l),i=0===n.issues.length,r=Y(n);return{success:i,message:r.length>u?L(r,u):r}}},8442(e,t,l){l.d(t,{a:()=>r});var o=l(1178),n=l(2793);l(1649);var i=l(5886);let r=(0,l(504).observer)(e=>{var t;let{value:l,FilterItem:r,ctx:a}=e;l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let s=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("reset")},d=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("submit")},u=(null==a||null==(t=a.model)?void 0:t.translate)||(e=>e);return(0,o.jsxs)("form",{onSubmit:e=>{e.preventDefault(),d()},children:[(0,o.jsx)(i.I,{value:l,FilterItem:r}),(0,o.jsxs)(n.Space,{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[(0,o.jsx)(n.Button,{htmlType:"button",onClick:s,children:u("Reset")}),(0,o.jsx)(n.Button,{type:"primary",htmlType:"submit",children:u("Submit")})]})]})},{displayName:"FilterContent"})},5886(e,t,l){l.d(t,{I:()=>c});var o=l(1178),n=l(2113),i=l(2793),r=l(7843);l(1649);var a=l(504);let s=new WeakMap,d=0,u=e=>{let t=s.get(e);return t||(d+=1,t=`filter-item-${d}`,s.set(e,t)),t},c=(0,a.observer)(e=>{let{token:t}=i.theme.useToken(),{value:l={logic:"$and",items:[]},FilterItem:a,showBorder:s=!1,onRemove:d,onChange:p,closeIcon:m=(0,o.jsx)(n.CloseCircleOutlined,{style:{color:t.colorIcon}})}=e,{t:h}=(0,r.useTranslation)();l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let{logic:f,items:g}=l,y=s?{position:"relative",border:`1px dashed ${t.colorBorder}`,padding:t.paddingSM,marginBottom:t.marginXS,borderRadius:t.borderRadius}:{position:"relative",marginBottom:t.marginXS},v=e=>{l.logic=e,null==p||p(l)},_=()=>{g.push({path:"",operator:"",value:""}),null==p||p(l)},b=()=>{g.push({logic:"$and",items:[]}),null==p||p(l)},x=e=>{g.splice(e,1),null==p||p(l)},M=e=>"path"in e||"operator"in e||"value"in e,w=e=>"logic"in e&&"items"in e;return(0,o.jsxs)("div",{style:y,children:[s&&d&&(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{position:"absolute",right:10,top:10,cursor:"pointer",background:"transparent",border:0,padding:0},onClick:d,children:m}),(0,o.jsx)("div",{style:{marginBottom:8,color:t.colorText},children:(0,o.jsxs)("span",{children:[h("Meet")," ",(0,o.jsxs)(i.Select,{"data-testid":"filter-select-all-or-any",style:{width:"auto"},value:f,onChange:v,children:[(0,o.jsx)(i.Select.Option,{value:"$and",children:h("All")}),(0,o.jsx)(i.Select.Option,{value:"$or",children:h("Any")})]})," ",h("conditions in the group")]})}),(0,o.jsx)("div",{children:g.map((e,n)=>w(e)?(0,o.jsx)(c,{value:e,FilterItem:a,showBorder:!0,onRemove:()=>x(n),onChange:e=>{g[n]=e,null==p||p(l)}},u(e)):M(e)?a?(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)(a,{value:e}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:"pointer",background:"transparent",border:0,padding:0},onClick:()=>x(n),children:m})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsxs)("span",{children:[e.path," ",e.operator," ",String(e.value)]}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:"pointer",background:"transparent",border:0,padding:0},onClick:()=>x(n),children:m})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{color:t.colorTextTertiary},children:"Invalid filter item"}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:"pointer",background:"transparent",border:0,padding:0},onClick:()=>x(n),children:m})]})},u(e)))}),(0,o.jsxs)(i.Space,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:_,children:h("Add condition")}),(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:b,children:h("Add condition group")})]})]})},{displayName:"FilterGroup"})},937(e,t,l){l.d(t,{H:()=>o});let o=(e,t,l,o)=>e.map(e=>n(e,t,l,o)).filter(Boolean),n=(e,t,l,n)=>{var i;if(l.length&&1===t&&l.includes(e.name)||!e.interface||!1===e.filterable)return;let r=e.getInterfaceOptions();if(!(null==r?void 0:r.filterable))return;let{nested:a,children:s,operators:d}=r.filterable,u={name:e.name,type:e.type,target:e.target,title:n(e.title),schema:null==e?void 0:e.uiSchema,operators:((null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]).map(e=>({...e,label:n(e.label)}))};if(!e.target||!(t>2)){if(t>2)return u;if((null==s?void 0:s.length)&&(u.children=s),a){let i=o(e.getFields().filter(e=>"attachments"!==e.target&&"formula"!==e.interface),t+1,l,n).filter(Boolean);u.children=u.children||[],u.children.push(...i)}return u}}},9078(e,t,l){l.d(t,{Ru:()=>j,I8:()=>n.I,qi:()=>u,oJ:()=>o.a,Et:()=>x,uw:()=>I.u});var o=l(8442),n=l(5886),i=l(1178),r=l(504),a=l(2793),s=l(1649),d=l(937);let u=(0,r.observer)(e=>{var t;let{path:l,operator:o,value:n}=e.value,r=e.model,u=(null==(t=r.context.blockModel.collection)?void 0:t.getFields().filter(e=>"attachments"!==e.target))||[],p=c(r.props.filterableFieldNames||[],u.map(e=>e.name)),m=r.translate,h=(0,d.H)(u.filter(e=>"attachments"!==e.target&&"formula"!==e.interface&&!["belongsTo","belongsToMany","hasOne","hasMany","oho","obo","m2o","o2m","m2m"].includes(e.type)),1,e.noIgnore?[]:p,m).filter(Boolean),f=(0,s.useMemo)(()=>{let e=h.find(e=>e.name===l);return(null==e?void 0:e.operators)||[]},[h,l]),g=t=>{var l;e.value.path=t;let o=h.find(e=>e.name===t);(null==o||null==(l=o.operators)?void 0:l.length)>0?e.value.operator=o.operators[0].value:e.value.operator="",e.value.value=""},y=t=>{e.value.operator=t},v=t=>{e.value.value=t.target.value};return(0,i.jsxs)(a.Space,{children:[(0,i.jsx)(a.Select,{style:{width:200},placeholder:m("Select field"),value:l||void 0,onChange:g,children:h.map(e=>(0,i.jsx)(a.Select.Option,{value:e.name,children:e.title},e.name))}),(0,i.jsx)(a.Select,{style:{width:120},placeholder:m("Select operator"),value:o||void 0,onChange:y,disabled:!l||0===f.length,children:f.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),(0,i.jsx)(a.Input,{style:{width:200},placeholder:m("Enter value"),value:n,onChange:v})]})},{displayName:"FilterItem"});function c(e,t){return null==t?void 0:t.filter(t=>!e.includes(t))}var p=l(6305),m=l(7583),h=l(6220),f=l(7309),g=l(7720);let{DateFilterDynamicComponent:y}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent");async function v(e){var t,l,o,n;let i=async e=>Array.isArray(e)?e:"function"==typeof e?await e():[];if(null==(l=e.getPropertyOptions)||null==(t=l.call(e,"collection"))?void 0:t.meta){let t=null==(n=e.getPropertyMetaTree)?void 0:n.call(e,"{{ ctx.collection }}");return await i(t)}let a=()=>(null==e?void 0:e.collection)??null,s=await (0,r.createEphemeralContext)(e,{defineProperties:{collection:{get:a,meta:(0,r.createCollectionContextMeta)(a,"Current collection")}}}),d=null==(o=s.getPropertyMetaTree)?void 0:o.call(s,"{{ ctx.collection }}");return await i(d)}function _(e,t,l,o){var n;let r=null==e?void 0:e["x-component"],s=(null==t||null==(n=t.uiSchema)?void 0:n["x-component-props"])||{},d=(null==e?void 0:e["x-component-props"])||{},u=(0,__rspack_external_lodash_merge_8f812c65.default)({},s,d),c=(0,f.di)(null==e?void 0:e.enum,l)||[],p={style:{width:200,...(null==u?void 0:u.style)||{}},placeholder:(null==u?void 0:u.placeholder)||l("Enter value"),...u},m=e=>{if("number"==typeof e||(null==u?void 0:u.stringMode)===!0&&"string"==typeof e)return e};return e=>{let{value:t,onChange:l,...n}=e||{};if("InputNumber"===r)return(0,i.jsx)(a.InputNumber,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("NumberPicker"===r)return(0,i.jsx)(h.NumberPicker,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("Switch"===r)return(0,i.jsx)(a.Switch,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e)});if("Select"===r)return(0,i.jsx)(a.Select,{options:c,...p,...n,value:(0,f.xO)(t,p),onChange:e=>null==l?void 0:l(e)});if("Checkbox"===r)return(0,i.jsx)(a.Checkbox,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e.target.checked)});if("Checkbox.Group"===r)return(0,i.jsx)(a.Checkbox.Group,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Radio.Group"===r)return(0,i.jsx)(a.Radio.Group,{...p,...n,value:Array.isArray(t)||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:void 0,onChange:e=>null==l?void 0:l(e.target.value)});if("Cascader"===r)return(0,i.jsx)(a.Cascader,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Input.TextArea"===r||"TextArea"===r)return(0,i.jsx)(a.Input.TextArea,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)});if("DateFilterDynamicComponent"===r)return(0,i.jsx)(y,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e)});if(r&&(null==o?void 0:o.getComponent)){let e=o.getComponent(r);if(e)return(0,i.jsx)(e,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e),style:{width:200,...p.style||{},...null==n?void 0:n.style}})}return(0,i.jsx)(a.Input,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)})}}function b(e){if(e&&"object"==typeof e){let l=e;if("function"==typeof l.preventDefault||l.nativeEvent||"target"in l){var t;let o=null==(t=l.target)?void 0:t.value;return void 0!==o?o:e}}return e}let x=(0,r.observer)(e=>{let{value:t,model:l,rightAsVariable:o,rightMetaTree:n,ignoreFieldNames:d}=e,u=(0,r.useFlowViewContext)(),c=l.translate,{path:h,operator:y,value:x}=t,[M,w]=(0,s.useState)(null),S=(0,s.useCallback)(e=>{var t;return(0,p.w6)(e,l.context.dataSourceManager,null==(t=l.context.app)?void 0:t.dataSourceManager)},[l]),k=(0,s.useMemo)(()=>{var e,t;if(!M)return[];let l=M.interface?S(M.interface):void 0,o=null==M||null==(e=M.uiSchema)?void 0:e["x-filter-operators"];return((Array.isArray(o)&&o.length?o:null==l||null==(t=l.filterable)?void 0:t.operators)||[]).filter(e=>!e.visible||e.visible(M))},[S,M]);(0,s.useEffect)(()=>{if(!k.length)return;let e=m.default.find(k,e=>e.value===t.operator);if(e)t.noValue=!!e.noValue;else{let e=k[0];t.operator=e.value,t.value=!!e.noValue||void 0,t.noValue=!!e.noValue}},[k,t]);let F=(0,s.useMemo)(()=>k.map(e=>({value:e.value,label:"string"==typeof e.label?c(e.label):e.label})),[k,c]),C=(0,s.useCallback)((e,l)=>{let o=t.path||"",n=e||"",i=n!==o;t.path=n,i&&o&&(t.operator="",t.value=void 0,t.noValue=!1),l&&w(l)},[t]),A=(0,s.useMemo)(()=>({resolveValueFromPath:e=>(w(e),(null==e?void 0:e.paths.slice(1).join("."))||null),resolvePathFromValue(e){if(null==e)return;let t=String(e).trim();if(t)return["collection",...t.split(".")]}}),[]),P=(0,s.useCallback)(e=>{t.operator=e;let l=k.find(t=>t.value===e);(null==l?void 0:l.noValue)?(t.value=!0,t.noValue=!0):(t.value=void 0,t.noValue=!1)},[k,t]),T=(0,s.useMemo)(()=>k.find(e=>e.value===y),[k,y]),j=(0,s.useCallback)(e=>{var t,l;return(null==e||null==(t=e.options)?void 0:t.dataType)||(null==e?void 0:e.dataType)||(null==e?void 0:e.type)||(null==e||null==(l=e.uiSchema)?void 0:l.type)||"double"},[]),I=(0,s.useCallback)(e=>{switch(e){case"boolean":return"Switch";case"date":return"DateFilterDynamicComponent";case"integer":case"bigInt":case"double":case"decimal":case"number":return"InputNumber";default:return"Input"}},[]),L=(0,s.useMemo)(()=>{let e=(null==M?void 0:M.uiSchema)||{},t=(null==T?void 0:T.schema)||{},l=(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t);if((null==M?void 0:M.interface)==="formula"){let e={"x-read-pretty":!1,"x-component":I(j(M)),"x-component-props":{...l["x-component-props"]}};return(0,__rspack_external_lodash_merge_8f812c65.default)({},l,e)}return l},[M,T,I,j]),D=s.default.useRef(null==L?void 0:L["x-component"]),R=null==L?void 0:L["x-component"],Y=(0,s.useMemo)(()=>{let e=D.current;D.current=R;let l=void 0!==e&&e!==R;if(null==T?void 0:T.noValue)return x;if(l&&null!=x){t.value=void 0;return}return x},[R,x,t,T]),E=(0,s.useCallback)(e=>{t.value=b(e)},[t]),N=s.default.useRef(c);s.default.useEffect(()=>{N.current=c},[c]);let O=s.default.useCallback(e=>{var t;return(null==(t=N.current)?void 0:t.call(N,e))??e},[]),B=(0,s.useMemo)(()=>(0,f.di)(null==L?void 0:L.enum,O)||[],[L,O]),H=(0,s.useMemo)(()=>_(L,M,O,l.context.app),[L,M,O,l.context.app]),V=(0,s.useCallback)(()=>{let e=(0,g._)(l.context.app,y,k),t="$in"===y||"$notIn"===y;if(e&&t){let{Comp:t,props:l}=e,o={...l};(!(null==o?void 0:o.options)||(null==o?void 0:o.options.length)===0)&&(null==B?void 0:B.length)&&(o.options=B);let n={flex:"1 1 40%",minWidth:160,maxWidth:"100%",...(null==o?void 0:o.style)||{}},r=Array.isArray(Y)&&Y.every(e=>"string"==typeof e||"number"==typeof e)?Y:"string"==typeof Y?Y.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)("div",{style:n,children:(0,i.jsx)(t,{...o,style:{width:"100%",...(null==o?void 0:o.style)||{}},value:r,onChange:e=>E(e)})})}let o=H;return(0,i.jsx)("div",{style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},children:(0,i.jsx)(o,{value:Y,onChange:e=>E(e)})})},[y,k,Y,H,l.context.app,E,B]),q=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${c("Null")}>`,readOnly:!0})},[c]),$=(0,s.useMemo)(()=>async()=>{let e="function"==typeof n?await n():n??u.getPropertyMetaTree(),t=Array.isArray(e)?e:await e();return[{title:c("Constant"),name:"constant",type:"string",paths:["constant"],render:H},{title:c("Null"),name:"null",type:"object",paths:["null"],render:q},...t]},[n,u,H,q,c]),z=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?H:"null"===l?q:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t="string"==typeof e?(0,r.parseValueToPath)(e):void 0;return t||["constant"]}}),[q,H]),K=(0,s.useMemo)(()=>async()=>{let e=await v(l.context),t=async e=>{let t=e.interface?S(e.interface):void 0,o=[],n=null==t?void 0:t.filterable,i=null==n?void 0:n.children;if(Array.isArray(i)&&i.length)for(let t of i){var r,a,s;let n=t.title||t.name,i=(null==(r=l.context)?void 0:r.t)?l.context.t(n):n;o.push({name:t.name,title:i,type:(null==(a=t.schema)?void 0:a.type)||"string",interface:(null==(s=t.schema)?void 0:s["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]})}if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=[...Array.isArray(e)?e:[],...o];return m.default.uniqBy(l,"name")}}}let d=[...Array.isArray(e.children)?e.children:[],...o];return{...e,children:d.length?d:e.children}},o=[];for(let l of e)o.push(await t(l));return o},[S,l]);return(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:h,metaTree:K,onChange:C,converters:A,showValueComponent:!1,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},onlyLeafSelectable:!0,placeholder:c("Select field"),ignoreFieldNames:d}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:c("Comparison"),value:y||void 0,onChange:P,children:F.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==T?void 0:T.noValue)&&(o?(0,i.jsx)(r.VariableInput,{value:Y,onChange:e=>E(e),metaTree:$,converters:z,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:c("Enter value")}):V())]})});var M=l(1793);let{DateFilterDynamicComponent:w}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent");function S(e,t,l){var o,n,r;let s=null==e?void 0:e["x-component"],d=(null==t||null==(o=t.uiSchema)?void 0:o["x-component-props"])||{},u=(null==e?void 0:e["x-component-props"])||{},c=(0,__rspack_external_lodash_merge_8f812c65.default)({},d,u),p=Array.isArray(null==t||null==(n=t.uiSchema)?void 0:n.enum)?null==t||null==(r=t.uiSchema)?void 0:r.enum:void 0,m=(0,f.di)(p,l),g={style:{width:200,...(null==c?void 0:c.style)||{}},placeholder:(null==c?void 0:c.placeholder)||l("Enter value"),...c};return e=>{let{value:t,onChange:o,...n}=e||{};if("InputNumber"===s)return(0,i.jsx)(a.InputNumber,{...g,...n,value:t,onChange:o});if("NumberPicker"===s)return(0,i.jsx)(h.NumberPicker,{...g,...n,value:t,onChange:o});if("Switch"===s)return(0,i.jsx)(a.Switch,{...g,...n,checked:!!t,onChange:o});if("Select"===s){let e=g;return Array.isArray(null==e?void 0:e.options)&&e.options.length>0?e={...e,options:(0,f.ZY)(e.options,l)}:m&&(e={...e,options:m}),(0,i.jsx)(a.Select,{...e,...n,value:(0,f.xO)(t,e),onChange:o})}return"DateFilterDynamicComponent"===s?(0,i.jsx)(w,{...g,...n,value:t,onChange:o}):(0,i.jsx)(a.Input,{...g,...n,value:t,onChange:e=>{var t;return null==o?void 0:o(null==e||null==(t=e.target)?void 0:t.value)}})}}let k=[{value:"$includes",label:"contains",selected:!0},{value:"$notIncludes",label:"does not contain"},{value:"$eq",label:"is"},{value:"$ne",label:"is not"},{value:"$empty",label:"is empty",noValue:!0},{value:"$notEmpty",label:"is not empty",noValue:!0}],F=new Set(["$in","$notIn"]);function C(e,t){let l=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(!o.length)return l;let n=o.find(e=>(null==e?void 0:e.name)==="item");if(!n)return[...o,...l];let i=(0,M.mD)(l,[n]);return[...o.filter(e=>(null==e?void 0:e.name)!=="item"),...i]}function A(e,t){var l,o;return{name:t.name,title:t.title||t.name,type:(null==(l=t.schema)?void 0:l.type)||"string",interface:(null==(o=t.schema)?void 0:o["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]}}async function P(e,t){var l,o;let n=e.interface&&t?t(e.interface):void 0,i=(Array.isArray(null==n||null==(l=n.filterable)?void 0:l.children)?null==n||null==(o=n.filterable)?void 0:o.children:[]).map(t=>A(e,t)),r=async e=>{let l=[...await Promise.all(e.map(e=>P(e,t))),...i];return(0,__rspack_external_lodash_uniqBy_85106929.default)(l,e=>e.name)};if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=Array.isArray(e)?e:[];return await r(l)}}}return Array.isArray(e.children)?{...e,children:await r(e.children)}:i.length?{...e,children:i}:e}async function T(e,t){let l=Array.isArray(e)?e:[];return await Promise.all(l.map(e=>P(e,t)))}let j=(0,r.observer)(e=>{var t;let{value:l,model:o,extraMetaTree:n}=e,d=(0,r.useFlowViewContext)(),u=o.translate,{path:c,operator:m,value:h}=l||{},[y,v]=(0,s.useState)(null),_=(0,s.useRef)(!1),b=(0,s.useMemo)(()=>{if(y){var e,t,l;let n=y.interface?(0,p.w6)(y.interface,o.context.dataSourceManager,null==(e=o.context.app)?void 0:e.dataSourceManager):void 0,i=null==y||null==(t=y.uiSchema)?void 0:t["x-filter-operators"];return((Array.isArray(i)&&i.length?i:null==n||null==(l=n.filterable)?void 0:l.operators)||k).filter(e=>!e.visible||e.visible(y)).map(e=>({value:e.value,label:e.label,noValue:!!e.noValue,schema:e.schema,selected:!!e.selected}))}return[]},[y,o]),x=(0,s.useMemo)(()=>b.map(e=>({value:e.value,label:"string"==typeof e.label?u(e.label):e.label})),[b,u]);(0,s.useEffect)(()=>{if(0!==b.length){if(!m){if(_.current){let e=b.find(e=>e.selected)||b[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1,_.current=!1}return}if(!b.some(e=>e.value===m)){let e=b.find(e=>e.selected)||b[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1}}},[b,m,l]);let M=(0,s.useMemo)(()=>b.find(e=>e.value===m),[b,m]),w=(0,s.useMemo)(()=>{let e=(null==y?void 0:y.uiSchema)||{},t=(null==M?void 0:M.schema)||{};return(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t)},[y,M]),A=(0,s.useRef)(u);(0,s.useEffect)(()=>{A.current=u},[u]);let P=(0,s.useCallback)(e=>{var t;return(null==(t=A.current)?void 0:t.call(A,e))??e},[]),j=(0,s.useMemo)(()=>S(w,y,P),[w,y,P]),I=(0,s.useMemo)(()=>(0,f.di)(null==w?void 0:w.enum,P)||[],[w,P]),L=(0,s.useMemo)(()=>{let e=(0,g._)(o.context.app,m,b),t=F.has(m);if(!e||!t)return j;let{Comp:l,props:n}=e;return e=>{let{value:t,onChange:o,...r}=e||{},a={...n};(null==a?void 0:a.options)&&(null==a?void 0:a.options.length)!==0||!(I.length>0)||(a.options=I);let s=Array.isArray(t)?t:"string"==typeof t?t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)(l,{...a,...r,value:s,onChange:o,style:{width:200,...(null==a?void 0:a.style)||{},...(null==r?void 0:r.style)||{}}})}},[I,o.context.app,b,m,j]),D=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${u("Null")}>`,readOnly:!0})},[u]),R=(0,s.useMemo)(()=>async()=>{let e=C((null==o?void 0:o.context.getPropertyMetaTree())||d.getPropertyMetaTree(),n);return[{title:u("Constant"),name:"constant",type:"string",paths:["constant"]},{title:u("Null"),name:"null",type:"object",paths:["null"]},...e]},[d,o,u,n]),Y=(0,s.useCallback)(async()=>{var e,t;let l=(null==o||null==(t=o.context)||null==(e=t.getPropertyMetaTree)?void 0:e.call(t))||d.getPropertyMetaTree(),i=C(Array.isArray(l)?l:[],n),r=e=>{var t;return(0,p.w6)(e,o.context.dataSourceManager,null==(t=o.context.app)?void 0:t.dataSourceManager)};return await T(i,r)},[d,o,n]),E=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?L:"null"===l?D:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t=(0,r.parseValueToPath)(e);return t||["constant"]}}),[D,L]),N=(0,s.useCallback)((e,t)=>{let o=l.path||"",n=e||"",i=n!==o;l.path=n,i&&o&&(l.operator="",l.value="",_.current=!0),o||!n||l.operator||(_.current=!0),t&&v(t)},[l]),O=(0,s.useCallback)(e=>{let t=l.operator;l.operator=e;let o=b.find(t=>t.value===e);(null==o?void 0:o.noValue)?(l.value=!0,l.noValue=!0):(F.has(t)&&!F.has(e)&&Array.isArray(l.value)&&(l.value=l.value.join("\n")),l.noValue=!1)},[l,b]);return(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:c,onChange:N,metaTree:Y,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:u("Select variable"),onlyLeafSelectable:!0}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:u("Comparison"),value:m||void 0,onChange:O,children:x.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==(t=b.find(e=>e.value===m))?void 0:t.noValue)&&(0,i.jsx)(r.VariableInput,{value:h,onChange:e=>l.value=e,metaTree:R,converters:E,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:u("Enter value"),clearValue:""})]})});var I=l(8102)},8102(e,t,l){l.d(t,{u:()=>r});var o=l(1649),n=l(937);let i=e=>e;function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filterableFieldNames:l,nonfilterableFieldNames:r,noIgnore:a=!1,t:s=i}=t,d=(0,o.useMemo)(()=>(null==e?void 0:e.getFields())||[],[e]),u=(0,o.useMemo)(()=>{let e=!a&&(null==l?void 0:l.length)?d.map(e=>e.name).filter(e=>!l.includes(e)):[],t=r??[];return t.length?Array.from(new Set([...e,...t])):e},[d,l,r,a]);return(0,o.useMemo)(()=>(0,n.H)(d.filter(e=>"attachments"!==e.target&&"formula"!==e.interface),1,u,s).filter(Boolean),[d,u,s])}},8563(e,t,l){l.d(t,{b2:()=>n.b,tn:()=>o.t,S5:()=>n.S});var o=l(8804);l(1178),l(8533),l(8198),l(504),l(1649),l(7326),l(5721);var n=l(5026);l(9253),l(4244)},9378(e,t,l){l.d(t,{g:()=>m});var o=l(1178),n=l(1649);let i=l(7583).default.memoize(async e=>e?(await Promise.resolve().then(l.bind(l,248))).default.render(e):e);function r(e){let[t,l]=(0,n.useState)(""),[o,r]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{r(!0),i(e).then(e=>{l(e),r(!1)}).catch(e=>console.log(e))},[e]),{html:t,loading:o}}function a(e){let t=e,l=document.createElement("div");l.innerHTML=t;let o=l.innerText;return l=null,(null==o?void 0:o.replace(/[\n\r]/g,""))||""}var s=l(2741),d=l(691),u=l(504),c=l(2793);let p=()=>{let e=(0,u.useFlowContext)(),{token:t}=c.theme.useToken(),l=!!e.isDarkTheme,o=new s.TinyColor(t.colorFillAlter).onBackground(t.colorBgContainer).toHexShortString(),n={lineHeight:"inherit","&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},i={"&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return(0,d.css)({lineHeight:t.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:t.lineHeight},".field-interface-datetime":{minWidth:"100px"},img:{maxWidth:"100%"},...l?i:n})},m=e=>{let{textOnly:t,overflowMode:l,style:i}=e,s=p(),{html:d=""}=r(e.value),u=a(d),m="ellipsis"===l,h=(0,n.useRef)(null),[f,g]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(h.current){let e=h.current;g(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)}},[d,i,l]);let y={...i||{},...m?{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-word",cursor:"default"}:{}},v=(0,o.jsx)("div",{ref:h,className:`${s} nb-markdown`,dangerouslySetInnerHTML:{__html:t?u:d},style:y});return m&&f?(0,o.jsx)(c.Tooltip,{title:(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:d},style:{maxHeight:500,overflowY:"auto",padding:10,color:"#000"}}),overlayInnerStyle:{background:"#fff",color:"#000",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},color:"#fff",children:v}):v}},248(e,t,l){function o(e,t){function l(e){return e.split(/\s+/g)[0]}__rspack_external_mermaid.default.initialize({securityLevel:"loose",...t});let o=e.renderer.rules.fence;function n(e,t,n,i,r){let a=e[t],s=a.info.trim();if(-1===["mermaid","{mermaid}"].indexOf(s?l(s):""))return void 0!==o?o(e,t,n,i,r):"";let d="",u=[],c=document.createElement("div");document.body.appendChild(c);try{let e="mermaid-container";__rspack_external_mermaid.default.mermaidAPI.render(e,a.content,t=>{let l=document.getElementById(e);null!==l&&u.push(["style",`max-width:${l.style.maxWidth};max-height:${l.style.maxHeight}`]),d=t},c)}catch(e){return`<div class="alert alert-danger">${e}</div>`}finally{c.remove()}return u.push(["src",`data:image/svg+xml,${encodeURIComponent(d)}`]),`<img ${r.renderAttrs({attrs:u})}>`}e.renderer.rules.fence=n}l.d(t,{default:()=>i});let n=new __rspack_external_markdown_it_a5918e6a.default({html:!0,linkify:!0,typographer:!0,breaks:!0});n.use(__rspack_external_markdown_it_highlightjs_3df446b8.default),n.use(o);let i=n},7309(e,t,l){function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.map(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t=e,l=void 0!==t.label,o=void 0!==t.value,n=l?t.label:String(t.value??""),i=o?t.value:n,r={label:n,value:i};return t.color&&(r.color=t.color),t.icon&&(r.icon=t.icon),r}return{label:String(e),value:e}}):[]}function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return Array.isArray(e)?e.map(e=>"string"==typeof(null==e?void 0:e.label)?{...e,label:t(e.label)}:e):[]}function i(e,t){if(e&&Array.isArray(e)&&0!==e.length)return n(o(e),t)}function r(e,t){let l=null==t?void 0:t.mode,o="multiple"===l||"tags"===l||(null==t?void 0:t.multiple)===!0;return Array.isArray(e)?e.filter(e=>""!==e&&null!=e):""===e||null==e?o?[]:void 0:e}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(Array.isArray(e)?e:null==e?[]:[e]).map(e=>{var l;let o=t.find(t=>(null==t?void 0:t.value)===e);return o?{value:e,label:o.label}:{value:e,label:(null==e||null==(l=e.toString)?void 0:l.call(e))??e}})}function s(e,t){var l,n,i,r;if(!["radioGroup","checkboxGroup","select","multipleSelect"].includes(null==t?void 0:t.interface)||Array.isArray(null==(l=e.props)?void 0:l.options)&&(null==(i=e.props)||null==(n=i.options)?void 0:n.length)>0)return!1;let a=null==(r=t.uiSchema)?void 0:r.enum;if(!Array.isArray(a)||0===a.length)return!1;let s=o(a);return!!s.length&&(e.setProps({options:s}),!0)}l.d(t,{NI:()=>s,ZY:()=>n,di:()=>i,xO:()=>r,yg:()=>a})},9133(e,t,l){l.d(t,{E4:()=>i,Gj:()=>d,a_:()=>o,eo:()=>p,pX:()=>s,w7:()=>r});let o="__custom__";function n(e){return`${o}:${e}`}function i(e){var t;if(!e||"object"!=typeof e)return!1;let l=e;if(!(null==(t=l.isAssociationField)?void 0:t.call(l)))return!1;let o=l.type,n=l.interface;return"belongsToMany"===o||"hasMany"===o||"belongsToArray"===o||"m2m"===n||"o2m"===n||"mbm"===n}function r(e){var t;if(!e||"object"!=typeof e)return;let l=e;return l.collection||(null==(t=l.context)?void 0:t.collection)||void 0}function a(e){return"string"==typeof e?e.trim():""}function s(e){if(!e||"object"!=typeof e)return[];let t=e,l="function"==typeof t.getStepParams?t.getStepParams("fieldSettings","init"):void 0,o=l&&"object"==typeof l?l:void 0,i="function"==typeof t.getStepParams?t.getStepParams("formItemSettings","fieldSettings"):void 0,r=i&&"object"==typeof i?i:void 0,s=(null==o?void 0:o.fieldPath)??t.fieldPath,d=(null==o?void 0:o.associationPathName)??t.associationPathName,u=null==r?void 0:r.name,c=a(s),p=a(d),m=a(u),h=new Set;return c&&h.add(c),p&&(c?c.startsWith(`${p}.`)?h.add(c):h.add(`${p}.${c}`):h.add(p)),m&&h.add(n(m)),Array.from(h)}function d(e){return s(e)[0]}function u(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;if(!t||"object"!=typeof t)return[];let l=t.items;if(Array.isArray(l))return l;let o=t.grid;if(!o||"object"!=typeof o)return[];let n=o.subModels;if(!n||"object"!=typeof n)return[];let i=n.items;return Array.isArray(i)?i:[]}function c(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;return t&&"object"==typeof t?u(t.field):[]}function p(e,t){let l=a(t);if(!l)return null;let o=e=>{if(!Array.isArray(e))return null;for(let t of e){if(s(t).some(e=>e===l))return t;let e=o(c(t));if(e)return e}return null};return o(u(e))}},7720(e,t,l){l.d(t,{_:()=>n});var o=l(6832);function n(e,t,l){let n;if(!l||!Array.isArray(l))return null;let i=l.find(e=>(null==e?void 0:e.value)===t),r=null==i?void 0:i.schema,a=null==r?void 0:r["x-component"];if(!a)return null;if("DateFilterDynamicComponent"===a)n=o.DateFilterDynamicComponent;else{var s;n=null==e||null==(s=e.getComponent)?void 0:s.call(e,a)}return n?{Comp:n,props:(null==r?void 0:r["x-component-props"])||{}}:null}},544(e,t,l){l.d(t,{ON:()=>i,jI:()=>n});let o="__saveStepParamsWithSubModels";function n(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");e[o]=!0}async function i(e,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");let l=e;if(!0!==l[o])return await t();if("function"!=typeof l.save)throw Error("[saveStepParamsWithSubModels] model.save is not a function");try{return await l.save()}finally{delete l[o]}}},7827(e,t,l){l.d(t,{S0:()=>r.S0,_T:()=>r._T,s5:()=>r.s5});var o=l(504),n=l(6305);l(1649);var i=l(2542),r=l(5042);r.S0.registerFlow({key:"buttonSettings",title:(0,o.tExpr)("Button settings"),sort:-999,steps:{general:{title:(0,o.tExpr)("Edit button"),uiSchema:e=>({title:e.model.enableEditTitle?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button title")}:void 0,tooltip:e.model.enableEditTooltip?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button tooltip")}:void 0,icon:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"IconPicker",title:(0,o.tExpr)("Button icon")}:void 0,iconOnly:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Icon only")}:void 0,type:e.model.enableEditType?{"x-decorator":"FormItem","x-component":"Radio.Group",title:(0,o.tExpr)("Button type"),enum:e.model.buttonTypeOptions}:void 0,danger:e.model.enableEditDanger?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Danger action")}:void 0,color:e.model.enableEditColor?{"x-decorator":"FormItem","x-component":n.sk,title:(0,o.tExpr)("Color")}:void 0}),defaultParams(e){var t,l;let o=e.model.defaultProps||{};return e.model.enableEditColor?{...o,color:(null==(t=e.model.props)?void 0:t.color)??o.color??(null==(l=e.themeToken)?void 0:l.colorPrimary)}:o},handler(e,t){let{title:l,tooltip:o,...n}=t;e.model.setProps({title:e.t(l,{ns:"lm-flow-engine"}),tooltip:e.t(o,{ns:"lm-flow-engine"}),...n})}},linkageRules:{use:"actionLinkageRules"}}}),r.S0.registerFlow({key:"buttonAclSettings",steps:{aclCheck:{use:"aclCheck"}}}),r.S0.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh"},linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"actionLinkageRules",flowKey:"buttonSettings",stepKey:"linkageRules"}}}}),r.S0.registerEvents({click:{title:(0,o.tExpr)("Click"),name:"click",uiSchema:{condition:{type:"object",title:(0,o.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":i.H}},handler:i.b}})},5042(e,t,l){l.d(t,{S0:()=>p,_T:()=>u,s5:()=>c});var o=l(1178),n=l(504),i=l(2195),r=l(2793),a=l(7583),s=l(1649),d=l(7843);function u(e){let{t}=(0,d.useTranslation)(),l=(0,n.useFlowModel)(),i=l.context.blockModel,u=e.collection||i.collection,c=u.dataSource,p=(0,s.useMemo)(()=>{let e=`${t(c.displayName||c.key)} > `,l=u?`${t(u.title)||u.name||u.tableName} `:"";return`${e}${l}`},[]),{actionName:m}=(null==e?void 0:e.forbidden)||l.forbidden,h=(0,s.useMemo)(()=>t('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:p,actionName:t(a.default.capitalize(m))}).replaceAll("&gt;",">"),[m,p,t]);return(0,o.jsx)(r.Tooltip,{title:e.message||h,children:e.children})}let c={collection:"collection",record:"record",all:["collection","record"],both:["collection","record"]};class p extends n.FlowModel{static _getScene(){return a.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getAclActionName(){return null}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1})}getInputArgs(){let e={},t=[];if(this.context.resource){let l=this.context.resource.getSourceId();l&&(e.sourceId=l,t.push("sourceId"))}if(this.context.collection&&this.context.record){let l=this.context.collection.getFilterByTK(this.context.record);l&&(e.filterByTk=l,t.push("filterByTk"))}return t.length&&(e.defaultInputKeys=t),e}onClick(e){this.dispatchEvent("click",{event:e,...this.getInputArgs()},{debounce:!0})}getTitle(){return this.props.title}getIcon(){return this.props.icon}renderButton(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0;return(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,children:e?null:t.children||this.getTitle()})}render(){return this.props.tooltip?(0,o.jsx)(r.Tooltip,{title:this.props.tooltip,children:this.renderButton()}):this.renderButton()}renderHiddenInConfig(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0;return this.forbidden?(0,o.jsx)(u,{children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:e?null:t.children||this.getTitle()})}):(0,o.jsx)(r.Tooltip,{title:this.context.t("The button is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:e?null:t.children||this.getTitle()})})}constructor(...e){super(...e),this.defaultProps={type:"default",title:(0,n.tExpr)("Action"),iconOnly:!1},this.enableEditTooltip=!0,this.enableEditTitle=!0,this.enableEditIcon=!0,this.enableEditType=!0,this.enableEditDanger=!0,this.enableEditColor=!1,this.buttonTypeOptions=[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Primary")}}'},{value:"dashed",label:'{{t("Dashed")}}'},{value:"link",label:'{{t("Link")}}'},{value:"text",label:'{{t("Text")}}'}]}}},3890(e,t,l){l.d(t,{P:()=>f,z:()=>g});var o=l(1178),n=l(2314),i=l(504),r=l(7583),a=l(1649),s=l(2793),d=l(8563),u=l(2542),c=l(7843),p=l(8804);let m=()=>{let{t:e}=(0,c.useTranslation)(),t=(0,i.useFlowModel)(),l=t.context.blockModel.collection,n=l.dataSource,d=(0,a.useMemo)(()=>{let t=`${e(n.displayName||n.key)} > `,o=l?`${e(l.title)||l.name||l.tableName} `:"";return`${t}${o}`},[]),{actionName:u}=t.forbidden,m=(0,a.useMemo)(()=>e('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:d,actionName:e(r.default.capitalize(u))}).replaceAll("&gt;",">"),[u,d,e]);return(0,o.jsx)(p.t,{children:(0,o.jsx)(s.Result,{status:"403",subTitle:m})})};function h(){let{t:e}=(0,c.useTranslation)(),t=(0,i.useFlowModel)(),l=t.dataSource,n=(0,a.useMemo)(()=>{let o=`${e(l.displayName||l.key)} > `,n=t.resource.resourceName;return`${o}${n}`},[]),r=(0,a.useMemo)(()=>e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:e("Collection"),name:n,blockType:e("Block")}).replaceAll("&gt;",">"),[n,e]);return(0,o.jsx)(p.t,{children:(0,o.jsx)(s.Result,{status:"404",subTitle:r})})}let f={new:"new",one:"one",many:"many",select:"select",filter:"filter",oam:["one","many"],subForm:"subForm",bulkEditForm:"bulkEditForm"};class g extends i.FlowModel{setFilterActive(e,t){this.activeFilterSources.set(e,t)}hasActiveFilters(){let e=this.resource;if(e&&e.filter&&Object.keys(e.filter).length>0)return!0;for(let[,e]of this.activeFilterSources)if(e)return!0;return!1}removeFilterSource(e){this.activeFilterSources.delete(e)}getDataLoadingMode(){var e;let t=this.getStepParams("dataLoadingModeSettings");return(null==t||null==(e=t.dataLoadingMode)?void 0:e.mode)||"auto"}static _getScene(){return r.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getModelClassName(e){return Object.keys(this.customModelClasses).includes(e)?this.customModelClasses[e]:this._defaultCustomModelClasses[e]||e}renderHiddenInConfig(){return this.forbidden?(0,o.jsx)(m,{}):(0,o.jsx)(s.Tooltip,{title:this.context.t("The block is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(d.tn,{ref:this.context.ref,...this.decoratorProps,style:{opacity:"0.3"},children:(0,o.jsx)(this.ObservedRenderComponent,{})})})}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineMethod("getModelClassName",e=>this.getModelClassName(e)),this.ObservedRenderComponent=(0,i.observer)(()=>this.renderComponent(),{displayName:"ObservedRenderComponent"})}setDecoratorProps(e){Object.assign(this.decoratorProps,e)}get title(){return this._title||(this._title=this.defaultBlockTitle()),this._title}defaultBlockTitle(){var e;return`${this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name)}`}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of BlockModel")}render(){return this.collectionRequired&&!this.context.collection?(0,o.jsx)(h,{}):(0,o.jsx)(d.tn,{ref:this.context.ref,...this.decoratorProps,children:(0,o.jsx)(this.ObservedRenderComponent,{})})}constructor(...e){super(...e),this.decoratorProps=(0,n.observable)({}),this._defaultCustomModelClasses={},this.customModelClasses={},this.collectionRequired=!1,this.ObservedRenderComponent=null,this.activeFilterSources=new Map}}g.registerFlow({key:"cardSettings",title:(0,i.tExpr)("Card settings"),steps:{titleDescription:{title:(0,i.tExpr)("Title & description"),uiSchema:{title:{"x-component":"Input","x-decorator":"FormItem",title:(0,i.tExpr)("Title")},description:{"x-component":"Input.TextArea","x-decorator":"FormItem",title:(0,i.tExpr)("Description")}},handler(e,t){let l=e.t(t.title,{ns:"lm-flow-engine"}),o=e.t(t.description,{ns:"lm-flow-engine"});e.model.setDecoratorProps({title:l,description:o})}},linkageRules:{use:"blockLinkageRules"},blockHeight:{use:"blockHeight"}}}),g.define({hide:!0,label:(0,i.tExpr)("Other blocks")}),i.FlowModel.registerEvents({beforeRender:{title:(0,i.tExpr)("Before render"),name:"beforeRender",uiSchema:{condition:{type:"object",title:(0,i.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":u.H}},handler:u.b}})},9639(e,t,l){l.d(t,{U:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.collection))})},146(e,t,l){l.d(t,{t:()=>s});var o=l(504),n=l(7583),i=l(7123),r=l(8481),a=l(2606);class s extends a.R{onMount(){super.onMount(),this.previousBeforeRenderHash=this.context.location.search}getDirtyTrackingVersion(e,t,l,o){var n;let i=new Set,r=(null==l||null==(n=l.getResourceName)?void 0:n.call(l))||o.associationName||o.collectionName;r&&i.add(String(r)),o.associationName&&i.add(String(o.associationName)),o.collectionName&&i.add(String(o.collectionName));let a=0;for(let l of i)a+=e.getDataSourceDirtyVersion(t,l);return a}onActive(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.hidden&&this.previousBeforeRenderHash!==this.context.location.search&&(this.rerender(),!e)||this.hidden)return;let t=this.context.resource;if(!t)return;let l=this.getResourceSettingsInitParams(),o=t.getDataSourceKey()||l.dataSourceKey||"main",n=this.context.engine,i=this.getDirtyTrackingVersion(n,o,t,l);if(e){if(this.dirtyRefreshing)return;this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(n,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1});return}this.isManualRefresh||null!==this.lastSeenDirtyVersion&&i===this.lastSeenDirtyVersion||this.dirtyRefreshing||(this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(n,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1}))}static filterCollection(e){return!!e.filterTargetKey}static isCollectionAvailable(e){if(!e)return!1;let t=(0,r.b1)(this);return(0,r.F3)(e,t)}static async defineChildren(e){let t=t=>{var l;if(!(null==(l=this.meta)?void 0:l.createModelOptions))return t||{};if("function"==typeof this.meta.createModelOptions){let l=this.meta.createModelOptions(e);return n.default.merge({},l,t)}return n.default.merge({},this.meta.createModelOptions,t)},l=e=>this.name+e,{dataSourceKey:i,collectionName:r,associationName:a,filterByTk:s}=e.view.inputArgs,d=e.dataSourceManager.getDataSources().map(e=>0===e.getCollections().length?null:{key:l(`ds-${e.key}`),label:e.displayName,searchable:!0,searchPlaceholder:(0,o.tExpr)("Search"),children:o=>e.getCollections().map(o=>{if(!this.filterCollection(o)||!this.isCollectionAvailable(o))return null;let n={dataSourceKey:o.dataSourceKey,collectionName:o.name};return{key:l(`ds-${e.key}.${o.name}`),label:o.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)}).filter(Boolean),u=e=>1===d.length?d[0].children(e):d;if(!r)return u(e);if(this._isScene("select")){let o={dataSourceKey:i,collectionName:r};a&&(o.associationName=a,o.sourceId="{{ctx.view.inputArgs.sourceId}}");let n=e.dataSourceManager.getCollection(i,r),s=[];return this.isCollectionAvailable(n)&&s.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:o}}})}),s.push({key:l("others-collections"),label:"Other collections",children:u(e)}),s}if(this._isScene("new")){let o={dataSourceKey:i,collectionName:r};a&&(o.associationName=a,o.sourceId="{{ctx.view.inputArgs.sourceId}}");let n=[],d=e.dataSourceManager.getCollection(i,r);return this.isCollectionAvailable(d)&&n.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:o}}})}),null!=s&&n.push({key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(i,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let o=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(o="{{ctx.view.inputArgs.filterByTk}}");let n={dataSourceKey:i,collectionName:e.target,associationName:e.resourceName,sourceId:o};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)}),n.push({key:l("others-collections"),label:"Other collections",children:u(e)}),n}let c=[{key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(i,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let o=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(o="{{ctx.view.inputArgs.filterByTk}}");let n={dataSourceKey:i,collectionName:e.target,associationName:e.resourceName,sourceId:o};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)},{key:l("others-records"),label:"Other records",children:u(e)}];if(this._isScene("one")){let o=e.dataSourceManager.getCollection(i,r);if(!o||!this.filterCollection(o)||!this.isCollectionAvailable(o))return c;let n={dataSourceKey:i,collectionName:r,filterByTk:"{{ctx.view.inputArgs.filterByTk}}"};a&&(n.associationName=a,n.sourceId="{{ctx.view.inputArgs.sourceId}}"),c.unshift({key:l("current-record"),label:"Current record",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})})}return c}get dataSource(){return this.context.dataSource}get collection(){return this.context.collection}get resource(){return this.context.resource}get association(){return this.context.association}get associationField(){return this.context.association}getAclActionName(){return"view"}async getFilterFields(){return this.collection.getFields().filter(e=>e.filterable)}getResourceSettingsInitParams(){return this.getStepParams("resourceSettings","init")}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1}),this.context.defineProperty("resourceName",{get:()=>this.resource.getResourceName(),cache:!1}),this.context.defineProperty("dataSource",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getDataSource(e.dataSourceKey)}}),this.context.defineProperty("collection",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getCollection(e.dataSourceKey,e.collectionName)}}),this.context.defineProperty("resource",{get:()=>{let e=this.getResourceSettingsInitParams(),t=this.createResource(this.context,e);t.setDataSourceKey(e.dataSourceKey),t.setResourceName(e.associationName||e.collectionName);let l=()=>{var l;let o=this.context.engine;if(!(null==o?void 0:o.getDataSourceDirtyVersion))return;let n=(null==(l=t.getDataSourceKey)?void 0:l.call(t))||e.dataSourceKey||"main";this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(o,n,t,e)};return l(),t.on("refresh",()=>{l(),this.invalidateFlowCache("beforeRender")}),t}}),this.context.defineProperty("association",{get:()=>{let e=this.getResourceSettingsInitParams();if(e.associationName)return this.dataSource.getAssociation(e.associationName)}})}createResource(e,t){throw Error("createResource method must be implemented in subclasses of CollectionBlockModel")}refresh(){return this.resource?this.resource.refresh():super.refresh()}defaultBlockTitle(){var e,t,l,o,n,r,a;let s=this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name),d=(null==(t=this.dataSource)?void 0:t.displayName)||(null==(l=this.dataSource)?void 0:l.key),u=(null==(r=this.context)||null==(n=r.dataSourceManager)||null==(o=n.getDataSources)?void 0:o.call(n).length)||0,c=null==(a=this.collection)?void 0:a.title;if(this.association){let e=this.resource.getResourceName(),t=this.dataSource.getCollection(e.split(".")[0]);return(0,i.l)({blockLabel:s,dsName:d,dsCount:u,collectionTitle:c,sourceCollectionTitle:t.title,associationTitle:this.association.title})}return(0,i.l)({blockLabel:s,dsName:d,dsCount:u,collectionTitle:c})}addAppends(e){var t,l;let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)if(e.includes(".")){let[l,n]=e.split("."),i=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${l}`);if(!i)return;let r=i.target;if(!r)return;let a=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${r}.${n}`);if(a&&a.isAssociationField()){if(this.resource.addAppends(e),(null==(t=a.targetCollection)?void 0:t.template)==="tree"){let t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;a.name===t&&this.resource.addAppends(`${e}.parent(recursively=true)`)}o&&this.resource.refresh()}}else{if(!this.collection)return;let t=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${e}`);if(!t)return;t.isAssociationField()&&(this.resource.addAppends(t.name),(null==(l=t.targetCollection)?void 0:l.template)==="tree"&&this.resource.addAppends(`${t.name}.parent(recursively=true)`),o&&this.resource.refresh())}}constructor(...e){super(...e),this.isManualRefresh=!1,this.collectionRequired=!0,this.lastSeenDirtyVersion=null,this.dirtyRefreshing=!1}}s.registerFlow({key:"resourceSettings",sort:-999,steps:{collectionCheck:{handler(e){e.collection||e.exitAll()}},aclCheck:{use:"aclCheck"},init:{handler(e,t){if(!t.dataSourceKey)throw Error("dataSourceKey is required");if(!t.collectionName)throw Error("collectionName is required");Object.keys(t).includes("sourceId")&&e.resource.setSourceId(t.sourceId),Object.keys(t).includes("filterByTk")&&e.resource.setFilterByTk(t.filterByTk)}}}}),s.registerFlow({key:"refreshSettings",sort:1e4,steps:{refresh:{async handler(e){let t=e.model,l=e.model.context.filterManager,n=(null==l?void 0:l.prepareFiltersForTarget)?await l.prepareFiltersForTarget(e.model.uid):void 0;l&&l.bindToTarget(e.model.uid);let i=t.getDataLoadingMode(),r=t.resource;if(r instanceof o.MultiRecordResource&&"manual"===i&&!t.hasActiveFilters()){r.setData([]),r.setMeta({count:0,hasNext:!1,page:1}),r.loading=!1;return}null==n||n.forEach(t=>{var l;null==t||null==(l=t.markInitialTargetRefreshHandled)||l.call(t,e.model.uid)}),e.model.isManualRefresh?e.model.resource.loading=!1:await e.model.resource.refresh()}}}}),s.registerFlow({key:"dataLoadingModeSettings",sort:800,title:(0,o.tExpr)("Set data loading mode"),steps:{dataLoadingMode:{use:"dataLoadingMode"}}}),s.define({hide:!0})},2606(e,t,l){l.d(t,{R:()=>i});var o=l(504),n=l(3890);class i extends n.z{}i.define({hide:!0,label:(0,o.tExpr)("Data blocks"),async children(e){let t=await (0,o.buildSubModelItems)(i)(e),{collectionName:l,filterByTk:n,scene:r}=e.view.inputArgs;return t.filter(t=>{var o,i,a,s,d,u,c;let p=e.engine.getModelClass(t.useModel);return"select"===r?null==(s=p._isScene)?void 0:s.call(p,"select"):"subForm"===r?null==(d=p._isScene)?void 0:d.call(p,"subForm"):"bulkEditForm"===r?null==(u=p._isScene)?void 0:u.call(p,"bulkEditForm"):"new"===r||l&&!n?null==(c=p._isScene)?void 0:c.call(p,"new"):!p._isScene||!(null==(o=p._isScene)?void 0:o.call(p,"select"))&&!(null==(i=p._isScene)?void 0:i.call(p,"subForm"))&&!(null==(a=p._isScene)?void 0:a.call(p,"bulkEditForm"))})}})},6859(e,t,l){l.d(t,{o:()=>n});var o=l(504);class n extends o.FlowModel{static resolveUse(e,t,l){var o,n;let i=null==e||null==(n=e.stepParams)||null==(o=n.fieldBinding)?void 0:o.use;return i&&i!==(null==e?void 0:e.use)?i:null==e?void 0:e.use}}},1882(e,t,l){l.d(t,{L:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.record))})},3027(e,t,l){l.d(t,{GO:()=>h,KW:()=>g,Z1:()=>p,eu:()=>m,nF:()=>c,zL:()=>s});var o=l(1178),n=l(504),i=l(1649),r=l(9639),a=l(1882);let s="assignFieldValues";function d(e){let t=null==e?void 0:e.collection;return t&&"object"==typeof t?t:void 0}function u(e){let t=d(e),l=null==t?void 0:t.dataSourceKey,o=null==t?void 0:t.name;return l&&o?{dataSourceKey:l,collectionName:o}:void 0}function c(e){return{async:!0,use:"AssignFormModel",stepParams:{resourceSettings:{init:u(e)}}}}function p(e,t){var l,o;let n=(null==(l=(o=e.model).getStepParams)?void 0:l.call(o,t,s))||{};return{assignedValues:(null==n?void 0:n.assignedValues)||{}}}async function m(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AssignFieldValues";try{return await (0,n.resolveRunJSObjectValues)(e,t)}catch(t){var o,i,r;return console.error(`[${l}] RunJS execution failed`,t),null==(r=e.message)||null==(i=r.error)||i.call(r,(null==(o=e.t)?void 0:o.call(e,"RunJS execution failed"))||"RunJS execution failed"),null}}function h(e,t){return t&&"object"==typeof t&&Object.keys(t).length?{...e,...t}:e}function f(e){let{model:t,blockModel:l}=(0,n.useFlowSettingsContext)(),u=t,c=(0,n.useFlowEngine)(),p=(0,i.useRef)(!1),[m,h]=i.default.useState(null);return(0,i.useEffect)(()=>{let e=!1;return(async()=>{let l=await c.loadOrCreateModel({parentId:u.uid,subKey:"assignForm",use:"AssignFormModel"},{skipSave:!t.context.flowSettingsEnabled});e||(h(l),u.assignFormUid=(null==l?void 0:l.uid)||u.assignFormUid)})(),()=>{e=!0}},[u,c,t.context.flowSettingsEnabled]),(0,i.useEffect)(()=>{var t,o;if(p.current||!m)return;let n=(null==(t=u.getStepParams)?void 0:t.call(u,e.settingsFlowKey,s))||{},i=(null==l?void 0:l.collection)||d(null==u?void 0:u.context),c=null==i?void 0:i.dataSourceKey,h=null==i?void 0:i.name;c&&h&&m.setStepParams("resourceSettings","init",{dataSourceKey:c,collectionName:h}),m.setInitialAssignedValues((null==n?void 0:n.assignedValues)||{}),(e.clearRecordContext||u instanceof r.U&&!(u instanceof a.L))&&(null==(o=m.context)?void 0:o.defineProperty)&&m.context.defineProperty("record",{get:()=>void 0,cache:!1}),p.current=!0},[u,null==l?void 0:l.collection,m,e.clearRecordContext,e.settingsFlowKey]),m?(0,o.jsx)(n.FlowModelRenderer,{model:m,showFlowSettings:!1}):null}function g(e){return{title:e.title||(0,n.tExpr)("Assign field values"),uiSchema:()=>({tip:e.tipComponent?{"x-decorator":"FormItem","x-component":e.tipComponent}:void 0,editor:{"x-decorator":"FormItem","x-component":()=>(0,o.jsx)(f,{settingsFlowKey:e.settingsFlowKey,clearRecordContext:e.clearRecordContext})}}),async beforeParamsSave(t){var l,o,n,i,r,a,d;let u=t.model.assignFormUid?null==(l=(o=t.engine).getModel)?void 0:l.call(o,t.model.assignFormUid,!0):void 0;if(!u)return;e.validateBeforeSave&&await (null==(d=u.form)||null==(a=d.validateFields)?void 0:a.call(d));let c=(null==(n=u.getAssignedValues)?void 0:n.call(u))||{};null==(i=(r=t.model).setStepParams)||i.call(r,e.settingsFlowKey,s,{assignedValues:c})},handler(){}}}},6832(e,t,l){l.r(t),l.d(t,{DateFilterDynamicComponent:()=>_});var o=l(1178),n=l(1649),i=l(2793),r=l(691),a=l(504),s=l(6305),d=l(3526),u=l(7583);let c=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,p=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},m=e=>{let{value:t,picker:l="date",format:r,showTime:m,timeFormat:h}=e,f=(0,a.useFlowEngine)(),g=f.translate.bind(f),y=(0,s.fD)(),v=[{label:g("Today"),value:y.today},{label:g("Last week"),value:y.lastWeek},{label:g("This week"),value:y.thisWeek},{label:g("Next week"),value:y.nextWeek},{label:g("Last month"),value:y.lastMonth},{label:g("This month"),value:y.thisMonth},{label:g("Next month"),value:y.nextMonth},{label:g("Last quarter"),value:y.lastQuarter},{label:g("This quarter"),value:y.thisQuarter},{label:g("Next quarter"),value:y.nextQuarter},{label:g("Last year"),value:y.lastYear},{label:g("This year"),value:y.thisYear},{label:g("Next year"),value:y.nextYear},{label:g("Last 7 days"),value:y.last7Days},{label:g("Next 7 days"),value:y.next7Days},{label:g("Last 30 days"),value:y.last30Days},{label:g("Next 30 days"),value:y.next30Days},{label:g("Last 90 days"),value:y.last90Days},{label:g("Next 90 days"),value:y.next90Days}],_=t?(0,s.Pn)(null==t?void 0:t[0],l):l,b=_===l&&r?r:(0,d.getPickerFormat)(_),x="date"===_?c(b):b,M=(0,d.getDateTimeFormat)(_,x,m,h),w={utc:!0,presets:v,...e,format:M,picker:_,showTime:!!m&&{defaultValue:[(0,d.dayjs)("00:00:00","HH:mm:ss"),(0,d.dayjs)("23:59:59","HH:mm:ss")]}},S=(0,n.useMemo)(()=>u.default.castArray(e.value).map(e=>p(e,M)),[e.value,M]);return(0,o.jsx)(i.DatePicker.RangePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:S})},h=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,f=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},g=e=>{let{picker:t="date",format:l,showTime:r,timeFormat:u,onChange:c}=e,p=(0,a.useFlowContext)(),m=Array.isArray(e.value)?e.value[0]:e.value,g=m?(0,s.Pn)(m,t):t,[y,v]=(0,n.useState)(g),_=p.model.translate.bind(p.model),b=e=>{let o=e===t&&l?l:(0,d.getPickerFormat)(e),n="date"===e?h(o):o;return(0,d.getDateTimeFormat)(e,n,r,u)},x=(0,n.useMemo)(()=>b(y),[l,t,r,y,u]),M=(0,n.useMemo)(()=>f(m,x),[m,x]),w={utc:!0,inputReadOnly:p.isMobileLayout,...e,underFilter:!0,showTime:!!r&&{defaultValue:(0,d.dayjs)("00:00:00","HH:mm:ss")},format:x,picker:y};return(0,o.jsxs)(i.Space.Compact,{style:{width:"100%"},children:[(0,o.jsx)(i.Select,{style:{width:"100px"},popupMatchSelectWidth:!1,value:y,options:[{label:_("Date"),value:"date"},{label:_("Month"),value:"month"},{label:_("Quarter"),value:"quarter"},{label:_("Year"),value:"year"}],onChange:e=>{let t=b(e),l=x;if(v(e),!m||!c)return;let o=f(m,l);o&&o.isValid()&&c(o,o.format(t))}}),(0,o.jsx)(i.DatePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:M})]})},y=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=[{value:"exact",label:e("Exact day")},{value:"past",label:e("Past")},{value:"next",label:e("Next")},{value:"today",label:e("Today")},{value:"yesterday",label:e("Yesterday")},{value:"tomorrow",label:e("Tomorrow")},{value:"thisWeek",label:e("This Week")},{value:"lastWeek",label:e("Last Week")},{value:"nextWeek",label:e("Next Week")},{value:"thisMonth",label:e("This Month")},{value:"lastMonth",label:e("Last Month")},{value:"nextMonth",label:e("Next Month")},{value:"thisQuarter",label:e("This Quarter")},{value:"lastQuarter",label:e("Last Quarter")},{value:"nextQuarter",label:e("Next Quarter")},{value:"thisYear",label:e("This Year")},{value:"lastYear",label:e("Last Year")},{value:"nextYear",label:e("Next Year")}];return t&&l.splice(3,0,{value:"now",label:e("Now")}),l},v=e=>{let{isRange:t,defaultValue:l,onChange:i,...r}=e,a=(0,n.useCallback)((e,t)=>i(t),[i]);return t?(0,o.jsx)(m,{...r,onChange:a}):(0,o.jsx)(g,{...r,onChange:a})},_=e=>{let{value:t,onChange:l,includeNow:s=!1,...d}=e,u=(0,a.useFlowEngine)(),c=u.translate.bind(u),{token:p}=i.theme.useToken(),[m,h]=(0,n.useState)(!1),f=(0,n.useMemo)(()=>y(c,s),[c,s]),g=e=>{if(h(!1),"exact"===e)return l(void 0);let t={type:e};["past","next"].includes(e)&&(t.number=1,t.unit="day"),l(t)},_=()=>{let e=f.slice(0,3),t=f.slice(3),l=(0,r.css)`
165
+ ${n}`,u)}}let o=T(e.issues.filter(e=>"runtime"===e.type)),n=o?`Key runtime issue: ${j(o)}`:"",i=["RunJS preview output was truncated.",t,e.execution?I(e.execution):void 0,n||void 0].filter(Boolean).join("\n").trim();return i.length<=u?i:L(i,u-1)+"\n"}function Y(e){return R(e)}async function E(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="string"==typeof e?e:String(e??""),n=[],i=[],r=null==l?void 0:l.version,a=(0,s.shouldPreprocessRunJSTemplates)({version:r});i.push(...C(o)),i.push(...A(o));let d="u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now(),u={started:!1,finished:!1,timeout:!1,durationMs:void 0};try{u.started=!0;let{consoleCapture:e,loggerCapture:l}=P(n),d={console:e};try{if("u">typeof window){let e=(0,s.createSafeNavigator)();d.navigator=e,d.window=(0,s.createSafeWindow)({navigator:e}),d.document=(0,s.createSafeDocument)()}}catch(e){}let p=o;try{p=await (0,s.prepareRunJsCode)(o,{preprocessTemplates:a})}catch(o){let e=String((null==o?void 0:o.name)||""),t=y((null==o?void 0:o.message)||o),l=o instanceof SyntaxError||/^SyntaxError\b/i.test(e)||/SyntaxError\b/i.test(t);return i.push({type:"runtime",ruleId:l?"preview-start-failed":"internal",message:l?t:`Preview internal failure: ${t}`,stack:M(o)}),u.finished=!0,u.timeout=!1,{issues:k(i),logs:n,execution:u}}let m=await t.createJSRunner({globals:d,timeoutMs:c,version:r});m.globals.ctx.defineProperty("logger",{value:l});let h=await m.run(p);if(u.finished=!0,u.timeout=!!(null==h?void 0:h.timeout),!(null==h?void 0:h.success)){let e=null==h?void 0:h.error,t=(null==h?void 0:h.timeout)?"Execution timed out":y((null==e?void 0:e.message)||e||"Unknown error"),l=e instanceof SyntaxError||/^SyntaxError\b/i.test(String((null==e?void 0:e.name)||""));i.push({type:"runtime",ruleId:(null==h?void 0:h.timeout)?"timeout":l?"preview-start-failed":"runtime-error",message:t,stack:M(e)})}}catch(e){u.finished=!0,u.timeout=!1,i.push({type:"runtime",ruleId:"internal",message:`Preview internal failure: ${y((null==e?void 0:e.message)||e)}`,stack:M(e)})}finally{let e=Math.max(0,("u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now())-d);u.durationMs=Number.isFinite(e)?e:void 0}return{issues:k(i),logs:n,execution:u}}function N(e){let t=new s.FlowContext;if(t.addDelegate(e),"u">typeof document&&"function"==typeof document.createElement&&!e.element)try{let e=document.createElement("div");t.defineProperty("element",{value:e})}catch(e){}return t}async function O(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=N(t),n=await E(e,o,l),i=0===n.issues.length,r=Y(n);return{success:i,message:r.length>u?L(r,u):r}}},8442(e,t,l){l.d(t,{a:()=>r});var o=l(1178),n=l(2793);l(1649);var i=l(5886);let r=(0,l(504).observer)(e=>{var t;let{value:l,FilterItem:r,ctx:a}=e;l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let s=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("reset")},d=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("submit")},u=(null==a||null==(t=a.model)?void 0:t.translate)||(e=>e);return(0,o.jsxs)("form",{onSubmit:e=>{e.preventDefault(),d()},children:[(0,o.jsx)(i.I,{value:l,FilterItem:r}),(0,o.jsxs)(n.Space,{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[(0,o.jsx)(n.Button,{htmlType:"button",onClick:s,children:u("Reset")}),(0,o.jsx)(n.Button,{type:"primary",htmlType:"submit",children:u("Submit")})]})]})},{displayName:"FilterContent"})},5886(e,t,l){l.d(t,{I:()=>c});var o=l(1178),n=l(2113),i=l(2793),r=l(7843);l(1649);var a=l(504);let s=new WeakMap,d=0,u=e=>{let t=s.get(e);return t||(d+=1,t=`filter-item-${d}`,s.set(e,t)),t},c=(0,a.observer)(e=>{let{token:t}=i.theme.useToken(),{value:l={logic:"$and",items:[]},FilterItem:a,showBorder:s=!1,onRemove:d,onChange:p,closeIcon:m=(0,o.jsx)(n.CloseCircleOutlined,{style:{color:t.colorIcon}})}=e,{t:h}=(0,r.useTranslation)();l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let{logic:f,items:g}=l,y=s?{position:"relative",border:`1px dashed ${t.colorBorder}`,padding:t.paddingSM,marginBottom:t.marginXS,borderRadius:t.borderRadius}:{position:"relative",marginBottom:t.marginXS},v=e=>{l.logic=e,null==p||p(l)},_=()=>{g.push({path:"",operator:"",value:""}),null==p||p(l)},b=()=>{g.push({logic:"$and",items:[]}),null==p||p(l)},x=e=>{g.splice(e,1),null==p||p(l)},M=e=>"path"in e||"operator"in e||"value"in e,w=e=>"logic"in e&&"items"in e;return(0,o.jsxs)("div",{style:y,children:[s&&d&&(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{position:"absolute",right:10,top:10,cursor:"pointer",background:"transparent",border:0,padding:0},onClick:d,children:m}),(0,o.jsx)("div",{style:{marginBottom:8,color:t.colorText},children:(0,o.jsxs)("span",{children:[h("Meet")," ",(0,o.jsxs)(i.Select,{"data-testid":"filter-select-all-or-any",style:{width:"auto"},value:f,onChange:v,children:[(0,o.jsx)(i.Select.Option,{value:"$and",children:h("All")}),(0,o.jsx)(i.Select.Option,{value:"$or",children:h("Any")})]})," ",h("conditions in the group")]})}),(0,o.jsx)("div",{children:g.map((e,n)=>w(e)?(0,o.jsx)(c,{value:e,FilterItem:a,showBorder:!0,onRemove:()=>x(n),onChange:e=>{g[n]=e,null==p||p(l)}},u(e)):M(e)?a?(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)(a,{value:e}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:"pointer",background:"transparent",border:0,padding:0},onClick:()=>x(n),children:m})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsxs)("span",{children:[e.path," ",e.operator," ",String(e.value)]}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:"pointer",background:"transparent",border:0,padding:0},onClick:()=>x(n),children:m})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{color:t.colorTextTertiary},children:"Invalid filter item"}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:"pointer",background:"transparent",border:0,padding:0},onClick:()=>x(n),children:m})]})},u(e)))}),(0,o.jsxs)(i.Space,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:_,children:h("Add condition")}),(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:b,children:h("Add condition group")})]})]})},{displayName:"FilterGroup"})},937(e,t,l){l.d(t,{H:()=>o});let o=(e,t,l,o)=>e.map(e=>n(e,t,l,o)).filter(Boolean),n=(e,t,l,n)=>{var i;if(l.length&&1===t&&l.includes(e.name)||!e.interface||!1===e.filterable)return;let r=e.getInterfaceOptions();if(!(null==r?void 0:r.filterable))return;let{nested:a,children:s,operators:d}=r.filterable,u={name:e.name,type:e.type,target:e.target,title:n(e.title),schema:null==e?void 0:e.uiSchema,operators:((null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]).map(e=>({...e,label:n(e.label)}))};if(!e.target||!(t>2)){if(t>2)return u;if((null==s?void 0:s.length)&&(u.children=s),a){let i=o(e.getFields().filter(e=>"attachments"!==e.target&&"formula"!==e.interface),t+1,l,n).filter(Boolean);u.children=u.children||[],u.children.push(...i)}return u}}},9078(e,t,l){l.d(t,{Ru:()=>j,I8:()=>n.I,qi:()=>u,oJ:()=>o.a,Et:()=>x,uw:()=>I.u});var o=l(8442),n=l(5886),i=l(1178),r=l(504),a=l(2793),s=l(1649),d=l(937);let u=(0,r.observer)(e=>{var t;let{path:l,operator:o,value:n}=e.value,r=e.model,u=(null==(t=r.context.blockModel.collection)?void 0:t.getFields().filter(e=>"attachments"!==e.target))||[],p=c(r.props.filterableFieldNames||[],u.map(e=>e.name)),m=r.translate,h=(0,d.H)(u.filter(e=>"attachments"!==e.target&&"formula"!==e.interface&&!["belongsTo","belongsToMany","hasOne","hasMany","oho","obo","m2o","o2m","m2m"].includes(e.type)),1,e.noIgnore?[]:p,m).filter(Boolean),f=(0,s.useMemo)(()=>{let e=h.find(e=>e.name===l);return(null==e?void 0:e.operators)||[]},[h,l]),g=t=>{var l;e.value.path=t;let o=h.find(e=>e.name===t);(null==o||null==(l=o.operators)?void 0:l.length)>0?e.value.operator=o.operators[0].value:e.value.operator="",e.value.value=""},y=t=>{e.value.operator=t},v=t=>{e.value.value=t.target.value};return(0,i.jsxs)(a.Space,{children:[(0,i.jsx)(a.Select,{style:{width:200},placeholder:m("Select field"),value:l||void 0,onChange:g,children:h.map(e=>(0,i.jsx)(a.Select.Option,{value:e.name,children:e.title},e.name))}),(0,i.jsx)(a.Select,{style:{width:120},placeholder:m("Select operator"),value:o||void 0,onChange:y,disabled:!l||0===f.length,children:f.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),(0,i.jsx)(a.Input,{style:{width:200},placeholder:m("Enter value"),value:n,onChange:v})]})},{displayName:"FilterItem"});function c(e,t){return null==t?void 0:t.filter(t=>!e.includes(t))}var p=l(6305),m=l(7583),h=l(6220),f=l(7309),g=l(7720);let{DateFilterDynamicComponent:y}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent");async function v(e){var t,l,o,n;let i=async e=>Array.isArray(e)?e:"function"==typeof e?await e():[];if(null==(l=e.getPropertyOptions)||null==(t=l.call(e,"collection"))?void 0:t.meta){let t=null==(n=e.getPropertyMetaTree)?void 0:n.call(e,"{{ ctx.collection }}");return await i(t)}let a=()=>(null==e?void 0:e.collection)??null,s=await (0,r.createEphemeralContext)(e,{defineProperties:{collection:{get:a,meta:(0,r.createCollectionContextMeta)(a,"Current collection")}}}),d=null==(o=s.getPropertyMetaTree)?void 0:o.call(s,"{{ ctx.collection }}");return await i(d)}function _(e,t,l,o){var n;let r=null==e?void 0:e["x-component"],s=(null==t||null==(n=t.uiSchema)?void 0:n["x-component-props"])||{},d=(null==e?void 0:e["x-component-props"])||{},u=(0,__rspack_external_lodash_merge_8f812c65.default)({},s,d),c=(0,f.di)(null==e?void 0:e.enum,l)||[],p={style:{width:200,...(null==u?void 0:u.style)||{}},placeholder:(null==u?void 0:u.placeholder)||l("Enter value"),...u},m=e=>{if("number"==typeof e||(null==u?void 0:u.stringMode)===!0&&"string"==typeof e)return e};return e=>{let{value:t,onChange:l,...n}=e||{};if("InputNumber"===r)return(0,i.jsx)(a.InputNumber,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("NumberPicker"===r)return(0,i.jsx)(h.NumberPicker,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("Switch"===r)return(0,i.jsx)(a.Switch,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e)});if("Select"===r)return(0,i.jsx)(a.Select,{options:c,...p,...n,value:(0,f.xO)(t,p),onChange:e=>null==l?void 0:l(e)});if("Checkbox"===r)return(0,i.jsx)(a.Checkbox,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e.target.checked)});if("Checkbox.Group"===r)return(0,i.jsx)(a.Checkbox.Group,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Radio.Group"===r)return(0,i.jsx)(a.Radio.Group,{...p,...n,value:Array.isArray(t)||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:void 0,onChange:e=>null==l?void 0:l(e.target.value)});if("Cascader"===r)return(0,i.jsx)(a.Cascader,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Input.TextArea"===r||"TextArea"===r)return(0,i.jsx)(a.Input.TextArea,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)});if("DateFilterDynamicComponent"===r)return(0,i.jsx)(y,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e)});if(r&&(null==o?void 0:o.getComponent)){let e=o.getComponent(r);if(e)return(0,i.jsx)(e,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e),style:{width:200,...p.style||{},...null==n?void 0:n.style}})}return(0,i.jsx)(a.Input,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)})}}function b(e){if(e&&"object"==typeof e){let l=e;if("function"==typeof l.preventDefault||l.nativeEvent||"target"in l){var t;let o=null==(t=l.target)?void 0:t.value;return void 0!==o?o:e}}return e}let x=(0,r.observer)(e=>{let{value:t,model:l,rightAsVariable:o,rightMetaTree:n,ignoreFieldNames:d}=e,u=(0,r.useFlowViewContext)(),c=l.translate,{path:h,operator:y,value:x}=t,[M,w]=(0,s.useState)(null),S=(0,s.useCallback)(e=>{var t;return(0,p.w6)(e,l.context.dataSourceManager,null==(t=l.context.app)?void 0:t.dataSourceManager)},[l]),k=(0,s.useMemo)(()=>{var e,t;if(!M)return[];let l=M.interface?S(M.interface):void 0,o=null==M||null==(e=M.uiSchema)?void 0:e["x-filter-operators"];return((Array.isArray(o)&&o.length?o:null==l||null==(t=l.filterable)?void 0:t.operators)||[]).filter(e=>!e.visible||e.visible(M))},[S,M]);(0,s.useEffect)(()=>{if(!k.length)return;let e=m.default.find(k,e=>e.value===t.operator);if(e)t.noValue=!!e.noValue;else{let e=k[0];t.operator=e.value,t.value=!!e.noValue||void 0,t.noValue=!!e.noValue}},[k,t]);let F=(0,s.useMemo)(()=>k.map(e=>({value:e.value,label:"string"==typeof e.label?c(e.label):e.label})),[k,c]),C=(0,s.useCallback)((e,l)=>{let o=t.path||"",n=e||"",i=n!==o;t.path=n,i&&o&&(t.operator="",t.value=void 0,t.noValue=!1),l&&w(l)},[t]),A=(0,s.useMemo)(()=>({resolveValueFromPath:e=>(w(e),(null==e?void 0:e.paths.slice(1).join("."))||null),resolvePathFromValue(e){if(null==e)return;let t=String(e).trim();if(t)return["collection",...t.split(".")]}}),[]),P=(0,s.useCallback)(e=>{t.operator=e;let l=k.find(t=>t.value===e);(null==l?void 0:l.noValue)?(t.value=!0,t.noValue=!0):(t.value=void 0,t.noValue=!1)},[k,t]),T=(0,s.useMemo)(()=>k.find(e=>e.value===y),[k,y]),j=(0,s.useCallback)(e=>{var t,l;return(null==e||null==(t=e.options)?void 0:t.dataType)||(null==e?void 0:e.dataType)||(null==e?void 0:e.type)||(null==e||null==(l=e.uiSchema)?void 0:l.type)||"double"},[]),I=(0,s.useCallback)(e=>{switch(e){case"boolean":return"Switch";case"date":return"DateFilterDynamicComponent";case"integer":case"bigInt":case"double":case"decimal":case"number":return"InputNumber";default:return"Input"}},[]),L=(0,s.useMemo)(()=>{let e=(null==M?void 0:M.uiSchema)||{},t=(null==T?void 0:T.schema)||{},l=(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t);if((null==M?void 0:M.interface)==="formula"){let e={"x-read-pretty":!1,"x-component":I(j(M)),"x-component-props":{...l["x-component-props"]}};return(0,__rspack_external_lodash_merge_8f812c65.default)({},l,e)}return l},[M,T,I,j]),D=s.default.useRef(null==L?void 0:L["x-component"]),R=null==L?void 0:L["x-component"],Y=(0,s.useMemo)(()=>{let e=D.current;D.current=R;let l=void 0!==e&&e!==R;if(null==T?void 0:T.noValue)return x;if(l&&null!=x){t.value=void 0;return}return x},[R,x,t,T]),E=(0,s.useCallback)(e=>{t.value=b(e)},[t]),N=s.default.useRef(c);s.default.useEffect(()=>{N.current=c},[c]);let O=s.default.useCallback(e=>{var t;return(null==(t=N.current)?void 0:t.call(N,e))??e},[]),B=(0,s.useMemo)(()=>(0,f.di)(null==L?void 0:L.enum,O)||[],[L,O]),H=(0,s.useMemo)(()=>_(L,M,O,l.context.app),[L,M,O,l.context.app]),V=(0,s.useCallback)(()=>{let e=(0,g._)(l.context.app,y,k),t="$in"===y||"$notIn"===y;if(e&&t){let{Comp:t,props:l}=e,o={...l};(!(null==o?void 0:o.options)||(null==o?void 0:o.options.length)===0)&&(null==B?void 0:B.length)&&(o.options=B);let n={flex:"1 1 40%",minWidth:160,maxWidth:"100%",...(null==o?void 0:o.style)||{}},r=Array.isArray(Y)&&Y.every(e=>"string"==typeof e||"number"==typeof e)?Y:"string"==typeof Y?Y.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)("div",{style:n,children:(0,i.jsx)(t,{...o,style:{width:"100%",...(null==o?void 0:o.style)||{}},value:r,onChange:e=>E(e)})})}let o=H;return(0,i.jsx)("div",{style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},children:(0,i.jsx)(o,{value:Y,onChange:e=>E(e)})})},[y,k,Y,H,l.context.app,E,B]),q=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${c("Null")}>`,readOnly:!0})},[c]),$=(0,s.useMemo)(()=>async()=>{let e="function"==typeof n?await n():n??u.getPropertyMetaTree(),t=Array.isArray(e)?e:await e();return[{title:c("Constant"),name:"constant",type:"string",paths:["constant"],render:H},{title:c("Null"),name:"null",type:"object",paths:["null"],render:q},...t]},[n,u,H,q,c]),z=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?H:"null"===l?q:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t="string"==typeof e?(0,r.parseValueToPath)(e):void 0;return t||["constant"]}}),[q,H]),K=(0,s.useMemo)(()=>async()=>{let e=await v(l.context),t=async e=>{let t=e.interface?S(e.interface):void 0,o=[],n=null==t?void 0:t.filterable,i=null==n?void 0:n.children;if(Array.isArray(i)&&i.length)for(let t of i){var r,a,s;let n=t.title||t.name,i=(null==(r=l.context)?void 0:r.t)?l.context.t(n):n;o.push({name:t.name,title:i,type:(null==(a=t.schema)?void 0:a.type)||"string",interface:(null==(s=t.schema)?void 0:s["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]})}if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=[...Array.isArray(e)?e:[],...o];return m.default.uniqBy(l,"name")}}}let d=[...Array.isArray(e.children)?e.children:[],...o];return{...e,children:d.length?d:e.children}},o=[];for(let l of e)o.push(await t(l));return o},[S,l]);return(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:h,metaTree:K,onChange:C,converters:A,showValueComponent:!1,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},onlyLeafSelectable:!0,placeholder:c("Select field"),ignoreFieldNames:d}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:c("Comparison"),value:y||void 0,onChange:P,children:F.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==T?void 0:T.noValue)&&(o?(0,i.jsx)(r.VariableInput,{value:Y,onChange:e=>E(e),metaTree:$,converters:z,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:c("Enter value")}):V())]})});var M=l(1793);let{DateFilterDynamicComponent:w}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent");function S(e,t,l){var o,n,r;let s=null==e?void 0:e["x-component"],d=(null==t||null==(o=t.uiSchema)?void 0:o["x-component-props"])||{},u=(null==e?void 0:e["x-component-props"])||{},c=(0,__rspack_external_lodash_merge_8f812c65.default)({},d,u),p=Array.isArray(null==t||null==(n=t.uiSchema)?void 0:n.enum)?null==t||null==(r=t.uiSchema)?void 0:r.enum:void 0,m=(0,f.di)(p,l),g={style:{width:200,...(null==c?void 0:c.style)||{}},placeholder:(null==c?void 0:c.placeholder)||l("Enter value"),...c};return e=>{let{value:t,onChange:o,...n}=e||{};if("InputNumber"===s)return(0,i.jsx)(a.InputNumber,{...g,...n,value:t,onChange:o});if("NumberPicker"===s)return(0,i.jsx)(h.NumberPicker,{...g,...n,value:t,onChange:o});if("Switch"===s)return(0,i.jsx)(a.Switch,{...g,...n,checked:!!t,onChange:o});if("Select"===s){let e=g;return Array.isArray(null==e?void 0:e.options)&&e.options.length>0?e={...e,options:(0,f.ZY)(e.options,l)}:m&&(e={...e,options:m}),(0,i.jsx)(a.Select,{...e,...n,value:(0,f.xO)(t,e),onChange:o})}return"DateFilterDynamicComponent"===s?(0,i.jsx)(w,{...g,...n,value:t,onChange:o}):(0,i.jsx)(a.Input,{...g,...n,value:t,onChange:e=>{var t;return null==o?void 0:o(null==e||null==(t=e.target)?void 0:t.value)}})}}let k=[{value:"$includes",label:"contains",selected:!0},{value:"$notIncludes",label:"does not contain"},{value:"$eq",label:"is"},{value:"$ne",label:"is not"},{value:"$empty",label:"is empty",noValue:!0},{value:"$notEmpty",label:"is not empty",noValue:!0}],F=new Set(["$in","$notIn"]);function C(e,t){let l=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(!o.length)return l;let n=o.find(e=>(null==e?void 0:e.name)==="item");if(!n)return[...o,...l];let i=(0,M.mD)(l,[n]);return[...o.filter(e=>(null==e?void 0:e.name)!=="item"),...i]}function A(e,t){var l,o;return{name:t.name,title:t.title||t.name,type:(null==(l=t.schema)?void 0:l.type)||"string",interface:(null==(o=t.schema)?void 0:o["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]}}async function P(e,t){var l,o;let n=e.interface&&t?t(e.interface):void 0,i=(Array.isArray(null==n||null==(l=n.filterable)?void 0:l.children)?null==n||null==(o=n.filterable)?void 0:o.children:[]).map(t=>A(e,t)),r=async e=>{let l=[...await Promise.all(e.map(e=>P(e,t))),...i];return(0,__rspack_external_lodash_uniqBy_85106929.default)(l,e=>e.name)};if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=Array.isArray(e)?e:[];return await r(l)}}}return Array.isArray(e.children)?{...e,children:await r(e.children)}:i.length?{...e,children:i}:e}async function T(e,t){let l=Array.isArray(e)?e:[];return await Promise.all(l.map(e=>P(e,t)))}let j=(0,r.observer)(e=>{var t;let{value:l,model:o,extraMetaTree:n}=e,d=(0,r.useFlowViewContext)(),u=o.translate,{path:c,operator:m,value:h}=l||{},[y,v]=(0,s.useState)(null),_=(0,s.useRef)(!1),b=(0,s.useMemo)(()=>{if(y){var e,t,l;let n=y.interface?(0,p.w6)(y.interface,o.context.dataSourceManager,null==(e=o.context.app)?void 0:e.dataSourceManager):void 0,i=null==y||null==(t=y.uiSchema)?void 0:t["x-filter-operators"];return((Array.isArray(i)&&i.length?i:null==n||null==(l=n.filterable)?void 0:l.operators)||k).filter(e=>!e.visible||e.visible(y)).map(e=>({value:e.value,label:e.label,noValue:!!e.noValue,schema:e.schema,selected:!!e.selected}))}return[]},[y,o]),x=(0,s.useMemo)(()=>b.map(e=>({value:e.value,label:"string"==typeof e.label?u(e.label):e.label})),[b,u]);(0,s.useEffect)(()=>{if(0!==b.length){if(!m){if(_.current){let e=b.find(e=>e.selected)||b[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1,_.current=!1}return}if(!b.some(e=>e.value===m)){let e=b.find(e=>e.selected)||b[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1}}},[b,m,l]);let M=(0,s.useMemo)(()=>b.find(e=>e.value===m),[b,m]),w=(0,s.useMemo)(()=>{let e=(null==y?void 0:y.uiSchema)||{},t=(null==M?void 0:M.schema)||{};return(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t)},[y,M]),A=(0,s.useRef)(u);(0,s.useEffect)(()=>{A.current=u},[u]);let P=(0,s.useCallback)(e=>{var t;return(null==(t=A.current)?void 0:t.call(A,e))??e},[]),j=(0,s.useMemo)(()=>S(w,y,P),[w,y,P]),I=(0,s.useMemo)(()=>(0,f.di)(null==w?void 0:w.enum,P)||[],[w,P]),L=(0,s.useMemo)(()=>{let e=(0,g._)(o.context.app,m,b),t=F.has(m);if(!e||!t)return j;let{Comp:l,props:n}=e;return e=>{let{value:t,onChange:o,...r}=e||{},a={...n};(null==a?void 0:a.options)&&(null==a?void 0:a.options.length)!==0||!(I.length>0)||(a.options=I);let s=Array.isArray(t)?t:"string"==typeof t?t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)(l,{...a,...r,value:s,onChange:o,style:{width:200,...(null==a?void 0:a.style)||{},...(null==r?void 0:r.style)||{}}})}},[I,o.context.app,b,m,j]),D=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${u("Null")}>`,readOnly:!0})},[u]),R=(0,s.useMemo)(()=>async()=>{let e=C((null==o?void 0:o.context.getPropertyMetaTree())||d.getPropertyMetaTree(),n);return[{title:u("Constant"),name:"constant",type:"string",paths:["constant"]},{title:u("Null"),name:"null",type:"object",paths:["null"]},...e]},[d,o,u,n]),Y=(0,s.useCallback)(async()=>{var e,t;let l=(null==o||null==(t=o.context)||null==(e=t.getPropertyMetaTree)?void 0:e.call(t))||d.getPropertyMetaTree(),i=C(Array.isArray(l)?l:[],n),r=e=>{var t;return(0,p.w6)(e,o.context.dataSourceManager,null==(t=o.context.app)?void 0:t.dataSourceManager)};return await T(i,r)},[d,o,n]),E=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?L:"null"===l?D:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t=(0,r.parseValueToPath)(e);return t||["constant"]}}),[D,L]),N=(0,s.useCallback)((e,t)=>{let o=l.path||"",n=e||"",i=n!==o;l.path=n,i&&o&&(l.operator="",l.value="",_.current=!0),o||!n||l.operator||(_.current=!0),t&&v(t)},[l]),O=(0,s.useCallback)(e=>{let t=l.operator;l.operator=e;let o=b.find(t=>t.value===e);(null==o?void 0:o.noValue)?(l.value=!0,l.noValue=!0):(F.has(t)&&!F.has(e)&&Array.isArray(l.value)&&(l.value=l.value.join("\n")),l.noValue=!1)},[l,b]);return(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:c,onChange:N,metaTree:Y,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:u("Select variable"),onlyLeafSelectable:!0}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:u("Comparison"),value:m||void 0,onChange:O,children:x.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==(t=b.find(e=>e.value===m))?void 0:t.noValue)&&(0,i.jsx)(r.VariableInput,{value:h,onChange:e=>l.value=e,metaTree:R,converters:E,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:u("Enter value"),clearValue:""})]})});var I=l(8102)},8102(e,t,l){l.d(t,{u:()=>r});var o=l(1649),n=l(937);let i=e=>e;function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filterableFieldNames:l,nonfilterableFieldNames:r,noIgnore:a=!1,t:s=i}=t,d=(0,o.useMemo)(()=>(null==e?void 0:e.getFields())||[],[e]),u=(0,o.useMemo)(()=>{let e=!a&&(null==l?void 0:l.length)?d.map(e=>e.name).filter(e=>!l.includes(e)):[],t=r??[];return t.length?Array.from(new Set([...e,...t])):e},[d,l,r,a]);return(0,o.useMemo)(()=>(0,n.H)(d.filter(e=>"attachments"!==e.target&&"formula"!==e.interface),1,u,s).filter(Boolean),[d,u,s])}},8563(e,t,l){l.d(t,{b2:()=>n.b,tn:()=>o.t,S5:()=>n.S});var o=l(8804);l(1178),l(8533),l(8198),l(504),l(1649),l(7326),l(5721);var n=l(5026);l(9253),l(4244)},9378(e,t,l){l.d(t,{g:()=>m});var o=l(1178),n=l(1649);let i=l(7583).default.memoize(async e=>e?(await Promise.resolve().then(l.bind(l,248))).default.render(e):e);function r(e){let[t,l]=(0,n.useState)(""),[o,r]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{r(!0),i(e).then(e=>{l(e),r(!1)}).catch(e=>console.log(e))},[e]),{html:t,loading:o}}function a(e){let t=e,l=document.createElement("div");l.innerHTML=t;let o=l.innerText;return l=null,(null==o?void 0:o.replace(/[\n\r]/g,""))||""}var s=l(2741),d=l(691),u=l(504),c=l(2793);let p=()=>{let e=(0,u.useFlowContext)(),{token:t}=c.theme.useToken(),l=!!e.isDarkTheme,o=new s.TinyColor(t.colorFillAlter).onBackground(t.colorBgContainer).toHexShortString(),n={lineHeight:"inherit","&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},i={"&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return(0,d.css)({lineHeight:t.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:t.lineHeight},".field-interface-datetime":{minWidth:"100px"},img:{maxWidth:"100%"},...l?i:n})},m=e=>{let{textOnly:t,overflowMode:l,style:i}=e,s=p(),{html:d=""}=r(e.value),u=a(d),m="ellipsis"===l,h=(0,n.useRef)(null),[f,g]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(h.current){let e=h.current;g(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)}},[d,i,l]);let y={...i||{},...m?{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-word",cursor:"default"}:{}},v=(0,o.jsx)("div",{ref:h,className:`${s} nb-markdown`,dangerouslySetInnerHTML:{__html:t?u:d},style:y});return m&&f?(0,o.jsx)(c.Tooltip,{title:(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:d},style:{maxHeight:500,overflowY:"auto",padding:10,color:"#000"}}),overlayInnerStyle:{background:"#fff",color:"#000",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},color:"#fff",children:v}):v}},248(e,t,l){function o(e,t){function l(e){return e.split(/\s+/g)[0]}__rspack_external_mermaid.default.initialize({securityLevel:"loose",...t});let o=e.renderer.rules.fence;function n(e,t,n,i,r){let a=e[t],s=a.info.trim();if(-1===["mermaid","{mermaid}"].indexOf(s?l(s):""))return void 0!==o?o(e,t,n,i,r):"";let d="",u=[],c=document.createElement("div");document.body.appendChild(c);try{let e="mermaid-container";__rspack_external_mermaid.default.mermaidAPI.render(e,a.content,t=>{let l=document.getElementById(e);null!==l&&u.push(["style",`max-width:${l.style.maxWidth};max-height:${l.style.maxHeight}`]),d=t},c)}catch(e){return`<div class="alert alert-danger">${e}</div>`}finally{c.remove()}return u.push(["src",`data:image/svg+xml,${encodeURIComponent(d)}`]),`<img ${r.renderAttrs({attrs:u})}>`}e.renderer.rules.fence=n}l.d(t,{default:()=>i});let n=new __rspack_external_markdown_it_a5918e6a.default({html:!0,linkify:!0,typographer:!0,breaks:!0});n.use(__rspack_external_markdown_it_highlightjs_3df446b8.default),n.use(o);let i=n},7309(e,t,l){function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.map(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t=e,l=void 0!==t.label,o=void 0!==t.value,n=l?t.label:String(t.value??""),i=o?t.value:n,r={label:n,value:i};return t.color&&(r.color=t.color),t.icon&&(r.icon=t.icon),r}return{label:String(e),value:e}}):[]}function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return Array.isArray(e)?e.map(e=>"string"==typeof(null==e?void 0:e.label)?{...e,label:t(e.label)}:e):[]}function i(e,t){if(e&&Array.isArray(e)&&0!==e.length)return n(o(e),t)}function r(e,t){let l=null==t?void 0:t.mode,o="multiple"===l||"tags"===l||(null==t?void 0:t.multiple)===!0;return Array.isArray(e)?e.filter(e=>""!==e&&null!=e):""===e||null==e?o?[]:void 0:e}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(Array.isArray(e)?e:null==e?[]:[e]).map(e=>{var l;let o=t.find(t=>(null==t?void 0:t.value)===e);return o?{value:e,label:o.label}:{value:e,label:(null==e||null==(l=e.toString)?void 0:l.call(e))??e}})}function s(e,t){var l,n,i,r;if(!["radioGroup","checkboxGroup","select","multipleSelect"].includes(null==t?void 0:t.interface)||Array.isArray(null==(l=e.props)?void 0:l.options)&&(null==(i=e.props)||null==(n=i.options)?void 0:n.length)>0)return!1;let a=null==(r=t.uiSchema)?void 0:r.enum;if(!Array.isArray(a)||0===a.length)return!1;let s=o(a);return!!s.length&&(e.setProps({options:s}),!0)}l.d(t,{NI:()=>s,ZY:()=>n,di:()=>i,xO:()=>r,yg:()=>a})},9133(e,t,l){l.d(t,{E4:()=>i,Gj:()=>d,a_:()=>o,eo:()=>p,pX:()=>s,w7:()=>r});let o="__custom__";function n(e){return`${o}:${e}`}function i(e){var t;if(!e||"object"!=typeof e)return!1;let l=e;if(!(null==(t=l.isAssociationField)?void 0:t.call(l)))return!1;let o=l.type,n=l.interface;return"belongsToMany"===o||"hasMany"===o||"belongsToArray"===o||"m2m"===n||"o2m"===n||"mbm"===n}function r(e){var t;if(!e||"object"!=typeof e)return;let l=e;return l.collection||(null==(t=l.context)?void 0:t.collection)||void 0}function a(e){return"string"==typeof e?e.trim():""}function s(e){if(!e||"object"!=typeof e)return[];let t=e,l="function"==typeof t.getStepParams?t.getStepParams("fieldSettings","init"):void 0,o=l&&"object"==typeof l?l:void 0,i="function"==typeof t.getStepParams?t.getStepParams("formItemSettings","fieldSettings"):void 0,r=i&&"object"==typeof i?i:void 0,s=(null==o?void 0:o.fieldPath)??t.fieldPath,d=(null==o?void 0:o.associationPathName)??t.associationPathName,u=null==r?void 0:r.name,c=a(s),p=a(d),m=a(u),h=new Set;return c&&h.add(c),p&&(c?c.startsWith(`${p}.`)?h.add(c):h.add(`${p}.${c}`):h.add(p)),m&&h.add(n(m)),Array.from(h)}function d(e){return s(e)[0]}function u(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;if(!t||"object"!=typeof t)return[];let l=t.items;if(Array.isArray(l))return l;let o=t.grid;if(!o||"object"!=typeof o)return[];let n=o.subModels;if(!n||"object"!=typeof n)return[];let i=n.items;return Array.isArray(i)?i:[]}function c(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;return t&&"object"==typeof t?u(t.field):[]}function p(e,t){let l=a(t);if(!l)return null;let o=e=>{if(!Array.isArray(e))return null;for(let t of e){if(s(t).some(e=>e===l))return t;let e=o(c(t));if(e)return e}return null};return o(u(e))}},7720(e,t,l){l.d(t,{_:()=>n});var o=l(6832);function n(e,t,l){let n;if(!l||!Array.isArray(l))return null;let i=l.find(e=>(null==e?void 0:e.value)===t),r=null==i?void 0:i.schema,a=null==r?void 0:r["x-component"];if(!a)return null;if("DateFilterDynamicComponent"===a)n=o.DateFilterDynamicComponent;else{var s;n=null==e||null==(s=e.getComponent)?void 0:s.call(e,a)}return n?{Comp:n,props:(null==r?void 0:r["x-component-props"])||{}}:null}},544(e,t,l){l.d(t,{ON:()=>i,jI:()=>n});let o="__saveStepParamsWithSubModels";function n(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");e[o]=!0}async function i(e,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");let l=e;if(!0!==l[o])return await t();if("function"!=typeof l.save)throw Error("[saveStepParamsWithSubModels] model.save is not a function");try{return await l.save()}finally{delete l[o]}}},7827(e,t,l){l.d(t,{S0:()=>r.S0,_T:()=>r._T,s5:()=>r.s5});var o=l(504),n=l(6305);l(1649);var i=l(2542),r=l(5042);r.S0.registerFlow({key:"buttonSettings",title:(0,o.tExpr)("Button settings"),sort:-999,steps:{general:{title:(0,o.tExpr)("Edit button"),uiSchema:e=>({title:e.model.enableEditTitle?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button title")}:void 0,tooltip:e.model.enableEditTooltip?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button tooltip")}:void 0,icon:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"IconPicker",title:(0,o.tExpr)("Button icon")}:void 0,iconOnly:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Icon only")}:void 0,type:e.model.enableEditType?{"x-decorator":"FormItem","x-component":"Radio.Group",title:(0,o.tExpr)("Button type"),enum:e.model.buttonTypeOptions}:void 0,danger:e.model.enableEditDanger?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Danger action")}:void 0,color:e.model.enableEditColor?{"x-decorator":"FormItem","x-component":n.sk,title:(0,o.tExpr)("Color")}:void 0}),defaultParams(e){var t,l;let o=e.model.defaultProps||{};return e.model.enableEditColor?{...o,color:(null==(t=e.model.props)?void 0:t.color)??o.color??(null==(l=e.themeToken)?void 0:l.colorPrimary)}:o},handler(e,t){let{title:l,tooltip:o,...n}=t;e.model.setProps({title:e.t(l,{ns:"lm-flow-engine"}),tooltip:e.t(o,{ns:"lm-flow-engine"}),...n})}},linkageRules:{use:"actionLinkageRules"}}}),r.S0.registerFlow({key:"buttonAclSettings",steps:{aclCheck:{use:"aclCheck"}}}),r.S0.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh"},linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"actionLinkageRules",flowKey:"buttonSettings",stepKey:"linkageRules"}}}}),r.S0.registerEvents({click:{title:(0,o.tExpr)("Click"),name:"click",uiSchema:{condition:{type:"object",title:(0,o.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":i.H}},handler:i.b}})},5042(e,t,l){l.d(t,{S0:()=>p,_T:()=>u,s5:()=>c});var o=l(1178),n=l(504),i=l(2195),r=l(2793),a=l(7583),s=l(1649),d=l(7843);function u(e){let{t}=(0,d.useTranslation)(),l=(0,n.useFlowModel)(),i=l.context.blockModel,u=e.collection||i.collection,c=u.dataSource,p=(0,s.useMemo)(()=>{let e=`${t(c.displayName||c.key)} > `,l=u?`${t(u.title)||u.name||u.tableName} `:"";return`${e}${l}`},[]),{actionName:m}=(null==e?void 0:e.forbidden)||l.forbidden,h=(0,s.useMemo)(()=>t('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:p,actionName:t(a.default.capitalize(m))}).replaceAll("&gt;",">"),[m,p,t]);return(0,o.jsx)(r.Tooltip,{title:e.message||h,children:e.children})}let c={collection:"collection",record:"record",all:["collection","record"],both:["collection","record"]};class p extends n.FlowModel{static _getScene(){return a.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getAclActionName(){return null}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1})}getInputArgs(){let e={},t=[];if(this.context.resource){let l=this.context.resource.getSourceId();l&&(e.sourceId=l,t.push("sourceId"))}if(this.context.collection&&this.context.record){let l=this.context.collection.getFilterByTK(this.context.record);l&&(e.filterByTk=l,t.push("filterByTk"))}return t.length&&(e.defaultInputKeys=t),e}onClick(e){this.dispatchEvent("click",{event:e,...this.getInputArgs()},{debounce:!0})}getTitle(){return this.props.title}getIcon(){return this.props.icon}renderButton(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0;return(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,children:e?null:t.children||this.getTitle()})}render(){return this.props.tooltip?(0,o.jsx)(r.Tooltip,{title:this.props.tooltip,children:this.renderButton()}):this.renderButton()}renderHiddenInConfig(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0;return this.forbidden?(0,o.jsx)(u,{children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:e?null:t.children||this.getTitle()})}):(0,o.jsx)(r.Tooltip,{title:this.context.t("The button is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:e?null:t.children||this.getTitle()})})}constructor(...e){super(...e),this.defaultProps={type:"default",title:(0,n.tExpr)("Action"),iconOnly:!1},this.enableEditTooltip=!0,this.enableEditTitle=!0,this.enableEditIcon=!0,this.enableEditType=!0,this.enableEditDanger=!0,this.enableEditColor=!1,this.buttonTypeOptions=[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Primary")}}'},{value:"dashed",label:'{{t("Dashed")}}'},{value:"link",label:'{{t("Link")}}'},{value:"text",label:'{{t("Text")}}'}]}}},3890(e,t,l){l.d(t,{P:()=>f,z:()=>g});var o=l(1178),n=l(2314),i=l(504),r=l(7583),a=l(1649),s=l(2793),d=l(8563),u=l(2542),c=l(7843),p=l(8804);let m=()=>{let{t:e}=(0,c.useTranslation)(),t=(0,i.useFlowModel)(),l=t.context.blockModel.collection,n=l.dataSource,d=(0,a.useMemo)(()=>{let t=`${e(n.displayName||n.key)} > `,o=l?`${e(l.title)||l.name||l.tableName} `:"";return`${t}${o}`},[]),{actionName:u}=t.forbidden,m=(0,a.useMemo)(()=>e('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:d,actionName:e(r.default.capitalize(u))}).replaceAll("&gt;",">"),[u,d,e]);return(0,o.jsx)(p.t,{children:(0,o.jsx)(s.Result,{status:"403",subTitle:m})})};function h(){let{t:e}=(0,c.useTranslation)(),t=(0,i.useFlowModel)(),l=t.dataSource,n=(0,a.useMemo)(()=>{let o=`${e(l.displayName||l.key)} > `,n=t.resource.resourceName;return`${o}${n}`},[]),r=(0,a.useMemo)(()=>e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:e("Collection"),name:n,blockType:e("Block")}).replaceAll("&gt;",">"),[n,e]);return(0,o.jsx)(p.t,{children:(0,o.jsx)(s.Result,{status:"404",subTitle:r})})}let f={new:"new",one:"one",many:"many",select:"select",filter:"filter",oam:["one","many"],subForm:"subForm",bulkEditForm:"bulkEditForm"};class g extends i.FlowModel{setFilterActive(e,t){this.activeFilterSources.set(e,t)}hasActiveFilters(){let e=this.resource;if(e&&e.filter&&Object.keys(e.filter).length>0)return!0;for(let[,e]of this.activeFilterSources)if(e)return!0;return!1}removeFilterSource(e){this.activeFilterSources.delete(e)}getDataLoadingMode(){var e;let t=this.getStepParams("dataLoadingModeSettings");return(null==t||null==(e=t.dataLoadingMode)?void 0:e.mode)||"auto"}static _getScene(){return r.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getModelClassName(e){return Object.keys(this.customModelClasses).includes(e)?this.customModelClasses[e]:this._defaultCustomModelClasses[e]||e}renderHiddenInConfig(){return this.forbidden?(0,o.jsx)(m,{}):(0,o.jsx)(s.Tooltip,{title:this.context.t("The block is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(d.tn,{ref:this.context.ref,...this.decoratorProps,style:{opacity:"0.3"},children:(0,o.jsx)(this.ObservedRenderComponent,{})})})}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineMethod("getModelClassName",e=>this.getModelClassName(e)),this.ObservedRenderComponent=(0,i.observer)(()=>this.renderComponent(),{displayName:"ObservedRenderComponent"})}setDecoratorProps(e){Object.assign(this.decoratorProps,e)}get title(){return this._title||(this._title=this.defaultBlockTitle()),this._title}defaultBlockTitle(){var e;return`${this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name)}`}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of BlockModel")}render(){return this.collectionRequired&&!this.context.collection?(0,o.jsx)(h,{}):(0,o.jsx)(d.tn,{ref:this.context.ref,...this.decoratorProps,children:(0,o.jsx)(this.ObservedRenderComponent,{})})}constructor(...e){super(...e),this.decoratorProps=(0,n.observable)({}),this._defaultCustomModelClasses={},this.customModelClasses={},this.collectionRequired=!1,this.ObservedRenderComponent=null,this.activeFilterSources=new Map}}g.registerFlow({key:"cardSettings",title:(0,i.tExpr)("Card settings"),steps:{titleDescription:{title:(0,i.tExpr)("Title & description"),uiSchema:{title:{"x-component":"Input","x-decorator":"FormItem",title:(0,i.tExpr)("Title")},description:{"x-component":"Input.TextArea","x-decorator":"FormItem",title:(0,i.tExpr)("Description")}},handler(e,t){let l=e.t(t.title,{ns:"lm-flow-engine"}),o=e.t(t.description,{ns:"lm-flow-engine"});e.model.setDecoratorProps({title:l,description:o})}},linkageRules:{use:"blockLinkageRules"},blockHeight:{use:"blockHeight"}}}),g.define({hide:!0,label:(0,i.tExpr)("Other blocks")}),i.FlowModel.registerEvents({beforeRender:{title:(0,i.tExpr)("Before render"),name:"beforeRender",uiSchema:{condition:{type:"object",title:(0,i.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":u.H}},handler:u.b}})},9639(e,t,l){l.d(t,{U:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.collection))})},146(e,t,l){l.d(t,{t:()=>s});var o=l(504),n=l(7583),i=l(7123),r=l(8481),a=l(2606);class s extends a.R{onMount(){super.onMount(),this.previousBeforeRenderHash=this.context.location.search}getDirtyTrackingVersion(e,t,l,o){var n;let i=new Set,r=(null==l||null==(n=l.getResourceName)?void 0:n.call(l))||o.associationName||o.collectionName;r&&i.add(String(r)),o.associationName&&i.add(String(o.associationName)),o.collectionName&&i.add(String(o.collectionName));let a=0;for(let l of i)a+=e.getDataSourceDirtyVersion(t,l);return a}onActive(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.hidden&&this.previousBeforeRenderHash!==this.context.location.search&&(this.rerender(),!e)||this.hidden)return;let t=this.context.resource;if(!t)return;let l=this.getResourceSettingsInitParams(),o=t.getDataSourceKey()||l.dataSourceKey||"main",n=this.context.engine,i=this.getDirtyTrackingVersion(n,o,t,l);if(e){if(this.dirtyRefreshing)return;this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(n,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1});return}this.isManualRefresh||null!==this.lastSeenDirtyVersion&&i===this.lastSeenDirtyVersion||this.dirtyRefreshing||(this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(n,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1}))}static filterCollection(e){return!!e.filterTargetKey}static isCollectionAvailable(e){if(!e)return!1;let t=(0,r.b1)(this);return(0,r.F3)(e,t)}static async defineChildren(e){let t=t=>{var l;if(!(null==(l=this.meta)?void 0:l.createModelOptions))return t||{};if("function"==typeof this.meta.createModelOptions){let l=this.meta.createModelOptions(e);return n.default.merge({},l,t)}return n.default.merge({},this.meta.createModelOptions,t)},l=e=>this.name+e,{dataSourceKey:i,collectionName:r,associationName:a,filterByTk:s}=e.view.inputArgs,d=e.dataSourceManager.getDataSources().map(e=>0===e.getCollections().length?null:{key:l(`ds-${e.key}`),label:e.displayName,searchable:!0,searchPlaceholder:(0,o.tExpr)("Search"),children:o=>e.getCollections().map(o=>{if(!this.filterCollection(o)||!this.isCollectionAvailable(o))return null;let n={dataSourceKey:o.dataSourceKey,collectionName:o.name};return{key:l(`ds-${e.key}.${o.name}`),label:o.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)}).filter(Boolean),u=e=>1===d.length?d[0].children(e):d;if(!r)return u(e);if(this._isScene("select")){let o={dataSourceKey:i,collectionName:r};a&&(o.associationName=a,o.sourceId="{{ctx.view.inputArgs.sourceId}}");let n=e.dataSourceManager.getCollection(i,r),s=[];return this.isCollectionAvailable(n)&&s.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:o}}})}),s.push({key:l("others-collections"),label:"Other collections",children:u(e)}),s}if(this._isScene("new")){let o={dataSourceKey:i,collectionName:r};a&&(o.associationName=a,o.sourceId="{{ctx.view.inputArgs.sourceId}}");let n=[],d=e.dataSourceManager.getCollection(i,r);return this.isCollectionAvailable(d)&&n.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:o}}})}),null!=s&&n.push({key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(i,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let o=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(o="{{ctx.view.inputArgs.filterByTk}}");let n={dataSourceKey:i,collectionName:e.target,associationName:e.resourceName,sourceId:o};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)}),n.push({key:l("others-collections"),label:"Other collections",children:u(e)}),n}let c=[{key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(i,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let o=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(o="{{ctx.view.inputArgs.filterByTk}}");let n={dataSourceKey:i,collectionName:e.target,associationName:e.resourceName,sourceId:o};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)},{key:l("others-records"),label:"Other records",children:u(e)}];if(this._isScene("one")){let o=e.dataSourceManager.getCollection(i,r);if(!o||!this.filterCollection(o)||!this.isCollectionAvailable(o))return c;let n={dataSourceKey:i,collectionName:r,filterByTk:"{{ctx.view.inputArgs.filterByTk}}"};a&&(n.associationName=a,n.sourceId="{{ctx.view.inputArgs.sourceId}}"),c.unshift({key:l("current-record"),label:"Current record",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})})}return c}get dataSource(){return this.context.dataSource}get collection(){return this.context.collection}get resource(){return this.context.resource}get association(){return this.context.association}get associationField(){return this.context.association}getAclActionName(){return"view"}async getFilterFields(){return this.collection.getFields().filter(e=>e.filterable)}getResourceSettingsInitParams(){return this.getStepParams("resourceSettings","init")}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1}),this.context.defineProperty("resourceName",{get:()=>this.resource.getResourceName(),cache:!1}),this.context.defineProperty("dataSource",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getDataSource(e.dataSourceKey)}}),this.context.defineProperty("collection",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getCollection(e.dataSourceKey,e.collectionName)}}),this.context.defineProperty("resource",{get:()=>{let e=this.getResourceSettingsInitParams(),t=this.createResource(this.context,e);t.setDataSourceKey(e.dataSourceKey),t.setResourceName(e.associationName||e.collectionName);let l=()=>{var l;let o=this.context.engine;if(!(null==o?void 0:o.getDataSourceDirtyVersion))return;let n=(null==(l=t.getDataSourceKey)?void 0:l.call(t))||e.dataSourceKey||"main";this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(o,n,t,e)};return l(),t.on("refresh",()=>{l(),this.invalidateFlowCache("beforeRender")}),t}}),this.context.defineProperty("association",{get:()=>{let e=this.getResourceSettingsInitParams();if(e.associationName)return this.dataSource.getAssociation(e.associationName)}})}createResource(e,t){throw Error("createResource method must be implemented in subclasses of CollectionBlockModel")}refresh(){return this.resource?this.resource.refresh():super.refresh()}defaultBlockTitle(){var e,t,l,o,n,r,a;let s=this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name),d=(null==(t=this.dataSource)?void 0:t.displayName)||(null==(l=this.dataSource)?void 0:l.key),u=(null==(r=this.context)||null==(n=r.dataSourceManager)||null==(o=n.getDataSources)?void 0:o.call(n).length)||0,c=null==(a=this.collection)?void 0:a.title;if(this.association){let e=this.resource.getResourceName(),t=this.dataSource.getCollection(e.split(".")[0]);return(0,i.l)({blockLabel:s,dsName:d,dsCount:u,collectionTitle:c,sourceCollectionTitle:t.title,associationTitle:this.association.title})}return(0,i.l)({blockLabel:s,dsName:d,dsCount:u,collectionTitle:c})}addAppends(e){var t,l;let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)if(e.includes(".")){let[l,n]=e.split("."),i=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${l}`);if(!i)return;let r=i.target;if(!r)return;let a=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${r}.${n}`);if(a&&a.isAssociationField()){if(this.resource.addAppends(e),(null==(t=a.targetCollection)?void 0:t.template)==="tree"){let t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;a.name===t&&this.resource.addAppends(`${e}.parent(recursively=true)`)}o&&this.resource.refresh()}}else{if(!this.collection)return;let t=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${e}`);if(!t)return;t.isAssociationField()&&(this.resource.addAppends(t.name),(null==(l=t.targetCollection)?void 0:l.template)==="tree"&&this.resource.addAppends(`${t.name}.parent(recursively=true)`),o&&this.resource.refresh())}}constructor(...e){super(...e),this.isManualRefresh=!1,this.collectionRequired=!0,this.lastSeenDirtyVersion=null,this.dirtyRefreshing=!1}}s.registerFlow({key:"resourceSettings",sort:-999,steps:{collectionCheck:{handler(e){e.collection||e.exitAll()}},aclCheck:{use:"aclCheck"},init:{handler(e,t){if(!t.dataSourceKey)throw Error("dataSourceKey is required");if(!t.collectionName)throw Error("collectionName is required");Object.keys(t).includes("sourceId")&&e.resource.setSourceId(t.sourceId),Object.keys(t).includes("filterByTk")&&e.resource.setFilterByTk(t.filterByTk)}}}}),s.registerFlow({key:"refreshSettings",sort:1e4,steps:{refresh:{async handler(e){let t=e.model,l=e.model.context.filterManager,n=(null==l?void 0:l.prepareFiltersForTarget)?await l.prepareFiltersForTarget(e.model.uid):void 0;l&&l.bindToTarget(e.model.uid);let i=t.getDataLoadingMode(),r=t.resource;if(r instanceof o.MultiRecordResource&&"manual"===i&&!t.hasActiveFilters()){r.setData([]),r.setMeta({count:0,hasNext:!1,page:1}),r.loading=!1;return}null==n||n.forEach(t=>{var l;null==t||null==(l=t.markInitialTargetRefreshHandled)||l.call(t,e.model.uid)}),e.model.isManualRefresh?e.model.resource.loading=!1:await e.model.resource.refresh()}}}}),s.registerFlow({key:"dataLoadingModeSettings",sort:800,title:(0,o.tExpr)("Set data loading mode"),steps:{dataLoadingMode:{use:"dataLoadingMode"}}}),s.define({hide:!0})},2606(e,t,l){l.d(t,{R:()=>i});var o=l(504),n=l(3890);class i extends n.z{}i.define({hide:!0,label:(0,o.tExpr)("Data blocks"),async children(e){let t=await (0,o.buildSubModelItems)(i)(e),{collectionName:l,filterByTk:n,scene:r}=e.view.inputArgs;return t.filter(t=>{var o,i,a,s,d,u,c;let p=e.engine.getModelClass(t.useModel);return"select"===r?null==(s=p._isScene)?void 0:s.call(p,"select"):"subForm"===r?null==(d=p._isScene)?void 0:d.call(p,"subForm"):"bulkEditForm"===r?null==(u=p._isScene)?void 0:u.call(p,"bulkEditForm"):"new"===r||l&&!n?null==(c=p._isScene)?void 0:c.call(p,"new"):!p._isScene||!(null==(o=p._isScene)?void 0:o.call(p,"select"))&&!(null==(i=p._isScene)?void 0:i.call(p,"subForm"))&&!(null==(a=p._isScene)?void 0:a.call(p,"bulkEditForm"))})}})},6859(e,t,l){l.d(t,{o:()=>n});var o=l(504);class n extends o.FlowModel{static resolveUse(e,t,l){var o,n;let i=null==e||null==(n=e.stepParams)||null==(o=n.fieldBinding)?void 0:o.use;return i&&i!==(null==e?void 0:e.use)?i:null==e?void 0:e.use}}},1882(e,t,l){l.d(t,{L:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.record))})},3027(e,t,l){l.d(t,{GO:()=>y,KW:()=>_,Z1:()=>f,eu:()=>g,nF:()=>h,zL:()=>s});var o=l(1178),n=l(504),i=l(1649),r=l(9639),a=l(1882);let s="assignFieldValues";function d(e){let t=null==e?void 0:e.collection;return t&&"object"==typeof t?t:void 0}function u(e){let t=d(e),l=null==t?void 0:t.dataSourceKey,o=null==t?void 0:t.name;return l&&o?{dataSourceKey:l,collectionName:o}:void 0}function c(e,t){let l=(null==e?void 0:e.collection)||d(t),o=null==l?void 0:l.dataSourceKey,n=null==l?void 0:l.name;return o&&n?{dataSourceKey:o,collectionName:n}:void 0}function p(e){if(!e||"object"!=typeof e)return!1;let t=e;return"string"==typeof t.dataSourceKey&&!!t.dataSourceKey&&"string"==typeof t.collectionName&&!!t.collectionName}function m(e){var t,l,o,n,i,r,a,s;null==e||null==(l=e.context)||null==(t=l.removeCache)||t.call(l,"dataSource"),null==e||null==(n=e.context)||null==(o=n.removeCache)||o.call(n,"collection"),null==e||null==(r=e.context)||null==(i=r.removeCache)||i.call(r,"resource"),null==e||null==(s=e.context)||null==(a=s.removeCache)||a.call(s,"association")}function h(e){return{async:!0,use:"AssignFormModel",stepParams:{resourceSettings:{init:u(e)}}}}function f(e,t){var l,o;let n=(null==(l=(o=e.model).getStepParams)?void 0:l.call(o,t,s))||{};return{assignedValues:(null==n?void 0:n.assignedValues)||{}}}async function g(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AssignFieldValues";try{return await (0,n.resolveRunJSObjectValues)(e,t)}catch(t){var o,i,r;return console.error(`[${l}] RunJS execution failed`,t),null==(r=e.message)||null==(i=r.error)||i.call(r,(null==(o=e.t)?void 0:o.call(e,"RunJS execution failed"))||"RunJS execution failed"),null}}function y(e,t){return t&&"object"==typeof t&&Object.keys(t).length?{...e,...t}:e}function v(e){let{model:t,blockModel:l}=(0,n.useFlowSettingsContext)(),d=t,u=(0,n.useFlowEngine)(),[h,f]=i.default.useState(null);return(0,i.useEffect)(()=>{let o=!1;return(async()=>{var n,i,h,g,y;let v=c(l,null==d?void 0:d.context),_=await u.loadOrCreateModel(v?{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel",stepParams:{resourceSettings:{init:v}}}:{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel"},{skipSave:!t.context.flowSettingsEnabled});if(o)return;if(p(v)){let e=null==(h=_.getStepParams)?void 0:h.call(_,"resourceSettings","init");p(e)&&e.dataSourceKey===v.dataSourceKey&&e.collectionName===v.collectionName||null==(y=_.setStepParams)||y.call(_,"resourceSettings","init",v),m(_),m(null==(g=_.subModels)?void 0:g.grid)}let b=(null==(n=d.getStepParams)?void 0:n.call(d,e.settingsFlowKey,s))||{};_.setInitialAssignedValues((null==b?void 0:b.assignedValues)||{});let x=t instanceof r.U&&!(t instanceof a.L);(e.clearRecordContext||x)&&(null==(i=_.context)?void 0:i.defineProperty)&&_.context.defineProperty("record",{get:()=>void 0,cache:!1}),f(_),d.assignFormUid=(null==_?void 0:_.uid)||d.assignFormUid})(),()=>{o=!0}},[d,l,u,t,t.context.flowSettingsEnabled,e.clearRecordContext,e.settingsFlowKey]),h?(0,o.jsx)(n.FlowModelRenderer,{model:h,showFlowSettings:!1}):null}function _(e){return{title:e.title||(0,n.tExpr)("Assign field values"),uiSchema:()=>({tip:e.tipComponent?{"x-decorator":"FormItem","x-component":e.tipComponent}:void 0,editor:{"x-decorator":"FormItem","x-component":()=>(0,o.jsx)(v,{settingsFlowKey:e.settingsFlowKey,clearRecordContext:e.clearRecordContext})}}),async beforeParamsSave(t){var l,o,n,i,r,a,d;let u=t.model.assignFormUid?null==(l=(o=t.engine).getModel)?void 0:l.call(o,t.model.assignFormUid,!0):void 0;if(!u)return;e.validateBeforeSave&&await (null==(d=u.form)||null==(a=d.validateFields)?void 0:a.call(d));let c=(null==(n=u.getAssignedValues)?void 0:n.call(u))||{};null==(i=(r=t.model).setStepParams)||i.call(r,e.settingsFlowKey,s,{assignedValues:c})},handler(){}}}},6832(e,t,l){l.r(t),l.d(t,{DateFilterDynamicComponent:()=>_});var o=l(1178),n=l(1649),i=l(2793),r=l(691),a=l(504),s=l(6305),d=l(3526),u=l(7583);let c=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,p=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},m=e=>{let{value:t,picker:l="date",format:r,showTime:m,timeFormat:h}=e,f=(0,a.useFlowEngine)(),g=f.translate.bind(f),y=(0,s.fD)(),v=[{label:g("Today"),value:y.today},{label:g("Last week"),value:y.lastWeek},{label:g("This week"),value:y.thisWeek},{label:g("Next week"),value:y.nextWeek},{label:g("Last month"),value:y.lastMonth},{label:g("This month"),value:y.thisMonth},{label:g("Next month"),value:y.nextMonth},{label:g("Last quarter"),value:y.lastQuarter},{label:g("This quarter"),value:y.thisQuarter},{label:g("Next quarter"),value:y.nextQuarter},{label:g("Last year"),value:y.lastYear},{label:g("This year"),value:y.thisYear},{label:g("Next year"),value:y.nextYear},{label:g("Last 7 days"),value:y.last7Days},{label:g("Next 7 days"),value:y.next7Days},{label:g("Last 30 days"),value:y.last30Days},{label:g("Next 30 days"),value:y.next30Days},{label:g("Last 90 days"),value:y.last90Days},{label:g("Next 90 days"),value:y.next90Days}],_=t?(0,s.Pn)(null==t?void 0:t[0],l):l,b=_===l&&r?r:(0,d.getPickerFormat)(_),x="date"===_?c(b):b,M=(0,d.getDateTimeFormat)(_,x,m,h),w={utc:!0,presets:v,...e,format:M,picker:_,showTime:!!m&&{defaultValue:[(0,d.dayjs)("00:00:00","HH:mm:ss"),(0,d.dayjs)("23:59:59","HH:mm:ss")]}},S=(0,n.useMemo)(()=>u.default.castArray(e.value).map(e=>p(e,M)),[e.value,M]);return(0,o.jsx)(i.DatePicker.RangePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:S})},h=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,f=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},g=e=>{let{picker:t="date",format:l,showTime:r,timeFormat:u,onChange:c}=e,p=(0,a.useFlowContext)(),m=Array.isArray(e.value)?e.value[0]:e.value,g=m?(0,s.Pn)(m,t):t,[y,v]=(0,n.useState)(g),_=p.model.translate.bind(p.model),b=e=>{let o=e===t&&l?l:(0,d.getPickerFormat)(e),n="date"===e?h(o):o;return(0,d.getDateTimeFormat)(e,n,r,u)},x=(0,n.useMemo)(()=>b(y),[l,t,r,y,u]),M=(0,n.useMemo)(()=>f(m,x),[m,x]),w={utc:!0,inputReadOnly:p.isMobileLayout,...e,underFilter:!0,showTime:!!r&&{defaultValue:(0,d.dayjs)("00:00:00","HH:mm:ss")},format:x,picker:y};return(0,o.jsxs)(i.Space.Compact,{style:{width:"100%"},children:[(0,o.jsx)(i.Select,{style:{width:"100px"},popupMatchSelectWidth:!1,value:y,options:[{label:_("Date"),value:"date"},{label:_("Month"),value:"month"},{label:_("Quarter"),value:"quarter"},{label:_("Year"),value:"year"}],onChange:e=>{let t=b(e),l=x;if(v(e),!m||!c)return;let o=f(m,l);o&&o.isValid()&&c(o,o.format(t))}}),(0,o.jsx)(i.DatePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:M})]})},y=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=[{value:"exact",label:e("Exact day")},{value:"past",label:e("Past")},{value:"next",label:e("Next")},{value:"today",label:e("Today")},{value:"yesterday",label:e("Yesterday")},{value:"tomorrow",label:e("Tomorrow")},{value:"thisWeek",label:e("This Week")},{value:"lastWeek",label:e("Last Week")},{value:"nextWeek",label:e("Next Week")},{value:"thisMonth",label:e("This Month")},{value:"lastMonth",label:e("Last Month")},{value:"nextMonth",label:e("Next Month")},{value:"thisQuarter",label:e("This Quarter")},{value:"lastQuarter",label:e("Last Quarter")},{value:"nextQuarter",label:e("Next Quarter")},{value:"thisYear",label:e("This Year")},{value:"lastYear",label:e("Last Year")},{value:"nextYear",label:e("Next Year")}];return t&&l.splice(3,0,{value:"now",label:e("Now")}),l},v=e=>{let{isRange:t,defaultValue:l,onChange:i,...r}=e,a=(0,n.useCallback)((e,t)=>i(t),[i]);return t?(0,o.jsx)(m,{...r,onChange:a}):(0,o.jsx)(g,{...r,onChange:a})},_=e=>{let{value:t,onChange:l,includeNow:s=!1,...d}=e,u=(0,a.useFlowEngine)(),c=u.translate.bind(u),{token:p}=i.theme.useToken(),[m,h]=(0,n.useState)(!1),f=(0,n.useMemo)(()=>y(c,s),[c,s]),g=e=>{if(h(!1),"exact"===e)return l(void 0);let t={type:e};["past","next"].includes(e)&&(t.number=1,t.unit="day"),l(t)},_=()=>{let e=f.slice(0,3),t=f.slice(3),l=(0,r.css)`
166
166
  padding: 3px 10px;
167
167
  cursor: pointer;
168
168
  white-space: nowrap;
@@ -655,7 +655,7 @@ if (!ctx.record) {
655
655
  flex-shrink: 0;
656
656
  flex: 1;
657
657
  }
658
- `},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":iH.n,"x-component-props":{rows:1}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":t("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}}},handler(e,t){e.model.setProps({url:t.url,searchParams:t.searchParams,openInNewWindow:t.openInNewWindow})}}}});class aW extends rp.S0{setTitle(e){this.setProps({title:e})}setExpandFlag(e){this.expandFlag=e}getTitle(){return this.expandFlag?this.context.t("Collapse all"):this.context.t("Expand all")}getIcon(){return this.expandFlag?"NodeCollapseOutlined":"NodeExpandOutlined"}constructor(...e){super(...e),this.defaultProps={type:"default",icon:"DownOutlined"}}}function aJ(e){let{idKey:t="id",childrenKey:l="children"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[];function n(e){if(Array.isArray(e))for(let i of e){let e=i[l];o.push(i[t]),Array.isArray(e)&&e.length>0&&n(e)}}return n(e),o}aW.scene=rp.s5.collection;let aX=e=>aJ(e);aW.registerFlow({key:"expandCollapseSettingsInit",sort:200,steps:{init:{handler(e,t){e.blockModel.props.defaultExpandAllRows?e.model.setExpandFlag(!0):e.model.setExpandFlag(!1)}}}}),aW.registerFlow({key:"expandCollapseSettings",on:"click",steps:{expandCollapse:{async handler(e,t){var l;if(!(null==(l=e.blockModel)?void 0:l.resource))return;let o=e.blockModel.resource,{treeTable:n}=e.blockModel.props;if(n)if(e.model.expandFlag)e.blockModel.setProps({expandedRowKeys:[]}),e.model.setExpandFlag(!1);else{let t=aX(o.getData());e.blockModel.setProps({expandedRowKeys:t}),e.model.setExpandFlag(!0)}}}}}),aW.define({label:(0,u.escapeT)("Expand/Collapse"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.model.props.treeTable}});class aQ extends r9{getAclActionName(){return"create"}onInit(e){super.onInit(e),this.context.defineProperty("association",{get:()=>this.context.blockModel.dataSource.getAssociation(`${this.context.blockModel.collection.name}.children`)})}constructor(...e){super(...e),this.defaultProps={type:"link",title:(0,u.tExpr)("Add child"),icon:"PlusOutlined"}}}aQ.capabilityActionName=null,aQ.registerFlow({key:"addChildSettingsInit",steps:{addChildInit:{async handler(e,t){e.model.onClick=t=>{e.model.dispatchEvent("click",{event:t,...e.inputArgs,sourceId:e.record.id,filterByTk:null},{debounce:!0})}}}}}),aQ.define({label:(0,u.tExpr)("Add child"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.blockModel.props.treeTable}}),rc.registerActionModels({AddChildActionModel:aQ});var aZ=__webpack_require__(2088);class a0 extends aZ.F4{useHooksBeforeRender(){let[e]=g.Form.useForm();this.context.defineProperty("form",{get:()=>e})}onInit(e){super.onInit(e);let t=(0,u.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)},cache:!1,resolveOnServer:(0,u.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)}),meta:t}),this.context.defineProperty("filterManager",{once:!0,get:()=>new rw(this,null==e?void 0:e.filterManager)}),this.isManualRefresh=!0}createResource(e,t){let l=this.context.createResource(u.SingleRecordResource);return l.isNewRecord=!0,l}renderComponent(){var e;let{colon:t,labelAlign:l,labelWidth:o,labelWrap:n,layout:i}=this.props;return(0,s.jsx)(aZ.s2,{model:this,layoutProps:{colon:t,labelAlign:l,labelWidth:o,labelWrap:n,layout:i},children:(0,s.jsx)(u.FlowModelRenderer,{model:null==(e=this.subModels)?void 0:e.grid,showFlowSettings:!1})})}setInitialAssignedValues(e){var t;let l=null==(t=this.subModels)?void 0:t.grid;Object.entries(e||{}).forEach(e=>{let[t,o]=e;l.addOrEnsureItem(t,o)})}getAssignedValues(){return this.subModels.grid.getAssignedValues()||{}}}a0.define({label:(0,u.tExpr)("Field assignments"),hide:!0,createModelOptions:{use:"AssignFormModel",subModels:{grid:{use:"AssignFormGridModel"}}}});class a1 extends rL{renderAddSubModelButton(){return(0,s.jsx)(u.AddSubModelButton,{subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("FormItemModel"),this.context.getModelClassName("FormAssociationFieldGroupModel"),this.context.getModelClassName("FormCustomItemModel"),this.context.getModelClassName("FormJSFieldItemModel")].filter(Boolean),model:this,keepDropdownOpen:!0,children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Fields")})})}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,o=null==(t=this.props)?void 0:t.heightModel,n=this.context.themeToken,i=super.render();return"defaultHeight"===o?i:(0,s.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${n.marginLG}px`,marginRight:`-${n.marginLG}px`,paddingLeft:`${n.marginLG}px`,paddingRight:`${n.marginLG}px`,paddingTop:5},children:i})}constructor(...e){super(...e),this.itemFallback=(0,s.jsx)(g.Skeleton.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}a1.registerFlow({key:"formFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class a2 extends a1{renderAddSubModelButton(){var e,t;let l=null==(e=this.context)?void 0:e.collection,o=(null==l||null==(t=l.getFields)?void 0:t.call(l))||[],n="function"==typeof(null==l?void 0:l.getPrimaryKey)?l.getPrimaryKey():void 0,i=null==l?void 0:l.filterTargetKey,r=e=>!!e&&!!(n&&e===n||"string"==typeof i&&e===i||Array.isArray(i)&&i.includes(e)),a=o.filter(e=>!r(null==e?void 0:e.name)).map(e=>{let t=e.name,o=e.title||e.name,n=u.EditableItemModel.getDefaultBindingByField(this.context,e);if(!n)return;let i=n.modelName;return{key:t,label:o,toggleable:e=>{let l=e.getStepParams("fieldSettings","init")||{};return(null==l?void 0:l.fieldPath)===t},useModel:"AssignFormItemModel",createModelOptions:()=>({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}},subModels:{field:{use:i,stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}}}}})}}).filter(Boolean);return(0,s.jsx)(u.AddSubModelButton,{subModelKey:"items",model:this,items:a,keepDropdownOpen:!0,children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Fields")})})}addOrEnsureItem(e,t){var l,o,n;let i=null==(l=this.context)?void 0:l.collection,r=((null==(o=this.subModels)?void 0:o.items)||[]).find(t=>{try{let l="function"==typeof(null==t?void 0:t.getStepParams)?t.getStepParams("fieldSettings","init"):null;return(null==l?void 0:l.fieldPath)===e}catch(e){return!1}});if(r){"function"==typeof(null==r?void 0:r.setStepParams)&&r.setStepParams("fieldSettings","assignValue",{value:t}),r.assignValue=t;return}let a=((null==i||null==(n=i.getFields)?void 0:n.call(i))||[]).find(t=>t.name===e),s=u.EditableItemModel.getDefaultBindingByField(this.context,a);if(!s)return;let d=s.modelName;this.flowEngine.createModel({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e},assignValue:{value:t}}},subModels:{field:{use:d,stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e}}}}},parentId:this.uid,subKey:"items"}).assignValue=t}getAssignedValues(){var e;let t=(null==(e=this.subModels)?void 0:e.items)||[],l={};for(let e of t){let t="function"==typeof e.getAssignedEntry?e.getAssignedEntry():null;t&&Array.isArray(t)&&(l[t[0]]=t[1])}return l}}a2.define({label:(0,u.tExpr)("Assign grid")});var a5=__webpack_require__(9829);function a8(e){return"string"==typeof e?e:"function"==typeof e&&e.name?e.name:void 0}function a4(e){var t,l;let o=null==e||null==(l=e.stepParams)||null==(t=l.fieldBinding)?void 0:t.use;return"string"==typeof o?o:void 0}async function a3(e){var t,l,o;let{parentModel:n,targetUse:i,defaultProps:r,pattern:a,fieldSettingsInit:s}=e,d=n.subModels.field,u=null==d?void 0:d.uid,c=null==d||null==(l=d.serialize)||null==(t=l.call(d))?void 0:t.subModels;for(let e in c)!1===c[e].delegateToParent&&delete c[e];let p=a8(a4(d)||(null==d?void 0:d.use))===i&&(null==d?void 0:d.stepParams)||{},m=s??(null==(o=n.getFieldSettingsInitParams)?void 0:o.call(n)),{fieldBinding:h,...f}=p,g={...f,fieldSettings:{...f.fieldSettings||{},init:m}},y=n.flowEngine;u&&(null==d||d.invalidateFlowCache("beforeRender",!0),y.removeModelWithSubModels(u));let v=n.setSubModel("field",{uid:u,use:i,props:{...r||{},...a?{pattern:a}:{}},stepParams:g,subModels:c});await v.dispatchEvent("beforeRender",void 0,{useCache:!1}),await n.save()}var a6=__webpack_require__(9133);function a9(e,t,l){let o=(0,c.castArray)(l).filter(e=>"string"==typeof e),n=t.split(".");if(null==o?void 0:o.length){let t=[],l=0,i=0;for(;l<n.length;){let e=n[l];if(t.push(e),i<o.length){let[l,n]=o[i].split(":");l===e&&(t.push(Number(n)),i++)}l++}return(0,c.get)(e,t)}return(0,c.get)(e,n)}function a7(e){let{record:t,currentObject:l,fieldPath:o,prefixFieldPath:n,idx:i}=e,r=a9(t,o,i);if(void 0!==r||null==l)return r;if(n&&o===n)return l;let a=n&&o.startsWith(`${n}.`)?o.slice(n.length+1):o;return a?(0,c.get)(l,a):l}function se(e,t){return!(0,a6.E4)(e)||Array.isArray(t)?t:t&&"object"==typeof t&&Array.isArray(t.rows)?t.rows:null==t?[]:[t]}class st extends u.DisplayItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let o=this.getDefaultBindingByField(e,l,{fallbackToTargetTitleField:!0});if(!o)return null;let n=o.modelName,i=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:i,label:l.title,refreshTargets:["DetailsCustomItemModel/DetailsJSFieldItemModel"],toggleable:e=>{var t;return(null==(t=e.getStepParams("fieldSettings","init"))?void 0:t.fieldPath)===i},useModel:"DetailsItemModel",createModelOptions:()=>({use:"DetailsItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:i}}},subModels:{field:{use:n,props:"function"==typeof o.defaultProps?o.defaultProps(e,l):o.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>"view",cache:!1})}renderItem(){let e=this.subModels.field,t=this.context.fieldIndex,l=this.context.record,o=this.context.currentObject,n=this.context.item,i=this.context.getPropertyOptions("item"),r=this.context.prefixFieldPath,a=null!=t?(()=>{let r=e.createFork({},`${t}`);r.context.defineProperty("fieldIndex",{get:()=>t}),r.context.defineProperty("record",{get:()=>l,cache:!1}),r.context.defineProperty("currentObject",{get:()=>o,cache:!1});let{value:a,...s}=i||{};return r.context.defineProperty("item",{...s,get:()=>n,cache:!1}),this.context.pattern&&r.context.defineProperty("pattern",{get:()=>this.context.pattern}),r})():e,d=this.context.pattern?{...this.context.blockModel.props,...this.props,pattern:this.context.pattern,disabled:"readPretty"===this.context.pattern}:{...this.context.blockModel.props,...this.props},c=se(this.collectionField,a7({record:l,currentObject:o,fieldPath:this.fieldPath,prefixFieldPath:r,idx:t}));return(0,s.jsx)(u.FormItem,{...d,value:c,children:(0,s.jsx)(u.FieldModelRenderer,{model:a})})}}st.define({label:(0,u.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search fields"),sort:100}),st.registerFlow({key:"detailItemSettings",sort:300,title:(0,u.tExpr)("Detail item settings"),steps:{showLabel:{title:(0,u.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,u.tExpr)("Label"),uiSchema:e=>({title:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let o=e.model,n=null==(l=o.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:o.context.t("Original field title: ")+n}}}}),defaultParams:e=>{var t;return{title:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let o={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.title,o)})}},aclCheck:{use:"aclCheck"},init:{async handler(e){let{collectionField:t}=e.model;t&&e.model.setProps(t.getComponentProps())}},tooltip:{title:(0,u.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,u.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},model:{title:(0,u.tExpr)("Field component"),use:"displayFieldComponent"},fieldNames:{use:"titleField",title:(0,u.tExpr)("Title field"),beforeParamsSave:async(e,t,l)=>{if(!e.collectionField||!e.collectionField.isAssociationField())return null;if(t.label!==l.label){var o,n;e.model.setProps({titleField:t.label,...null==(n=e.collectionField.targetCollection)||null==(o=n.getField(t.label))?void 0:o.getComponentProps()});let l=e.collectionField.targetCollection.getField(t.label),i=u.DisplayItemModel.getDefaultBindingByField(e,l),r=i.modelName;await a3({parentModel:e.model,targetUse:r,defaultProps:"function"==typeof(null==i?void 0:i.defaultProps)?i.defaultProps(e,e.collectionField):null==i?void 0:i.defaultProps,pattern:e.model.getProps().pattern})}},async handler(e,t){var l,o;if(!e.collectionField||e.model.subModels.field.disableTitleField)return;e.model.setProps({titleField:t.label,...null==(o=e.collectionField.targetCollection)||null==(l=o.getField(t.label))?void 0:l.getComponentProps()});let n=e.collectionField.targetCollection;if(n){let l=n.getField(t.label),o=u.DisplayItemModel.getDefaultBindingByField(e,l).modelName;o!==e.model.subModels.field.use&&e.model.setStepParams(e.flowKey,"model",{use:o})}},hideInSettings:async e=>!e.collectionField||!e.collectionField.isAssociationField()||e.model.subModels.field.disableTitleField}}}),st.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var sl=__webpack_require__(1961);function so(e){if(!e)return!1;let t=null==e?void 0:e.type;return"belongsToMany"===t||"hasMany"===t||"belongsToArray"===t}function sn(e,t){var l;let o=!!(null==e||null==(l=e.isAssociationField)?void 0:l.call(e)),n=so(e);return o&&!n&&Array.isArray(t)?t.length?t[0]:void 0:t}function si(e,t){if(!(null==t?void 0:t.length))return e;let[l,o]=String(t[t.length-1]).split(":"),n=Number(o);if(!l||!Number.isFinite(n))return e;let i=0;for(let e of t){let[t]=String(e).split(":");t===l&&(i+=1)}let r=-1,a=0;for(let t=0;t<e.length;t++)if(String(e[t])===l&&(a+=1)===i){r=t;break}if(-1===r){for(let t=e.length-1;t>=0;t--)if(String(e[t])===l){r=t;break}}return -1===r?e:[n,...e.slice(r+1)]}let sr=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"];class sa extends u.EditableItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let o=this.getDefaultBindingByField(e,l);if(!o)return;let n=o.modelName,i=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:i,label:l.title,refreshTargets:["FormJSFieldItemModel","FormItemModel/FormJSFieldItemModel"],toggleable:e=>(0,a6.pX)(e).some(e=>e===i),useModel:"FormItemModel",createModelOptions:()=>({use:"FormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:i}}},subModels:{field:{use:n,props:"function"==typeof o.defaultProps?o.defaultProps(e,l):o.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{if(this.collectionField){let t=this.collectionField.getComponentProps();e.setProps(t),this.setProps({...c.default.pick(t,"rules")||{}})}})}renderItem(){var e,t;let l=this.subModels.field,o=this.context.fieldIndex,n=this.context.fieldKey,i=(null==(e=this.parent)?void 0:e.context.fieldPathArray)||[],r=!!this.context.flowSettingsEnabled&&!!this.props.hidden&&!this.hidden&&!this.forbidden,a=null!=o||r?(()=>{let e=r?`${this.uid}:config-visible`:`${n}`,t=l.createFork({},e);if(null!=o){t.context.defineProperty("fieldIndex",{get:()=>o}),t.context.defineProperty("fieldKey",{get:()=>n}),this.context.currentObject&&t.context.defineProperty("currentObject",{get:()=>this.context.currentObject});let e=this.context.getPropertyOptions("item");if(this.context.item){let{value:l,...o}=e||{};t.context.defineProperty("item",{...o,get:()=>this.context.item,cache:!1})}this.context.pattern&&t.context.defineProperty("pattern",{get:()=>this.context.pattern})}return t.context.defineProperty("fieldPathArray",{get:()=>this.context.fieldPathArray,cache:!1}),r&&t.setProps({hidden:!1}),t})():l,{initialValue:d,hidden:p,...m}=this.context.pattern?{...this.props,pattern:this.context.pattern}:this.props,h=r?m:{hidden:p,...m},f=si(this.props.name,o);this.context.defineProperty("fieldPathArray",{get:()=>[...i,...c.default.castArray(f)],cache:!1});let y=(null==(t=this.context.item)?void 0:t.value)||this.context.record,v=(0,s.jsx)(u.FormItem,{...h,name:f,validateFirst:!0,disabled:this.props.disabled||!c.default.isEmpty(y)&&!y.__is_new__&&this.props.aclDisabled||!c.default.isEmpty(y)&&y.__is_new__&&this.props.aclCreateDisabled,children:(0,s.jsx)(u.FieldModelRenderer,{model:a,name:f})});return r?(0,s.jsx)(g.Tooltip,{title:this.context.t("The field is hidden and only visible when the UI Editor is active"),children:(0,s.jsx)("div",{style:{opacity:.3},children:v})}):v}}sa.define({label:(0,u.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search fields"),sort:100}),sa.registerFlow({key:"editItemSettings",sort:300,title:(0,u.tExpr)("Form item settings"),steps:{showLabel:{title:(0,u.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,u.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let o=e.model,n=null==(l=o.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:o.context.t("Original field title: ")+n}}}}),defaultParams:e=>{var t;return{label:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let o={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.label,o)})}},aclCheck:{use:"aclCheck",async handler(e,t){var l,o,n,i,r,a,s,d,u,c,p,m,h;if(!e.collectionField||!e.blockModel)return;let f=e.blockModel.context.actionName,g=await e.aclCheck({dataSourceKey:null==(l=e.dataSource)?void 0:l.key,resourceName:null==(o=e.collectionField)?void 0:o.collectionName,fields:[null==(n=e.collectionField)?void 0:n.name],actionName:f});if("update"===f){let t=await e.aclCheck({dataSourceKey:null==(i=e.dataSource)?void 0:i.key,resourceName:null==(r=e.collectionField)?void 0:r.collectionName,fields:[e.collectionField.name],actionName:"view"});e.prefixFieldPath&&e.item&&(await e.aclCheck({dataSourceKey:null==(s=e.dataSource)?void 0:s.key,resourceName:null==(d=e.collectionField)?void 0:d.collectionName,fields:[e.collectionField.name],actionName:"create"})||e.model.setProps({aclCreateDisabled:!0}));let l=(null==(a=e.item)?void 0:a.__is_new__)??!1;t||l||(e.model.hidden=!0,e.model.forbidden={actionName:"view"},e.exitAll()),g||e.model.setProps({aclDisabled:!0})}else if("create"===f){let t=await e.aclCheck({dataSourceKey:null==(u=e.dataSource)?void 0:u.key,resourceName:null==(c=e.collectionField)?void 0:c.collectionName,actionName:"update"}),l=await e.aclCheck({dataSourceKey:null==(p=e.dataSource)?void 0:p.key,resourceName:null==(m=e.collectionField)?void 0:m.collectionName,fields:[e.collectionField.name],actionName:"update"}),o=(null==(h=e.item)?void 0:h.__is_stored__)??!1;g||o||(e.model.hidden=!0,e.model.forbidden={actionName:f},e.exitAll()),t&&l||e.model.setProps({aclDisabled:!0})}}},init:{async handler(e){let t=e.model.fieldPath,l=t.includes(".")?t.split("."):t;e.model.setProps({name:l})}},tooltip:{title:(0,u.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,u.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem","x-component-props":{autoSize:!0}}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},initialValue:{title:(0,u.tExpr)("Default value"),disabledInSettings:!0,disabledReasonInSettings:e=>`${e.t("This setting has been moved to")}: ${e.t("Form block settings")} > ${e.t("Field values")}`,uiSchema:e=>{var t,l,o,n;if(e.model.parent.parent instanceof sl.EditFormModel||(null==(l=e.model.subModels)||null==(t=l.field)?void 0:t.updateAssociation))return;let i=null==(o=e.model.collectionField)?void 0:o.interface;if(null==sr||null==(n=sr.includes)||!n.call(sr,i))return{defaultValue:{"x-component":"DefaultValue","x-decorator":"FormItem"}}},defaultParams:e=>{let t=e.model.collectionField;if("nanoid"===t.interface&&!1!==t.options.autoFill){let{size:e,customAlphabet:l}=t.options||{size:21};return{defaultValue:(0,a5.customAlphabet)(l,e)()}}return{defaultValue:t.defaultValue}},handler(e,t){var l,o;let n=null==(l=e.model.collectionField)?void 0:l.interface;if(null==sr||null==(o=sr.includes)?void 0:o.call(sr,n))return;let i=sn(e.model.collectionField,t.defaultValue);e.model.setProps({initialValue:i})}},validation:{title:(0,u.tExpr)("Validation"),use:"validation"},required:{title:(0,u.tExpr)("Required"),use:"required"},model:{use:"fieldComponent",title:(0,u.tExpr)("Field component")},pattern:{use:"pattern"},titleField:{use:"titleField",hideInSettings:e=>!(e.collectionField&&e.collectionField.isAssociationField()&&e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern),defaultParams:e=>{var t,l,o;return{titleField:e.model.props.titleField||(null==(o=e.model)||null==(l=o.context)||null==(t=l.collectionField)?void 0:t.targetCollectionTitleFieldName)}},beforeParamsSave:async(e,t,l)=>{if(!(e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern))return null;let o=t.titleField||t.label;if(o!==l.titleField){let t=e.collectionField.targetCollection,l=t.getField(o),n=st.getDefaultBindingByField(e,l);if(n.modelName!==e.model.subModels.field.use){let l=e.model.subModels.field.uid;await e.engine.destroyModel(l);let i=e.model.setSubModel("field",{use:n.modelName,stepParams:{fieldSettings:{init:{dataSourceKey:e.model.collectionField.dataSourceKey,collectionName:t.name,fieldPath:o}}}});await i.save()}e.model.setProps(e.collectionField.targetCollection.getField(o).getComponentProps())}},async handler(e,t){"readPretty"===e.model.props.pattern?e.model.setProps({titleField:null==t?void 0:t.label}):e.model.setProps({titleField:t.titleField})}}}}),sa.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var ss=__webpack_require__(7309),sd=__webpack_require__(9624);function su(e,t){var l,o,n;let i=null==e||null==(l=e.props)?void 0:l.fieldNames,r=null==e||null==(o=e.props)?void 0:o.titleField,a=null==e||null==(n=e.getStepParams)?void 0:n.call(e,"selectSettings","fieldNames");return{stepParams:{fieldSettings:{init:t},...a?{selectSettings:{fieldNames:a}}:{}},props:{...void 0!==i?{fieldNames:i}:{},...void 0!==r?{titleField:r}:{}}}}function sc(e){try{return JSON.stringify(e)??""}catch{return String(e)}}function sp(e){var t,l,o;let n=null==e||null==(t=e.props)?void 0:t.fieldNames,i=null==e||null==(l=e.props)?void 0:l.titleField,r=null==e||null==(o=e.getStepParams)?void 0:o.call(e,"selectSettings","fieldNames");return[(null==e?void 0:e.uid)||"",sc(n),sc(i),sc(r)].join("|")}class sm extends sa{onInit(e){var t,l,o,n,i,r,a;let s=null==(t=this.getStepParams("fieldSettings","assignValue"))?void 0:t.value;void 0!==s&&(this.assignValue=s),this.context.defineProperty("collectionField",{get:()=>{var e,t;let l=this.getStepParams("fieldSettings","init")||{},o=`${null==l?void 0:l.dataSourceKey}.${null==l?void 0:l.collectionName}.${null==l?void 0:l.fieldPath}`,n=null==(e=this.context)?void 0:e.dataSourceManager;return null==n||null==(t=n.getCollectionField)?void 0:t.call(n,o)}});let d=this.context,c=null==d?void 0:d.collection,p=this.fieldInit;if(!(null==(l=this.subModels)?void 0:l.field)&&(null==c?void 0:c.getFields)){let e=(c.getFields()||[]).find(e=>(null==e?void 0:e.name)===(null==p?void 0:p.fieldPath));null==c||null==(n=c.getField)||n.call(c,null==p?void 0:p.fieldPath);let t=u.EditableItemModel.getDefaultBindingByField(d,e);if(!t)return;let l=t.modelName;null==d||null==(r=d.engine)||null==(i=r.createModel)||i.call(r,{use:l,stepParams:{fieldSettings:{init:p}},parentId:this.uid,subKey:"field"})}let m=null==(o=this.context)?void 0:o.collection,h=this.fieldPath;if(h){let e=null==m||null==(a=m.getField)?void 0:a.call(m,h),t=(null==e?void 0:e.title)||h,l=h.includes(".")?h.split("."):[h];this.setProps({label:t,name:l})}}get fieldInit(){return this.getStepParams("fieldSettings","init")||{}}get fieldPath(){var e;return null==(e=this.fieldInit)?void 0:e.fieldPath}getAssignedEntry(){let e=this.fieldPath;return e?[e,this.assignValue]:null}render(){var e,t;let l=this.context,o=l.collection,n=this.fieldInit,i=(null==(e=this.props)?void 0:e.name)||(this.fieldPath?[this.fieldPath]:void 0),r=this.fieldPath,a=null==(t=this.subModels)?void 0:t.field,d=sp(a),c=()=>{var e,t,d;let[c,m]=p.default.useState(null);p.default.useEffect(()=>{var e,t,i,s,d,c,p,h,f,g,y,v,_,b,x,M,w,S,k,F,C;if(!r)return;let A=((null==o||null==(e=o.getFields)?void 0:e.call(o))||[]).find(e=>(null==e?void 0:e.name)===r);o.getField(r);let P=u.EditableItemModel.getDefaultBindingByField(l,A);if(!P)return;let T=P.modelName,j=su(a,n),I=null==l||null==(i=l.engine)||null==(t=i.createModel)?void 0:t.call(i,{use:"VariableFieldFormModel",subModels:{fields:[{use:T,...j}]}});if(!I)return;null==(d=I.context)||null==(s=d.defineProperty)||s.call(d,"collection",{value:o});let L=null==l?void 0:l.dataSource;L&&(null==(p=I.context)||null==(c=p.defineProperty)||c.call(p,"dataSource",{value:L}));let D=null==o||null==(h=o.getField)?void 0:h.call(o,null==n?void 0:n.fieldPath);D&&(null==(g=I.context)||null==(f=g.defineProperty)||f.call(g,"collectionField",{value:D}));let R=null==l?void 0:l.blockModel;R&&(null==(v=I.context)||null==(y=v.defineProperty)||y.call(v,"blockModel",{value:R}));let Y=l.form;Y&&(null==(F=I.context)||null==(k=F.defineProperty)||k.call(F,"form",{value:Y})),I.context&&Object.defineProperty(I.context,"resource",{configurable:!0,enumerable:!0,get:()=>null==R?void 0:R.resource});let E=null==I||null==(b=I.subModels)||null==(_=b.fields)?void 0:_[0],N=null==o||null==(x=o.getField)?void 0:x.call(o,null==n?void 0:n.fieldPath),O=null==N?void 0:N.type,B=null==N?void 0:N.interface,H="belongsToMany"===O||"hasMany"===O||"belongsToArray"===O||"m2m"===B||"o2m"===B||"mbm"===B;if(null==E||null==(M=E.setProps)||M.call(E,{disabled:!1,readPretty:!1,pattern:"editable",updateAssociation:!1,multiple:H}),null==E||null==(w=E.dispatchEvent)||w.call(E,"beforeRender",void 0,{sequential:!0,useCache:!0}),(0,ss.NI)(E,N),!(null==E||null==(S=E.props)?void 0:S.fieldNames)&&(null==N?void 0:N.targetCollection)){let e=N.targetCollection,t=(null==N?void 0:N.targetKey)||(null==e?void 0:e.filterTargetKey)||"id";null==E||null==(C=E.setProps)||C.call(E,{fieldNames:{label:null==e?void 0:e.titleField,value:t}})}return m(I),()=>{var e,t,l,o;null==I||null==(l=I.subModels)||null==(t=l.fields)||null==(e=t.forEach)||e.call(t,e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),null==I||null==(o=I.remove)||o.call(I)}},[]);let h=e=>(p.default.useEffect(()=>{var t,l,o,n;if(!c)return;null==(t=c.setProps)||t.call(c,{...e});let i=null==c||null==(o=c.subModels)||null==(l=o.fields)?void 0:l[0];i&&(null==(n=i.setProps)||n.call(i,{value:null==e?void 0:e.value,onChange:function(){for(var t,l=arguments.length,o=Array(l),n=0;n<l;n++)o[n]=arguments[n];let i=o&&o.length?o[0]:void 0;null==e||null==(t=e.onChange)||t.call(e,i)}}))},[e]),c?(0,s.jsx)("div",{style:{width:"100%"},children:(0,s.jsx)(u.FlowModelRenderer,{model:c,showFlowSettings:!1})}):null),f=()=>(0,s.jsx)(g.Input,{placeholder:"<Null>",readOnly:!0,style:{width:"100%"}}),y=e=>(0,s.jsx)(sd.h,{t:this.context.t,value:null==e?void 0:e.value,onChange:null==e?void 0:e.onChange,containerStyle:{width:"100%"}}),v={renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?h:"null"===l?f:"runjs"===l?y:void 0},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:"runjs"===l?{code:"",version:"v2"}:void 0},resolvePathFromValue:e=>null===e?["null"]:(0,u.isRunJSValue)(e)?["runjs"]:(0,u.isVariableExpression)(e)?(0,u.parseValueToPath)(e):["constant"]},_=async()=>{var e;let t=null==(e=this.context)?void 0:e.getPropertyMetaTree,l="function"==typeof t?await t():[];return[{title:(0,u.tExpr)("Constant"),name:"constant",type:"string",paths:["constant"],render:h},{title:(0,u.tExpr)("Null"),name:"null",type:"object",paths:["null"],render:f},{title:(0,u.tExpr)("RunJS"),name:"runjs",type:"object",paths:["runjs"],render:y},...l]},b=(null==(e=this.props)?void 0:e.label)??this.fieldPath??"",x=null==o||null==(t=o.getField)?void 0:t.call(o,this.fieldPath);return b=(null==(d=this.props)?void 0:d.label)??(null==x?void 0:x.title)??b,(0,s.jsx)(u.FormItem,{...this.props,label:b,name:i,initialValue:this.assignValue,valuePropName:"__assign_value__",trigger:"__assign_trigger__",validateTrigger:"__assign_trigger__",children:p.default.createElement(e=>{let t=null==e?void 0:e.__assign_value__,l=void 0===t?this.assignValue:t;return(0,s.jsx)(u.VariableInput,{value:l,onChange:t=>{var l;this.assignValue=t,null==e||null==(l=e.__assign_trigger__)||l.call(e,t)},metaTree:_,converters:v,clearValue:""})})})};return(0,s.jsx)(c,{},d)}constructor(e){super(e),this.assignValue=void 0,(0,d.define)(this,{assignValue:d.observable})}}sm.define({label:(0,u.tExpr)("Assign field")}),sm.registerFlow({key:"editItemSettings",sort:300,title:(0,u.tExpr)("Form item settings"),steps:{showLabel:{title:(0,u.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,u.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let o=e.model,n=null==(l=o.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:o.context.t("Original field title: ")+n}}}}),defaultParams:e=>({label:e.model.collectionField.title}),handler(e,t){var l;t.label&&t.label===(null==(l=e.model.collectionField)?void 0:l.title)?e.model.setProps({label:t.label}):e.model.setProps({label:e.t(t.label,{ns:"lm-flow-engine"})})}},init:{async handler(e){let t=e.model.collectionField;t&&e.model.setProps(t.getComponentProps());let l=e.model.fieldPath,o=l.includes(".")?l.split("."):l;e.model.setProps({name:o})}},tooltip:{title:(0,u.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,u.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},validation:{title:(0,u.tExpr)("Validation"),use:"validation"},required:{title:(0,u.tExpr)("Required"),use:"required"}}});class sh extends rm{}sh.itemModelName="DetailsItemModel",sh.define({label:'{{t("Display association fields")}}'});let sf=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),o=parseFloat(l.marginTop)||0,n=parseFloat(l.marginBottom)||0;return t.height+o+n},sg=e=>{let{heightMode:t,containerRef:l,actionsRef:o,paginationRef:n,deps:i=[]}=e,[r,a]=(0,p.useState)(),s=(0,p.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let r=Math.max(0,Math.floor(i-sf(o.current)-sf(n.current)));a(e=>e===r?e:r)},[t,l,o,n]);return(0,p.useLayoutEffect)(()=>{s()},[s,...i]),(0,p.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=o.current,i=n.current,r=new ResizeObserver(()=>s());return r.observe(e),t&&r.observe(t),i&&r.observe(i),()=>r.disconnect()},[s,l,o,n,...i]),r};class sy extends rV.t{createResource(e,t){var l,o;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(o=this.association)?void 0:o.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(u.SingleRecordResource);return e.isNewRecord=!1,e}let n=this.context.createResource(u.MultiRecordResource);return n.setPageSize(1),n}onInit(e){var t,l;super.onInit(e),this.hadSingleRecordData=(null==(l=this.resource)||null==(t=l.hasData)?void 0:t.call(l))??!1,this.hasMultiRefreshDispatched=!1;let o=(0,u.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1,resolveOnServer:(0,u.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>this.getCurrentRecord()),meta:o}),this.resource.on("refresh",()=>{var e,t;if(this.isMultiRecordResource()){this.hasMultiRefreshDispatched=!0,(0,aY.Xi)(this,"paginationChange");return}let l=this.hadSingleRecordData;this.hadSingleRecordData=(null==(t=this.resource)||null==(e=t.hasData)?void 0:e.call(t))??!1,l&&(0,aY.Xi)(this,"paginationChange")})}isMultiRecordResource(){return this.resource instanceof u.MultiRecordResource}hasDispatchedMultiRefresh(){return this.hasMultiRefreshDispatched}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}async refresh(){await this.resource.refresh()}renderPagination(){if(!this.resource.loading&&!this.hasAvailableData()){var e,t;return(0,s.jsx)("div",{style:{textAlign:"center",color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")})}let l=this.resource;return!this.isMultiRecordResource()||!l.getPage()||1>=this.resource.getMeta("count")?null:(0,s.jsx)("div",{style:{textAlign:"center"},children:(0,s.jsx)(g.Pagination,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:l.getPage(),total:l.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})})}renderConfigureActions(){return(0,s.jsx)(u.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("RecordActionGroupModel"),afterSubModelInit:async e=>{e.setStepParams("buttonSettings","general",{type:"default"})},children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Actions")})},"details-actions-add")}renderComponent(){let{colon:e,labelAlign:t,labelWidth:l,labelWrap:o,layout:n}=this.props,i=!!this.context.flowSettingsEnabled,r=!i&&!this.hasAvailableData(),{heightMode:a,height:d}=this.decoratorProps;return(0,s.jsx)(sv,{model:this,gridModel:this.subModels.grid,isConfigMode:i,heightMode:a,height:d,layoutProps:{colon:e,labelAlign:t,labelWidth:l,labelWrap:o,layout:n},actions:(0,s.jsx)(u.DndProvider,{children:(0,s.jsx)("div",{style:r?{pointerEvents:"none",opacity:.45}:void 0,children:(0,s.jsxs)(g.Space,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||i)return(0,s.jsx)(u.Droppable,{model:e,children:(0,s.jsx)(u.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:u.DragHandler,sort:1}]})},e.uid)}),this.renderConfigureActions()]})})})})}constructor(...e){super(...e),this.hadSingleRecordData=!1,this.hasMultiRefreshDispatched=!1,this._defaultCustomModelClasses={RecordActionGroupModel:"RecordActionGroupModel",DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"},this.customModelClasses={},this.handlePageChange=async e=>{if(this.resource instanceof u.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await this.refresh()}}}}sy.scene=rB.P.oam;let sv=e=>{let{model:t,gridModel:l,isConfigMode:o,heightMode:n,height:i,layoutProps:r,actions:a}=e,d=(0,p.useRef)(null),c=(0,p.useRef)(null),m=(0,p.useRef)(null),h="specifyValue"===n||"fullHeight"===n,f=sg({heightMode:n,containerRef:d,actionsRef:c,paginationRef:m,deps:[i]});(0,p.useEffect)(()=>{var e,t;if(!l)return;let o=h?f:void 0;((null==(e=l.props)?void 0:e.height)!==o||(null==(t=l.props)?void 0:t.heightMode)!==n)&&l.setProps({height:o,heightMode:n})},[l,f,h,n]);let g=h?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,y=h?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,s.jsx)(aZ.s2,{model:t,layoutProps:r,style:g,children:(0,s.jsxs)("div",{ref:d,style:y,children:[(0,s.jsx)("div",{ref:c,style:{textAlign:"right",lineHeight:"0px",paddingBottom:o&&t.context.themeToken.padding},children:a}),(0,s.jsx)(u.FlowModelRenderer,{model:l,showFlowSettings:!1},`${(null==l?void 0:l.uid)||"details-grid"}:${o?"design":"runtime"}`),(0,s.jsx)("div",{ref:m,children:t.renderPagination()})]})})};sy.registerFlow({key:"detailsSettings",title:(0,u.tExpr)("Details settings"),sort:150,steps:{refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");await e.model.applySubModelsBeforeRenderFlows("grid")}},layout:{use:"layout",title:(0,u.tExpr)("Layout")},dataScope:{use:"dataScope"},defaultSorting:{use:"sortingRule",title:(0,u.tExpr)("Default sorting")},linkageRules:{use:"detailsFieldLinkageRules"}}}),sy.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldslinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"detailsFieldLinkageRules",flowKey:"detailsSettings",stepKey:"linkageRules"}}}}),sy.registerFlow({key:"initialPaginationChangeRefresh",sort:10001,steps:{refreshPaginationRelatedStates:{async handler(e){if(e.model.hidden||!e.model.isMultiRecordResource()||e.model.hasDispatchedMultiRefresh())return;let t=e.model.resource;if(!t)return;let l="manual"===(t.dataLoadingMode??t.loadingMode),o="function"==typeof t.hasActiveFilters&&t.hasActiveFilters();l&&!o&&await (0,aY.Xi)(e.model,"paginationChange")}}}}),sy.define({label:(0,u.tExpr)("Details"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search"),createModelOptions:{use:"DetailsBlockModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});class s_ extends u.FlowModel{static defineChildren(e){let t=e.engine.filterModelClassByParent("CommonItemModel"),l=e.engine.filterModelClassByParent("DetailsCustomItemModel"),o=t=>Array.from(t.entries()).map(t=>{var l,o,n,i,r;let[a,s]=t,d="function"==typeof s.defineChildren||!!(null==(l=s.meta)?void 0:l.children),u={key:a,label:e.t(s.meta.label),sort:s.meta.sort??999,searchable:!!(null==(o=s.meta)?void 0:o.searchable),searchPlaceholder:null==(n=s.meta)?void 0:n.searchPlaceholder,hide:null==(i=s.meta)?void 0:i.hide};return d?u.children=e=>{var t;return"function"==typeof s.defineChildren?s.defineChildren(e):(null==(t=s.meta)?void 0:t.children)||[]}:u.createModelOptions=(null==(r=s.meta)?void 0:r.createModelOptions)||{use:a},u});return c.default.sortBy([...o(t),...o(l)],"sort")}}s_.renderMode=u.ModelRenderMode.RenderFunction,s_.define({hide:!0,label:(0,u.tExpr)("Others")});class sb extends rL{renderAddSubModelButton(){return this.context.flowSettingsEnabled?(0,s.jsx)(u.AddSubModelButton,{model:this,subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("DetailsItemModel"),this.context.getModelClassName("DetailsAssociationFieldGroupModel"),this.context.getModelClassName("DetailsCustomItemModel")].filter(Boolean),keepDropdownOpen:!0,children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Fields")})}):null}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,o=null==(t=this.props)?void 0:t.heightMode,n=this.context.themeToken,i=super.render();return"defaultHeight"===o?i:(0,s.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${n.marginLG}px`,marginRight:`-${n.marginLG}px`,paddingLeft:`${n.marginLG}px`,paddingRight:`${n.marginLG}px`},children:i})}constructor(...e){super(...e),this.itemFallback=(0,s.jsx)(g.Skeleton.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}function sx(e,t){let{fieldUseModel:l,refreshTargets:o}=t,n=e=>Array.isArray(e)?e.map(e=>{let t={...e};if(t.children)if("function"==typeof t.children){let e=t.children;t.children=async t=>n(await e(t))}else Array.isArray(t.children)&&(t.children=n(t.children));if(t.createModelOptions){let e=t.createModelOptions;t.createModelOptions=async(t,o)=>{let n=await ("function"==typeof e?e(t,o):e);return n.subModels=n.subModels||{},n.subModels.field={...n.subModels.field||{},use:l},n},t.refreshTargets=t.refreshTargets||o}return t}):[];return n(e)}function sM(e,t,l){let{fieldUseModel:o,refreshTargets:n}=l,i=l.key??"js-association-fields",r=l.label??(0,u.tExpr)("Display association fields");return{key:i,type:"group",label:r,searchable:l.searchable??!0,searchPlaceholder:l.searchPlaceholder??(0,u.tExpr)("Search fields"),children:async e=>sx(await t(e),{fieldUseModel:o,refreshTargets:n})}}sb.registerFlow({key:"detailFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class sw extends rm{}async function sS(e,t){var l;let{useModel:o,fieldUseModel:n,refreshTargets:i,associationPathName:r,associationProvider:a}=t,s=(0,u.buildWrapperFieldChildren)(e,{useModel:o,fieldUseModel:n,associationPathName:r,refreshTargets:i}),d=[],c=null==s||null==(l=s[0])?void 0:l.children;if(Array.isArray(c)&&(d=c),!a)return d;let p=await a(e);return Array.isArray(p)&&0!==p.length?[...d,sM(e,a,{fieldUseModel:n,refreshTargets:i})]:d}sw.itemModelName="FormItemModel";class sk extends s_{static defineChildren(e){return sS(e,{useModel:"DetailsItemModel",fieldUseModel:"JSFieldModel",refreshTargets:["DetailsItemModel"],associationProvider:e=>sh.defineChildren(e)})}}sk.define({label:(0,u.tExpr)("JS field"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search fields"),sort:110});class sF extends rz.o{}class sC extends rz.o{constructor(...e){super(...e),this.operator="$eq",this.updateAssociation=!0}}sC.registerFlow({key:"AssociationFieldInit",sort:800,steps:{init:{async handler(e,t){if(e.model.updateAssociation){var l,o;let t=e.model.context.blockModel,n=null==t||null==(l=t.context)?void 0:l.resource,i=null==(o=e.model.parent)?void 0:o.fieldPath;n&&i&&n.addUpdateAssociationValues(i)}}},allowCreateCheck:{async handler(e){var t;let l=await e.aclCheck({dataSourceKey:e.collectionField.dataSourceKey,resourceName:null==(t=e.collectionField)?void 0:t.target,actionName:"create"});e.model.setProps({allowCreate:!!l})}}}});let sA=(e,t)=>e===t,sP=e=>{if(e&&"object"==typeof e){let t=e.data;return t&&"object"==typeof t?t:e}};function sT(e){return"string"==typeof e&&e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0}function sj(e,t){var l;let o="string"==typeof(null==t||null==(l=t.titleCollectionField)?void 0:l.name)?t.titleCollectionField.name:void 0,n=sT(null==t?void 0:t.filterTargetKey)||"id",i="string"==typeof(null==e?void 0:e.value)&&e.value&&!sA(e.value,"value")?e.value:void 0,r="string"==typeof(null==e?void 0:e.label)&&e.label&&!sA(e.label,"label")?e.label:void 0,a=i||n;return{label:r||o||a,value:a}}function sI(e){var t,l,o,n,i,r;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!!a.navigation,d=e=>{if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e)},u=d(null==(l=e.view)||null==(t=l.inputArgs)?void 0:t.openerUids),c=d(a.openerUids),p=u||c||[];if(s)return(c||p).filter(Boolean);let m=null==(n=e.view)||null==(o=n.inputArgs)?void 0:o.viewUid,h=null==(r=e.model.context)||null==(i=r.inputArgs)?void 0:i.viewUid;return[...p,"string"==typeof m&&m?m:"string"==typeof h&&h?h:e.model.uid].filter(Boolean)}function sL(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.map(e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}).filter(e=>void 0!==e);return t.length?t.map(String).join(", "):void 0}if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}function sD(e){var t,l,o;let{option:n,fieldNames:i}=e,r=(0,u.useFlowModel)(),a=sP(n),d=sj(i,null==(t=r.context.collectionField)?void 0:t.targetCollection),c=r.subModels.field,p=sL(null==a?void 0:a[d.label])??sL(null==a?void 0:a.label)??sL(null==a?void 0:a[d.value]);if(!c)return(0,s.jsx)("span",{children:p??"N/A"});let m=String((null==a?void 0:a[d.value])??p??"association-option"),h=c.createFork({},m);h.context.defineProperty("record",{get:()=>a,cache:!1,meta:(0,u.createCurrentRecordMetaFactory)(h.context,()=>h.context.collection)});let f=null==(o=r.context.collectionField.targetCollection)||null==(l=o.getField)?void 0:l.call(o,d.label),g=f&&"function"==typeof f.getComponentProps?f.getComponentProps():{};h.setProps({value:p,clickToOpen:!1,...g});let y=null!=p&&""!==p?h.render():"N/A";return(0,s.jsx)("span",{style:{pointerEvents:"none"},children:y})}function sR(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"record",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(!e)return l?[]:void 0;let{value:i}=t||{},r=e=>"object"==typeof e&&null!==e,a=e=>{if(r(e))return{label:(0,s.jsx)(sD,{option:e,fieldNames:t}),value:e[i]}};if("value"===o){let t=e=>{if("object"==typeof e&&null!==e)return a(e);let t=n.find(t=>(null==t?void 0:t[i])===e);return t?a(t):{label:String(e),value:e}};return l?Array.isArray(e)?e.map(e=>t(e)).filter(Boolean):[]:Array.isArray(e)?t(e[0]):t(e)}if(l)return Array.isArray(e)?e.filter(r).map(a).filter(Boolean):[];if(Array.isArray(e)){let t=e[0];return r(t)?a(t):void 0}return r(e)?a(e):void 0}function sY(e,t,l){return(null==e?void 0:e.length)?e.map(e=>(0,c.omit)(e,"disabled","options","style")):l?Array.isArray(t)?t.filter(e=>"object"==typeof e&&null!==e):[]:t&&"object"==typeof t?[t]:[]}let sE=(0,S.css)`
658
+ `},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":iH.n,"x-component-props":{rows:1}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":t("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}}},handler(e,t){e.model.setProps({url:t.url,searchParams:t.searchParams,openInNewWindow:t.openInNewWindow})}}}});class aW extends rp.S0{setTitle(e){this.setProps({title:e})}setExpandFlag(e){this.expandFlag=e}getTitle(){return this.expandFlag?this.context.t("Collapse all"):this.context.t("Expand all")}getIcon(){return this.expandFlag?"NodeCollapseOutlined":"NodeExpandOutlined"}constructor(...e){super(...e),this.defaultProps={type:"default",icon:"DownOutlined"}}}function aJ(e){let{idKey:t="id",childrenKey:l="children"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[];function n(e){if(Array.isArray(e))for(let i of e){let e=i[l];o.push(i[t]),Array.isArray(e)&&e.length>0&&n(e)}}return n(e),o}aW.scene=rp.s5.collection;let aX=e=>aJ(e);aW.registerFlow({key:"expandCollapseSettingsInit",sort:200,steps:{init:{handler(e,t){e.blockModel.props.defaultExpandAllRows?e.model.setExpandFlag(!0):e.model.setExpandFlag(!1)}}}}),aW.registerFlow({key:"expandCollapseSettings",on:"click",steps:{expandCollapse:{async handler(e,t){var l;if(!(null==(l=e.blockModel)?void 0:l.resource))return;let o=e.blockModel.resource,{treeTable:n}=e.blockModel.props;if(n)if(e.model.expandFlag)e.blockModel.setProps({expandedRowKeys:[]}),e.model.setExpandFlag(!1);else{let t=aX(o.getData());e.blockModel.setProps({expandedRowKeys:t}),e.model.setExpandFlag(!0)}}}}}),aW.define({label:(0,u.escapeT)("Expand/Collapse"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.model.props.treeTable}});class aQ extends r9{getAclActionName(){return"create"}onInit(e){super.onInit(e),this.context.defineProperty("association",{get:()=>this.context.blockModel.dataSource.getAssociation(`${this.context.blockModel.collection.name}.children`)})}constructor(...e){super(...e),this.defaultProps={type:"link",title:(0,u.tExpr)("Add child"),icon:"PlusOutlined"}}}aQ.capabilityActionName=null,aQ.registerFlow({key:"addChildSettingsInit",steps:{addChildInit:{async handler(e,t){e.model.onClick=t=>{e.model.dispatchEvent("click",{event:t,...e.inputArgs,sourceId:e.record.id,filterByTk:null},{debounce:!0})}}}}}),aQ.define({label:(0,u.tExpr)("Add child"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.blockModel.props.treeTable}}),rc.registerActionModels({AddChildActionModel:aQ});var aZ=__webpack_require__(2088);class a0 extends aZ.F4{useHooksBeforeRender(){let[e]=g.Form.useForm();this.context.defineProperty("form",{get:()=>e})}onInit(e){super.onInit(e);let t=(0,u.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)},cache:!1,resolveOnServer:(0,u.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)}),meta:t}),this.context.defineProperty("filterManager",{once:!0,get:()=>new rw(this,null==e?void 0:e.filterManager)}),this.isManualRefresh=!0}createResource(e,t){let l=this.context.createResource(u.SingleRecordResource);return l.isNewRecord=!0,l}renderComponent(){var e;let{colon:t,labelAlign:l,labelWidth:o,labelWrap:n,layout:i}=this.props;return(0,s.jsx)(aZ.s2,{model:this,layoutProps:{colon:t,labelAlign:l,labelWidth:o,labelWrap:n,layout:i},children:(0,s.jsx)(u.FlowModelRenderer,{model:null==(e=this.subModels)?void 0:e.grid,showFlowSettings:!1})})}setInitialAssignedValues(e){var t;let l=null==(t=this.subModels)?void 0:t.grid;Object.entries(e||{}).forEach(e=>{let[t,o]=e;l.addOrEnsureItem(t,o)})}getAssignedValues(){return this.subModels.grid.getAssignedValues()||{}}}a0.define({label:(0,u.tExpr)("Field assignments"),hide:!0,createModelOptions:{use:"AssignFormModel",subModels:{grid:{use:"AssignFormGridModel"}}}});class a1 extends rL{renderAddSubModelButton(){return(0,s.jsx)(u.AddSubModelButton,{subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("FormItemModel"),this.context.getModelClassName("FormAssociationFieldGroupModel"),this.context.getModelClassName("FormCustomItemModel"),this.context.getModelClassName("FormJSFieldItemModel")].filter(Boolean),model:this,keepDropdownOpen:!0,children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Fields")})})}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,o=null==(t=this.props)?void 0:t.heightModel,n=this.context.themeToken,i=super.render();return"defaultHeight"===o?i:(0,s.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${n.marginLG}px`,marginRight:`-${n.marginLG}px`,paddingLeft:`${n.marginLG}px`,paddingRight:`${n.marginLG}px`,paddingTop:5},children:i})}constructor(...e){super(...e),this.itemFallback=(0,s.jsx)(g.Skeleton.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}a1.registerFlow({key:"formFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class a2 extends a1{renderAddSubModelButton(){var e,t;let l=null==(e=this.context)?void 0:e.collection,o=(null==l||null==(t=l.getFields)?void 0:t.call(l))||[],n="function"==typeof(null==l?void 0:l.getPrimaryKey)?l.getPrimaryKey():void 0,i=null==l?void 0:l.filterTargetKey,r=e=>!!e&&!!(n&&e===n||"string"==typeof i&&e===i||Array.isArray(i)&&i.includes(e)),a=o.filter(e=>!r(null==e?void 0:e.name)).map(e=>{let t=e.name,o=e.title||e.name,n=u.EditableItemModel.getDefaultBindingByField(this.context,e);if(!n)return;let i=n.modelName;return{key:t,label:o,toggleable:e=>{let l=e.getStepParams("fieldSettings","init")||{};return(null==l?void 0:l.fieldPath)===t},useModel:"AssignFormItemModel",createModelOptions:()=>({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}},subModels:{field:{use:i,stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}}}}})}}).filter(Boolean);return(0,s.jsx)(u.AddSubModelButton,{subModelKey:"items",model:this,items:a,keepDropdownOpen:!0,children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Fields")})})}addOrEnsureItem(e,t){var l,o,n;let i=null==(l=this.context)?void 0:l.collection,r=((null==(o=this.subModels)?void 0:o.items)||[]).find(t=>{try{let l="function"==typeof(null==t?void 0:t.getStepParams)?t.getStepParams("fieldSettings","init"):null;return(null==l?void 0:l.fieldPath)===e}catch(e){return!1}});if(r){"function"==typeof(null==r?void 0:r.setStepParams)&&r.setStepParams("fieldSettings","assignValue",{value:t}),r.assignValue=t;return}let a=((null==i||null==(n=i.getFields)?void 0:n.call(i))||[]).find(t=>t.name===e),s=u.EditableItemModel.getDefaultBindingByField(this.context,a);if(!s)return;let d=s.modelName;this.addSubModel("items",{use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e},assignValue:{value:t}}},subModels:{field:{use:d,stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e}}}}}}).assignValue=t}getAssignedValues(){var e;let t=(null==(e=this.subModels)?void 0:e.items)||[],l={};for(let e of t){let t="function"==typeof e.getAssignedEntry?e.getAssignedEntry():null;t&&Array.isArray(t)&&(l[t[0]]=t[1])}return l}}a2.define({label:(0,u.tExpr)("Assign grid")});var a5=__webpack_require__(9829);function a8(e){return"string"==typeof e?e:"function"==typeof e&&e.name?e.name:void 0}function a4(e){var t,l;let o=null==e||null==(l=e.stepParams)||null==(t=l.fieldBinding)?void 0:t.use;return"string"==typeof o?o:void 0}async function a3(e){var t,l,o;let{parentModel:n,targetUse:i,defaultProps:r,pattern:a,fieldSettingsInit:s}=e,d=n.subModels.field,u=null==d?void 0:d.uid,c=null==d||null==(l=d.serialize)||null==(t=l.call(d))?void 0:t.subModels;for(let e in c)!1===c[e].delegateToParent&&delete c[e];let p=a8(a4(d)||(null==d?void 0:d.use))===i&&(null==d?void 0:d.stepParams)||{},m=s??(null==(o=n.getFieldSettingsInitParams)?void 0:o.call(n)),{fieldBinding:h,...f}=p,g={...f,fieldSettings:{...f.fieldSettings||{},init:m}},y=n.flowEngine;u&&(null==d||d.invalidateFlowCache("beforeRender",!0),y.removeModelWithSubModels(u));let v=n.setSubModel("field",{uid:u,use:i,props:{...r||{},...a?{pattern:a}:{}},stepParams:g,subModels:c});await v.dispatchEvent("beforeRender",void 0,{useCache:!1}),await n.save()}var a6=__webpack_require__(9133);function a9(e,t,l){let o=(0,c.castArray)(l).filter(e=>"string"==typeof e),n=t.split(".");if(null==o?void 0:o.length){let t=[],l=0,i=0;for(;l<n.length;){let e=n[l];if(t.push(e),i<o.length){let[l,n]=o[i].split(":");l===e&&(t.push(Number(n)),i++)}l++}return(0,c.get)(e,t)}return(0,c.get)(e,n)}function a7(e){let{record:t,currentObject:l,fieldPath:o,prefixFieldPath:n,idx:i}=e,r=a9(t,o,i);if(void 0!==r||null==l)return r;if(n&&o===n)return l;let a=n&&o.startsWith(`${n}.`)?o.slice(n.length+1):o;return a?(0,c.get)(l,a):l}function se(e,t){return!(0,a6.E4)(e)||Array.isArray(t)?t:t&&"object"==typeof t&&Array.isArray(t.rows)?t.rows:null==t?[]:[t]}class st extends u.DisplayItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let o=this.getDefaultBindingByField(e,l,{fallbackToTargetTitleField:!0});if(!o)return null;let n=o.modelName,i=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:i,label:l.title,refreshTargets:["DetailsCustomItemModel/DetailsJSFieldItemModel"],toggleable:e=>{var t;return(null==(t=e.getStepParams("fieldSettings","init"))?void 0:t.fieldPath)===i},useModel:"DetailsItemModel",createModelOptions:()=>({use:"DetailsItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:i}}},subModels:{field:{use:n,props:"function"==typeof o.defaultProps?o.defaultProps(e,l):o.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>"view",cache:!1})}renderItem(){let e=this.subModels.field,t=this.context.fieldIndex,l=this.context.record,o=this.context.currentObject,n=this.context.item,i=this.context.getPropertyOptions("item"),r=this.context.prefixFieldPath,a=null!=t?(()=>{let r=e.createFork({},`${t}`);r.context.defineProperty("fieldIndex",{get:()=>t}),r.context.defineProperty("record",{get:()=>l,cache:!1}),r.context.defineProperty("currentObject",{get:()=>o,cache:!1});let{value:a,...s}=i||{};return r.context.defineProperty("item",{...s,get:()=>n,cache:!1}),this.context.pattern&&r.context.defineProperty("pattern",{get:()=>this.context.pattern}),r})():e,d=this.context.pattern?{...this.context.blockModel.props,...this.props,pattern:this.context.pattern,disabled:"readPretty"===this.context.pattern}:{...this.context.blockModel.props,...this.props},c=se(this.collectionField,a7({record:l,currentObject:o,fieldPath:this.fieldPath,prefixFieldPath:r,idx:t}));return(0,s.jsx)(u.FormItem,{...d,value:c,children:(0,s.jsx)(u.FieldModelRenderer,{model:a})})}}st.define({label:(0,u.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search fields"),sort:100}),st.registerFlow({key:"detailItemSettings",sort:300,title:(0,u.tExpr)("Detail item settings"),steps:{showLabel:{title:(0,u.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,u.tExpr)("Label"),uiSchema:e=>({title:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let o=e.model,n=null==(l=o.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:o.context.t("Original field title: ")+n}}}}),defaultParams:e=>{var t;return{title:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let o={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.title,o)})}},aclCheck:{use:"aclCheck"},init:{async handler(e){let{collectionField:t}=e.model;t&&e.model.setProps(t.getComponentProps())}},tooltip:{title:(0,u.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,u.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},model:{title:(0,u.tExpr)("Field component"),use:"displayFieldComponent"},fieldNames:{use:"titleField",title:(0,u.tExpr)("Title field"),beforeParamsSave:async(e,t,l)=>{if(!e.collectionField||!e.collectionField.isAssociationField())return null;if(t.label!==l.label){var o,n;e.model.setProps({titleField:t.label,...null==(n=e.collectionField.targetCollection)||null==(o=n.getField(t.label))?void 0:o.getComponentProps()});let l=e.collectionField.targetCollection.getField(t.label),i=u.DisplayItemModel.getDefaultBindingByField(e,l),r=i.modelName;await a3({parentModel:e.model,targetUse:r,defaultProps:"function"==typeof(null==i?void 0:i.defaultProps)?i.defaultProps(e,e.collectionField):null==i?void 0:i.defaultProps,pattern:e.model.getProps().pattern})}},async handler(e,t){var l,o;if(!e.collectionField||e.model.subModels.field.disableTitleField)return;e.model.setProps({titleField:t.label,...null==(o=e.collectionField.targetCollection)||null==(l=o.getField(t.label))?void 0:l.getComponentProps()});let n=e.collectionField.targetCollection;if(n){let l=n.getField(t.label),o=u.DisplayItemModel.getDefaultBindingByField(e,l).modelName;o!==e.model.subModels.field.use&&e.model.setStepParams(e.flowKey,"model",{use:o})}},hideInSettings:async e=>!e.collectionField||!e.collectionField.isAssociationField()||e.model.subModels.field.disableTitleField}}}),st.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var sl=__webpack_require__(1961);function so(e){if(!e)return!1;let t=null==e?void 0:e.type;return"belongsToMany"===t||"hasMany"===t||"belongsToArray"===t}function sn(e,t){var l;let o=!!(null==e||null==(l=e.isAssociationField)?void 0:l.call(e)),n=so(e);return o&&!n&&Array.isArray(t)?t.length?t[0]:void 0:t}function si(e,t){if(!(null==t?void 0:t.length))return e;let[l,o]=String(t[t.length-1]).split(":"),n=Number(o);if(!l||!Number.isFinite(n))return e;let i=0;for(let e of t){let[t]=String(e).split(":");t===l&&(i+=1)}let r=-1,a=0;for(let t=0;t<e.length;t++)if(String(e[t])===l&&(a+=1)===i){r=t;break}if(-1===r){for(let t=e.length-1;t>=0;t--)if(String(e[t])===l){r=t;break}}return -1===r?e:[n,...e.slice(r+1)]}let sr=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"];class sa extends u.EditableItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let o=this.getDefaultBindingByField(e,l);if(!o)return;let n=o.modelName,i=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:i,label:l.title,refreshTargets:["FormJSFieldItemModel","FormItemModel/FormJSFieldItemModel"],toggleable:e=>(0,a6.pX)(e).some(e=>e===i),useModel:"FormItemModel",createModelOptions:()=>({use:"FormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:i}}},subModels:{field:{use:n,props:"function"==typeof o.defaultProps?o.defaultProps(e,l):o.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{if(this.collectionField){let t=this.collectionField.getComponentProps();e.setProps(t),this.setProps({...c.default.pick(t,"rules")||{}})}})}renderItem(){var e,t;let l=this.subModels.field,o=this.context.fieldIndex,n=this.context.fieldKey,i=(null==(e=this.parent)?void 0:e.context.fieldPathArray)||[],r=!!this.context.flowSettingsEnabled&&!!this.props.hidden&&!this.hidden&&!this.forbidden,a=null!=o||r?(()=>{let e=r?`${this.uid}:config-visible`:`${n}`,t=l.createFork({},e);if(null!=o){t.context.defineProperty("fieldIndex",{get:()=>o}),t.context.defineProperty("fieldKey",{get:()=>n}),this.context.currentObject&&t.context.defineProperty("currentObject",{get:()=>this.context.currentObject});let e=this.context.getPropertyOptions("item");if(this.context.item){let{value:l,...o}=e||{};t.context.defineProperty("item",{...o,get:()=>this.context.item,cache:!1})}this.context.pattern&&t.context.defineProperty("pattern",{get:()=>this.context.pattern})}return t.context.defineProperty("fieldPathArray",{get:()=>this.context.fieldPathArray,cache:!1}),r&&t.setProps({hidden:!1}),t})():l,{initialValue:d,hidden:p,...m}=this.context.pattern?{...this.props,pattern:this.context.pattern}:this.props,h=r?m:{hidden:p,...m},f=si(this.props.name,o);this.context.defineProperty("fieldPathArray",{get:()=>[...i,...c.default.castArray(f)],cache:!1});let y=(null==(t=this.context.item)?void 0:t.value)||this.context.record,v=(0,s.jsx)(u.FormItem,{...h,name:f,validateFirst:!0,disabled:this.props.disabled||!c.default.isEmpty(y)&&!y.__is_new__&&this.props.aclDisabled||!c.default.isEmpty(y)&&y.__is_new__&&this.props.aclCreateDisabled,children:(0,s.jsx)(u.FieldModelRenderer,{model:a,name:f})});return r?(0,s.jsx)(g.Tooltip,{title:this.context.t("The field is hidden and only visible when the UI Editor is active"),children:(0,s.jsx)("div",{style:{opacity:.3},children:v})}):v}}sa.define({label:(0,u.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search fields"),sort:100}),sa.registerFlow({key:"editItemSettings",sort:300,title:(0,u.tExpr)("Form item settings"),steps:{showLabel:{title:(0,u.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,u.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let o=e.model,n=null==(l=o.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:o.context.t("Original field title: ")+n}}}}),defaultParams:e=>{var t;return{label:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let o={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.label,o)})}},aclCheck:{use:"aclCheck",async handler(e,t){var l,o,n,i,r,a,s,d,u,c,p,m,h;if(!e.collectionField||!e.blockModel)return;let f=e.blockModel.context.actionName,g=await e.aclCheck({dataSourceKey:null==(l=e.dataSource)?void 0:l.key,resourceName:null==(o=e.collectionField)?void 0:o.collectionName,fields:[null==(n=e.collectionField)?void 0:n.name],actionName:f});if("update"===f){let t=await e.aclCheck({dataSourceKey:null==(i=e.dataSource)?void 0:i.key,resourceName:null==(r=e.collectionField)?void 0:r.collectionName,fields:[e.collectionField.name],actionName:"view"});e.prefixFieldPath&&e.item&&(await e.aclCheck({dataSourceKey:null==(s=e.dataSource)?void 0:s.key,resourceName:null==(d=e.collectionField)?void 0:d.collectionName,fields:[e.collectionField.name],actionName:"create"})||e.model.setProps({aclCreateDisabled:!0}));let l=(null==(a=e.item)?void 0:a.__is_new__)??!1;t||l||(e.model.hidden=!0,e.model.forbidden={actionName:"view"},e.exitAll()),g||e.model.setProps({aclDisabled:!0})}else if("create"===f){let t=await e.aclCheck({dataSourceKey:null==(u=e.dataSource)?void 0:u.key,resourceName:null==(c=e.collectionField)?void 0:c.collectionName,actionName:"update"}),l=await e.aclCheck({dataSourceKey:null==(p=e.dataSource)?void 0:p.key,resourceName:null==(m=e.collectionField)?void 0:m.collectionName,fields:[e.collectionField.name],actionName:"update"}),o=(null==(h=e.item)?void 0:h.__is_stored__)??!1;g||o||(e.model.hidden=!0,e.model.forbidden={actionName:f},e.exitAll()),t&&l||e.model.setProps({aclDisabled:!0})}}},init:{async handler(e){let t=e.model.fieldPath,l=t.includes(".")?t.split("."):t;e.model.setProps({name:l})}},tooltip:{title:(0,u.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,u.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem","x-component-props":{autoSize:!0}}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},initialValue:{title:(0,u.tExpr)("Default value"),disabledInSettings:!0,disabledReasonInSettings:e=>`${e.t("This setting has been moved to")}: ${e.t("Form block settings")} > ${e.t("Field values")}`,uiSchema:e=>{var t,l,o,n;if(e.model.parent.parent instanceof sl.EditFormModel||(null==(l=e.model.subModels)||null==(t=l.field)?void 0:t.updateAssociation))return;let i=null==(o=e.model.collectionField)?void 0:o.interface;if(null==sr||null==(n=sr.includes)||!n.call(sr,i))return{defaultValue:{"x-component":"DefaultValue","x-decorator":"FormItem"}}},defaultParams:e=>{let t=e.model.collectionField;if("nanoid"===t.interface&&!1!==t.options.autoFill){let{size:e,customAlphabet:l}=t.options||{size:21};return{defaultValue:(0,a5.customAlphabet)(l,e)()}}return{defaultValue:t.defaultValue}},handler(e,t){var l,o;let n=null==(l=e.model.collectionField)?void 0:l.interface;if(null==sr||null==(o=sr.includes)?void 0:o.call(sr,n))return;let i=sn(e.model.collectionField,t.defaultValue);e.model.setProps({initialValue:i})}},validation:{title:(0,u.tExpr)("Validation"),use:"validation"},required:{title:(0,u.tExpr)("Required"),use:"required"},model:{use:"fieldComponent",title:(0,u.tExpr)("Field component")},pattern:{use:"pattern"},titleField:{use:"titleField",hideInSettings:e=>!(e.collectionField&&e.collectionField.isAssociationField()&&e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern),defaultParams:e=>{var t,l,o;return{titleField:e.model.props.titleField||(null==(o=e.model)||null==(l=o.context)||null==(t=l.collectionField)?void 0:t.targetCollectionTitleFieldName)}},beforeParamsSave:async(e,t,l)=>{if(!(e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern))return null;let o=t.titleField||t.label;if(o!==l.titleField){let t=e.collectionField.targetCollection,l=t.getField(o),n=st.getDefaultBindingByField(e,l);if(n.modelName!==e.model.subModels.field.use){let l=e.model.subModels.field.uid;await e.engine.destroyModel(l);let i=e.model.setSubModel("field",{use:n.modelName,stepParams:{fieldSettings:{init:{dataSourceKey:e.model.collectionField.dataSourceKey,collectionName:t.name,fieldPath:o}}}});await i.save()}e.model.setProps(e.collectionField.targetCollection.getField(o).getComponentProps())}},async handler(e,t){"readPretty"===e.model.props.pattern?e.model.setProps({titleField:null==t?void 0:t.label}):e.model.setProps({titleField:t.titleField})}}}}),sa.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var ss=__webpack_require__(7309),sd=__webpack_require__(9624);function su(e,t){var l,o,n;let i=null==e||null==(l=e.props)?void 0:l.fieldNames,r=null==e||null==(o=e.props)?void 0:o.titleField,a=null==e||null==(n=e.getStepParams)?void 0:n.call(e,"selectSettings","fieldNames");return{stepParams:{fieldSettings:{init:t},...a?{selectSettings:{fieldNames:a}}:{}},props:{...void 0!==i?{fieldNames:i}:{},...void 0!==r?{titleField:r}:{}}}}function sc(e){try{return JSON.stringify(e)??""}catch{return String(e)}}function sp(e){var t,l,o;let n=null==e||null==(t=e.props)?void 0:t.fieldNames,i=null==e||null==(l=e.props)?void 0:l.titleField,r=null==e||null==(o=e.getStepParams)?void 0:o.call(e,"selectSettings","fieldNames");return[(null==e?void 0:e.uid)||"",sc(n),sc(i),sc(r)].join("|")}class sm extends sa{onInit(e){var t,l,o,n,i,r,a;let s=null==(t=this.getStepParams("fieldSettings","assignValue"))?void 0:t.value;void 0!==s&&(this.assignValue=s),this.context.defineProperty("collectionField",{get:()=>{var e,t;let l=this.getStepParams("fieldSettings","init")||{},o=`${null==l?void 0:l.dataSourceKey}.${null==l?void 0:l.collectionName}.${null==l?void 0:l.fieldPath}`,n=null==(e=this.context)?void 0:e.dataSourceManager;return null==n||null==(t=n.getCollectionField)?void 0:t.call(n,o)}});let d=this.context,c=null==d?void 0:d.collection,p=this.fieldInit;if(!(null==(l=this.subModels)?void 0:l.field)&&(null==c?void 0:c.getFields)){let e=(c.getFields()||[]).find(e=>(null==e?void 0:e.name)===(null==p?void 0:p.fieldPath));null==c||null==(n=c.getField)||n.call(c,null==p?void 0:p.fieldPath);let t=u.EditableItemModel.getDefaultBindingByField(d,e);if(!t)return;let l=t.modelName;null==d||null==(r=d.engine)||null==(i=r.createModel)||i.call(r,{use:l,stepParams:{fieldSettings:{init:p}},parentId:this.uid,subKey:"field"})}let m=null==(o=this.context)?void 0:o.collection,h=this.fieldPath;if(h){let e=null==m||null==(a=m.getField)?void 0:a.call(m,h),t=(null==e?void 0:e.title)||h,l=h.includes(".")?h.split("."):[h];this.setProps({label:t,name:l})}}get fieldInit(){return this.getStepParams("fieldSettings","init")||{}}get fieldPath(){var e;return null==(e=this.fieldInit)?void 0:e.fieldPath}getAssignedEntry(){let e=this.fieldPath;return e?[e,this.assignValue]:null}render(){var e,t;let l=this.context,o=l.collection,n=this.fieldInit,i=(null==(e=this.props)?void 0:e.name)||(this.fieldPath?[this.fieldPath]:void 0),r=this.fieldPath,a=null==(t=this.subModels)?void 0:t.field,d=sp(a),c=()=>{var e,t,d;let[c,m]=p.default.useState(null);p.default.useEffect(()=>{var e,t,i,s,d,c,p,h,f,g,y,v,_,b,x,M,w,S,k,F,C;if(!r)return;let A=((null==o||null==(e=o.getFields)?void 0:e.call(o))||[]).find(e=>(null==e?void 0:e.name)===r);o.getField(r);let P=u.EditableItemModel.getDefaultBindingByField(l,A);if(!P)return;let T=P.modelName,j=su(a,n),I=null==l||null==(i=l.engine)||null==(t=i.createModel)?void 0:t.call(i,{use:"VariableFieldFormModel",subModels:{fields:[{use:T,...j}]}});if(!I)return;null==(d=I.context)||null==(s=d.defineProperty)||s.call(d,"collection",{value:o});let L=null==l?void 0:l.dataSource;L&&(null==(p=I.context)||null==(c=p.defineProperty)||c.call(p,"dataSource",{value:L}));let D=null==o||null==(h=o.getField)?void 0:h.call(o,null==n?void 0:n.fieldPath);D&&(null==(g=I.context)||null==(f=g.defineProperty)||f.call(g,"collectionField",{value:D}));let R=null==l?void 0:l.blockModel;R&&(null==(v=I.context)||null==(y=v.defineProperty)||y.call(v,"blockModel",{value:R}));let Y=l.form;Y&&(null==(F=I.context)||null==(k=F.defineProperty)||k.call(F,"form",{value:Y})),I.context&&Object.defineProperty(I.context,"resource",{configurable:!0,enumerable:!0,get:()=>null==R?void 0:R.resource});let E=null==I||null==(b=I.subModels)||null==(_=b.fields)?void 0:_[0],N=null==o||null==(x=o.getField)?void 0:x.call(o,null==n?void 0:n.fieldPath),O=null==N?void 0:N.type,B=null==N?void 0:N.interface,H="belongsToMany"===O||"hasMany"===O||"belongsToArray"===O||"m2m"===B||"o2m"===B||"mbm"===B;if(null==E||null==(M=E.setProps)||M.call(E,{disabled:!1,readPretty:!1,updateAssociation:!1,multiple:H}),null==E||null==(w=E.dispatchEvent)||w.call(E,"beforeRender",void 0,{sequential:!0,useCache:!0}),(0,ss.NI)(E,N),!(null==E||null==(S=E.props)?void 0:S.fieldNames)&&(null==N?void 0:N.targetCollection)){let e=N.targetCollection,t=(null==N?void 0:N.targetKey)||(null==e?void 0:e.filterTargetKey)||"id";null==E||null==(C=E.setProps)||C.call(E,{fieldNames:{label:null==e?void 0:e.titleField,value:t}})}return m(I),()=>{var e,t,l,o;null==I||null==(l=I.subModels)||null==(t=l.fields)||null==(e=t.forEach)||e.call(t,e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),null==I||null==(o=I.remove)||o.call(I)}},[]);let h=e=>(p.default.useEffect(()=>{var t,l,o,n;if(!c)return;null==(t=c.setProps)||t.call(c,{...e});let i=null==c||null==(o=c.subModels)||null==(l=o.fields)?void 0:l[0];i&&(null==(n=i.setProps)||n.call(i,{value:null==e?void 0:e.value,onChange:function(){for(var t,l=arguments.length,o=Array(l),n=0;n<l;n++)o[n]=arguments[n];let i=o&&o.length?o[0]:void 0;null==e||null==(t=e.onChange)||t.call(e,i)}}))},[e]),c?(0,s.jsx)("div",{style:{width:"100%"},children:(0,s.jsx)(u.FlowModelRenderer,{model:c,showFlowSettings:!1})}):null),f=()=>(0,s.jsx)(g.Input,{placeholder:"<Null>",readOnly:!0,style:{width:"100%"}}),y=e=>(0,s.jsx)(sd.h,{t:this.context.t,value:null==e?void 0:e.value,onChange:null==e?void 0:e.onChange,containerStyle:{width:"100%"}}),v={renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?h:"null"===l?f:"runjs"===l?y:void 0},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:"runjs"===l?{code:"",version:"v2"}:void 0},resolvePathFromValue:e=>null===e?["null"]:(0,u.isRunJSValue)(e)?["runjs"]:(0,u.isVariableExpression)(e)?(0,u.parseValueToPath)(e):["constant"]},_=async()=>{var e;let t=null==(e=this.context)?void 0:e.getPropertyMetaTree,l="function"==typeof t?await t():[];return[{title:(0,u.tExpr)("Constant"),name:"constant",type:"string",paths:["constant"],render:h},{title:(0,u.tExpr)("Null"),name:"null",type:"object",paths:["null"],render:f},{title:(0,u.tExpr)("RunJS"),name:"runjs",type:"object",paths:["runjs"],render:y},...l]},b=(null==(e=this.props)?void 0:e.label)??this.fieldPath??"",x=null==o||null==(t=o.getField)?void 0:t.call(o,this.fieldPath);return b=(null==(d=this.props)?void 0:d.label)??(null==x?void 0:x.title)??b,(0,s.jsx)(u.FormItem,{...this.props,label:b,name:i,initialValue:this.assignValue,valuePropName:"__assign_value__",trigger:"__assign_trigger__",validateTrigger:"__assign_trigger__",children:p.default.createElement(e=>{let t=null==e?void 0:e.__assign_value__,l=void 0===t?this.assignValue:t;return(0,s.jsx)(u.VariableInput,{value:l,onChange:t=>{var l;this.assignValue=t,null==e||null==(l=e.__assign_trigger__)||l.call(e,t)},metaTree:_,converters:v,clearValue:""})})})};return(0,s.jsx)(c,{},d)}constructor(e){super(e),this.assignValue=void 0,(0,d.define)(this,{assignValue:d.observable})}}sm.define({label:(0,u.tExpr)("Assign field")}),sm.registerFlow({key:"editItemSettings",sort:300,title:(0,u.tExpr)("Form item settings"),steps:{showLabel:{title:(0,u.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,u.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let o=e.model,n=null==(l=o.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:o.context.t("Original field title: ")+n}}}}),defaultParams:e=>({label:e.model.collectionField.title}),handler(e,t){var l;t.label&&t.label===(null==(l=e.model.collectionField)?void 0:l.title)?e.model.setProps({label:t.label}):e.model.setProps({label:e.t(t.label,{ns:"lm-flow-engine"})})}},init:{async handler(e){let t=e.model.collectionField;t&&e.model.setProps(t.getComponentProps());let l=e.model.fieldPath,o=l.includes(".")?l.split("."):l;e.model.setProps({name:o})}},tooltip:{title:(0,u.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,u.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},validation:{title:(0,u.tExpr)("Validation"),use:"validation"},required:{title:(0,u.tExpr)("Required"),use:"required"}}});class sh extends rm{}sh.itemModelName="DetailsItemModel",sh.define({label:'{{t("Display association fields")}}'});let sf=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),o=parseFloat(l.marginTop)||0,n=parseFloat(l.marginBottom)||0;return t.height+o+n},sg=e=>{let{heightMode:t,containerRef:l,actionsRef:o,paginationRef:n,deps:i=[]}=e,[r,a]=(0,p.useState)(),s=(0,p.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let r=Math.max(0,Math.floor(i-sf(o.current)-sf(n.current)));a(e=>e===r?e:r)},[t,l,o,n]);return(0,p.useLayoutEffect)(()=>{s()},[s,...i]),(0,p.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=o.current,i=n.current,r=new ResizeObserver(()=>s());return r.observe(e),t&&r.observe(t),i&&r.observe(i),()=>r.disconnect()},[s,l,o,n,...i]),r};class sy extends rV.t{createResource(e,t){var l,o;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(o=this.association)?void 0:o.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(u.SingleRecordResource);return e.isNewRecord=!1,e}let n=this.context.createResource(u.MultiRecordResource);return n.setPageSize(1),n}onInit(e){var t,l;super.onInit(e),this.hadSingleRecordData=(null==(l=this.resource)||null==(t=l.hasData)?void 0:t.call(l))??!1,this.hasMultiRefreshDispatched=!1;let o=(0,u.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1,resolveOnServer:(0,u.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>this.getCurrentRecord()),meta:o}),this.resource.on("refresh",()=>{var e,t;if(this.isMultiRecordResource()){this.hasMultiRefreshDispatched=!0,(0,aY.Xi)(this,"paginationChange");return}let l=this.hadSingleRecordData;this.hadSingleRecordData=(null==(t=this.resource)||null==(e=t.hasData)?void 0:e.call(t))??!1,l&&(0,aY.Xi)(this,"paginationChange")})}isMultiRecordResource(){return this.resource instanceof u.MultiRecordResource}hasDispatchedMultiRefresh(){return this.hasMultiRefreshDispatched}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}async refresh(){await this.resource.refresh()}renderPagination(){if(!this.resource.loading&&!this.hasAvailableData()){var e,t;return(0,s.jsx)("div",{style:{textAlign:"center",color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")})}let l=this.resource;return!this.isMultiRecordResource()||!l.getPage()||1>=this.resource.getMeta("count")?null:(0,s.jsx)("div",{style:{textAlign:"center"},children:(0,s.jsx)(g.Pagination,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:l.getPage(),total:l.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})})}renderConfigureActions(){return(0,s.jsx)(u.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("RecordActionGroupModel"),afterSubModelInit:async e=>{e.setStepParams("buttonSettings","general",{type:"default"})},children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Actions")})},"details-actions-add")}renderComponent(){let{colon:e,labelAlign:t,labelWidth:l,labelWrap:o,layout:n}=this.props,i=!!this.context.flowSettingsEnabled,r=!i&&!this.hasAvailableData(),{heightMode:a,height:d}=this.decoratorProps;return(0,s.jsx)(sv,{model:this,gridModel:this.subModels.grid,isConfigMode:i,heightMode:a,height:d,layoutProps:{colon:e,labelAlign:t,labelWidth:l,labelWrap:o,layout:n},actions:(0,s.jsx)(u.DndProvider,{children:(0,s.jsx)("div",{style:r?{pointerEvents:"none",opacity:.45}:void 0,children:(0,s.jsxs)(g.Space,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||i)return(0,s.jsx)(u.Droppable,{model:e,children:(0,s.jsx)(u.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:u.DragHandler,sort:1}]})},e.uid)}),this.renderConfigureActions()]})})})})}constructor(...e){super(...e),this.hadSingleRecordData=!1,this.hasMultiRefreshDispatched=!1,this._defaultCustomModelClasses={RecordActionGroupModel:"RecordActionGroupModel",DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"},this.customModelClasses={},this.handlePageChange=async e=>{if(this.resource instanceof u.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await this.refresh()}}}}sy.scene=rB.P.oam;let sv=e=>{let{model:t,gridModel:l,isConfigMode:o,heightMode:n,height:i,layoutProps:r,actions:a}=e,d=(0,p.useRef)(null),c=(0,p.useRef)(null),m=(0,p.useRef)(null),h="specifyValue"===n||"fullHeight"===n,f=sg({heightMode:n,containerRef:d,actionsRef:c,paginationRef:m,deps:[i]});(0,p.useEffect)(()=>{var e,t;if(!l)return;let o=h?f:void 0;((null==(e=l.props)?void 0:e.height)!==o||(null==(t=l.props)?void 0:t.heightMode)!==n)&&l.setProps({height:o,heightMode:n})},[l,f,h,n]);let g=h?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,y=h?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,s.jsx)(aZ.s2,{model:t,layoutProps:r,style:g,children:(0,s.jsxs)("div",{ref:d,style:y,children:[(0,s.jsx)("div",{ref:c,style:{textAlign:"right",lineHeight:"0px",paddingBottom:o&&t.context.themeToken.padding},children:a}),(0,s.jsx)(u.FlowModelRenderer,{model:l,showFlowSettings:!1},`${(null==l?void 0:l.uid)||"details-grid"}:${o?"design":"runtime"}`),(0,s.jsx)("div",{ref:m,children:t.renderPagination()})]})})};sy.registerFlow({key:"detailsSettings",title:(0,u.tExpr)("Details settings"),sort:150,steps:{refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");await e.model.applySubModelsBeforeRenderFlows("grid")}},layout:{use:"layout",title:(0,u.tExpr)("Layout")},dataScope:{use:"dataScope"},defaultSorting:{use:"sortingRule",title:(0,u.tExpr)("Default sorting")},linkageRules:{use:"detailsFieldLinkageRules"}}}),sy.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldslinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"detailsFieldLinkageRules",flowKey:"detailsSettings",stepKey:"linkageRules"}}}}),sy.registerFlow({key:"initialPaginationChangeRefresh",sort:10001,steps:{refreshPaginationRelatedStates:{async handler(e){if(e.model.hidden||!e.model.isMultiRecordResource()||e.model.hasDispatchedMultiRefresh())return;let t=e.model.resource;if(!t)return;let l="manual"===(t.dataLoadingMode??t.loadingMode),o="function"==typeof t.hasActiveFilters&&t.hasActiveFilters();l&&!o&&await (0,aY.Xi)(e.model,"paginationChange")}}}}),sy.define({label:(0,u.tExpr)("Details"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search"),createModelOptions:{use:"DetailsBlockModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});class s_ extends u.FlowModel{static defineChildren(e){let t=e.engine.filterModelClassByParent("CommonItemModel"),l=e.engine.filterModelClassByParent("DetailsCustomItemModel"),o=t=>Array.from(t.entries()).map(t=>{var l,o,n,i,r;let[a,s]=t,d="function"==typeof s.defineChildren||!!(null==(l=s.meta)?void 0:l.children),u={key:a,label:e.t(s.meta.label),sort:s.meta.sort??999,searchable:!!(null==(o=s.meta)?void 0:o.searchable),searchPlaceholder:null==(n=s.meta)?void 0:n.searchPlaceholder,hide:null==(i=s.meta)?void 0:i.hide};return d?u.children=e=>{var t;return"function"==typeof s.defineChildren?s.defineChildren(e):(null==(t=s.meta)?void 0:t.children)||[]}:u.createModelOptions=(null==(r=s.meta)?void 0:r.createModelOptions)||{use:a},u});return c.default.sortBy([...o(t),...o(l)],"sort")}}s_.renderMode=u.ModelRenderMode.RenderFunction,s_.define({hide:!0,label:(0,u.tExpr)("Others")});class sb extends rL{renderAddSubModelButton(){return this.context.flowSettingsEnabled?(0,s.jsx)(u.AddSubModelButton,{model:this,subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("DetailsItemModel"),this.context.getModelClassName("DetailsAssociationFieldGroupModel"),this.context.getModelClassName("DetailsCustomItemModel")].filter(Boolean),keepDropdownOpen:!0,children:(0,s.jsx)(u.FlowSettingsButton,{icon:(0,s.jsx)(eJ.SettingOutlined,{}),children:this.translate("Fields")})}):null}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,o=null==(t=this.props)?void 0:t.heightMode,n=this.context.themeToken,i=super.render();return"defaultHeight"===o?i:(0,s.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${n.marginLG}px`,marginRight:`-${n.marginLG}px`,paddingLeft:`${n.marginLG}px`,paddingRight:`${n.marginLG}px`},children:i})}constructor(...e){super(...e),this.itemFallback=(0,s.jsx)(g.Skeleton.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}}),this.itemSettingsMenuLevel=2,this.itemFlowSettings={showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}},this.dragOverlayConfig={columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}}}}function sx(e,t){let{fieldUseModel:l,refreshTargets:o}=t,n=e=>Array.isArray(e)?e.map(e=>{let t={...e};if(t.children)if("function"==typeof t.children){let e=t.children;t.children=async t=>n(await e(t))}else Array.isArray(t.children)&&(t.children=n(t.children));if(t.createModelOptions){let e=t.createModelOptions;t.createModelOptions=async(t,o)=>{let n=await ("function"==typeof e?e(t,o):e);return n.subModels=n.subModels||{},n.subModels.field={...n.subModels.field||{},use:l},n},t.refreshTargets=t.refreshTargets||o}return t}):[];return n(e)}function sM(e,t,l){let{fieldUseModel:o,refreshTargets:n}=l,i=l.key??"js-association-fields",r=l.label??(0,u.tExpr)("Display association fields");return{key:i,type:"group",label:r,searchable:l.searchable??!0,searchPlaceholder:l.searchPlaceholder??(0,u.tExpr)("Search fields"),children:async e=>sx(await t(e),{fieldUseModel:o,refreshTargets:n})}}sb.registerFlow({key:"detailFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class sw extends rm{}async function sS(e,t){var l;let{useModel:o,fieldUseModel:n,refreshTargets:i,associationPathName:r,associationProvider:a}=t,s=(0,u.buildWrapperFieldChildren)(e,{useModel:o,fieldUseModel:n,associationPathName:r,refreshTargets:i}),d=[],c=null==s||null==(l=s[0])?void 0:l.children;if(Array.isArray(c)&&(d=c),!a)return d;let p=await a(e);return Array.isArray(p)&&0!==p.length?[...d,sM(e,a,{fieldUseModel:n,refreshTargets:i})]:d}sw.itemModelName="FormItemModel";class sk extends s_{static defineChildren(e){return sS(e,{useModel:"DetailsItemModel",fieldUseModel:"JSFieldModel",refreshTargets:["DetailsItemModel"],associationProvider:e=>sh.defineChildren(e)})}}sk.define({label:(0,u.tExpr)("JS field"),searchable:!0,searchPlaceholder:(0,u.tExpr)("Search fields"),sort:110});class sF extends rz.o{}class sC extends rz.o{constructor(...e){super(...e),this.operator="$eq",this.updateAssociation=!0}}sC.registerFlow({key:"AssociationFieldInit",sort:800,steps:{init:{async handler(e,t){if(e.model.updateAssociation){var l,o;let t=e.model.context.blockModel,n=null==t||null==(l=t.context)?void 0:l.resource,i=null==(o=e.model.parent)?void 0:o.fieldPath;n&&i&&n.addUpdateAssociationValues(i)}}},allowCreateCheck:{async handler(e){var t;let l=await e.aclCheck({dataSourceKey:e.collectionField.dataSourceKey,resourceName:null==(t=e.collectionField)?void 0:t.target,actionName:"create"});e.model.setProps({allowCreate:!!l})}}}});let sA=(e,t)=>e===t,sP=e=>{if(e&&"object"==typeof e){let t=e.data;return t&&"object"==typeof t?t:e}};function sT(e){return"string"==typeof e&&e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0}function sj(e,t){var l;let o="string"==typeof(null==t||null==(l=t.titleCollectionField)?void 0:l.name)?t.titleCollectionField.name:void 0,n=sT(null==t?void 0:t.filterTargetKey)||"id",i="string"==typeof(null==e?void 0:e.value)&&e.value&&!sA(e.value,"value")?e.value:void 0,r="string"==typeof(null==e?void 0:e.label)&&e.label&&!sA(e.label,"label")?e.label:void 0,a=i||n;return{label:r||o||a,value:a}}function sI(e){var t,l,o,n,i,r;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!!a.navigation,d=e=>{if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e)},u=d(null==(l=e.view)||null==(t=l.inputArgs)?void 0:t.openerUids),c=d(a.openerUids),p=u||c||[];if(s)return(c||p).filter(Boolean);let m=null==(n=e.view)||null==(o=n.inputArgs)?void 0:o.viewUid,h=null==(r=e.model.context)||null==(i=r.inputArgs)?void 0:i.viewUid;return[...p,"string"==typeof m&&m?m:"string"==typeof h&&h?h:e.model.uid].filter(Boolean)}function sL(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.map(e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}).filter(e=>void 0!==e);return t.length?t.map(String).join(", "):void 0}if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}function sD(e){var t,l,o;let{option:n,fieldNames:i}=e,r=(0,u.useFlowModel)(),a=sP(n),d=sj(i,null==(t=r.context.collectionField)?void 0:t.targetCollection),c=r.subModels.field,p=sL(null==a?void 0:a[d.label])??sL(null==a?void 0:a.label)??sL(null==a?void 0:a[d.value]);if(!c)return(0,s.jsx)("span",{children:p??"N/A"});let m=String((null==a?void 0:a[d.value])??p??"association-option"),h=c.createFork({},m);h.context.defineProperty("record",{get:()=>a,cache:!1,meta:(0,u.createCurrentRecordMetaFactory)(h.context,()=>h.context.collection)});let f=null==(o=r.context.collectionField.targetCollection)||null==(l=o.getField)?void 0:l.call(o,d.label),g=f&&"function"==typeof f.getComponentProps?f.getComponentProps():{};h.setProps({value:p,clickToOpen:!1,...g});let y=null!=p&&""!==p?h.render():"N/A";return(0,s.jsx)("span",{style:{pointerEvents:"none"},children:y})}function sR(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"record",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(!e)return l?[]:void 0;let{value:i}=t||{},r=e=>"object"==typeof e&&null!==e,a=e=>{if(r(e))return{label:(0,s.jsx)(sD,{option:e,fieldNames:t}),value:e[i]}};if("value"===o){let t=e=>{if("object"==typeof e&&null!==e)return a(e);let t=n.find(t=>(null==t?void 0:t[i])===e);return t?a(t):{label:String(e),value:e}};return l?Array.isArray(e)?e.map(e=>t(e)).filter(Boolean):[]:Array.isArray(e)?t(e[0]):t(e)}if(l)return Array.isArray(e)?e.filter(r).map(a).filter(Boolean):[];if(Array.isArray(e)){let t=e[0];return r(t)?a(t):void 0}return r(e)?a(e):void 0}function sY(e,t,l){return(null==e?void 0:e.length)?e.map(e=>(0,c.omit)(e,"disabled","options","style")):l?Array.isArray(t)?t.filter(e=>"object"==typeof e&&null!==e):[]:t&&"object"==typeof t?[t]:[]}let sE=(0,S.css)`
659
659
  div {
660
660
  white-space: nowrap !important;
661
661
  overflow: hidden;