import{a as e,t}from"./chunk-BNv3lrIs.js";import{n}from"./jsx-runtime-pmtNMKr4.js";import{t as r}from"./extends-MSosE5QM.js";import{n as i}from"./setPrototypeOf-Cn_CdjzQ.js";import{c as a}from"./querySelectorAll-PdiS4z27.js";var o=t(((e,t)=>{t.exports=function(e,t,n,r,i,a,o,s){if(!e){var c;if(t===void 0)c=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var l=[n,r,i,a,o,s],u=0;c=Error(t.replace(/%s/g,function(){return l[u++]})),c.name=`Invariant Violation`}throw c.framesToPop=1,c}}})),s=e(n()),c=e(o()),l=function(){};function u(e,t){var n={};return Object.keys(e).forEach(function(e){n[f(e)]=l}),n}function d(e,t){return e[t]!==void 0}function f(e){return`default`+e.charAt(0).toUpperCase()+e.substr(1)}function p(e){return!!e&&(typeof e!=`function`||e.prototype&&e.prototype.isReactComponent)}function m(e){var t=h(e,`string`);return typeof t==`symbol`?t:String(t)}function h(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function g(e,t,n){var r=(0,s.useRef)(e!==void 0),i=(0,s.useState)(t),a=i[0],o=i[1],c=e!==void 0,l=r.current;return r.current=c,!c&&l&&a!==t&&o(t),[c?e:a,(0,s.useCallback)(function(e){var t=[...arguments].slice(1);n&&n.apply(void 0,[e].concat(t)),o(e)},[n])]}function _(e,t){return Object.keys(t).reduce(function(n,a){var o,s=n,c=s[f(a)],l=s[a],u=i(s,[f(a),a].map(m)),d=t[a],p=g(l,c,e[d]),h=p[0],_=p[1];return r({},u,(o={},o[a]=h,o[d]=_,o))},e)}function v(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function y(e){function t(t){return this.constructor.getDerivedStateFromProps(e,t)??null}this.setState(t.bind(this))}function b(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}v.__suppressDeprecationWarning=!0,y.__suppressDeprecationWarning=!0,b.__suppressDeprecationWarning=!0;function x(e){var t=e.prototype;if(!t||!t.isReactComponent)throw Error(`Can only polyfill class components`);if(typeof e.getDerivedStateFromProps!=`function`&&typeof t.getSnapshotBeforeUpdate!=`function`)return e;var n=null,r=null,i=null;if(typeof t.componentWillMount==`function`?n=`componentWillMount`:typeof t.UNSAFE_componentWillMount==`function`&&(n=`UNSAFE_componentWillMount`),typeof t.componentWillReceiveProps==`function`?r=`componentWillReceiveProps`:typeof t.UNSAFE_componentWillReceiveProps==`function`&&(r=`UNSAFE_componentWillReceiveProps`),typeof t.componentWillUpdate==`function`?i=`componentWillUpdate`:typeof t.UNSAFE_componentWillUpdate==`function`&&(i=`UNSAFE_componentWillUpdate`),n!==null||r!==null||i!==null){var a=e.displayName||e.name,o=typeof e.getDerivedStateFromProps==`function`?`getDerivedStateFromProps()`:`getSnapshotBeforeUpdate()`;throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.

`+a+` uses `+o+` but also contains the following legacy lifecycles:`+(n===null?``:`
  `+n)+(r===null?``:`
  `+r)+(i===null?``:`
  `+i)+`

The above lifecycles should be removed. Learn more about this warning here:
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps==`function`&&(t.componentWillMount=v,t.componentWillReceiveProps=y),typeof t.getSnapshotBeforeUpdate==`function`){if(typeof t.componentDidUpdate!=`function`)throw Error(`Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype`);t.componentWillUpdate=b;var s=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;s.call(this,e,t,r)}}return e}var S=`/Users/jquense/src/uncontrollable/src/uncontrollable.js`;function C(e,t,n){n===void 0&&(n=[]);var o=e.displayName||e.name||`Component`,l=p(e),m=Object.keys(t),h=m.map(f);!(l||!n.length)&&(0,c.default)(!1);var g=function(o){a(c,o);function c(){var e,i=[...arguments];e=o.call.apply(o,[this].concat(i))||this,e.handlers=Object.create(null),m.forEach(function(n){var i=t[n],a=function(t){if(e.props[i]){var a;e._notifying=!0;var o=[...arguments].slice(1);(a=e.props)[i].apply(a,[t].concat(o)),e._notifying=!1}e.unmounted||e.setState(function(e){var i,a=e.values;return{values:r(Object.create(null),a,(i={},i[n]=t,i))}})};e.handlers[i]=a}),n.length&&(e.attachRef=function(t){e.inner=t});var a=Object.create(null);return m.forEach(function(t){a[t]=e.props[f(t)]}),e.state={values:a,prevProps:{}},e}var l=c.prototype;return l.shouldComponentUpdate=function(){return!this._notifying},c.getDerivedStateFromProps=function(e,t){var n=t.values,i=t.prevProps,a={values:r(Object.create(null),n),prevProps:{}};return m.forEach(function(t){a.prevProps[t]=e[t],!d(e,t)&&d(i,t)&&(a.values[t]=e[f(t)])}),a},l.componentWillUnmount=function(){this.unmounted=!0},l.render=function(){var t=this,n=this.props,a=n.innerRef,o=i(n,[`innerRef`]);h.forEach(function(e){delete o[e]});var c={};return m.forEach(function(e){var n=t.props[e];c[e]=n===void 0?t.state.values[e]:n}),s.createElement(e,r({},o,c,this.handlers,{ref:a||this.attachRef}))},c}(s.Component);x(g),g.displayName=`Uncontrolled(`+o+`)`,g.propTypes=r({innerRef:function(){}},u(t,o)),n.forEach(function(e){g.prototype[e]=function(){var t;return(t=this.inner)[e].apply(t,arguments)}});var _=g;return s.forwardRef&&(_=s.forwardRef(function(e,t){return s.createElement(g,r({},e,{innerRef:t,__source:{fileName:S,lineNumber:128},__self:this}))}),_.propTypes=g.propTypes),_.ControlledComponent=e,_.deferControlTo=function(e,n,i){return n===void 0&&(n={}),C(e,r({},t,n),i)},_}export{_ as n,o as r,C as t};