import{ActivityInputError}from"./Errors.js";var validation;!function(i){function l(r,n){throw new ActivityInputError(r,n)}i.never={},i.fail=l,i.array=function(r,n,e){return null==n?(e===i.never&&l(r,"array"),2<arguments.length?e:void 0):n instanceof Array?n:[n]},i.exists=function(r,n,e){return null!=n?n:2<arguments.length?e:void l(r,"exists")},i.id=function(r,n,e){return null==n?(e===i.never&&l(r,"id"),2<arguments.length?e:void 0):"string"==typeof n||"number"==typeof n&&0*n==0?n:2<arguments.length?(e===i.never&&l(r,"id"),e):void l(r,"number")},i.number=function(r,n,e){if(null==n)return e===i.never&&l(r,"number"),2<arguments.length?e:void 0;var t=n.valueOf();if("number"==typeof t)return t;if("boolean"==typeof t)return t?1:0;if("string"==typeof t){t=parseFloat(n);if(!isNaN(t))return t}if(2<arguments.length)return e===i.never&&l(r,"number"),e;l(r,"number")},i.choice=function(r,n,e){if(null!=e){e=n[e.toString()];if(null==e)return e;l(r,"choice")}},i.boolean=function(r,n,e){return null==n?(e===i.never&&l(r,"boolean"),2<arguments.length?e:void 0):"boolean"==typeof n?n:2<arguments.length?(e===i.never&&l(r,"boolean"),e):void l(r,"boolean")},i.string=function(r,n,e){return null==n?(e===i.never&&l(r,"string"),2<arguments.length?e:void 0):"string"==typeof n?n:2<arguments.length?(e===i.never&&l(r,"string"),e):void l(r,"string")},i.urlOrLayer=function(n,e){if(null!=n){let r=n.url;n=n.layer;if(!r&&n&&n.url&&(r=!e&&void 0!==n.layerId&&null!==n.layerId?`${n.url}/${n.layerId}`:n.url),r)return r}l("url or layer","url or layer input is required. layer must have a valid url property.")}}(validation=validation||{});export{validation};