UNPKG

@p5-wrapper/next

Version:

A NextJS specific library for the @P5-Wrapper/react project.

28 lines (24 loc) 19 kB
(function(I,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],L):(I=typeof globalThis<"u"?globalThis:I||self,L(I.NextReactP5Wrapper={},I.React))})(this,function(I,L){"use strict";function Me(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var Q={exports:{}},V={};V._=V._interop_require_default=Ye;function Ye(p){return p&&p.__esModule?p:{default:p}}var ee={exports:{}},q={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ce;function Ve(){if(ce)return q;ce=1;var p=L,E=Symbol.for("react.element"),w=Symbol.for("react.fragment"),C=Object.prototype.hasOwnProperty,j=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,D={key:!0,ref:!0,__self:!0,__source:!0};function x(P,y,k){var l,v={},g=null,d=null;k!==void 0&&(g=""+k),y.key!==void 0&&(g=""+y.key),y.ref!==void 0&&(d=y.ref);for(l in y)C.call(y,l)&&!D.hasOwnProperty(l)&&(v[l]=y[l]);if(P&&P.defaultProps)for(l in y=P.defaultProps,y)v[l]===void 0&&(v[l]=y[l]);return{$$typeof:E,type:P,key:g,ref:d,props:v,_owner:j.current}}return q.Fragment=w,q.jsx=x,q.jsxs=x,q}var $={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var de;function qe(){return de||(de=1,process.env.NODE_ENV!=="production"&&function(){var p=L,E=Symbol.for("react.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),P=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),s=Symbol.iterator,_="@@iterator";function o(e){if(e===null||typeof e!="object")return null;var r=s&&e[s]||e[_];return typeof r=="function"?r:null}var f=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];U("error",e,t)}}function U(e,r,t){{var n=f.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var c=t.map(function(i){return String(i)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var B=!1,R=!1,N=!1,O=!1,Ke=!1,_e;_e=Symbol.for("react.module.reference");function Xe(e){return!!(typeof e=="string"||typeof e=="function"||e===C||e===D||Ke||e===j||e===k||e===l||O||e===d||B||R||N||typeof e=="object"&&e!==null&&(e.$$typeof===g||e.$$typeof===v||e.$$typeof===x||e.$$typeof===P||e.$$typeof===y||e.$$typeof===_e||e.getModuleId!==void 0))}function Ze(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function he(e){return e.displayName||"Context"}function A(e){if(e==null)return null;if(typeof e.tag=="number"&&h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case w:return"Portal";case D:return"Profiler";case j:return"StrictMode";case k:return"Suspense";case l:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P:var r=e;return he(r)+".Consumer";case x:var t=e;return he(t._context)+".Provider";case y:return Ze(e,e.render,"ForwardRef");case v:var n=e.displayName||null;return n!==null?n:A(e.type)||"Memo";case g:{var u=e,c=u._payload,i=u._init;try{return A(i(c))}catch{return null}}}return null}var W=Object.assign,G=0,me,ye,be,ge,Re,Ee,Te;function we(){}we.__reactDisabledLog=!0;function Qe(){{if(G===0){me=console.log,ye=console.info,be=console.warn,ge=console.error,Re=console.group,Ee=console.groupCollapsed,Te=console.groupEnd;var e={configurable:!0,enumerable:!0,value:we,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}G++}}function er(){{if(G--,G===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:me}),info:W({},e,{value:ye}),warn:W({},e,{value:be}),error:W({},e,{value:ge}),group:W({},e,{value:Re}),groupCollapsed:W({},e,{value:Ee}),groupEnd:W({},e,{value:Te})})}G<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ne=f.ReactCurrentDispatcher,ae;function z(e,r,t){{if(ae===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);ae=n&&n[1]||""}return` `+ae+e}}var oe=!1,H;{var rr=typeof WeakMap=="function"?WeakMap:Map;H=new rr}function Ce(e,r){if(!e||oe)return"";{var t=H.get(e);if(t!==void 0)return t}var n;oe=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=ne.current,ne.current=null,Qe();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(F){n=F}Reflect.construct(e,[],i)}else{try{i.call()}catch(F){n=F}e.call(i.prototype)}}else{try{throw Error()}catch(F){n=F}e()}}catch(F){if(F&&n&&typeof F.stack=="string"){for(var a=F.stack.split(` `),T=n.stack.split(` `),m=a.length-1,b=T.length-1;m>=1&&b>=0&&a[m]!==T[b];)b--;for(;m>=1&&b>=0;m--,b--)if(a[m]!==T[b]){if(m!==1||b!==1)do if(m--,b--,b<0||a[m]!==T[b]){var S=` `+a[m].replace(" at new "," at ");return e.displayName&&S.includes("<anonymous>")&&(S=S.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,S),S}while(m>=1&&b>=0);break}}}finally{oe=!1,ne.current=c,er(),Error.prepareStackTrace=u}var Y=e?e.displayName||e.name:"",We=Y?z(Y):"";return typeof e=="function"&&H.set(e,We),We}function tr(e,r,t){return Ce(e,!1)}function nr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,t){if(e==null)return"";if(typeof e=="function")return Ce(e,nr(e));if(typeof e=="string")return z(e);switch(e){case k:return z("Suspense");case l:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case y:return tr(e.render);case v:return K(e.type,r,t);case g:{var n=e,u=n._payload,c=n._init;try{return K(c(u),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,Pe={},Oe=f.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,t=K(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function ar(e,r,t,n,u){{var c=Function.call.bind(X);for(var i in e)if(c(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var T=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(m){a=m}a&&!(a instanceof Error)&&(Z(u),h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),Z(null)),a instanceof Error&&!(a.message in Pe)&&(Pe[a.message]=!0,Z(u),h("Failed %s type: %s",t,a.message),Z(null))}}}var or=Array.isArray;function ie(e){return or(e)}function ir(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ur(e){try{return Se(e),!1}catch{return!0}}function Se(e){return""+e}function je(e){if(ur(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ir(e)),Se(e)}var J=f.ReactCurrentOwner,lr={key:!0,ref:!0,__self:!0,__source:!0},xe,ke,ue;ue={};function sr(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function fr(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function cr(e,r){if(typeof e.ref=="string"&&J.current&&r&&J.current.stateNode!==r){var t=A(J.current.type);ue[t]||(h('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',A(J.current.type),e.ref),ue[t]=!0)}}function dr(e,r){{var t=function(){xe||(xe=!0,h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function pr(e,r){{var t=function(){ke||(ke=!0,h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var vr=function(e,r,t,n,u,c,i){var a={$$typeof:E,type:e,key:r,ref:t,props:i,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function _r(e,r,t,n,u){{var c,i={},a=null,T=null;t!==void 0&&(je(t),a=""+t),fr(r)&&(je(r.key),a=""+r.key),sr(r)&&(T=r.ref,cr(r,u));for(c in r)X.call(r,c)&&!lr.hasOwnProperty(c)&&(i[c]=r[c]);if(e&&e.defaultProps){var m=e.defaultProps;for(c in m)i[c]===void 0&&(i[c]=m[c])}if(a||T){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&dr(i,b),T&&pr(i,b)}return vr(e,a,T,u,n,J.current,i)}}var le=f.ReactCurrentOwner,De=f.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=K(e.type,e._source,r?r.type:null);De.setExtraStackFrame(t)}else De.setExtraStackFrame(null)}var se;se=!1;function fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===E}function Ae(){{if(le.current){var e=A(le.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function hr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` Check your code at `+r+":"+t+"."}return""}}var Fe={};function mr(e){{var r=Ae();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` Check the top-level render call using <`+t+">.")}return r}}function Le(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=mr(r);if(Fe[t])return;Fe[t]=!0;var n="";e&&e._owner&&e._owner!==le.current&&(n=" It was passed a child from "+A(e._owner.type)+"."),M(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),M(null)}}function Ie(e,r){{if(typeof e!="object")return;if(ie(e))for(var t=0;t<e.length;t++){var n=e[t];fe(n)&&Le(n,r)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var u=o(e);if(typeof u=="function"&&u!==e.entries)for(var c=u.call(e),i;!(i=c.next()).done;)fe(i.value)&&Le(i.value,r)}}}function yr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===y||r.$$typeof===v))t=r.propTypes;else return;if(t){var n=A(r);ar(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!se){se=!0;var u=A(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function br(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){M(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),M(null);break}}e.ref!==null&&(M(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}function Ne(e,r,t,n,u,c){{var i=Xe(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var T=hr(u);T?a+=T:a+=Ae();var m;e===null?m="null":ie(e)?m="array":e!==void 0&&e.$$typeof===E?(m="<"+(A(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):m=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",m,a)}var b=_r(e,r,t,u,c);if(b==null)return b;if(i){var S=r.children;if(S!==void 0)if(n)if(ie(S)){for(var Y=0;Y<S.length;Y++)Ie(S[Y],e);Object.freeze&&Object.freeze(S)}else h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ie(S,e)}return e===C?br(b):yr(b),b}}function gr(e,r,t){return Ne(e,r,t,!0)}function Rr(e,r,t){return Ne(e,r,t,!1)}var Er=Rr,Tr=gr;$.Fragment=C,$.jsx=Er,$.jsxs=Tr}()),$}process.env.NODE_ENV==="production"?ee.exports=Ve():ee.exports=qe();var $e=ee.exports;function Ue(p){throw new Error('Could not dynamically require "'+p+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var re={},te={},pe;function Be(){return pe||(pe=1,function(p){"use client";Object.defineProperty(p,"__esModule",{value:!0}),Object.defineProperty(p,"LoadableContext",{enumerable:!0,get:function(){return C}});const C=V._(L).default.createContext(null);process.env.NODE_ENV!=="production"&&(C.displayName="LoadableContext")}(te)),te}var ve;function Ge(){return ve||(ve=1,function(p){Object.defineProperty(p,"__esModule",{value:!0}),Object.defineProperty(p,"default",{enumerable:!0,get:function(){return d}});const w=V._(L),C=Be();function j(s){return s&&s.default?s.default:s}const D=[],x=[];let P=!1;function y(s){let _=s(),o={loading:!0,loaded:null,error:null};return o.promise=_.then(f=>(o.loading=!1,o.loaded=f,f)).catch(f=>{throw o.loading=!1,o.error=f,f}),o}function k(s,_){let o=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},_),f=null;function h(){if(!f){const R=new l(s,o);f={getCurrentValue:R.getCurrentValue.bind(R),subscribe:R.subscribe.bind(R),retry:R.retry.bind(R),promise:R.promise.bind(R)}}return f.promise()}if(typeof window>"u"&&D.push(h),!P&&typeof window<"u"){const R=o.webpack&&typeof Ue.resolveWeak=="function"?o.webpack():o.modules;R&&x.push(N=>{for(const O of R)if(N.includes(O))return h()})}function U(){h();const R=w.default.useContext(C.LoadableContext);R&&Array.isArray(o.modules)&&o.modules.forEach(N=>{R(N)})}function B(R,N){U();const O=w.default.useSyncExternalStore(f.subscribe,f.getCurrentValue,f.getCurrentValue);return w.default.useImperativeHandle(N,()=>({retry:f.retry}),[]),w.default.useMemo(()=>O.loading||O.error?w.default.createElement(o.loading,{isLoading:O.loading,pastDelay:O.pastDelay,timedOut:O.timedOut,error:O.error,retry:f.retry}):O.loaded?w.default.createElement(j(O.loaded),R):null,[R,O])}return B.preload=()=>h(),B.displayName="LoadableComponent",w.default.forwardRef(B)}class l{promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};const{_res:_,_opts:o}=this;_.loading&&(typeof o.delay=="number"&&(o.delay===0?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},o.delay)),typeof o.timeout=="number"&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},o.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(f=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(_){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,..._},this._callbacks.forEach(o=>o())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(_){return this._callbacks.add(_),()=>{this._callbacks.delete(_)}}constructor(_,o){this._loadFn=_,this._opts=o,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}}function v(s){return k(y,s)}function g(s,_){let o=[];for(;s.length;){let f=s.pop();o.push(f(_))}return Promise.all(o).then(()=>{if(s.length)return g(s,_)})}v.preloadAll=()=>new Promise((s,_)=>{g(D).then(s,_)}),v.preloadReady=s=>(s===void 0&&(s=[]),new Promise(_=>{const o=()=>(P=!0,_());g(x,s).then(o,o)})),typeof window<"u"&&(window.__NEXT_PRELOADREADY=v.preloadReady);const d=v}(re)),re}(function(p,E){Object.defineProperty(E,"__esModule",{value:!0});function w(l,v){for(var g in v)Object.defineProperty(l,g,{enumerable:!0,get:v[g]})}w(E,{noSSR:function(){return y},default:function(){return k}});const C=V,j=$e,D=C._(Ge()),x=typeof window>"u";function P(l){return{default:(l==null?void 0:l.default)||l}}function y(l,v){if(delete v.webpack,delete v.modules,!x)return l(v);const g=v.loading;return()=>(0,j.jsx)(g,{error:null,isLoading:!0,pastDelay:!1,timedOut:!1})}function k(l,v){let g=D.default,d={loading:o=>{let{error:f,isLoading:h,pastDelay:U}=o;if(!U)return null;if(process.env.NODE_ENV!=="production"){if(h)return null;if(f)return(0,j.jsxs)("p",{children:[f.message,(0,j.jsx)("br",{}),f.stack]})}return null}};l instanceof Promise?d.loader=()=>l:typeof l=="function"?d.loader=l:typeof l=="object"&&(d={...d,...l}),d={...d,...v};const s=d.loader,_=()=>s!=null?s().then(P):Promise.resolve(P(()=>null));return d.loadableGenerated&&(d={...d,...d.loadableGenerated},delete d.loadableGenerated),typeof d.ssr=="boolean"&&!d.ssr?(delete d.webpack,delete d.modules,y(g,d)):g({...d,loader:_})}(typeof E.default=="function"||typeof E.default=="object"&&E.default!==null)&&typeof E.default.__esModule>"u"&&(Object.defineProperty(E.default,"__esModule",{value:!0}),Object.assign(E.default,E),p.exports=E.default)})(Q,Q.exports);var Je=Q.exports,ze=Je;const He=Me(ze)(async()=>(await import("@p5-wrapper/react")).ReactP5Wrapper,{ssr:!1});I.NextReactP5Wrapper=He,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});