1import{r as v,a as A}from"./react-DjP1ANNA.js";import{P as s}from"./prop-types-BE-839HU.js";function x(e,r,t){switch(t){case"Backspace":r>0&&(e=e.slice(0,r-1)+e.slice(r),r--);break;case"Delete":e=e.slice(0,r)+e.slice(r+1);break}return{value:e,caret:r}}function k(e,r,t){for(var a={},n="",i=0,u=0;u<e.length;){var o=t(e[u],n,a);o!==void 0&&(n+=o,r!==void 0&&(r===u?i=n.length-1:r>u&&(i=n.length))),u++}r===void 0&&(i=n.length);var f={value:n,caret:i};return f}function I(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=R(e))||r){t&&(e=t);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(e,r){if(e){if(typeof e=="string")return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,r)}}function b(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}function p(e,r){for(var t=0,a=I(r.split("")),n;!(n=a()).done;){var i=n.value;i===e&&t++}return t}function D(e,r){for(var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"x",a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:" ",n=e.length,i=p("(",e),u=p(")",e),o=i-u;o>0&&n<r.length;)e+=r[n].replace(t,a),r[n]===")"&&o--,n++;return e}function j(e,r){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=P(e))||r){t&&(e=t);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P(e,r){if(e){if(typeof e=="string")return m(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(e,r)}}function m(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}function E(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x",t=arguments.length>2?arguments[2]:void 0;if(!e)return function(n){return{text:n}};var a=p(r,e);return function(n){if(!n)return{text:"",template:e};for(var i=0,u="",o=j(e.split("")),f;!(f=o()).done;){var c=f.value;if(c!==r){u+=c;continue}if(u+=n[i],i++,i===n.length&&n.length<a)break}return t&&(u=D(u,e)),{text:u,template:e}}}function T(e,r,t){typeof t=="string"&&(t=E(t));var a=t(e)||{},n=a.text,i=a.template;if(n===void 0&&(n=e),i)if(r===void 0)r=n.length;else{for(var u=0,o=!1,f=-1;u<n.length&&u<i.length;){if(n[u]!==i[u]){if(r===0){o=!0,r=u;break}f=u,r--}u++}o||(r=f+1)}return{text:n,caret:r}}function _(e){return e.hasAttribute("readonly")}function K(e){if(e.selectionStart!==e.selectionEnd)return{start:e.selectionStart,end:e.selectionEnd}}var w={Backspace:8,Delete:46};function $(e){switch(e.keyCode){case w.Backspace:return"Backspace";case w.Delete:return"Delete"}}function B(e){return e.selectionStart}function C(e,r){r!==void 0&&(q()?setTimeout(function(){return e.setSelectionRange(r,r)},0):e.setSelectionRange(r,r))}function q(){if(typeof navigator<"u")return L.test(navigator.userAgent)}var L=/Android/i;function U(e,r,t,a,n){y(r,t,a,void 0,n)}function F(e,r,t,a,n){if(!_(r)){var i=$(e);switch(i){case"Delete":case"Backspace":e.preventDefault();var u=K(r);return u?(G(r,u),y(r,t,a,void 0,n)):y(r,t,a,i,n)}}}function G(e,r){var t=e.value;t=t.slice(0,r.start)+t.slice(r.end),e.value=t,C(e,r.start)}function y(e,r,t,a,n){var i=k(e.value,B(e),r),u=i.value,o=i.caret;if(a){var f=x(u,o,a);u=f.value,o=f.caret}var c=T(u,o,t),g=c.text;o=c.caret,e.value=g,C(e,o),n(u)}var H=["value","parse","format","inputComponent","onChange","onKeyDown"];function h(){return h=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},h.apply(this,arguments)}function M(e,r){if(e==null)return{};var t=N(e,r),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(r.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}function N(e,r){if(e==null)return{};var t={},a=Object.keys(e),n,i;for(i=0;i<a.length;i++)n=a[i],!(r.indexOf(n)>=0)&&(t[n]=e[n]);return t}function d(e,r){var t=e.value,a=e.parse,n=e.format,i=e.inputComponent,u=e.onChange,o=e.onKeyDown,f=M(e,H),c=v.useRef(),g=v.useCallback(function(l){c.current=l,r&&(typeof r=="function"?r(l):r.current=l)},[r]),O=v.useCallback(function(l){return U(l,c.current,a,n,u)},[c,a,n,u]),S=v.useCallback(function(l){if(o&&o(l),!l.defaultPrevented)return F(l,c.current,a,n,u)},[c,a,n,u,o]);return A.createElement(i,h({},f,{ref:g,value:n(W(t)?"":t).text,onKeyDown:S,onChange:O}))}d=A.forwardRef(d);d.propTypes={parse:s.func.isRequired,format:s.func.isRequired,inputComponent:s.elementType.isRequired,type:s.string.isRequired,value:s.string,onChange:s.func.isRequired,onKeyDown:s.func,onCut:s.func,onPaste:s.func};d.defaultProps={inputComponent:"input",type:"text"};function W(e){return e==null}export{d as I};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.