import{__decorate}from"tslib";import{validation}from"../../Validation.js";import{MapProvider}from"./MapProvider.js";import{activate}from"../../Hooks.js";import{inline}from"./tools.js";let SetLayerDefinitionExpression=class{execute(i,e,n){const o=validation.string("expression",i.expression,validation.never);validation.id("layerId",i.layerId,validation.never);const r=validation.id("sublayerId",i.sublayerId,void 0),t=n.create();return inline(t.load(),function(){const e=t.findLayer(i.layerId);return void 0!==e&&null!==e?inline(e.load(),function(){if(void 0===r)return{oldExpression:e.getDefinitionExpression(),newExpression:e.setDefinitionExpression(o)?o:void 0};const i=t.findLayer(r,e.layer);return void 0===i||null===i?{}:{oldExpression:i.getDefinitionExpression(),newExpression:i.setDefinitionExpression(o)?o:void 0}}):{}})}};SetLayerDefinitionExpression.action="gcx:wf:arcgis::SetLayerDefinitionExpression",SetLayerDefinitionExpression.suite="gcx:wf:builtin",SetLayerDefinitionExpression=__decorate([activate(MapProvider)],SetLayerDefinitionExpression);export{SetLayerDefinitionExpression};