define(["require","exports","tslib","./textUtilities"],function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r=n.__importStar(r),t.text=r;var i=0,o=(new Date).valueOf();function c(e,t){if(null!=e){e=e.index;return"number"==typeof e?e:t}}function m(e,t){return e=e.index,t=t.index,e<t?-1:t<e?1:0}function u(e,t){void 0===t&&(t=c);var n={};if("object"!=typeof e||null===e)return n;var r,i=0,o=[];for(r in e){var u=e[r],a=t(u,i++);"number"==typeof a&&o.push({key:r,index:a,item:u})}for(var s=0,f=o.sort(m);s<f.length;s++){var l=f[s];n[l.key]=l.item}return n}function a(e,t){return e.className.split(" ").filter(function(e){return 0<e.length&&e!==t}).join(" ")}function s(e){return"gcx-forms-"+(e&&e.replace(/[\W]/g,"")||"element")}t.makeId=function(){return 2147483648<=i&&(o=(new Date).valueOf(),i=0),"5DDC9A38-AAAB-44C1-AD87-415160F43D75:"+o+":"+i++},t.sort=u,t.sortItems=function(e){var t=e.current,n=e.value,r=u(e.items,function(e,t){if(null!=e&&!1!==e.visible){e=e.index;return"number"==typeof e?e:t}});if(void 0===(t=null==t||void 0===r[t]?void 0:t)&&null!=n)for(var i in r){if(r[i].value===n)break;t=void 0}return void 0!==t?(e.current=t,e.label=r[t].label,e.value=r[t].value):(e.current=void 0,e.label=void 0,e.value=void 0),r},t.makeSafeClassName=s;var f=0;function l(e,t){void 0!==e.classList?e.classList.add(t):e.className=a(e,t)+" "+t}function d(e,t){void 0!==e.classList?e.classList.remove(t):e.className=a(e,t)}function v(e,t){return"object"==typeof e&&null!==e&&(!Array.isArray(e)&&e.refValueType===t)}function y(e){return v(e,"geometry")}t.makeUniqueId=function(e){return s(e)+"-"+ ++f},t.addClass=l,t.removeClass=d,t.setClass=function(e,t,n){(n?l:d)(e,t)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isDataRef=function(e){return v(e,"data")},t.isDateTimeRef=function(e){return v(e,"date")||v(e,"time")||v(e,"datetime")},t.isFilesRef=function(e){return v(e,"files")},t.isScanRef=function(e){return v(e,"scan")},t.isGeometryRef=y,t.isItemsRef=function(e){return v(e,"items")},t.isNumberRef=function(e){return v(e,"number")},t.sanitizeGeometryRef=function(e){if(y(e)){var t=e.geometry;if(Array.isArray(t)&&0<t.length)switch(e.format){case"point":case"polygon":case"polyline":case"polygon-freehand":case"polyline-freehand":case"extent":case"line":return e}}},t.createGeometryRef=function(e){return{refValueType:"geometry",format:e,geometry:[]}},t.addStyleToDocument=function(e){var t=document.createElement("style");return t.appendChild(document.createTextNode(e)),(e=document.head).insertBefore(t,e.firstChild),t},t.throttle=function(i,o){var u,a;return void 0===o&&(o=100),function(){function e(){a=void 0,u=Date.now(),i.apply(t,n)}var t=this,n=arguments,r=Date.now();u&&r<u+o?(clearTimeout(a),a=setTimeout(e,o)):e()}},t.isNumeric=function(e){return!isNaN(parseFloat(e))&&isFinite(e)}});