UNPKG

pspdfkit

Version:

View and annotate PDF files in your web app. Full support for mobile and desktop. Runs in the browser using WASM.

13 lines 5.09 MB
/*! * PSPDFKit for Web 2024.8.2 (https://pspdfkit.com/web) * * Copyright (c) 2016-2025 PSPDFKit GmbH. All rights reserved. * * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT. * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. * This notice may not be removed from this file. * * PSPDFKit uses several open source third-party components: https://pspdfkit.com/acknowledgements/web/ */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PSPDFKit=t():e.PSPDFKit=t()}(globalThis,(()=>(()=>{var e,t,n,r,o={10934:(e,t,n)=>{"use strict";function r(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}n.d(t,{A:()=>r})},44268:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(10934);function o(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,(0,r.A)(e,t,"get"))}},13649:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(10934);function o(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,(0,r.A)(e,t,"set"),n),n}},67136:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(10527);function o(e,t,n){return(t=(0,r.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},84474:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(60875);function o(e,t){if("object"!==(0,r.A)(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==(0,r.A)(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}},10527:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(60875),o=n(84474);function i(e){var t=(0,o.A)(e,"string");return"symbol"===(0,r.A)(t)?t:String(t)}},60875:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{A:()=>r})},84010:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Comment:()=>Ir,Devtools:()=>Er,SignatureTextInput:()=>lr,Stamp:()=>kr,TaggedPagination:()=>jr});var r=n(13158),o=n(96540),i=n(40027),a=n(65221),s=n(74848);function l(e,t=-1/0,n=1/0){return Math.min(Math.max(e,t),n)}var c=E(),u=e=>x(e,c),d=E();u.write=e=>x(e,d);var p=E();u.onStart=e=>x(e,p);var h=E();u.onFrame=e=>x(e,h);var f=E();u.onFinish=e=>x(e,f);var m=[];u.setTimeout=(e,t)=>{const n=u.now()+t,r=()=>{const e=m.findIndex((e=>e.cancel==r));~e&&m.splice(e,1),b-=~e?1:0},o={time:n,handler:e,cancel:r};return m.splice(g(n),0,o),b+=1,S(),o};var g=e=>~(~m.findIndex((t=>t.time>e))||~m.length);u.cancel=e=>{p.delete(e),h.delete(e),f.delete(e),c.delete(e),d.delete(e)},u.sync=e=>{w=!0,u.batchedUpdates(e),w=!1},u.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function r(...e){t=e,u.onStart(n)}return r.handler=e,r.cancel=()=>{p.delete(n),t=null},r};var v="undefined"!=typeof window?window.requestAnimationFrame:()=>{};u.use=e=>v=e,u.now="undefined"!=typeof performance?()=>performance.now():Date.now,u.batchedUpdates=e=>e(),u.catch=console.error,u.frameLoop="always",u.advance=()=>{"demand"!==u.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):C()};var y=-1,b=0,w=!1;function x(e,t){w?(t.delete(e),e(0)):(t.add(e),S())}function S(){y<0&&(y=0,"demand"!==u.frameLoop&&v(_))}function _(){~y&&(v(_),u.batchedUpdates(C))}function C(){const e=y;y=u.now();const t=g(y);t&&(k(m.splice(0,t),(e=>e.handler())),b-=t),b?(p.flush(),c.flush(e?Math.min(64,y-e):16.667),h.flush(),d.flush(),f.flush()):y=-1}function E(){let e=new Set,t=e;return{add(n){b+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(b-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,b-=t.size,k(t,(t=>t(n)&&e.add(t))),b+=e.size,t=e)}}}function k(e,t){e.forEach((e=>{try{t(e)}catch(e){u.catch(e)}}))}var z=Object.defineProperty,P={};function A(){}((e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})})(P,{assign:()=>$,colors:()=>L,createStringInterpolator:()=>j,skipAnimation:()=>V,to:()=>R,willAdvance:()=>K});var D={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function T(e,t){if(D.arr(e)){if(!D.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var I=(e,t)=>e.forEach(t);function M(e,t,n){if(D.arr(e))for(let r=0;r<e.length;r++)t.call(n,e[r],`${r}`);else for(const r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r)}var N=e=>D.und(e)?[]:D.arr(e)?e:[e];function O(e,t){if(e.size){const n=Array.from(e);e.clear(),I(n,t)}}var j,R,F=(e,...t)=>O(e,(e=>e(...t))),B=()=>"undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),L=null,V=!1,K=A,$=e=>{e.to&&(R=e.to),e.now&&(u.now=e.now),void 0!==e.colors&&(L=e.colors),null!=e.skipAnimation&&(V=e.skipAnimation),e.createStringInterpolator&&(j=e.createStringInterpolator),e.requestAnimationFrame&&u.use(e.requestAnimationFrame),e.batchedUpdates&&(u.batchedUpdates=e.batchedUpdates),e.willAdvance&&(K=e.willAdvance),e.frameLoop&&(u.frameLoop=e.frameLoop)},H=new Set,U=[],q=[],W=0,G={get idle(){return!H.size&&!U.length},start(e){W>e.priority?(H.add(e),u.onStart(Y)):(Z(e),u(X))},advance:X,sort(e){if(W)u.onFrame((()=>G.sort(e)));else{const t=U.indexOf(e);~t&&(U.splice(t,1),J(e))}},clear(){U=[],H.clear()}};function Y(){H.forEach(Z),H.clear(),u(X)}function Z(e){U.includes(e)||J(e)}function J(e){U.splice(function(e,t){const n=e.findIndex(t);return n<0?e.length:n}(U,(t=>t.priority>e.priority)),0,e)}function X(e){const t=q;for(let n=0;n<U.length;n++){const r=U[n];W=r.priority,r.idle||(K(r),r.advance(e),r.idle||t.push(r))}return W=0,(q=U).length=0,(U=t).length>0}var Q="[-+]?\\d*\\.?\\d+",ee=Q+"%";function te(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var ne=new RegExp("rgb"+te(Q,Q,Q)),re=new RegExp("rgba"+te(Q,Q,Q,Q)),oe=new RegExp("hsl"+te(Q,ee,ee)),ie=new RegExp("hsla"+te(Q,ee,ee,Q)),ae=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,ce=/^#([0-9a-fA-F]{8})$/;function ue(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function de(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=ue(o,r,e+1/3),a=ue(o,r,e),s=ue(o,r,e-1/3);return Math.round(255*i)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}function pe(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function he(e){return(parseFloat(e)%360+360)%360/360}function fe(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function me(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function ge(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:L&&void 0!==L[e]?L[e]:(t=ne.exec(e))?(pe(t[1])<<24|pe(t[2])<<16|pe(t[3])<<8|255)>>>0:(t=re.exec(e))?(pe(t[1])<<24|pe(t[2])<<16|pe(t[3])<<8|fe(t[4]))>>>0:(t=ae.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=ce.exec(e))?parseInt(t[1],16)>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=oe.exec(e))?(255|de(he(t[1]),me(t[2]),me(t[3])))>>>0:(t=ie.exec(e))?(de(he(t[1]),me(t[2]),me(t[3]))|fe(t[4]))>>>0:null}(e);if(null===t)return e;t=t||0;return`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`}var ve=(e,t,n)=>{if(D.fun(e))return e;if(D.arr(e))return ve({range:e,output:t,extrapolate:n});if(D.str(e.output[0]))return j(e);const r=e,o=r.output,i=r.range||[0,1],a=r.extrapolateLeft||r.extrapolate||"extend",s=r.extrapolateRight||r.extrapolate||"extend",l=r.easing||(e=>e);return e=>{const t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,i);return function(e,t,n,r,o,i,a,s,l){let c=l?l(e):e;if(c<t){if("identity"===a)return c;"clamp"===a&&(c=t)}if(c>n){if("identity"===s)return c;"clamp"===s&&(c=n)}if(r===o)return r;if(t===n)return e<=t?r:o;t===-1/0?c=-c:n===1/0?c-=t:c=(c-t)/(n-t);c=i(c),r===-1/0?c=-c:o===1/0?c+=r:c=c*(o-r)+r;return c}(e,i[t],i[t+1],o[t],o[t+1],l,a,s,r.map)}};var ye=1.70158,be=1.525*ye,we=ye+1,xe=2*Math.PI/3,Se=2*Math.PI/4.5,_e=e=>{const t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},Ce={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>we*e*e*e-ye*e*e,easeOutBack:e=>1+we*Math.pow(e-1,3)+ye*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(7.189819*e-be)/2:(Math.pow(2*e-2,2)*((be+1)*(2*e-2)+be)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*xe),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*xe)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*Se)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*Se)/2+1,easeInBounce:e=>1-_e(1-e),easeOutBounce:_e,easeInOutBounce:e=>e<.5?(1-_e(1-2*e))/2:(1+_e(2*e-1))/2,steps:(e,t="end")=>n=>{const r=(n="end"===t?Math.min(n,.999):Math.max(n,.001))*e;return((e,t,n)=>Math.min(Math.max(n,e),t))(0,1,("end"===t?Math.floor(r):Math.ceil(r))/e)}},Ee=Symbol.for("FluidValue.get"),ke=Symbol.for("FluidValue.observers"),ze=e=>Boolean(e&&e[Ee]),Pe=e=>e&&e[Ee]?e[Ee]():e,Ae=e=>e[ke]||null;function De(e,t){const n=e[ke];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var Te=class{constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");Ie(this,e)}},Ie=(e,t)=>je(e,Ee,t);function Me(e,t){if(e[Ee]){let n=e[ke];n||je(e,ke,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function Ne(e,t){const n=e[ke];if(n&&n.has(t)){const r=n.size-1;r?n.delete(t):e[ke]=null,e.observerRemoved&&e.observerRemoved(r,t)}}var Oe,je=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),Re=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,Fe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,Be=new RegExp(`(${Re.source})(%|[a-z]+)`,"i"),Le=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Ve=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,Ke=e=>{const[t,n]=$e(e);if(!t||B())return e;const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(r)return r.trim();if(n&&n.startsWith("--")){const t=window.getComputedStyle(document.documentElement).getPropertyValue(n);return t||e}return n&&Ve.test(n)?Ke(n):n||e},$e=e=>{const t=Ve.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]},He=(e,t,n,r,o)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`,Ue=e=>{Oe||(Oe=L?new RegExp(`(${Object.keys(L).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map((e=>Pe(e).replace(Ve,Ke).replace(Fe,ge).replace(Oe,ge))),n=t.map((e=>e.match(Re).map(Number))),r=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>ve({...e,output:t})));return e=>{const n=!Be.test(t[0])&&t.find((e=>Be.test(e)))?.replace(Re,"");let o=0;return t[0].replace(Re,(()=>`${r[o++](e)}${n||""}`)).replace(Le,He)}},qe="react-spring: ",We=e=>{const t=e;let n=!1;if("function"!=typeof t)throw new TypeError(`${qe}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},Ge=We(console.warn);var Ye=We(console.warn);function Ze(e){return D.str(e)&&("#"==e[0]||/\d/.test(e)||!B()&&Ve.test(e)||e in(L||{}))}var Je=B()?o.useEffect:o.useLayoutEffect;function Xe(){const e=(0,o.useState)()[1],t=(()=>{const e=(0,o.useRef)(!1);return Je((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var Qe=e=>(0,o.useEffect)(e,et),et=[];function tt(e){const t=(0,o.useRef)();return(0,o.useEffect)((()=>{t.current=e})),t.current}var nt=Symbol.for("Animated:node"),rt=e=>e&&e[nt],ot=(e,t)=>{return n=e,r=nt,o=t,Object.defineProperty(n,r,{value:o,writable:!0,configurable:!0});var n,r,o},it=e=>e&&e[nt]&&e[nt].getPayload(),at=class{constructor(){ot(this,this)}getPayload(){return this.payload||[]}},st=class extends at{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,D.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new st(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return D.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,D.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},lt=class extends st{constructor(e){super(0),this._string=null,this._toString=ve({output:[e,e]})}static create(e){return new lt(e)}getValue(){const e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(D.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=ve({output:[this.getValue(),e]})),this._value=0,super.reset()}},ct={dependencies:null},ut=class extends at{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return M(this.source,((n,r)=>{var o;(o=n)&&o[nt]===o?t[r]=n.getValue(e):ze(n)?t[r]=Pe(n):e||(t[r]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&I(this.payload,(e=>e.reset()))}_makePayload(e){if(e){const t=new Set;return M(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){ct.dependencies&&ze(e)&&ct.dependencies.add(e);const t=it(e);t&&I(t,(e=>this.add(e)))}},dt=class extends ut{constructor(e){super(e)}static create(e){return new dt(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){const t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(pt)),!0)}};function pt(e){return(Ze(e)?lt:st).create(e)}function ht(e){const t=rt(e);return t?t.constructor:D.arr(e)?dt:Ze(e)?lt:st}var ft=(e,t)=>{const n=!D.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,o.forwardRef)(((r,i)=>{const a=(0,o.useRef)(null),s=n&&(0,o.useCallback)((e=>{a.current=function(e,t){e&&(D.fun(e)?e(t):e.current=t);return t}(i,e)}),[i]),[l,c]=function(e,t){const n=new Set;ct.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)});return e=new ut(e),ct.dependencies=null,[e,n]}(r,t),d=Xe(),p=()=>{const e=a.current;if(n&&!e)return;!1===(!!e&&t.applyAnimatedValues(e,l.getValue(!0)))&&d()},h=new mt(p,c),f=(0,o.useRef)();Je((()=>(f.current=h,I(c,(e=>Me(e,h))),()=>{f.current&&(I(f.current.deps,(e=>Ne(e,f.current))),u.cancel(f.current.update))}))),(0,o.useEffect)(p,[]),Qe((()=>()=>{const e=f.current;I(e.deps,(t=>Ne(t,e)))}));const m=t.getComponentProps(l.getValue());return o.createElement(e,{...m,ref:s})}))},mt=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&u.write(this.update)}};var gt=Symbol.for("AnimatedComponent"),vt=e=>D.str(e)?e:e&&D.str(e.displayName)?e.displayName:D.fun(e)&&e.name||null;function yt(e,...t){return D.fun(e)?e(...t):e}var bt=(e,t)=>!0===e||!!(t&&e&&(D.fun(e)?e(t):N(e).includes(t))),wt=(e,t)=>D.obj(e)?t&&e[t]:e,xt=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,St=e=>e,_t=(e,t=St)=>{let n=Ct;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));const r={};for(const o of n){const n=t(e[o],o);D.und(n)||(r[o]=n)}return r},Ct=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Et={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function kt(e){const t=function(e){const t={};let n=0;if(M(e,((e,r)=>{Et[r]||(t[r]=e,n++)})),n)return t}(e);if(t){const n={to:t};return M(e,((e,r)=>r in t||(n[r]=e))),n}return{...e}}function zt(e){return e=Pe(e),D.arr(e)?e.map(zt):Ze(e)?P.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Pt(e){for(const t in e)return!0;return!1}function At(e){return D.fun(e)||D.arr(e)&&D.obj(e[0])}function Dt(e,t){e.ref?.delete(e),t?.delete(e)}function Tt(e,t){t&&e.ref!==t&&(e.ref?.delete(e),t.add(e),e.ref=t)}var It={tension:170,friction:26,mass:1,damping:1,easing:Ce.linear,clamp:!1};function Mt(e,t){if(D.und(t.decay)){const n=!D.und(t.tension)||!D.und(t.friction);!n&&D.und(t.frequency)&&D.und(t.damping)&&D.und(t.mass)||(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}var Nt=[];function Ot(e,{key:t,props:n,defaultProps:r,state:o,actions:i}){return new Promise(((a,s)=>{let l,c,d=bt(n.cancel??r?.cancel,t);if(d)f();else{D.und(n.pause)||(o.paused=bt(n.pause,t));let e=r?.pause;!0!==e&&(e=o.paused||bt(e,t)),l=yt(n.delay||0,t),e?(o.resumeQueue.add(h),i.pause()):(i.resume(),h())}function p(){o.resumeQueue.add(h),o.timeouts.delete(c),c.cancel(),l=c.time-u.now()}function h(){l>0&&!P.skipAnimation?(o.delayed=!0,c=u.setTimeout(f,l),o.pauseQueue.add(p),o.timeouts.add(c)):f()}function f(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(p),o.timeouts.delete(c),e<=(o.cancelId||0)&&(d=!0);try{i.start({...n,callId:e,cancel:d},a)}catch(e){s(e)}}}))}var jt=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?Bt(e.get()):t.every((e=>e.noop))?Rt(e.get()):Ft(e.get(),t.every((e=>e.finished))),Rt=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),Ft=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),Bt=e=>({value:e,cancelled:!0,finished:!1});function Lt(e,t,n,r){const{callId:o,parentId:i,onRest:a}=t,{asyncTo:s,promise:l}=n;return i||e!==s||t.reset?n.promise=(async()=>{n.asyncId=o,n.asyncTo=e;const c=_t(t,((e,t)=>"onRest"===t?void 0:e));let d,p;const h=new Promise(((e,t)=>(d=e,p=t))),f=e=>{const t=o<=(n.cancelId||0)&&Bt(r)||o!==n.asyncId&&Ft(r,!1);if(t)throw e.result=t,p(e),e},m=(e,t)=>{const i=new Kt,a=new $t;return(async()=>{if(P.skipAnimation)throw Vt(n),a.result=Ft(r,!1),p(a),a;f(i);const s=D.obj(e)?{...e}:{...t,to:e};s.parentId=o,M(c,((e,t)=>{D.und(s[t])&&(s[t]=e)}));const l=await r.start(s);return f(i),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),l})()};let g;if(P.skipAnimation)return Vt(n),Ft(r,!1);try{let t;t=D.arr(e)?(async e=>{for(const t of e)await m(t)})(e):Promise.resolve(e(m,r.stop.bind(r))),await Promise.all([t.then(d),h]),g=Ft(r.get(),!0,!1)}catch(e){if(e instanceof Kt)g=e.result;else{if(!(e instanceof $t))throw e;g=e.result}}finally{o==n.asyncId&&(n.asyncId=i,n.asyncTo=i?s:void 0,n.promise=i?l:void 0)}return D.fun(a)&&u.batchedUpdates((()=>{a(g,r,r.item)})),g})():l}function Vt(e,t){O(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var Kt=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},$t=class extends Error{constructor(){super("SkipAnimationSignal")}},Ht=e=>e instanceof qt,Ut=1,qt=class extends Te{constructor(){super(...arguments),this.id=Ut++,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=rt(this);return e&&e.getValue()}to(...e){return P.to(this,e)}interpolate(...e){return Ge(`${qe}The "interpolate" function is deprecated in v9 (use "to" instead)`),P.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){De(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||G.sort(this),De(this,{type:"priority",parent:this,priority:e})}},Wt=Symbol.for("SpringPhase"),Gt=e=>(1&e[Wt])>0,Yt=e=>(2&e[Wt])>0,Zt=e=>(4&e[Wt])>0,Jt=(e,t)=>t?e[Wt]|=3:e[Wt]&=-3,Xt=(e,t)=>t?e[Wt]|=4:e[Wt]&=-5,Qt=class extends qt{constructor(e,t){if(super(),this.animation=new class{constructor(){this.changed=!1,this.values=Nt,this.toValues=null,this.fromValues=Nt,this.config=new class{constructor(){this.velocity=0,Object.assign(this,It)}},this.immediate=!1}},this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!D.und(e)||!D.und(t)){const n=D.obj(e)?{...e}:{...t,from:e};D.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(Yt(this)||this._state.asyncTo)||Zt(this)}get goal(){return Pe(this.animation.to)}get velocity(){const e=rt(this);return e instanceof st?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return Gt(this)}get isAnimating(){return Yt(this)}get isPaused(){return Zt(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1;const r=this.animation;let{toValues:o}=r;const{config:i}=r,a=it(r.to);!a&&ze(r.to)&&(o=N(Pe(r.to))),r.values.forEach(((s,l)=>{if(s.done)return;const c=s.constructor==lt?1:a?a[l].lastPosition:o[l];let u=r.immediate,d=c;if(!u){if(d=s.lastPosition,i.tension<=0)return void(s.done=!0);let t=s.elapsedTime+=e;const n=r.fromValues[l],o=null!=s.v0?s.v0:s.v0=D.arr(i.velocity)?i.velocity[l]:i.velocity;let a;const p=i.precision||(n==c?.005:Math.min(1,.001*Math.abs(c-n)));if(D.und(i.duration))if(i.decay){const e=!0===i.decay?.998:i.decay,r=Math.exp(-(1-e)*t);d=n+o/(1-e)*(1-r),u=Math.abs(s.lastPosition-d)<=p,a=o*r}else{a=null==s.lastVelocity?o:s.lastVelocity;const t=i.restVelocity||p/10,r=i.clamp?0:i.bounce,l=!D.und(r),h=n==c?s.v0>0:n<c;let f,m=!1;const g=1,v=Math.ceil(e/g);for(let e=0;e<v&&(f=Math.abs(a)>t,f||(u=Math.abs(c-d)<=p,!u));++e){l&&(m=d==c||d>c==h,m&&(a=-a*r,d=c));a+=(1e-6*-i.tension*(d-c)+.001*-i.friction*a)/i.mass*g,d+=a*g}}else{let r=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,s.durationProgress>0&&(s.elapsedTime=i.duration*s.durationProgress,t=s.elapsedTime+=e)),r=(i.progress||0)+t/this._memoizedDuration,r=r>1?1:r<0?0:r,s.durationProgress=r),d=n+i.easing(r)*(c-n),a=(d-s.lastPosition)/e,u=1==r}s.lastVelocity=a,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}a&&!a[l].done&&(u=!1),u?s.done=!0:t=!1,s.setValue(d,i.round)&&(n=!0)}));const s=rt(this),l=s.getValue();if(t){const e=Pe(r.to);l===e&&!n||i.decay?n&&i.decay&&this._onChange(l):(s.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(l)}set(e){return u.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Yt(this)){const{to:e,config:t}=this.animation;u.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return D.und(e)?(n=this.queue||[],this.queue=[]):n=[D.obj(e)?e:{...t,to:e}],Promise.all(n.map((e=>this._update(e)))).then((e=>jt(this,e)))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),Vt(this._state,e&&this._lastCallId),u.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:r}=e;n=D.obj(n)?n[t]:n,(null==n||At(n))&&(n=void 0),r=D.obj(r)?r[t]:r,null==r&&(r=void 0);const o={to:n,from:r};return Gt(this)||(e.reverse&&([n,r]=[r,n]),r=Pe(r),D.und(r)?rt(this)||this._set(n):this._set(r)),o}_update({...e},t){const{key:n,defaultProps:r}=this;e.default&&Object.assign(r,_t(e,((e,t)=>/^on/.test(t)?wt(e,n):e))),sn(this,e,"onProps"),ln(this,"onProps",e,this);const o=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const i=this._state;return Ot(++this._lastCallId,{key:n,props:e,defaultProps:r,state:i,actions:{pause:()=>{Zt(this)||(Xt(this,!0),F(i.pauseQueue),ln(this,"onPause",Ft(this,en(this,this.animation.to)),this))},resume:()=>{Zt(this)&&(Xt(this,!1),Yt(this)&&this._resume(),F(i.resumeQueue),ln(this,"onResume",Ft(this,en(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then((n=>{if(e.loop&&n.finished&&(!t||!n.noop)){const t=tn(e);if(t)return this._update(t,!0)}return n}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Bt(this));const r=!D.und(e.to),o=!D.und(e.from);if(r||o){if(!(t.callId>this._lastToId))return n(Bt(this));this._lastToId=t.callId}const{key:i,defaultProps:a,animation:s}=this,{to:l,from:c}=s;let{to:d=l,from:p=c}=e;!o||r||t.default&&!D.und(d)||(d=p),t.reverse&&([d,p]=[p,d]);const h=!T(p,c);h&&(s.from=p),p=Pe(p);const f=!T(d,l);f&&this._focus(d);const m=At(t.to),{config:g}=s,{decay:v,velocity:y}=g;(r||o)&&(g.velocity=0),t.config&&!m&&function(e,t,n){n&&(Mt(n={...n},t),t={...n,...t}),Mt(e,t),Object.assign(e,t);for(const t in It)null==e[t]&&(e[t]=It[t]);let{frequency:r,damping:o}=e;const{mass:i}=e;D.und(r)||(r<.01&&(r=.01),o<0&&(o=0),e.tension=Math.pow(2*Math.PI/r,2)*i,e.friction=4*Math.PI*o*i/r)}(g,yt(t.config,i),t.config!==a.config?yt(a.config,i):void 0);let b=rt(this);if(!b||D.und(d))return n(Ft(this,!0));const w=D.und(t.reset)?o&&!t.default:!D.und(p)&&bt(t.reset,i),x=w?p:this.get(),S=zt(d),_=D.num(S)||D.arr(S)||Ze(S),C=!m&&(!_||bt(a.immediate||t.immediate,i));if(f){const e=ht(d);if(e!==b.constructor){if(!C)throw Error(`Cannot animate between ${b.constructor.name} and ${e.name}, as the "to" prop suggests`);b=this._set(S)}}const E=b.constructor;let k=ze(d),z=!1;if(!k){const e=w||!Gt(this)&&h;(f||e)&&(z=T(zt(x),S),k=!z),(T(s.immediate,C)||C)&&T(g.decay,v)&&T(g.velocity,y)||(k=!0)}if(z&&Yt(this)&&(s.changed&&!w?k=!0:k||this._stop(l)),!m&&((k||ze(l))&&(s.values=b.getPayload(),s.toValues=ze(d)?null:E==lt?[1]:N(S)),s.immediate!=C&&(s.immediate=C,C||w||this._set(l)),k)){const{onRest:e}=s;I(an,(e=>sn(this,t,e)));const r=Ft(this,en(this,l));F(this._pendingCalls,r),this._pendingCalls.add(n),s.changed&&u.batchedUpdates((()=>{s.changed=!w,e?.(r,this),w?yt(a.onRest,r):s.onStart?.(r,this)}))}w&&this._set(x),m?n(Lt(t.to,t,this._state,this)):k?this._start():Yt(this)&&!f?this._pendingCalls.add(n):n(Rt(x))}_focus(e){const t=this.animation;e!==t.to&&(Ae(this)&&this._detach(),t.to=e,Ae(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;ze(t)&&(Me(t,this),Ht(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;ze(e)&&Ne(e,this)}_set(e,t=!0){const n=Pe(e);if(!D.und(n)){const e=rt(this);if(!e||!T(n,e.getValue())){const r=ht(n);e&&e.constructor==r?e.setValue(n):ot(this,r.create(n)),e&&u.batchedUpdates((()=>{this._onChange(n,t)}))}}return rt(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,ln(this,"onStart",Ft(this,en(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),yt(this.animation.onChange,e,this)),yt(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;rt(this).reset(Pe(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),Yt(this)||(Jt(this,!0),Zt(this)||this._resume())}_resume(){P.skipAnimation?this.finish():G.start(this)}_stop(e,t){if(Yt(this)){Jt(this,!1);const n=this.animation;I(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),De(this,{type:"idle",parent:this});const r=t?Bt(this.get()):Ft(this.get(),en(this,e??n.to));F(this._pendingCalls,r),n.changed&&(n.changed=!1,ln(this,"onRest",r,this))}}};function en(e,t){const n=zt(t);return T(zt(e.get()),n)}function tn(e,t=e.loop,n=e.to){const r=yt(t);if(r){const o=!0!==r&&kt(r),i=(o||e).reverse,a=!o||o.reset;return nn({...e,loop:t,default:!1,pause:void 0,to:!i||At(n)?n:void 0,from:a?e.from:void 0,reset:a,...o})}}function nn(e){const{to:t,from:n}=e=kt(e),r=new Set;return D.obj(t)&&on(t,r),D.obj(n)&&on(n,r),e.keys=r.size?Array.from(r):null,e}function rn(e){const t=nn(e);return D.und(t.default)&&(t.default=_t(t)),t}function on(e,t){M(e,((e,n)=>null!=e&&t.add(n)))}var an=["onStart","onRest","onChange","onPause","onResume"];function sn(e,t,n){e.animation[n]=t[n]!==xt(t,n)?wt(t[n],e.key):void 0}function ln(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var cn=["onStart","onChange","onRest"],un=1,dn=class{constructor(e,t){this.id=un++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(const t in e){const n=e[t];D.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(nn(e)),this}start(e){let{queue:t}=this;return e?t=N(e).map(nn):this.queue=[],this._flush?this._flush(this,t):(yn(this,t),pn(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;I(N(t),(t=>n[t].stop(!!e)))}else Vt(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(D.und(e))this.start({pause:!0});else{const t=this.springs;I(N(e),(e=>t[e].pause()))}return this}resume(e){if(D.und(e))this.start({pause:!1});else{const t=this.springs;I(N(e),(e=>t[e].resume()))}return this}each(e){M(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,o=this._changed.size>0;(r&&!this._started||o&&!this._started)&&(this._started=!0,O(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));const i=!r&&this._started,a=o||i&&n.size?this.get():null;o&&t.size&&O(t,(([e,t])=>{t.value=a,e(t,this,this._item)})),i&&(this._started=!1,O(n,(([e,t])=>{t.value=a,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}u.onFrame(this._onFrame)}};function pn(e,t){return Promise.all(t.map((t=>hn(e,t)))).then((t=>jt(e,t)))}async function hn(e,t,n){const{keys:r,to:o,from:i,loop:a,onRest:s,onResolve:l}=t,c=D.obj(t.default)&&t.default;a&&(t.loop=!1),!1===o&&(t.to=null),!1===i&&(t.from=null);const d=D.arr(o)||D.fun(o)?o:void 0;d?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):I(cn,(n=>{const r=t[n];if(D.fun(r)){const o=e._events[n];t[n]=({finished:e,cancelled:t})=>{const n=o.get(r);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):o.set(r,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[n]=t[n])}}));const p=e._state;t.pause===!p.paused?(p.paused=t.pause,F(t.pause?p.pauseQueue:p.resumeQueue)):p.paused&&(t.pause=!0);const h=(r||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),f=!0===t.cancel||!0===xt(t,"cancel");(d||f&&p.asyncId)&&h.push(Ot(++e._lastAsyncId,{props:t,state:p,actions:{pause:A,resume:A,start(t,n){f?(Vt(p,e._lastAsyncId),n(Bt(e))):(t.onRest=s,n(Lt(d,t,p,e)))}}})),p.paused&&await new Promise((e=>{p.resumeQueue.add(e)}));const m=jt(e,await Promise.all(h));if(a&&m.finished&&(!n||!m.noop)){const n=tn(t,a,o);if(n)return yn(e,[n]),hn(e,n,!0)}return l&&u.batchedUpdates((()=>l(m,e,e.item))),m}function fn(e,t){const n={...e.springs};return t&&I(N(t),(e=>{D.und(e.keys)&&(e=nn(e)),D.obj(e.to)||(e={...e,to:void 0}),vn(n,e,(e=>gn(e)))})),mn(e,n),n}function mn(e,t){M(t,((t,n)=>{e.springs[n]||(e.springs[n]=t,Me(t,e))}))}function gn(e,t){const n=new Qt;return n.key=e,t&&Me(n,t),n}function vn(e,t,n){t.keys&&I(t.keys,(r=>{(e[r]||(e[r]=n(r)))._prepareNode(t)}))}function yn(e,t){I(t,(t=>{vn(e.springs,t,(t=>gn(t,e)))}))}var bn,wn,xn=({children:e,...t})=>{const n=(0,o.useContext)(Sn),r=t.pause||!!n.pause,i=t.immediate||!!n.immediate;t=function(e,t){const[n]=(0,o.useState)((()=>({inputs:t,result:e()}))),r=(0,o.useRef)(),i=r.current;let a=i;a?Boolean(t&&a.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,a.inputs))||(a={inputs:t,result:e()}):a=n;return(0,o.useEffect)((()=>{r.current=a,i==n&&(n.inputs=n.result=void 0)}),[a]),a.result}((()=>({pause:r,immediate:i})),[r,i]);const{Provider:a}=Sn;return o.createElement(a,{value:t},e)},Sn=(bn=xn,wn={},Object.assign(bn,o.createContext(wn)),bn.Provider._context=bn,bn.Consumer._context=bn,bn);xn.Provider=Sn.Provider,xn.Consumer=Sn.Consumer;var _n=()=>{const e=[],t=function(t){Ye(`${qe}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);const r=[];return I(e,((e,o)=>{if(D.und(t))r.push(e.start());else{const i=n(t,e,o);i&&r.push(e.start(i))}})),r};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){const n=e.indexOf(t);~n&&e.splice(n,1)},t.pause=function(){return I(e,(e=>e.pause(...arguments))),this},t.resume=function(){return I(e,(e=>e.resume(...arguments))),this},t.set=function(t){I(e,((e,n)=>{const r=D.fun(t)?t(n,e):t;r&&e.set(r)}))},t.start=function(t){const n=[];return I(e,((e,r)=>{if(D.und(t))n.push(e.start());else{const o=this._getProps(t,e,r);o&&n.push(e.start(o))}})),n},t.stop=function(){return I(e,(e=>e.stop(...arguments))),this},t.update=function(t){return I(e,((e,n)=>e.update(this._getProps(t,e,n)))),this};const n=function(e,t,n){return D.fun(e)?e(n,t):e};return t._getProps=n,t};function Cn(e,t,n){const r=D.fun(t)&&t;r&&!n&&(n=[]);const i=(0,o.useMemo)((()=>r||3==arguments.length?_n():void 0),[]),a=(0,o.useRef)(0),s=Xe(),l=(0,o.useMemo)((()=>({ctrls:[],queue:[],flush(e,t){const n=fn(e,t);return a.current>0&&!l.queue.length&&!Object.keys(n).some((t=>!e.springs[t]))?pn(e,t):new Promise((r=>{mn(e,n),l.queue.push((()=>{r(pn(e,t))})),s()}))}})),[]),c=(0,o.useRef)([...l.ctrls]),u=[],d=tt(e)||0;function p(e,n){for(let o=e;o<n;o++){const e=c.current[o]||(c.current[o]=new dn(null,l.flush)),n=r?r(o,e):t[o];n&&(u[o]=rn(n))}}(0,o.useMemo)((()=>{I(c.current.slice(e,d),(e=>{Dt(e,i),e.stop(!0)})),c.current.length=e,p(d,e)}),[e]),(0,o.useMemo)((()=>{p(0,Math.min(d,e))}),n);const h=c.current.map(((e,t)=>fn(e,u[t]))),f=(0,o.useContext)(xn),m=tt(f),g=f!==m&&Pt(f);Je((()=>{a.current++,l.ctrls=c.current;const{queue:e}=l;e.length&&(l.queue=[],I(e,(e=>e()))),I(c.current,((e,t)=>{i?.add(e),g&&e.start({default:f});const n=u[t];n&&(Tt(e,n.ref),e.ref?e.queue.push(n):e.start(n))}))})),Qe((()=>()=>{I(l.ctrls,(e=>e.stop(!0)))}));const v=h.map((e=>({...e})));return i?[v,i]:v}function En(e,t){const n=D.fun(e),[[r],o]=Cn(1,n?e:[e],n?t||[]:t);return n||2==arguments.length?[r,o]:r}var kn=class extends qt{constructor(e,t){super(),this.source=e,this.idle=!0,this._active=new Set,this.calc=ve(...t);const n=this._get(),r=ht(n);ot(this,r.create(n))}advance(e){const t=this._get();T(t,this.get())||(rt(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Pn(this._active)&&An(this)}_get(){const e=D.arr(this.source)?this.source.map(Pe):N(Pe(this.source));return this.calc(...e)}_start(){this.idle&&!Pn(this._active)&&(this.idle=!1,I(it(this),(e=>{e.done=!1})),P.skipAnimation?(u.batchedUpdates((()=>this.advance())),An(this)):G.start(this))}_attach(){let e=1;I(N(this.source),(t=>{ze(t)&&Me(t,this),Ht(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){I(N(this.source),(e=>{ze(e)&&Ne(e,this)})),this._active.clear(),An(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=N(this.source).reduce(((e,t)=>Math.max(e,(Ht(t)?t.priority:0)+1)),0))}};function zn(e){return!1!==e.idle}function Pn(e){return!e.size||Array.from(e).every(zn)}function An(e){e.idle||(e.idle=!0,I(it(e),(e=>{e.done=!0})),De(e,{type:"idle",parent:e}))}P.assign({createStringInterpolator:Ue,to:(e,t)=>new kn(e,t)});G.advance;var Dn=n(40961),Tn=/^--/;function In(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||Tn.test(e)||Nn.hasOwnProperty(e)&&Nn[e]?(""+t).trim():t+"px"}var Mn={};var Nn={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},On=["Webkit","Ms","Moz","O"];Nn=Object.keys(Nn).reduce(((e,t)=>(On.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Nn);var jn=/^(matrix|translate|scale|rotate|skew)/,Rn=/^(translate)/,Fn=/^(rotate|skew)/,Bn=(e,t)=>D.num(e)&&0!==e?e+t:e,Ln=(e,t)=>D.arr(e)?e.every((e=>Ln(e,t))):D.num(e)?e===t:parseFloat(e)===t,Vn=class extends ut{constructor({x:e,y:t,z:n,...r}){const o=[],i=[];(e||t||n)&&(o.push([e||0,t||0,n||0]),i.push((e=>[`translate3d(${e.map((e=>Bn(e,"px"))).join(",")})`,Ln(e,0)]))),M(r,((e,t)=>{if("transform"===t)o.push([e||""]),i.push((e=>[e,""===e]));else if(jn.test(t)){if(delete r[t],D.und(e))return;const n=Rn.test(t)?"px":Fn.test(t)?"deg":"";o.push(N(e)),i.push("rotate3d"===t?([e,t,r,o])=>[`rotate3d(${e},${t},${r},${Bn(o,n)})`,Ln(o,0)]:e=>[`${t}(${e.map((e=>Bn(e,n))).join(",")})`,Ln(e,t.startsWith("scale")?1:0)])}})),o.length&&(r.transform=new Kn(o,i)),super(r)}},Kn=class extends Te{constructor(e,t){super(),this.inputs=e,this.transforms=t,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return I(this.inputs,((n,r)=>{const o=Pe(n[0]),[i,a]=this.transforms[r](D.arr(o)?o:n.map(Pe));e+=" "+i,t=t&&a})),t?"none":e}observerAdded(e){1==e&&I(this.inputs,(e=>I(e,(e=>ze(e)&&Me(e,this)))))}observerRemoved(e){0==e&&I(this.inputs,(e=>I(e,(e=>ze(e)&&Ne(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),De(this,e)}};P.assign({batchedUpdates:Dn.unstable_batchedUpdates,createStringInterpolator:Ue,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var $n=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new ut(e)),getComponentProps:r=(e=>e)}={})=>{const o={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:r},i=e=>{const t=vt(e)||"Anonymous";return(e=D.str(e)?i[e]||(i[e]=ft(e,o)):e[gt]||(e[gt]=ft(e,o))).displayName=`Animated(${t})`,e};return M(e,((t,n)=>{D.arr(e)&&(n=vt(t)),i[n]=i(t)})),{animated:i}})(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;const n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:r,children:o,scrollTop:i,scrollLeft:a,viewBox:s,...l}=t,c=Object.values(l),u=Object.keys(l).map((t=>n||e.hasAttribute(t)?t:Mn[t]||(Mn[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==o&&(e.textContent=o);for(const t in r)if(r.hasOwnProperty(t)){const n=In(t,r[t]);Tn.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==i&&(e.scrollTop=i),void 0!==a&&(e.scrollLeft=a),void 0!==s&&e.setAttribute("viewBox",s)},createAnimatedStyle:e=>new Vn(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n}),Hn=$n.animated,Un=n(8521),qn=n(35295),Wn=n(20576),Gn=n(55026),Yn=n(42838),Zn=n.n(Yn),Jn=n(37555);function Xn(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function Qn(e,t,n){return(t=Xn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function tr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?er(Object(n),!0).forEach((function(t){Qn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):er(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nr(e,t){var n={};for(var r in e)n[r]=t(e[r],r);return n}var rr=(e,t,n)=>{for(var r of Object.keys(e)){var o;if(e[r]!==(null!==(o=t[r])&&void 0!==o?o:n[r]))return!1}return!0},or=e=>{var t=t=>{var n=e.defaultClassName,r=tr(tr({},e.defaultVariants),t);for(var o in r){var i,a=null!==(i=r[o])&&void 0!==i?i:e.defaultVariants[o];if(null!=a){var s=a;"boolean"==typeof s&&(s=!0===s?"true":"false");var l=e.variantClassNames[o][s];l&&(n+=" "+l)}}for(var[c,u]of e.compoundVariants)rr(c,r,e.defaultVariants)&&(n+=" "+u);return n};return t.variants=()=>Object.keys(e.variantClassNames),t.classNames={get base(){return e.defaultClassName.split(" ")[0]},get variants(){return nr(e.variantClassNames,(e=>nr(e,(e=>e.split(" ")[0]))))}},t},ir=or({defaultClassName:"_96lriw3",variantClassNames:{isFocusVisible:{true:"_96lriw4"},isDisabled:{true:"_1yep5z6da"},isInline:{false:"_96lriw6 _1yep5z6ih _1yep5z6ii _1yep5z6ij _1yep5z6jt _1yep5z6ju _1yep5z6jv _1yep5z6lc _1yep5z6ge",true:"_96lriw7 _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6gz _1yep5z6gc"}},defaultVariants:{},compoundVariants:[]}),ar=or({defaultClassName:"_96lriw8 _1yep5z6ih _1yep5z6ii _1yep5z6ij _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6k2 _1yep5z6k3 _1yep5z6k4 _1yep5z6dy _1yep5z6fi",variantClassNames:{isInline:{false:"_96lriw9",true:"_96lriwa"}},defaultVariants:{},compoundVariants:[]}),sr=or({defaultClassName:"_96lriw0 _1yep5z6ih _1yep5z6ii _1yep5z6ij _1yep5z6it _1yep5z6iu _1yep5z6iv _1yep5z6j8 _1yep5z6j9 _1yep5z6ja",variantClassNames:{isInline:{false:"_96lriw1",true:"_1yep5z69o _1yep5z69p _1yep5z69q"}},defaultVariants:{},compoundVariants:[]}),lr=o.forwardRef((({className:e,style:t,inputStyle:n,inputClassName:l,clearLabel:c,defaultValue:u,value:d,"data-block-id":p,"data-block-class":h,isInline:f=!0,label:m,footerStyle:g,footerClassName:v,...y},b)=>{let w=o.useRef(null),[x,S]=o.useState(d||u||""),{inputProps:_,labelProps:C}=(0,a.vZ)({...y,value:d||x,onChange:e=>{y.onChange?.(e),S(e)},"aria-label":m},w),{isFocusVisible:E,focusProps:k}=(0,a.og)({isTextInput:!0});return(0,s.jsxs)(r.Group,{className:(0,i.xW)(sr({isInline:f}),"BaselineUI-SignatureTextInput",e),style:t,ref:b,"data-block-id":p,"data-block-class":h,children:[(0,s.jsx)("input",{...(0,a.v6)(_,k),className:(0,i.xW)(ir({isFocusVisible:E,isDisabled:y.isDisabled,isInline:f}),l),ref:w,style:n}),(0,s.jsx)("div",{className:(0,i.xW)(f?void 0:"_1yep5z66 _1yep5z67 _1yep5z68 _1yep5z62i _1yep5z62j _1yep5z62k _1yep5z63o _1yep5z63p _1yep5z63q _1yep5z61c _1yep5z61d _1yep5z61e _1yep5z6g3 _1yep5z6lc _1yep5z6ih _1yep5z6ii _1yep5z6ij _1yep5z6k2 _1yep5z6k3 _1yep5z6k4",v),style:g,children:w.current?.value?(0,s.jsx)(r.ActionButton,{label:c,variant:"ghost",size:f?"md":"sm",isDisabled:y.isDisabled||!x,onPress:()=>{S(""),y.onChange?.("")}}):(0,s.jsx)("label",{...C,"aria-disabled":"true",className:ar({isInline:f}),children:m})})]})}));lr.displayName="SignatureTextInput";var cr={prefix:String(Math.round(1e10*Math.random())),current:0},ur=(o.createContext(cr),o.createContext(!1));typeof window<"u"&&window.document&&window.document.createElement,new WeakMap;function dr(){return!1}function pr(){return!0}function hr(e){return()=>{}}function fr(){return"function"==typeof o.useSyncExternalStore?o.useSyncExternalStore(hr,dr,pr):(0,o.useContext)(ur)}o.useId;var mr=e=>{var t;return null!==(t=e?.ownerDocument)&&void 0!==t?t:document},gr=typeof document<"u"&&window.visualViewport;function vr(){return{width:gr&&gr?.width||window.innerWidth,height:gr&&gr?.height||window.innerHeight}}var yr=or({defaultClassName:"jzfzia3",variantClassNames:{isFocusVisible:{true:"jzfzia4"}},defaultVariants:{},compoundVariants:[]}),br=({children:e})=>{let t=o.useRef(null),{focusProps:n,isFocusVisible:i}=(0,a.og)(),[c,u]=(0,r.useLocalStorage)("bui-devtools",{x:0,y:0}),{buttonProps:d}=(0,a.sL)({},t),[p,h]=En((()=>({left:c.x,top:c.y,config:{tension:600,friction:30}}))),f=o.useRef(null),m=function(){let e=fr(),[t,n]=(0,o.useState)((()=>e?{width:0,height:0}:vr()));return(0,o.useEffect)((()=>{let e=()=>{n((e=>{let t=vr();return t.width===e.width&&t.height===e.height?e:t}))};return gr?gr.addEventListener("resize",e):window.addEventLi