Outlook_Addin_LLM/node_modules/@fluentui/react-hooks/dist/react-hooks.min.js

1 line
14 KiB
JavaScript

var FluentUIReactHooks;!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useAsync:function(){return l},useBoolean:function(){return d},useConst:function(){return f},useConstCallback:function(){return h},useControllableValue:function(){return m},useEventCallback:function(){return _},useForceUpdate:function(){return p},useId:function(){return F},useIsomorphicLayoutEffect:function(){return v},useMergedRefs:function(){return A},useMount:function(){return D},useMountSync:function(){return O},useOnEvent:function(){return j},usePrevious:function(){return P},useRefEffect:function(){return x},useSetInterval:function(){return M},useSetTimeout:function(){return q},useTarget:function(){return K},useUnmount:function(){return U},useWarnings:function(){return W}});var n={},r=void 0;try{r=window}catch(e){}function i(e,t){if(void 0!==r){var i=r.__packages__=r.__packages__||{};i[e]&&n[e]||(n[e]=t,(i[e]=i[e]||[]).push(t))}}function o(){return"undefined"!=typeof window&&!(!window.document||!window.document.createElement)}i("@fluentui/set-version","6.0.0"),i("@fluentui/react-hooks","8.8.16");var u=void 0;try{u=window}catch(e){}function s(e){if(o()&&void 0!==u){var t=e;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:u}}var a=function(){function e(e,t){this._timeoutIds=null,this._immediateIds=null,this._intervalIds=null,this._animationFrameIds=null,this._isDisposed=!1,this._parent=e||null,this._onErrorHandler=t,this._noop=function(){}}return e.prototype.dispose=function(){var e;if(this._isDisposed=!0,this._parent=null,this._timeoutIds){for(e in this._timeoutIds)this._timeoutIds.hasOwnProperty(e)&&this.clearTimeout(parseInt(e,10));this._timeoutIds=null}if(this._immediateIds){for(e in this._immediateIds)this._immediateIds.hasOwnProperty(e)&&this.clearImmediate(parseInt(e,10));this._immediateIds=null}if(this._intervalIds){for(e in this._intervalIds)this._intervalIds.hasOwnProperty(e)&&this.clearInterval(parseInt(e,10));this._intervalIds=null}if(this._animationFrameIds){for(e in this._animationFrameIds)this._animationFrameIds.hasOwnProperty(e)&&this.cancelAnimationFrame(parseInt(e,10));this._animationFrameIds=null}},e.prototype.setTimeout=function(e,t){var n=this,r=0;return this._isDisposed||(this._timeoutIds||(this._timeoutIds={}),r=setTimeout((function(){try{n._timeoutIds&&delete n._timeoutIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._timeoutIds[r]=!0),r},e.prototype.clearTimeout=function(e){this._timeoutIds&&this._timeoutIds[e]&&(clearTimeout(e),delete this._timeoutIds[e])},e.prototype.setImmediate=function(e,t){var n=this,r=0,i=s(t);return this._isDisposed||(this._immediateIds||(this._immediateIds={}),r=i.setTimeout((function(){try{n._immediateIds&&delete n._immediateIds[r],e.apply(n._parent)}catch(e){n._logError(e)}}),0),this._immediateIds[r]=!0),r},e.prototype.clearImmediate=function(e,t){var n=s(t);this._immediateIds&&this._immediateIds[e]&&(n.clearTimeout(e),delete this._immediateIds[e])},e.prototype.setInterval=function(e,t){var n=this,r=0;return this._isDisposed||(this._intervalIds||(this._intervalIds={}),r=setInterval((function(){try{e.apply(n._parent)}catch(e){n._logError(e)}}),t),this._intervalIds[r]=!0),r},e.prototype.clearInterval=function(e){this._intervalIds&&this._intervalIds[e]&&(clearInterval(e),delete this._intervalIds[e])},e.prototype.throttle=function(e,t,n){var r=this;if(this._isDisposed)return this._noop;var i,o,u=t||0,s=!0,a=!0,c=0,l=null;n&&"boolean"==typeof n.leading&&(s=n.leading),n&&"boolean"==typeof n.trailing&&(a=n.trailing);var f=function(t){var n=Date.now(),d=n-c,h=s?u-d:u;return d>=u&&(!t||s)?(c=n,l&&(r.clearTimeout(l),l=null),i=e.apply(r._parent,o)):null===l&&a&&(l=r.setTimeout(f,h)),i};return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o=e,f(!0)}},e.prototype.debounce=function(e,t,n){var r=this;if(this._isDisposed){var i=function(){};return i.cancel=function(){},i.flush=function(){return null},i.pending=function(){return!1},i}var o,u,s=t||0,a=!1,c=!0,l=null,f=0,d=Date.now(),h=null;n&&"boolean"==typeof n.leading&&(a=n.leading),n&&"boolean"==typeof n.trailing&&(c=n.trailing),n&&"number"==typeof n.maxWait&&!isNaN(n.maxWait)&&(l=n.maxWait);var m=function(e){h&&(r.clearTimeout(h),h=null),d=e},v=function(t){m(t),o=e.apply(r._parent,u)},_=function(e){var t=Date.now(),n=!1;e&&(a&&t-f>=s&&(n=!0),f=t);var i=t-f,u=s-i,m=t-d,p=!1;return null!==l&&(m>=l&&h?p=!0:u=Math.min(u,l-m)),i>=s||p||n?v(t):null!==h&&e||!c||(h=r.setTimeout(_,u)),o},p=function(){return!!h},y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u=e,_(!0)};return y.cancel=function(){p()&&m(Date.now())},y.flush=function(){return p()&&v(Date.now()),o},y.pending=p,y},e.prototype.requestAnimationFrame=function(e,t){var n=this,r=0,i=s(t);if(!this._isDisposed){this._animationFrameIds||(this._animationFrameIds={});var o=function(){try{n._animationFrameIds&&delete n._animationFrameIds[r],e.apply(n._parent)}catch(e){n._logError(e)}};r=i.requestAnimationFrame?i.requestAnimationFrame(o):i.setTimeout(o,0),this._animationFrameIds[r]=!0}return r},e.prototype.cancelAnimationFrame=function(e,t){var n=s(t);this._animationFrameIds&&this._animationFrameIds[e]&&(n.cancelAnimationFrame?n.cancelAnimationFrame(e):n.clearTimeout(e),delete this._animationFrameIds[e])},e.prototype._logError=function(e){this._onErrorHandler&&this._onErrorHandler(e)},e}(),c=React;function l(){var e=c.useRef();return e.current||(e.current=new a),c.useEffect((function(){return function(){var t;null===(t=e.current)||void 0===t||t.dispose(),e.current=void 0}}),[]),e.current}function f(e){var t=c.useRef();return void 0===t.current&&(t.current={value:"function"==typeof e?e():e}),t.current.value}function d(e){var t=c.useState(e),n=t[0],r=t[1];return[n,{setTrue:f((function(){return function(){r(!0)}})),setFalse:f((function(){return function(){r(!1)}})),toggle:f((function(){return function(){r((function(e){return!e}))}}))}]}function h(e){var t=c.useRef();return t.current||(t.current=e),t.current}function m(e,t,n){var r=c.useState(t),i=r[0],o=r[1],u=f(void 0!==e),s=u?e:i,a=c.useRef(s),l=c.useRef(n);c.useEffect((function(){a.current=s,l.current=n}));var d=f((function(){return function(e,t){var n="function"==typeof e?e(a.current):e;l.current&&l.current(t,n),u||o(n)}}));return[s,d]}var v=o()?c.useLayoutEffect:c.useEffect;function _(e){var t=c.useRef((function(){throw new Error("Cannot call an event handler while rendering")}));return v((function(){t.current=e}),[e]),f((function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.current.apply(void 0,e)}}))}function p(){var e=c.useState(0)[1];return f((function(){return function(){return e((function(e){return++e}))}}))}var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},y.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var g,I="__shadow_dom_stylesheet__",R="__stylesheet__",w="undefined"!=typeof navigator&&/rv:11.0/.test(navigator.userAgent),E={};try{E=window||{}}catch(e){}var T=function(){function e(e,t){var n,r,i,o,u,s;this._rules=[],this._preservedRules=[],this._counter=0,this._keyToClassName={},this._onInsertRuleCallbacks=[],this._onResetCallbacks=[],this._classNameToArgs={},this._config=y({injectionMode:"undefined"==typeof document?0:1,defaultPrefix:"css",namespace:void 0,cspSettings:void 0},e),this._classNameToArgs=null!==(n=null==t?void 0:t.classNameToArgs)&&void 0!==n?n:this._classNameToArgs,this._counter=null!==(r=null==t?void 0:t.counter)&&void 0!==r?r:this._counter,this._keyToClassName=null!==(o=null!==(i=this._config.classNameCache)&&void 0!==i?i:null==t?void 0:t.keyToClassName)&&void 0!==o?o:this._keyToClassName,this._preservedRules=null!==(u=null==t?void 0:t.preservedRules)&&void 0!==u?u:this._preservedRules,this._rules=null!==(s=null==t?void 0:t.rules)&&void 0!==s?s:this._rules}return e.getInstance=function(t){if(g=E[R],E[I])return E[I].getInstance(t);if(!g||g._lastStyleElement&&g._lastStyleElement.ownerDocument!==document){var n=(null==E?void 0:E.FabricConfig)||{},r=new e(n.mergeStyles,n.serializedStylesheet);g=r,E[R]=r}return g},e.prototype.serialize=function(){return JSON.stringify({classNameToArgs:this._classNameToArgs,counter:this._counter,keyToClassName:this._keyToClassName,preservedRules:this._preservedRules,rules:this._rules})},e.prototype.setConfig=function(e){this._config=y(y({},this._config),e)},e.prototype.onReset=function(e){var t=this;return this._onResetCallbacks.push(e),function(){t._onResetCallbacks=t._onResetCallbacks.filter((function(t){return t!==e}))}},e.prototype.onInsertRule=function(e){var t=this;return this._onInsertRuleCallbacks.push(e),function(){t._onInsertRuleCallbacks=t._onInsertRuleCallbacks.filter((function(t){return t!==e}))}},e.prototype.getClassName=function(e){var t=this._config.namespace,n=e||this._config.defaultPrefix;return"".concat(t?t+"-":"").concat(n,"-").concat(this._counter++)},e.prototype.cacheClassName=function(e,t,n,r){this._keyToClassName[this._getCacheKey(t)]=e,this._classNameToArgs[e]={args:n,rules:r}},e.prototype.classNameFromKey=function(e){return this._keyToClassName[this._getCacheKey(e)]},e.prototype.getClassNameCache=function(){return this._keyToClassName},e.prototype.argsFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.args},e.prototype.insertedRulesFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.rules},e.prototype.insertRule=function(e,t,n){void 0===n&&(n="__global__");var r=this._config.injectionMode,i=0!==r?this._getStyleElement():void 0;if(t&&this._preservedRules.push(e),i)switch(r){case 1:this._insertRuleIntoSheet(i.sheet,e);break;case 2:i.appendChild(document.createTextNode(e))}else this._rules.push(e);this._config.onInsertRule&&this._config.onInsertRule(e),this._onInsertRuleCallbacks.forEach((function(t){return t({key:n,sheet:i?i.sheet:void 0,rule:e})}))},e.prototype.getRules=function(e){return(e?this._preservedRules.join(""):"")+this._rules.join("")},e.prototype.reset=function(){this._rules=[],this._counter=0,this._classNameToArgs={},this._keyToClassName={},this._onResetCallbacks.forEach((function(e){return e()}))},e.prototype.resetKeys=function(){this._keyToClassName={}},e.prototype._createStyleElement=function(){var e,t=(null===(e=this._config.window)||void 0===e?void 0:e.document)||document,n=t.head,r=t.createElement("style"),i=null;r.setAttribute("data-merge-styles","true");var o=this._config.cspSettings;if(o&&o.nonce&&r.setAttribute("nonce",o.nonce),this._lastStyleElement)i=this._lastStyleElement.nextElementSibling;else{var u=this._findPlaceholderStyleTag();i=u?u.nextElementSibling:n.childNodes[0]}return n.insertBefore(r,n.contains(i)?i:null),this._lastStyleElement=r,r},e.prototype._insertRuleIntoSheet=function(e,t){if(!e)return!1;try{return e.insertRule(t,e.cssRules.length),!0}catch(e){}return!1},e.prototype._getCacheKey=function(e){return e},e.prototype._getStyleElement=function(){var e=this;return this._styleElement||(this._styleElement=this._createStyleElement(),w||(this._config.window||window).requestAnimationFrame((function(){e._styleElement=void 0}))),this._styleElement},e.prototype._findPlaceholderStyleTag=function(){var e=document.head;return e?e.querySelector("style[data-merge-styles]"):null},e}(),b="__currentId__",C="id__",k=s()||{};void 0===k[b]&&(k[b]=0);var S=!1;function N(e){void 0===e&&(e=0),k[b]=e}function F(e,t){var n=c.useRef(t);return n.current||(n.current=function(e){if(!S){var t=T.getInstance();t&&t.onReset&&t.onReset(N),S=!0}var n=k[b]++;return(void 0===e?C:e)+n}(e)),n.current}function A(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=c.useCallback((function(t){n.current=t;for(var r=0,i=e;r<i.length;r++){var o=i[r];"function"==typeof o?o(t):o&&(o.current=t)}}),function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0));return n}var D=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])},O=function(e){var t=c.useRef(e);t.current=e,c.useLayoutEffect((function(){var e;null===(e=t.current)||void 0===e||e.call(t)}),[])};function j(e,t,n,r){var i=c.useRef(n);i.current=n,c.useEffect((function(){var n=e&&"current"in e?e.current:e;if(n&&n.addEventListener){var o=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(n,t,(function(e){return i.current(e)}),r);return o}}),[e,t,r])}function P(e){var t=(0,c.useRef)();return(0,c.useEffect)((function(){t.current=e})),t.current}function x(e,t){void 0===t&&(t=null);var n,r=c.useRef({ref:(n=function(e){r.ref.current!==e&&(r.cleanup&&(r.cleanup(),r.cleanup=void 0),r.ref.current=e,null!==e&&(r.cleanup=r.callback(e)))},n.current=t,n),callback:e}).current;return r.callback=e,r.ref}var M=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearInterval(r)}}}),[e]),f({setInterval:function(t,n){var r=setInterval(t,n);return e[r]=1,r},clearInterval:function(t){delete e[t],clearInterval(t)}})},q=function(){var e=f({});return c.useEffect((function(){return function(){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];clearTimeout(r)}}}),[e]),f({setTimeout:function(t,n){var r=setTimeout(t,n);return e[r]=1,r},clearTimeout:function(t){delete e[t],clearTimeout(t)}})},L=c.createContext({window:"object"==typeof window?window:void 0}),H=function(){return c.useContext(L).window};function K(e,t){var n,r,i,u=c.useRef(),s=c.useRef(null),a=H();if(!e||e!==u.current||"string"==typeof e){var l=null==t?void 0:t.current;if(e)if("string"==typeof e)if(null===(n=null==l?void 0:l.getRootNode())||void 0===n?void 0:n.host)s.current=null!==(i=null===(r=null==l?void 0:l.getRootNode())||void 0===r?void 0:r.querySelector(e))&&void 0!==i?i:null;else{var f=function(e){if(o()&&"undefined"!=typeof document){var t=e;return t&&t.ownerDocument?t.ownerDocument:document}}(l);s.current=f?f.querySelector(e):null}else s.current="stopPropagation"in e||"getBoundingClientRect"in e?e:"current"in e?e.current:e;u.current=e}return[s,a]}var U=function(e){var t=c.useRef(e);t.current=e,c.useEffect((function(){return function(){var e;null===(e=t.current)||void 0===e||e.call(t)}}),[])};function W(e){}FluentUIReactHooks=t}();