@veevarts/design-system 1.6.0-dev.1 → 1.6.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -16,5 +16,5 @@
16
16
  `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&a&&o){const f=a.filter(p=>l.includes(p.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var sn=200,he=function(){};he.prototype.append=function(e){return e.length?(e=he.from(e),!this.length&&e||e.length<sn&&this.leafAppend(e)||this.length<sn&&e.leafPrepend(this)||this.appendInner(e)):this};he.prototype.prepend=function(e){return e.length?he.from(e).append(this):this};he.prototype.appendInner=function(e){return new oa(this,e)};he.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?he.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};he.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};he.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};he.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};he.from=function(e){return e instanceof he?e:e&&e.length?new hi(e):he.empty};var hi=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=sn)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=sn)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(he);he.empty=new hi([]);var oa=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(he);const la=500;class De{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,u=[],d=[];return this.items.forEach((f,p)=>{if(!f.step){s||(s=this.remapping(r,p+1),i=s.maps.length),i--,d.push(f);return}if(s){d.push(new Pe(f.map));let m=f.step.map(s.slice(i)),C;m&&o.maybeStep(m).doc&&(C=o.mapping.maps[o.mapping.maps.length-1],u.push(new Pe(C,void 0,void 0,u.length+d.length))),i--,C&&s.appendMap(C,i)}else o.maybeStep(f.step);if(f.selection)return l=s?f.selection.map(s.slice(i)):f.selection,a=new De(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),p=new Pe(e.mapping.maps[d],f,n),m;(m=a&&a.merge(p))&&(p=m,d?i.pop():l=l.slice(0,l.length-1)),i.push(p),n&&(o++,n=void 0),s||(a=p)}let u=o-r.depth;return u>ca&&(l=aa(l,u),o-=u),new De(l.append(i),o)}remapping(e,n){let r=new nn;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new De(this.items.append(e.map(n=>new Pe(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},s);let a=n;this.items.forEach(p=>{let m=i.getMirror(--a);if(m==null)return;o=Math.min(o,m);let C=i.maps[m];if(p.step){let b=e.steps[m].invert(e.docs[m]),k=p.selection&&p.selection.map(i.slice(a+1,m));k&&l++,r.push(new Pe(C,b,k))}else r.push(new Pe(C))},s);let u=[];for(let p=n;p<o;p++)u.push(new Pe(i.maps[p]));let d=this.items.slice(0,s).append(u).append(r),f=new De(d,l);return f.emptyItemCount()>la&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let d=o.selection&&o.selection.map(n.slice(r));d&&i++;let f=new Pe(u.invert(),a,d),p,m=s.length-1;(p=s.length&&s[m].merge(f))?s[m]=p:s.push(f)}}else o.map&&r--},this.items.length,0),new De(he.from(s.reverse()),i)}}De.empty=new De(he.empty,0);function aa(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class Pe{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Pe(n.getMap().invert(),n,this.selection)}}}class Ge{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const ca=20;function ua(t,e,n,r){let s=n.getMeta(ct),i;if(s)return s.historyState;n.getMeta(ha)&&(t=new Ge(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ct))return o.getMeta(ct).redo?new Ge(t.done.addTransform(n,void 0,r,Xt(e)),t.undone,us(n.mapping.maps),t.prevTime,t.prevComposition):new Ge(t.done,t.undone.addTransform(n,void 0,r,Xt(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!da(n,t.prevRanges)),u=o?Pn(t.prevRanges,n.mapping):us(n.mapping.maps);return new Ge(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Xt(e)),De.empty,u,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ge(t.done.rebased(n,i),t.undone.rebased(n,i),Pn(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ge(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Pn(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function da(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function us(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function Pn(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function fa(t,e,n){let r=Xt(e),s=ct.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new Ge(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(ct,{redo:n,historyState:a})}let $n=!1,ds=null;function Xt(t){let e=t.plugins;if(ds!=e){$n=!1,ds=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){$n=!0;break}}return $n}const ct=new yr("history"),ha=new yr("closeHistory");function pa(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new xn({key:ct,state:{init(){return new Ge(De.empty,De.empty,null,0,-1)},apply(e,n,r){return ua(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?mi:r=="historyRedo"?gi:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function pi(t,e){return(n,r)=>{let s=ct.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=fa(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const mi=pi(!1,!0),gi=pi(!0,!0),fs=R.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>mi(t,e),redo:()=>({state:t,dispatch:e})=>gi(t,e)}},addProseMirrorPlugins(){return[pa(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ma=R.Node.create({name:"doc",topNode:!0,content:"block+"}),ga=R.Node.create({name:"text",group:"inline"});function ya(t={}){return new xn({view(e){return new xa(e,t)}})}class xa{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let m=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(m){let C=m.getBoundingClientRect(),b=f?C.bottom:C.top;f&&p&&(b=(b+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*l;r={left:C.left,right:C.right,top:b-k,bottom:b+k}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*o;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),p=f.width/a.offsetWidth,m=f.height/a.offsetHeight;u=f.left-a.scrollLeft*p,d=f.top-a.scrollTop*m}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ui(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const ba=R.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[ya(this.options)]}});var Ye={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},on={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ka=typeof navigator<"u"&&/Mac/.test(navigator.platform),va=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var pe=0;pe<10;pe++)Ye[48+pe]=Ye[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Ye[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Ye[pe]=String.fromCharCode(pe+32),on[pe]=String.fromCharCode(pe);for(var Vn in Ye)on.hasOwnProperty(Vn)||(on[Vn]=Ye[Vn]);function Sa(t){var e=ka&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||va&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?on:Ye)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Ca=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),wa=typeof navigator<"u"&&/Win/.test(navigator.platform);function Aa(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Ca?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Na(t){let e=Object.create(null);for(let n in t)e[Aa(n)]=t[n];return e}function Bn(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Ea(t){let e=Na(t);return function(n,r){let s=Sa(r),i,o=e[Bn(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Bn(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(wa&&r.ctrlKey&&r.altKey)&&(i=Ye[r.keyCode])&&i!=s){let l=e[Bn(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const ft=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},yi=function(t,e,n,r){return n&&(hs(t,e,n,r,-1)||hs(t,e,n,r,1))},Ta=/^(img|br|input|textarea|hr)$/i;function hs(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ln(t))){let o=t.parentNode;if(!o||o.nodeType!=1||xr(t)||Ta.test(t.nodeName)||t.contentEditable=="false")return!1;e=ft(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?ln(t):0}else return!1}}function ln(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ma(t,e,n){for(let r=e==0,s=e==ln(t);r||s;){if(t==n)return!0;let i=ft(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==ln(t)}}function xr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const xi=function(t){return t.focusNode&&yi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function bi(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Be=typeof navigator<"u"?navigator:null,ps=typeof document<"u"?document:null,et=Be&&Be.userAgent||"",Xn=/Edge\/(\d+)/.exec(et),ki=/MSIE \d/.exec(et),Yn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(et),_t=!!(ki||Yn||Xn),vi=ki?document.documentMode:Yn?+Yn[1]:Xn?+Xn[1]:0,bn=!_t&&/gecko\/(\d+)/i.test(et);bn&&+(/Firefox\/(\d+)/.exec(et)||[0,0])[1];const er=!_t&&/Chrome\/(\d+)/.exec(et),Ue=!!er,Si=er?+er[1]:0,ht=!_t&&!!Be&&/Apple Computer/.test(Be.vendor),br=ht&&(/Mobile\/\w+/.test(et)||!!Be&&Be.maxTouchPoints>2),Me=br||(Be?/Mac/.test(Be.platform):!1),Ci=Be?/Win/.test(Be.platform):!1,Ht=/Android \d/.test(et),kr=!!ps&&"webkitFontSmoothing"in ps.documentElement.style,Oa=kr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ia(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,u;if(xi(n)){for(a=o;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&J.isSelectable(f)&&s.parent&&!(f.isInline&&Ma(n.focusNode,n.focusOffset,s.dom))){let p=s.posBefore;u=new J(o==p?l:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,p=o;for(let m=0;m<n.rangeCount;m++){let C=n.getRangeAt(m);f=Math.min(f,t.docView.posFromDOM(C.startContainer,C.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(C.endContainer,C.endOffset,-1))}if(f<0)return null;[a,o]=p==t.state.selection.anchor?[p,f]:[f,p],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!u){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;u=Ai(t,d,l,f)}return u}function wi(t){return t.editable?t.hasFocus():Ra(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function vr(t,e=!1){let n=t.state.selection;if(La(t,n),!!wi(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ue){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&yi(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)ja(t);else{let{anchor:r,head:s}=n,i,o;ms&&!(n instanceof Q)&&(n.$from.parent.inlineContent||(i=gs(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=gs(t,n.to))),t.docView.setSelection(r,s,t,e),ms&&(i&&ys(i),o&&ys(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Da(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ms=ht||Ue&&Si<63;function gs(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(ht&&s&&s.contentEditable=="false")return zn(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return zn(s);if(i)return zn(i)}}function zn(t){return t.contentEditable="true",ht&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ys(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Da(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!wi(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function ja(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ft(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_t&&vi<=11&&(n.disabled=!0,n.disabled=!1)}function La(t,e){if(e instanceof J){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(xs(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else xs(t)}function xs(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ai(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||Q.between(e,n,r)}function Ra(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function tr(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&X.findFrom(i,e)}function Ze(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function bs(t,e,n){let r=t.state.selection;if(r instanceof Q)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Ze(t,new Q(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=tr(t.state,e);return s&&s instanceof J?Ze(t,s):!1}else if(!(Me&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?J.isSelectable(i)?Ze(t,new J(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):kr?Ze(t,new Q(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof J&&r.node.isInline)return Ze(t,new Q(e>0?r.$to:r.$from));{let s=tr(t.state,e);return s?Ze(t,s):!1}}}function an(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function It(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function mt(t,e){return e<0?Fa(t):Pa(t)}function Fa(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(bn&&n.nodeType==1&&r<an(n)&&It(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(It(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Ni(n))break;{let l=n.previousSibling;for(;l&&It(l,-1);)s=n.parentNode,i=ft(l),l=l.previousSibling;if(l)n=l,r=an(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?nr(t,n,r):s&&nr(t,s,i)}function Pa(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=an(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(It(l,1))i=n,o=++r;else break}else{if(Ni(n))break;{let l=n.nextSibling;for(;l&&It(l,1);)i=l.parentNode,o=ft(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=an(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&nr(t,i,o)}function Ni(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function $a(t,e){for(;t&&e==t.childNodes.length&&!xr(t);)e=ft(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Va(t,e){for(;t&&!e&&!xr(t);)e=ft(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function nr(t,e,n){if(e.nodeType!=3){let i,o;(o=$a(e,n))?(e=o,n=0):(i=Va(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(xi(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&vr(t)},50)}function ks(t,e){let n=t.state.doc.resolve(e);if(!(Ue||Ci)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vs(t,e,n){let r=t.state.selection;if(r instanceof Q&&!r.empty||n.indexOf("s")>-1||Me&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=tr(t.state,e);if(o&&o instanceof J)return Ze(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof Ve?X.near(o,e):X.findFrom(o,e);return l?Ze(t,l):!1}return!1}function Ss(t,e){if(!(t.state.selection instanceof Q))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Cs(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Ba(t){if(!ht||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Cs(t,r,"true"),setTimeout(()=>Cs(t,r,"false"),20)}return!1}function za(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function _a(t,e){let n=e.keyCode,r=za(e);if(n==8||Me&&n==72&&r=="c")return Ss(t,-1)||mt(t,-1);if(n==46&&!e.shiftKey||Me&&n==68&&r=="c")return Ss(t,1)||mt(t,1);if(n==13||n==27)return!0;if(n==37||Me&&n==66&&r=="c"){let s=n==37?ks(t,t.state.selection.from)=="ltr"?-1:1:-1;return bs(t,s,r)||mt(t,s)}else if(n==39||Me&&n==70&&r=="c"){let s=n==39?ks(t,t.state.selection.from)=="ltr"?1:-1:1;return bs(t,s,r)||mt(t,s)}else{if(n==38||Me&&n==80&&r=="c")return vs(t,-1,r)||mt(t,-1);if(n==40||Me&&n==78&&r=="c")return Ba(t)||vs(t,1,r)||mt(t,1);if(r==(Me?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ei(t,e){t.someProp("transformCopied",m=>{e=m(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let m=r.firstChild;n.push(m.type.name,m.attrs!=m.type.defaultAttrs?m.attrs:null),r=m.content}let o=t.someProp("clipboardSerializer")||gn.fromSchema(t.state.schema),l=ji(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=Di[u.nodeName.toLowerCase()]);){for(let m=d.length-1;m>=0;m--){let C=l.createElement(d[m]);for(;a.firstChild;)C.appendChild(a.firstChild);a.appendChild(C),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",m=>m(e,t))||e.content.textBetween(0,e.content.size,`
17
17
 
18
18
  `);return{dom:a,text:p,slice:e}}function Ti(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",p=>{e=p(e,i||r,t)}),i)return l=new K(q.from(t.state.schema.text(e.replace(/\r\n?/g,`
19
- `))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,s,r,t));if(f)l=f;else{let p=s.marks(),{schema:m}=t.state,C=gn.fromSchema(m);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let k=o.appendChild(document.createElement("p"));b&&k.appendChild(C.serializeNode(m.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=Ka(n),kr&&Ja(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||tn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:s,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Ha.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Wa(ws(l,+d[1],+d[2]),d[4]);else if(l=K.maxOpen(Ua(l.content,s),!0),l.openStart||l.openEnd){let f=0,p=0;for(let m=l.content.firstChild;f<l.openStart&&!m.type.spec.isolating;f++,m=m.firstChild);for(let m=l.content.lastChild;p<l.openEnd&&!m.type.spec.isolating;p++,m=m.lastChild);l=ws(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,a)}),l}const Ha=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ua(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&i.length&&Oi(a,i,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Ii(o[o.length-1],i.length));let d=Mi(l,a);o.push(d),s=s.matchType(d.type),i=a}}),o)return q.from(o)}return t}function Mi(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,q.from(t));return t}function Oi(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=Oi(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(q.from(Mi(n,t,s+1))))}}function Ii(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ii(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(q.empty,!0);return t.copy(n.append(r))}function rr(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=rr(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function ws(t,e,n){return e<t.openStart&&(t=new K(rr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new K(rr(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Di={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let As=null;function ji(){return As||(As=document.implementation.createHTMLDocument("title"))}let _n=null;function qa(t){let e=window.trustedTypes;return e?(_n||(_n=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),_n.createHTML(t)):t}function Ka(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=ji().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&Di[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=qa(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function Ja(t){let e=t.querySelectorAll(Ue?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Wa(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=q.from(a.create(r[l+1],s)),i++,o++}return new K(s,i,o)}const Fe={},Te={};function Qe(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Te.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ri(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ht&&Ue&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),br&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,bi(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||_a(t,n)?n.preventDefault():Qe(t,"key")};Te.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Te.keypress=(t,e)=>{let n=e;if(Ri(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Me&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Q)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function kn(t){return{left:t.clientX,top:t.clientY}}function Ga(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Sr(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function vt(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Za(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&J.isSelectable(r)?(vt(t,new J(n)),!0):!1}function Qa(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof J&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(J.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(vt(t,J.create(t.state.doc,s)),!0):!1}function Xa(t,e,n,r,s){return Sr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?Qa(t,n):Za(t,n))}function Ya(t,e,n,r){return Sr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function ec(t,e,n,r){return Sr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||tc(t,n,r)}function tc(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(vt(t,Q.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)vt(t,Q.create(r,l+1,l+1+o.content.size));else if(J.isSelectable(o))vt(t,J.create(r,l));else continue;return!0}}function Cr(t){return cn(t)}const Li=Me?"metaKey":"ctrlKey";Fe.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Cr(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&Ga(n,t.input.lastClick)&&!n[Li]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(kn(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new nc(t,o,n,!!r)):(i=="doubleClick"?Ya:ec)(t,o.pos,o.inside,n)?n.preventDefault():Qe(t,"pointer"))};class nc{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Li],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof J&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Qe(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>vr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(kn(e))),this.updateAllowDefault(e),this.allowDefault||!n?Qe(this.view,"pointer"):Xa(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ht&&this.mightDrag&&!this.mightDrag.node.isAtom||Ue&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(vt(this.view,X.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Qe(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qe(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Fe.touchstart=t=>{t.input.lastTouch=Date.now(),Cr(t),Qe(t,"pointer")};Fe.touchmove=t=>{t.input.lastTouch=Date.now(),Qe(t,"pointer")};Fe.contextmenu=t=>Cr(t);function Ri(t,e){return t.composing?!0:ht&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const rc=Ht?5e3:-1;Te.compositionstart=Te.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Q&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ue&&Ci&&sc(t)))t.markCursor=t.state.storedMarks||n.marks(),cn(t,!0),t.markCursor=null;else if(cn(t,!e.selection.empty),bn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}Fi(t,rc)};function sc(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Te.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Fi(t,20))};function Fi(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>cn(t),e))}function ic(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=oc());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function oc(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function cn(t,e=!1){if(!(Ht&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ic(t),e||t.docView&&t.docView.dirty){let n=Ia(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function lc(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Vt=_t&&vi<15||br&&Oa<604;Fe.copy=Te.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Vt?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Ei(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):lc(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ac(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function cc(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sr(t,r.value,null,s,e):sr(t,r.textContent,r.innerHTML,s,e)},50)}function sr(t,e,n,r,s){let i=Ti(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||K.empty)))return!0;if(!i)return!1;let o=ac(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Pi(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Te.paste=(t,e)=>{let n=e;if(t.composing&&!Ht)return;let r=Vt?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&sr(t,Pi(r),r.getData("text/html"),s,n)?n.preventDefault():cc(t,n)};class uc{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const dc=Me?"altKey":"ctrlKey";function $i(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[dc]}Fe.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(kn(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof J?s.to-1:s.to))){if(r&&r.mightDrag)o=J.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=J.create(t.state.doc,f.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:u,slice:d}=Ei(t,l);(!n.dataTransfer.files.length||!Ue||Si>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Vt?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Vt||n.dataTransfer.setData("text/plain",u),t.dragging=new uc(d,$i(t,n),o)};Fe.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Te.dragover=Te.dragenter=(t,e)=>e.preventDefault();Te.drop=(t,e)=>{try{fc(t,e,t.dragging)}finally{t.dragging=null}};function fc(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(kn(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",m=>{i=m(i,t,!1)}):i=Ti(t,Pi(e.dataTransfer),Vt?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&$i(t,e));if(t.someProp("handleDrop",m=>m(t,e,i||K.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?ui(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:m}=n;m?m.replace(a):a.deleteSelection()}let u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&J.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new J(p));else{let m=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((C,b,k,S)=>m=S),a.setSelection(Ai(t,p,a.doc.resolve(m)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Fe.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&vr(t)},20))};Fe.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Fe.beforeinput=(t,e)=>{if(Ue&&Ht&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,bi(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Te)Fe[t]=Te[t];function Bt(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class un{constructor(e,n){this.toDOM=e,this.spec=n||ut,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new $e(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof un&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Bt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Xe{constructor(e,n){this.attrs=e,this.spec=n||ut}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new $e(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Xe&&Bt(this.attrs,e.attrs)&&Bt(this.spec,e.spec)}static is(e){return e.type instanceof Xe}destroy(){}}class wr{constructor(e,n){this.attrs=e,this.spec=n||ut}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new $e(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof wr&&Bt(this.attrs,e.attrs)&&Bt(this.spec,e.spec)}destroy(){}}class $e{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new $e(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new $e(e,e,new un(n,r))}static inline(e,n,r,s){return new $e(e,n,new Xe(r,s))}static node(e,n,r,s){return new $e(e,n,new wr(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Xe}get widget(){return this.type instanceof un}}const xt=[],ut={};class fe{constructor(e,n){this.local=e.length?e:xt,this.children=n.length?n:xt}static create(e,n){return n.length?dn(n,e,0,ut):ve}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==ve||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ut)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?hc(this.children,o||[],e,n,r,s,i):o?new fe(o.sort(dt),xt):ve}add(e,n){return n.length?this==ve?fe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let u=a+r,d;if(d=Bi(n,l,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,d,u+1):s.splice(i,0,a,a+l.nodeSize,dn(d,l,u+1,ut)),i+=3}});let o=Vi(i?zi(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new fe(o.length?this.local.concat(o).sort(dt):this.local,s||this.children)}remove(e){return e.length==0||this==ve?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,l+1);u!=ve?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new fe(s,r):ve}forChild(e,n){if(this==ve)return this;if(n.isLeaf)return fe.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof Xe){let u=Math.max(i,a.from)-i,d=Math.min(o,a.to)-i;u<d&&(s||(s=[])).push(a.copy(u,d))}}if(s){let l=new fe(s.sort(dt),xt);return r?new st([l,r]):l}return r||ve}eq(e){if(this==e)return!0;if(!(e instanceof fe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ar(this.localsInner(e))}localsInner(e){if(this==ve)return xt;if(e.inlineContent||!this.local.some(Xe.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Xe||n.push(this.local[r]);return n}forEachSet(e){e(this)}}fe.empty=new fe([],[]);fe.removeOverlap=Ar;const ve=fe.empty;class st{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,ut));return st.from(r)}forChild(e,n){if(n.isLeaf)return fe.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=ve&&(i instanceof st?r=r.concat(i.members):r.push(i))}return st.from(r)}eq(e){if(!(e instanceof st)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Ar(r?n:n.sort(dt)):xt}static from(e){switch(e.length){case 0:return ve;case 1:return e[0];default:return new st(e.every(n=>n instanceof fe)?e:e.reduce((n,r)=>n.concat(r instanceof fe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function hc(t,e,n,r,s,i,o){let l=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let f=0;n.maps[u].forEach((p,m,C,b)=>{let k=b-C-(m-p);for(let S=0;S<l.length;S+=3){let w=l[S+1];if(w<0||p>w+d-f)continue;let j=l[S]+d-f;m>=j?l[S+1]=p<=j?-2:-1:p>=d&&k&&(l[S]+=k,l[S+1]+=k)}f+=k}),d=n.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=n.map(t[u]+i),f=d-s;if(f<0||f>=r.content.size){a=!0;continue}let p=n.map(t[u+1]+i,-1),m=p-s,{index:C,offset:b}=r.content.findIndex(f),k=r.maybeChild(C);if(k&&b==f&&b+k.nodeSize==m){let S=l[u+2].mapInner(n,k,d+1,t[u]+i+1,o);S!=ve?(l[u]=f,l[u+1]=m,l[u+2]=S):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=pc(l,t,e,n,s,i,o),d=dn(u,r,0,o);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<d.children.length;f+=3){let m=d.children[f];for(;p<l.length&&l[p]<m;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new fe(e.sort(dt),l)}function Vi(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new $e(s.from+e,s.to+e,s.type))}return n}function pc(t,e,n,r,s,i,o){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(r,s,u);f?n.push(f):o.onRemove&&o.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Bi(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function zi(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function dn(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let u=Bi(t,l,a+n);if(u){i=!0;let d=dn(u,l,n+a+1,r);d!=ve&&s.push(a,a+l.nodeSize,d)}});let o=Vi(i?zi(t):t,-n).sort(dt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new fe(o,s):ve}function dt(t,e){return t.from-e.from||t.to-e.to}function Ar(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Ns(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ns(e,s,r.copy(i.from,r.to)));break}}}return e}function Ns(t,e,n){for(;e<t.length&&dt(n,t[e])>0;)e++;t.splice(e,0,n)}class ie extends X{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ie.valid(r)?new ie(r):X.near(r)}content(){return K.empty}eq(e){return e instanceof ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ie(e.resolve(n.pos))}getBookmark(){return new Nr(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!mc(e)||!gc(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ie.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(ie.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!J.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(ie.valid(l))return l}return null}}}ie.prototype.visible=!1;ie.findFrom=ie.findGapCursorFrom;X.jsonID("gapcursor",ie);class Nr{constructor(e){this.pos=e}map(e){return new Nr(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ie.valid(n)?new ie(n):X.near(n)}}function _i(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function mc(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||_i(s.type))return!0;if(s.inlineContent)return!1}}return!0}function gc(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||_i(s.type))return!0;if(s.inlineContent)return!1}}return!0}function yc(){return new xn({props:{decorations:vc,createSelectionBetween(t,e,n){return e.pos==n.pos&&ie.valid(n)?new ie(n):null},handleClick:bc,handleKeyDown:xc,handleDOMEvents:{beforeinput:kc}}})}const xc=Ea({ArrowLeft:Wt("horiz",-1),ArrowRight:Wt("horiz",1),ArrowUp:Wt("vert",-1),ArrowDown:Wt("vert",1)});function Wt(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof Q){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ie.findGapCursorFrom(l,e,a);return u?(s&&s(r.tr.setSelection(new ie(u))),!0):!1}}function bc(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ie.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&J.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ie(r))),!0)}function kc(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ie))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=q.empty;for(let o=r.length-1;o>=0;o--)s=q.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new K(s,0,0));return i.setSelection(Q.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function vc(t){if(!(t.selection instanceof ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",fe.create(t.doc,[$e.widget(t.selection.head,e,{key:"gapcursor"})])}const Sc=R.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[yc()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=R.callOrReturn(R.getExtensionField(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),At={bold:{category:"mark",extension:kl,priority:100},italic:{category:"mark",extension:Al,priority:100},strike:{category:"mark",extension:Tl,priority:100},underline:{category:"mark",extension:Fo.Underline,priority:100},code:{category:"mark",extension:Il,priority:100},textColor:{category:"mark",extension:Po.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:$o.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Vo.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ll,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Pl,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Vl,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Bo.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:ta,priority:100},blockquote:{category:"node",extension:ra,priority:100},horizontalRule:{category:"node",extension:sa,priority:100},hardBreak:{category:"node",extension:ia,priority:100},undo:{category:"extension",extension:fs,priority:50},redo:{category:"extension",extension:fs,priority:50},textAlign:{category:"extension",extension:_o.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},Cc=[ma,ga,Rl,jl.configure({HTMLAttributes:{}}),Bl.configure({HTMLAttributes:{}}),zo.TaskItem.configure({nested:!0}),ba,Sc];function wc(t){const e=[],n=new Set,r=new Set;Cc.forEach(l=>{l&&(e.push(l),r.add(l.name))});const s=t.map(l=>Rt(l)),i=new Set;return s.forEach(l=>{const a=At[l];a?.requiredExtensions&&a.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const a=At[l];if(!a||a.extension===null)return;const u=a.extension.name;if(r.has(u)){n.add(l);return}const d=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(d),n.add(l),r.add(u)}),s.forEach(l=>{if(n.has(l))return;const a=At[l];if(!a){console.warn(`Extension config not found for modifier: ${l}`);return}if(a.extension===null){n.add(l);return}const u=a.extension.name;if(r.has(u)){n.add(l);return}const d=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(d),n.add(l),r.add(u)}),e.sort((l,a)=>{const u=Object.values(At).find(m=>m?.extension?.name===l.name),d=Object.values(At).find(m=>m?.extension?.name===a.name),f=u?.priority??100;return(d?.priority??100)-f})}const Hi={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},se={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},Je={brand:{primary:{DEFAULT:"#C14615"}},neutral:{gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",500:"#6B7280",800:"#1F2937"}},palettes:{warning:{200:"#fde68a"}}},te={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},Ac={h1:`font-size: ${se.fontSize["4xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h2:`font-size: ${se.fontSize["2xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h3:`font-size: ${se.fontSize.xl}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h4:`font-size: ${se.fontSize.lg}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h5:`font-size: ${se.fontSize.base}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h6:`font-size: ${se.fontSize.sm}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,p:`min-height: ${se.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${te.xl}; margin: ${te.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${te.xl}; margin: ${te.md} 0;`,li:`display: list-item; margin: ${te.xs} 0;`,strong:`font-weight: ${se.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Je.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${se.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${se.fontFamily.mono};`,pre:`background: ${Je.neutral.gray[800]}; border-radius: ${te.sm}; color: ${Je.neutral.gray[100]}; font-family: ${se.fontFamily.mono}; margin: ${te.lg} 0; padding: 0.75rem ${te.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Je.neutral.gray[300]}; margin: ${te.lg} 0; padding-left: ${te.md}; color: ${Je.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Je.neutral.gray[200]}; margin: ${te.xl} 0;`,a:`color: ${Je.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Je.palettes.warning[200]}; border-radius: ${te.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${te.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Nc={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function Ec(t){if(!t)return t;let e=t;for(const[n,r]of Object.entries(Nc)){const s=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");e=e.replace(s,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${r}"`):`${o} style="${r}">`)}for(const[n,r]of Object.entries(Ac)){const s=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");e=e.replace(s,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${r}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${r}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${r}"${i.slice(o)}`}})}return e}const Tc=({modifiers:t,zoom:e,onZoomChange:n,onToolbarAction:r})=>{const{editor:s}=hr.useCurrentEditor();return c.jsx(ml,{editor:s,modifiers:t,zoom:e,onZoomChange:n,onToolbarAction:r})},Mc=({showCharacterCount:t,showWordCount:e})=>{const{editor:n}=hr.useCurrentEditor();if(!n||!t&&!e)return null;const r=n.getText(),s=r.length,i=r.split(/\s+/).filter(o=>o.length>0).length;return c.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[t&&c.jsxs("span",{children:[s," characters"]}),e&&c.jsxs("span",{children:[i," words"]})]})},ir=v.forwardRef((t,e)=>{const{minRows:n=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=Hi.full,variant:u="bordered",initialContent:d,content:f,onContentChange:p,onUpdate:m,onToolbarAction:C,isReadOnly:b=!1,isDisabled:k=!1,includeInlineStyles:S=!0,...w}=t,{zoom:j,setZoom:N}=fl(),D=Jr.lineHeight,L=n*D,O=s?void 0:r*D,z=v.useMemo(()=>wc(a),[a]),{Component:H,label:U,shouldLabelBeOutside:P,getBaseProps:M,getLabelProps:F,getInputWrapperProps:$}=y.useInput({...w,variant:u,ref:e,isMultiline:!0}),B=U?c.jsx("label",{...F(),children:U}):null,Y=v.useCallback(({editor:W})=>{const ye=W.getHTML(),de=S?Ec(ye):ye,xe=W.getJSON(),qe=W.getText(),pt=qe.length,Ct=qe.split(/\s+/).filter(we=>we.length>0).length,ne={html:de,json:xe,text:qe,characters:pt,words:Ct};if(p?.(ne),m?.(ne),"onChange"in w&&typeof w.onChange=="function"){const we={target:{value:de},currentTarget:{value:de}};w.onChange(we)}},[p,m,w,S]);return c.jsxs(H,{...M(),children:[P?B:null,c.jsx("div",{...$(),className:y.cn($().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:O?`${O+Jr.toolbarHeight}px`:void 0,overflow:O?"auto":void 0},children:c.jsx(hr.EditorProvider,{editable:!b&&!k,slotBefore:l?c.jsx(Tc,{modifiers:a,zoom:j,onZoomChange:N,onToolbarAction:C}):void 0,slotAfter:c.jsx(Mc,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${L}px`,fontSize:`${j}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:z,content:f||d||t.defaultValue||"",onUpdate:Y})})]})});ir.displayName="TipTapEditor";const Ui=v.forwardRef((t,e)=>{const{adapter:n="tiptap",variant:r="bordered",...s}=t;return n==="tiptap"?c.jsx(ir,{...s,variant:r,ref:e}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),c.jsx(ir,{...s,variant:r,ref:e}))});Ui.displayName="RichTextArea";function Oc(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}const Es=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Ic={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},qi=({presetAmounts:t=Es,selectedDonation:e,defaultSelectedDonation:n=null,onChange:r,currency:s="USD",locale:i="en-US",showCustomAmount:o=!0,minCustomAmount:l=.5,maxCustomAmount:a=1e6,labels:u,mobileColumns:d=2,desktopColumns:f=3,isDisabled:p=!1,buttonVariant:m="bordered",buttonColor:C="default",inputVariant:b="bordered",className:k="",showCard:S=!0})=>{const w={...Ic,...u},j=Array.isArray(t)?t:Es,N={2:"grid-cols-2",3:"grid-cols-3"},D={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},L=`${N[d]} ${D[f]}`,[O,z]=pr(e,n,r),[H,U]=v.useState(""),P=v.useCallback(B=>{if(p)return;const Y={amount:B.amount,isCustom:!1,presetId:B.id};z(Y),U("")},[p,z]),M=v.useCallback(B=>{if(p)return;if(U(B!==void 0?String(B):""),B===void 0||isNaN(B)){z(null);return}z({amount:B,isCustom:!0})},[p,z]),F=v.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),$=c.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&c.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),j.length>0&&c.jsx("div",{className:y.cn("grid gap-3",L),"data-testid":"donation-amounts-presets",children:j.map(B=>{const Y=O!==null&&!O.isCustom&&O.presetId===B.id;return c.jsx(oe,{color:Y?"primary":C,variant:Y?"solid":m,className:"w-full",onPress:()=>P(B),isDisabled:p,"data-testid":`donation-amounts-preset-${B.id}`,children:B.label||Oc(B.amount,i,s)},B.id)})}),o&&c.jsx(y.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,variant:b,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:F,value:H!==""?parseFloat(H):void 0,onValueChange:M,isDisabled:p,"data-testid":"donation-amounts-custom-input"},O?.isCustom===!1?O.presetId:"custom")]});return S?c.jsx(y.Card,{className:y.cn("w-full",k),"data-testid":"donation-amounts-card",children:c.jsx(y.CardBody,{children:$})}):c.jsx("div",{className:y.cn("w-full",k),"data-testid":"donation-amounts-plain",children:$})};qi.displayName="DonationAmounts";const Dc=t=>{const e=Math.max(0,t),n=Math.floor(e/60).toString().padStart(2,"0"),r=(e%60).toString().padStart(2,"0");return`${n}:${r} minutes`},jc=t=>{switch(t){case"warning":return _.Clock;case"error":return _.AlertCircle;case"success":return _.CheckCircle;default:return _.Clock}},Lc=t=>{switch(t){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ki=v.forwardRef(({timeLeft:t,defaultTimeLeft:e=1200,onTimeChange:n,onExpire:r,variant:s="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:a,position:u="fixed",autoStart:d=!0,formatTime:f=Dc,className:p,...m},C)=>{const[b,k]=pr(t!==void 0?Math.max(0,t):void 0,Math.max(0,e),n),S=v.useRef(null),w=v.useRef(!1);v.useEffect(()=>()=>{S.current&&clearInterval(S.current)},[]),v.useEffect(()=>{if(!d||b<=0){S.current&&(clearInterval(S.current),S.current=null);return}return S.current=setInterval(()=>{k(L=>L<=1?(S.current&&(clearInterval(S.current),S.current=null),w.current||(w.current=!0,r?.()),0):L-1)},1e3),()=>{S.current&&(clearInterval(S.current),S.current=null)}},[d,b,k,r]),v.useEffect(()=>{b>0&&(w.current=!1)},[b]);const j=a||jc(s),N=Lc(i),D={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return c.jsx("div",{ref:C,role:"banner","aria-live":"polite","aria-label":`${o} ${f(b)}`,"data-testid":"expire-cart-timer",className:y.cn("w-full text-white z-50",N,D[u],p),...m,children:c.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:c.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&c.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:c.jsx(j,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),c.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),c.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:c.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(b)}`,"data-testid":"expire-cart-timer-value",children:f(b)})})]})})})});Ki.displayName="ExpireCartTimer";function Rc(t,e){const n=t.icons,r=t.aliases||Object.create(null),s=Object.create(null);function i(o){if(n[o])return s[o]=[];if(!(o in s)){s[o]=null;const l=r[o]&&r[o].parent,a=l&&i(l);a&&(s[o]=[l].concat(a))}return s[o]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}const Ji=Object.freeze({left:0,top:0,width:16,height:16}),fn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Er=Object.freeze({...Ji,...fn}),or=Object.freeze({...Er,body:"",hidden:!1});function Fc(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const r=((t.rotate||0)+(e.rotate||0))%4;return r&&(n.rotate=r),n}function Ts(t,e){const n=Fc(t,e);for(const r in or)r in fn?r in t&&!(r in n)&&(n[r]=fn[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function Pc(t,e,n){const r=t.icons,s=t.aliases||Object.create(null);let i={};function o(l){i=Ts(r[l]||s[l],i)}return o(e),n.forEach(o),Ts(t,i)}function Wi(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(s=>{e(s,null),n.push(s)});const r=Rc(t);for(const s in r){const i=r[s];i&&(e(s,Pc(t,s,i)),n.push(s))}return n}const $c={provider:"",aliases:{},not_found:{},...Ji};function Hn(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Gi(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Hn(t,$c))return null;const n=e.icons;for(const s in n){const i=n[s];if(!s||typeof i.body!="string"||!Hn(i,or))return null}const r=e.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s||typeof o!="string"||!n[o]&&!r[o]||!Hn(i,or))return null}return e}const Ms=Object.create(null);function Vc(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function St(t,e){const n=Ms[t]||(Ms[t]=Object.create(null));return n[e]||(n[e]=Vc(t,e))}function Zi(t,e){return Gi(e)?Wi(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function Bc(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}const Qi=/^[a-z0-9]+(-[a-z0-9]+)*$/,vn=(t,e,n,r="")=>{const s=t.split(":");if(t.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const l=s.pop(),a=s.pop(),u={provider:s.length>0?s[0]:r,prefix:a,name:l};return e&&!Yt(u)?null:u}const i=s[0],o=i.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return e&&!Yt(l)?null:l}if(n&&r===""){const l={provider:r,prefix:"",name:i};return e&&!Yt(l,n)?null:l}return null},Yt=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;let zt=!1;function Xi(t){return typeof t=="boolean"&&(zt=t),zt}function Os(t){const e=typeof t=="string"?vn(t,!0,zt):t;if(e){const n=St(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function zc(t,e){const n=vn(t,!0,zt);if(!n)return!1;const r=St(n.provider,n.prefix);return e?Bc(r,n.name,e):(r.missing.add(n.name),!0)}function _c(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),zt&&!e&&!t.prefix){let s=!1;return Gi(t)&&(t.prefix="",Wi(t,(i,o)=>{zc(i,o)&&(s=!0)})),s}const n=t.prefix;if(!Yt({prefix:n,name:"a"}))return!1;const r=St(e,n);return!!Zi(r,t)}const Yi=Object.freeze({width:null,height:null}),eo=Object.freeze({...Yi,...fn}),Hc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Uc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Is(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(Hc);if(r===null||!r.length)return t;const s=[];let i=r.shift(),o=Uc.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?s.push(i):s.push(Math.ceil(l*e*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}function qc(t,e="defs"){let n="";const r=t.indexOf("<"+e);for(;r>=0;){const s=t.indexOf(">",r),i=t.indexOf("</"+e);if(s===-1||i===-1)break;const o=t.indexOf(">",i);if(o===-1)break;n+=t.slice(s+1,i).trim(),t=t.slice(0,r).trim()+t.slice(o+1)}return{defs:n,content:t}}function Kc(t,e){return t?"<defs>"+t+"</defs>"+e:e}function Jc(t,e,n){const r=qc(t);return Kc(r.defs,e+r.content+n)}const Wc=t=>t==="unset"||t==="undefined"||t==="none";function Gc(t,e){const n={...Er,...t},r={...eo,...e},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(b=>{const k=[],S=b.hFlip,w=b.vFlip;let j=b.rotate;S?w?j+=2:(k.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),k.push("scale(-1 1)"),s.top=s.left=0):w&&(k.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),k.push("scale(1 -1)"),s.top=s.left=0);let N;switch(j<0&&(j-=Math.floor(j/4)*4),j=j%4,j){case 1:N=s.height/2+s.top,k.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:k.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:N=s.width/2+s.left,k.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}j%2===1&&(s.left!==s.top&&(N=s.left,s.left=s.top,s.top=N),s.width!==s.height&&(N=s.width,s.width=s.height,s.height=N)),k.length&&(i=Jc(i,'<g transform="'+k.join(" ")+'">',"</g>"))});const o=r.width,l=r.height,a=s.width,u=s.height;let d,f;o===null?(f=l===null?"1em":l==="auto"?u:l,d=Is(f,a/u)):(d=o==="auto"?a:o,f=l===null?Is(d,u/a):l==="auto"?u:l);const p={},m=(b,k)=>{Wc(k)||(p[b]=k.toString())};m("width",d),m("height",f);const C=[s.left,s.top,a,u];return p.viewBox=C.join(" "),{attributes:p,viewBox:C,body:i}}const Zc=/\sid="(\S+)"/g,Qc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Xc=0;function Yc(t,e=Qc){const n=[];let r;for(;r=Zc.exec(t);)n.push(r[1]);if(!n.length)return t;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof e=="function"?e(i):e+(Xc++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),t=t.replace(new RegExp(s,"g"),""),t}const lr=Object.create(null);function eu(t,e){lr[t]=e}function ar(t){return lr[t]||lr[""]}function Tr(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const Mr=Object.create(null),Nt=["https://api.simplesvg.com","https://api.unisvg.com"],en=[];for(;Nt.length>0;)Nt.length===1||Math.random()>.5?en.push(Nt.shift()):en.push(Nt.pop());Mr[""]=Tr({resources:["https://api.iconify.design"].concat(en)});function tu(t,e){const n=Tr(e);return n===null?!1:(Mr[t]=n,!0)}function Or(t){return Mr[t]}const nu=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let Ds=nu();function ru(t,e){const n=Or(t);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(o=>{s=Math.max(s,o.length)});const i=e+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function su(t){return t===404}const iu=(t,e,n)=>{const r=[],s=ru(t,e),i="icons";let o={type:i,provider:t,prefix:e,icons:[]},l=0;return n.forEach((a,u)=>{l+=a.length+1,l>=s&&u>0&&(r.push(o),o={type:i,provider:t,prefix:e,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function ou(t){if(typeof t=="string"){const e=Or(t);if(e)return e.path}return"/"}const lu=(t,e,n)=>{if(!Ds){n("abort",424);return}let r=ou(e.provider);switch(e.type){case"icons":{const i=e.prefix,l=e.icons.join(","),a=new URLSearchParams({icons:l});r+=i+".json?"+a.toString();break}case"custom":{const i=e.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;Ds(t+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(su(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},au={prepare:iu,send:lu};function to(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==e))})}function cu(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const r=t.provider,s=t.prefix;e.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==s)return!0;const u=a.name;if(t.icons[u])o.loaded.push({provider:r,prefix:s,name:u});else if(t.missing.has(u))o.missing.push({provider:r,prefix:s,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||to([t],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let uu=0;function du(t,e,n){const r=uu++,s=to.bind(null,n,r);if(!e.pending.length)return s;const i={id:r,icons:e,callback:t,abort:s};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function fu(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return t.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,l=s.name,a=n[i]||(n[i]=Object.create(null)),u=a[o]||(a[o]=St(i,o));let d;l in u.icons?d=e.loaded:o===""||u.missing.has(l)?d=e.missing:d=e.pending;const f={provider:i,prefix:o,name:l};d.push(f)}),e}function hu(t,e=!0,n=!1){const r=[];return t.forEach(s=>{const i=typeof s=="string"?vn(s,e,n):s;i&&r.push(i)}),r}const pu={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function mu(t,e,n,r){const s=t.resources.length,i=t.random?Math.floor(Math.random()*s):t.index;let o;if(t.random){let L=t.resources.slice(0);for(o=[];L.length>1;){const O=Math.floor(Math.random()*L.length);o.push(L[O]),L=L.slice(0,O).concat(L.slice(O+1))}o=o.concat(L)}else o=t.resources.slice(i).concat(t.resources.slice(0,i));const l=Date.now();let a="pending",u=0,d,f=null,p=[],m=[];typeof r=="function"&&m.push(r);function C(){f&&(clearTimeout(f),f=null)}function b(){a==="pending"&&(a="aborted"),C(),p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function k(L,O){O&&(m=[]),typeof L=="function"&&m.push(L)}function S(){return{startTime:l,payload:e,status:a,queriesSent:u,queriesPending:p.length,subscribe:k,abort:b}}function w(){a="failed",m.forEach(L=>{L(void 0,d)})}function j(){p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function N(L,O,z){const H=O!=="success";switch(p=p.filter(U=>U!==L),a){case"pending":break;case"failed":if(H||!t.dataAfterTimeout)return;break;default:return}if(O==="abort"){d=z,w();return}if(H){d=z,p.length||(o.length?D():w());return}if(C(),j(),!t.random){const U=t.resources.indexOf(L.resource);U!==-1&&U!==t.index&&(t.index=U)}a="completed",m.forEach(U=>{U(z)})}function D(){if(a!=="pending")return;C();const L=o.shift();if(L===void 0){if(p.length){f=setTimeout(()=>{C(),a==="pending"&&(j(),w())},t.timeout);return}w();return}const O={status:"pending",resource:L,callback:(z,H)=>{N(O,z,H)}};p.push(O),u++,f=setTimeout(D,t.rotate),n(L,e,O.callback)}return setTimeout(D),S}function no(t){const e={...pu,...t};let n=[];function r(){n=n.filter(l=>l().status==="pending")}function s(l,a,u){const d=mu(e,l,a,(f,p)=>{r(),u&&u(f,p)});return n.push(d),d}function i(l){return n.find(a=>l(a))||null}return{query:s,find:i,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:r}}function js(){}const Un=Object.create(null);function gu(t){if(!Un[t]){const e=Or(t);if(!e)return;const n=no(e),r={config:e,redundancy:n};Un[t]=r}return Un[t]}function yu(t,e,n){let r,s;if(typeof t=="string"){const i=ar(t);if(!i)return n(void 0,424),js;s=i.send;const o=gu(t);o&&(r=o.redundancy)}else{const i=Tr(t);if(i){r=no(i);const o=t.resources?t.resources[0]:"",l=ar(o);l&&(s=l.send)}}return!r||!s?(n(void 0,424),js):r.query(e,s,n)().abort}function Ls(){}function xu(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,cu(t)}))}function bu(t){const e=[],n=[];return t.forEach(r=>{(r.match(Qi)?e:n).push(r)}),{valid:e,invalid:n}}function Et(t,e,n){function r(){const s=t.pendingIcons;e.forEach(i=>{s&&s.delete(i),t.icons[i]||t.missing.add(i)})}if(n&&typeof n=="object")try{if(!Zi(t,n).length){r();return}}catch(s){console.error(s)}r(),xu(t)}function Rs(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function ku(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:r}=t,s=t.iconsToLoad;if(delete t.iconsToLoad,!s||!s.length)return;const i=t.loadIcon;if(t.loadIcons&&(s.length>1||!i)){Rs(t.loadIcons(s,r,n),d=>{Et(t,s,d)});return}if(i){s.forEach(d=>{const f=i(d,r,n);Rs(f,p=>{const m=p?{prefix:r,icons:{[d]:p}}:null;Et(t,[d],m)})});return}const{valid:o,invalid:l}=bu(s);if(l.length&&Et(t,l,null),!o.length)return;const a=r.match(Qi)?ar(n):null;if(!a){Et(t,o,null);return}a.prepare(n,r,o).forEach(d=>{yu(n,d,f=>{Et(t,d.icons,f)})})}))}const vu=(t,e)=>{const n=hu(t,!0,Xi()),r=fu(n);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,Ls)}),()=>{a=!1}}const s=Object.create(null),i=[];let o,l;return r.pending.forEach(a=>{const{provider:u,prefix:d}=a;if(d===l&&u===o)return;o=u,l=d,i.push(St(u,d));const f=s[u]||(s[u]=Object.create(null));f[d]||(f[d]=[])}),r.pending.forEach(a=>{const{provider:u,prefix:d,name:f}=a,p=St(u,d),m=p.pendingIcons||(p.pendingIcons=new Set);m.has(f)||(m.add(f),s[u][d].push(f))}),i.forEach(a=>{const u=s[a.provider][a.prefix];u.length&&ku(a,u)}),e?du(e,r,i):Ls};function Su(t,e){const n={...t};for(const r in e){const s=e[r],i=typeof s;r in Yi?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const Cu=/[\s,]+/;function wu(t,e){e.split(Cu).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Au(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(t);return isNaN(s)?0:r(s)}else if(n!==t){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return e}function Nu(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function Eu(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Tu(t){return"data:image/svg+xml,"+Eu(t)}function Mu(t){return'url("'+Tu(t)+'")'}let Dt;function Ou(){try{Dt=window.trustedTypes.createPolicy("iconify",{createHTML:t=>t})}catch{Dt=null}}function Iu(t){return Dt===void 0&&Ou(),Dt?Dt.createHTML(t):t}const ro={...eo,inline:!1},Du={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ju={display:"inline-block"},cr={backgroundColor:"currentColor"},so={backgroundColor:"transparent"},Fs={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ps={WebkitMask:cr,mask:cr,background:so};for(const t in Ps){const e=Ps[t];for(const n in Fs)e[t+n]=Fs[n]}const Lu={...ro,inline:!0};function $s(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const Ru=(t,e,n)=>{const r=e.inline?Lu:ro,s=Su(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?Du:{}};if(n){const k=vn(n,!1,!0);if(k){const S=["iconify"],w=["provider","prefix"];for(const j of w)k[j]&&S.push("iconify--"+k[j]);a.className=S.join(" ")}}for(let k in e){const S=e[k];if(S!==void 0)switch(k){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":a.ref=S;break;case"className":a[k]=(a[k]?a[k]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":s[k]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&wu(s,S);break;case"color":o.color=S;break;case"rotate":typeof S=="string"?s[k]=Au(S):typeof S=="number"&&(s[k]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete a["aria-hidden"];break;default:r[k]===void 0&&(a[k]=S)}}const u=Gc(t,s),d=u.attributes;if(s.inline&&(o.verticalAlign="-0.125em"),i==="svg"){a.style={...o,...l},Object.assign(a,d);let k=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),a.dangerouslySetInnerHTML={__html:Iu(Yc(u.body,S?()=>S+"ID"+k++:"iconifyReact"))},v.createElement("svg",a)}const{body:f,width:p,height:m}=t,C=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),b=Nu(f,{...d,width:p+"",height:m+""});return a.style={...o,"--svg":Mu(b),width:$s(d.width),height:$s(d.height),...ju,...C?cr:so,...l},v.createElement("span",a)};Xi(!0);eu("",au);if(typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!_c(r))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const r="IconifyProviders["+n+"] is invalid.";try{const s=e[n];if(typeof s!="object"||!s||s.resources===void 0)continue;tu(n,s)||console.error(r)}catch{console.error(r)}}}}function io(t){const[e,n]=v.useState(!!t.ssr),[r,s]=v.useState({});function i(m){if(m){const C=t.icon;if(typeof C=="object")return{name:"",data:C};const b=Os(C);if(b)return{name:C,data:b}}return{name:""}}const[o,l]=v.useState(i(!!t.ssr));function a(){const m=r.callback;m&&(m(),s({}))}function u(m){if(JSON.stringify(o)!==JSON.stringify(m))return a(),l(m),!0}function d(){var m;const C=t.icon;if(typeof C=="object"){u({name:"",data:C});return}const b=Os(C);if(u({name:C,data:b}))if(b===void 0){const k=vu([C],d);s({callback:k})}else b&&((m=t.onLoad)===null||m===void 0||m.call(t,C))}v.useEffect(()=>(n(!0),a),[]),v.useEffect(()=>{e&&d()},[t.icon,e]);const{name:f,data:p}=o;return p?Ru({...Er,...p},t,f):t.children?t.children:t.fallback?t.fallback:v.createElement("span",{})}const Ie=v.forwardRef((t,e)=>io({...t,_ref:e}));v.forwardRef((t,e)=>io({inline:!0,...t,_ref:e}));const qn=({icon:t,children:e,testId:n})=>c.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[c.jsx(Ie,{icon:t,width:20,className:"text-default-500"}),c.jsx("span",{children:e})]}),Fu=({classes:t="",name:e,imageUrl:n,eventDate:r,eventTime:s,location:i,description:o,showImage:l=!1,showMoreButtonClassName:a,labels:u})=>{const[d,f]=v.useState(!1),[p,m]=v.useState(!1),C=v.useRef(null);return v.useEffect(()=>{const b=()=>{if(C.current){const k=C.current.scrollHeight>C.current.clientHeight;m(k)}};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[o]),c.jsxs(y.Card,{className:y.cn("border-0 shadow-none",t),"data-testid":"event-details-root",children:[c.jsxs(y.CardHeader,{className:"pt-2 pb-0 flex-col items-start space-y-2","data-testid":"event-details-header",children:[l&&n&&c.jsx("div",{className:"w-full aspect-[3/1] overflow-hidden rounded-xl","data-testid":"event-details-image-wrapper",children:c.jsx(y.Image,{alt:`Event image for ${e}`,className:"w-full h-full object-cover",src:n,"data-testid":"event-details-image"})}),c.jsx("h2",{className:"font-semibold text-xl text-gray-800","data-testid":"event-details-title",children:e})]}),c.jsxs(y.CardBody,{className:"py-3 space-y-3","data-testid":"event-details-body",children:[c.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:u.eventInformation}),c.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[r&&c.jsx(qn,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:r}),s&&c.jsx(qn,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:s}),i&&c.jsx(qn,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&c.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[c.jsx("div",{ref:C,className:y.cn("text-sm text-gray-700 leading-relaxed transition-all",!d&&"line-clamp-2"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),(p||d)&&c.jsx("div",{className:"flex justify-end mt-1",children:c.jsx(oe,{onPress:()=>f(!d),variant:"light",className:y.cn("text-primary",a),startContent:c.jsx(Ie,{icon:d?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:d?u.showLess||"Hide":u.showMore||"Show"})})]})]})]})};function oo(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}function Pu(t){const e=t.replace(/[^\d.,-]/g,""),n=e.match(/,\d{1,2}$/);let r;n?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");const s=parseFloat(r);return isNaN(s)?null:s}const $u={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached"},Gt=t=>typeof t=="number"&&!isNaN(t),Ir=({offer:t,quantity:e,defaultQuantity:n=0,onQuantityChange:r,currency:s="USD",locale:i="en-US",labels:o,slots:l,isDisabled:a=!1,buttonVariant:u="bordered",buttonColor:d="default",showCard:f=!0,showDescription:p=!0,showPeopleCount:m=!0,showPrice:C=!0,classNames:b={},"data-testid":k,selectedColor:S="default"})=>{const w={...$u,...o},[j,N]=v.useState(n),D=e!==void 0?e:j,L=de=>{if(a)return;const xe=Math.max(0,D+de);e===void 0&&N(xe),r?.(t.id,xe)},O=v.useMemo(()=>!Gt(t.totalTicketsSold)||!Gt(t.ticketsAllowed)?!1:t.totalTicketsSold>=t.ticketsAllowed,[t.totalTicketsSold,t.ticketsAllowed]),z=v.useMemo(()=>O||!Gt(t.ticketsAllowed)?!1:D>=t.ticketsAllowed-(t.totalTicketsSold??0),[O,t.ticketsAllowed,t.totalTicketsSold,D]),H=oo(t.price,i,s),U=()=>l?.renderName?l.renderName(t.name,t):c.jsx("h2",{"data-testid":"offer-card-name",className:y.cn("text-base font-medium",b.name),children:t.name}),P=()=>C?l?.renderPrice?l.renderPrice(t.price,H,t):c.jsx("p",{"data-testid":"offer-card-price",className:y.cn("text-primary text-base mt-1",b.price),children:H}):null,M=()=>!p||!t.description?null:l?.renderDescription?l.renderDescription(t.description,t):c.jsx("p",{"data-testid":"offer-card-description",className:y.cn("mb-4 text-sm text-gray-700 leading-relaxed",b.description),children:t.description}),F=()=>{if(!m||!Gt(t.numberOfPeople)||t.numberOfPeople<=0)return null;const de=t.numberOfPeople===1?w.person:w.people;return l?.renderPeopleCount?l.renderPeopleCount(t.numberOfPeople,de,t):c.jsxs("p",{"data-testid":"offer-card-people-count",className:y.cn("text-sm text-gray-600 flex items-center mt-2",b.peopleCount),children:[c.jsx(Ie,{icon:t.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),t.numberOfPeople," ",de]})},$=()=>{const de=D===0||a,xe=z||a;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:D,onIncrement:()=>L(1),onDecrement:()=>L(-1),isDecrementDisabled:de,isIncrementDisabled:xe,isDisabled:a}):c.jsxs("div",{className:y.cn("flex items-center gap-2",b.quantitySelector),children:[c.jsx(oe,{"data-testid":"offer-card-decrement-button",onPress:()=>L(-1),isDisabled:de,variant:u,color:D>0?S:d,radius:"full",isIconOnly:!0,size:"sm","aria-label":"Decrease quantity",children:c.jsx(Ie,{icon:"gravity-ui:minus",width:16})}),c.jsx("span",{"data-testid":"offer-card-quantity",className:y.cn("min-w-[2rem] text-center font-medium"),children:D}),c.jsx(oe,{"data-testid":"offer-card-increment-button",onPress:()=>L(1),isDisabled:xe,variant:u,color:D>0?S:d,radius:"full",isIconOnly:!0,size:"sm","aria-label":"Increase quantity",children:c.jsx(Ie,{icon:"gravity-ui:plus",width:16})})]})},B=()=>l?.renderSoldOut?l.renderSoldOut(w.soldOut):c.jsx(y.Chip,{"data-testid":"offer-card-sold-out-chip",color:"danger",className:y.cn("gap-2 px-4 h-8",b.soldOut),startContent:c.jsx(Ie,{icon:"gravity-ui:circle-info-fill",width:14}),children:c.jsx("span",{className:"font-medium text-sm",children:w.soldOut})}),Y=()=>l?.renderMaxReachedAlert?l.renderMaxReachedAlert(w.maxReached):c.jsx(y.Chip,{"data-testid":"offer-card-max-reached-chip",variant:"flat",color:"warning",classNames:{base:"gap-2 px-4 h-10",content:"text-black"},className:y.cn(" text-black! gap-2 px-4 h-10",b.maxReachedAlert),startContent:c.jsx(Ie,{icon:"gravity-ui:triangle-exclamation-fill",className:"text-black",width:16}),children:c.jsx("span",{className:"font-medium text-sm",children:w.maxReached})}),W=c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 gap-2 items-start",children:[c.jsxs("div",{className:y.cn("h-full col-span-2",O?"opacity-50 pointer-events-none select-none":""),children:[U(),P(),c.jsxs("div",{className:y.cn("md:col-span-1 xl:col-span-2 lg:col-span-1 mb-2",O?"opacity-50 pointer-events-none select-none":""),children:[F(),M()]})]}),c.jsx("div",{className:"space-x-2 p-2 h-full flex items-center justify-start md:justify-start lg:justify-end ",children:O?B():$()})]}),ye=z&&!O&&c.jsx(Re.motion.div,{className:"w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Y()});return f?c.jsxs(y.Card,{className:y.cn("w-full",b.base),"data-testid":k||`offer-card-${t.id}`,children:[c.jsx(y.CardBody,{className:y.cn("pt-1 pb-0",b.body),children:W}),c.jsx(Re.AnimatePresence,{children:ye&&c.jsx(y.CardFooter,{className:y.cn("w-full mt-0 pt-0",b.footer),children:ye})})]}):c.jsxs("div",{className:y.cn("w-full",b.base),"data-testid":k||`offer-card-${t.id}`,children:[c.jsx("div",{className:y.cn("pt-1 pb-0",b.body),children:W}),c.jsx(Re.AnimatePresence,{children:ye&&c.jsx("div",{className:y.cn("w-full mt-0 pt-0",b.footer),children:ye})})]})};Ir.displayName="OfferCard";const lo=({message:t="No offers available.",icon:e="solar:ticket-sale-outline",iconSize:n=48,showCard:r=!0,classNames:s={},renderEmpty:i})=>{if(i){const l=i();return r?c.jsx(y.Card,{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):c.jsx("div",{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:l})}const o=c.jsxs("div",{"data-testid":"offer-card-empty-content",className:y.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",s.content),children:[c.jsx(Ie,{"data-testid":"offer-card-empty-icon",icon:e,width:n,className:y.cn("mb-4",s.icon)}),c.jsx("h3",{"data-testid":"offer-card-empty-message",className:y.cn("text-lg",s.message),children:t})]});return r?c.jsx(y.Card,{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):c.jsx("div",{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:o})};lo.displayName="OfferCardEmpty";const Vu={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ao=({error:t,labels:e,showCard:n=!0,color:r="danger",classNames:s={}})=>{const i={...Vu,...e},o=c.jsx(y.Alert,{"data-testid":"offer-card-error-alert",color:r,title:i.title,description:t||i.description,className:s.alert});return n?c.jsx(y.Card,{"data-testid":"offer-card-error",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{"data-testid":"offer-card-error-body",children:o})}):c.jsx("div",{"data-testid":"offer-card-error",className:y.cn("w-full",s.base),children:o})};ao.displayName="OfferCardError";const Bu={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},co=({quantity:t=2,gap:e=4,classNames:n={}})=>{const r=Bu[e];return c.jsx("div",{"data-testid":"offer-card-skeleton-container",className:y.cn(r,n.base),children:Array.from({length:t}).map((s,i)=>c.jsxs(y.Card,{"data-testid":`offer-card-skeleton-${i}`,className:y.cn("w-full",n.card),children:[c.jsx(y.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:c.jsxs("div",{className:"space-y-2 w-full",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:c.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:c.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),c.jsx(y.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:c.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[c.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:c.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:c.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),c.jsx("div",{className:"flex items-start justify-end",children:c.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};co.displayName="OfferCardSkeleton";const uo={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},fo={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},zu={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},ho=({offers:t=[],selection:e,defaultSelection:n={},onSelectionChange:r,onQuantityChange:s,currency:i="USD",locale:o="en-US",labels:l,slots:a,isDisabled:u=!1,buttonVariant:d="bordered",buttonColor:f="default",showCard:p=!0,animated:m=!0,gap:C=2,classNames:b={}})=>{const[k,S]=v.useState(n),w=e!==void 0?e:k,j=v.useCallback((z,H)=>{const U={...w,[z]:Math.max(0,H)};e===void 0&&S(U),r?.(U),s?.(z,U[z])},[w,e,r,s]),N=[...t].sort((z,H)=>(z.position??0)-(H.position??0)),D=zu[C],L=y.cn("grid mx-auto pt-2",D,b.base),O=z=>c.jsx(Ir,{offer:z,quantity:w[z.id]||0,onQuantityChange:j,currency:i,locale:o,labels:l,slots:a,isDisabled:u,buttonVariant:d,buttonColor:f,showCard:p,classNames:b.card},z.id);return m?c.jsx(Re.motion.div,{"data-testid":"offer-card-list",className:L,variants:uo,initial:"hidden",animate:"show",children:c.jsx(Re.AnimatePresence,{children:N.map(z=>c.jsx(Re.motion.div,{"data-testid":`offer-card-list-item-${z.id}`,className:b.cardWrapper,variants:fo,exit:{opacity:0,y:-20},transition:{duration:.3},children:O(z)},z.id))})}):c.jsx("div",{"data-testid":"offer-card-list",className:L,children:N.map(O)})};ho.displayName="OfferCardList";var Ut=t=>t.type==="checkbox",at=t=>t instanceof Date,Ce=t=>t==null;const po=t=>typeof t=="object";var ue=t=>!Ce(t)&&!Array.isArray(t)&&po(t)&&!at(t),mo=t=>ue(t)&&t.target?Ut(t.target)?t.target.checked:t.target.value:t,_u=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,go=(t,e)=>t.has(_u(e)),Hu=t=>{const e=t.constructor&&t.constructor.prototype;return ue(e)&&e.hasOwnProperty("isPrototypeOf")},Dr=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function le(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Dr&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(ue(t)&&Hu(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=le(t[s]));return r}var Sn=t=>/^\w*$/.test(t),re=t=>t===void 0,jr=t=>Array.isArray(t)?t.filter(Boolean):[],Lr=t=>jr(t.replace(/["|']|\]/g,"").split(/\.|\[/)),T=(t,e,n)=>{if(!e||!ue(t))return n;const r=(Sn(e)?[e]:Lr(e)).reduce((s,i)=>Ce(s)?s:s[i],t);return re(r)||r===t?re(t[e])?n:t[e]:r},Ae=t=>typeof t=="boolean",Se=t=>typeof t=="function",ee=(t,e,n)=>{let r=-1;const s=Sn(e)?[e]:Lr(e),i=s.length,o=i-1;for(;++r<i;){const l=s[r];let a=n;if(r!==o){const u=t[l];a=ue(u)||Array.isArray(u)?u:isNaN(+s[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=a,t=t[l]}};const hn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},je={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ze={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},yo=v.createContext(null);yo.displayName="HookFormControlContext";const Rr=()=>v.useContext(yo);var xo=(t,e,n,r=!0)=>{const s={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(s,i,{get:()=>{const o=i;return e._proxyFormState[o]!==je.all&&(e._proxyFormState[o]=!r||je.all),n&&(n[o]=!0),t[o]}});return s};const Fr=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Uu(t){const e=Rr(),{control:n=e,disabled:r,name:s,exact:i}=t||{},[o,l]=v.useState(n._formState),a=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Fr(()=>n._subscribe({name:s,formState:a.current,exact:i,callback:u=>{!r&&l({...n._formState,...u})}}),[s,r,i]),v.useEffect(()=>{a.current.isValid&&n._setValid(!0)},[n]),v.useMemo(()=>xo(o,n,a.current,!1),[o,n])}var Ee=t=>typeof t=="string",ur=(t,e,n,r,s)=>Ee(t)?(r&&e.watch.add(t),T(n,t,s)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),T(n,i))):(r&&(e.watchAll=!0),n),dr=t=>Ce(t)||!po(t);function Le(t,e,n=new WeakSet){if(dr(t)||dr(e))return Object.is(t,e);if(at(t)&&at(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const i of r){const o=t[i];if(!s.includes(i))return!1;if(i!=="ref"){const l=e[i];if(at(o)&&at(l)||ue(o)&&ue(l)||Array.isArray(o)&&Array.isArray(l)?!Le(o,l,n):!Object.is(o,l))return!1}}return!0}function qu(t){const e=Rr(),{control:n=e,name:r,defaultValue:s,disabled:i,exact:o,compute:l}=t||{},a=v.useRef(s),u=v.useRef(l),d=v.useRef(void 0),f=v.useRef(n),p=v.useRef(r);u.current=l;const[m,C]=v.useState(()=>{const N=n._getWatch(r,a.current);return u.current?u.current(N):N}),b=v.useCallback(N=>{const D=ur(r,n._names,N||n._formValues,!1,a.current);return u.current?u.current(D):D},[n._formValues,n._names,r]),k=v.useCallback(N=>{if(!i){const D=ur(r,n._names,N||n._formValues,!1,a.current);if(u.current){const L=u.current(D);Le(L,d.current)||(C(L),d.current=L)}else C(D)}},[n._formValues,n._names,i,r]);Fr(()=>((f.current!==n||!Le(p.current,r))&&(f.current=n,p.current=r,k()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:N=>{k(N.values)}})),[n,o,r,k]),v.useEffect(()=>n._removeUnmounted());const S=f.current!==n,w=p.current,j=v.useMemo(()=>{if(i)return null;const N=!S&&!Le(w,r);return S||N?b():null},[i,S,r,w,b]);return j!==null?j:m}function Ku(t){const e=Rr(),{name:n,disabled:r,control:s=e,shouldUnregister:i,defaultValue:o,exact:l=!0}=t,a=go(s._names.array,n),u=v.useMemo(()=>T(s._formValues,n,T(s._defaultValues,n,o)),[s,n,o]),d=qu({control:s,name:n,defaultValue:u,exact:l}),f=Uu({control:s,name:n,exact:l}),p=v.useRef(t),m=v.useRef(void 0),C=v.useRef(s.register(n,{...t.rules,value:d,...Ae(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const b=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!T(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!T(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!T(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!T(f.validatingFields,n)},error:{enumerable:!0,get:()=>T(f.errors,n)}}),[f,n]),k=v.useCallback(N=>C.current.onChange({target:{value:mo(N),name:n},type:hn.CHANGE}),[n]),S=v.useCallback(()=>C.current.onBlur({target:{value:T(s._formValues,n),name:n},type:hn.BLUR}),[n,s._formValues]),w=v.useCallback(N=>{const D=T(s._fields,n);D&&D._f&&N&&(D._f.ref={focus:()=>Se(N.focus)&&N.focus(),select:()=>Se(N.select)&&N.select(),setCustomValidity:L=>Se(N.setCustomValidity)&&N.setCustomValidity(L),reportValidity:()=>Se(N.reportValidity)&&N.reportValidity()})},[s._fields,n]),j=v.useMemo(()=>({name:n,value:d,...Ae(r)||f.disabled?{disabled:f.disabled||r}:{},onChange:k,onBlur:S,ref:w}),[n,r,f.disabled,k,S,w,d]);return v.useEffect(()=>{const N=s._options.shouldUnregister||i,D=m.current;D&&D!==n&&!a&&s.unregister(D),s.register(n,{...p.current.rules,...Ae(p.current.disabled)?{disabled:p.current.disabled}:{}});const L=(O,z)=>{const H=T(s._fields,O);H&&H._f&&(H._f.mount=z)};if(L(n,!0),N){const O=le(T(s._options.defaultValues,n,p.current.defaultValue));ee(s._defaultValues,n,O),re(T(s._formValues,n))&&ee(s._formValues,n,O)}return!a&&s.register(n),m.current=n,()=>{(a?N&&!s._state.action:N)?s.unregister(n):L(n,!1)}},[n,s,a,i]),v.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),v.useMemo(()=>({field:j,formState:f,fieldState:b}),[j,f,b])}const Ju=v.createContext(null);Ju.displayName="HookFormContext";var Wu=(t,e,n,r,s)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:s||!0}}:{},jt=t=>Array.isArray(t)?t:[t],Vs=()=>{let t=[];return{get observers(){return t},next:s=>{for(const i of t)i.next&&i.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(i=>i!==s)}}),unsubscribe:()=>{t=[]}}};function bo(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const s=t[r],i=e[r];if(s&&ue(s)&&i){const o=bo(s,i);ue(o)&&(n[r]=o)}else t[r]&&(n[r]=i)}return n}var ke=t=>ue(t)&&!Object.keys(t).length,Pr=t=>t.type==="file",pn=t=>{if(!Dr)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},ko=t=>t.type==="select-multiple",$r=t=>t.type==="radio",Gu=t=>$r(t)||Ut(t),Kn=t=>pn(t)&&t.isConnected;function Zu(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=re(t)?r++:t[e[r++]];return t}function Qu(t){for(const e in t)if(t.hasOwnProperty(e)&&!re(t[e]))return!1;return!0}function ae(t,e){const n=Array.isArray(e)?e:Sn(e)?[e]:Lr(e),r=n.length===1?t:Zu(t,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(ue(r)&&ke(r)||Array.isArray(r)&&Qu(r))&&ae(t,n.slice(0,-1)),t}var Xu=t=>{for(const e in t)if(Se(t[e]))return!0;return!1};function vo(t){return Array.isArray(t)||ue(t)&&!Xu(t)}function fr(t,e={}){for(const n in t){const r=t[n];vo(r)?(e[n]=Array.isArray(r)?[]:{},fr(r,e[n])):re(r)||(e[n]=!0)}return e}function bt(t,e,n){n||(n=fr(e));for(const r in t){const s=t[r];if(vo(s))re(e)||dr(n[r])?n[r]=fr(s,Array.isArray(s)?[]:{}):bt(s,Ce(e)?{}:e[r],n[r]);else{const i=e[r];n[r]=!Le(s,i)}}return n}const Bs={value:!1,isValid:!1},zs={value:!0,isValid:!0};var So=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!re(t[0].attributes.value)?re(t[0].value)||t[0].value===""?zs:{value:t[0].value,isValid:!0}:zs:Bs}return Bs},Co=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>re(t)?t:e?t===""?NaN:t&&+t:n&&Ee(t)?new Date(t):r?r(t):t;const _s={isValid:!1,value:null};var wo=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,_s):_s;function Hs(t){const e=t.ref;return Pr(e)?e.files:$r(e)?wo(t.refs).value:ko(e)?[...e.selectedOptions].map(({value:n})=>n):Ut(e)?So(t.refs).value:Co(re(e.value)?t.ref.value:e.value,t)}var Yu=(t,e,n,r)=>{const s={};for(const i of t){const o=T(e,i);o&&ee(s,i,o._f)}return{criteriaMode:n,names:[...t],fields:s,shouldUseNativeValidation:r}},mn=t=>t instanceof RegExp,Tt=t=>re(t)?t:mn(t)?t.source:ue(t)?mn(t.value)?t.value.source:t.value:t,Us=t=>({isOnSubmit:!t||t===je.onSubmit,isOnBlur:t===je.onBlur,isOnChange:t===je.onChange,isOnAll:t===je.all,isOnTouch:t===je.onTouched});const qs="AsyncFunction";var ed=t=>!!t&&!!t.validate&&!!(Se(t.validate)&&t.validate.constructor.name===qs||ue(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===qs)),td=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Ks=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Lt=(t,e,n,r)=>{for(const s of n||Object.keys(t)){const i=T(t,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],s)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(Lt(l,e))break}else if(ue(l)&&Lt(l,e))break}}};function Js(t,e,n){const r=T(t,n);if(r||Sn(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=T(e,i),l=T(t,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};s.pop()}return{name:n}}var nd=(t,e,n,r)=>{n(t);const{name:s,...i}=t;return ke(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(o=>e[o]===(!r||je.all))},rd=(t,e,n)=>!t||!e||t===e||jt(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),sd=(t,e,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(e||t):(n?r.isOnBlur:s.isOnBlur)?!t:(n?r.isOnChange:s.isOnChange)?t:!0,id=(t,e)=>!jr(T(t,e)).length&&ae(t,e),od=(t,e,n)=>{const r=jt(T(t,n));return ee(r,"root",e[n]),ee(t,n,r),t};function Ws(t,e,n="validate"){if(Ee(t)||Array.isArray(t)&&t.every(Ee)||Ae(t)&&!t)return{type:n,message:Ee(t)?t:"",ref:e}}var gt=t=>ue(t)&&!mn(t)?t:{value:t,message:""},Gs=async(t,e,n,r,s,i)=>{const{ref:o,refs:l,required:a,maxLength:u,minLength:d,min:f,max:p,pattern:m,validate:C,name:b,valueAsNumber:k,mount:S}=t._f,w=T(n,b);if(!S||e.has(b))return{};const j=l?l[0]:o,N=M=>{s&&j.reportValidity&&(j.setCustomValidity(Ae(M)?"":M||""),j.reportValidity())},D={},L=$r(o),O=Ut(o),z=L||O,H=(k||Pr(o))&&re(o.value)&&re(w)||pn(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,U=Wu.bind(null,b,r,D),P=(M,F,$,B=ze.maxLength,Y=ze.minLength)=>{const W=M?F:$;D[b]={type:M?B:Y,message:W,ref:o,...U(M?B:Y,W)}};if(i?!Array.isArray(w)||!w.length:a&&(!z&&(H||Ce(w))||Ae(w)&&!w||O&&!So(l).isValid||L&&!wo(l).isValid)){const{value:M,message:F}=Ee(a)?{value:!!a,message:a}:gt(a);if(M&&(D[b]={type:ze.required,message:F,ref:j,...U(ze.required,F)},!r))return N(F),D}if(!H&&(!Ce(f)||!Ce(p))){let M,F;const $=gt(p),B=gt(f);if(!Ce(w)&&!isNaN(w)){const Y=o.valueAsNumber||w&&+w;Ce($.value)||(M=Y>$.value),Ce(B.value)||(F=Y<B.value)}else{const Y=o.valueAsDate||new Date(w),W=xe=>new Date(new Date().toDateString()+" "+xe),ye=o.type=="time",de=o.type=="week";Ee($.value)&&w&&(M=ye?W(w)>W($.value):de?w>$.value:Y>new Date($.value)),Ee(B.value)&&w&&(F=ye?W(w)<W(B.value):de?w<B.value:Y<new Date(B.value))}if((M||F)&&(P(!!M,$.message,B.message,ze.max,ze.min),!r))return N(D[b].message),D}if((u||d)&&!H&&(Ee(w)||i&&Array.isArray(w))){const M=gt(u),F=gt(d),$=!Ce(M.value)&&w.length>+M.value,B=!Ce(F.value)&&w.length<+F.value;if(($||B)&&(P($,M.message,F.message),!r))return N(D[b].message),D}if(m&&!H&&Ee(w)){const{value:M,message:F}=gt(m);if(mn(M)&&!w.match(M)&&(D[b]={type:ze.pattern,message:F,ref:o,...U(ze.pattern,F)},!r))return N(F),D}if(C){if(Se(C)){const M=await C(w,n),F=Ws(M,j);if(F&&(D[b]={...F,...U(ze.validate,F.message)},!r))return N(F.message),D}else if(ue(C)){let M={};for(const F in C){if(!ke(M)&&!r)break;const $=Ws(await C[F](w,n),j,F);$&&(M={...$,...U(F,$.message)},N($.message),r&&(D[b]=M))}if(!ke(M)&&(D[b]={ref:j,...M},!r))return D}}return N(!0),D};const ld={mode:je.onSubmit,reValidateMode:je.onChange,shouldFocusError:!0};function ad(t={}){let e={...ld,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Se(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},s=ue(e.defaultValues)||ue(e.values)?le(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:le(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},a,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let p={...f};const m={array:Vs(),state:Vs()},C=e.criteriaMode===je.all,b=h=>g=>{clearTimeout(u),u=setTimeout(h,g)},k=async h=>{if(!o.keepIsValid&&!e.disabled&&(f.isValid||p.isValid||h)){let g;e.resolver?(g=ke((await z()).errors),S()):g=await U(r,!0),g!==n.isValid&&m.state.next({isValid:g})}},S=(h,g)=>{!e.disabled&&(f.isValidating||f.validatingFields||p.isValidating||p.validatingFields)&&((h||Array.from(l.mount)).forEach(x=>{x&&(g?ee(n.validatingFields,x,g):ae(n.validatingFields,x))}),m.state.next({validatingFields:n.validatingFields,isValidating:!ke(n.validatingFields)}))},w=(h,g=[],x,I,E=!0,A=!0)=>{if(I&&x&&!e.disabled){if(o.action=!0,A&&Array.isArray(T(r,h))){const V=x(T(r,h),I.argA,I.argB);E&&ee(r,h,V)}if(A&&Array.isArray(T(n.errors,h))){const V=x(T(n.errors,h),I.argA,I.argB);E&&ee(n.errors,h,V),id(n.errors,h)}if((f.touchedFields||p.touchedFields)&&A&&Array.isArray(T(n.touchedFields,h))){const V=x(T(n.touchedFields,h),I.argA,I.argB);E&&ee(n.touchedFields,h,V)}(f.dirtyFields||p.dirtyFields)&&(n.dirtyFields=bt(s,i)),m.state.next({name:h,isDirty:M(h,g),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ee(i,h,g)},j=(h,g)=>{ee(n.errors,h,g),m.state.next({errors:n.errors})},N=h=>{n.errors=h,m.state.next({errors:n.errors,isValid:!1})},D=(h,g,x,I)=>{const E=T(r,h);if(E){const A=T(i,h,re(x)?T(s,h):x);re(A)||I&&I.defaultChecked||g?ee(i,h,g?A:Hs(E._f)):B(h,A),o.mount&&!o.action&&k()}},L=(h,g,x,I,E)=>{let A=!1,V=!1;const G={name:h};if(!e.disabled){if(!x||I){(f.isDirty||p.isDirty)&&(V=n.isDirty,n.isDirty=G.isDirty=M(),A=V!==G.isDirty);const Z=Le(T(s,h),g);V=!!T(n.dirtyFields,h),Z?ae(n.dirtyFields,h):ee(n.dirtyFields,h,!0),G.dirtyFields=n.dirtyFields,A=A||(f.dirtyFields||p.dirtyFields)&&V!==!Z}if(x){const Z=T(n.touchedFields,h);Z||(ee(n.touchedFields,h,x),G.touchedFields=n.touchedFields,A=A||(f.touchedFields||p.touchedFields)&&Z!==x)}A&&E&&m.state.next(G)}return A?G:{}},O=(h,g,x,I)=>{const E=T(n.errors,h),A=(f.isValid||p.isValid)&&Ae(g)&&n.isValid!==g;if(e.delayError&&x?(a=b(()=>j(h,x)),a(e.delayError)):(clearTimeout(u),a=null,x?ee(n.errors,h,x):ae(n.errors,h)),(x?!Le(E,x):E)||!ke(I)||A){const V={...I,...A&&Ae(g)?{isValid:g}:{},errors:n.errors,name:h};n={...n,...V},m.state.next(V)}},z=async h=>(S(h,!0),await e.resolver(i,e.context,Yu(h||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),H=async h=>{const{errors:g}=await z(h);if(S(h),h)for(const x of h){const I=T(g,x);I?ee(n.errors,x,I):ae(n.errors,x)}else n.errors=g;return g},U=async(h,g,x={valid:!0})=>{for(const I in h){const E=h[I];if(E){const{_f:A,...V}=E;if(A){const G=l.array.has(A.name),Z=E._f&&ed(E._f);Z&&f.validatingFields&&S([A.name],!0);const be=await Gs(E,l.disabled,i,C,e.shouldUseNativeValidation&&!g,G);if(Z&&f.validatingFields&&S([A.name]),be[A.name]&&(x.valid=!1,g||t.shouldUseNativeValidation))break;!g&&(T(be,A.name)?G?od(n.errors,be,A.name):ee(n.errors,A.name,be[A.name]):ae(n.errors,A.name))}!ke(V)&&await U(V,g,x)}}return x.valid},P=()=>{for(const h of l.unMount){const g=T(r,h);g&&(g._f.refs?g._f.refs.every(x=>!Kn(x)):!Kn(g._f.ref))&&wn(h)}l.unMount=new Set},M=(h,g)=>!e.disabled&&(h&&g&&ee(i,h,g),!Le(qe(),s)),F=(h,g,x)=>ur(h,l,{...o.mount?i:re(g)?s:Ee(h)?{[h]:g}:g},x,g),$=h=>jr(T(o.mount?i:s,h,e.shouldUnregister?T(s,h,[]):[])),B=(h,g,x={})=>{const I=T(r,h);let E=g;if(I){const A=I._f;A&&(!A.disabled&&ee(i,h,Co(g,A)),E=pn(A.ref)&&Ce(g)?"":g,ko(A.ref)?[...A.ref.options].forEach(V=>V.selected=E.includes(V.value)):A.refs?Ut(A.ref)?A.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(E)?V.checked=!!E.find(G=>G===V.value):V.checked=E===V.value||!!E)}):A.refs.forEach(V=>V.checked=V.value===E):Pr(A.ref)?A.ref.value="":(A.ref.value=E,A.ref.type||m.state.next({name:h,values:le(i)})))}(x.shouldDirty||x.shouldTouch)&&L(h,E,x.shouldTouch,x.shouldDirty,!0),x.shouldValidate&&xe(h)},Y=(h,g,x)=>{for(const I in g){if(!g.hasOwnProperty(I))return;const E=g[I],A=h+"."+I,V=T(r,A);(l.array.has(h)||ue(E)||V&&!V._f)&&!at(E)?Y(A,E,x):B(A,E,x)}},W=(h,g,x={})=>{const I=T(r,h),E=l.array.has(h),A=le(g);ee(i,h,A),E?(m.array.next({name:h,values:le(i)}),(f.isDirty||f.dirtyFields||p.isDirty||p.dirtyFields)&&x.shouldDirty&&m.state.next({name:h,dirtyFields:bt(s,i),isDirty:M(h,A)})):I&&!I._f&&!Ce(A)?Y(h,A,x):B(h,A,x),Ks(h,l)?m.state.next({...n,name:h,values:le(i)}):m.state.next({name:o.mount?h:void 0,values:le(i)})},ye=async h=>{o.mount=!0;const g=h.target;let x=g.name,I=!0;const E=T(r,x),A=Z=>{I=Number.isNaN(Z)||at(Z)&&isNaN(Z.getTime())||Le(Z,T(i,x,Z))},V=Us(e.mode),G=Us(e.reValidateMode);if(E){let Z,be;const tt=g.type?Hs(E._f):mo(h),Ke=h.type===hn.BLUR||h.type===hn.FOCUS_OUT,jo=!td(E._f)&&!e.resolver&&!T(n.errors,x)&&!E._f.deps||sd(Ke,T(n.touchedFields,x),n.isSubmitted,G,V),En=Ks(x,l,Ke);ee(i,x,tt),Ke?(!g||!g.readOnly)&&(E._f.onBlur&&E._f.onBlur(h),a&&a(0)):E._f.onChange&&E._f.onChange(h);const Tn=L(x,tt,Ke),Lo=!ke(Tn)||En;if(!Ke&&m.state.next({name:x,type:h.type,values:le(i)}),jo)return(f.isValid||p.isValid)&&(e.mode==="onBlur"?Ke&&k():Ke||k()),Lo&&m.state.next({name:x,...En?{}:Tn});if(!Ke&&En&&m.state.next({...n}),e.resolver){const{errors:qr}=await z([x]);if(S([x]),A(tt),I){const Ro=Js(n.errors,r,x),Kr=Js(qr,r,Ro.name||x);Z=Kr.error,x=Kr.name,be=ke(qr)}}else S([x],!0),Z=(await Gs(E,l.disabled,i,C,e.shouldUseNativeValidation))[x],S([x]),A(tt),I&&(Z?be=!1:(f.isValid||p.isValid)&&(be=await U(r,!0)));I&&(E._f.deps&&(!Array.isArray(E._f.deps)||E._f.deps.length>0)&&xe(E._f.deps),O(x,be,Z,Tn))}},de=(h,g)=>{if(T(n.errors,g)&&h.focus)return h.focus(),1},xe=async(h,g={})=>{let x,I;const E=jt(h);if(e.resolver){const A=await H(re(h)?h:E);x=ke(A),I=h?!E.some(V=>T(A,V)):x}else h?(I=(await Promise.all(E.map(async A=>{const V=T(r,A);return await U(V&&V._f?{[A]:V}:V)}))).every(Boolean),!(!I&&!n.isValid)&&k()):I=x=await U(r);return m.state.next({...!Ee(h)||(f.isValid||p.isValid)&&x!==n.isValid?{}:{name:h},...e.resolver||!h?{isValid:x}:{},errors:n.errors}),g.shouldFocus&&!I&&Lt(r,de,h?E:l.mount),I},qe=(h,g)=>{let x={...o.mount?i:s};return g&&(x=bo(g.dirtyFields?n.dirtyFields:n.touchedFields,x)),re(h)?x:Ee(h)?T(x,h):h.map(I=>T(x,I))},pt=(h,g)=>({invalid:!!T((g||n).errors,h),isDirty:!!T((g||n).dirtyFields,h),error:T((g||n).errors,h),isValidating:!!T(n.validatingFields,h),isTouched:!!T((g||n).touchedFields,h)}),Ct=h=>{h&&jt(h).forEach(g=>ae(n.errors,g)),m.state.next({errors:h?n.errors:{}})},ne=(h,g,x)=>{const I=(T(r,h,{_f:{}})._f||{}).ref,E=T(n.errors,h)||{},{ref:A,message:V,type:G,...Z}=E;ee(n.errors,h,{...Z,...g,ref:I}),m.state.next({name:h,errors:n.errors,isValid:!1}),x&&x.shouldFocus&&I&&I.focus&&I.focus()},we=(h,g)=>Se(h)?m.state.subscribe({next:x=>"values"in x&&h(F(void 0,g),x)}):F(h,g,!0),wt=h=>m.state.subscribe({next:g=>{rd(h.name,g.name,h.exact)&&nd(g,h.formState||f,Do,h.reRenderRoot)&&h.callback({values:{...i},...n,...g,defaultValues:s})}}).unsubscribe,Cn=h=>(o.mount=!0,p={...p,...h.formState},wt({...h,formState:{...d,...h.formState}})),wn=(h,g={})=>{for(const x of h?jt(h):l.mount)l.mount.delete(x),l.array.delete(x),g.keepValue||(ae(r,x),ae(i,x)),!g.keepError&&ae(n.errors,x),!g.keepDirty&&ae(n.dirtyFields,x),!g.keepTouched&&ae(n.touchedFields,x),!g.keepIsValidating&&ae(n.validatingFields,x),!e.shouldUnregister&&!g.keepDefaultValue&&ae(s,x);m.state.next({values:le(i)}),m.state.next({...n,...g.keepDirty?{isDirty:M()}:{}}),!g.keepIsValid&&k()},Br=({disabled:h,name:g})=>{if(Ae(h)&&o.mount||h||l.disabled.has(g)){const E=l.disabled.has(g)!==!!h;h?l.disabled.add(g):l.disabled.delete(g),E&&o.mount&&!o.action&&k()}},An=(h,g={})=>{let x=T(r,h);const I=Ae(g.disabled)||Ae(e.disabled);return ee(r,h,{...x||{},_f:{...x&&x._f?x._f:{ref:{name:h}},name:h,mount:!0,...g}}),l.mount.add(h),x?Br({disabled:Ae(g.disabled)?g.disabled:e.disabled,name:h}):D(h,!0,g.value),{...I?{disabled:g.disabled||e.disabled}:{},...e.progressive?{required:!!g.required,min:Tt(g.min),max:Tt(g.max),minLength:Tt(g.minLength),maxLength:Tt(g.maxLength),pattern:Tt(g.pattern)}:{},name:h,onChange:ye,onBlur:ye,ref:E=>{if(E){An(h,g),x=T(r,h);const A=re(E.value)&&E.querySelectorAll&&E.querySelectorAll("input,select,textarea")[0]||E,V=Gu(A),G=x._f.refs||[];if(V?G.find(Z=>Z===A):A===x._f.ref)return;ee(r,h,{_f:{...x._f,...V?{refs:[...G.filter(Kn),A,...Array.isArray(T(s,h))?[{}]:[]],ref:{type:A.type,name:h}}:{ref:A}}}),D(h,!1,void 0,A)}else x=T(r,h,{}),x._f&&(x._f.mount=!1),(e.shouldUnregister||g.shouldUnregister)&&!(go(l.array,h)&&o.action)&&l.unMount.add(h)}}},Nn=()=>e.shouldFocusError&&Lt(r,de,l.mount),Mo=h=>{Ae(h)&&(m.state.next({disabled:h}),Lt(r,(g,x)=>{const I=T(r,x);I&&(g.disabled=I._f.disabled||h,Array.isArray(I._f.refs)&&I._f.refs.forEach(E=>{E.disabled=I._f.disabled||h}))},0,!1))},zr=(h,g)=>async x=>{let I;x&&(x.preventDefault&&x.preventDefault(),x.persist&&x.persist());let E=le(i);if(m.state.next({isSubmitting:!0}),e.resolver){const{errors:A,values:V}=await z();S(),n.errors=A,E=le(V)}else await U(r);if(l.disabled.size)for(const A of l.disabled)ae(E,A);if(ae(n.errors,"root"),ke(n.errors)){m.state.next({errors:{}});try{await h(E,x)}catch(A){I=A}}else g&&await g({...n.errors},x),Nn(),setTimeout(Nn);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ke(n.errors)&&!I,submitCount:n.submitCount+1,errors:n.errors}),I)throw I},Oo=(h,g={})=>{T(r,h)&&(re(g.defaultValue)?W(h,le(T(s,h))):(W(h,g.defaultValue),ee(s,h,le(g.defaultValue))),g.keepTouched||ae(n.touchedFields,h),g.keepDirty||(ae(n.dirtyFields,h),n.isDirty=g.defaultValue?M(h,le(T(s,h))):M()),g.keepError||(ae(n.errors,h),f.isValid&&k()),m.state.next({...n}))},_r=(h,g={})=>{const x=h?le(h):s,I=le(x),E=ke(h),A=E?s:I;if(g.keepDefaultValues||(s=x),!g.keepValues){if(g.keepDirtyValues){const V=new Set([...l.mount,...Object.keys(bt(s,i))]);for(const G of Array.from(V)){const Z=T(n.dirtyFields,G),be=T(i,G),tt=T(A,G);Z&&!re(be)?ee(A,G,be):!Z&&!re(tt)&&W(G,tt)}}else{if(Dr&&re(h))for(const V of l.mount){const G=T(r,V);if(G&&G._f){const Z=Array.isArray(G._f.refs)?G._f.refs[0]:G._f.ref;if(pn(Z)){const be=Z.closest("form");if(be){be.reset();break}}}}if(g.keepFieldsRef)for(const V of l.mount)W(V,T(A,V));else r={}}i=e.shouldUnregister?g.keepDefaultValues?le(s):{}:le(A),m.array.next({values:{...A}}),m.state.next({values:{...A}})}l={mount:g.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!g.keepIsValid||!!g.keepDirtyValues||!e.shouldUnregister&&!ke(A),o.watch=!!e.shouldUnregister,o.keepIsValid=!!g.keepIsValid,o.action=!1,g.keepErrors||(n.errors={}),m.state.next({submitCount:g.keepSubmitCount?n.submitCount:0,isDirty:E?!1:g.keepDirty?n.isDirty:!!(g.keepDefaultValues&&!Le(h,s)),isSubmitted:g.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:E?{}:g.keepDirtyValues?g.keepDefaultValues&&i?bt(s,i):n.dirtyFields:g.keepDefaultValues&&h?bt(s,h):g.keepDirty?n.dirtyFields:{},touchedFields:g.keepTouched?n.touchedFields:{},errors:g.keepErrors?n.errors:{},isSubmitSuccessful:g.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Hr=(h,g)=>_r(Se(h)?h(i):h,{...e.resetOptions,...g}),Io=(h,g={})=>{const x=T(r,h),I=x&&x._f;if(I){const E=I.refs?I.refs[0]:I.ref;E.focus&&setTimeout(()=>{E.focus(),g.shouldSelect&&Se(E.select)&&E.select()})}},Do=h=>{n={...n,...h}},Ur={control:{register:An,unregister:wn,getFieldState:pt,handleSubmit:zr,setError:ne,_subscribe:wt,_runSchema:z,_updateIsValidating:S,_focusError:Nn,_getWatch:F,_getDirty:M,_setValid:k,_setFieldArray:w,_setDisabledField:Br,_setErrors:N,_getFieldArray:$,_reset:_r,_resetDefaultValues:()=>Se(e.defaultValues)&&e.defaultValues().then(h=>{Hr(h,e.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:P,_disableForm:Mo,_subjects:m,_proxyFormState:f,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(h){o=h},get _defaultValues(){return s},get _names(){return l},set _names(h){l=h},get _formState(){return n},get _options(){return e},set _options(h){e={...e,...h}}},subscribe:Cn,trigger:xe,register:An,handleSubmit:zr,watch:we,setValue:W,getValues:qe,reset:Hr,resetField:Oo,clearErrors:Ct,unregister:wn,setError:ne,setFocus:Io,getFieldState:pt};return{...Ur,formControl:Ur}}function cd(t={}){const e=v.useRef(void 0),n=v.useRef(void 0),[r,s]=v.useState({isDirty:!1,isValidating:!1,isLoading:Se(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Se(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!Se(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...l}=ad(t);e.current={...l,formState:r}}const i=e.current.control;return i._options=t,Fr(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>s({...i._formState}),reRenderRoot:!0});return s(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),v.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),v.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),v.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),v.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),v.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),v.useEffect(()=>{var o;t.values&&!Le(t.values,n.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.current=t.values,s(l=>({...l}))):i._resetDefaultValues()},[i,t.values]),v.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=v.useMemo(()=>xo(r,i),[i,r]),e.current}function ud(t,e=3){return t%1===0?t.toString():t.toFixed(e).replace(/\.?0+$/,"")}function dd(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}function fd(t="USD",e="en-US"){try{return new Intl.NumberFormat(e,{style:"currency",currency:t}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function hd(t){const e=t.replace(/[^\d.,-]/g,""),n=e.match(/,\d{1,2}$/);let r;n?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");const s=parseFloat(r);return isNaN(s)?null:s}function pd(t,e,n=.001){const r=t-e,s=Math.abs(r)<=n;return{difference:r,isBalanced:s,isUnderAllocated:!s&&r>0,isOverAllocated:!s&&r<0}}function Vr(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Vr();const md={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Jn=()=>({id:Vr(),amount:0,glAccount:null,isTaxDeductible:!1}),Ao=({distribution:t,defaultDistribution:e,glAccounts:n=[],isLoadingGlAccounts:r=!1,onSearchGlAccounts:s,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:a,onDelete:u,canDelete:d=!0,canEditTaxDeductible:f=!0,isDisabled:p=!1,labels:m,classNames:C={},"data-testid":b,control:k,name:S,rules:w})=>{const j={...md,...m},N=k!==void 0&&S!==void 0,D=cd({defaultValues:{_internal:e||Jn()}}),L=Ku({control:N?k:D.control,name:N?S:"_internal",rules:N?w:void 0}),[O,z]=v.useState(e||Jn()),H=N?L.field.value??Jn():t??O,U=N&&!!L.fieldState?.error,P=N&&(L.fieldState?.isTouched??!1),M=U||P,F=M&&(!H.amount||H.amount<=0),$=M&&!H.glAccount,[B,Y]=v.useState(H.glAccount?.name||""),W=v.useCallback(ne=>{const we={...H,...ne};N&&L.field.onChange(we),!N&&t===void 0&&z(we),i?.(we)},[H,t,i,N,L]),ye=v.useCallback(ne=>{const we=ne||0;W({amount:we}),o?.(we)},[W,o]),de=v.useCallback(ne=>{Y(ne),s?.(ne)},[s]),xe=v.useCallback(ne=>{if(ne===null){W({glAccount:null}),l?.(null);return}const wt=n.find(Cn=>String(Cn.id)===String(ne))||null;W({glAccount:wt}),l?.(wt)},[n,W,l]),qe=v.useCallback(()=>{Y(""),W({glAccount:null}),l?.(null)},[W,l]),pt=v.useCallback(ne=>{W({isTaxDeductible:ne}),a?.(ne)},[W,a]),Ct=v.useCallback(()=>{u?.()},[u]);return c.jsx(y.Card,{radius:"md",shadow:"sm","data-testid":b||"revenue-distribution-card",className:y.cn(C.base),children:c.jsxs(y.CardBody,{className:y.cn("flex flex-row flex-nowrap items-start gap-4",C.body),children:[c.jsx("div",{className:y.cn("shrink-0",C.amountContainer),children:c.jsx(y.NumberInput,{"data-testid":`${b||"revenue-distribution-card"}-amount-input`,label:c.jsxs("span",{className:"flex items-center gap-1",children:[j.amount,c.jsx(y.Tooltip,{content:j.amountTooltip,children:c.jsx(Ie,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:H.amount||void 0,onValueChange:ye,labelPlacement:"outside",placeholder:j.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:F,errorMessage:F?"Amount is required":void 0,minValue:0,step:.01,className:C.amountInput,startContent:c.jsx("div",{className:"pointer-events-none flex items-center",children:c.jsx("span",{className:"text-default-400 text-small",children:j.currencySymbol})})})}),c.jsx("div",{className:y.cn("grow",C.glAccountContainer),children:c.jsx(y.Autocomplete,{"data-testid":`${b||"revenue-distribution-card"}-gl-account-input`,label:c.jsxs("span",{className:"flex items-center gap-1",children:[j.glAccount,c.jsx(y.Tooltip,{content:j.glAccountTooltip,children:c.jsx(Ie,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:r,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:H.glAccount?.name??B,selectedKey:H.glAccount?.id??null,isDisabled:p,isInvalid:$,errorMessage:$?"GL Account is required":void 0,listboxProps:{emptyContent:r?j.searching:j.noGlAccountsFound},placeholder:j.glAccountPlaceholder,onInputChange:de,onSelectionChange:xe,onClear:qe,className:C.glAccountInput,children:ne=>c.jsx(y.AutocompleteItem,{textValue:ne.name,children:c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{children:ne.name}),ne.code&&c.jsx("span",{className:"text-xs text-default-400",children:ne.code})]})},ne.id)})}),c.jsx("div",{className:y.cn("shrink-0 pt-6 flex items-center",C.taxDeductibleContainer),children:c.jsx(y.Checkbox,{radius:"full","data-testid":`${b||"revenue-distribution-card"}-tax-deductible`,isSelected:H.isTaxDeductible,onValueChange:pt,isDisabled:p||!f,className:C.taxDeductibleCheckbox,children:j.taxDeductible})}),c.jsx("div",{className:y.cn("shrink-0 pt-6",C.deleteContainer),children:c.jsx(oe,{"data-testid":`${b||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!d,onPress:Ct,startContent:c.jsx(Ie,{icon:"solar:trash-bin-trash-linear",width:16}),className:y.cn("text-danger",C.deleteButton),children:j.deleteButton})})]})})};Ao.displayName="RevenueDistributionCard";const No=({message:t="No distributions configured",icon:e="solar:document-text-outline",iconSize:n=48,showCard:r=!0,classNames:s={},renderEmpty:i})=>{if(i)return c.jsx(c.Fragment,{children:i()});const o=c.jsxs("div",{className:y.cn("flex flex-col items-center justify-center py-8",s.content),children:[c.jsx(Ie,{icon:e,width:n,className:y.cn("text-default-300 mb-4",s.icon)}),c.jsx("p",{className:y.cn("text-default-500 text-sm text-center",s.message),children:t})]});return r?c.jsx(y.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{children:o})}):c.jsx("div",{"data-testid":"revenue-distribution-empty",className:y.cn("w-full",s.base),children:o})};No.displayName="RevenueDistributionEmpty";const gd={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Eo=({error:t,labels:e,showCard:n=!0,color:r="danger",classNames:s={}})=>{const i={...gd,...e},o=c.jsx(y.Alert,{"data-testid":"revenue-distribution-error-alert",color:r,title:i.title,description:t||i.description,className:s.alert});return n?c.jsx(y.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{children:o})}):c.jsx("div",{"data-testid":"revenue-distribution-error",className:y.cn("w-full",s.base),children:o})};Eo.displayName="RevenueDistributionError";const To=({rows:t=1,showCard:e=!0,classNames:n={}})=>{const r=Array.from({length:t},(i,o)=>o),s=i=>c.jsxs("div",{className:y.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[c.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(y.Skeleton,{className:"h-4 w-14 rounded-md"}),c.jsx(y.Skeleton,{className:"h-4 w-4 rounded-full"})]}),c.jsx(y.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),c.jsxs("div",{className:"grow flex flex-col gap-1",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(y.Skeleton,{className:"h-4 w-20 rounded-md"}),c.jsx(y.Skeleton,{className:"h-4 w-4 rounded-full"})]}),c.jsx(y.Skeleton,{className:"h-10 w-full rounded-lg"})]}),c.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[c.jsx(y.Skeleton,{className:"h-5 w-5 rounded-full"}),c.jsx(y.Skeleton,{className:"h-4 w-24 rounded-md"})]}),c.jsx("div",{className:"shrink-0 pb-2",children:c.jsx(y.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return e?c.jsx("div",{className:y.cn("flex flex-col gap-3",n.base),children:r.map(i=>c.jsx(y.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:c.jsx(y.CardBody,{children:s(i)})},i))}):c.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:y.cn("flex flex-col gap-3",n.base),children:r.map(i=>s(i))})};To.displayName="RevenueDistributionSkeleton";exports.Button=oe;exports.ConfirmationPageTemplate=Wo;exports.DonationAmounts=qi;exports.EventDetails=Fu;exports.EventDetailsTemplate=Qo;exports.ExpireCartTimer=Ki;exports.Footer=Xo;exports.HeroUIProvider=Ho;exports.Multiselect=Yo;exports.Navbar=Jo;exports.OfferCard=Ir;exports.OfferCardEmpty=lo;exports.OfferCardError=ao;exports.OfferCardList=ho;exports.OfferCardSkeleton=co;exports.RICH_TEXT_PRESETS=Hi;exports.RevenueDistributionCard=Ao;exports.RevenueDistributionEmpty=No;exports.RevenueDistributionError=Eo;exports.RevenueDistributionSkeleton=To;exports.RichTextArea=Ui;exports.Stepper=Zs;exports.calculateAllocationDifference=pd;exports.formatOfferCurrency=oo;exports.formatRevenueAmount=ud;exports.formatRevenueCurrency=dd;exports.generateDistributionId=Vr;exports.getCurrencySymbol=fd;exports.offerCardVariants=fo;exports.offerListVariants=uo;exports.parseOfferCurrency=Pu;exports.parseRevenueCurrency=hd;Object.keys(y).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>y[t]})});
20
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:none}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
19
+ `))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,s,r,t));if(f)l=f;else{let p=s.marks(),{schema:m}=t.state,C=gn.fromSchema(m);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let k=o.appendChild(document.createElement("p"));b&&k.appendChild(C.serializeNode(m.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=Ka(n),kr&&Ja(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||tn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:s,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Ha.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Wa(ws(l,+d[1],+d[2]),d[4]);else if(l=K.maxOpen(Ua(l.content,s),!0),l.openStart||l.openEnd){let f=0,p=0;for(let m=l.content.firstChild;f<l.openStart&&!m.type.spec.isolating;f++,m=m.firstChild);for(let m=l.content.lastChild;p<l.openEnd&&!m.type.spec.isolating;p++,m=m.lastChild);l=ws(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,a)}),l}const Ha=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ua(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&i.length&&Oi(a,i,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Ii(o[o.length-1],i.length));let d=Mi(l,a);o.push(d),s=s.matchType(d.type),i=a}}),o)return q.from(o)}return t}function Mi(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,q.from(t));return t}function Oi(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=Oi(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(q.from(Mi(n,t,s+1))))}}function Ii(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ii(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(q.empty,!0);return t.copy(n.append(r))}function rr(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=rr(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function ws(t,e,n){return e<t.openStart&&(t=new K(rr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new K(rr(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Di={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let As=null;function ji(){return As||(As=document.implementation.createHTMLDocument("title"))}let _n=null;function qa(t){let e=window.trustedTypes;return e?(_n||(_n=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),_n.createHTML(t)):t}function Ka(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=ji().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&Di[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=qa(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function Ja(t){let e=t.querySelectorAll(Ue?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Wa(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=q.from(a.create(r[l+1],s)),i++,o++}return new K(s,i,o)}const Fe={},Te={};function Qe(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Te.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ri(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ht&&Ue&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),br&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,bi(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||_a(t,n)?n.preventDefault():Qe(t,"key")};Te.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Te.keypress=(t,e)=>{let n=e;if(Ri(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Me&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Q)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function kn(t){return{left:t.clientX,top:t.clientY}}function Ga(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Sr(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function vt(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Za(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&J.isSelectable(r)?(vt(t,new J(n)),!0):!1}function Qa(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof J&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(J.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(vt(t,J.create(t.state.doc,s)),!0):!1}function Xa(t,e,n,r,s){return Sr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?Qa(t,n):Za(t,n))}function Ya(t,e,n,r){return Sr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function ec(t,e,n,r){return Sr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||tc(t,n,r)}function tc(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(vt(t,Q.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)vt(t,Q.create(r,l+1,l+1+o.content.size));else if(J.isSelectable(o))vt(t,J.create(r,l));else continue;return!0}}function Cr(t){return cn(t)}const Li=Me?"metaKey":"ctrlKey";Fe.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Cr(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&Ga(n,t.input.lastClick)&&!n[Li]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(kn(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new nc(t,o,n,!!r)):(i=="doubleClick"?Ya:ec)(t,o.pos,o.inside,n)?n.preventDefault():Qe(t,"pointer"))};class nc{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Li],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof J&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Qe(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>vr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(kn(e))),this.updateAllowDefault(e),this.allowDefault||!n?Qe(this.view,"pointer"):Xa(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ht&&this.mightDrag&&!this.mightDrag.node.isAtom||Ue&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(vt(this.view,X.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Qe(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qe(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Fe.touchstart=t=>{t.input.lastTouch=Date.now(),Cr(t),Qe(t,"pointer")};Fe.touchmove=t=>{t.input.lastTouch=Date.now(),Qe(t,"pointer")};Fe.contextmenu=t=>Cr(t);function Ri(t,e){return t.composing?!0:ht&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const rc=Ht?5e3:-1;Te.compositionstart=Te.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Q&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ue&&Ci&&sc(t)))t.markCursor=t.state.storedMarks||n.marks(),cn(t,!0),t.markCursor=null;else if(cn(t,!e.selection.empty),bn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}Fi(t,rc)};function sc(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Te.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Fi(t,20))};function Fi(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>cn(t),e))}function ic(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=oc());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function oc(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function cn(t,e=!1){if(!(Ht&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ic(t),e||t.docView&&t.docView.dirty){let n=Ia(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function lc(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Vt=_t&&vi<15||br&&Oa<604;Fe.copy=Te.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Vt?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Ei(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):lc(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ac(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function cc(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sr(t,r.value,null,s,e):sr(t,r.textContent,r.innerHTML,s,e)},50)}function sr(t,e,n,r,s){let i=Ti(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||K.empty)))return!0;if(!i)return!1;let o=ac(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Pi(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Te.paste=(t,e)=>{let n=e;if(t.composing&&!Ht)return;let r=Vt?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&sr(t,Pi(r),r.getData("text/html"),s,n)?n.preventDefault():cc(t,n)};class uc{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const dc=Me?"altKey":"ctrlKey";function $i(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[dc]}Fe.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(kn(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof J?s.to-1:s.to))){if(r&&r.mightDrag)o=J.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=J.create(t.state.doc,f.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:u,slice:d}=Ei(t,l);(!n.dataTransfer.files.length||!Ue||Si>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Vt?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Vt||n.dataTransfer.setData("text/plain",u),t.dragging=new uc(d,$i(t,n),o)};Fe.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Te.dragover=Te.dragenter=(t,e)=>e.preventDefault();Te.drop=(t,e)=>{try{fc(t,e,t.dragging)}finally{t.dragging=null}};function fc(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(kn(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",m=>{i=m(i,t,!1)}):i=Ti(t,Pi(e.dataTransfer),Vt?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&$i(t,e));if(t.someProp("handleDrop",m=>m(t,e,i||K.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?ui(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:m}=n;m?m.replace(a):a.deleteSelection()}let u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&J.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new J(p));else{let m=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((C,b,k,S)=>m=S),a.setSelection(Ai(t,p,a.doc.resolve(m)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Fe.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&vr(t)},20))};Fe.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Fe.beforeinput=(t,e)=>{if(Ue&&Ht&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,bi(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Te)Fe[t]=Te[t];function Bt(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class un{constructor(e,n){this.toDOM=e,this.spec=n||ut,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new $e(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof un&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Bt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Xe{constructor(e,n){this.attrs=e,this.spec=n||ut}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new $e(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Xe&&Bt(this.attrs,e.attrs)&&Bt(this.spec,e.spec)}static is(e){return e.type instanceof Xe}destroy(){}}class wr{constructor(e,n){this.attrs=e,this.spec=n||ut}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new $e(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof wr&&Bt(this.attrs,e.attrs)&&Bt(this.spec,e.spec)}destroy(){}}class $e{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new $e(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new $e(e,e,new un(n,r))}static inline(e,n,r,s){return new $e(e,n,new Xe(r,s))}static node(e,n,r,s){return new $e(e,n,new wr(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Xe}get widget(){return this.type instanceof un}}const xt=[],ut={};class fe{constructor(e,n){this.local=e.length?e:xt,this.children=n.length?n:xt}static create(e,n){return n.length?dn(n,e,0,ut):ve}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==ve||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ut)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?hc(this.children,o||[],e,n,r,s,i):o?new fe(o.sort(dt),xt):ve}add(e,n){return n.length?this==ve?fe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let u=a+r,d;if(d=Bi(n,l,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,d,u+1):s.splice(i,0,a,a+l.nodeSize,dn(d,l,u+1,ut)),i+=3}});let o=Vi(i?zi(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new fe(o.length?this.local.concat(o).sort(dt):this.local,s||this.children)}remove(e){return e.length==0||this==ve?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,l+1);u!=ve?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new fe(s,r):ve}forChild(e,n){if(this==ve)return this;if(n.isLeaf)return fe.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof Xe){let u=Math.max(i,a.from)-i,d=Math.min(o,a.to)-i;u<d&&(s||(s=[])).push(a.copy(u,d))}}if(s){let l=new fe(s.sort(dt),xt);return r?new st([l,r]):l}return r||ve}eq(e){if(this==e)return!0;if(!(e instanceof fe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ar(this.localsInner(e))}localsInner(e){if(this==ve)return xt;if(e.inlineContent||!this.local.some(Xe.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Xe||n.push(this.local[r]);return n}forEachSet(e){e(this)}}fe.empty=new fe([],[]);fe.removeOverlap=Ar;const ve=fe.empty;class st{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,ut));return st.from(r)}forChild(e,n){if(n.isLeaf)return fe.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=ve&&(i instanceof st?r=r.concat(i.members):r.push(i))}return st.from(r)}eq(e){if(!(e instanceof st)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Ar(r?n:n.sort(dt)):xt}static from(e){switch(e.length){case 0:return ve;case 1:return e[0];default:return new st(e.every(n=>n instanceof fe)?e:e.reduce((n,r)=>n.concat(r instanceof fe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function hc(t,e,n,r,s,i,o){let l=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let f=0;n.maps[u].forEach((p,m,C,b)=>{let k=b-C-(m-p);for(let S=0;S<l.length;S+=3){let w=l[S+1];if(w<0||p>w+d-f)continue;let j=l[S]+d-f;m>=j?l[S+1]=p<=j?-2:-1:p>=d&&k&&(l[S]+=k,l[S+1]+=k)}f+=k}),d=n.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=n.map(t[u]+i),f=d-s;if(f<0||f>=r.content.size){a=!0;continue}let p=n.map(t[u+1]+i,-1),m=p-s,{index:C,offset:b}=r.content.findIndex(f),k=r.maybeChild(C);if(k&&b==f&&b+k.nodeSize==m){let S=l[u+2].mapInner(n,k,d+1,t[u]+i+1,o);S!=ve?(l[u]=f,l[u+1]=m,l[u+2]=S):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=pc(l,t,e,n,s,i,o),d=dn(u,r,0,o);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<d.children.length;f+=3){let m=d.children[f];for(;p<l.length&&l[p]<m;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new fe(e.sort(dt),l)}function Vi(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new $e(s.from+e,s.to+e,s.type))}return n}function pc(t,e,n,r,s,i,o){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(r,s,u);f?n.push(f):o.onRemove&&o.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Bi(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function zi(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function dn(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let u=Bi(t,l,a+n);if(u){i=!0;let d=dn(u,l,n+a+1,r);d!=ve&&s.push(a,a+l.nodeSize,d)}});let o=Vi(i?zi(t):t,-n).sort(dt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new fe(o,s):ve}function dt(t,e){return t.from-e.from||t.to-e.to}function Ar(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Ns(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ns(e,s,r.copy(i.from,r.to)));break}}}return e}function Ns(t,e,n){for(;e<t.length&&dt(n,t[e])>0;)e++;t.splice(e,0,n)}class ie extends X{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ie.valid(r)?new ie(r):X.near(r)}content(){return K.empty}eq(e){return e instanceof ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ie(e.resolve(n.pos))}getBookmark(){return new Nr(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!mc(e)||!gc(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ie.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(ie.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!J.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(ie.valid(l))return l}return null}}}ie.prototype.visible=!1;ie.findFrom=ie.findGapCursorFrom;X.jsonID("gapcursor",ie);class Nr{constructor(e){this.pos=e}map(e){return new Nr(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ie.valid(n)?new ie(n):X.near(n)}}function _i(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function mc(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||_i(s.type))return!0;if(s.inlineContent)return!1}}return!0}function gc(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||_i(s.type))return!0;if(s.inlineContent)return!1}}return!0}function yc(){return new xn({props:{decorations:vc,createSelectionBetween(t,e,n){return e.pos==n.pos&&ie.valid(n)?new ie(n):null},handleClick:bc,handleKeyDown:xc,handleDOMEvents:{beforeinput:kc}}})}const xc=Ea({ArrowLeft:Wt("horiz",-1),ArrowRight:Wt("horiz",1),ArrowUp:Wt("vert",-1),ArrowDown:Wt("vert",1)});function Wt(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof Q){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ie.findGapCursorFrom(l,e,a);return u?(s&&s(r.tr.setSelection(new ie(u))),!0):!1}}function bc(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ie.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&J.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ie(r))),!0)}function kc(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ie))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=q.empty;for(let o=r.length-1;o>=0;o--)s=q.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new K(s,0,0));return i.setSelection(Q.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function vc(t){if(!(t.selection instanceof ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",fe.create(t.doc,[$e.widget(t.selection.head,e,{key:"gapcursor"})])}const Sc=R.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[yc()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=R.callOrReturn(R.getExtensionField(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),At={bold:{category:"mark",extension:kl,priority:100},italic:{category:"mark",extension:Al,priority:100},strike:{category:"mark",extension:Tl,priority:100},underline:{category:"mark",extension:Fo.Underline,priority:100},code:{category:"mark",extension:Il,priority:100},textColor:{category:"mark",extension:Po.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:$o.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Vo.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ll,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Pl,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Vl,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Bo.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:ta,priority:100},blockquote:{category:"node",extension:ra,priority:100},horizontalRule:{category:"node",extension:sa,priority:100},hardBreak:{category:"node",extension:ia,priority:100},undo:{category:"extension",extension:fs,priority:50},redo:{category:"extension",extension:fs,priority:50},textAlign:{category:"extension",extension:_o.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},Cc=[ma,ga,Rl,jl.configure({HTMLAttributes:{}}),Bl.configure({HTMLAttributes:{}}),zo.TaskItem.configure({nested:!0}),ba,Sc];function wc(t){const e=[],n=new Set,r=new Set;Cc.forEach(l=>{l&&(e.push(l),r.add(l.name))});const s=t.map(l=>Rt(l)),i=new Set;return s.forEach(l=>{const a=At[l];a?.requiredExtensions&&a.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const a=At[l];if(!a||a.extension===null)return;const u=a.extension.name;if(r.has(u)){n.add(l);return}const d=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(d),n.add(l),r.add(u)}),s.forEach(l=>{if(n.has(l))return;const a=At[l];if(!a){console.warn(`Extension config not found for modifier: ${l}`);return}if(a.extension===null){n.add(l);return}const u=a.extension.name;if(r.has(u)){n.add(l);return}const d=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(d),n.add(l),r.add(u)}),e.sort((l,a)=>{const u=Object.values(At).find(m=>m?.extension?.name===l.name),d=Object.values(At).find(m=>m?.extension?.name===a.name),f=u?.priority??100;return(d?.priority??100)-f})}const Hi={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},se={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},Je={brand:{primary:{DEFAULT:"#C14615"}},neutral:{gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",500:"#6B7280",800:"#1F2937"}},palettes:{warning:{200:"#fde68a"}}},te={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},Ac={h1:`font-size: ${se.fontSize["4xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h2:`font-size: ${se.fontSize["2xl"]}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h3:`font-size: ${se.fontSize.xl}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h4:`font-size: ${se.fontSize.lg}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h5:`font-size: ${se.fontSize.base}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,h6:`font-size: ${se.fontSize.sm}; font-weight: ${se.fontWeight.semibold}; line-height: ${se.lineHeight.tight}; margin: ${te.md} 0 ${te.sm} 0;`,p:`min-height: ${se.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${te.xl}; margin: ${te.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${te.xl}; margin: ${te.md} 0;`,li:`display: list-item; margin: ${te.xs} 0;`,strong:`font-weight: ${se.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Je.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${se.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${se.fontFamily.mono};`,pre:`background: ${Je.neutral.gray[800]}; border-radius: ${te.sm}; color: ${Je.neutral.gray[100]}; font-family: ${se.fontFamily.mono}; margin: ${te.lg} 0; padding: 0.75rem ${te.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Je.neutral.gray[300]}; margin: ${te.lg} 0; padding-left: ${te.md}; color: ${Je.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Je.neutral.gray[200]}; margin: ${te.xl} 0;`,a:`color: ${Je.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Je.palettes.warning[200]}; border-radius: ${te.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${te.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Nc={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function Ec(t){if(!t)return t;let e=t;for(const[n,r]of Object.entries(Nc)){const s=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");e=e.replace(s,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${r}"`):`${o} style="${r}">`)}for(const[n,r]of Object.entries(Ac)){const s=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");e=e.replace(s,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${r}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${r}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${r}"${i.slice(o)}`}})}return e}const Tc=({modifiers:t,zoom:e,onZoomChange:n,onToolbarAction:r})=>{const{editor:s}=hr.useCurrentEditor();return c.jsx(ml,{editor:s,modifiers:t,zoom:e,onZoomChange:n,onToolbarAction:r})},Mc=({showCharacterCount:t,showWordCount:e})=>{const{editor:n}=hr.useCurrentEditor();if(!n||!t&&!e)return null;const r=n.getText(),s=r.length,i=r.split(/\s+/).filter(o=>o.length>0).length;return c.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[t&&c.jsxs("span",{children:[s," characters"]}),e&&c.jsxs("span",{children:[i," words"]})]})},ir=v.forwardRef((t,e)=>{const{minRows:n=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=Hi.full,variant:u="bordered",initialContent:d,content:f,onContentChange:p,onUpdate:m,onToolbarAction:C,isReadOnly:b=!1,isDisabled:k=!1,includeInlineStyles:S=!0,...w}=t,{zoom:j,setZoom:N}=fl(),D=Jr.lineHeight,L=n*D,O=s?void 0:r*D,z=v.useMemo(()=>wc(a),[a]),{Component:H,label:U,shouldLabelBeOutside:P,getBaseProps:M,getLabelProps:F,getInputWrapperProps:$}=y.useInput({...w,variant:u,ref:e,isMultiline:!0}),B=U?c.jsx("label",{...F(),children:U}):null,Y=v.useCallback(({editor:W})=>{const ye=W.getHTML(),de=S?Ec(ye):ye,xe=W.getJSON(),qe=W.getText(),pt=qe.length,Ct=qe.split(/\s+/).filter(we=>we.length>0).length,ne={html:de,json:xe,text:qe,characters:pt,words:Ct};if(p?.(ne),m?.(ne),"onChange"in w&&typeof w.onChange=="function"){const we={target:{value:de},currentTarget:{value:de}};w.onChange(we)}},[p,m,w,S]);return c.jsxs(H,{...M(),children:[P?B:null,c.jsx("div",{...$(),className:y.cn($().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:O?`${O+Jr.toolbarHeight}px`:void 0,overflow:O?"auto":void 0},children:c.jsx(hr.EditorProvider,{editable:!b&&!k,slotBefore:l?c.jsx(Tc,{modifiers:a,zoom:j,onZoomChange:N,onToolbarAction:C}):void 0,slotAfter:c.jsx(Mc,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${L}px`,fontSize:`${j}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:z,content:f||d||t.defaultValue||"",onUpdate:Y})})]})});ir.displayName="TipTapEditor";const Ui=v.forwardRef((t,e)=>{const{adapter:n="tiptap",variant:r="bordered",...s}=t;return n==="tiptap"?c.jsx(ir,{...s,variant:r,ref:e}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),c.jsx(ir,{...s,variant:r,ref:e}))});Ui.displayName="RichTextArea";function Oc(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}const Es=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Ic={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},qi=({presetAmounts:t=Es,selectedDonation:e,defaultSelectedDonation:n=null,onChange:r,currency:s="USD",locale:i="en-US",showCustomAmount:o=!0,minCustomAmount:l=.5,maxCustomAmount:a=1e6,labels:u,mobileColumns:d=2,desktopColumns:f=3,isDisabled:p=!1,buttonVariant:m="bordered",buttonColor:C="default",inputVariant:b="bordered",className:k="",showCard:S=!0})=>{const w={...Ic,...u},j=Array.isArray(t)?t:Es,N={2:"grid-cols-2",3:"grid-cols-3"},D={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},L=`${N[d]} ${D[f]}`,[O,z]=pr(e,n,r),[H,U]=v.useState(""),P=v.useCallback(B=>{if(p)return;const Y={amount:B.amount,isCustom:!1,presetId:B.id};z(Y),U("")},[p,z]),M=v.useCallback(B=>{if(p)return;if(U(B!==void 0?String(B):""),B===void 0||isNaN(B)){z(null);return}z({amount:B,isCustom:!0})},[p,z]),F=v.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),$=c.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&c.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),j.length>0&&c.jsx("div",{className:y.cn("grid gap-3",L),"data-testid":"donation-amounts-presets",children:j.map(B=>{const Y=O!==null&&!O.isCustom&&O.presetId===B.id;return c.jsx(oe,{color:Y?"primary":C,variant:Y?"solid":m,className:"w-full",onPress:()=>P(B),isDisabled:p,"data-testid":`donation-amounts-preset-${B.id}`,children:B.label||Oc(B.amount,i,s)},B.id)})}),o&&c.jsx(y.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,variant:b,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:F,value:H!==""?parseFloat(H):void 0,onValueChange:M,isDisabled:p,"data-testid":"donation-amounts-custom-input"},O?.isCustom===!1?O.presetId:"custom")]});return S?c.jsx(y.Card,{className:y.cn("w-full",k),"data-testid":"donation-amounts-card",children:c.jsx(y.CardBody,{children:$})}):c.jsx("div",{className:y.cn("w-full",k),"data-testid":"donation-amounts-plain",children:$})};qi.displayName="DonationAmounts";const Dc=t=>{const e=Math.max(0,t),n=Math.floor(e/60).toString().padStart(2,"0"),r=(e%60).toString().padStart(2,"0");return`${n}:${r} minutes`},jc=t=>{switch(t){case"warning":return _.Clock;case"error":return _.AlertCircle;case"success":return _.CheckCircle;default:return _.Clock}},Lc=t=>{switch(t){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ki=v.forwardRef(({timeLeft:t,defaultTimeLeft:e=1200,onTimeChange:n,onExpire:r,variant:s="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:a,position:u="fixed",autoStart:d=!0,formatTime:f=Dc,className:p,...m},C)=>{const[b,k]=pr(t!==void 0?Math.max(0,t):void 0,Math.max(0,e),n),S=v.useRef(null),w=v.useRef(!1);v.useEffect(()=>()=>{S.current&&clearInterval(S.current)},[]),v.useEffect(()=>{if(!d||b<=0){S.current&&(clearInterval(S.current),S.current=null);return}return S.current=setInterval(()=>{k(L=>L<=1?(S.current&&(clearInterval(S.current),S.current=null),w.current||(w.current=!0,r?.()),0):L-1)},1e3),()=>{S.current&&(clearInterval(S.current),S.current=null)}},[d,b,k,r]),v.useEffect(()=>{b>0&&(w.current=!1)},[b]);const j=a||jc(s),N=Lc(i),D={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return c.jsx("div",{ref:C,role:"banner","aria-live":"polite","aria-label":`${o} ${f(b)}`,"data-testid":"expire-cart-timer",className:y.cn("w-full text-white z-50",N,D[u],p),...m,children:c.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:c.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&c.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:c.jsx(j,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),c.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),c.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:c.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(b)}`,"data-testid":"expire-cart-timer-value",children:f(b)})})]})})})});Ki.displayName="ExpireCartTimer";function Rc(t,e){const n=t.icons,r=t.aliases||Object.create(null),s=Object.create(null);function i(o){if(n[o])return s[o]=[];if(!(o in s)){s[o]=null;const l=r[o]&&r[o].parent,a=l&&i(l);a&&(s[o]=[l].concat(a))}return s[o]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}const Ji=Object.freeze({left:0,top:0,width:16,height:16}),fn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Er=Object.freeze({...Ji,...fn}),or=Object.freeze({...Er,body:"",hidden:!1});function Fc(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const r=((t.rotate||0)+(e.rotate||0))%4;return r&&(n.rotate=r),n}function Ts(t,e){const n=Fc(t,e);for(const r in or)r in fn?r in t&&!(r in n)&&(n[r]=fn[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function Pc(t,e,n){const r=t.icons,s=t.aliases||Object.create(null);let i={};function o(l){i=Ts(r[l]||s[l],i)}return o(e),n.forEach(o),Ts(t,i)}function Wi(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(s=>{e(s,null),n.push(s)});const r=Rc(t);for(const s in r){const i=r[s];i&&(e(s,Pc(t,s,i)),n.push(s))}return n}const $c={provider:"",aliases:{},not_found:{},...Ji};function Hn(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Gi(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Hn(t,$c))return null;const n=e.icons;for(const s in n){const i=n[s];if(!s||typeof i.body!="string"||!Hn(i,or))return null}const r=e.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s||typeof o!="string"||!n[o]&&!r[o]||!Hn(i,or))return null}return e}const Ms=Object.create(null);function Vc(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function St(t,e){const n=Ms[t]||(Ms[t]=Object.create(null));return n[e]||(n[e]=Vc(t,e))}function Zi(t,e){return Gi(e)?Wi(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function Bc(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}const Qi=/^[a-z0-9]+(-[a-z0-9]+)*$/,vn=(t,e,n,r="")=>{const s=t.split(":");if(t.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const l=s.pop(),a=s.pop(),u={provider:s.length>0?s[0]:r,prefix:a,name:l};return e&&!Yt(u)?null:u}const i=s[0],o=i.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return e&&!Yt(l)?null:l}if(n&&r===""){const l={provider:r,prefix:"",name:i};return e&&!Yt(l,n)?null:l}return null},Yt=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;let zt=!1;function Xi(t){return typeof t=="boolean"&&(zt=t),zt}function Os(t){const e=typeof t=="string"?vn(t,!0,zt):t;if(e){const n=St(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function zc(t,e){const n=vn(t,!0,zt);if(!n)return!1;const r=St(n.provider,n.prefix);return e?Bc(r,n.name,e):(r.missing.add(n.name),!0)}function _c(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),zt&&!e&&!t.prefix){let s=!1;return Gi(t)&&(t.prefix="",Wi(t,(i,o)=>{zc(i,o)&&(s=!0)})),s}const n=t.prefix;if(!Yt({prefix:n,name:"a"}))return!1;const r=St(e,n);return!!Zi(r,t)}const Yi=Object.freeze({width:null,height:null}),eo=Object.freeze({...Yi,...fn}),Hc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Uc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Is(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(Hc);if(r===null||!r.length)return t;const s=[];let i=r.shift(),o=Uc.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?s.push(i):s.push(Math.ceil(l*e*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}function qc(t,e="defs"){let n="";const r=t.indexOf("<"+e);for(;r>=0;){const s=t.indexOf(">",r),i=t.indexOf("</"+e);if(s===-1||i===-1)break;const o=t.indexOf(">",i);if(o===-1)break;n+=t.slice(s+1,i).trim(),t=t.slice(0,r).trim()+t.slice(o+1)}return{defs:n,content:t}}function Kc(t,e){return t?"<defs>"+t+"</defs>"+e:e}function Jc(t,e,n){const r=qc(t);return Kc(r.defs,e+r.content+n)}const Wc=t=>t==="unset"||t==="undefined"||t==="none";function Gc(t,e){const n={...Er,...t},r={...eo,...e},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(b=>{const k=[],S=b.hFlip,w=b.vFlip;let j=b.rotate;S?w?j+=2:(k.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),k.push("scale(-1 1)"),s.top=s.left=0):w&&(k.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),k.push("scale(1 -1)"),s.top=s.left=0);let N;switch(j<0&&(j-=Math.floor(j/4)*4),j=j%4,j){case 1:N=s.height/2+s.top,k.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:k.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:N=s.width/2+s.left,k.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}j%2===1&&(s.left!==s.top&&(N=s.left,s.left=s.top,s.top=N),s.width!==s.height&&(N=s.width,s.width=s.height,s.height=N)),k.length&&(i=Jc(i,'<g transform="'+k.join(" ")+'">',"</g>"))});const o=r.width,l=r.height,a=s.width,u=s.height;let d,f;o===null?(f=l===null?"1em":l==="auto"?u:l,d=Is(f,a/u)):(d=o==="auto"?a:o,f=l===null?Is(d,u/a):l==="auto"?u:l);const p={},m=(b,k)=>{Wc(k)||(p[b]=k.toString())};m("width",d),m("height",f);const C=[s.left,s.top,a,u];return p.viewBox=C.join(" "),{attributes:p,viewBox:C,body:i}}const Zc=/\sid="(\S+)"/g,Qc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Xc=0;function Yc(t,e=Qc){const n=[];let r;for(;r=Zc.exec(t);)n.push(r[1]);if(!n.length)return t;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof e=="function"?e(i):e+(Xc++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),t=t.replace(new RegExp(s,"g"),""),t}const lr=Object.create(null);function eu(t,e){lr[t]=e}function ar(t){return lr[t]||lr[""]}function Tr(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const Mr=Object.create(null),Nt=["https://api.simplesvg.com","https://api.unisvg.com"],en=[];for(;Nt.length>0;)Nt.length===1||Math.random()>.5?en.push(Nt.shift()):en.push(Nt.pop());Mr[""]=Tr({resources:["https://api.iconify.design"].concat(en)});function tu(t,e){const n=Tr(e);return n===null?!1:(Mr[t]=n,!0)}function Or(t){return Mr[t]}const nu=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let Ds=nu();function ru(t,e){const n=Or(t);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(o=>{s=Math.max(s,o.length)});const i=e+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function su(t){return t===404}const iu=(t,e,n)=>{const r=[],s=ru(t,e),i="icons";let o={type:i,provider:t,prefix:e,icons:[]},l=0;return n.forEach((a,u)=>{l+=a.length+1,l>=s&&u>0&&(r.push(o),o={type:i,provider:t,prefix:e,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function ou(t){if(typeof t=="string"){const e=Or(t);if(e)return e.path}return"/"}const lu=(t,e,n)=>{if(!Ds){n("abort",424);return}let r=ou(e.provider);switch(e.type){case"icons":{const i=e.prefix,l=e.icons.join(","),a=new URLSearchParams({icons:l});r+=i+".json?"+a.toString();break}case"custom":{const i=e.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;Ds(t+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(su(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},au={prepare:iu,send:lu};function to(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==e))})}function cu(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const r=t.provider,s=t.prefix;e.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==s)return!0;const u=a.name;if(t.icons[u])o.loaded.push({provider:r,prefix:s,name:u});else if(t.missing.has(u))o.missing.push({provider:r,prefix:s,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||to([t],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let uu=0;function du(t,e,n){const r=uu++,s=to.bind(null,n,r);if(!e.pending.length)return s;const i={id:r,icons:e,callback:t,abort:s};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function fu(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return t.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,l=s.name,a=n[i]||(n[i]=Object.create(null)),u=a[o]||(a[o]=St(i,o));let d;l in u.icons?d=e.loaded:o===""||u.missing.has(l)?d=e.missing:d=e.pending;const f={provider:i,prefix:o,name:l};d.push(f)}),e}function hu(t,e=!0,n=!1){const r=[];return t.forEach(s=>{const i=typeof s=="string"?vn(s,e,n):s;i&&r.push(i)}),r}const pu={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function mu(t,e,n,r){const s=t.resources.length,i=t.random?Math.floor(Math.random()*s):t.index;let o;if(t.random){let L=t.resources.slice(0);for(o=[];L.length>1;){const O=Math.floor(Math.random()*L.length);o.push(L[O]),L=L.slice(0,O).concat(L.slice(O+1))}o=o.concat(L)}else o=t.resources.slice(i).concat(t.resources.slice(0,i));const l=Date.now();let a="pending",u=0,d,f=null,p=[],m=[];typeof r=="function"&&m.push(r);function C(){f&&(clearTimeout(f),f=null)}function b(){a==="pending"&&(a="aborted"),C(),p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function k(L,O){O&&(m=[]),typeof L=="function"&&m.push(L)}function S(){return{startTime:l,payload:e,status:a,queriesSent:u,queriesPending:p.length,subscribe:k,abort:b}}function w(){a="failed",m.forEach(L=>{L(void 0,d)})}function j(){p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function N(L,O,z){const H=O!=="success";switch(p=p.filter(U=>U!==L),a){case"pending":break;case"failed":if(H||!t.dataAfterTimeout)return;break;default:return}if(O==="abort"){d=z,w();return}if(H){d=z,p.length||(o.length?D():w());return}if(C(),j(),!t.random){const U=t.resources.indexOf(L.resource);U!==-1&&U!==t.index&&(t.index=U)}a="completed",m.forEach(U=>{U(z)})}function D(){if(a!=="pending")return;C();const L=o.shift();if(L===void 0){if(p.length){f=setTimeout(()=>{C(),a==="pending"&&(j(),w())},t.timeout);return}w();return}const O={status:"pending",resource:L,callback:(z,H)=>{N(O,z,H)}};p.push(O),u++,f=setTimeout(D,t.rotate),n(L,e,O.callback)}return setTimeout(D),S}function no(t){const e={...pu,...t};let n=[];function r(){n=n.filter(l=>l().status==="pending")}function s(l,a,u){const d=mu(e,l,a,(f,p)=>{r(),u&&u(f,p)});return n.push(d),d}function i(l){return n.find(a=>l(a))||null}return{query:s,find:i,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:r}}function js(){}const Un=Object.create(null);function gu(t){if(!Un[t]){const e=Or(t);if(!e)return;const n=no(e),r={config:e,redundancy:n};Un[t]=r}return Un[t]}function yu(t,e,n){let r,s;if(typeof t=="string"){const i=ar(t);if(!i)return n(void 0,424),js;s=i.send;const o=gu(t);o&&(r=o.redundancy)}else{const i=Tr(t);if(i){r=no(i);const o=t.resources?t.resources[0]:"",l=ar(o);l&&(s=l.send)}}return!r||!s?(n(void 0,424),js):r.query(e,s,n)().abort}function Ls(){}function xu(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,cu(t)}))}function bu(t){const e=[],n=[];return t.forEach(r=>{(r.match(Qi)?e:n).push(r)}),{valid:e,invalid:n}}function Et(t,e,n){function r(){const s=t.pendingIcons;e.forEach(i=>{s&&s.delete(i),t.icons[i]||t.missing.add(i)})}if(n&&typeof n=="object")try{if(!Zi(t,n).length){r();return}}catch(s){console.error(s)}r(),xu(t)}function Rs(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function ku(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:r}=t,s=t.iconsToLoad;if(delete t.iconsToLoad,!s||!s.length)return;const i=t.loadIcon;if(t.loadIcons&&(s.length>1||!i)){Rs(t.loadIcons(s,r,n),d=>{Et(t,s,d)});return}if(i){s.forEach(d=>{const f=i(d,r,n);Rs(f,p=>{const m=p?{prefix:r,icons:{[d]:p}}:null;Et(t,[d],m)})});return}const{valid:o,invalid:l}=bu(s);if(l.length&&Et(t,l,null),!o.length)return;const a=r.match(Qi)?ar(n):null;if(!a){Et(t,o,null);return}a.prepare(n,r,o).forEach(d=>{yu(n,d,f=>{Et(t,d.icons,f)})})}))}const vu=(t,e)=>{const n=hu(t,!0,Xi()),r=fu(n);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,Ls)}),()=>{a=!1}}const s=Object.create(null),i=[];let o,l;return r.pending.forEach(a=>{const{provider:u,prefix:d}=a;if(d===l&&u===o)return;o=u,l=d,i.push(St(u,d));const f=s[u]||(s[u]=Object.create(null));f[d]||(f[d]=[])}),r.pending.forEach(a=>{const{provider:u,prefix:d,name:f}=a,p=St(u,d),m=p.pendingIcons||(p.pendingIcons=new Set);m.has(f)||(m.add(f),s[u][d].push(f))}),i.forEach(a=>{const u=s[a.provider][a.prefix];u.length&&ku(a,u)}),e?du(e,r,i):Ls};function Su(t,e){const n={...t};for(const r in e){const s=e[r],i=typeof s;r in Yi?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const Cu=/[\s,]+/;function wu(t,e){e.split(Cu).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Au(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(t);return isNaN(s)?0:r(s)}else if(n!==t){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return e}function Nu(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function Eu(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Tu(t){return"data:image/svg+xml,"+Eu(t)}function Mu(t){return'url("'+Tu(t)+'")'}let Dt;function Ou(){try{Dt=window.trustedTypes.createPolicy("iconify",{createHTML:t=>t})}catch{Dt=null}}function Iu(t){return Dt===void 0&&Ou(),Dt?Dt.createHTML(t):t}const ro={...eo,inline:!1},Du={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ju={display:"inline-block"},cr={backgroundColor:"currentColor"},so={backgroundColor:"transparent"},Fs={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ps={WebkitMask:cr,mask:cr,background:so};for(const t in Ps){const e=Ps[t];for(const n in Fs)e[t+n]=Fs[n]}const Lu={...ro,inline:!0};function $s(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const Ru=(t,e,n)=>{const r=e.inline?Lu:ro,s=Su(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?Du:{}};if(n){const k=vn(n,!1,!0);if(k){const S=["iconify"],w=["provider","prefix"];for(const j of w)k[j]&&S.push("iconify--"+k[j]);a.className=S.join(" ")}}for(let k in e){const S=e[k];if(S!==void 0)switch(k){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":a.ref=S;break;case"className":a[k]=(a[k]?a[k]+" ":"")+S;break;case"inline":case"hFlip":case"vFlip":s[k]=S===!0||S==="true"||S===1;break;case"flip":typeof S=="string"&&wu(s,S);break;case"color":o.color=S;break;case"rotate":typeof S=="string"?s[k]=Au(S):typeof S=="number"&&(s[k]=S);break;case"ariaHidden":case"aria-hidden":S!==!0&&S!=="true"&&delete a["aria-hidden"];break;default:r[k]===void 0&&(a[k]=S)}}const u=Gc(t,s),d=u.attributes;if(s.inline&&(o.verticalAlign="-0.125em"),i==="svg"){a.style={...o,...l},Object.assign(a,d);let k=0,S=e.id;return typeof S=="string"&&(S=S.replace(/-/g,"_")),a.dangerouslySetInnerHTML={__html:Iu(Yc(u.body,S?()=>S+"ID"+k++:"iconifyReact"))},v.createElement("svg",a)}const{body:f,width:p,height:m}=t,C=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),b=Nu(f,{...d,width:p+"",height:m+""});return a.style={...o,"--svg":Mu(b),width:$s(d.width),height:$s(d.height),...ju,...C?cr:so,...l},v.createElement("span",a)};Xi(!0);eu("",au);if(typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!_c(r))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const r="IconifyProviders["+n+"] is invalid.";try{const s=e[n];if(typeof s!="object"||!s||s.resources===void 0)continue;tu(n,s)||console.error(r)}catch{console.error(r)}}}}function io(t){const[e,n]=v.useState(!!t.ssr),[r,s]=v.useState({});function i(m){if(m){const C=t.icon;if(typeof C=="object")return{name:"",data:C};const b=Os(C);if(b)return{name:C,data:b}}return{name:""}}const[o,l]=v.useState(i(!!t.ssr));function a(){const m=r.callback;m&&(m(),s({}))}function u(m){if(JSON.stringify(o)!==JSON.stringify(m))return a(),l(m),!0}function d(){var m;const C=t.icon;if(typeof C=="object"){u({name:"",data:C});return}const b=Os(C);if(u({name:C,data:b}))if(b===void 0){const k=vu([C],d);s({callback:k})}else b&&((m=t.onLoad)===null||m===void 0||m.call(t,C))}v.useEffect(()=>(n(!0),a),[]),v.useEffect(()=>{e&&d()},[t.icon,e]);const{name:f,data:p}=o;return p?Ru({...Er,...p},t,f):t.children?t.children:t.fallback?t.fallback:v.createElement("span",{})}const Ie=v.forwardRef((t,e)=>io({...t,_ref:e}));v.forwardRef((t,e)=>io({inline:!0,...t,_ref:e}));const qn=({icon:t,children:e,testId:n})=>c.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[c.jsx(Ie,{icon:t,width:20,className:"text-default-500"}),c.jsx("span",{children:e})]}),Fu=({classes:t="",name:e,imageUrl:n,eventDate:r,eventTime:s,location:i,description:o,showImage:l=!1,showMoreButtonClassName:a,labels:u})=>{const[d,f]=v.useState(!1),[p,m]=v.useState(!1),C=v.useRef(null);return v.useEffect(()=>{const b=()=>{if(C.current){const k=C.current.scrollHeight>C.current.clientHeight;m(k)}};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[o]),c.jsxs(y.Card,{className:y.cn("border-0 shadow-none",t),"data-testid":"event-details-root",children:[c.jsxs(y.CardHeader,{className:"pt-2 pb-0 flex-col items-start space-y-2","data-testid":"event-details-header",children:[l&&n&&c.jsx("div",{className:"w-full aspect-[3/1] overflow-hidden rounded-xl","data-testid":"event-details-image-wrapper",children:c.jsx(y.Image,{alt:`Event image for ${e}`,className:"w-full h-full object-cover",src:n,"data-testid":"event-details-image"})}),c.jsx("h2",{className:"font-semibold text-xl text-gray-800","data-testid":"event-details-title",children:e})]}),c.jsxs(y.CardBody,{className:"py-3 space-y-3","data-testid":"event-details-body",children:[c.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:u.eventInformation}),c.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[r&&c.jsx(qn,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:r}),s&&c.jsx(qn,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:s}),i&&c.jsx(qn,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&c.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[c.jsx("div",{ref:C,className:y.cn("text-sm text-gray-700 leading-relaxed transition-all",!d&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),(p||d)&&c.jsx("div",{className:"flex justify-end mt-1",children:c.jsx(oe,{onPress:()=>f(!d),variant:"light",className:y.cn("text-primary",a),startContent:c.jsx(Ie,{icon:d?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:d?u.showLess||"Hide":u.showMore||"Show"})})]})]})]})};function oo(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}function Pu(t){const e=t.replace(/[^\d.,-]/g,""),n=e.match(/,\d{1,2}$/);let r;n?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");const s=parseFloat(r);return isNaN(s)?null:s}const $u={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached"},Gt=t=>typeof t=="number"&&!isNaN(t),Ir=({offer:t,quantity:e,defaultQuantity:n=0,onQuantityChange:r,currency:s="USD",locale:i="en-US",labels:o,slots:l,isDisabled:a=!1,buttonVariant:u="bordered",buttonColor:d="default",showCard:f=!0,showDescription:p=!0,showPeopleCount:m=!0,showPrice:C=!0,classNames:b={},"data-testid":k,selectedColor:S="default"})=>{const w={...$u,...o},[j,N]=v.useState(n),D=e!==void 0?e:j,L=de=>{if(a)return;const xe=Math.max(0,D+de);e===void 0&&N(xe),r?.(t.id,xe)},O=v.useMemo(()=>!Gt(t.totalTicketsSold)||!Gt(t.ticketsAllowed)?!1:t.totalTicketsSold>=t.ticketsAllowed,[t.totalTicketsSold,t.ticketsAllowed]),z=v.useMemo(()=>O||!Gt(t.ticketsAllowed)?!1:D>=t.ticketsAllowed-(t.totalTicketsSold??0),[O,t.ticketsAllowed,t.totalTicketsSold,D]),H=oo(t.price,i,s),U=()=>l?.renderName?l.renderName(t.name,t):c.jsx("h2",{"data-testid":"offer-card-name",className:y.cn("text-base font-medium",b.name),children:t.name}),P=()=>C?l?.renderPrice?l.renderPrice(t.price,H,t):c.jsx("p",{"data-testid":"offer-card-price",className:y.cn("text-primary text-base mt-1",b.price),children:H}):null,M=()=>!p||!t.description?null:l?.renderDescription?l.renderDescription(t.description,t):c.jsx("p",{"data-testid":"offer-card-description",className:y.cn("mb-4 text-sm text-gray-700 leading-relaxed",b.description),children:t.description}),F=()=>{if(!m||!Gt(t.numberOfPeople)||t.numberOfPeople<=0)return null;const de=t.numberOfPeople===1?w.person:w.people;return l?.renderPeopleCount?l.renderPeopleCount(t.numberOfPeople,de,t):c.jsxs("p",{"data-testid":"offer-card-people-count",className:y.cn("text-sm text-gray-600 flex items-center mt-2",b.peopleCount),children:[c.jsx(Ie,{icon:t.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),t.numberOfPeople," ",de]})},$=()=>{const de=D===0||a,xe=z||a;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:D,onIncrement:()=>L(1),onDecrement:()=>L(-1),isDecrementDisabled:de,isIncrementDisabled:xe,isDisabled:a}):c.jsxs("div",{className:y.cn("flex items-center gap-2",b.quantitySelector),children:[c.jsx(oe,{"data-testid":"offer-card-decrement-button",onPress:()=>L(-1),isDisabled:de,variant:u,color:D>0?S:d,radius:"full",isIconOnly:!0,size:"sm","aria-label":"Decrease quantity",children:c.jsx(Ie,{icon:"gravity-ui:minus",width:16})}),c.jsx("span",{"data-testid":"offer-card-quantity",className:y.cn("min-w-[2rem] text-center font-medium"),children:D}),c.jsx(oe,{"data-testid":"offer-card-increment-button",onPress:()=>L(1),isDisabled:xe,variant:u,color:D>0?S:d,radius:"full",isIconOnly:!0,size:"sm","aria-label":"Increase quantity",children:c.jsx(Ie,{icon:"gravity-ui:plus",width:16})})]})},B=()=>l?.renderSoldOut?l.renderSoldOut(w.soldOut):c.jsx(y.Chip,{"data-testid":"offer-card-sold-out-chip",color:"danger",className:y.cn("gap-2 px-4 h-8",b.soldOut),startContent:c.jsx(Ie,{icon:"gravity-ui:circle-info-fill",width:14}),children:c.jsx("span",{className:"font-medium text-sm",children:w.soldOut})}),Y=()=>l?.renderMaxReachedAlert?l.renderMaxReachedAlert(w.maxReached):c.jsx(y.Chip,{"data-testid":"offer-card-max-reached-chip",variant:"flat",color:"warning",classNames:{base:"gap-2 px-4 h-10",content:"text-black"},className:y.cn(" text-black! gap-2 px-4 h-10",b.maxReachedAlert),startContent:c.jsx(Ie,{icon:"gravity-ui:triangle-exclamation-fill",className:"text-black",width:16}),children:c.jsx("span",{className:"font-medium text-sm",children:w.maxReached})}),W=c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 gap-2 items-start",children:[c.jsxs("div",{className:y.cn("h-full col-span-2",O?"opacity-50 pointer-events-none select-none":""),children:[U(),P(),c.jsxs("div",{className:y.cn("md:col-span-1 xl:col-span-2 lg:col-span-1 mb-2",O?"opacity-50 pointer-events-none select-none":""),children:[F(),M()]})]}),c.jsx("div",{className:"space-x-2 p-2 h-full flex items-center justify-start md:justify-start lg:justify-end ",children:O?B():$()})]}),ye=z&&!O&&c.jsx(Re.motion.div,{className:"w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Y()});return f?c.jsxs(y.Card,{className:y.cn("w-full",b.base),"data-testid":k||`offer-card-${t.id}`,children:[c.jsx(y.CardBody,{className:y.cn("pt-1 pb-0",b.body),children:W}),c.jsx(Re.AnimatePresence,{children:ye&&c.jsx(y.CardFooter,{className:y.cn("w-full mt-0 pt-0",b.footer),children:ye})})]}):c.jsxs("div",{className:y.cn("w-full",b.base),"data-testid":k||`offer-card-${t.id}`,children:[c.jsx("div",{className:y.cn("pt-1 pb-0",b.body),children:W}),c.jsx(Re.AnimatePresence,{children:ye&&c.jsx("div",{className:y.cn("w-full mt-0 pt-0",b.footer),children:ye})})]})};Ir.displayName="OfferCard";const lo=({message:t="No offers available.",icon:e="solar:ticket-sale-outline",iconSize:n=48,showCard:r=!0,classNames:s={},renderEmpty:i})=>{if(i){const l=i();return r?c.jsx(y.Card,{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):c.jsx("div",{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:l})}const o=c.jsxs("div",{"data-testid":"offer-card-empty-content",className:y.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",s.content),children:[c.jsx(Ie,{"data-testid":"offer-card-empty-icon",icon:e,width:n,className:y.cn("mb-4",s.icon)}),c.jsx("h3",{"data-testid":"offer-card-empty-message",className:y.cn("text-lg",s.message),children:t})]});return r?c.jsx(y.Card,{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):c.jsx("div",{"data-testid":"offer-card-empty",className:y.cn("w-full",s.base),children:o})};lo.displayName="OfferCardEmpty";const Vu={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ao=({error:t,labels:e,showCard:n=!0,color:r="danger",classNames:s={}})=>{const i={...Vu,...e},o=c.jsx(y.Alert,{"data-testid":"offer-card-error-alert",color:r,title:i.title,description:t||i.description,className:s.alert});return n?c.jsx(y.Card,{"data-testid":"offer-card-error",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{"data-testid":"offer-card-error-body",children:o})}):c.jsx("div",{"data-testid":"offer-card-error",className:y.cn("w-full",s.base),children:o})};ao.displayName="OfferCardError";const Bu={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},co=({quantity:t=2,gap:e=4,classNames:n={}})=>{const r=Bu[e];return c.jsx("div",{"data-testid":"offer-card-skeleton-container",className:y.cn(r,n.base),children:Array.from({length:t}).map((s,i)=>c.jsxs(y.Card,{"data-testid":`offer-card-skeleton-${i}`,className:y.cn("w-full",n.card),children:[c.jsx(y.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:c.jsxs("div",{className:"space-y-2 w-full",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:c.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:c.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),c.jsx(y.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:c.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[c.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:c.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:c.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),c.jsx("div",{className:"flex items-start justify-end",children:c.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),c.jsx(y.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};co.displayName="OfferCardSkeleton";const uo={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},fo={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},zu={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},ho=({offers:t=[],selection:e,defaultSelection:n={},onSelectionChange:r,onQuantityChange:s,currency:i="USD",locale:o="en-US",labels:l,slots:a,isDisabled:u=!1,buttonVariant:d="bordered",buttonColor:f="default",showCard:p=!0,animated:m=!0,gap:C=2,classNames:b={}})=>{const[k,S]=v.useState(n),w=e!==void 0?e:k,j=v.useCallback((z,H)=>{const U={...w,[z]:Math.max(0,H)};e===void 0&&S(U),r?.(U),s?.(z,U[z])},[w,e,r,s]),N=[...t].sort((z,H)=>(z.position??0)-(H.position??0)),D=zu[C],L=y.cn("grid mx-auto pt-2",D,b.base),O=z=>c.jsx(Ir,{offer:z,quantity:w[z.id]||0,onQuantityChange:j,currency:i,locale:o,labels:l,slots:a,isDisabled:u,buttonVariant:d,buttonColor:f,showCard:p,classNames:b.card},z.id);return m?c.jsx(Re.motion.div,{"data-testid":"offer-card-list",className:L,variants:uo,initial:"hidden",animate:"show",children:c.jsx(Re.AnimatePresence,{children:N.map(z=>c.jsx(Re.motion.div,{"data-testid":`offer-card-list-item-${z.id}`,className:b.cardWrapper,variants:fo,exit:{opacity:0,y:-20},transition:{duration:.3},children:O(z)},z.id))})}):c.jsx("div",{"data-testid":"offer-card-list",className:L,children:N.map(O)})};ho.displayName="OfferCardList";var Ut=t=>t.type==="checkbox",at=t=>t instanceof Date,Ce=t=>t==null;const po=t=>typeof t=="object";var ue=t=>!Ce(t)&&!Array.isArray(t)&&po(t)&&!at(t),mo=t=>ue(t)&&t.target?Ut(t.target)?t.target.checked:t.target.value:t,_u=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,go=(t,e)=>t.has(_u(e)),Hu=t=>{const e=t.constructor&&t.constructor.prototype;return ue(e)&&e.hasOwnProperty("isPrototypeOf")},Dr=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function le(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Dr&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(ue(t)&&Hu(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=le(t[s]));return r}var Sn=t=>/^\w*$/.test(t),re=t=>t===void 0,jr=t=>Array.isArray(t)?t.filter(Boolean):[],Lr=t=>jr(t.replace(/["|']|\]/g,"").split(/\.|\[/)),T=(t,e,n)=>{if(!e||!ue(t))return n;const r=(Sn(e)?[e]:Lr(e)).reduce((s,i)=>Ce(s)?s:s[i],t);return re(r)||r===t?re(t[e])?n:t[e]:r},Ae=t=>typeof t=="boolean",Se=t=>typeof t=="function",ee=(t,e,n)=>{let r=-1;const s=Sn(e)?[e]:Lr(e),i=s.length,o=i-1;for(;++r<i;){const l=s[r];let a=n;if(r!==o){const u=t[l];a=ue(u)||Array.isArray(u)?u:isNaN(+s[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=a,t=t[l]}};const hn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},je={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ze={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},yo=v.createContext(null);yo.displayName="HookFormControlContext";const Rr=()=>v.useContext(yo);var xo=(t,e,n,r=!0)=>{const s={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(s,i,{get:()=>{const o=i;return e._proxyFormState[o]!==je.all&&(e._proxyFormState[o]=!r||je.all),n&&(n[o]=!0),t[o]}});return s};const Fr=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Uu(t){const e=Rr(),{control:n=e,disabled:r,name:s,exact:i}=t||{},[o,l]=v.useState(n._formState),a=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Fr(()=>n._subscribe({name:s,formState:a.current,exact:i,callback:u=>{!r&&l({...n._formState,...u})}}),[s,r,i]),v.useEffect(()=>{a.current.isValid&&n._setValid(!0)},[n]),v.useMemo(()=>xo(o,n,a.current,!1),[o,n])}var Ee=t=>typeof t=="string",ur=(t,e,n,r,s)=>Ee(t)?(r&&e.watch.add(t),T(n,t,s)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),T(n,i))):(r&&(e.watchAll=!0),n),dr=t=>Ce(t)||!po(t);function Le(t,e,n=new WeakSet){if(dr(t)||dr(e))return Object.is(t,e);if(at(t)&&at(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const i of r){const o=t[i];if(!s.includes(i))return!1;if(i!=="ref"){const l=e[i];if(at(o)&&at(l)||ue(o)&&ue(l)||Array.isArray(o)&&Array.isArray(l)?!Le(o,l,n):!Object.is(o,l))return!1}}return!0}function qu(t){const e=Rr(),{control:n=e,name:r,defaultValue:s,disabled:i,exact:o,compute:l}=t||{},a=v.useRef(s),u=v.useRef(l),d=v.useRef(void 0),f=v.useRef(n),p=v.useRef(r);u.current=l;const[m,C]=v.useState(()=>{const N=n._getWatch(r,a.current);return u.current?u.current(N):N}),b=v.useCallback(N=>{const D=ur(r,n._names,N||n._formValues,!1,a.current);return u.current?u.current(D):D},[n._formValues,n._names,r]),k=v.useCallback(N=>{if(!i){const D=ur(r,n._names,N||n._formValues,!1,a.current);if(u.current){const L=u.current(D);Le(L,d.current)||(C(L),d.current=L)}else C(D)}},[n._formValues,n._names,i,r]);Fr(()=>((f.current!==n||!Le(p.current,r))&&(f.current=n,p.current=r,k()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:N=>{k(N.values)}})),[n,o,r,k]),v.useEffect(()=>n._removeUnmounted());const S=f.current!==n,w=p.current,j=v.useMemo(()=>{if(i)return null;const N=!S&&!Le(w,r);return S||N?b():null},[i,S,r,w,b]);return j!==null?j:m}function Ku(t){const e=Rr(),{name:n,disabled:r,control:s=e,shouldUnregister:i,defaultValue:o,exact:l=!0}=t,a=go(s._names.array,n),u=v.useMemo(()=>T(s._formValues,n,T(s._defaultValues,n,o)),[s,n,o]),d=qu({control:s,name:n,defaultValue:u,exact:l}),f=Uu({control:s,name:n,exact:l}),p=v.useRef(t),m=v.useRef(void 0),C=v.useRef(s.register(n,{...t.rules,value:d,...Ae(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const b=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!T(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!T(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!T(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!T(f.validatingFields,n)},error:{enumerable:!0,get:()=>T(f.errors,n)}}),[f,n]),k=v.useCallback(N=>C.current.onChange({target:{value:mo(N),name:n},type:hn.CHANGE}),[n]),S=v.useCallback(()=>C.current.onBlur({target:{value:T(s._formValues,n),name:n},type:hn.BLUR}),[n,s._formValues]),w=v.useCallback(N=>{const D=T(s._fields,n);D&&D._f&&N&&(D._f.ref={focus:()=>Se(N.focus)&&N.focus(),select:()=>Se(N.select)&&N.select(),setCustomValidity:L=>Se(N.setCustomValidity)&&N.setCustomValidity(L),reportValidity:()=>Se(N.reportValidity)&&N.reportValidity()})},[s._fields,n]),j=v.useMemo(()=>({name:n,value:d,...Ae(r)||f.disabled?{disabled:f.disabled||r}:{},onChange:k,onBlur:S,ref:w}),[n,r,f.disabled,k,S,w,d]);return v.useEffect(()=>{const N=s._options.shouldUnregister||i,D=m.current;D&&D!==n&&!a&&s.unregister(D),s.register(n,{...p.current.rules,...Ae(p.current.disabled)?{disabled:p.current.disabled}:{}});const L=(O,z)=>{const H=T(s._fields,O);H&&H._f&&(H._f.mount=z)};if(L(n,!0),N){const O=le(T(s._options.defaultValues,n,p.current.defaultValue));ee(s._defaultValues,n,O),re(T(s._formValues,n))&&ee(s._formValues,n,O)}return!a&&s.register(n),m.current=n,()=>{(a?N&&!s._state.action:N)?s.unregister(n):L(n,!1)}},[n,s,a,i]),v.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),v.useMemo(()=>({field:j,formState:f,fieldState:b}),[j,f,b])}const Ju=v.createContext(null);Ju.displayName="HookFormContext";var Wu=(t,e,n,r,s)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:s||!0}}:{},jt=t=>Array.isArray(t)?t:[t],Vs=()=>{let t=[];return{get observers(){return t},next:s=>{for(const i of t)i.next&&i.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(i=>i!==s)}}),unsubscribe:()=>{t=[]}}};function bo(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const s=t[r],i=e[r];if(s&&ue(s)&&i){const o=bo(s,i);ue(o)&&(n[r]=o)}else t[r]&&(n[r]=i)}return n}var ke=t=>ue(t)&&!Object.keys(t).length,Pr=t=>t.type==="file",pn=t=>{if(!Dr)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},ko=t=>t.type==="select-multiple",$r=t=>t.type==="radio",Gu=t=>$r(t)||Ut(t),Kn=t=>pn(t)&&t.isConnected;function Zu(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=re(t)?r++:t[e[r++]];return t}function Qu(t){for(const e in t)if(t.hasOwnProperty(e)&&!re(t[e]))return!1;return!0}function ae(t,e){const n=Array.isArray(e)?e:Sn(e)?[e]:Lr(e),r=n.length===1?t:Zu(t,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(ue(r)&&ke(r)||Array.isArray(r)&&Qu(r))&&ae(t,n.slice(0,-1)),t}var Xu=t=>{for(const e in t)if(Se(t[e]))return!0;return!1};function vo(t){return Array.isArray(t)||ue(t)&&!Xu(t)}function fr(t,e={}){for(const n in t){const r=t[n];vo(r)?(e[n]=Array.isArray(r)?[]:{},fr(r,e[n])):re(r)||(e[n]=!0)}return e}function bt(t,e,n){n||(n=fr(e));for(const r in t){const s=t[r];if(vo(s))re(e)||dr(n[r])?n[r]=fr(s,Array.isArray(s)?[]:{}):bt(s,Ce(e)?{}:e[r],n[r]);else{const i=e[r];n[r]=!Le(s,i)}}return n}const Bs={value:!1,isValid:!1},zs={value:!0,isValid:!0};var So=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!re(t[0].attributes.value)?re(t[0].value)||t[0].value===""?zs:{value:t[0].value,isValid:!0}:zs:Bs}return Bs},Co=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>re(t)?t:e?t===""?NaN:t&&+t:n&&Ee(t)?new Date(t):r?r(t):t;const _s={isValid:!1,value:null};var wo=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,_s):_s;function Hs(t){const e=t.ref;return Pr(e)?e.files:$r(e)?wo(t.refs).value:ko(e)?[...e.selectedOptions].map(({value:n})=>n):Ut(e)?So(t.refs).value:Co(re(e.value)?t.ref.value:e.value,t)}var Yu=(t,e,n,r)=>{const s={};for(const i of t){const o=T(e,i);o&&ee(s,i,o._f)}return{criteriaMode:n,names:[...t],fields:s,shouldUseNativeValidation:r}},mn=t=>t instanceof RegExp,Tt=t=>re(t)?t:mn(t)?t.source:ue(t)?mn(t.value)?t.value.source:t.value:t,Us=t=>({isOnSubmit:!t||t===je.onSubmit,isOnBlur:t===je.onBlur,isOnChange:t===je.onChange,isOnAll:t===je.all,isOnTouch:t===je.onTouched});const qs="AsyncFunction";var ed=t=>!!t&&!!t.validate&&!!(Se(t.validate)&&t.validate.constructor.name===qs||ue(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===qs)),td=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Ks=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Lt=(t,e,n,r)=>{for(const s of n||Object.keys(t)){const i=T(t,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],s)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(Lt(l,e))break}else if(ue(l)&&Lt(l,e))break}}};function Js(t,e,n){const r=T(t,n);if(r||Sn(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=T(e,i),l=T(t,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};s.pop()}return{name:n}}var nd=(t,e,n,r)=>{n(t);const{name:s,...i}=t;return ke(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(o=>e[o]===(!r||je.all))},rd=(t,e,n)=>!t||!e||t===e||jt(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),sd=(t,e,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(e||t):(n?r.isOnBlur:s.isOnBlur)?!t:(n?r.isOnChange:s.isOnChange)?t:!0,id=(t,e)=>!jr(T(t,e)).length&&ae(t,e),od=(t,e,n)=>{const r=jt(T(t,n));return ee(r,"root",e[n]),ee(t,n,r),t};function Ws(t,e,n="validate"){if(Ee(t)||Array.isArray(t)&&t.every(Ee)||Ae(t)&&!t)return{type:n,message:Ee(t)?t:"",ref:e}}var gt=t=>ue(t)&&!mn(t)?t:{value:t,message:""},Gs=async(t,e,n,r,s,i)=>{const{ref:o,refs:l,required:a,maxLength:u,minLength:d,min:f,max:p,pattern:m,validate:C,name:b,valueAsNumber:k,mount:S}=t._f,w=T(n,b);if(!S||e.has(b))return{};const j=l?l[0]:o,N=M=>{s&&j.reportValidity&&(j.setCustomValidity(Ae(M)?"":M||""),j.reportValidity())},D={},L=$r(o),O=Ut(o),z=L||O,H=(k||Pr(o))&&re(o.value)&&re(w)||pn(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,U=Wu.bind(null,b,r,D),P=(M,F,$,B=ze.maxLength,Y=ze.minLength)=>{const W=M?F:$;D[b]={type:M?B:Y,message:W,ref:o,...U(M?B:Y,W)}};if(i?!Array.isArray(w)||!w.length:a&&(!z&&(H||Ce(w))||Ae(w)&&!w||O&&!So(l).isValid||L&&!wo(l).isValid)){const{value:M,message:F}=Ee(a)?{value:!!a,message:a}:gt(a);if(M&&(D[b]={type:ze.required,message:F,ref:j,...U(ze.required,F)},!r))return N(F),D}if(!H&&(!Ce(f)||!Ce(p))){let M,F;const $=gt(p),B=gt(f);if(!Ce(w)&&!isNaN(w)){const Y=o.valueAsNumber||w&&+w;Ce($.value)||(M=Y>$.value),Ce(B.value)||(F=Y<B.value)}else{const Y=o.valueAsDate||new Date(w),W=xe=>new Date(new Date().toDateString()+" "+xe),ye=o.type=="time",de=o.type=="week";Ee($.value)&&w&&(M=ye?W(w)>W($.value):de?w>$.value:Y>new Date($.value)),Ee(B.value)&&w&&(F=ye?W(w)<W(B.value):de?w<B.value:Y<new Date(B.value))}if((M||F)&&(P(!!M,$.message,B.message,ze.max,ze.min),!r))return N(D[b].message),D}if((u||d)&&!H&&(Ee(w)||i&&Array.isArray(w))){const M=gt(u),F=gt(d),$=!Ce(M.value)&&w.length>+M.value,B=!Ce(F.value)&&w.length<+F.value;if(($||B)&&(P($,M.message,F.message),!r))return N(D[b].message),D}if(m&&!H&&Ee(w)){const{value:M,message:F}=gt(m);if(mn(M)&&!w.match(M)&&(D[b]={type:ze.pattern,message:F,ref:o,...U(ze.pattern,F)},!r))return N(F),D}if(C){if(Se(C)){const M=await C(w,n),F=Ws(M,j);if(F&&(D[b]={...F,...U(ze.validate,F.message)},!r))return N(F.message),D}else if(ue(C)){let M={};for(const F in C){if(!ke(M)&&!r)break;const $=Ws(await C[F](w,n),j,F);$&&(M={...$,...U(F,$.message)},N($.message),r&&(D[b]=M))}if(!ke(M)&&(D[b]={ref:j,...M},!r))return D}}return N(!0),D};const ld={mode:je.onSubmit,reValidateMode:je.onChange,shouldFocusError:!0};function ad(t={}){let e={...ld,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Se(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},s=ue(e.defaultValues)||ue(e.values)?le(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:le(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},a,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let p={...f};const m={array:Vs(),state:Vs()},C=e.criteriaMode===je.all,b=h=>g=>{clearTimeout(u),u=setTimeout(h,g)},k=async h=>{if(!o.keepIsValid&&!e.disabled&&(f.isValid||p.isValid||h)){let g;e.resolver?(g=ke((await z()).errors),S()):g=await U(r,!0),g!==n.isValid&&m.state.next({isValid:g})}},S=(h,g)=>{!e.disabled&&(f.isValidating||f.validatingFields||p.isValidating||p.validatingFields)&&((h||Array.from(l.mount)).forEach(x=>{x&&(g?ee(n.validatingFields,x,g):ae(n.validatingFields,x))}),m.state.next({validatingFields:n.validatingFields,isValidating:!ke(n.validatingFields)}))},w=(h,g=[],x,I,E=!0,A=!0)=>{if(I&&x&&!e.disabled){if(o.action=!0,A&&Array.isArray(T(r,h))){const V=x(T(r,h),I.argA,I.argB);E&&ee(r,h,V)}if(A&&Array.isArray(T(n.errors,h))){const V=x(T(n.errors,h),I.argA,I.argB);E&&ee(n.errors,h,V),id(n.errors,h)}if((f.touchedFields||p.touchedFields)&&A&&Array.isArray(T(n.touchedFields,h))){const V=x(T(n.touchedFields,h),I.argA,I.argB);E&&ee(n.touchedFields,h,V)}(f.dirtyFields||p.dirtyFields)&&(n.dirtyFields=bt(s,i)),m.state.next({name:h,isDirty:M(h,g),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ee(i,h,g)},j=(h,g)=>{ee(n.errors,h,g),m.state.next({errors:n.errors})},N=h=>{n.errors=h,m.state.next({errors:n.errors,isValid:!1})},D=(h,g,x,I)=>{const E=T(r,h);if(E){const A=T(i,h,re(x)?T(s,h):x);re(A)||I&&I.defaultChecked||g?ee(i,h,g?A:Hs(E._f)):B(h,A),o.mount&&!o.action&&k()}},L=(h,g,x,I,E)=>{let A=!1,V=!1;const G={name:h};if(!e.disabled){if(!x||I){(f.isDirty||p.isDirty)&&(V=n.isDirty,n.isDirty=G.isDirty=M(),A=V!==G.isDirty);const Z=Le(T(s,h),g);V=!!T(n.dirtyFields,h),Z?ae(n.dirtyFields,h):ee(n.dirtyFields,h,!0),G.dirtyFields=n.dirtyFields,A=A||(f.dirtyFields||p.dirtyFields)&&V!==!Z}if(x){const Z=T(n.touchedFields,h);Z||(ee(n.touchedFields,h,x),G.touchedFields=n.touchedFields,A=A||(f.touchedFields||p.touchedFields)&&Z!==x)}A&&E&&m.state.next(G)}return A?G:{}},O=(h,g,x,I)=>{const E=T(n.errors,h),A=(f.isValid||p.isValid)&&Ae(g)&&n.isValid!==g;if(e.delayError&&x?(a=b(()=>j(h,x)),a(e.delayError)):(clearTimeout(u),a=null,x?ee(n.errors,h,x):ae(n.errors,h)),(x?!Le(E,x):E)||!ke(I)||A){const V={...I,...A&&Ae(g)?{isValid:g}:{},errors:n.errors,name:h};n={...n,...V},m.state.next(V)}},z=async h=>(S(h,!0),await e.resolver(i,e.context,Yu(h||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),H=async h=>{const{errors:g}=await z(h);if(S(h),h)for(const x of h){const I=T(g,x);I?ee(n.errors,x,I):ae(n.errors,x)}else n.errors=g;return g},U=async(h,g,x={valid:!0})=>{for(const I in h){const E=h[I];if(E){const{_f:A,...V}=E;if(A){const G=l.array.has(A.name),Z=E._f&&ed(E._f);Z&&f.validatingFields&&S([A.name],!0);const be=await Gs(E,l.disabled,i,C,e.shouldUseNativeValidation&&!g,G);if(Z&&f.validatingFields&&S([A.name]),be[A.name]&&(x.valid=!1,g||t.shouldUseNativeValidation))break;!g&&(T(be,A.name)?G?od(n.errors,be,A.name):ee(n.errors,A.name,be[A.name]):ae(n.errors,A.name))}!ke(V)&&await U(V,g,x)}}return x.valid},P=()=>{for(const h of l.unMount){const g=T(r,h);g&&(g._f.refs?g._f.refs.every(x=>!Kn(x)):!Kn(g._f.ref))&&wn(h)}l.unMount=new Set},M=(h,g)=>!e.disabled&&(h&&g&&ee(i,h,g),!Le(qe(),s)),F=(h,g,x)=>ur(h,l,{...o.mount?i:re(g)?s:Ee(h)?{[h]:g}:g},x,g),$=h=>jr(T(o.mount?i:s,h,e.shouldUnregister?T(s,h,[]):[])),B=(h,g,x={})=>{const I=T(r,h);let E=g;if(I){const A=I._f;A&&(!A.disabled&&ee(i,h,Co(g,A)),E=pn(A.ref)&&Ce(g)?"":g,ko(A.ref)?[...A.ref.options].forEach(V=>V.selected=E.includes(V.value)):A.refs?Ut(A.ref)?A.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(E)?V.checked=!!E.find(G=>G===V.value):V.checked=E===V.value||!!E)}):A.refs.forEach(V=>V.checked=V.value===E):Pr(A.ref)?A.ref.value="":(A.ref.value=E,A.ref.type||m.state.next({name:h,values:le(i)})))}(x.shouldDirty||x.shouldTouch)&&L(h,E,x.shouldTouch,x.shouldDirty,!0),x.shouldValidate&&xe(h)},Y=(h,g,x)=>{for(const I in g){if(!g.hasOwnProperty(I))return;const E=g[I],A=h+"."+I,V=T(r,A);(l.array.has(h)||ue(E)||V&&!V._f)&&!at(E)?Y(A,E,x):B(A,E,x)}},W=(h,g,x={})=>{const I=T(r,h),E=l.array.has(h),A=le(g);ee(i,h,A),E?(m.array.next({name:h,values:le(i)}),(f.isDirty||f.dirtyFields||p.isDirty||p.dirtyFields)&&x.shouldDirty&&m.state.next({name:h,dirtyFields:bt(s,i),isDirty:M(h,A)})):I&&!I._f&&!Ce(A)?Y(h,A,x):B(h,A,x),Ks(h,l)?m.state.next({...n,name:h,values:le(i)}):m.state.next({name:o.mount?h:void 0,values:le(i)})},ye=async h=>{o.mount=!0;const g=h.target;let x=g.name,I=!0;const E=T(r,x),A=Z=>{I=Number.isNaN(Z)||at(Z)&&isNaN(Z.getTime())||Le(Z,T(i,x,Z))},V=Us(e.mode),G=Us(e.reValidateMode);if(E){let Z,be;const tt=g.type?Hs(E._f):mo(h),Ke=h.type===hn.BLUR||h.type===hn.FOCUS_OUT,jo=!td(E._f)&&!e.resolver&&!T(n.errors,x)&&!E._f.deps||sd(Ke,T(n.touchedFields,x),n.isSubmitted,G,V),En=Ks(x,l,Ke);ee(i,x,tt),Ke?(!g||!g.readOnly)&&(E._f.onBlur&&E._f.onBlur(h),a&&a(0)):E._f.onChange&&E._f.onChange(h);const Tn=L(x,tt,Ke),Lo=!ke(Tn)||En;if(!Ke&&m.state.next({name:x,type:h.type,values:le(i)}),jo)return(f.isValid||p.isValid)&&(e.mode==="onBlur"?Ke&&k():Ke||k()),Lo&&m.state.next({name:x,...En?{}:Tn});if(!Ke&&En&&m.state.next({...n}),e.resolver){const{errors:qr}=await z([x]);if(S([x]),A(tt),I){const Ro=Js(n.errors,r,x),Kr=Js(qr,r,Ro.name||x);Z=Kr.error,x=Kr.name,be=ke(qr)}}else S([x],!0),Z=(await Gs(E,l.disabled,i,C,e.shouldUseNativeValidation))[x],S([x]),A(tt),I&&(Z?be=!1:(f.isValid||p.isValid)&&(be=await U(r,!0)));I&&(E._f.deps&&(!Array.isArray(E._f.deps)||E._f.deps.length>0)&&xe(E._f.deps),O(x,be,Z,Tn))}},de=(h,g)=>{if(T(n.errors,g)&&h.focus)return h.focus(),1},xe=async(h,g={})=>{let x,I;const E=jt(h);if(e.resolver){const A=await H(re(h)?h:E);x=ke(A),I=h?!E.some(V=>T(A,V)):x}else h?(I=(await Promise.all(E.map(async A=>{const V=T(r,A);return await U(V&&V._f?{[A]:V}:V)}))).every(Boolean),!(!I&&!n.isValid)&&k()):I=x=await U(r);return m.state.next({...!Ee(h)||(f.isValid||p.isValid)&&x!==n.isValid?{}:{name:h},...e.resolver||!h?{isValid:x}:{},errors:n.errors}),g.shouldFocus&&!I&&Lt(r,de,h?E:l.mount),I},qe=(h,g)=>{let x={...o.mount?i:s};return g&&(x=bo(g.dirtyFields?n.dirtyFields:n.touchedFields,x)),re(h)?x:Ee(h)?T(x,h):h.map(I=>T(x,I))},pt=(h,g)=>({invalid:!!T((g||n).errors,h),isDirty:!!T((g||n).dirtyFields,h),error:T((g||n).errors,h),isValidating:!!T(n.validatingFields,h),isTouched:!!T((g||n).touchedFields,h)}),Ct=h=>{h&&jt(h).forEach(g=>ae(n.errors,g)),m.state.next({errors:h?n.errors:{}})},ne=(h,g,x)=>{const I=(T(r,h,{_f:{}})._f||{}).ref,E=T(n.errors,h)||{},{ref:A,message:V,type:G,...Z}=E;ee(n.errors,h,{...Z,...g,ref:I}),m.state.next({name:h,errors:n.errors,isValid:!1}),x&&x.shouldFocus&&I&&I.focus&&I.focus()},we=(h,g)=>Se(h)?m.state.subscribe({next:x=>"values"in x&&h(F(void 0,g),x)}):F(h,g,!0),wt=h=>m.state.subscribe({next:g=>{rd(h.name,g.name,h.exact)&&nd(g,h.formState||f,Do,h.reRenderRoot)&&h.callback({values:{...i},...n,...g,defaultValues:s})}}).unsubscribe,Cn=h=>(o.mount=!0,p={...p,...h.formState},wt({...h,formState:{...d,...h.formState}})),wn=(h,g={})=>{for(const x of h?jt(h):l.mount)l.mount.delete(x),l.array.delete(x),g.keepValue||(ae(r,x),ae(i,x)),!g.keepError&&ae(n.errors,x),!g.keepDirty&&ae(n.dirtyFields,x),!g.keepTouched&&ae(n.touchedFields,x),!g.keepIsValidating&&ae(n.validatingFields,x),!e.shouldUnregister&&!g.keepDefaultValue&&ae(s,x);m.state.next({values:le(i)}),m.state.next({...n,...g.keepDirty?{isDirty:M()}:{}}),!g.keepIsValid&&k()},Br=({disabled:h,name:g})=>{if(Ae(h)&&o.mount||h||l.disabled.has(g)){const E=l.disabled.has(g)!==!!h;h?l.disabled.add(g):l.disabled.delete(g),E&&o.mount&&!o.action&&k()}},An=(h,g={})=>{let x=T(r,h);const I=Ae(g.disabled)||Ae(e.disabled);return ee(r,h,{...x||{},_f:{...x&&x._f?x._f:{ref:{name:h}},name:h,mount:!0,...g}}),l.mount.add(h),x?Br({disabled:Ae(g.disabled)?g.disabled:e.disabled,name:h}):D(h,!0,g.value),{...I?{disabled:g.disabled||e.disabled}:{},...e.progressive?{required:!!g.required,min:Tt(g.min),max:Tt(g.max),minLength:Tt(g.minLength),maxLength:Tt(g.maxLength),pattern:Tt(g.pattern)}:{},name:h,onChange:ye,onBlur:ye,ref:E=>{if(E){An(h,g),x=T(r,h);const A=re(E.value)&&E.querySelectorAll&&E.querySelectorAll("input,select,textarea")[0]||E,V=Gu(A),G=x._f.refs||[];if(V?G.find(Z=>Z===A):A===x._f.ref)return;ee(r,h,{_f:{...x._f,...V?{refs:[...G.filter(Kn),A,...Array.isArray(T(s,h))?[{}]:[]],ref:{type:A.type,name:h}}:{ref:A}}}),D(h,!1,void 0,A)}else x=T(r,h,{}),x._f&&(x._f.mount=!1),(e.shouldUnregister||g.shouldUnregister)&&!(go(l.array,h)&&o.action)&&l.unMount.add(h)}}},Nn=()=>e.shouldFocusError&&Lt(r,de,l.mount),Mo=h=>{Ae(h)&&(m.state.next({disabled:h}),Lt(r,(g,x)=>{const I=T(r,x);I&&(g.disabled=I._f.disabled||h,Array.isArray(I._f.refs)&&I._f.refs.forEach(E=>{E.disabled=I._f.disabled||h}))},0,!1))},zr=(h,g)=>async x=>{let I;x&&(x.preventDefault&&x.preventDefault(),x.persist&&x.persist());let E=le(i);if(m.state.next({isSubmitting:!0}),e.resolver){const{errors:A,values:V}=await z();S(),n.errors=A,E=le(V)}else await U(r);if(l.disabled.size)for(const A of l.disabled)ae(E,A);if(ae(n.errors,"root"),ke(n.errors)){m.state.next({errors:{}});try{await h(E,x)}catch(A){I=A}}else g&&await g({...n.errors},x),Nn(),setTimeout(Nn);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ke(n.errors)&&!I,submitCount:n.submitCount+1,errors:n.errors}),I)throw I},Oo=(h,g={})=>{T(r,h)&&(re(g.defaultValue)?W(h,le(T(s,h))):(W(h,g.defaultValue),ee(s,h,le(g.defaultValue))),g.keepTouched||ae(n.touchedFields,h),g.keepDirty||(ae(n.dirtyFields,h),n.isDirty=g.defaultValue?M(h,le(T(s,h))):M()),g.keepError||(ae(n.errors,h),f.isValid&&k()),m.state.next({...n}))},_r=(h,g={})=>{const x=h?le(h):s,I=le(x),E=ke(h),A=E?s:I;if(g.keepDefaultValues||(s=x),!g.keepValues){if(g.keepDirtyValues){const V=new Set([...l.mount,...Object.keys(bt(s,i))]);for(const G of Array.from(V)){const Z=T(n.dirtyFields,G),be=T(i,G),tt=T(A,G);Z&&!re(be)?ee(A,G,be):!Z&&!re(tt)&&W(G,tt)}}else{if(Dr&&re(h))for(const V of l.mount){const G=T(r,V);if(G&&G._f){const Z=Array.isArray(G._f.refs)?G._f.refs[0]:G._f.ref;if(pn(Z)){const be=Z.closest("form");if(be){be.reset();break}}}}if(g.keepFieldsRef)for(const V of l.mount)W(V,T(A,V));else r={}}i=e.shouldUnregister?g.keepDefaultValues?le(s):{}:le(A),m.array.next({values:{...A}}),m.state.next({values:{...A}})}l={mount:g.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!g.keepIsValid||!!g.keepDirtyValues||!e.shouldUnregister&&!ke(A),o.watch=!!e.shouldUnregister,o.keepIsValid=!!g.keepIsValid,o.action=!1,g.keepErrors||(n.errors={}),m.state.next({submitCount:g.keepSubmitCount?n.submitCount:0,isDirty:E?!1:g.keepDirty?n.isDirty:!!(g.keepDefaultValues&&!Le(h,s)),isSubmitted:g.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:E?{}:g.keepDirtyValues?g.keepDefaultValues&&i?bt(s,i):n.dirtyFields:g.keepDefaultValues&&h?bt(s,h):g.keepDirty?n.dirtyFields:{},touchedFields:g.keepTouched?n.touchedFields:{},errors:g.keepErrors?n.errors:{},isSubmitSuccessful:g.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Hr=(h,g)=>_r(Se(h)?h(i):h,{...e.resetOptions,...g}),Io=(h,g={})=>{const x=T(r,h),I=x&&x._f;if(I){const E=I.refs?I.refs[0]:I.ref;E.focus&&setTimeout(()=>{E.focus(),g.shouldSelect&&Se(E.select)&&E.select()})}},Do=h=>{n={...n,...h}},Ur={control:{register:An,unregister:wn,getFieldState:pt,handleSubmit:zr,setError:ne,_subscribe:wt,_runSchema:z,_updateIsValidating:S,_focusError:Nn,_getWatch:F,_getDirty:M,_setValid:k,_setFieldArray:w,_setDisabledField:Br,_setErrors:N,_getFieldArray:$,_reset:_r,_resetDefaultValues:()=>Se(e.defaultValues)&&e.defaultValues().then(h=>{Hr(h,e.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:P,_disableForm:Mo,_subjects:m,_proxyFormState:f,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(h){o=h},get _defaultValues(){return s},get _names(){return l},set _names(h){l=h},get _formState(){return n},get _options(){return e},set _options(h){e={...e,...h}}},subscribe:Cn,trigger:xe,register:An,handleSubmit:zr,watch:we,setValue:W,getValues:qe,reset:Hr,resetField:Oo,clearErrors:Ct,unregister:wn,setError:ne,setFocus:Io,getFieldState:pt};return{...Ur,formControl:Ur}}function cd(t={}){const e=v.useRef(void 0),n=v.useRef(void 0),[r,s]=v.useState({isDirty:!1,isValidating:!1,isLoading:Se(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Se(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!Se(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...l}=ad(t);e.current={...l,formState:r}}const i=e.current.control;return i._options=t,Fr(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>s({...i._formState}),reRenderRoot:!0});return s(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),v.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),v.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),v.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),v.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),v.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),v.useEffect(()=>{var o;t.values&&!Le(t.values,n.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.current=t.values,s(l=>({...l}))):i._resetDefaultValues()},[i,t.values]),v.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=v.useMemo(()=>xo(r,i),[i,r]),e.current}function ud(t,e=3){return t%1===0?t.toString():t.toFixed(e).replace(/\.?0+$/,"")}function dd(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}function fd(t="USD",e="en-US"){try{return new Intl.NumberFormat(e,{style:"currency",currency:t}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function hd(t){const e=t.replace(/[^\d.,-]/g,""),n=e.match(/,\d{1,2}$/);let r;n?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");const s=parseFloat(r);return isNaN(s)?null:s}function pd(t,e,n=.001){const r=t-e,s=Math.abs(r)<=n;return{difference:r,isBalanced:s,isUnderAllocated:!s&&r>0,isOverAllocated:!s&&r<0}}function Vr(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Vr();const md={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Jn=()=>({id:Vr(),amount:0,glAccount:null,isTaxDeductible:!1}),Ao=({distribution:t,defaultDistribution:e,glAccounts:n=[],isLoadingGlAccounts:r=!1,onSearchGlAccounts:s,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:a,onDelete:u,canDelete:d=!0,canEditTaxDeductible:f=!0,isDisabled:p=!1,labels:m,classNames:C={},"data-testid":b,control:k,name:S,rules:w})=>{const j={...md,...m},N=k!==void 0&&S!==void 0,D=cd({defaultValues:{_internal:e||Jn()}}),L=Ku({control:N?k:D.control,name:N?S:"_internal",rules:N?w:void 0}),[O,z]=v.useState(e||Jn()),H=N?L.field.value??Jn():t??O,U=N&&!!L.fieldState?.error,P=N&&(L.fieldState?.isTouched??!1),M=U||P,F=M&&(!H.amount||H.amount<=0),$=M&&!H.glAccount,[B,Y]=v.useState(H.glAccount?.name||""),W=v.useCallback(ne=>{const we={...H,...ne};N&&L.field.onChange(we),!N&&t===void 0&&z(we),i?.(we)},[H,t,i,N,L]),ye=v.useCallback(ne=>{const we=ne||0;W({amount:we}),o?.(we)},[W,o]),de=v.useCallback(ne=>{Y(ne),s?.(ne)},[s]),xe=v.useCallback(ne=>{if(ne===null){W({glAccount:null}),l?.(null);return}const wt=n.find(Cn=>String(Cn.id)===String(ne))||null;W({glAccount:wt}),l?.(wt)},[n,W,l]),qe=v.useCallback(()=>{Y(""),W({glAccount:null}),l?.(null)},[W,l]),pt=v.useCallback(ne=>{W({isTaxDeductible:ne}),a?.(ne)},[W,a]),Ct=v.useCallback(()=>{u?.()},[u]);return c.jsx(y.Card,{radius:"md",shadow:"sm","data-testid":b||"revenue-distribution-card",className:y.cn(C.base),children:c.jsxs(y.CardBody,{className:y.cn("flex flex-row flex-nowrap items-start gap-4",C.body),children:[c.jsx("div",{className:y.cn("shrink-0",C.amountContainer),children:c.jsx(y.NumberInput,{"data-testid":`${b||"revenue-distribution-card"}-amount-input`,label:c.jsxs("span",{className:"flex items-center gap-1",children:[j.amount,c.jsx(y.Tooltip,{content:j.amountTooltip,children:c.jsx(Ie,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:H.amount||void 0,onValueChange:ye,labelPlacement:"outside",placeholder:j.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:F,errorMessage:F?"Amount is required":void 0,minValue:0,step:.01,className:C.amountInput,startContent:c.jsx("div",{className:"pointer-events-none flex items-center",children:c.jsx("span",{className:"text-default-400 text-small",children:j.currencySymbol})})})}),c.jsx("div",{className:y.cn("grow",C.glAccountContainer),children:c.jsx(y.Autocomplete,{"data-testid":`${b||"revenue-distribution-card"}-gl-account-input`,label:c.jsxs("span",{className:"flex items-center gap-1",children:[j.glAccount,c.jsx(y.Tooltip,{content:j.glAccountTooltip,children:c.jsx(Ie,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:r,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:H.glAccount?.name??B,selectedKey:H.glAccount?.id??null,isDisabled:p,isInvalid:$,errorMessage:$?"GL Account is required":void 0,listboxProps:{emptyContent:r?j.searching:j.noGlAccountsFound},placeholder:j.glAccountPlaceholder,onInputChange:de,onSelectionChange:xe,onClear:qe,className:C.glAccountInput,children:ne=>c.jsx(y.AutocompleteItem,{textValue:ne.name,children:c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{children:ne.name}),ne.code&&c.jsx("span",{className:"text-xs text-default-400",children:ne.code})]})},ne.id)})}),c.jsx("div",{className:y.cn("shrink-0 pt-6 flex items-center",C.taxDeductibleContainer),children:c.jsx(y.Checkbox,{radius:"full","data-testid":`${b||"revenue-distribution-card"}-tax-deductible`,isSelected:H.isTaxDeductible,onValueChange:pt,isDisabled:p||!f,className:C.taxDeductibleCheckbox,children:j.taxDeductible})}),c.jsx("div",{className:y.cn("shrink-0 pt-6",C.deleteContainer),children:c.jsx(oe,{"data-testid":`${b||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!d,onPress:Ct,startContent:c.jsx(Ie,{icon:"solar:trash-bin-trash-linear",width:16}),className:y.cn("text-danger",C.deleteButton),children:j.deleteButton})})]})})};Ao.displayName="RevenueDistributionCard";const No=({message:t="No distributions configured",icon:e="solar:document-text-outline",iconSize:n=48,showCard:r=!0,classNames:s={},renderEmpty:i})=>{if(i)return c.jsx(c.Fragment,{children:i()});const o=c.jsxs("div",{className:y.cn("flex flex-col items-center justify-center py-8",s.content),children:[c.jsx(Ie,{icon:e,width:n,className:y.cn("text-default-300 mb-4",s.icon)}),c.jsx("p",{className:y.cn("text-default-500 text-sm text-center",s.message),children:t})]});return r?c.jsx(y.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{children:o})}):c.jsx("div",{"data-testid":"revenue-distribution-empty",className:y.cn("w-full",s.base),children:o})};No.displayName="RevenueDistributionEmpty";const gd={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Eo=({error:t,labels:e,showCard:n=!0,color:r="danger",classNames:s={}})=>{const i={...gd,...e},o=c.jsx(y.Alert,{"data-testid":"revenue-distribution-error-alert",color:r,title:i.title,description:t||i.description,className:s.alert});return n?c.jsx(y.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:y.cn("w-full",s.base),children:c.jsx(y.CardBody,{children:o})}):c.jsx("div",{"data-testid":"revenue-distribution-error",className:y.cn("w-full",s.base),children:o})};Eo.displayName="RevenueDistributionError";const To=({rows:t=1,showCard:e=!0,classNames:n={}})=>{const r=Array.from({length:t},(i,o)=>o),s=i=>c.jsxs("div",{className:y.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[c.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(y.Skeleton,{className:"h-4 w-14 rounded-md"}),c.jsx(y.Skeleton,{className:"h-4 w-4 rounded-full"})]}),c.jsx(y.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),c.jsxs("div",{className:"grow flex flex-col gap-1",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(y.Skeleton,{className:"h-4 w-20 rounded-md"}),c.jsx(y.Skeleton,{className:"h-4 w-4 rounded-full"})]}),c.jsx(y.Skeleton,{className:"h-10 w-full rounded-lg"})]}),c.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[c.jsx(y.Skeleton,{className:"h-5 w-5 rounded-full"}),c.jsx(y.Skeleton,{className:"h-4 w-24 rounded-md"})]}),c.jsx("div",{className:"shrink-0 pb-2",children:c.jsx(y.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return e?c.jsx("div",{className:y.cn("flex flex-col gap-3",n.base),children:r.map(i=>c.jsx(y.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:c.jsx(y.CardBody,{children:s(i)})},i))}):c.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:y.cn("flex flex-col gap-3",n.base),children:r.map(i=>s(i))})};To.displayName="RevenueDistributionSkeleton";exports.Button=oe;exports.ConfirmationPageTemplate=Wo;exports.DonationAmounts=qi;exports.EventDetails=Fu;exports.EventDetailsTemplate=Qo;exports.ExpireCartTimer=Ki;exports.Footer=Xo;exports.HeroUIProvider=Ho;exports.Multiselect=Yo;exports.Navbar=Jo;exports.OfferCard=Ir;exports.OfferCardEmpty=lo;exports.OfferCardError=ao;exports.OfferCardList=ho;exports.OfferCardSkeleton=co;exports.RICH_TEXT_PRESETS=Hi;exports.RevenueDistributionCard=Ao;exports.RevenueDistributionEmpty=No;exports.RevenueDistributionError=Eo;exports.RevenueDistributionSkeleton=To;exports.RichTextArea=Ui;exports.Stepper=Zs;exports.calculateAllocationDifference=pd;exports.formatOfferCurrency=oo;exports.formatRevenueAmount=ud;exports.formatRevenueCurrency=dd;exports.generateDistributionId=Vr;exports.getCurrencySymbol=fd;exports.offerCardVariants=fo;exports.offerListVariants=uo;exports.parseOfferCurrency=Pu;exports.parseRevenueCurrency=hd;Object.keys(y).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>y[t]})});
20
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:none}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
package/dist/index.js CHANGED
@@ -9031,7 +9031,7 @@ const lr = ({
9031
9031
  ref: k,
9032
9032
  className: F(
9033
9033
  "text-sm text-gray-700 leading-relaxed transition-all",
9034
- !u && "line-clamp-2"
9034
+ !u && "line-clamp-3"
9035
9035
  ),
9036
9036
  "data-testid": "event-details-description",
9037
9037
  dangerouslySetInnerHTML: { __html: o }
@@ -11036,4 +11036,4 @@ export {
11036
11036
  oh as parseOfferCurrency,
11037
11037
  uh as parseRevenueCurrency
11038
11038
  };
11039
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:none}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
11039
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:none}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
package/dist/styles.css CHANGED
@@ -96,3 +96,16 @@
96
96
  body {
97
97
  font-family: var(--font-primary);
98
98
  }
99
+
100
+ /**
101
+ * Tailwind v4 Compatibility
102
+ * Restore v3 default border color behavior
103
+ * https://tailwindcss.com/docs/upgrade-guide
104
+ */
105
+ *,
106
+ ::after,
107
+ ::before,
108
+ ::backdrop,
109
+ ::file-selector-button {
110
+ border-color: var(--color-gray-200, #e5e7eb);
111
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veevarts/design-system",
3
3
  "private": false,
4
- "version": "1.6.0-dev.1",
4
+ "version": "1.6.0-dev.3",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "prepublishOnly": "npm run test && npm run lint && npm run build"
45
45
  },
46
46
  "peerDependencies": {
47
- "@heroui/react": ">=2.7.0",
47
+ "@heroui/react": ">=2.8.0",
48
48
  "@tiptap/core": "^2.27.0",
49
49
  "@tiptap/extension-color": "^2.27.0",
50
50
  "@tiptap/extension-highlight": "^2.27.0",
@@ -71,13 +71,14 @@
71
71
  "devDependencies": {
72
72
  "@chromatic-com/storybook": "^4.1.3",
73
73
  "@eslint/js": "^9.39.1",
74
- "@heroui/react": "^2.8.7",
74
+ "@heroui/react": "^2.8.8",
75
75
  "@storybook/addon-a11y": "^10.0.8",
76
76
  "@storybook/addon-docs": "^10.0.8",
77
77
  "@storybook/addon-onboarding": "^10.0.8",
78
78
  "@storybook/addon-vitest": "^10.0.8",
79
79
  "@storybook/react-vite": "^10.0.8",
80
- "@tailwindcss/line-clamp": "^0.4.4",
80
+ "@tailwindcss/postcss": "^4.0.0",
81
+ "@tailwindcss/vite": "^4.0.0",
81
82
  "@testing-library/jest-dom": "^6.9.1",
82
83
  "@testing-library/react": "^16.3.1",
83
84
  "@testing-library/user-event": "^14.6.1",
@@ -98,7 +99,6 @@
98
99
  "@vitejs/plugin-react": "^5.1.1",
99
100
  "@vitest/browser-playwright": "^4.0.13",
100
101
  "@vitest/coverage-v8": "^4.0.13",
101
- "autoprefixer": "^10.4.23",
102
102
  "eslint": "^9.39.1",
103
103
  "eslint-plugin-react-hooks": "^7.0.1",
104
104
  "eslint-plugin-react-refresh": "^0.4.24",
@@ -112,7 +112,7 @@
112
112
  "react": "19.2.3",
113
113
  "react-dom": "19.2.3",
114
114
  "storybook": "^10.0.8",
115
- "tailwindcss": "^3.4.19",
115
+ "tailwindcss": "^4.0.0",
116
116
  "typescript": "~5.9.3",
117
117
  "typescript-eslint": "^8.46.4",
118
118
  "vite": "^7.2.4",