12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.24/esri/copyright.txt for details.
- */
- import{p as n,a as t,j as r,i as u,l as e,b as i,M as o,f,g as a,n as c}from"../../chunks/languageUtils.js";import{parse as s}from"../../core/number.js";function l(n,t,r){return void 0===r||0==+r?Math[n](t):(t=+t,r=+r,isNaN(t)||"number"!=typeof r||r%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math[n](+(t[0]+"e"+(t[1]?+t[1]-r:-r)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+r:r))))}function N(N,h){function m(n,t,r){const u=f(n);return isNaN(u)?u:isNaN(t)||isNaN(r)||t>r?NaN:u<t?t:u>r?r:u}N.number=function(f,a){return h(f,a,(function(f,a,c){n(c,1,2);const l=c[0];if(t(l))return l;if(null===l)return 0;if(r(l))return Number(l);if(u(l))return Number(l);if(e(l))return NaN;if(""===l)return Number(l);if(void 0===l)return Number(l);if(i(l)){if(void 0!==c[1]){let n=o(c[1],"‰","");return n=o(n,"¤",""),s(l,{pattern:n})}return Number(l.trim())}return Number(l)}))},N.abs=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.abs(f(u[0]))}))},N.acos=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.acos(f(u[0]))}))},N.asin=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.asin(f(u[0]))}))},N.atan=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.atan(f(u[0]))}))},N.atan2=function(t,r){return h(t,r,(function(t,r,u){return n(u,2,2),Math.atan2(f(u[0]),f(u[1]))}))},N.ceil=function(t,r){return h(t,r,(function(t,r,u){if(n(u,1,2),2===u.length){let n=f(u[1]);return isNaN(n)&&(n=0),l("ceil",f(u[0]),-1*n)}return Math.ceil(f(u[0]))}))},N.round=function(t,r){return h(t,r,(function(t,r,u){if(n(u,1,2),2===u.length){let n=f(u[1]);return isNaN(n)&&(n=0),l("round",f(u[0]),-1*n)}return Math.round(f(u[0]))}))},N.floor=function(t,r){return h(t,r,(function(t,r,u){if(n(u,1,2),2===u.length){let n=f(u[1]);return isNaN(n)&&(n=0),l("floor",f(u[0]),-1*n)}return Math.floor(f(u[0]))}))},N.cos=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.cos(f(u[0]))}))},N.isnan=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),"number"==typeof u[0]&&isNaN(u[0])}))},N.exp=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.exp(f(u[0]))}))},N.log=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.log(f(u[0]))}))},N.pow=function(t,r){return h(t,r,(function(t,r,u){return n(u,2,2),f(u[0])**f(u[1])}))},N.random=function(t,r){return h(t,r,(function(t,r,u){return n(u,0,0),Math.random()}))},N.sin=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.sin(f(u[0]))}))},N.sqrt=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.sqrt(f(u[0]))}))},N.tan=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),Math.tan(f(u[0]))}))},N.defaultvalue=function(t,r){return h(t,r,(function(t,r,u){return n(u,2,2),null===u[0]||""===u[0]||void 0===u[0]?u[1]:u[0]}))},N.isempty=function(t,r){return h(t,r,(function(t,r,u){return n(u,1,1),null===u[0]||(""===u[0]||void 0===u[0])}))},N.boolean=function(t,r){return h(t,r,(function(t,r,u){n(u,1,1);const e=u[0];return a(e)}))},N.constrain=function(t,r){return h(t,r,(function(t,r,u){n(u,3,3);const i=f(u[1]),o=f(u[2]);if(e(u[0])){const n=[];for(const t of u[0])n.push(m(t,i,o));return n}if(c(u[0])){const n=[];for(let t=0;t<u[0].length();t++)n.push(m(u[0].get(t),i,o));return n}return m(u[0],i,o)}))}}export{N as registerFunctions};
|