"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function I(X){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},I(X)}function P(X,Z){var ne="data-clipboard-".concat(X);if(Z.hasAttribute(ne))return Z.getAttribute(ne)}var H=function(X){T(ne,X);var Z=B(ne);function ne(oe,Y){var ee;return q(this,ne),ee=Z.call(this),ee.resolveOptions(Y),ee.listenClick(oe),ee}return C(ne,[{key:"resolveOptions",value:function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof Y.action=="function"?Y.action:this.defaultAction,this.target=typeof Y.target=="function"?Y.target:this.defaultTarget,this.text=typeof Y.text=="function"?Y.text:this.defaultText,this.container=k(Y.container)==="object"?Y.container:document.body}},{key:"listenClick",value:function(Y){var ee=this;this.listener=p()(Y,"click",function(ie){return ee.onClick(ie)})}},{key:"onClick",value:function(Y){var ee=Y.delegateTarget||Y.currentTarget,ie=this.action(ee)||"copy",se=w({action:ie,container:this.container,target:this.target(ee),text:this.text(ee)});this.emit(se?"success":"error",{action:ie,text:se,trigger:ee,clearSelection:function(){ee&&ee.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(Y){return P("action",Y)}},{key:"defaultTarget",value:function(Y){var ee=P("target",Y);if(ee)return document.querySelector(ee)}},{key:"defaultText",value:function(Y){return P("text",Y)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(Y){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return M(Y,ee)}},{key:"cut",value:function(Y){return z(Y)}},{key:"isSupported",value:function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],ee=typeof Y=="string"?[Y]:Y,ie=!!document.queryCommandSupported;return ee.forEach(function(se){ie=ie&&!!document.queryCommandSupported(se)}),ie}}]),ne}(u()),U=H},828:function(s){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var c=Element.prototype;c.matches=c.matchesSelector||c.mozMatchesSelector||c.msMatchesSelector||c.oMatchesSelector||c.webkitMatchesSelector}function l(u,d){for(;u&&u.nodeType!==i;){if(typeof u.matches=="function"&&u.matches(d))return u;u=u.parentNode}}s.exports=l},438:function(s,i,c){var l=c(828);function u(f,b,h,g,z){var y=p.apply(this,arguments);return f.addEventListener(h,y,z),{destroy:function(){f.removeEventListener(h,y,z)}}}function d(f,b,h,g,z){return typeof f.addEventListener=="function"?u.apply(null,arguments):typeof h=="function"?u.bind(null,document).apply(null,arguments):(typeof f=="string"&&(f=document.querySelectorAll(f)),Array.prototype.map.call(f,function(y){return u(y,b,h,g,z)}))}function p(f,b,h,g){return function(z){z.delegateTarget=l(z.target,b),z.delegateTarget&&g.call(f,z)}}s.exports=d},879:function(s,i){i.node=function(c){return c!==void 0&&c instanceof HTMLElement&&c.nodeType===1},i.nodeList=function(c){var l=Object.prototype.toString.call(c);return c!==void 0&&(l==="[object NodeList]"||l==="[object HTMLCollection]")&&"length"in c&&(c.length===0||i.node(c[0]))},i.string=function(c){return typeof c=="string"||c instanceof String},i.fn=function(c){var l=Object.prototype.toString.call(c);return l==="[object Function]"}},370:function(s,i,c){var l=c(879),u=c(438);function d(h,g,z){if(!h&&!g&&!z)throw new Error("Missing required arguments");if(!l.string(g))throw new TypeError("Second argument must be a String");if(!l.fn(z))throw new TypeError("Third argument must be a Function");if(l.node(h))return p(h,g,z);if(l.nodeList(h))return f(h,g,z);if(l.string(h))return b(h,g,z);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function p(h,g,z){return h.addEventListener(g,z),{destroy:function(){h.removeEventListener(g,z)}}}function f(h,g,z){return Array.prototype.forEach.call(h,function(y){y.addEventListener(g,z)}),{destroy:function(){Array.prototype.forEach.call(h,function(y){y.removeEventListener(g,z)})}}}function b(h,g,z){return u(document.body,h,g,z)}s.exports=d},817:function(s){function i(c){var l;if(c.nodeName==="SELECT")c.focus(),l=c.value;else if(c.nodeName==="INPUT"||c.nodeName==="TEXTAREA"){var u=c.hasAttribute("readonly");u||c.setAttribute("readonly",""),c.select(),c.setSelectionRange(0,c.value.length),u||c.removeAttribute("readonly"),l=c.value}else{c.hasAttribute("contenteditable")&&c.focus();var d=window.getSelection(),p=document.createRange();p.selectNodeContents(c),d.removeAllRanges(),d.addRange(p),l=d.toString()}return l}s.exports=i},279:function(s){function i(){}i.prototype={on:function(c,l,u){var d=this.e||(this.e={});return(d[c]||(d[c]=[])).push({fn:l,ctx:u}),this},once:function(c,l,u){var d=this;function p(){d.off(c,p),l.apply(u,arguments)}return p._=l,this.on(c,p,u)},emit:function(c){var l=[].slice.call(arguments,1),u=((this.e||(this.e={}))[c]||[]).slice(),d=0,p=u.length;for(d;d{const s=new D6e(r,{text(){return typeof n.current=="function"?n.current():n.current||""}});return s.on("success",({clearSelection:i})=>{i(),o.current&&o.current()}),()=>{s.destroy()}},[])}function Ta(e=null){if(!e){if(typeof window>"u")return!1;e=window}const{platform:t}=e.navigator;return t.indexOf("Mac")!==-1||["iPad","iPhone"].includes(t)}const Si=8,qp=9,y1=13,Ea=27,qx=32,F6e=33,$6e=34,Ag=35,Vb=36,Bs=37,xi=38,Ns=39,Do=40,_a=46,V6e=121,ui="alt",la="ctrl",ep="meta",di="shift";function fne(e){return e.length<2?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}function $z(e,t){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,t(o)]))}const Sx={primary:e=>e()?[ep]:[la],primaryShift:e=>e()?[di,ep]:[la,di],primaryAlt:e=>e()?[ui,ep]:[la,ui],secondary:e=>e()?[di,ui,ep]:[la,di,ui],access:e=>e()?[la,ui]:[di,ui],ctrl:()=>[la],alt:()=>[ui],ctrlShift:()=>[la,di],shift:()=>[di],shiftAlt:()=>[di,ui],undefined:()=>[]},H6e=$z(Sx,e=>(t,n=Ta)=>[...e(n),t.toLowerCase()].join("+")),bne=$z(Sx,e=>(t,n=Ta)=>{const o=n(),r={[ui]:o?"⌥":"Alt",[la]:o?"⌃":"Ctrl",[ep]:"⌘",[di]:o?"⇧":"Shift"};return[...e(n).reduce((i,c)=>{var l;const u=(l=r[c])!==null&&l!==void 0?l:c;return o?[...i,u]:[...i,u,"+"]},[]),fne(t)]}),Jo=$z(bne,e=>(t,n=Ta)=>e(t,n).join("")),hne=$z(Sx,e=>(t,n=Ta)=>{const o=n(),r={[di]:"Shift",[ep]:o?"Command":"Control",[la]:"Control",[ui]:o?"Option":"Alt",",":m("Comma"),".":m("Period"),"`":m("Backtick"),"~":m("Tilde")};return[...e(n),t].map(s=>{var i;return fne((i=r[s])!==null&&i!==void 0?i:s)}).join(o?" ":" + ")});function U6e(e){return[ui,la,ep,di].filter(t=>e[`${t}Key`])}const Fs=$z(Sx,e=>(t,n,o=Ta)=>{const r=e(o),s=U6e(t),i={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=r.filter(d=>!s.includes(d)),l=s.filter(d=>!r.includes(d));if(c.length>0||l.length>0)return!1;let u=t.key.toLowerCase();return n?(t.altKey&&n.length===1&&(u=String.fromCharCode(t.keyCode).toLowerCase()),t.shiftKey&&n.length===1&&i[t.code]&&(u=i[t.code]),n==="del"&&(n="delete"),u===n.toLowerCase()):r.includes(u)});function Cx(e="firstElement"){const t=O.useRef(e),n=r=>{r.focus({preventScroll:!0})},o=O.useRef();return O.useEffect(()=>{t.current=e},[e]),Et(r=>{var s;if(!(!r||t.current===!1)&&!r.contains((s=r.ownerDocument?.activeElement)!==null&&s!==void 0?s:null)){if(t.current==="firstElement"){o.current=setTimeout(()=>{const i=Nn.tabbable.find(r)[0];i&&n(i)},0);return}return n(r),()=>{o.current&&clearTimeout(o.current)}}},[])}let KO=null;function _B(e){const t=O.useRef(null),n=O.useRef(null),o=O.useRef(e);return O.useEffect(()=>{o.current=e},[e]),O.useCallback(r=>{if(r){if(t.current=r,n.current)return;n.current=r.ownerDocument.activeElement}else if(n.current){const i=t.current?.contains(t.current?.ownerDocument.activeElement);if(t.current?.isConnected&&!i){var s;(s=KO)!==null&&s!==void 0||(KO=n.current);return}o.current?o.current():(n.current.isConnected?n.current:KO)?.focus(),KO=null}},[])}const X6e=["button","submit"];function G6e(e){if(!(e instanceof window.HTMLElement))return!1;switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return X6e.includes(e.type)}return!1}function mne(e){const t=O.useRef(e);O.useEffect(()=>{t.current=e},[e]);const n=O.useRef(!1),o=O.useRef(),r=O.useCallback(()=>{clearTimeout(o.current)},[]);O.useEffect(()=>()=>r(),[]),O.useEffect(()=>{e||r()},[e,r]);const s=O.useCallback(c=>{const{type:l,target:u}=c;["mouseup","touchend"].includes(l)?n.current=!1:G6e(u)&&(n.current=!0)},[]),i=O.useCallback(c=>{if(c.persist(),n.current)return;const l=c.target.getAttribute("data-unstable-ignore-focus-outside-for-relatedtarget");l&&c.relatedTarget?.closest(l)||(o.current=setTimeout(()=>{if(!document.hasFocus()){c.preventDefault();return}typeof t.current=="function"&&t.current(c)},0))},[]);return{onFocus:r,onMouseDown:s,onMouseUp:s,onTouchStart:s,onTouchEnd:s,onBlur:i}}function YO(e,t){typeof e=="function"?e(t):e&&e.hasOwnProperty("current")&&(e.current=t)}function Gt(e){const t=O.useRef(),n=O.useRef(!1),o=O.useRef(!1),r=O.useRef([]),s=O.useRef(e);return s.current=e,O.useLayoutEffect(()=>{o.current===!1&&n.current===!0&&e.forEach((i,c)=>{const l=r.current[c];i!==l&&(YO(l,null),YO(i,t.current))}),r.current=e},e),O.useLayoutEffect(()=>{o.current=!1}),O.useCallback(i=>{YO(t,i),o.current=!0,n.current=i!==null;const c=i?s.current:r.current;for(const l of c)YO(l,i)},[])}function Mne(e){const t=O.useRef(),{constrainTabbing:n=e.focusOnMount!==!1}=e;O.useEffect(()=>{t.current=e},Object.values(e));const o=xB(),r=Cx(e.focusOnMount),s=_B(),i=mne(l=>{t.current?.__unstableOnClose?t.current.__unstableOnClose("focus-outside",l):t.current?.onClose&&t.current.onClose()}),c=O.useCallback(l=>{l&&l.addEventListener("keydown",u=>{u.keyCode===Ea&&!u.defaultPrevented&&t.current?.onClose&&(u.preventDefault(),t.current.onClose())})},[]);return[Gt([n?o:null,e.focusOnMount!==!1?s:null,e.focusOnMount!==!1?r:null,c]),{...i,tabIndex:-1}]}function wB({isDisabled:e=!1}={}){return Et(t=>{if(e)return;const n=t?.ownerDocument?.defaultView;if(!n)return;const o=[],r=()=>{t.childNodes.forEach(c=>{c instanceof n.HTMLElement&&(c.getAttribute("inert")||(c.setAttribute("inert","true"),o.push(()=>{c.removeAttribute("inert")})))})},s=jr(r,0,{leading:!0});r();const i=new window.MutationObserver(s);return i.observe(t,{childList:!0}),()=>{i&&i.disconnect(),s.cancel(),o.forEach(c=>c())}},[e])}const kB=typeof window<"u"?O.useLayoutEffect:O.useEffect;function gne({onDragStart:e,onDragMove:t,onDragEnd:n}){const[o,r]=O.useState(!1),s=O.useRef({onDragStart:e,onDragMove:t,onDragEnd:n});kB(()=>{s.current.onDragStart=e,s.current.onDragMove=t,s.current.onDragEnd=n},[e,t,n]);const i=O.useCallback(u=>s.current.onDragMove&&s.current.onDragMove(u),[]),c=O.useCallback(u=>{s.current.onDragEnd&&s.current.onDragEnd(u),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",c),r(!1)},[]),l=O.useCallback(u=>{s.current.onDragStart&&s.current.onDragStart(u),document.addEventListener("mousemove",i),document.addEventListener("mouseup",c),r(!0)},[]);return O.useEffect(()=>()=>{o&&(document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",c))},[o]),{startDrag:l,endDrag:c,isDragging:o}}const w$=new Map;function K6e(e){if(!e)return null;let t=w$.get(e);return t||(typeof window<"u"&&typeof window.matchMedia=="function"?(t=window.matchMedia(e),w$.set(e,t),t):null)}function qB(e){const t=O.useMemo(()=>{const n=K6e(e);return{subscribe(o){return n?(n.addEventListener?.("change",o),()=>{n.removeEventListener?.("change",o)}):()=>{}},getValue(){var o;return(o=n?.matches)!==null&&o!==void 0?o:!1}}},[e]);return O.useSyncExternalStore(t.subscribe,t.getValue,()=>!1)}function t1(e){const t=O.useRef();return O.useEffect(()=>{t.current=e},[e]),t.current}const Zs=()=>qB("(prefers-reduced-motion: reduce)");function Y6e(e,t){const n={...e};return Object.entries(t).forEach(([o,r])=>{n[o]?n[o]={...n[o],to:r.to}:n[o]=r}),n}const k$=(e,t)=>{const n=e?.findIndex(({id:r})=>typeof r=="string"?r===t.id:Jr(r,t.id)),o=[...e];return n!==-1?o[n]={id:t.id,changes:Y6e(o[n].changes,t.changes)}:o.push(t),o};function Z6e(){let e=[],t=[],n=0;const o=()=>{e=e.slice(0,n||void 0),n=0},r=()=>{var i;const c=e.length===0?0:e.length-1;let l=(i=e[c])!==null&&i!==void 0?i:[];t.forEach(u=>{l=k$(l,u)}),t=[],e[c]=l},s=i=>!i.filter(({changes:l})=>Object.values(l).some(({from:u,to:d})=>typeof u!="function"&&typeof d!="function"&&!Jr(u,d))).length;return{addRecord(i,c=!1){const l=!i||s(i);if(c){if(l)return;i.forEach(u=>{t=k$(t,u)})}else{if(o(),t.length&&r(),l)return;e.push(i)}},undo(){t.length&&(o(),r());const i=e[e.length-1+n];if(i)return n-=1,i},redo(){const i=e[e.length+n];if(i)return n+=1,i},hasUndo(){return!!e[e.length-1+n]},hasRedo(){return!!e[e.length+n]}}}const q$={xhuge:1920,huge:1440,wide:1280,xlarge:1080,large:960,medium:782,small:600,mobile:480},Q6e={">=":"min-width","<":"max-width"},J6e={">=":(e,t)=>t>=e,"<":(e,t)=>t=")=>{const n=O.useContext(zne),o=!n&&`(${Q6e[t]}: ${q$[e]}px)`,r=qB(o||void 0);return n?J6e[t](q$[e],n):r};g0.__experimentalWidthProvider=zne.Provider;const eqe=e=>{let t;if(!e.contentBoxSize)t=[e.contentRect.width,e.contentRect.height];else if(e.contentBoxSize[0]){const r=e.contentBoxSize[0];t=[r.inlineSize,r.blockSize]}else{const r=e.contentBoxSize;t=[r.inlineSize,r.blockSize]}const[n,o]=t.map(r=>Math.round(r));return{width:n,height:o}},tqe={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",opacity:0,overflow:"hidden",zIndex:-1};function nqe({onResize:e}){const t=O.useRef(null),n=O.useRef(e);return O.useLayoutEffect(()=>{n.current=e},[e]),O.useLayoutEffect(()=>{const o=t.current,r=new ResizeObserver(s=>{for(const i of s){const c=eqe(i);n.current(c)}});return r.observe(o),()=>{r.unobserve(o)}},[]),a.jsx("div",{ref:t,style:tqe,"aria-hidden":"true"})}function oqe(e,t){return e.width===t.width&&e.height===t.height}const S$={width:null,height:null};function Ci(){const[e,t]=O.useState(S$),n=O.useRef(S$),o=O.useCallback(s=>{oqe(n.current,s)||(n.current=s,t(s))},[]);return[a.jsx(nqe,{onResize:o}),e]}var rqe={exports:{}};(function(e){(function(t){e.exports?e.exports=t():window.idleCallbackShim=t()})(function(){var t,n,o,r,s=typeof window<"u"?window:typeof In!=null?In:this||{},i=s.cancelRequestAnimationFrame&&s.requestAnimationFrame||setTimeout,c=s.cancelRequestAnimationFrame||clearTimeout,l=[],u=0,d=!1,p=7,f=35,b=125,h=0,g=0,z=0,y={get didTimeout(){return!1},timeRemaining:function(){var T=p-(Date.now()-g);return T<0?0:T}},x=v(function(){p=22,b=66,f=0});function v(T){var W,B,N=99,E=function(){var L=Date.now()-B;L9?o=setTimeout(w,n):(n=0,w()))}function q(){var T,W,B,N=p>9?9:1;if(g=Date.now(),d=!1,o=null,u>2||g-n-50N;W++)T=l.shift(),z++,T&&T(y);l.length?k():u=0}function S(T){return h++,l.push(T),k(),h}function C(T){var W=T-1-z;l[W]&&(l[W]=null)}if(!s.requestIdleCallback||!s.cancelIdleCallback)s.requestIdleCallback=S,s.cancelIdleCallback=C,s.document&&document.addEventListener&&(s.addEventListener("scroll",A,!0),s.addEventListener("resize",A),document.addEventListener("focus",A,!0),document.addEventListener("mouseover",A,!0),["click","keypress","touchstart","mousedown"].forEach(function(T){document.addEventListener(T,A,{capture:!0,passive:!0})}),s.MutationObserver&&new MutationObserver(A).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}));else try{s.requestIdleCallback(function(){},{timeout:0})}catch{(function(W){var B,N;if(s.requestIdleCallback=function(E,L){return L&&typeof L.timeout=="number"?W(E,L.timeout):W(E)},s.IdleCallbackDeadline&&(B=IdleCallbackDeadline.prototype)){if(N=Object.getOwnPropertyDescriptor(B,"timeRemaining"),!N||!N.configurable||!N.get)return;Object.defineProperty(B,"timeRemaining",{value:function(){return N.get.call(this)},enumerable:!0,configurable:!0})}})(s.requestIdleCallback)}return{request:S,cancel:C}})})(rqe);function sqe(){return typeof window>"u"?e=>{setTimeout(()=>e(Date.now()),0)}:window.requestIdleCallback}const C$=sqe(),One=()=>{const e=new Map;let t=!1;const n=c=>{for(const[l,u]of e)if(e.delete(l),u(),typeof c=="number"||c.timeRemaining()<=0)break;if(e.size===0){t=!1;return}C$(n)};return{add:(c,l)=>{e.set(c,l),t||(t=!0,C$(n))},flush:c=>{const l=e.get(c);return l===void 0?!1:(e.delete(c),l(),!0)},cancel:c=>e.delete(c),reset:()=>{e.clear(),t=!1}}};function iqe(e,t){const n=[];for(let o=0;o{let s=iqe(e,o);s.length{Qo.flushSync(()=>{r(l=>[...l,...e.slice(c,c+n)])})});return()=>i.reset()},[e]),o}function aqe(e,t){if(e.length!==t.length)return!1;for(var n=0;njr(e,t??0,n),[e,t,n]);return O.useEffect(()=>()=>o.cancel(),[o]),o}function yne(e=""){const[t,n]=O.useState(e),[o,r]=O.useState(e),s=Uo(r,250);return O.useEffect(()=>{s(t)},[t,s]),[t,n,o]}function t8(e,t,n){const o=Ane(()=>zB(e,t??0,n),[e,t,n]);return O.useEffect(()=>()=>o.cancel(),[o]),o}function jf(e){const t=O.useRef();return t.current=e,t}function Rx({dropZoneElement:e,isDisabled:t,onDrop:n,onDragStart:o,onDragEnter:r,onDragLeave:s,onDragEnd:i,onDragOver:c}){const l=jf(n),u=jf(o),d=jf(r),p=jf(s),f=jf(i),b=jf(c);return Et(h=>{if(t)return;const g=e??h;let z=!1;const{ownerDocument:y}=g;function x(q){const{defaultView:S}=y;if(!q||!S||!(q instanceof S.HTMLElement)||!g.contains(q))return!1;let C=q;do if(C.dataset.isDropZone)return C===g;while(C=C.parentElement);return!1}function v(q){z||(z=!0,y.addEventListener("dragend",k),y.addEventListener("mousemove",k),u.current&&u.current(q))}function M(q){q.preventDefault(),!g.contains(q.relatedTarget)&&d.current&&d.current(q)}function A(q){!q.defaultPrevented&&b.current&&b.current(q),q.preventDefault()}function _(q){x(q.relatedTarget)||p.current&&p.current(q)}function w(q){q.defaultPrevented||(q.preventDefault(),q.dataTransfer&&q.dataTransfer.files.length,l.current&&l.current(q),k(q))}function k(q){z&&(z=!1,y.removeEventListener("dragend",k),y.removeEventListener("mousemove",k),f.current&&f.current(q))}return g.dataset.isDropZone="true",g.addEventListener("drop",w),g.addEventListener("dragenter",M),g.addEventListener("dragover",A),g.addEventListener("dragleave",_),y.addEventListener("dragenter",v),()=>{delete g.dataset.isDropZone,g.removeEventListener("drop",w),g.removeEventListener("dragenter",M),g.removeEventListener("dragover",A),g.removeEventListener("dragleave",_),y.removeEventListener("dragend",k),y.removeEventListener("mousemove",k),y.removeEventListener("dragenter",v)}},[t,e])}function vne(){return Et(e=>{const{ownerDocument:t}=e;if(!t)return;const{defaultView:n}=t;if(!n)return;function o(){t&&t.activeElement===e&&e.focus()}return n.addEventListener("blur",o),()=>{n.removeEventListener("blur",o)}},[])}const cqe=30;function lqe(e,t,n,o){var r,s;const i=(r=o?.initWindowSize)!==null&&r!==void 0?r:cqe,c=(s=o?.useWindowing)!==null&&s!==void 0?s:!0,[l,u]=O.useState({visibleItems:i,start:0,end:i,itemInView:d=>d>=0&&d<=i});return O.useLayoutEffect(()=>{if(!c)return;const d=Sr(e.current),p=b=>{var h;if(!d)return;const g=Math.ceil(d.clientHeight/t),z=b?g:(h=o?.windowOverscan)!==null&&h!==void 0?h:g,y=Math.floor(d.scrollTop/t),x=Math.max(0,y-z),v=Math.min(n-1,y+g+z);u(M=>{const A={visibleItems:g,start:x,end:v,itemInView:_=>x<=_&&_<=v};return M.start!==A.start||M.end!==A.end||M.visibleItems!==A.visibleItems?A:M})};p(!0);const f=jr(()=>{p()},16);return d?.addEventListener("scroll",f),d?.ownerDocument?.defaultView?.addEventListener("resize",f),d?.ownerDocument?.defaultView?.addEventListener("resize",f),()=>{d?.removeEventListener("scroll",f),d?.ownerDocument?.defaultView?.removeEventListener("resize",f)}},[t,e,n,o?.expandedState,o?.windowOverscan,c]),O.useLayoutEffect(()=>{if(!c)return;const d=Sr(e.current),p=f=>{switch(f.keyCode){case Vb:return d?.scrollTo({top:0});case Ag:return d?.scrollTo({top:n*t});case F6e:return d?.scrollTo({top:d.scrollTop-l.visibleItems*t});case $6e:return d?.scrollTo({top:d.scrollTop+l.visibleItems*t})}};return d?.ownerDocument?.defaultView?.addEventListener("keydown",p),()=>{d?.ownerDocument?.defaultView?.removeEventListener("keydown",p)}},[n,t,e,l.visibleItems,c,o?.expandedState]),[l,u]}function xne(e,t){const[n,o]=O.useMemo(()=>[r=>e.subscribe(t,r),()=>e.get(t)],[e,t]);return O.useSyncExternalStore(n,o,o)}function _ne(e){const t=Object.keys(e);return function(o={},r){const s={};let i=!1;for(const c of t){const l=e[c],u=o[c],d=l(u,r);s[c]=d,i=i||d!==u}return i?s:o}}function nt(e){const t=new WeakMap,n=(...o)=>{let r=t.get(n.registry);return r||(r=e(n.registry.select),t.set(n.registry,r)),r(...o)};return n.isRegistrySelector=!0,n}function N6(e){return e.isRegistryControl=!0,e}const uqe="@@data/SELECT",dqe="@@data/RESOLVE_SELECT",pqe="@@data/DISPATCH",fqe={[uqe]:N6(e=>({storeKey:t,selectorName:n,args:o})=>e.select(t)[n](...o)),[dqe]:N6(e=>({storeKey:t,selectorName:n,args:o})=>{const r=e.select(t)[n].hasResolver?"resolveSelect":"select";return e[r](t)[n](...o)}),[pqe]:N6(e=>({storeKey:t,actionName:n,args:o})=>e.dispatch(t)[n](...o))},bqe=["@wordpress/block-directory","@wordpress/block-editor","@wordpress/block-library","@wordpress/blocks","@wordpress/commands","@wordpress/components","@wordpress/core-commands","@wordpress/core-data","@wordpress/customize-widgets","@wordpress/data","@wordpress/edit-post","@wordpress/edit-site","@wordpress/edit-widgets","@wordpress/editor","@wordpress/format-library","@wordpress/interface","@wordpress/patterns","@wordpress/preferences","@wordpress/reusable-blocks","@wordpress/router","@wordpress/dataviews"],R$=[];let n8;try{n8=!globalThis.IS_WORDPRESS_CORE}catch{n8=!0}const ar=(e,t)=>{if(!bqe.includes(t))throw new Error(`You tried to opt-in to unstable APIs as module "${t}". This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if(!n8&&R$.includes(t))throw new Error(`You tried to opt-in to unstable APIs as module "${t}" which is already registered. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);return R$.push(t),{lock:hqe,unlock:mqe}};function hqe(e,t){if(!e)throw new Error("Cannot lock an undefined object.");RM in e||(e[RM]={}),wne.set(e[RM],t)}function mqe(e){if(!e)throw new Error("Cannot unlock an undefined object.");if(!(RM in e))throw new Error("Cannot unlock an object that was not locked before. ");return wne.get(e[RM])}const wne=new WeakMap,RM=Symbol("Private API ID"),{lock:nM,unlock:Pf}=ar("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/data"),Mqe=()=>e=>t=>Z0e(t)?t.then(n=>{if(n)return e(n)}):e(t),gqe=(e,t)=>()=>n=>o=>{const r=e.select(t).getCachedResolvers();return Object.entries(r).forEach(([i,c])=>{const l=e.stores[t]?.resolvers?.[i];!l||!l.shouldInvalidate||c.forEach((u,d)=>{u!==void 0&&(u.status!=="finished"&&u.status!=="error"||l.shouldInvalidate(o,...d)&&e.dispatch(t).invalidateResolution(i,d))})}),n(o)};function zqe(e){return()=>t=>n=>typeof n=="function"?n(e):t(n)}const Oqe=e=>t=>(n={},o)=>{const r=o[e];if(r===void 0)return n;const s=t(n[r],o);return s===n[r]?n:{...n,[r]:s}};function Pl(e){if(e==null)return[];const t=e.length;let n=t;for(;n>0&&e[n-1]===void 0;)n--;return n===t?e:e.slice(0,n)}const Aqe=Oqe("selectorName")((e=new ia,t)=>{switch(t.type){case"START_RESOLUTION":{const n=new ia(e);return n.set(Pl(t.args),{status:"resolving"}),n}case"FINISH_RESOLUTION":{const n=new ia(e);return n.set(Pl(t.args),{status:"finished"}),n}case"FAIL_RESOLUTION":{const n=new ia(e);return n.set(Pl(t.args),{status:"error",error:t.error}),n}case"START_RESOLUTIONS":{const n=new ia(e);for(const o of t.args)n.set(Pl(o),{status:"resolving"});return n}case"FINISH_RESOLUTIONS":{const n=new ia(e);for(const o of t.args)n.set(Pl(o),{status:"finished"});return n}case"FAIL_RESOLUTIONS":{const n=new ia(e);return t.args.forEach((o,r)=>{const s={status:"error",error:void 0},i=t.errors[r];i&&(s.error=i),n.set(Pl(o),s)}),n}case"INVALIDATE_RESOLUTION":{const n=new ia(e);return n.delete(Pl(t.args)),n}}return e}),yqe=(e={},t)=>{switch(t.type){case"INVALIDATE_RESOLUTION_FOR_STORE":return{};case"INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR":{if(t.selectorName in e){const{[t.selectorName]:n,...o}=e;return o}return e}case"START_RESOLUTION":case"FINISH_RESOLUTION":case"FAIL_RESOLUTION":case"START_RESOLUTIONS":case"FINISH_RESOLUTIONS":case"FAIL_RESOLUTIONS":case"INVALIDATE_RESOLUTION":return Aqe(e,t)}return e};var L6={};function vqe(e){return[e]}function xqe(e){return!!e&&typeof e=="object"}function _qe(){var e={clear:function(){e.head=null}};return e}function W$(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;oArray.from(t._map.values()).some(n=>n[1]?.status==="resolving"))}const Tqe=at(e=>{const t={};return Object.values(e).forEach(n=>Array.from(n._map.values()).forEach(o=>{var r;const s=(r=o[1]?.status)!==null&&r!==void 0?r:"error";t[s]||(t[s]=0),t[s]++})),t},e=>[e]),Eqe=Object.freeze(Object.defineProperty({__proto__:null,countSelectorsByStatus:Tqe,getCachedResolvers:Rqe,getIsResolving:wqe,getResolutionError:Sqe,getResolutionState:cf,hasFinishedResolution:kqe,hasResolutionFailed:qqe,hasResolvingSelectors:Wqe,hasStartedResolution:kne,isResolving:Cqe},Symbol.toStringTag,{value:"Module"}));function qne(e,t){return{type:"START_RESOLUTION",selectorName:e,args:t}}function Sne(e,t){return{type:"FINISH_RESOLUTION",selectorName:e,args:t}}function Cne(e,t,n){return{type:"FAIL_RESOLUTION",selectorName:e,args:t,error:n}}function Bqe(e,t){return{type:"START_RESOLUTIONS",selectorName:e,args:t}}function Nqe(e,t){return{type:"FINISH_RESOLUTIONS",selectorName:e,args:t}}function Lqe(e,t,n){return{type:"FAIL_RESOLUTIONS",selectorName:e,args:t,errors:n}}function jqe(e,t){return{type:"INVALIDATE_RESOLUTION",selectorName:e,args:t}}function Pqe(){return{type:"INVALIDATE_RESOLUTION_FOR_STORE"}}function Iqe(e){return{type:"INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR",selectorName:e}}const Dqe=Object.freeze(Object.defineProperty({__proto__:null,failResolution:Cne,failResolutions:Lqe,finishResolution:Sne,finishResolutions:Nqe,invalidateResolution:jqe,invalidateResolutionForStore:Pqe,invalidateResolutionForStoreSelector:Iqe,startResolution:qne,startResolutions:Bqe},Symbol.toStringTag,{value:"Module"})),j6=e=>{const t=[...e];for(let n=t.length-1;n>=0;n--)t[n]===void 0&&t.splice(n,1);return t},eu=(e,t)=>Object.fromEntries(Object.entries(e??{}).map(([n,o])=>[n,t(o,n)])),Fqe=(e,t)=>t instanceof Map?Object.fromEntries(t):t instanceof window.HTMLElement?null:t;function $qe(){const e={};return{isRunning(t,n){return e[t]&&e[t].get(j6(n))},clear(t,n){e[t]&&e[t].delete(j6(n))},markAsRunning(t,n){e[t]||(e[t]=new ia),e[t].set(j6(n),!0)}}}function T$(e){const t=new WeakMap;return{get(n,o){let r=t.get(n);return r||(r=e(n,o),t.set(n,r)),r}}}function er(e,t){const n={},o={},r={privateActions:n,registerPrivateActions:i=>{Object.assign(n,i)},privateSelectors:o,registerPrivateSelectors:i=>{Object.assign(o,i)}},s={name:e,instantiate:i=>{const c=new Set,l=t.reducer,d=Vqe(e,t,i,{registry:i,get dispatch(){return z},get select(){return w},get resolveSelect(){return T()}});nM(d,r);const p=$qe();function f(E){return(...L)=>Promise.resolve(d.dispatch(E(...L)))}const b={...eu(Dqe,f),...eu(t.actions,f)},h=T$(f),g=new Proxy(()=>{},{get:(E,L)=>{const I=n[L];return I?h.get(I,L):b[L]}}),z=new Proxy(g,{apply:(E,L,[I])=>d.dispatch(I)});nM(b,g);const y=t.resolvers?Xqe(t.resolvers):{};function x(E,L){E.isRegistrySelector&&(E.registry=i);const I=(...H)=>{H=o8(E,H);const U=d.__unstableOriginalGetState();return E.isRegistrySelector&&(E.registry=i),E(U.root,...H)};I.__unstableNormalizeArgs=E.__unstableNormalizeArgs;const P=y[L];return P?Gqe(I,L,P,d,p):(I.hasResolver=!1,I)}function v(E){const L=(...I)=>{const P=d.__unstableOriginalGetState(),H=I&&I[0],U=I&&I[1],X=t?.selectors?.[H];return H&&X&&(I[1]=o8(X,U)),E(P.metadata,...I)};return L.hasResolver=!1,L}const M={...eu(Eqe,v),...eu(t.selectors,x)},A=T$(x);for(const[E,L]of Object.entries(o))A.get(L,E);const _=new Proxy(()=>{},{get:(E,L)=>{const I=o[L];return I?A.get(I,L):M[L]}}),w=new Proxy(_,{apply:(E,L,[I])=>I(d.__unstableOriginalGetState())});nM(M,_);const k=Hqe(M,d),q=Uqe(M,d),S=()=>M,C=()=>b,T=()=>k,W=()=>q;d.__unstableOriginalGetState=d.getState,d.getState=()=>d.__unstableOriginalGetState().root;const B=d&&(E=>(c.add(E),()=>c.delete(E)));let N=d.__unstableOriginalGetState();return d.subscribe(()=>{const E=d.__unstableOriginalGetState(),L=E!==N;if(N=E,L)for(const I of c)I()}),{reducer:l,store:d,actions:b,selectors:M,resolvers:y,getSelectors:S,getResolveSelectors:T,getSuspendSelectors:W,getActions:C,subscribe:B}}};return nM(s,r),s}function Vqe(e,t,n,o){const r={...t.controls,...fqe},s=eu(r,p=>p.isRegistryControl?p(n):p),i=[gqe(n,e),Mqe,l6e(s),zqe(o)],c=[Ake(...i)];typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&c.push(window.__REDUX_DEVTOOLS_EXTENSION__({name:e,instanceId:e,serialize:{replacer:Fqe}}));const{reducer:l,initialState:u}=t,d=_ne({metadata:yqe,root:l});return U0e(d,{root:u},v0(c))}function Hqe(e,t){const{getIsResolving:n,hasStartedResolution:o,hasFinishedResolution:r,hasResolutionFailed:s,isResolving:i,getCachedResolvers:c,getResolutionState:l,getResolutionError:u,hasResolvingSelectors:d,countSelectorsByStatus:p,...f}=e;return eu(f,(b,h)=>b.hasResolver?(...g)=>new Promise((z,y)=>{const x=()=>e.hasFinishedResolution(h,g),v=w=>{if(e.hasResolutionFailed(h,g)){const q=e.getResolutionError(h,g);y(q)}else z(w)},M=()=>b.apply(null,g),A=M();if(x())return v(A);const _=t.subscribe(()=>{x()&&(_(),v(M()))})}):async(...g)=>b.apply(null,g))}function Uqe(e,t){return eu(e,(n,o)=>n.hasResolver?(...r)=>{const s=n.apply(null,r);if(e.hasFinishedResolution(o,r)){if(e.hasResolutionFailed(o,r))throw e.getResolutionError(o,r);return s}throw new Promise(i=>{const c=t.subscribe(()=>{e.hasFinishedResolution(o,r)&&(i(),c())})})}:n)}function Xqe(e){return eu(e,t=>t.fulfill?t:{...t,fulfill:t})}function Gqe(e,t,n,o,r){function s(c){const l=o.getState();if(r.isRunning(t,c)||typeof n.isFulfilled=="function"&&n.isFulfilled(l,...c))return;const{metadata:u}=o.__unstableOriginalGetState();kne(u,t,c)||(r.markAsRunning(t,c),setTimeout(async()=>{r.clear(t,c),o.dispatch(qne(t,c));try{const d=n.fulfill(...c);d&&await o.dispatch(d),o.dispatch(Sne(t,c))}catch(d){o.dispatch(Cne(t,c,d))}},0))}const i=(...c)=>(c=o8(e,c),s(c),e(...c));return i.hasResolver=!0,i}function o8(e,t){return e.__unstableNormalizeArgs&&typeof e.__unstableNormalizeArgs=="function"&&t?.length?e.__unstableNormalizeArgs(t):t}const Kqe={name:"core/data",instantiate(e){const t=o=>(r,...s)=>e.select(r)[o](...s),n=o=>(r,...s)=>e.dispatch(r)[o](...s);return{getSelectors(){return Object.fromEntries(["getIsResolving","hasStartedResolution","hasFinishedResolution","isResolving","getCachedResolvers"].map(o=>[o,t(o)]))},getActions(){return Object.fromEntries(["startResolution","finishResolution","invalidateResolution","invalidateResolutionForStore","invalidateResolutionForStoreSelector"].map(o=>[o,n(o)]))},subscribe(){return()=>()=>{}}}}};function E$(){let e=!1,t=!1;const n=new Set,o=()=>Array.from(n).forEach(r=>r());return{get isPaused(){return e},subscribe(r){return n.add(r),()=>n.delete(r)},pause(){e=!0},resume(){e=!1,t&&(t=!1,o())},emit(){if(e){t=!0;return}o()}}}function vm(e){return typeof e=="string"?e:e.name}function SB(e={},t=null){const n={},o=E$();let r=null;function s(){o.emit()}const i=(A,_)=>{if(!_)return o.subscribe(A);const w=vm(_),k=n[w];return k?k.subscribe(A):t?t.subscribe(A,_):o.subscribe(A)};function c(A){const _=vm(A);r?.add(_);const w=n[_];return w?w.getSelectors():t?.select(_)}function l(A,_){r=new Set;try{return A.call(this)}finally{_.current=Array.from(r),r=null}}function u(A){const _=vm(A);r?.add(_);const w=n[_];return w?w.getResolveSelectors():t&&t.resolveSelect(_)}function d(A){const _=vm(A);r?.add(_);const w=n[_];return w?w.getSuspendSelectors():t&&t.suspendSelect(_)}function p(A){const _=vm(A),w=n[_];return w?w.getActions():t&&t.dispatch(_)}function f(A){return Object.fromEntries(Object.entries(A).map(([_,w])=>typeof w!="function"?[_,w]:[_,function(){return x[_].apply(null,arguments)}]))}function b(A,_){if(n[A])return console.error('Store "'+A+'" is already registered.'),n[A];const w=_();if(typeof w.getSelectors!="function")throw new TypeError("store.getSelectors must be a function");if(typeof w.getActions!="function")throw new TypeError("store.getActions must be a function");if(typeof w.subscribe!="function")throw new TypeError("store.subscribe must be a function");w.emitter=E$();const k=w.subscribe;if(w.subscribe=q=>{const S=w.emitter.subscribe(q),C=k(()=>{if(w.emitter.isPaused){w.emitter.emit();return}q()});return()=>{C?.(),S?.()}},n[A]=w,w.subscribe(s),t)try{Pf(w.store).registerPrivateActions(Pf(t).privateActionsOf(A)),Pf(w.store).registerPrivateSelectors(Pf(t).privateSelectorsOf(A))}catch{}return w}function h(A){b(A.name,()=>A.instantiate(x))}function g(A,_){Re("wp.data.registerGenericStore",{since:"5.9",alternative:"wp.data.register( storeDescriptor )"}),b(A,()=>_)}function z(A,_){if(!_.reducer)throw new TypeError("Must specify store reducer");return b(A,()=>er(A,_).instantiate(x)).store}function y(A){if(o.isPaused){A();return}o.pause(),Object.values(n).forEach(_=>_.emitter.pause());try{A()}finally{o.resume(),Object.values(n).forEach(_=>_.emitter.resume())}}let x={batch:y,stores:n,namespaces:n,subscribe:i,select:c,resolveSelect:u,suspendSelect:d,dispatch:p,use:v,register:h,registerGenericStore:g,registerStore:z,__unstableMarkListeningStores:l};function v(A,_){if(A)return x={...x,...A(x,_)},x}x.register(Kqe);for(const[A,_]of Object.entries(e))x.register(er(A,_));t&&t.subscribe(s);const M=f(x);return nM(M,{privateActionsOf:A=>{try{return Pf(n[A].store).privateActions}catch{return{}}},privateSelectorsOf:A=>{try{return Pf(n[A].store).privateSelectors}catch{return{}}}}),M}const Ga=SB();var Yqe=function(t){return Zqe(t)&&!Qqe(t)};function Zqe(e){return!!e&&typeof e=="object"}function Qqe(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||tSe(e)}var Jqe=typeof Symbol=="function"&&Symbol.for,eSe=Jqe?Symbol.for("react.element"):60103;function tSe(e){return e.$$typeof===eSe}function nSe(e){return Array.isArray(e)?[]:{}}function yg(e,t){return t.clone!==!1&&t.isMergeableObject(e)?z2(nSe(e),e,t):e}function oSe(e,t,n){return e.concat(t).map(function(o){return yg(o,n)})}function rSe(e,t){if(!t.customMerge)return z2;var n=t.customMerge(e);return typeof n=="function"?n:z2}function sSe(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function B$(e){return Object.keys(e).concat(sSe(e))}function Rne(e,t){try{return t in e}catch{return!1}}function iSe(e,t){return Rne(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function aSe(e,t,n){var o={};return n.isMergeableObject(e)&&B$(e).forEach(function(r){o[r]=yg(e[r],n)}),B$(t).forEach(function(r){iSe(e,r)||(Rne(e,r)&&n.isMergeableObject(t[r])?o[r]=rSe(r,n)(e[r],t[r],n):o[r]=yg(t[r],n))}),o}function z2(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||oSe,n.isMergeableObject=n.isMergeableObject||Yqe,n.cloneUnlessOtherwiseSpecified=yg;var o=Array.isArray(t),r=Array.isArray(e),s=o===r;return s?o?n.arrayMerge(e,t,n):aSe(e,t,n):yg(t,n)}z2.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(o,r){return z2(o,r,n)},{})};var cSe=z2,lSe=cSe;const Wne=yo(lSe),Tne=O.createContext(Ga),{Consumer:nb0,Provider:Ene}=Tne;function h0(){return O.useContext(Tne)}const Bne=O.createContext(!1),{Consumer:ob0,Provider:uSe}=Bne,Wx=uSe;function dSe(){return O.useContext(Bne)}const P6=One();function pSe(e,t){const n=e.select,o={};let r,s,i=!1,c,l;const u=new Map;function d(f){var b;return(b=e.stores[f]?.store?.getState?.())!==null&&b!==void 0?b:{}}const p=f=>{const b=[...f],h=new Set;function g(y){if(i)for(const _ of b)u.get(_)!==d(_)&&(i=!1);u.clear();const x=()=>{i=!1,y()},v=()=>{c?P6.add(o,x):x()},M=[];function A(_){M.push(e.subscribe(v,_))}for(const _ of b)A(_);return h.add(A),()=>{h.delete(A);for(const _ of M.values())_?.();P6.cancel(o)}}function z(y){for(const x of y)if(!b.includes(x)){b.push(x);for(const v of h)v(x)}}return{subscribe:g,updateStores:z}};return(f,b)=>{function h(){if(i&&f===r)return s;const z={current:null},y=e.__unstableMarkListeningStores(()=>f(n,e),z);if(l)l.updateStores(z.current);else{for(const x of z.current)u.set(x,d(x));l=p(z.current)}Jr(s,y)||(s=y),r=f,i=!0}function g(){return h(),s}return c&&!b&&(i=!1,P6.cancel(o)),h(),c=b,{subscribe:l.subscribe,getValue:g}}}function fSe(e){return h0().select(e)}function bSe(e,t,n){const o=h0(),r=dSe(),s=O.useMemo(()=>pSe(o),[o,e]),i=O.useCallback(t,n),{subscribe:c,getValue:l}=s(i,r),u=O.useSyncExternalStore(c,l,l);return O.useDebugValue(u),u}function D(e,t){const n=typeof e!="function",o=O.useRef(n);if(n!==o.current){const r=o.current?"static":"mapping",s=n?"static":"mapping";throw new Error(`Switching useSelect from ${r} to ${s} is not allowed`)}return n?fSe(e):bSe(!1,e,t)}const Xo=e=>Sn(t=>p6e(n=>{const r=D((s,i)=>e(s,n,i));return a.jsx(t,{...n,...r})}),"withSelect"),ae=e=>{const{dispatch:t}=h0();return e===void 0?t:t(e)},hSe=(e,t)=>{const n=h0(),o=O.useRef(e);return kB(()=>{o.current=e}),O.useMemo(()=>{const r=o.current(n.dispatch,n);return Object.fromEntries(Object.entries(r).map(([s,i])=>(typeof i!="function"&&console.warn(`Property ${s} returned from dispatchMap in useDispatchWithMap must be a function.`),[s,(...c)=>o.current(n.dispatch,n)[s](...c)])))},[n,...t])},Fi=e=>Sn(t=>n=>{const r=hSe((s,i)=>e(s,n,i),[]);return a.jsx(t,{...n,...r})},"withDispatch");function tr(e){return Ga.dispatch(e)}function V0(e){return Ga.select(e)}const zo=_ne,mSe=Ga.resolveSelect;Ga.suspendSelect;const MSe=Ga.subscribe;Ga.registerGenericStore;const gSe=Ga.registerStore;Ga.use;const Qs=Ga.register;var zSe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var o,r,s;if(Array.isArray(t)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=o;r--!==0;){var i=s[r];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const J1=yo(zSe);function OSe(e,t){if(!e)return t;let n=!1;const o={};for(const r in t)J1(e[r],t[r])?o[r]=e[r]:(n=!0,o[r]=t[r]);if(!n)return e;for(const r in e)o.hasOwnProperty(r)||(o[r]=e[r]);return o}function Tu(e){return typeof e=="string"?e.split(","):Array.isArray(e)?e:null}const Nne=e=>t=>(n,o)=>n===void 0||e(o)?t(n,o):n,CB=e=>(...t)=>async({resolveSelect:n})=>{await n[e](...t)},N$=e=>t=>(n={},o)=>{const r=o[e];if(r===void 0)return n;const s=t(n[r],o);return s===n[r]?n:{...n,[r]:s}},Lne=e=>t=>(n,o)=>t(n,e(o));function ASe(e){const t=new WeakMap;return n=>{let o;return t.has(n)?o=t.get(n):(o=e(n),n!==null&&typeof n=="object"&&t.set(n,o)),o}}function ySe(e,t){return(e.rawAttributes||[]).includes(t)}function Tx(e,t,n){if(!e||typeof e!="object")return e;const o=Array.isArray(t)?t:t.split(".");return o.reduce((r,s,i)=>(r[s]===void 0&&(Number.isInteger(o[i+1])?r[s]=[]:r[s]={}),i===o.length-1&&(r[s]=n),r[s]),e),e}function vSe(e,t,n){if(!e||typeof e!="object"||typeof t!="string"&&!Array.isArray(t))return e;const o=Array.isArray(t)?t:t.split(".");let r=e;return o.forEach(s=>{r=r?.[s]}),r!==void 0?r:n}function xSe(e){return/^\s*\d+\s*$/.test(e)}const WM=["create","read","update","delete"];function RB(e){const t={};if(!e)return t;const n={create:"POST",read:"GET",update:"PUT",delete:"DELETE"};for(const[o,r]of Object.entries(n))t[o]=e.includes(r);return t}function Ex(e,t,n){return(typeof t=="object"?[e,t.kind,t.name,t.id]:[e,t,n]).filter(Boolean).join("/")}function jne(e,t,n){return{type:"RECEIVE_ITEMS",items:Array.isArray(e)?e:[e],persistedEdits:t,meta:n}}function _Se(e,t,n,o=!1){return{type:"REMOVE_ITEMS",itemIds:Array.isArray(n)?n:[n],kind:e,name:t,invalidateCache:o}}function wSe(e,t={},n,o){return{...jne(e,n,o),query:t}}function kSe(e){const t={stableKey:"",page:1,perPage:10,fields:null,include:null,context:"default"},n=Object.keys(e).sort();for(let s=0;s{x=x?.[v]}),Tx(g,y,x)}}else{if(!e.itemIsComplete[c]?.[b])return null;g=h}p.push(g)}return p}const Pne=at((e,t={})=>{let n=L$.get(e);if(n){const r=n.get(t);if(r!==void 0)return r}else n=new ia,L$.set(e,n);const o=qSe(e,t);return n.set(t,o),o});function Ine(e,t={}){var n;const{stableKey:o,context:r}=uh(t);return(n=e.queries?.[r]?.[o]?.meta?.totalItems)!==null&&n!==void 0?n:null}function SSe(e,t={}){var n;const{stableKey:o,context:r}=uh(t);return(n=e.queries?.[r]?.[o]?.meta?.totalPages)!==null&&n!==void 0?n:null}function CSe(e={},t){switch(t.type){case"ADD_FORMAT_TYPES":return{...e,...t.formatTypes.reduce((n,o)=>({...n,[o.name]:o}),{})};case"REMOVE_FORMAT_TYPES":return Object.fromEntries(Object.entries(e).filter(([n])=>!t.names.includes(n)))}return e}const RSe=zo({formatTypes:CSe}),WB=at(e=>Object.values(e.formatTypes),e=>[e.formatTypes]);function WSe(e,t){return e.formatTypes[t]}function TSe(e,t){const n=WB(e);return n.find(({className:o,tagName:r})=>o===null&&t===r)||n.find(({className:o,tagName:r})=>o===null&&r==="*")}function ESe(e,t){return WB(e).find(({className:n})=>n===null?!1:` ${t} `.indexOf(` ${n} `)>=0)}const BSe=Object.freeze(Object.defineProperty({__proto__:null,getFormatType:WSe,getFormatTypeForBareElement:TSe,getFormatTypeForClassName:ESe,getFormatTypes:WB},Symbol.toStringTag,{value:"Module"}));function NSe(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Array.isArray(e)?e:[e]}}function LSe(e){return{type:"REMOVE_FORMAT_TYPES",names:Array.isArray(e)?e:[e]}}const jSe=Object.freeze(Object.defineProperty({__proto__:null,addFormatTypes:NSe,removeFormatTypes:LSe},Symbol.toStringTag,{value:"Module"})),PSe="core/rich-text",xc=er(PSe,{reducer:RSe,selectors:BSe,actions:jSe});Qs(xc);function cv(e,t){if(e===t)return!0;if(!e||!t||e.type!==t.type)return!1;const n=e.attributes,o=t.attributes;if(n===o)return!0;if(!n||!o)return!1;const r=Object.keys(n),s=Object.keys(o);if(r.length!==s.length)return!1;const i=r.length;for(let c=0;c{const r=t[o-1];if(r){const s=n.slice();s.forEach((i,c)=>{const l=r[c];cv(i,l)&&(s[c]=l)}),t[o]=s}}),{...e,formats:t}}function j$(e,t,n){return e=e.slice(),e[t]=n,e}function _i(e,t,n=e.start,o=e.end){const{formats:r,activeFormats:s}=e,i=r.slice();if(n===o){const c=i[n]?.find(({type:l})=>l===t.type);if(c){const l=i[n].indexOf(c);for(;i[n]&&i[n][l]===c;)i[n]=j$(i[n],l,t),n--;for(o++;i[o]&&i[o][l]===c;)i[o]=j$(i[o],l,t),o++}}else{let c=1/0;for(let l=n;ld!==t.type);const u=i[l].length;uc!==t.type)||[],t]})}function _c({implementation:e},t){return _c.body||(_c.body=e.createHTMLDocument("").body),_c.body.innerHTML=t,_c.body}const Ou="",Dne="\uFEFF";function TB(e,t=[]){const{formats:n,start:o,end:r,activeFormats:s}=e;if(o===void 0)return t;if(o===r){if(s)return s;const u=n[o-1]||t,d=n[o]||t;return u.lengthcv(p,f))||c.splice(d,1)}if(c.length===0)return t}return c||t}function Fne(e){return V0(xc).getFormatType(e)}function P$(e,t){if(t)return e;const n={};for(const o in e){let r=o;o.startsWith("data-disable-rich-text-")&&(r=o.slice(23)),n[r]=e[o]}return n}function ZO({type:e,tagName:t,attributes:n,unregisteredAttributes:o,object:r,boundaryClass:s,isEditableTree:i}){const c=Fne(e);let l={};if(s&&i&&(l["data-rich-text-format-boundary"]="true"),!c)return n&&(l={...n,...l}),{type:e,attributes:P$(l,i),object:r};l={...o,...l};for(const u in n){const d=c.attributes?c.attributes[u]:!1;d?l[d]=n[u]:l[u]=n[u]}return c.className&&(l.class?l.class=`${c.className} ${l.class}`:l.class=c.className),i&&c.contentEditable===!1&&(l.contenteditable="false"),{type:t||c.tagName,object:c.object,attributes:P$(l,i)}}function ISe(e,t,n){do if(e[n]!==t[n])return!1;while(n--);return!0}function $ne({value:e,preserveWhiteSpace:t,createEmpty:n,append:o,getLastChild:r,getParent:s,isText:i,getText:c,remove:l,appendText:u,onStartIndex:d,onEndIndex:p,isEditableTree:f,placeholder:b}){const{formats:h,replacements:g,text:z,start:y,end:x}=e,v=h.length+1,M=n(),A=TB(e),_=A[A.length-1];let w,k;o(M,"");for(let q=0;q1&&arguments[1]!==void 0?arguments[1]:{container:document.body},oe="";return typeof Z=="string"?oe=x(Z,ne):Z instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(Z?.type)?oe=x(Z.value,ne):(oe=b()(Z),h("copy")),oe},M=v;function A(X){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(ne){return typeof ne}:A=function(ne){return ne&&typeof Symbol=="function"&&ne.constructor===Symbol&&ne!==Symbol.prototype?"symbol":typeof ne},A(X)}var _=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ne=Z.action,oe=ne===void 0?"copy":ne,Y=Z.container,ee=Z.target,ie=Z.text;if(oe!=="copy"&&oe!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(ee!==void 0)if(ee&&A(ee)==="object"&&ee.nodeType===1){if(oe==="copy"&&ee.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(oe==="cut"&&(ee.hasAttribute("readonly")||ee.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ie)return M(ie,{container:Y});if(ee)return oe==="cut"?z(ee):M(ee,{container:Y})},w=_;function k(X){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(ne){return typeof ne}:k=function(ne){return ne&&typeof Symbol=="function"&&ne.constructor===Symbol&&ne!==Symbol.prototype?"symbol":typeof ne},k(X)}function q(X,Z){if(!(X instanceof Z))throw new TypeError("Cannot call a class as a function")}function S(X,Z){for(var ne=0;ne"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function I(X){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},I(X)}function P(X,Z){var ne="data-clipboard-".concat(X);if(Z.hasAttribute(ne))return Z.getAttribute(ne)}var H=function(X){T(ne,X);var Z=B(ne);function ne(oe,Y){var ee;return q(this,ne),ee=Z.call(this),ee.resolveOptions(Y),ee.listenClick(oe),ee}return C(ne,[{key:"resolveOptions",value:function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof Y.action=="function"?Y.action:this.defaultAction,this.target=typeof Y.target=="function"?Y.target:this.defaultTarget,this.text=typeof Y.text=="function"?Y.text:this.defaultText,this.container=k(Y.container)==="object"?Y.container:document.body}},{key:"listenClick",value:function(Y){var ee=this;this.listener=p()(Y,"click",function(ie){return ee.onClick(ie)})}},{key:"onClick",value:function(Y){var ee=Y.delegateTarget||Y.currentTarget,ie=this.action(ee)||"copy",se=w({action:ie,container:this.container,target:this.target(ee),text:this.text(ee)});this.emit(se?"success":"error",{action:ie,text:se,trigger:ee,clearSelection:function(){ee&&ee.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(Y){return P("action",Y)}},{key:"defaultTarget",value:function(Y){var ee=P("target",Y);if(ee)return document.querySelector(ee)}},{key:"defaultText",value:function(Y){return P("text",Y)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(Y){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return M(Y,ee)}},{key:"cut",value:function(Y){return z(Y)}},{key:"isSupported",value:function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],ee=typeof Y=="string"?[Y]:Y,ie=!!document.queryCommandSupported;return ee.forEach(function(se){ie=ie&&!!document.queryCommandSupported(se)}),ie}}]),ne}(u()),U=H},828:function(s){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var c=Element.prototype;c.matches=c.matchesSelector||c.mozMatchesSelector||c.msMatchesSelector||c.oMatchesSelector||c.webkitMatchesSelector}function l(u,d){for(;u&&u.nodeType!==i;){if(typeof u.matches=="function"&&u.matches(d))return u;u=u.parentNode}}s.exports=l},438:function(s,i,c){var l=c(828);function u(f,b,h,g,z){var y=p.apply(this,arguments);return f.addEventListener(h,y,z),{destroy:function(){f.removeEventListener(h,y,z)}}}function d(f,b,h,g,z){return typeof f.addEventListener=="function"?u.apply(null,arguments):typeof h=="function"?u.bind(null,document).apply(null,arguments):(typeof f=="string"&&(f=document.querySelectorAll(f)),Array.prototype.map.call(f,function(y){return u(y,b,h,g,z)}))}function p(f,b,h,g){return function(z){z.delegateTarget=l(z.target,b),z.delegateTarget&&g.call(f,z)}}s.exports=d},879:function(s,i){i.node=function(c){return c!==void 0&&c instanceof HTMLElement&&c.nodeType===1},i.nodeList=function(c){var l=Object.prototype.toString.call(c);return c!==void 0&&(l==="[object NodeList]"||l==="[object HTMLCollection]")&&"length"in c&&(c.length===0||i.node(c[0]))},i.string=function(c){return typeof c=="string"||c instanceof String},i.fn=function(c){var l=Object.prototype.toString.call(c);return l==="[object Function]"}},370:function(s,i,c){var l=c(879),u=c(438);function d(h,g,z){if(!h&&!g&&!z)throw new Error("Missing required arguments");if(!l.string(g))throw new TypeError("Second argument must be a String");if(!l.fn(z))throw new TypeError("Third argument must be a Function");if(l.node(h))return p(h,g,z);if(l.nodeList(h))return f(h,g,z);if(l.string(h))return b(h,g,z);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function p(h,g,z){return h.addEventListener(g,z),{destroy:function(){h.removeEventListener(g,z)}}}function f(h,g,z){return Array.prototype.forEach.call(h,function(y){y.addEventListener(g,z)}),{destroy:function(){Array.prototype.forEach.call(h,function(y){y.removeEventListener(g,z)})}}}function b(h,g,z){return u(document.body,h,g,z)}s.exports=d},817:function(s){function i(c){var l;if(c.nodeName==="SELECT")c.focus(),l=c.value;else if(c.nodeName==="INPUT"||c.nodeName==="TEXTAREA"){var u=c.hasAttribute("readonly");u||c.setAttribute("readonly",""),c.select(),c.setSelectionRange(0,c.value.length),u||c.removeAttribute("readonly"),l=c.value}else{c.hasAttribute("contenteditable")&&c.focus();var d=window.getSelection(),p=document.createRange();p.selectNodeContents(c),d.removeAllRanges(),d.addRange(p),l=d.toString()}return l}s.exports=i},279:function(s){function i(){}i.prototype={on:function(c,l,u){var d=this.e||(this.e={});return(d[c]||(d[c]=[])).push({fn:l,ctx:u}),this},once:function(c,l,u){var d=this;function p(){d.off(c,p),l.apply(u,arguments)}return p._=l,this.on(c,p,u)},emit:function(c){var l=[].slice.call(arguments,1),u=((this.e||(this.e={}))[c]||[]).slice(),d=0,p=u.length;for(d;d{const s=new D6e(r,{text(){return typeof n.current=="function"?n.current():n.current||""}});return s.on("success",({clearSelection:i})=>{i(),o.current&&o.current()}),()=>{s.destroy()}},[])}function Ta(e=null){if(!e){if(typeof window>"u")return!1;e=window}const{platform:t}=e.navigator;return t.indexOf("Mac")!==-1||["iPad","iPhone"].includes(t)}const Si=8,qp=9,y1=13,Ea=27,qx=32,F6e=33,$6e=34,Ag=35,Vb=36,Ns=37,xi=38,Ls=39,Do=40,_a=46,V6e=121,ui="alt",la="ctrl",ep="meta",di="shift";function fne(e){return e.length<2?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}function $z(e,t){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,t(o)]))}const Sx={primary:e=>e()?[ep]:[la],primaryShift:e=>e()?[di,ep]:[la,di],primaryAlt:e=>e()?[ui,ep]:[la,ui],secondary:e=>e()?[di,ui,ep]:[la,di,ui],access:e=>e()?[la,ui]:[di,ui],ctrl:()=>[la],alt:()=>[ui],ctrlShift:()=>[la,di],shift:()=>[di],shiftAlt:()=>[di,ui],undefined:()=>[]},H6e=$z(Sx,e=>(t,n=Ta)=>[...e(n),t.toLowerCase()].join("+")),bne=$z(Sx,e=>(t,n=Ta)=>{const o=n(),r={[ui]:o?"⌥":"Alt",[la]:o?"⌃":"Ctrl",[ep]:"⌘",[di]:o?"⇧":"Shift"};return[...e(n).reduce((i,c)=>{var l;const u=(l=r[c])!==null&&l!==void 0?l:c;return o?[...i,u]:[...i,u,"+"]},[]),fne(t)]}),Jo=$z(bne,e=>(t,n=Ta)=>e(t,n).join("")),hne=$z(Sx,e=>(t,n=Ta)=>{const o=n(),r={[di]:"Shift",[ep]:o?"Command":"Control",[la]:"Control",[ui]:o?"Option":"Alt",",":m("Comma"),".":m("Period"),"`":m("Backtick"),"~":m("Tilde")};return[...e(n),t].map(s=>{var i;return fne((i=r[s])!==null&&i!==void 0?i:s)}).join(o?" ":" + ")});function U6e(e){return[ui,la,ep,di].filter(t=>e[`${t}Key`])}const $s=$z(Sx,e=>(t,n,o=Ta)=>{const r=e(o),s=U6e(t),i={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=r.filter(d=>!s.includes(d)),l=s.filter(d=>!r.includes(d));if(c.length>0||l.length>0)return!1;let u=t.key.toLowerCase();return n?(t.altKey&&n.length===1&&(u=String.fromCharCode(t.keyCode).toLowerCase()),t.shiftKey&&n.length===1&&i[t.code]&&(u=i[t.code]),n==="del"&&(n="delete"),u===n.toLowerCase()):r.includes(u)});function Cx(e="firstElement"){const t=O.useRef(e),n=r=>{r.focus({preventScroll:!0})},o=O.useRef();return O.useEffect(()=>{t.current=e},[e]),Et(r=>{var s;if(!(!r||t.current===!1)&&!r.contains((s=r.ownerDocument?.activeElement)!==null&&s!==void 0?s:null)){if(t.current==="firstElement"){o.current=setTimeout(()=>{const i=Nn.tabbable.find(r)[0];i&&n(i)},0);return}return n(r),()=>{o.current&&clearTimeout(o.current)}}},[])}let KO=null;function _B(e){const t=O.useRef(null),n=O.useRef(null),o=O.useRef(e);return O.useEffect(()=>{o.current=e},[e]),O.useCallback(r=>{if(r){if(t.current=r,n.current)return;n.current=r.ownerDocument.activeElement}else if(n.current){const i=t.current?.contains(t.current?.ownerDocument.activeElement);if(t.current?.isConnected&&!i){var s;(s=KO)!==null&&s!==void 0||(KO=n.current);return}o.current?o.current():(n.current.isConnected?n.current:KO)?.focus(),KO=null}},[])}const X6e=["button","submit"];function G6e(e){if(!(e instanceof window.HTMLElement))return!1;switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return X6e.includes(e.type)}return!1}function mne(e){const t=O.useRef(e);O.useEffect(()=>{t.current=e},[e]);const n=O.useRef(!1),o=O.useRef(),r=O.useCallback(()=>{clearTimeout(o.current)},[]);O.useEffect(()=>()=>r(),[]),O.useEffect(()=>{e||r()},[e,r]);const s=O.useCallback(c=>{const{type:l,target:u}=c;["mouseup","touchend"].includes(l)?n.current=!1:G6e(u)&&(n.current=!0)},[]),i=O.useCallback(c=>{if(c.persist(),n.current)return;const l=c.target.getAttribute("data-unstable-ignore-focus-outside-for-relatedtarget");l&&c.relatedTarget?.closest(l)||(o.current=setTimeout(()=>{if(!document.hasFocus()){c.preventDefault();return}typeof t.current=="function"&&t.current(c)},0))},[]);return{onFocus:r,onMouseDown:s,onMouseUp:s,onTouchStart:s,onTouchEnd:s,onBlur:i}}function YO(e,t){typeof e=="function"?e(t):e&&e.hasOwnProperty("current")&&(e.current=t)}function Gt(e){const t=O.useRef(),n=O.useRef(!1),o=O.useRef(!1),r=O.useRef([]),s=O.useRef(e);return s.current=e,O.useLayoutEffect(()=>{o.current===!1&&n.current===!0&&e.forEach((i,c)=>{const l=r.current[c];i!==l&&(YO(l,null),YO(i,t.current))}),r.current=e},e),O.useLayoutEffect(()=>{o.current=!1}),O.useCallback(i=>{YO(t,i),o.current=!0,n.current=i!==null;const c=i?s.current:r.current;for(const l of c)YO(l,i)},[])}function Mne(e){const t=O.useRef(),{constrainTabbing:n=e.focusOnMount!==!1}=e;O.useEffect(()=>{t.current=e},Object.values(e));const o=xB(),r=Cx(e.focusOnMount),s=_B(),i=mne(l=>{t.current?.__unstableOnClose?t.current.__unstableOnClose("focus-outside",l):t.current?.onClose&&t.current.onClose()}),c=O.useCallback(l=>{l&&l.addEventListener("keydown",u=>{u.keyCode===Ea&&!u.defaultPrevented&&t.current?.onClose&&(u.preventDefault(),t.current.onClose())})},[]);return[Gt([n?o:null,e.focusOnMount!==!1?s:null,e.focusOnMount!==!1?r:null,c]),{...i,tabIndex:-1}]}function wB({isDisabled:e=!1}={}){return Et(t=>{if(e)return;const n=t?.ownerDocument?.defaultView;if(!n)return;const o=[],r=()=>{t.childNodes.forEach(c=>{c instanceof n.HTMLElement&&(c.getAttribute("inert")||(c.setAttribute("inert","true"),o.push(()=>{c.removeAttribute("inert")})))})},s=jr(r,0,{leading:!0});r();const i=new window.MutationObserver(s);return i.observe(t,{childList:!0}),()=>{i&&i.disconnect(),s.cancel(),o.forEach(c=>c())}},[e])}const kB=typeof window<"u"?O.useLayoutEffect:O.useEffect;function gne({onDragStart:e,onDragMove:t,onDragEnd:n}){const[o,r]=O.useState(!1),s=O.useRef({onDragStart:e,onDragMove:t,onDragEnd:n});kB(()=>{s.current.onDragStart=e,s.current.onDragMove=t,s.current.onDragEnd=n},[e,t,n]);const i=O.useCallback(u=>s.current.onDragMove&&s.current.onDragMove(u),[]),c=O.useCallback(u=>{s.current.onDragEnd&&s.current.onDragEnd(u),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",c),r(!1)},[]),l=O.useCallback(u=>{s.current.onDragStart&&s.current.onDragStart(u),document.addEventListener("mousemove",i),document.addEventListener("mouseup",c),r(!0)},[]);return O.useEffect(()=>()=>{o&&(document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",c))},[o]),{startDrag:l,endDrag:c,isDragging:o}}const w$=new Map;function K6e(e){if(!e)return null;let t=w$.get(e);return t||(typeof window<"u"&&typeof window.matchMedia=="function"?(t=window.matchMedia(e),w$.set(e,t),t):null)}function qB(e){const t=O.useMemo(()=>{const n=K6e(e);return{subscribe(o){return n?(n.addEventListener?.("change",o),()=>{n.removeEventListener?.("change",o)}):()=>{}},getValue(){var o;return(o=n?.matches)!==null&&o!==void 0?o:!1}}},[e]);return O.useSyncExternalStore(t.subscribe,t.getValue,()=>!1)}function t1(e){const t=O.useRef();return O.useEffect(()=>{t.current=e},[e]),t.current}const Zs=()=>qB("(prefers-reduced-motion: reduce)");function Y6e(e,t){const n={...e};return Object.entries(t).forEach(([o,r])=>{n[o]?n[o]={...n[o],to:r.to}:n[o]=r}),n}const k$=(e,t)=>{const n=e?.findIndex(({id:r})=>typeof r=="string"?r===t.id:Jr(r,t.id)),o=[...e];return n!==-1?o[n]={id:t.id,changes:Y6e(o[n].changes,t.changes)}:o.push(t),o};function Z6e(){let e=[],t=[],n=0;const o=()=>{e=e.slice(0,n||void 0),n=0},r=()=>{var i;const c=e.length===0?0:e.length-1;let l=(i=e[c])!==null&&i!==void 0?i:[];t.forEach(u=>{l=k$(l,u)}),t=[],e[c]=l},s=i=>!i.filter(({changes:l})=>Object.values(l).some(({from:u,to:d})=>typeof u!="function"&&typeof d!="function"&&!Jr(u,d))).length;return{addRecord(i,c=!1){const l=!i||s(i);if(c){if(l)return;i.forEach(u=>{t=k$(t,u)})}else{if(o(),t.length&&r(),l)return;e.push(i)}},undo(){t.length&&(o(),r());const i=e[e.length-1+n];if(i)return n-=1,i},redo(){const i=e[e.length+n];if(i)return n+=1,i},hasUndo(){return!!e[e.length-1+n]},hasRedo(){return!!e[e.length+n]}}}const q$={xhuge:1920,huge:1440,wide:1280,xlarge:1080,large:960,medium:782,small:600,mobile:480},Q6e={">=":"min-width","<":"max-width"},J6e={">=":(e,t)=>t>=e,"<":(e,t)=>t=")=>{const n=O.useContext(zne),o=!n&&`(${Q6e[t]}: ${q$[e]}px)`,r=qB(o||void 0);return n?J6e[t](q$[e],n):r};g0.__experimentalWidthProvider=zne.Provider;const eqe=e=>{let t;if(!e.contentBoxSize)t=[e.contentRect.width,e.contentRect.height];else if(e.contentBoxSize[0]){const r=e.contentBoxSize[0];t=[r.inlineSize,r.blockSize]}else{const r=e.contentBoxSize;t=[r.inlineSize,r.blockSize]}const[n,o]=t.map(r=>Math.round(r));return{width:n,height:o}},tqe={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",opacity:0,overflow:"hidden",zIndex:-1};function nqe({onResize:e}){const t=O.useRef(null),n=O.useRef(e);return O.useLayoutEffect(()=>{n.current=e},[e]),O.useLayoutEffect(()=>{const o=t.current,r=new ResizeObserver(s=>{for(const i of s){const c=eqe(i);n.current(c)}});return r.observe(o),()=>{r.unobserve(o)}},[]),a.jsx("div",{ref:t,style:tqe,"aria-hidden":"true"})}function oqe(e,t){return e.width===t.width&&e.height===t.height}const S$={width:null,height:null};function Ci(){const[e,t]=O.useState(S$),n=O.useRef(S$),o=O.useCallback(s=>{oqe(n.current,s)||(n.current=s,t(s))},[]);return[a.jsx(nqe,{onResize:o}),e]}var rqe={exports:{}};(function(e){(function(t){e.exports?e.exports=t():window.idleCallbackShim=t()})(function(){var t,n,o,r,s=typeof window<"u"?window:typeof In!=null?In:this||{},i=s.cancelRequestAnimationFrame&&s.requestAnimationFrame||setTimeout,c=s.cancelRequestAnimationFrame||clearTimeout,l=[],u=0,d=!1,p=7,f=35,b=125,h=0,g=0,z=0,y={get didTimeout(){return!1},timeRemaining:function(){var T=p-(Date.now()-g);return T<0?0:T}},x=v(function(){p=22,b=66,f=0});function v(T){var W,B,N=99,E=function(){var L=Date.now()-B;L9?o=setTimeout(w,n):(n=0,w()))}function q(){var T,W,B,N=p>9?9:1;if(g=Date.now(),d=!1,o=null,u>2||g-n-50N;W++)T=l.shift(),z++,T&&T(y);l.length?k():u=0}function S(T){return h++,l.push(T),k(),h}function C(T){var W=T-1-z;l[W]&&(l[W]=null)}if(!s.requestIdleCallback||!s.cancelIdleCallback)s.requestIdleCallback=S,s.cancelIdleCallback=C,s.document&&document.addEventListener&&(s.addEventListener("scroll",A,!0),s.addEventListener("resize",A),document.addEventListener("focus",A,!0),document.addEventListener("mouseover",A,!0),["click","keypress","touchstart","mousedown"].forEach(function(T){document.addEventListener(T,A,{capture:!0,passive:!0})}),s.MutationObserver&&new MutationObserver(A).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}));else try{s.requestIdleCallback(function(){},{timeout:0})}catch{(function(W){var B,N;if(s.requestIdleCallback=function(E,L){return L&&typeof L.timeout=="number"?W(E,L.timeout):W(E)},s.IdleCallbackDeadline&&(B=IdleCallbackDeadline.prototype)){if(N=Object.getOwnPropertyDescriptor(B,"timeRemaining"),!N||!N.configurable||!N.get)return;Object.defineProperty(B,"timeRemaining",{value:function(){return N.get.call(this)},enumerable:!0,configurable:!0})}})(s.requestIdleCallback)}return{request:S,cancel:C}})})(rqe);function sqe(){return typeof window>"u"?e=>{setTimeout(()=>e(Date.now()),0)}:window.requestIdleCallback}const C$=sqe(),One=()=>{const e=new Map;let t=!1;const n=c=>{for(const[l,u]of e)if(e.delete(l),u(),typeof c=="number"||c.timeRemaining()<=0)break;if(e.size===0){t=!1;return}C$(n)};return{add:(c,l)=>{e.set(c,l),t||(t=!0,C$(n))},flush:c=>{const l=e.get(c);return l===void 0?!1:(e.delete(c),l(),!0)},cancel:c=>e.delete(c),reset:()=>{e.clear(),t=!1}}};function iqe(e,t){const n=[];for(let o=0;o{let s=iqe(e,o);s.length{Qo.flushSync(()=>{r(l=>[...l,...e.slice(c,c+n)])})});return()=>i.reset()},[e]),o}function aqe(e,t){if(e.length!==t.length)return!1;for(var n=0;njr(e,t??0,n),[e,t,n]);return O.useEffect(()=>()=>o.cancel(),[o]),o}function yne(e=""){const[t,n]=O.useState(e),[o,r]=O.useState(e),s=Uo(r,250);return O.useEffect(()=>{s(t)},[t,s]),[t,n,o]}function t8(e,t,n){const o=Ane(()=>zB(e,t??0,n),[e,t,n]);return O.useEffect(()=>()=>o.cancel(),[o]),o}function jf(e){const t=O.useRef();return t.current=e,t}function Rx({dropZoneElement:e,isDisabled:t,onDrop:n,onDragStart:o,onDragEnter:r,onDragLeave:s,onDragEnd:i,onDragOver:c}){const l=jf(n),u=jf(o),d=jf(r),p=jf(s),f=jf(i),b=jf(c);return Et(h=>{if(t)return;const g=e??h;let z=!1;const{ownerDocument:y}=g;function x(q){const{defaultView:S}=y;if(!q||!S||!(q instanceof S.HTMLElement)||!g.contains(q))return!1;let C=q;do if(C.dataset.isDropZone)return C===g;while(C=C.parentElement);return!1}function v(q){z||(z=!0,y.addEventListener("dragend",k),y.addEventListener("mousemove",k),u.current&&u.current(q))}function M(q){q.preventDefault(),!g.contains(q.relatedTarget)&&d.current&&d.current(q)}function A(q){!q.defaultPrevented&&b.current&&b.current(q),q.preventDefault()}function _(q){x(q.relatedTarget)||p.current&&p.current(q)}function w(q){q.defaultPrevented||(q.preventDefault(),q.dataTransfer&&q.dataTransfer.files.length,l.current&&l.current(q),k(q))}function k(q){z&&(z=!1,y.removeEventListener("dragend",k),y.removeEventListener("mousemove",k),f.current&&f.current(q))}return g.dataset.isDropZone="true",g.addEventListener("drop",w),g.addEventListener("dragenter",M),g.addEventListener("dragover",A),g.addEventListener("dragleave",_),y.addEventListener("dragenter",v),()=>{delete g.dataset.isDropZone,g.removeEventListener("drop",w),g.removeEventListener("dragenter",M),g.removeEventListener("dragover",A),g.removeEventListener("dragleave",_),y.removeEventListener("dragend",k),y.removeEventListener("mousemove",k),y.removeEventListener("dragenter",v)}},[t,e])}function vne(){return Et(e=>{const{ownerDocument:t}=e;if(!t)return;const{defaultView:n}=t;if(!n)return;function o(){t&&t.activeElement===e&&e.focus()}return n.addEventListener("blur",o),()=>{n.removeEventListener("blur",o)}},[])}const cqe=30;function lqe(e,t,n,o){var r,s;const i=(r=o?.initWindowSize)!==null&&r!==void 0?r:cqe,c=(s=o?.useWindowing)!==null&&s!==void 0?s:!0,[l,u]=O.useState({visibleItems:i,start:0,end:i,itemInView:d=>d>=0&&d<=i});return O.useLayoutEffect(()=>{if(!c)return;const d=Sr(e.current),p=b=>{var h;if(!d)return;const g=Math.ceil(d.clientHeight/t),z=b?g:(h=o?.windowOverscan)!==null&&h!==void 0?h:g,y=Math.floor(d.scrollTop/t),x=Math.max(0,y-z),v=Math.min(n-1,y+g+z);u(M=>{const A={visibleItems:g,start:x,end:v,itemInView:_=>x<=_&&_<=v};return M.start!==A.start||M.end!==A.end||M.visibleItems!==A.visibleItems?A:M})};p(!0);const f=jr(()=>{p()},16);return d?.addEventListener("scroll",f),d?.ownerDocument?.defaultView?.addEventListener("resize",f),d?.ownerDocument?.defaultView?.addEventListener("resize",f),()=>{d?.removeEventListener("scroll",f),d?.ownerDocument?.defaultView?.removeEventListener("resize",f)}},[t,e,n,o?.expandedState,o?.windowOverscan,c]),O.useLayoutEffect(()=>{if(!c)return;const d=Sr(e.current),p=f=>{switch(f.keyCode){case Vb:return d?.scrollTo({top:0});case Ag:return d?.scrollTo({top:n*t});case F6e:return d?.scrollTo({top:d.scrollTop-l.visibleItems*t});case $6e:return d?.scrollTo({top:d.scrollTop+l.visibleItems*t})}};return d?.ownerDocument?.defaultView?.addEventListener("keydown",p),()=>{d?.ownerDocument?.defaultView?.removeEventListener("keydown",p)}},[n,t,e,l.visibleItems,c,o?.expandedState]),[l,u]}function xne(e,t){const[n,o]=O.useMemo(()=>[r=>e.subscribe(t,r),()=>e.get(t)],[e,t]);return O.useSyncExternalStore(n,o,o)}function _ne(e){const t=Object.keys(e);return function(o={},r){const s={};let i=!1;for(const c of t){const l=e[c],u=o[c],d=l(u,r);s[c]=d,i=i||d!==u}return i?s:o}}function nt(e){const t=new WeakMap,n=(...o)=>{let r=t.get(n.registry);return r||(r=e(n.registry.select),t.set(n.registry,r)),r(...o)};return n.isRegistrySelector=!0,n}function N6(e){return e.isRegistryControl=!0,e}const uqe="@@data/SELECT",dqe="@@data/RESOLVE_SELECT",pqe="@@data/DISPATCH",fqe={[uqe]:N6(e=>({storeKey:t,selectorName:n,args:o})=>e.select(t)[n](...o)),[dqe]:N6(e=>({storeKey:t,selectorName:n,args:o})=>{const r=e.select(t)[n].hasResolver?"resolveSelect":"select";return e[r](t)[n](...o)}),[pqe]:N6(e=>({storeKey:t,actionName:n,args:o})=>e.dispatch(t)[n](...o))},bqe=["@wordpress/block-directory","@wordpress/block-editor","@wordpress/block-library","@wordpress/blocks","@wordpress/commands","@wordpress/components","@wordpress/core-commands","@wordpress/core-data","@wordpress/customize-widgets","@wordpress/data","@wordpress/edit-post","@wordpress/edit-site","@wordpress/edit-widgets","@wordpress/editor","@wordpress/format-library","@wordpress/interface","@wordpress/patterns","@wordpress/preferences","@wordpress/reusable-blocks","@wordpress/router","@wordpress/dataviews"],R$=[];let n8;try{n8=!globalThis.IS_WORDPRESS_CORE}catch{n8=!0}const ar=(e,t)=>{if(!bqe.includes(t))throw new Error(`You tried to opt-in to unstable APIs as module "${t}". This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if(!n8&&R$.includes(t))throw new Error(`You tried to opt-in to unstable APIs as module "${t}" which is already registered. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);return R$.push(t),{lock:hqe,unlock:mqe}};function hqe(e,t){if(!e)throw new Error("Cannot lock an undefined object.");RM in e||(e[RM]={}),wne.set(e[RM],t)}function mqe(e){if(!e)throw new Error("Cannot unlock an undefined object.");if(!(RM in e))throw new Error("Cannot unlock an object that was not locked before. ");return wne.get(e[RM])}const wne=new WeakMap,RM=Symbol("Private API ID"),{lock:nM,unlock:Pf}=ar("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/data"),Mqe=()=>e=>t=>Z0e(t)?t.then(n=>{if(n)return e(n)}):e(t),gqe=(e,t)=>()=>n=>o=>{const r=e.select(t).getCachedResolvers();return Object.entries(r).forEach(([i,c])=>{const l=e.stores[t]?.resolvers?.[i];!l||!l.shouldInvalidate||c.forEach((u,d)=>{u!==void 0&&(u.status!=="finished"&&u.status!=="error"||l.shouldInvalidate(o,...d)&&e.dispatch(t).invalidateResolution(i,d))})}),n(o)};function zqe(e){return()=>t=>n=>typeof n=="function"?n(e):t(n)}const Oqe=e=>t=>(n={},o)=>{const r=o[e];if(r===void 0)return n;const s=t(n[r],o);return s===n[r]?n:{...n,[r]:s}};function Pl(e){if(e==null)return[];const t=e.length;let n=t;for(;n>0&&e[n-1]===void 0;)n--;return n===t?e:e.slice(0,n)}const Aqe=Oqe("selectorName")((e=new ia,t)=>{switch(t.type){case"START_RESOLUTION":{const n=new ia(e);return n.set(Pl(t.args),{status:"resolving"}),n}case"FINISH_RESOLUTION":{const n=new ia(e);return n.set(Pl(t.args),{status:"finished"}),n}case"FAIL_RESOLUTION":{const n=new ia(e);return n.set(Pl(t.args),{status:"error",error:t.error}),n}case"START_RESOLUTIONS":{const n=new ia(e);for(const o of t.args)n.set(Pl(o),{status:"resolving"});return n}case"FINISH_RESOLUTIONS":{const n=new ia(e);for(const o of t.args)n.set(Pl(o),{status:"finished"});return n}case"FAIL_RESOLUTIONS":{const n=new ia(e);return t.args.forEach((o,r)=>{const s={status:"error",error:void 0},i=t.errors[r];i&&(s.error=i),n.set(Pl(o),s)}),n}case"INVALIDATE_RESOLUTION":{const n=new ia(e);return n.delete(Pl(t.args)),n}}return e}),yqe=(e={},t)=>{switch(t.type){case"INVALIDATE_RESOLUTION_FOR_STORE":return{};case"INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR":{if(t.selectorName in e){const{[t.selectorName]:n,...o}=e;return o}return e}case"START_RESOLUTION":case"FINISH_RESOLUTION":case"FAIL_RESOLUTION":case"START_RESOLUTIONS":case"FINISH_RESOLUTIONS":case"FAIL_RESOLUTIONS":case"INVALIDATE_RESOLUTION":return Aqe(e,t)}return e};var L6={};function vqe(e){return[e]}function xqe(e){return!!e&&typeof e=="object"}function _qe(){var e={clear:function(){e.head=null}};return e}function W$(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;oArray.from(t._map.values()).some(n=>n[1]?.status==="resolving"))}const Tqe=at(e=>{const t={};return Object.values(e).forEach(n=>Array.from(n._map.values()).forEach(o=>{var r;const s=(r=o[1]?.status)!==null&&r!==void 0?r:"error";t[s]||(t[s]=0),t[s]++})),t},e=>[e]),Eqe=Object.freeze(Object.defineProperty({__proto__:null,countSelectorsByStatus:Tqe,getCachedResolvers:Rqe,getIsResolving:wqe,getResolutionError:Sqe,getResolutionState:cf,hasFinishedResolution:kqe,hasResolutionFailed:qqe,hasResolvingSelectors:Wqe,hasStartedResolution:kne,isResolving:Cqe},Symbol.toStringTag,{value:"Module"}));function qne(e,t){return{type:"START_RESOLUTION",selectorName:e,args:t}}function Sne(e,t){return{type:"FINISH_RESOLUTION",selectorName:e,args:t}}function Cne(e,t,n){return{type:"FAIL_RESOLUTION",selectorName:e,args:t,error:n}}function Bqe(e,t){return{type:"START_RESOLUTIONS",selectorName:e,args:t}}function Nqe(e,t){return{type:"FINISH_RESOLUTIONS",selectorName:e,args:t}}function Lqe(e,t,n){return{type:"FAIL_RESOLUTIONS",selectorName:e,args:t,errors:n}}function jqe(e,t){return{type:"INVALIDATE_RESOLUTION",selectorName:e,args:t}}function Pqe(){return{type:"INVALIDATE_RESOLUTION_FOR_STORE"}}function Iqe(e){return{type:"INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR",selectorName:e}}const Dqe=Object.freeze(Object.defineProperty({__proto__:null,failResolution:Cne,failResolutions:Lqe,finishResolution:Sne,finishResolutions:Nqe,invalidateResolution:jqe,invalidateResolutionForStore:Pqe,invalidateResolutionForStoreSelector:Iqe,startResolution:qne,startResolutions:Bqe},Symbol.toStringTag,{value:"Module"})),j6=e=>{const t=[...e];for(let n=t.length-1;n>=0;n--)t[n]===void 0&&t.splice(n,1);return t},eu=(e,t)=>Object.fromEntries(Object.entries(e??{}).map(([n,o])=>[n,t(o,n)])),Fqe=(e,t)=>t instanceof Map?Object.fromEntries(t):t instanceof window.HTMLElement?null:t;function $qe(){const e={};return{isRunning(t,n){return e[t]&&e[t].get(j6(n))},clear(t,n){e[t]&&e[t].delete(j6(n))},markAsRunning(t,n){e[t]||(e[t]=new ia),e[t].set(j6(n),!0)}}}function T$(e){const t=new WeakMap;return{get(n,o){let r=t.get(n);return r||(r=e(n,o),t.set(n,r)),r}}}function er(e,t){const n={},o={},r={privateActions:n,registerPrivateActions:i=>{Object.assign(n,i)},privateSelectors:o,registerPrivateSelectors:i=>{Object.assign(o,i)}},s={name:e,instantiate:i=>{const c=new Set,l=t.reducer,d=Vqe(e,t,i,{registry:i,get dispatch(){return z},get select(){return w},get resolveSelect(){return T()}});nM(d,r);const p=$qe();function f(E){return(...L)=>Promise.resolve(d.dispatch(E(...L)))}const b={...eu(Dqe,f),...eu(t.actions,f)},h=T$(f),g=new Proxy(()=>{},{get:(E,L)=>{const I=n[L];return I?h.get(I,L):b[L]}}),z=new Proxy(g,{apply:(E,L,[I])=>d.dispatch(I)});nM(b,g);const y=t.resolvers?Xqe(t.resolvers):{};function x(E,L){E.isRegistrySelector&&(E.registry=i);const I=(...H)=>{H=o8(E,H);const U=d.__unstableOriginalGetState();return E.isRegistrySelector&&(E.registry=i),E(U.root,...H)};I.__unstableNormalizeArgs=E.__unstableNormalizeArgs;const P=y[L];return P?Gqe(I,L,P,d,p):(I.hasResolver=!1,I)}function v(E){const L=(...I)=>{const P=d.__unstableOriginalGetState(),H=I&&I[0],U=I&&I[1],X=t?.selectors?.[H];return H&&X&&(I[1]=o8(X,U)),E(P.metadata,...I)};return L.hasResolver=!1,L}const M={...eu(Eqe,v),...eu(t.selectors,x)},A=T$(x);for(const[E,L]of Object.entries(o))A.get(L,E);const _=new Proxy(()=>{},{get:(E,L)=>{const I=o[L];return I?A.get(I,L):M[L]}}),w=new Proxy(_,{apply:(E,L,[I])=>I(d.__unstableOriginalGetState())});nM(M,_);const k=Hqe(M,d),q=Uqe(M,d),S=()=>M,C=()=>b,T=()=>k,W=()=>q;d.__unstableOriginalGetState=d.getState,d.getState=()=>d.__unstableOriginalGetState().root;const B=d&&(E=>(c.add(E),()=>c.delete(E)));let N=d.__unstableOriginalGetState();return d.subscribe(()=>{const E=d.__unstableOriginalGetState(),L=E!==N;if(N=E,L)for(const I of c)I()}),{reducer:l,store:d,actions:b,selectors:M,resolvers:y,getSelectors:S,getResolveSelectors:T,getSuspendSelectors:W,getActions:C,subscribe:B}}};return nM(s,r),s}function Vqe(e,t,n,o){const r={...t.controls,...fqe},s=eu(r,p=>p.isRegistryControl?p(n):p),i=[gqe(n,e),Mqe,l6e(s),zqe(o)],c=[Ake(...i)];typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&c.push(window.__REDUX_DEVTOOLS_EXTENSION__({name:e,instanceId:e,serialize:{replacer:Fqe}}));const{reducer:l,initialState:u}=t,d=_ne({metadata:yqe,root:l});return U0e(d,{root:u},v0(c))}function Hqe(e,t){const{getIsResolving:n,hasStartedResolution:o,hasFinishedResolution:r,hasResolutionFailed:s,isResolving:i,getCachedResolvers:c,getResolutionState:l,getResolutionError:u,hasResolvingSelectors:d,countSelectorsByStatus:p,...f}=e;return eu(f,(b,h)=>b.hasResolver?(...g)=>new Promise((z,y)=>{const x=()=>e.hasFinishedResolution(h,g),v=w=>{if(e.hasResolutionFailed(h,g)){const q=e.getResolutionError(h,g);y(q)}else z(w)},M=()=>b.apply(null,g),A=M();if(x())return v(A);const _=t.subscribe(()=>{x()&&(_(),v(M()))})}):async(...g)=>b.apply(null,g))}function Uqe(e,t){return eu(e,(n,o)=>n.hasResolver?(...r)=>{const s=n.apply(null,r);if(e.hasFinishedResolution(o,r)){if(e.hasResolutionFailed(o,r))throw e.getResolutionError(o,r);return s}throw new Promise(i=>{const c=t.subscribe(()=>{e.hasFinishedResolution(o,r)&&(i(),c())})})}:n)}function Xqe(e){return eu(e,t=>t.fulfill?t:{...t,fulfill:t})}function Gqe(e,t,n,o,r){function s(c){const l=o.getState();if(r.isRunning(t,c)||typeof n.isFulfilled=="function"&&n.isFulfilled(l,...c))return;const{metadata:u}=o.__unstableOriginalGetState();kne(u,t,c)||(r.markAsRunning(t,c),setTimeout(async()=>{r.clear(t,c),o.dispatch(qne(t,c));try{const d=n.fulfill(...c);d&&await o.dispatch(d),o.dispatch(Sne(t,c))}catch(d){o.dispatch(Cne(t,c,d))}},0))}const i=(...c)=>(c=o8(e,c),s(c),e(...c));return i.hasResolver=!0,i}function o8(e,t){return e.__unstableNormalizeArgs&&typeof e.__unstableNormalizeArgs=="function"&&t?.length?e.__unstableNormalizeArgs(t):t}const Kqe={name:"core/data",instantiate(e){const t=o=>(r,...s)=>e.select(r)[o](...s),n=o=>(r,...s)=>e.dispatch(r)[o](...s);return{getSelectors(){return Object.fromEntries(["getIsResolving","hasStartedResolution","hasFinishedResolution","isResolving","getCachedResolvers"].map(o=>[o,t(o)]))},getActions(){return Object.fromEntries(["startResolution","finishResolution","invalidateResolution","invalidateResolutionForStore","invalidateResolutionForStoreSelector"].map(o=>[o,n(o)]))},subscribe(){return()=>()=>{}}}}};function E$(){let e=!1,t=!1;const n=new Set,o=()=>Array.from(n).forEach(r=>r());return{get isPaused(){return e},subscribe(r){return n.add(r),()=>n.delete(r)},pause(){e=!0},resume(){e=!1,t&&(t=!1,o())},emit(){if(e){t=!0;return}o()}}}function vm(e){return typeof e=="string"?e:e.name}function SB(e={},t=null){const n={},o=E$();let r=null;function s(){o.emit()}const i=(A,_)=>{if(!_)return o.subscribe(A);const w=vm(_),k=n[w];return k?k.subscribe(A):t?t.subscribe(A,_):o.subscribe(A)};function c(A){const _=vm(A);r?.add(_);const w=n[_];return w?w.getSelectors():t?.select(_)}function l(A,_){r=new Set;try{return A.call(this)}finally{_.current=Array.from(r),r=null}}function u(A){const _=vm(A);r?.add(_);const w=n[_];return w?w.getResolveSelectors():t&&t.resolveSelect(_)}function d(A){const _=vm(A);r?.add(_);const w=n[_];return w?w.getSuspendSelectors():t&&t.suspendSelect(_)}function p(A){const _=vm(A),w=n[_];return w?w.getActions():t&&t.dispatch(_)}function f(A){return Object.fromEntries(Object.entries(A).map(([_,w])=>typeof w!="function"?[_,w]:[_,function(){return x[_].apply(null,arguments)}]))}function b(A,_){if(n[A])return console.error('Store "'+A+'" is already registered.'),n[A];const w=_();if(typeof w.getSelectors!="function")throw new TypeError("store.getSelectors must be a function");if(typeof w.getActions!="function")throw new TypeError("store.getActions must be a function");if(typeof w.subscribe!="function")throw new TypeError("store.subscribe must be a function");w.emitter=E$();const k=w.subscribe;if(w.subscribe=q=>{const S=w.emitter.subscribe(q),C=k(()=>{if(w.emitter.isPaused){w.emitter.emit();return}q()});return()=>{C?.(),S?.()}},n[A]=w,w.subscribe(s),t)try{Pf(w.store).registerPrivateActions(Pf(t).privateActionsOf(A)),Pf(w.store).registerPrivateSelectors(Pf(t).privateSelectorsOf(A))}catch{}return w}function h(A){b(A.name,()=>A.instantiate(x))}function g(A,_){Re("wp.data.registerGenericStore",{since:"5.9",alternative:"wp.data.register( storeDescriptor )"}),b(A,()=>_)}function z(A,_){if(!_.reducer)throw new TypeError("Must specify store reducer");return b(A,()=>er(A,_).instantiate(x)).store}function y(A){if(o.isPaused){A();return}o.pause(),Object.values(n).forEach(_=>_.emitter.pause());try{A()}finally{o.resume(),Object.values(n).forEach(_=>_.emitter.resume())}}let x={batch:y,stores:n,namespaces:n,subscribe:i,select:c,resolveSelect:u,suspendSelect:d,dispatch:p,use:v,register:h,registerGenericStore:g,registerStore:z,__unstableMarkListeningStores:l};function v(A,_){if(A)return x={...x,...A(x,_)},x}x.register(Kqe);for(const[A,_]of Object.entries(e))x.register(er(A,_));t&&t.subscribe(s);const M=f(x);return nM(M,{privateActionsOf:A=>{try{return Pf(n[A].store).privateActions}catch{return{}}},privateSelectorsOf:A=>{try{return Pf(n[A].store).privateSelectors}catch{return{}}}}),M}const Ga=SB();var Yqe=function(t){return Zqe(t)&&!Qqe(t)};function Zqe(e){return!!e&&typeof e=="object"}function Qqe(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||tSe(e)}var Jqe=typeof Symbol=="function"&&Symbol.for,eSe=Jqe?Symbol.for("react.element"):60103;function tSe(e){return e.$$typeof===eSe}function nSe(e){return Array.isArray(e)?[]:{}}function yg(e,t){return t.clone!==!1&&t.isMergeableObject(e)?z2(nSe(e),e,t):e}function oSe(e,t,n){return e.concat(t).map(function(o){return yg(o,n)})}function rSe(e,t){if(!t.customMerge)return z2;var n=t.customMerge(e);return typeof n=="function"?n:z2}function sSe(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function B$(e){return Object.keys(e).concat(sSe(e))}function Rne(e,t){try{return t in e}catch{return!1}}function iSe(e,t){return Rne(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function aSe(e,t,n){var o={};return n.isMergeableObject(e)&&B$(e).forEach(function(r){o[r]=yg(e[r],n)}),B$(t).forEach(function(r){iSe(e,r)||(Rne(e,r)&&n.isMergeableObject(t[r])?o[r]=rSe(r,n)(e[r],t[r],n):o[r]=yg(t[r],n))}),o}function z2(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||oSe,n.isMergeableObject=n.isMergeableObject||Yqe,n.cloneUnlessOtherwiseSpecified=yg;var o=Array.isArray(t),r=Array.isArray(e),s=o===r;return s?o?n.arrayMerge(e,t,n):aSe(e,t,n):yg(t,n)}z2.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(o,r){return z2(o,r,n)},{})};var cSe=z2,lSe=cSe;const Wne=yo(lSe),Tne=O.createContext(Ga),{Consumer:sb0,Provider:Ene}=Tne;function h0(){return O.useContext(Tne)}const Bne=O.createContext(!1),{Consumer:ib0,Provider:uSe}=Bne,Wx=uSe;function dSe(){return O.useContext(Bne)}const P6=One();function pSe(e,t){const n=e.select,o={};let r,s,i=!1,c,l;const u=new Map;function d(f){var b;return(b=e.stores[f]?.store?.getState?.())!==null&&b!==void 0?b:{}}const p=f=>{const b=[...f],h=new Set;function g(y){if(i)for(const _ of b)u.get(_)!==d(_)&&(i=!1);u.clear();const x=()=>{i=!1,y()},v=()=>{c?P6.add(o,x):x()},M=[];function A(_){M.push(e.subscribe(v,_))}for(const _ of b)A(_);return h.add(A),()=>{h.delete(A);for(const _ of M.values())_?.();P6.cancel(o)}}function z(y){for(const x of y)if(!b.includes(x)){b.push(x);for(const v of h)v(x)}}return{subscribe:g,updateStores:z}};return(f,b)=>{function h(){if(i&&f===r)return s;const z={current:null},y=e.__unstableMarkListeningStores(()=>f(n,e),z);if(l)l.updateStores(z.current);else{for(const x of z.current)u.set(x,d(x));l=p(z.current)}Jr(s,y)||(s=y),r=f,i=!0}function g(){return h(),s}return c&&!b&&(i=!1,P6.cancel(o)),h(),c=b,{subscribe:l.subscribe,getValue:g}}}function fSe(e){return h0().select(e)}function bSe(e,t,n){const o=h0(),r=dSe(),s=O.useMemo(()=>pSe(o),[o,e]),i=O.useCallback(t,n),{subscribe:c,getValue:l}=s(i,r),u=O.useSyncExternalStore(c,l,l);return O.useDebugValue(u),u}function D(e,t){const n=typeof e!="function",o=O.useRef(n);if(n!==o.current){const r=o.current?"static":"mapping",s=n?"static":"mapping";throw new Error(`Switching useSelect from ${r} to ${s} is not allowed`)}return n?fSe(e):bSe(!1,e,t)}const Xo=e=>Sn(t=>p6e(n=>{const r=D((s,i)=>e(s,n,i));return a.jsx(t,{...n,...r})}),"withSelect"),ae=e=>{const{dispatch:t}=h0();return e===void 0?t:t(e)},hSe=(e,t)=>{const n=h0(),o=O.useRef(e);return kB(()=>{o.current=e}),O.useMemo(()=>{const r=o.current(n.dispatch,n);return Object.fromEntries(Object.entries(r).map(([s,i])=>(typeof i!="function"&&console.warn(`Property ${s} returned from dispatchMap in useDispatchWithMap must be a function.`),[s,(...c)=>o.current(n.dispatch,n)[s](...c)])))},[n,...t])},Fi=e=>Sn(t=>n=>{const r=hSe((s,i)=>e(s,n,i),[]);return a.jsx(t,{...n,...r})},"withDispatch");function tr(e){return Ga.dispatch(e)}function V0(e){return Ga.select(e)}const zo=_ne,mSe=Ga.resolveSelect;Ga.suspendSelect;const MSe=Ga.subscribe;Ga.registerGenericStore;const gSe=Ga.registerStore;Ga.use;const Qs=Ga.register;var zSe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var o,r,s;if(Array.isArray(t)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=o;r--!==0;){var i=s[r];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const J1=yo(zSe);function OSe(e,t){if(!e)return t;let n=!1;const o={};for(const r in t)J1(e[r],t[r])?o[r]=e[r]:(n=!0,o[r]=t[r]);if(!n)return e;for(const r in e)o.hasOwnProperty(r)||(o[r]=e[r]);return o}function Tu(e){return typeof e=="string"?e.split(","):Array.isArray(e)?e:null}const Nne=e=>t=>(n,o)=>n===void 0||e(o)?t(n,o):n,CB=e=>(...t)=>async({resolveSelect:n})=>{await n[e](...t)},N$=e=>t=>(n={},o)=>{const r=o[e];if(r===void 0)return n;const s=t(n[r],o);return s===n[r]?n:{...n,[r]:s}},Lne=e=>t=>(n,o)=>t(n,e(o));function ASe(e){const t=new WeakMap;return n=>{let o;return t.has(n)?o=t.get(n):(o=e(n),n!==null&&typeof n=="object"&&t.set(n,o)),o}}function ySe(e,t){return(e.rawAttributes||[]).includes(t)}function Tx(e,t,n){if(!e||typeof e!="object")return e;const o=Array.isArray(t)?t:t.split(".");return o.reduce((r,s,i)=>(r[s]===void 0&&(Number.isInteger(o[i+1])?r[s]=[]:r[s]={}),i===o.length-1&&(r[s]=n),r[s]),e),e}function vSe(e,t,n){if(!e||typeof e!="object"||typeof t!="string"&&!Array.isArray(t))return e;const o=Array.isArray(t)?t:t.split(".");let r=e;return o.forEach(s=>{r=r?.[s]}),r!==void 0?r:n}function xSe(e){return/^\s*\d+\s*$/.test(e)}const WM=["create","read","update","delete"];function RB(e){const t={};if(!e)return t;const n={create:"POST",read:"GET",update:"PUT",delete:"DELETE"};for(const[o,r]of Object.entries(n))t[o]=e.includes(r);return t}function Ex(e,t,n){return(typeof t=="object"?[e,t.kind,t.name,t.id]:[e,t,n]).filter(Boolean).join("/")}function jne(e,t,n){return{type:"RECEIVE_ITEMS",items:Array.isArray(e)?e:[e],persistedEdits:t,meta:n}}function _Se(e,t,n,o=!1){return{type:"REMOVE_ITEMS",itemIds:Array.isArray(n)?n:[n],kind:e,name:t,invalidateCache:o}}function wSe(e,t={},n,o){return{...jne(e,n,o),query:t}}function kSe(e){const t={stableKey:"",page:1,perPage:10,fields:null,include:null,context:"default"},n=Object.keys(e).sort();for(let s=0;s{x=x?.[v]}),Tx(g,y,x)}}else{if(!e.itemIsComplete[c]?.[b])return null;g=h}p.push(g)}return p}const Pne=at((e,t={})=>{let n=L$.get(e);if(n){const r=n.get(t);if(r!==void 0)return r}else n=new ia,L$.set(e,n);const o=qSe(e,t);return n.set(t,o),o});function Ine(e,t={}){var n;const{stableKey:o,context:r}=uh(t);return(n=e.queries?.[r]?.[o]?.meta?.totalItems)!==null&&n!==void 0?n:null}function SSe(e,t={}){var n;const{stableKey:o,context:r}=uh(t);return(n=e.queries?.[r]?.[o]?.meta?.totalPages)!==null&&n!==void 0?n:null}function CSe(e={},t){switch(t.type){case"ADD_FORMAT_TYPES":return{...e,...t.formatTypes.reduce((n,o)=>({...n,[o.name]:o}),{})};case"REMOVE_FORMAT_TYPES":return Object.fromEntries(Object.entries(e).filter(([n])=>!t.names.includes(n)))}return e}const RSe=zo({formatTypes:CSe}),WB=at(e=>Object.values(e.formatTypes),e=>[e.formatTypes]);function WSe(e,t){return e.formatTypes[t]}function TSe(e,t){const n=WB(e);return n.find(({className:o,tagName:r})=>o===null&&t===r)||n.find(({className:o,tagName:r})=>o===null&&r==="*")}function ESe(e,t){return WB(e).find(({className:n})=>n===null?!1:` ${t} `.indexOf(` ${n} `)>=0)}const BSe=Object.freeze(Object.defineProperty({__proto__:null,getFormatType:WSe,getFormatTypeForBareElement:TSe,getFormatTypeForClassName:ESe,getFormatTypes:WB},Symbol.toStringTag,{value:"Module"}));function NSe(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Array.isArray(e)?e:[e]}}function LSe(e){return{type:"REMOVE_FORMAT_TYPES",names:Array.isArray(e)?e:[e]}}const jSe=Object.freeze(Object.defineProperty({__proto__:null,addFormatTypes:NSe,removeFormatTypes:LSe},Symbol.toStringTag,{value:"Module"})),PSe="core/rich-text",xc=er(PSe,{reducer:RSe,selectors:BSe,actions:jSe});Qs(xc);function cv(e,t){if(e===t)return!0;if(!e||!t||e.type!==t.type)return!1;const n=e.attributes,o=t.attributes;if(n===o)return!0;if(!n||!o)return!1;const r=Object.keys(n),s=Object.keys(o);if(r.length!==s.length)return!1;const i=r.length;for(let c=0;c{const r=t[o-1];if(r){const s=n.slice();s.forEach((i,c)=>{const l=r[c];cv(i,l)&&(s[c]=l)}),t[o]=s}}),{...e,formats:t}}function j$(e,t,n){return e=e.slice(),e[t]=n,e}function _i(e,t,n=e.start,o=e.end){const{formats:r,activeFormats:s}=e,i=r.slice();if(n===o){const c=i[n]?.find(({type:l})=>l===t.type);if(c){const l=i[n].indexOf(c);for(;i[n]&&i[n][l]===c;)i[n]=j$(i[n],l,t),n--;for(o++;i[o]&&i[o][l]===c;)i[o]=j$(i[o],l,t),o++}}else{let c=1/0;for(let l=n;ld!==t.type);const u=i[l].length;uc!==t.type)||[],t]})}function _c({implementation:e},t){return _c.body||(_c.body=e.createHTMLDocument("").body),_c.body.innerHTML=t,_c.body}const Ou="",Dne="\uFEFF";function TB(e,t=[]){const{formats:n,start:o,end:r,activeFormats:s}=e;if(o===void 0)return t;if(o===r){if(s)return s;const u=n[o-1]||t,d=n[o]||t;return u.lengthcv(p,f))||c.splice(d,1)}if(c.length===0)return t}return c||t}function Fne(e){return V0(xc).getFormatType(e)}function P$(e,t){if(t)return e;const n={};for(const o in e){let r=o;o.startsWith("data-disable-rich-text-")&&(r=o.slice(23)),n[r]=e[o]}return n}function ZO({type:e,tagName:t,attributes:n,unregisteredAttributes:o,object:r,boundaryClass:s,isEditableTree:i}){const c=Fne(e);let l={};if(s&&i&&(l["data-rich-text-format-boundary"]="true"),!c)return n&&(l={...n,...l}),{type:e,attributes:P$(l,i),object:r};l={...o,...l};for(const u in n){const d=c.attributes?c.attributes[u]:!1;d?l[d]=n[u]:l[u]=n[u]}return c.className&&(l.class?l.class=`${c.className} ${l.class}`:l.class=c.className),i&&c.contentEditable===!1&&(l.contenteditable="false"),{type:t||c.tagName,object:c.object,attributes:P$(l,i)}}function ISe(e,t,n){do if(e[n]!==t[n])return!1;while(n--);return!0}function $ne({value:e,preserveWhiteSpace:t,createEmpty:n,append:o,getLastChild:r,getParent:s,isText:i,getText:c,remove:l,appendText:u,onStartIndex:d,onEndIndex:p,isEditableTree:f,placeholder:b}){const{formats:h,replacements:g,text:z,start:y,end:x}=e,v=h.length+1,M=n(),A=TB(e),_=A[A.length-1];let w,k;o(M,"");for(let q=0;q{if(W&&w&&ISe(T,w,N)){W=r(W);return}const{type:E,tagName:L,attributes:I,unregisteredAttributes:P}=B,H=f&&B===_,U=s(W),X=o(U,ZO({type:E,tagName:L,attributes:I,unregisteredAttributes:P,boundaryClass:H,isEditableTree:f}));i(W)&&c(W).length===0&&l(W),W=o(X,"")}),q===0&&(d&&y===0&&d(M,W),p&&x===0&&p(M,W)),S===Ou){const B=g[q];if(!B)continue;const{type:N,attributes:E,innerHTML:L}=B,I=Fne(N);!f&&N==="script"?(W=o(s(W),ZO({type:"script",isEditableTree:f})),o(W,{html:decodeURIComponent(E["data-rich-text-script"])})):I?.contentEditable===!1?(W=o(s(W),ZO({...B,isEditableTree:f,boundaryClass:y===q&&x===q+1})),L&&o(W,{html:L})):W=o(s(W),ZO({...B,object:!0,isEditableTree:f})),W=o(s(W),"")}else!t&&S===`
`?(W=o(s(W),{type:"br",attributes:f?{"data-rich-text-line-break":"true"}:void 0,object:!0}),W=o(s(W),"")):i(W)?u(W,S):W=o(s(W),S);d&&y===q+1&&d(M,W),p&&x===q+1&&p(M,W),C&&q===z.length&&(o(s(W),Dne),b&&z.length===0&&o(s(W),{type:"span",attributes:{"data-rich-text-placeholder":b,style:"pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;"}})),w=T,k=S}return M}function K1({value:e,preserveWhiteSpace:t}){const n=$ne({value:e,preserveWhiteSpace:t,createEmpty:DSe,append:$Se,getLastChild:FSe,getParent:HSe,isText:USe,getText:XSe,remove:GSe,appendText:VSe});return Vne(n.children)}function DSe(){return{}}function FSe({children:e}){return e&&e[e.length-1]}function $Se(e,t){return typeof t=="string"&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function VSe(e,t){e.text+=t}function HSe({parent:e}){return e}function USe({text:e}){return typeof e=="string"}function XSe({text:e}){return e}function GSe(e){const t=e.parent.children.indexOf(e);return t!==-1&&e.parent.children.splice(t,1),e}function KSe({type:e,attributes:t,object:n,children:o}){let r="";for(const s in t)w0e(s)&&(r+=` ${s}="${gx(t[s])}"`);return n?`<${e}${r}>`:`<${e}${r}>${Vne(o)}${e}>`}function Vne(e=[]){return e.map(t=>t.html!==void 0?t.html:t.text===void 0?KSe(t):lwe(t.text)).join("")}function cp({text:e}){return e.replace(Ou,"")}function Hd(){return{formats:[],replacements:[],text:""}}function YSe({tagName:e,attributes:t}){let n;if(t&&t.class&&(n=V0(xc).getFormatTypeForClassName(t.class),n&&(t.class=` ${t.class} `.replace(` ${n.className} `," ").trim(),t.class||delete t.class)),n||(n=V0(xc).getFormatTypeForBareElement(e)),!n)return t?{type:e,attributes:t}:{type:e};if(n.__experimentalCreatePrepareEditableTree&&!n.__experimentalCreateOnChangeEditableValue)return null;if(!t)return{formatType:n,type:n.name,tagName:e};const o={},r={},s={...t};for(const i in n.attributes){const c=n.attributes[i];o[i]=s[c],delete s[c],typeof o[i]>"u"&&delete o[i]}for(const i in s)r[i]=t[i];return n.contentEditable===!1&&delete r.contenteditable,{formatType:n,type:n.name,tagName:e,attributes:o,unregisteredAttributes:r}}class un{#e;static empty(){return new un}static fromPlainText(t){return new un(m0({text:t}))}static fromHTMLString(t){return new un(m0({html:t}))}static fromHTMLElement(t,n={}){const{preserveWhiteSpace:o=!1}=n,r=o?t:Hne(t),s=new un(m0({element:r}));return Object.defineProperty(s,"originalHTML",{value:t.innerHTML}),s}constructor(t=Hd()){this.#e=t}toPlainText(){return cp(this.#e)}toHTMLString({preserveWhiteSpace:t}={}){return this.originalHTML||K1({value:this.#e,preserveWhiteSpace:t})}valueOf(){return this.toHTMLString()}toString(){return this.toHTMLString()}toJSON(){return this.toHTMLString()}get length(){return this.text.length}get formats(){return this.#e.formats}get replacements(){return this.#e.replacements}get text(){return this.#e.text}}for(const e of Object.getOwnPropertyNames(String.prototype))un.prototype.hasOwnProperty(e)||Object.defineProperty(un.prototype,e,{value(...t){return this.toHTMLString()[e](...t)}});function m0({element:e,text:t,html:n,range:o,__unstableIsEditableTree:r}={}){return n instanceof un?{text:n.text,formats:n.formats,replacements:n.replacements}:typeof t=="string"&&t.length>0?{formats:Array(t.length),replacements:Array(t.length),text:t}:(typeof n=="string"&&n.length>0&&(e=_c(document,n)),typeof e!="object"?Hd():Une({element:e,range:o,isEditableTree:r}))}function qd(e,t,n,o){if(!n)return;const{parentNode:r}=t,{startContainer:s,startOffset:i,endContainer:c,endOffset:l}=n,u=e.text.length;o.start!==void 0?e.start=u+o.start:t===s&&t.nodeType===t.TEXT_NODE?e.start=u+i:r===s&&t===s.childNodes[i]?e.start=u:r===s&&t===s.childNodes[i-1]?e.start=u+o.text.length:t===s&&(e.start=u),o.end!==void 0?e.end=u+o.end:t===c&&t.nodeType===t.TEXT_NODE?e.end=u+l:r===c&&t===c.childNodes[l-1]?e.end=u+o.text.length:r===c&&t===c.childNodes[l]?e.end=u:t===c&&(e.end=u+l)}function ZSe(e,t,n){if(!t)return;const{startContainer:o,endContainer:r}=t;let{startOffset:s,endOffset:i}=t;return e===o&&(s=n(e.nodeValue.slice(0,s)).length),e===r&&(i=n(e.nodeValue.slice(0,i)).length),{startContainer:o,startOffset:s,endContainer:r,endOffset:i}}function Hne(e,t=!0){const n=e.cloneNode(!0);return n.normalize(),Array.from(n.childNodes).forEach((o,r,s)=>{if(o.nodeType===o.TEXT_NODE){let i=o.nodeValue;/[\n\t\r\f]/.test(i)&&(i=i.replace(/[\n\t\r\f]+/g," ")),i.indexOf(" ")!==-1&&(i=i.replace(/ {2,}/g," ")),r===0&&i.startsWith(" ")?i=i.slice(1):t&&r===s.length-1&&i.endsWith(" ")&&(i=i.slice(0,-1)),o.nodeValue=i}else o.nodeType===o.ELEMENT_NODE&&Hne(o,!1)}),n}const QSe="\r";function I$(e){return e.replace(new RegExp(`[${Dne}${Ou}${QSe}]`,"gu"),"")}function Une({element:e,range:t,isEditableTree:n}){const o=Hd();if(!e)return o;if(!e.hasChildNodes())return qd(o,e,t,Hd()),o;const r=e.childNodes.length;for(let i=0;in===t)}function tCe({start:e,end:t,replacements:n,text:o}){if(!(e+1!==t||o[e]!==Ou))return n[e]}function lf({start:e,end:t}){if(!(e===void 0||t===void 0))return e===t}function r8({text:e}){return e.length===0}function nCe(e,t=""){return typeof t=="string"&&(t=m0({text:t})),dh(e.reduce((n,{formats:o,replacements:r,text:s})=>({formats:n.formats.concat(t.formats,o),replacements:n.replacements.concat(t.replacements,r),text:n.text+t.text+s})))}function Xne(e,t){if(t={name:e,...t},typeof t.name!="string"){window.console.error("Format names must be strings.");return}if(!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name)){window.console.error("Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format");return}if(V0(xc).getFormatType(t.name)){window.console.error('Format "'+t.name+'" is already registered.');return}if(typeof t.tagName!="string"||t.tagName===""){window.console.error("Format tag names must be a string.");return}if((typeof t.className!="string"||t.className==="")&&t.className!==null){window.console.error("Format class names must be a string, or null to handle bare elements.");return}if(!/^[_a-zA-Z]+[a-zA-Z0-9_-]*$/.test(t.className)){window.console.error("A class name must begin with a letter, followed by any number of hyphens, underscores, letters, or numbers.");return}if(t.className===null){const n=V0(xc).getFormatTypeForBareElement(t.tagName);if(n&&n.name!=="core/unknown"){window.console.error(`Format "${n.name}" is already registered to handle bare tag name "${t.tagName}".`);return}}else{const n=V0(xc).getFormatTypeForClassName(t.className);if(n){window.console.error(`Format "${n.name}" is already registered to handle class name "${t.className}".`);return}}if(!("title"in t)||t.title===""){window.console.error('The format "'+t.name+'" must have a title.');return}if("keywords"in t&&t.keywords.length>3){window.console.error('The format "'+t.name+'" can have a maximum of 3 keywords.');return}if(typeof t.title!="string"){window.console.error("Format titles must be strings.");return}return tr(xc).addFormatTypes(t),t}function ud(e,t,n=e.start,o=e.end){const{formats:r,activeFormats:s}=e,i=r.slice();if(n===o){const c=i[n]?.find(({type:l})=>l===t);if(c){for(;i[n]?.find(l=>l===c);)I6(i,n,t),n--;for(o++;i[o]?.find(l=>l===c);)I6(i,o,t),o++}}else for(let c=n;cc!==t)||[]})}function I6(e,t,n){const o=e[t].filter(({type:r})=>r!==n);o.length?e[t]=o:delete e[t]}function Y1(e,t,n=e.start,o=e.end){const{formats:r,replacements:s,text:i}=e;typeof t=="string"&&(t=m0({text:t}));const c=n+t.text.length;return dh({formats:r.slice(0,n).concat(t.formats,r.slice(o)),replacements:s.slice(0,n).concat(t.replacements,s.slice(o)),text:i.slice(0,n)+t.text+i.slice(o),start:c,end:c})}function Ks(e,t,n){return Y1(e,m0(),t,n)}function oCe({formats:e,replacements:t,text:n,start:o,end:r},s,i){return n=n.replace(s,(c,...l)=>{const u=l[l.length-2];let d=i,p,f;return typeof d=="function"&&(d=i(c,...l)),typeof d=="object"?(p=d.formats,f=d.replacements,d=d.text):(p=Array(d.length),f=Array(d.length),e[u]&&(p=p.fill(e[u]))),e=e.slice(0,u).concat(p,e.slice(u+c.length)),t=t.slice(0,u).concat(f,t.slice(u+c.length)),o&&(o=r=u+d.length),d}),dh({formats:e,replacements:t,text:n,start:o,end:r})}function Gne(e,t,n,o){return Y1(e,{formats:[,],replacements:[t],text:Ou},n,o)}function O2(e,t=e.start,n=e.end){const{formats:o,replacements:r,text:s}=e;return t===void 0||n===void 0?{...e}:{formats:o.slice(t,n),replacements:r.slice(t,n),text:s.slice(t,n)}}function BB({formats:e,replacements:t,text:n,start:o,end:r},s){if(typeof s!="string")return rCe(...arguments);let i=0;return n.split(s).map(c=>{const l=i,u={formats:e.slice(l,l+c.length),replacements:t.slice(l,l+c.length),text:c};return i+=s.length+c.length,o!==void 0&&r!==void 0&&(o>=l&&ol&&(u.start=0),r>=l&&ri&&(u.end=c.length)),u})}function rCe({formats:e,replacements:t,text:n,start:o,end:r},s=o,i=r){if(o===void 0||r===void 0)return;const c={formats:e.slice(0,s),replacements:t.slice(0,s),text:n.slice(0,s)},l={formats:e.slice(i),replacements:t.slice(i),text:n.slice(i),start:0,end:0};return[c,l]}function Kne(e,t){return e===t||e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function s8(e,t,n){const o=e.parentNode;let r=0;for(;e=e.previousSibling;)r++;return n=[r,...n],o!==t&&(n=s8(o,t,n)),n}function D$(e,t){for(t=[...t];e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}function sCe(e,t){if(t.html!==void 0)return e.innerHTML+=t.html;typeof t=="string"&&(t=e.ownerDocument.createTextNode(t));const{type:n,attributes:o}=t;if(n){t=e.ownerDocument.createElement(n);for(const r in o)t.setAttribute(r,o[r])}return e.appendChild(t)}function iCe(e,t){e.appendData(t)}function aCe({lastChild:e}){return e}function cCe({parentNode:e}){return e}function lCe(e){return e.nodeType===e.TEXT_NODE}function uCe({nodeValue:e}){return e}function dCe(e){return e.parentNode.removeChild(e)}function pCe({value:e,prepareEditableTree:t,isEditableTree:n=!0,placeholder:o,doc:r=document}){let s=[],i=[];return t&&(e={...e,formats:t(e)}),{body:$ne({value:e,createEmpty:()=>_c(r,""),append:sCe,getLastChild:aCe,getParent:cCe,isText:lCe,getText:uCe,remove:dCe,appendText:iCe,onStartIndex(u,d){s=s8(d,u,[d.nodeValue.length])},onEndIndex(u,d){i=s8(d,u,[d.nodeValue.length])},isEditableTree:n,placeholder:o}),selection:{startPath:s,endPath:i}}}function fCe({value:e,current:t,prepareEditableTree:n,__unstableDomOnly:o,placeholder:r}){const{body:s,selection:i}=pCe({value:e,prepareEditableTree:n,placeholder:r,doc:t.ownerDocument});Yne(s,t),e.start!==void 0&&!o&&bCe(i,t)}function Yne(e,t){let n=0,o;for(;o=e.firstChild;){const r=t.childNodes[n];if(!r)t.appendChild(o);else if(r.isEqualNode(o))e.removeChild(o);else if(r.nodeName!==o.nodeName||r.nodeType===r.TEXT_NODE&&r.data!==o.data)t.replaceChild(o,r);else{const s=r.attributes,i=o.attributes;if(s){let c=s.length;for(;c--;){const{name:l}=s[c];o.getAttribute(l)||r.removeAttribute(l)}}if(i)for(let c=0;c0){if(Kne(d,u.getRangeAt(0)))return;u.removeAllRanges()}u.addRange(d),p!==c.activeElement&&p instanceof l.HTMLElement&&p.focus()}function hCe(e){if(!(typeof document>"u")){if(document.readyState==="complete"||document.readyState==="interactive")return void e();document.addEventListener("DOMContentLoaded",e)}}function mCe(){const e=document.createElement("p");e.id="a11y-speak-intro-text",e.className="a11y-speak-intro-text",e.textContent=m("Notifications"),e.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),e.setAttribute("hidden","hidden");const{body:t}=document;return t&&t.appendChild(e),e}function F$(e="polite"){const t=document.createElement("div");t.id=`a11y-speak-${e}`,t.className="a11y-speak-region",t.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions text"),t.setAttribute("aria-atomic","true");const{body:n}=document;return n&&n.appendChild(t),t}function MCe(){const e=document.getElementsByClassName("a11y-speak-region"),t=document.getElementById("a11y-speak-intro-text");for(let n=0;n]+>/g," "),$$===e&&(e+=" "),$$=e,e}function zCe(){const e=document.getElementById("a11y-speak-intro-text"),t=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");e===null&&mCe(),t===null&&F$("assertive"),n===null&&F$("polite")}hCe(zCe);function At(e,t){MCe(),e=gCe(e);const n=document.getElementById("a11y-speak-intro-text"),o=document.getElementById("a11y-speak-assertive"),r=document.getElementById("a11y-speak-polite");o&&t==="assertive"?o.textContent=e:r&&(r.textContent=e),n&&n.removeAttribute("hidden")}function Ba(e,t){return EB(e,t.type)?(t.title&&At(le(m("%s removed."),t.title),"assertive"),ud(e,t.type)):(t.title&&At(le(m("%s applied."),t.title),"assertive"),_i(e,t))}function OCe(e,t,n,o){let r=e.startContainer;if(r.nodeType===r.TEXT_NODE&&e.startOffset===r.length&&r.nextSibling)for(r=r.nextSibling;r.firstChild;)r=r.firstChild;if(r.nodeType!==r.ELEMENT_NODE&&(r=r.parentElement),!r||r===t||!t.contains(r))return;const s=n+(o?"."+o:"");for(;r!==t;){if(r.matches(s))return r;r=r.parentElement}}function ACe(e,t){return{contextElement:t,getBoundingClientRect(){return t.contains(e.startContainer)?e.getBoundingClientRect():t.getBoundingClientRect()}}}function D6(e,t,n){if(!e)return;const{ownerDocument:o}=e,{defaultView:r}=o,s=r.getSelection();if(!s||!s.rangeCount)return;const i=s.getRangeAt(0);if(!i||!i.startContainer)return;const c=OCe(i,e,t,n);return c||ACe(i,e)}function Vz({editableContentElement:e,settings:t={}}){const{tagName:n,className:o,isActive:r}=t,[s,i]=O.useState(()=>D6(e,n,o)),c=t1(r);return O.useLayoutEffect(()=>{if(!e)return;function l(){i(D6(e,n,o))}function u(){p.addEventListener("selectionchange",l)}function d(){p.removeEventListener("selectionchange",l)}const{ownerDocument:p}=e;return(e===p.activeElement||!c&&r||c&&!r)&&(i(D6(e,n,o)),u()),e.addEventListener("focusin",u),e.addEventListener("focusout",d),()=>{d(),e.removeEventListener("focusin",u),e.removeEventListener("focusout",d)}},[e,n,o,r,c]),s}const yCe="pre-wrap",vCe="1px";function xCe(){return O.useCallback(e=>{e&&(e.style.whiteSpace=yCe,e.style.minWidth=vCe)},[])}function _Ce({record:e}){const t=O.useRef(),{activeFormats:n=[],replacements:o,start:r}=e.current,s=o[r];return O.useEffect(()=>{if((!n||!n.length)&&!s)return;const i="*[data-rich-text-format-boundary]",c=t.current.querySelector(i);if(!c)return;const{ownerDocument:l}=c,{defaultView:u}=l,p=u.getComputedStyle(c).color.replace(")",", 0.2)").replace("rgb","rgba"),f=`.rich-text:focus ${i}`,b=`background-color: ${p}`,h=`${f} {${b}}`,g="rich-text-boundary-style";let z=l.getElementById(g);z||(z=l.createElement("style"),z.id=g,l.head.appendChild(z)),z.innerHTML!==h&&(z.innerHTML=h)},[n,s]),t}const wCe=e=>t=>{function n(r){const{record:s,createRecord:i,handleChange:c}=e.current,{ownerDocument:l}=t,{defaultView:u}=l,{anchorNode:d,focusNode:p,isCollapsed:f}=u.getSelection(),b=t.contains(d)&&t.contains(p);if(f||!b)return;const h=O2(s.current),g=cp(h),z=K1({value:h});r.clipboardData.setData("text/plain",g),r.clipboardData.setData("text/html",z),r.clipboardData.setData("rich-text","true"),r.preventDefault(),r.type==="cut"&&c(Ks(i()))}const{defaultView:o}=t.ownerDocument;return o.addEventListener("copy",n),o.addEventListener("cut",n),()=>{o.removeEventListener("copy",n),o.removeEventListener("cut",n)}},kCe=()=>e=>{function t(o){const{target:r}=o;if(r===e||r.textContent&&r.isContentEditable)return;const{ownerDocument:s}=r,{defaultView:i}=s,c=i.getSelection();if(c.containsNode(r))return;const l=s.createRange(),u=r.isContentEditable?r:r.closest("[contenteditable]");l.selectNode(u),c.removeAllRanges(),c.addRange(l),o.preventDefault()}function n(o){o.relatedTarget&&!e.contains(o.relatedTarget)&&o.relatedTarget.tagName==="A"&&t(o)}return e.addEventListener("click",t),e.addEventListener("focusin",n),()=>{e.removeEventListener("click",t),e.removeEventListener("focusin",n)}},V$=[],qCe=e=>t=>{function n(o){const{keyCode:r,shiftKey:s,altKey:i,metaKey:c,ctrlKey:l}=o;if(s||i||c||l||r!==Bs&&r!==Ns)return;const{record:u,applyRecord:d,forceRender:p}=e.current,{text:f,formats:b,start:h,end:g,activeFormats:z=[]}=u.current,y=lf(u.current),{ownerDocument:x}=t,{defaultView:v}=x,{direction:M}=v.getComputedStyle(t),A=M==="rtl"?Ns:Bs,_=o.keyCode===A;if(y&&z.length===0&&(h===0&&_||g===f.length&&!_)||!y)return;const w=b[h-1]||V$,k=b[h]||V$,q=_?w:k,S=z.every((E,L)=>E===q[L]);let C=z.length;if(S?C{t.removeEventListener("keydown",n)}},SCe=e=>t=>{function n(o){const{keyCode:r}=o,{createRecord:s,handleChange:i}=e.current;if(o.defaultPrevented||r!==_a&&r!==Si)return;const c=s(),{start:l,end:u,text:d}=c;l===0&&u!==0&&u===d.length&&(i(Ks(c)),o.preventDefault())}return t.addEventListener("keydown",n),()=>{t.removeEventListener("keydown",n)}};function CCe({value:e,start:t,end:n,formats:o}){const r=Math.min(t,n),s=Math.max(t,n),i=e.formats[r-1]||[],c=e.formats[s]||[];for(e.activeFormats=o.map((l,u)=>{if(i[u]){if(cv(l,i[u]))return i[u]}else if(c[u]&&cv(l,c[u]))return c[u];return l});--n>=t;)e.activeFormats.length>0?e.formats[n]=e.activeFormats:delete e.formats[n];return e}const RCe=new Set(["insertParagraph","insertOrderedList","insertUnorderedList","insertHorizontalRule","insertLink"]),H$=[],Zne="data-rich-text-placeholder";function WCe(e){const t=e.getSelection(),{anchorNode:n,anchorOffset:o}=t;if(n.nodeType!==n.ELEMENT_NODE)return;const r=n.childNodes[o];!r||r.nodeType!==r.ELEMENT_NODE||!r.hasAttribute(Zne)||t.collapseToStart()}const TCe=e=>t=>{const{ownerDocument:n}=t,{defaultView:o}=n;let r=!1;function s(d){if(r)return;let p;d&&(p=d.inputType);const{record:f,applyRecord:b,createRecord:h,handleChange:g}=e.current;if(p&&(p.indexOf("format")===0||RCe.has(p))){b(f.current);return}const z=h(),{start:y,activeFormats:x=[]}=f.current,v=CCe({value:z,start:y,end:z.start,formats:x});g(v)}function i(){const{record:d,applyRecord:p,createRecord:f,onSelectionChange:b}=e.current;if(t.contentEditable!=="true")return;const{anchorNode:h,focusNode:g}=o.getSelection();if(!(t.contains(h)&&t.contains(g)&&n.activeElement.contains(t))||r)return;const{start:y,end:x,text:v}=f(),M=d.current;if(v!==M.text){s();return}if(y===M.start&&x===M.end){M.text.length===0&&y===0&&WCe(o);return}const A={...M,start:y,end:x,activeFormats:M._newActiveFormats,_newActiveFormats:void 0},_=TB(A,H$);A.activeFormats=_,d.current=A,p(A,{domOnly:!0}),b(y,x)}function c(){r=!0,n.removeEventListener("selectionchange",i),t.querySelector(`[${Zne}]`)?.remove()}function l(){r=!1,s({inputType:"insertText"}),n.addEventListener("selectionchange",i)}function u(){const{record:d,isSelected:p,onSelectionChange:f,applyRecord:b}=e.current;t.parentElement.closest('[contenteditable="true"]')||(p?b(d.current,{domOnly:!0}):d.current={...d.current,start:void 0,end:void 0,activeFormats:H$},f(d.current.start,d.current.end),window.queueMicrotask(i),n.addEventListener("selectionchange",i))}return t.addEventListener("input",s),t.addEventListener("compositionstart",c),t.addEventListener("compositionend",l),t.addEventListener("focus",u),()=>{t.removeEventListener("input",s),t.removeEventListener("compositionstart",c),t.removeEventListener("compositionend",l),t.removeEventListener("focus",u),n.removeEventListener("selectionchange",i)}},ECe=()=>e=>{const{ownerDocument:t}=e,{defaultView:n}=t,o=n?.getSelection();let r;function s(){return o.rangeCount?o.getRangeAt(0):null}function i(c){const l=c.type==="keydown"?"keyup":"pointerup";function u(){t.removeEventListener(l,d),t.removeEventListener("selectionchange",u),t.removeEventListener("input",u)}function d(){u(),!Kne(r,s())&&t.dispatchEvent(new Event("selectionchange"))}t.addEventListener(l,d),t.addEventListener("selectionchange",u),t.addEventListener("input",u),r=s()}return e.addEventListener("pointerdown",i),e.addEventListener("keydown",i),()=>{e.removeEventListener("pointerdown",i),e.removeEventListener("keydown",i)}},BCe=[wCe,kCe,qCe,SCe,TCe,ECe];function NCe(e){const t=O.useRef(e);t.current=e;const n=O.useMemo(()=>BCe.map(o=>o(t)),[t]);return Et(o=>{const r=n.map(s=>s(o));return()=>{r.forEach(s=>s())}},[n])}function Qne({value:e="",selectionStart:t,selectionEnd:n,placeholder:o,onSelectionChange:r,preserveWhiteSpace:s,onChange:i,__unstableDisableFormats:c,__unstableIsSelected:l,__unstableDependencies:u=[],__unstableAfterParse:d,__unstableBeforeSerialize:p,__unstableAddInvisibleFormats:f}){const b=h0(),[,h]=O.useReducer(()=>({})),g=O.useRef();function z(){const{ownerDocument:{defaultView:S}}=g.current,C=S.getSelection(),T=C.rangeCount>0?C.getRangeAt(0):null;return m0({element:g.current,range:T,__unstableIsEditableTree:!0})}function y(S,{domOnly:C}={}){fCe({value:S,current:g.current,prepareEditableTree:f,__unstableDomOnly:C,placeholder:o})}const x=O.useRef(e),v=O.useRef();function M(){x.current=e,v.current=e,e instanceof un||(v.current=e?un.fromHTMLString(e,{preserveWhiteSpace:s}):un.empty()),v.current={text:v.current.text,formats:v.current.formats,replacements:v.current.replacements},c&&(v.current.formats=Array(e.length),v.current.replacements=Array(e.length)),d&&(v.current.formats=d(v.current)),v.current.start=t,v.current.end=n}const A=O.useRef(!1);v.current?(t!==v.current.start||n!==v.current.end)&&(A.current=l,v.current={...v.current,start:t,end:n,activeFormats:void 0}):(A.current=l,M());function _(S){if(v.current=S,y(S),c)x.current=S.text;else{const N=p?p(S):S.formats;S={...S,formats:N},typeof e=="string"?x.current=K1({value:S,preserveWhiteSpace:s}):x.current=new un(S)}const{start:C,end:T,formats:W,text:B}=v.current;b.batch(()=>{r(C,T),i(x.current,{__unstableFormats:W,__unstableText:B})}),h()}function w(){M(),y(v.current)}const k=O.useRef(!1);O.useLayoutEffect(()=>{k.current&&e!==x.current&&(w(),h())},[e]),O.useLayoutEffect(()=>{A.current&&(g.current.ownerDocument.activeElement!==g.current&&g.current.focus(),y(v.current),A.current=!1)},[A.current]);const q=Gt([g,xCe(),_Ce({record:v}),NCe({record:v,handleChange:_,applyRecord:y,createRecord:z,isSelected:l,onSelectionChange:r,forceRender:h}),Et(()=>{w(),k.current=!0},[o,...u])]);return{value:v.current,getValue:()=>v.current,onChange:_,ref:q}}let QO;const LCe=new Uint8Array(16);function jCe(){if(!QO&&(QO=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!QO))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return QO(LCe)}const so=[];for(let e=0;e<256;++e)so.push((e+256).toString(16).slice(1));function PCe(e,t=0){return so[e[t+0]]+so[e[t+1]]+so[e[t+2]]+so[e[t+3]]+"-"+so[e[t+4]]+so[e[t+5]]+"-"+so[e[t+6]]+so[e[t+7]]+"-"+so[e[t+8]]+so[e[t+9]]+"-"+so[e[t+10]]+so[e[t+11]]+so[e[t+12]]+so[e[t+13]]+so[e[t+14]]+so[e[t+15]]}const ICe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),U$={randomUUID:ICe};function Xc(e,t,n){if(U$.randomUUID&&!t&&!e)return U$.randomUUID();e=e||{};const o=e.random||(e.rng||jCe)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,PCe(o)}let F6=null;function DCe(e,t){const n=[...e],o=[];for(;n.length;)o.push(n.splice(0,t));return o}async function FCe(e){F6===null&&(F6=(await ct({path:"/batch/v1",method:"OPTIONS"})).endpoints[0].args.requests.maxItems);const t=[];for(const n of DCe(e,F6)){const o=await ct({path:"/batch/v1",method:"POST",data:{validation:"require-all-validate",requests:n.map(s=>({path:s.path,body:s.data,method:s.method,headers:s.headers}))}});let r;o.failed?r=o.responses.map(s=>({error:s?.body})):r=o.responses.map(s=>{const i={};return s.status>=200&&s.status<300?i.output=s.body:i.error=s.body,i}),t.push(...r)}return t}function $Ce(e=FCe){let t=0,n=[];const o=new VCe;return{add(r){const s=++t;o.add(s);const i=c=>new Promise((l,u)=>{n.push({input:c,resolve:l,reject:u}),o.delete(s)});return typeof r=="function"?Promise.resolve(r(i)).finally(()=>{o.delete(s)}):i(r)},async run(){o.size&&await new Promise(i=>{const c=o.subscribe(()=>{o.size||(c(),i(void 0))})});let r;try{if(r=await e(n.map(({input:i})=>i)),r.length!==n.length)throw new Error("run: Array returned by processor must be same size as input array.")}catch(i){for(const{reject:c}of n)c(i);throw i}let s=!0;return r.forEach((i,c)=>{const l=n[c];if(i?.error)l?.reject(i.error),s=!1;else{var u;l?.resolve((u=i?.output)!==null&&u!==void 0?u:i)}}),n=[],s}}}class VCe{constructor(...t){this.set=new Set(...t),this.subscribers=new Set}get size(){return this.set.size}add(t){return this.set.add(t),this.subscribers.forEach(n=>n()),this}delete(t){const n=this.set.delete(t);return this.subscribers.forEach(o=>o()),n}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}}const bo="core",Cr=()=>new Map,i8=e=>{const t=Cr();return e.forEach((n,o)=>{t.set(o,n)}),t},Fo=(e,t,n)=>{let o=e.get(t);return o===void 0&&e.set(t,o=n()),o},HCe=(e,t)=>{const n=[];for(const[o,r]of e)n.push(t(r,o));return n},UCe=(e,t)=>{for(const[n,o]of e)if(t(o,n))return!0;return!1},Eu=()=>new Set,$6=e=>e[e.length-1],XCe=(e,t)=>{for(let n=0;n{this.off(t,o),n(...r)};this.on(t,o)}off(t,n){const o=this._observers.get(t);o!==void 0&&(o.delete(n),o.size===0&&this._observers.delete(t))}emit(t,n){return Gc((this._observers.get(t)||Cr()).values()).forEach(o=>o(...n))}destroy(){this._observers=Cr()}}class Hz{constructor(){this._observers=Cr()}on(t,n){Fo(this._observers,t,Eu).add(n)}once(t,n){const o=(...r)=>{this.off(t,o),n(...r)};this.on(t,o)}off(t,n){const o=this._observers.get(t);o!==void 0&&(o.delete(n),o.size===0&&this._observers.delete(t))}emit(t,n){return Gc((this._observers.get(t)||Cr()).values()).forEach(o=>o(...n))}destroy(){this._observers=Cr()}}const Na=Math.floor,Py=Math.abs,YCe=Math.log10,NB=(e,t)=>ee>t?e:t,Jne=e=>e!==0?e<0:1/e<0,X$=1,G$=2,V6=4,H6=8,vg=32,Wc=64,es=128,Bx=31,a8=63,lp=127,ZCe=2147483647,e1e=Number.MAX_SAFE_INTEGER,QCe=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Na(e)===e),JCe=String.fromCharCode,eRe=e=>e.toLowerCase(),tRe=/^\s*/g,nRe=e=>e.replace(tRe,""),oRe=/([A-Z])/g,K$=(e,t)=>nRe(e.replace(oRe,n=>`${t}${eRe(n)}`)),rRe=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,o=new Uint8Array(n);for(let r=0;rxg.encode(e),c8=xg?sRe:rRe;let TM=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});TM&&TM.decode(new Uint8Array).length===1&&(TM=null);class Uz{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const F1=()=>new Uz,iRe=e=>{let t=e.cpos;for(let n=0;n{const t=new Uint8Array(iRe(e));let n=0;for(let o=0;o{const n=e.cbuf.length;n-e.cpos{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},_g=L1,Wt=(e,t)=>{for(;t>lp;)L1(e,es|lp&t),t=Na(t/128);L1(e,lp&t)},LB=(e,t)=>{const n=Jne(t);for(n&&(t=-t),L1(e,(t>a8?es:0)|(n?Wc:0)|a8&t),t=Na(t/64);t>0;)L1(e,(t>lp?es:0)|lp&t),t=Na(t/128)},l8=new Uint8Array(3e4),cRe=l8.length/3,lRe=(e,t)=>{if(t.length{const n=unescape(encodeURIComponent(t)),o=n.length;Wt(e,o);for(let r=0;r{const n=e.cbuf.length,o=e.cpos,r=NB(n-o,t.length),s=t.length-r;e.cbuf.set(t.subarray(0,r),o),e.cpos+=r,s>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(uf(n*2,s)),e.cbuf.set(t.subarray(r)),e.cpos=s)},Qn=(e,t)=>{Wt(e,t.byteLength),Nx(e,t)},jB=(e,t)=>{aRe(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},dRe=(e,t)=>jB(e,4).setFloat32(0,t,!1),pRe=(e,t)=>jB(e,8).setFloat64(0,t,!1),fRe=(e,t)=>jB(e,8).setBigInt64(0,t,!1),Y$=new DataView(new ArrayBuffer(4)),bRe=e=>(Y$.setFloat32(0,e),Y$.getFloat32(0)===e),A2=(e,t)=>{switch(typeof t){case"string":L1(e,119),wa(e,t);break;case"number":QCe(t)&&Py(t)<=ZCe?(L1(e,125),LB(e,t)):bRe(t)?(L1(e,124),dRe(e,t)):(L1(e,123),pRe(e,t));break;case"bigint":L1(e,122),fRe(e,t);break;case"object":if(t===null)L1(e,126);else if(GCe(t)){L1(e,117),Wt(e,t.length);for(let n=0;n0&&Wt(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const Q$=e=>{e.count>0&&(LB(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Wt(e.encoder,e.count-2))};class Iy{constructor(){this.encoder=new Uz,this.s=0,this.count=0}write(t){this.s===t?this.count++:(Q$(this),this.count=1,this.s=t)}toUint8Array(){return Q$(this),Fn(this.encoder)}}const J$=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);LB(e.encoder,t),e.count>1&&Wt(e.encoder,e.count-2)}};class U6{constructor(){this.encoder=new Uz,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(J$(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return J$(this),Fn(this.encoder)}}class hRe{constructor(){this.sarr=[],this.s="",this.lensE=new Iy}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new Uz;return this.sarr.push(this.s),this.s="",wa(t,this.sarr.join("")),Nx(t,this.lensE.toUint8Array()),Fn(t)}}const Ri=e=>new Error(e),ka=()=>{throw Ri("Method unimplemented")},La=()=>{throw Ri("Unexpected case")},t1e=Ri("Unexpected end of array"),n1e=Ri("Integer out of Range");class Lx{constructor(t){this.arr=t,this.pos=0}}const Ka=e=>new Lx(e),mRe=e=>e.pos!==e.arr.length,MRe=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},P1=e=>MRe(e,Jt(e)),Sp=e=>e.arr[e.pos++],Jt=e=>{let t=0,n=1;const o=e.arr.length;for(;e.pose1e)throw n1e}throw t1e},PB=e=>{let t=e.arr[e.pos++],n=t&a8,o=64;const r=(t&Wc)>0?-1:1;if(!(t&es))return r*n;const s=e.arr.length;for(;e.pose1e)throw n1e}throw t1e},gRe=e=>{let t=Jt(e);if(t===0)return"";{let n=String.fromCodePoint(Sp(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Sp(e));else for(;t>0;){const o=t<1e4?t:1e4,r=e.arr.subarray(e.pos,e.pos+o);e.pos+=o,n+=String.fromCodePoint.apply(null,r),t-=o}return decodeURIComponent(escape(n))}},zRe=e=>TM.decode(P1(e)),Tc=TM?zRe:gRe,IB=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},ORe=e=>IB(e,4).getFloat32(0,!1),ARe=e=>IB(e,8).getFloat64(0,!1),yRe=e=>IB(e,8).getBigInt64(0,!1),vRe=[e=>{},e=>null,PB,ORe,ARe,yRe,e=>!1,e=>!0,Tc,e=>{const t=Jt(e),n={};for(let o=0;o{const t=Jt(e),n=[];for(let o=0;ovRe[127-Sp(e)](e);class eV extends Lx{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),mRe(this)?this.count=Jt(this)+1:this.count=-1),this.count--,this.s}}class Dy extends Lx{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=PB(this);const t=Jne(this.s);this.count=1,t&&(this.s=-this.s,this.count=Jt(this)+2)}return this.count--,this.s}}class X6 extends Lx{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=PB(this),n=t&1;this.diff=Na(t/2),this.count=1,n&&(this.count=Jt(this)+2)}return this.s+=this.diff,this.count--,this.s}}class xRe{constructor(t){this.decoder=new Dy(t),this.str=Tc(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const _Re=crypto.getRandomValues.bind(crypto),wRe=Math.random,o1e=()=>_Re(new Uint32Array(1))[0],kRe="10000000-1000-4000-8000"+-1e11,r1e=()=>kRe.replace(/[018]/g,e=>(e^o1e()&15>>e/4).toString(16)),Kc=Date.now,v2=e=>new Promise(e);Promise.all.bind(Promise);const qRe=e=>Promise.reject(e),DB=e=>Promise.resolve(e),tV=e=>e===void 0?null:e;class SRe{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let s1e=new SRe,FB=!0;try{typeof localStorage<"u"&&localStorage&&(s1e=localStorage,FB=!1)}catch{}const i1e=s1e,CRe=e=>FB||addEventListener("storage",e),RRe=e=>FB||removeEventListener("storage",e),WRe=Object.assign,a1e=Object.keys,TRe=(e,t)=>{for(const n in e)t(e[n],n)},nV=e=>a1e(e).length,oV=e=>a1e(e).length,ERe=e=>{for(const t in e)return!1;return!0},BRe=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},c1e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),NRe=(e,t)=>e===t||oV(e)===oV(t)&&BRe(e,(n,o)=>(n!==void 0||c1e(t,o))&&t[o]===n),$B=(e,t,n=0)=>{try{for(;n{},jRe=e=>e,PRe=(e,t)=>e===t,EM=(e,t)=>{if(e==null||t==null)return PRe(e,t);if(e.constructor!==t.constructor)return!1;if(e===t)return!0;switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:{if(e.byteLength!==t.byteLength)return!1;for(let n=0;nt.includes(e);var l1e={};const x2=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",u1e=typeof window<"u"&&typeof document<"u"&&!x2;let Qi;const DRe=()=>{if(Qi===void 0)if(x2){Qi=Cr();const e=process.argv;let t=null;for(let n=0;n{if(e.length!==0){const[t,n]=e.split("=");Qi.set(`--${K$(t,"-")}`,n),Qi.set(`-${K$(t,"-")}`,n)}})):Qi=Cr();return Qi},u8=e=>DRe().has(e),lv=e=>tV(x2?l1e[e.toUpperCase().replaceAll("-","_")]:i1e.getItem(e)),d1e=e=>u8("--"+e)||lv(e)!==null;d1e("production");const FRe=x2&&IRe(l1e.FORCE_COLOR,["true","1","2"]),$Re=FRe||!u8("--no-colors")&&!d1e("no-color")&&(!x2||process.stdout.isTTY)&&(!x2||u8("--color")||lv("COLORTERM")!==null||(lv("TERM")||"").includes("color")),p1e=e=>new Uint8Array(e),VRe=(e,t,n)=>new Uint8Array(e,t,n),HRe=e=>new Uint8Array(e),URe=e=>{let t="";for(let n=0;nBuffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),GRe=e=>{const t=atob(e),n=p1e(t.length);for(let o=0;o{const t=Buffer.from(e,"base64");return VRe(t.buffer,t.byteOffset,t.byteLength)},f1e=u1e?URe:XRe,VB=u1e?GRe:KRe,YRe=e=>{const t=p1e(e.byteLength);return t.set(e),t};class ZRe{constructor(t,n){this.left=t,this.right=n}}const ac=(e,t)=>new ZRe(e,t);typeof DOMParser<"u"&&new DOMParser;const QRe=e=>HCe(e,(t,n)=>`${n}:${t};`).join(""),JRe=JSON.stringify,fl=Symbol,Ls=fl(),Cp=fl(),b1e=fl(),HB=fl(),h1e=fl(),m1e=fl(),M1e=fl(),UB=fl(),jx=fl(),e8e=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let o=0;for(;o0&&n.push(t.join(""));o{const n=rV[G6],o=lv("log"),r=o!==null&&(o==="*"||o==="true"||new RegExp(o,"gi").test(t));return G6=(G6+1)%rV.length,t+=": ",r?(...s)=>{s.length===1&&s[0]?.constructor===Function&&(s=s[0]());const i=Kc(),c=i-sV;sV=i,e(n,t,jx,...s.map(l=>{switch(l!=null&&l.constructor===Uint8Array&&(l=Array.from(l)),typeof l){case"string":case"symbol":return l;default:return JRe(l)}}),n," +"+c+"ms")}:LRe},n8e={[Ls]:ac("font-weight","bold"),[Cp]:ac("font-weight","normal"),[b1e]:ac("color","blue"),[h1e]:ac("color","green"),[HB]:ac("color","grey"),[m1e]:ac("color","red"),[M1e]:ac("color","purple"),[UB]:ac("color","orange"),[jx]:ac("color","black")},o8e=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],o=Cr();let r=[],s=0;for(;s0||l.length>0?(t.push("%c"+i),n.push(l)):t.push(i)}else break}}for(s>0&&(r=n,r.unshift(t.join("")));s{console.log(...r8e(e)),s8e.forEach(t=>t.print(e))},s8e=Eu(),i8e=e=>t8e(g1e,e),z1e=e=>({[Symbol.iterator](){return this},next:e}),a8e=(e,t)=>z1e(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),K6=(e,t)=>z1e(()=>{const{done:n,value:o}=e.next();return{done:n,value:n?void 0:t(o)}});class XB{constructor(t,n){this.clock=t,this.len=n}}class Xz{constructor(){this.clients=new Map}}const O1e=(e,t,n)=>t.clients.forEach((o,r)=>{const s=e.doc.store.clients.get(r);for(let i=0;i{let n=0,o=e.length-1;for(;n<=o;){const r=Na((n+o)/2),s=e[r],i=s.clock;if(i<=t){if(t{const n=e.clients.get(t.client);return n!==void 0&&c8e(n,t.clock)!==null},GB=e=>{e.clients.forEach(t=>{t.sort((r,s)=>r.clock-s.clock);let n,o;for(n=1,o=1;n=s.clock?r.len=uf(r.len,s.clock+s.len-r.clock):(o{const t=new Xz;for(let n=0;n{if(!t.clients.has(r)){const s=o.slice();for(let i=n+1;i{Fo(e.clients,t,()=>[]).push(new XB(n,o))},u8e=()=>new Xz,d8e=e=>{const t=u8e();return e.clients.forEach((n,o)=>{const r=[];for(let s=0;s0&&t.clients.set(o,r)}),t},ph=(e,t)=>{Wt(e.restEncoder,t.clients.size),Gc(t.clients.entries()).sort((n,o)=>o[0]-n[0]).forEach(([n,o])=>{e.resetDsCurVal(),Wt(e.restEncoder,n);const r=o.length;Wt(e.restEncoder,r);for(let s=0;s{const t=new Xz,n=Jt(e.restDecoder);for(let o=0;o0){const i=Fo(t.clients,r,()=>[]);for(let c=0;c{const o=new Xz,r=Jt(e.restDecoder);for(let s=0;s0){const s=new Rp;return Wt(s.restEncoder,0),ph(s,o),s.toUint8Array()}return null},y1e=o1e;class fh extends KCe{constructor({guid:t=r1e(),collectionid:n=null,gc:o=!0,gcFilter:r=()=>!0,meta:s=null,autoLoad:i=!1,shouldLoad:c=!0}={}){super(),this.gc=o,this.gcFilter=r,this.clientID=y1e(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new W1e,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=i,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=v2(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>v2(u=>{const d=p=>{(p===void 0||p===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&ln(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Gc(this.subdocs).map(t=>t.guid))}transact(t,n=null){return ln(this,t,n)}get(t,n=ho){const o=Fo(this.share,t,()=>{const s=new n;return s._integrate(this,null),s}),r=o.constructor;if(n!==ho&&r!==n)if(r===ho){const s=new n;s._map=o._map,o._map.forEach(i=>{for(;i!==null;i=i.left)i.parent=s}),s._start=o._start;for(let i=s._start;i!==null;i=i.right)i.parent=s;return s._length=o._length,this.share.set(t,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return o}getArray(t=""){return this.get(t,Ub)}getText(t=""){return this.get(t,k2)}getMap(t=""){return this.get(t,w2)}getXmlElement(t=""){return this.get(t,q2)}getXmlFragment(t=""){return this.get(t,Wp)}toJSON(){const t={};return this.share.forEach((n,o)=>{t[o]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Gc(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new fh({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,ln(t.parent.doc,o=>{const r=n.doc;t.deleted||o.subdocsAdded.add(r),o.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class v1e{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return Jt(this.restDecoder)}readDsLen(){return Jt(this.restDecoder)}}class x1e extends v1e{readLeftID(){return M0(Jt(this.restDecoder),Jt(this.restDecoder))}readRightID(){return M0(Jt(this.restDecoder),Jt(this.restDecoder))}readClient(){return Jt(this.restDecoder)}readInfo(){return Sp(this.restDecoder)}readString(){return Tc(this.restDecoder)}readParentInfo(){return Jt(this.restDecoder)===1}readTypeRef(){return Jt(this.restDecoder)}readLen(){return Jt(this.restDecoder)}readAny(){return y2(this.restDecoder)}readBuf(){return YRe(P1(this.restDecoder))}readJSON(){return JSON.parse(Tc(this.restDecoder))}readKey(){return Tc(this.restDecoder)}}class p8e{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Jt(this.restDecoder),this.dsCurrVal}readDsLen(){const t=Jt(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class _2 extends p8e{constructor(t){super(t),this.keys=[],Jt(t),this.keyClockDecoder=new X6(P1(t)),this.clientDecoder=new Dy(P1(t)),this.leftClockDecoder=new X6(P1(t)),this.rightClockDecoder=new X6(P1(t)),this.infoDecoder=new eV(P1(t),Sp),this.stringDecoder=new xRe(P1(t)),this.parentInfoDecoder=new eV(P1(t),Sp),this.typeRefDecoder=new Dy(P1(t)),this.lenDecoder=new Dy(P1(t))}readLeftID(){return new Hb(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Hb(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return y2(this.restDecoder)}readBuf(){return P1(this.restDecoder)}readJSON(){return y2(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t{o=uf(o,t[0].id.clock);const r=ja(t,o);Wt(e.restEncoder,t.length-r),e.writeClient(n),Wt(e.restEncoder,o);const s=t[r];s.write(e,o-s.id.clock);for(let i=r+1;i{const o=new Map;n.forEach((r,s)=>{H1(t,s)>r&&o.set(s,r)}),Px(t).forEach((r,s)=>{n.has(s)||o.set(s,0)}),Wt(e.restEncoder,o.size),Gc(o.entries()).sort((r,s)=>s[0]-r[0]).forEach(([r,s])=>{f8e(e,t.clients.get(r),r,s)})},b8e=(e,t)=>{const n=Cr(),o=Jt(e.restDecoder);for(let r=0;r{const o=[];let r=Gc(n.keys()).sort((b,h)=>b-h);if(r.length===0)return null;const s=()=>{if(r.length===0)return null;let b=n.get(r[r.length-1]);for(;b.refs.length===b.i;)if(r.pop(),r.length>0)b=n.get(r[r.length-1]);else return null;return b};let i=s();if(i===null)return null;const c=new W1e,l=new Map,u=(b,h)=>{const g=l.get(b);(g==null||g>h)&&l.set(b,h)};let d=i.refs[i.i++];const p=new Map,f=()=>{for(const b of o){const h=b.id.client,g=n.get(h);g?(g.i--,c.clients.set(h,g.refs.slice(g.i)),n.delete(h),g.i=0,g.refs=[]):c.clients.set(h,[b]),r=r.filter(z=>z!==h)}o.length=0};for(;;){if(d.constructor!==Ws){const h=Fo(p,d.id.client,()=>H1(t,d.id.client))-d.id.clock;if(h<0)o.push(d),u(d.id.client,d.id.clock-1),f();else{const g=d.getMissing(e,t);if(g!==null){o.push(d);const z=n.get(g)||{refs:[],i:0};if(z.refs.length===z.i)u(g,H1(t,g)),f();else{d=z.refs[z.i++];continue}}else(h===0||h0)d=o.pop();else if(i!==null&&i.i0){const b=new Rp;return YB(b,c,new Map),Wt(b.restEncoder,0),{missing:l,update:b.toUint8Array()}}return null},m8e=(e,t)=>YB(e,t.doc.store,t.beforeState),M8e=(e,t,n,o=new _2(e))=>ln(t,r=>{r.local=!1;let s=!1;const i=r.doc,c=i.store,l=b8e(o,i),u=h8e(r,c,l),d=c.pendingStructs;if(d){for(const[f,b]of d.missing)if(bb)&&d.missing.set(f,b)}d.update=dv([d.update,u.update])}}else c.pendingStructs=u;const p=iV(o,r,c);if(c.pendingDs){const f=new _2(Ka(c.pendingDs));Jt(f.restDecoder);const b=iV(f,r,c);p&&b?c.pendingDs=dv([p,b]):c.pendingDs=p||b}else c.pendingDs=p;if(s){const f=c.pendingStructs.update;c.pendingStructs=null,k1e(r.doc,f)}},n,!1),k1e=(e,t,n,o=_2)=>{const r=Ka(t);M8e(r,e,n,new o(r))},q1e=(e,t,n)=>k1e(e,t,n,x1e),g8e=(e,t,n=new Map)=>{YB(e,t.store,n),ph(e,d8e(t.store))},z8e=(e,t=new Uint8Array([0]),n=new Rp)=>{const o=S1e(t);g8e(n,e,o);const r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(E8e(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===Gz)return W8e(r.map((s,i)=>i===0?s:N8e(s)));if(n.constructor===Rp)return dv(r)}return r[0]},ZB=(e,t)=>z8e(e,t,new Gz),O8e=e=>{const t=new Map,n=Jt(e.restDecoder);for(let o=0;oO8e(new v1e(Ka(e))),C1e=(e,t)=>(Wt(e.restEncoder,t.size),Gc(t.entries()).sort((n,o)=>o[0]-n[0]).forEach(([n,o])=>{Wt(e.restEncoder,n),Wt(e.restEncoder,o)}),e),A8e=(e,t)=>C1e(e,Px(t.store)),y8e=(e,t=new w1e)=>(e instanceof Map?C1e(t,e):A8e(t,e),t.toUint8Array()),v8e=e=>y8e(e,new _1e);class x8e{constructor(){this.l=[]}}const aV=()=>new x8e,cV=(e,t)=>e.l.push(t),lV=(e,t)=>{const n=e.l,o=n.length;e.l=n.filter(r=>t!==r),o===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},R1e=(e,t,n)=>$B(e.l,[t,n]);class Hb{constructor(t,n){this.client=t,this.clock=n}}const JO=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,M0=(e,t)=>new Hb(e,t),_8e=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw La()},tb=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!A1e(t.ds,e.id),d8=(e,t)=>{const n=Fo(e.meta,d8,Eu),o=e.doc.store;n.has(t)||(t.sv.forEach((r,s)=>{r{}),n.add(t))};class W1e{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Px=e=>{const t=new Map;return e.clients.forEach((n,o)=>{const r=n[n.length-1];t.set(o,r.id.clock+r.length)}),t},H1=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const o=n[n.length-1];return o.id.clock+o.length},T1e=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const o=n[n.length-1];if(o.id.clock+o.length!==t.id.clock)throw La()}n.push(t)},ja=(e,t)=>{let n=0,o=e.length-1,r=e[o],s=r.id.clock;if(s===t)return o;let i=Na(t/(s+r.length-1)*o);for(;n<=o;){if(r=e[i],s=r.id.clock,s<=t){if(t{const n=e.clients.get(t.client);return n[ja(n,t.clock)]},Y6=w8e,p8=(e,t,n)=>{const o=ja(t,n),r=t[o];return r.id.clock{const n=e.doc.store.clients.get(t.client);return n[p8(e,n,t.clock)]},uV=(e,t,n)=>{const o=t.clients.get(n.client),r=ja(o,n.clock),s=o[r];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Rs&&o.splice(r+1,0,Mv(e,s,n.clock-s.id.clock+1)),s},k8e=(e,t,n)=>{const o=e.clients.get(t.id.client);o[ja(o,t.id.clock)]=n},E1e=(e,t,n,o,r)=>{if(o===0)return;const s=n+o;let i=p8(e,t,n),c;do c=t[i++],st.deleteSet.clients.size===0&&!UCe(t.afterState,(n,o)=>t.beforeState.get(o)!==n)?!1:(GB(t.deleteSet),m8e(e,t),ph(e,t.deleteSet),!0),pV=(e,t,n)=>{const o=t._item;(o===null||o.id.clock<(e.beforeState.get(o.id.client)||0)&&!o.deleted)&&Fo(e.changed,t,Eu).add(n)},Fy=(e,t)=>{let n=e[t],o=e[t-1],r=t;for(;r>0;n=o,o=e[--r-1]){if(o.deleted===n.deleted&&o.constructor===n.constructor&&o.mergeWith(n)){n instanceof Wo&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,o);continue}break}const s=t-r;return s&&e.splice(t+1-s,s),s},S8e=(e,t,n)=>{for(const[o,r]of e.clients.entries()){const s=t.clients.get(o);for(let i=r.length-1;i>=0;i--){const c=r[i],l=c.clock+c.len;for(let u=ja(s,c.clock),d=s[u];u{e.clients.forEach((n,o)=>{const r=t.clients.get(o);for(let s=n.length-1;s>=0;s--){const i=n[s],c=NB(r.length-1,1+ja(r,i.clock+i.len-1));for(let l=c,u=r[l];l>0&&u.id.clock>=i.clock;u=r[l])l-=1+Fy(r,l)}})},B1e=(e,t)=>{if(tc.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),c.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,p)=>d.path.length-p.path.length),R1e(u._dEH,l,n))})}),c.push(()=>o.emit("afterTransaction",[n,o])),$B(c,[]),n._needFormattingCleanup&&Y8e(n)}finally{o.gc&&S8e(s,r,o.gcFilter),C8e(s,r),n.afterState.forEach((d,p)=>{const f=n.beforeState.get(p)||0;if(f!==d){const b=r.clients.get(p),h=uf(ja(b,f),1);for(let g=b.length-1;g>=h;)g-=1+Fy(b,g)}});for(let d=i.length-1;d>=0;d--){const{client:p,clock:f}=i[d].id,b=r.clients.get(p),h=ja(b,f);h+11||h>0&&Fy(b,h)}if(!n.local&&n.afterState.get(o.clientID)!==n.beforeState.get(o.clientID)&&(g1e(UB,Ls,"[yjs] ",Cp,m1e,"Changed the client-id because another client seems to be using it."),o.clientID=y1e()),o.emit("afterTransactionCleanup",[n,o]),o._observers.has("update")){const d=new Gz;dV(d,n)&&o.emit("update",[d.toUint8Array(),n.origin,o,n])}if(o._observers.has("updateV2")){const d=new Rp;dV(d,n)&&o.emit("updateV2",[d.toUint8Array(),n.origin,o,n])}const{subdocsAdded:c,subdocsLoaded:l,subdocsRemoved:u}=n;(c.size>0||u.size>0||l.size>0)&&(c.forEach(d=>{d.clientID=o.clientID,d.collectionid==null&&(d.collectionid=o.collectionid),o.subdocs.add(d)}),u.forEach(d=>o.subdocs.delete(d)),o.emit("subdocs",[{loaded:l,added:c,removed:u},o,n]),u.forEach(d=>d.destroy())),e.length<=t+1?(o._transactionCleanups=[],o.emit("afterAllTransactions",[o,e])):B1e(e,t+1)}}},ln=(e,t,n=null,o=!0)=>{const r=e._transactionCleanups;let s=!1,i=null;e._transaction===null&&(s=!0,e._transaction=new q8e(e,n,o),r.push(e._transaction),r.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{i=t(e._transaction)}finally{if(s){const c=e._transaction===r[0];e._transaction=null,c&&B1e(r,0)}}return i};function*R8e(e){const t=Jt(e.restDecoder);for(let n=0;ndv(e,x1e,Gz),T8e=(e,t)=>{if(e.constructor===Rs){const{client:n,clock:o}=e.id;return new Rs(M0(n,o+t),e.length-t)}else if(e.constructor===Ws){const{client:n,clock:o}=e.id;return new Ws(M0(n,o+t),e.length-t)}else{const n=e,{client:o,clock:r}=n.id;return new Wo(M0(o,r+t),null,M0(o,r+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},dv=(e,t=_2,n=Rp)=>{if(e.length===1)return e[0];const o=e.map(d=>new t(Ka(d)));let r=o.map(d=>new QB(d,!0)),s=null;const i=new n,c=new JB(i);for(;r=r.filter(f=>f.curr!==null),r.sort((f,b)=>{if(f.curr.id.client===b.curr.id.client){const h=f.curr.id.clock-b.curr.id.clock;return h===0?f.curr.constructor===b.curr.constructor?0:f.curr.constructor===Ws?1:-1:h}else return b.curr.id.client-f.curr.id.client}),r.length!==0;){const d=r[0],p=d.curr.id.client;if(s!==null){let f=d.curr,b=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=d.next(),b=!0;if(f===null||f.id.client!==p||b&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(p!==s.struct.id.client)Gl(c,s.struct,s.offset),s={struct:f,offset:0},d.next();else if(s.struct.id.clock+s.struct.length0&&(s.struct.constructor===Ws?s.struct.length-=h:f=T8e(f,h)),s.struct.mergeWith(f)||(Gl(c,s.struct,s.offset),s={struct:f,offset:0},d.next())}}else s={struct:d.curr,offset:0},d.next();for(let f=d.curr;f!==null&&f.id.client===p&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==Ws;f=d.next())Gl(c,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(Gl(c,s.struct,s.offset),s=null),eN(c);const l=o.map(d=>KB(d)),u=l8e(l);return ph(i,u),i.toUint8Array()},E8e=(e,t,n=_2,o=Rp)=>{const r=S1e(t),s=new o,i=new JB(s),c=new n(Ka(e)),l=new QB(c,!1);for(;l.curr;){const d=l.curr,p=d.id.client,f=r.get(p)||0;if(l.curr.constructor===Ws){l.next();continue}if(d.id.clock+d.length>f)for(Gl(i,d,uf(f-d.id.clock,0)),l.next();l.curr&&l.curr.id.client===p;)Gl(i,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===p&&l.curr.id.clock+l.curr.length<=f;)l.next()}eN(i);const u=KB(c);return ph(s,u),s.toUint8Array()},N1e=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:Fn(e.encoder.restEncoder)}),e.encoder.restEncoder=F1(),e.written=0)},Gl=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&N1e(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),Wt(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},eN=e=>{N1e(e);const t=e.encoder.restEncoder;Wt(t,e.clientStructs.length);for(let n=0;n{const r=new n(Ka(e)),s=new QB(r,!1),i=new o,c=new JB(i);for(let u=s.curr;u!==null;u=s.next())Gl(c,t(u),0);eN(c);const l=KB(r);return ph(i,l),i.toUint8Array()},N8e=e=>B8e(e,jRe,_2,Gz),fV="You must not compute changes after the event-handler fired.";class Ix{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=L8e(this.currentTarget,this.target))}deletes(t){return A1e(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ri(fV);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(r=>{if(r!==null){const s=n._map.get(r);let i,c;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))i="delete",c=$6(l.content.getContent());else return;else l!==null&&this.deletes(l)?(i="update",c=$6(l.content.getContent())):(i="add",c=void 0)}else if(this.deletes(s))i="delete",c=$6(s.content.getContent());else return;t.set(r,{action:i,oldValue:c})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ri(fV);const n=this.target,o=Eu(),r=Eu(),s=[];if(t={added:o,deleted:r,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const l=()=>{c&&s.push(c)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((c===null||c.delete===void 0)&&(l(),c={delete:0}),c.delete+=u.length,r.add(u)):this.adds(u)?((c===null||c.insert===void 0)&&(l(),c={insert:[]}),c.insert=c.insert.concat(u.content.getContent()),o.add(u)):((c===null||c.retain===void 0)&&(l(),c={retain:0}),c.retain+=u.length);c!==null&&c.retain===void 0&&l()}this._changes=t}return t}}const L8e=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let o=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(o+=r.length),r=r.right;n.unshift(o)}t=t._item.parent}return n},L1e=80;let tN=0;class j8e{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=tN++}}const P8e=e=>{e.timestamp=tN++},j1e=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=tN++},I8e=(e,t,n)=>{if(e.length>=L1e){const o=e.reduce((r,s)=>r.timestamp{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((s,i)=>Py(t-s.index)t;)o=o.left,!o.deleted&&o.countable&&(r-=o.length);for(;o.left!==null&&o.left.id.client===o.id.client&&o.left.id.clock+o.left.length===o.id.clock;)o=o.left,!o.deleted&&o.countable&&(r-=o.length);return n!==null&&Py(n.index-r){for(let o=e.length-1;o>=0;o--){const r=e[o];if(n>0){let s=r.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(r.index-=s.length);if(s===null||s.marker===!0){e.splice(o,1);continue}r.p=s,s.marker=!0}(t0&&t===r.index)&&(r.index=uf(t,r.index+n))}},Fx=(e,t,n)=>{const o=e,r=t.changedParentTypes;for(;Fo(r,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;R1e(o._eH,n,t)};class ho{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=aV(),this._dEH=aV(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw ka()}clone(){throw ka()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){cV(this._eH,t)}observeDeep(t){cV(this._dEH,t)}unobserve(t){lV(this._eH,t)}unobserveDeep(t){lV(this._dEH,t)}toJSON(){}}const P1e=(e,t,n)=>{t<0&&(t=e._length+t),n<0&&(n=e._length+n);let o=n-t;const r=[];let s=e._start;for(;s!==null&&o>0;){if(s.countable&&!s.deleted){const i=s.content.getContent();if(i.length<=t)t-=i.length;else{for(let c=t;c0;c++)r.push(i[c]),o--;t=0}}s=s.right}return r},I1e=e=>{const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const o=n.content.getContent();for(let r=0;r{let n=0,o=e._start;for(;o!==null;){if(o.countable&&!o.deleted){const r=o.content.getContent();for(let s=0;s{const n=[];return kg(e,(o,r)=>{n.push(t(o,r,e))}),n},D8e=e=>{let t=e._start,n=null,o=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),o=0,t=t.right}const r=n[o++];return n.length<=o&&(n=null),{done:!1,value:r}}}},F1e=(e,t)=>{const n=Dx(e,t);let o=e._start;for(n!==null&&(o=n.p,t-=n.index);o!==null;o=o.right)if(!o.deleted&&o.countable){if(t{let r=n;const s=e.doc,i=s.clientID,c=s.store,l=n===null?t._start:n.right;let u=[];const d=()=>{u.length>0&&(r=new Wo(M0(i,H1(c,i)),r,r&&r.lastId,l,l&&l.id,t,null,new Tp(u)),r.integrate(e,0),u=[])};o.forEach(p=>{if(p===null)u.push(p);else switch(p.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(p);break;default:switch(d(),p.constructor){case Uint8Array:case ArrayBuffer:r=new Wo(M0(i,H1(c,i)),r,r&&r.lastId,l,l&&l.id,t,null,new Kz(new Uint8Array(p))),r.integrate(e,0);break;case fh:r=new Wo(M0(i,H1(c,i)),r,r&&r.lastId,l,l&&l.id,t,null,new Yz(p)),r.integrate(e,0);break;default:if(p instanceof ho)r=new Wo(M0(i,H1(c,i)),r,r&&r.lastId,l,l&&l.id,t,null,new bl(p)),r.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},$1e=()=>Ri("Length exceeded!"),V1e=(e,t,n,o)=>{if(n>t._length)throw $1e();if(n===0)return t._searchMarker&&wg(t._searchMarker,n,o.length),pv(e,t,null,o);const r=n,s=Dx(t,n);let i=t._start;for(s!==null&&(i=s.p,n-=s.index,n===0&&(i=i.prev,n+=i&&i.countable&&!i.deleted?i.length:0));i!==null;i=i.right)if(!i.deleted&&i.countable){if(n<=i.length){n{let r=(t._searchMarker||[]).reduce((s,i)=>i.index>s.index?i:s,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return pv(e,t,r,n)},H1e=(e,t,n,o)=>{if(o===0)return;const r=n,s=o,i=Dx(t,n);let c=t._start;for(i!==null&&(c=i.p,n-=i.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n0&&c!==null;)c.deleted||(o0)throw $1e();t._searchMarker&&wg(t._searchMarker,r,-s+o)},fv=(e,t,n)=>{const o=t._map.get(n);o!==void 0&&o.delete(e)},nN=(e,t,n,o)=>{const r=t._map.get(n)||null,s=e.doc,i=s.clientID;let c;if(o==null)c=new Tp([o]);else switch(o.constructor){case Number:case Object:case Boolean:case Array:case String:c=new Tp([o]);break;case Uint8Array:c=new Kz(o);break;case fh:c=new Yz(o);break;default:if(o instanceof ho)c=new bl(o);else throw new Error("Unexpected content type")}new Wo(M0(i,H1(s.store,i)),r,r&&r.lastId,null,null,t,n,c).integrate(e,0)},oN=(e,t)=>{const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},U1e=e=>{const t={};return e._map.forEach((n,o)=>{n.deleted||(t[o]=n.content.getContent()[n.length-1])}),t},X1e=(e,t)=>{const n=e._map.get(t);return n!==void 0&&!n.deleted},$8e=(e,t)=>{const n={};return e._map.forEach((o,r)=>{let s=o;for(;s!==null&&(!t.sv.has(s.id.client)||s.id.clock>=(t.sv.get(s.id.client)||0));)s=s.left;s!==null&&tb(s,t)&&(n[r]=s.content.getContent()[s.length-1])}),n},eA=e=>a8e(e.entries(),t=>!t[1].deleted);class V8e extends Ix{}class Ub extends ho{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Ub;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ub}clone(){const t=new Ub;return t.insert(0,this.toArray().map(n=>n instanceof ho?n.clone():n)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(t,n){super._callObserver(t,n),Fx(this,t,new V8e(this,t))}insert(t,n){this.doc!==null?ln(this.doc,o=>{V1e(o,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?ln(this.doc,n=>{F8e(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?ln(this.doc,o=>{H1e(o,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return F1e(this,t)}toArray(){return I1e(this)}slice(t=0,n=this.length){return P1e(this,t,n)}toJSON(){return this.map(t=>t instanceof ho?t.toJSON():t)}map(t){return D1e(this,t)}forEach(t){kg(this,t)}[Symbol.iterator](){return D8e(this)}_write(t){t.writeTypeRef(bWe)}}const H8e=e=>new Ub;class U8e extends Ix{constructor(t,n,o){super(t,n),this.keysChanged=o}}class w2 extends ho{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((o,r)=>{this.set(r,o)}),this._prelimContent=null}_copy(){return new w2}clone(){const t=new w2;return this.forEach((n,o)=>{t.set(o,n instanceof ho?n.clone():n)}),t}_callObserver(t,n){Fx(this,t,new U8e(this,t,n))}toJSON(){const t={};return this._map.forEach((n,o)=>{if(!n.deleted){const r=n.content.getContent()[n.length-1];t[o]=r instanceof ho?r.toJSON():r}}),t}get size(){return[...eA(this._map)].length}keys(){return K6(eA(this._map),t=>t[0])}values(){return K6(eA(this._map),t=>t[1].content.getContent()[t[1].length-1])}entries(){return K6(eA(this._map),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this._map.forEach((n,o)=>{n.deleted||t(n.content.getContent()[n.length-1],o,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?ln(this.doc,n=>{fv(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?ln(this.doc,o=>{nN(o,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return oN(this,t)}has(t){return X1e(this,t)}clear(){this.doc!==null?ln(this.doc,t=>{this.forEach(function(n,o,r){fv(t,r,o)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(hWe)}}const X8e=e=>new w2,tu=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&NRe(e,t);class f8{constructor(t,n,o,r){this.left=t,this.right=n,this.index=o,this.currentAttributes=r}forward(){switch(this.right===null&&La(),this.right.content.constructor){case R1:this.right.deleted||bh(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const bV=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case R1:t.right.deleted||bh(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n{const r=new Map,s=o?Dx(t,n):null;if(s){const i=new f8(s.p.left,s.p,s.index,r);return bV(e,i,n-s.index)}else{const i=new f8(null,t._start,0,r);return bV(e,i,n)}},G1e=(e,t,n,o)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===R1&&tu(o.get(n.right.content.key),n.right.content.value));)n.right.deleted||o.delete(n.right.content.key),n.forward();const r=e.doc,s=r.clientID;o.forEach((i,c)=>{const l=n.left,u=n.right,d=new Wo(M0(s,H1(r.store,s)),l,l&&l.lastId,u,u&&u.id,t,null,new R1(c,i));d.integrate(e,0),n.right=d,n.forward()})},bh=(e,t)=>{const{key:n,value:o}=t;o===null?e.delete(n):e.set(n,o)},K1e=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===R1&&tu(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},Y1e=(e,t,n,o)=>{const r=e.doc,s=r.clientID,i=new Map;for(const c in o){const l=o[c],u=n.currentAttributes.get(c)??null;if(!tu(u,l)){i.set(c,u);const{left:d,right:p}=n;n.right=new Wo(M0(s,H1(r.store,s)),d,d&&d.lastId,p,p&&p.id,t,null,new R1(c,l)),n.right.integrate(e,0),n.forward()}}return i},Z6=(e,t,n,o,r)=>{n.currentAttributes.forEach((f,b)=>{r[b]===void 0&&(r[b]=null)});const s=e.doc,i=s.clientID;K1e(n,r);const c=Y1e(e,t,n,r),l=o.constructor===String?new Pa(o):o instanceof ho?new bl(o):new df(o);let{left:u,right:d,index:p}=n;t._searchMarker&&wg(t._searchMarker,n.index,l.getLength()),d=new Wo(M0(i,H1(s.store,i)),u,u&&u.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=p,n.forward(),G1e(e,t,n,c)},hV=(e,t,n,o,r)=>{const s=e.doc,i=s.clientID;K1e(n,r);const c=Y1e(e,t,n,r);e:for(;n.right!==null&&(o>0||c.size>0&&(n.right.deleted||n.right.content.constructor===R1));){if(!n.right.deleted)switch(n.right.content.constructor){case R1:{const{key:l,value:u}=n.right.content,d=r[l];if(d!==void 0){if(tu(d,u))c.delete(l);else{if(o===0)break e;c.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:o0){let l="";for(;o>0;o--)l+=`
-`;n.right=new Wo(M0(i,H1(s.store,i)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Pa(l)),n.right.integrate(e,0),n.forward()}G1e(e,t,n,c)},Z1e=(e,t,n,o,r)=>{let s=t;const i=Cr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===R1){const u=s.content;i.set(u.key,u)}s=s.right}let c=0,l=!1;for(;t!==s;){if(n===t&&(l=!0),!t.deleted){const u=t.content;switch(u.constructor){case R1:{const{key:d,value:p}=u,f=o.get(d)??null;(i.get(d)!==u||f===p)&&(t.delete(e),c++,!l&&(r.get(d)??null)===p&&f!==p&&(f===null?r.delete(d):r.set(d,f))),!l&&!t.deleted&&bh(r,u);break}}}t=t.right}return c},G8e=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===R1){const o=t.content.key;n.has(o)?t.delete(e):n.add(o)}t=t.left}},K8e=e=>{let t=0;return ln(e.doc,n=>{let o=e._start,r=e._start,s=Cr();const i=i8(s);for(;r;){if(r.deleted===!1)switch(r.content.constructor){case R1:bh(i,r.content);break;default:t+=Z1e(n,o,r,s,i),s=i8(i),o=r;break}r=r.right}}),t},Y8e=e=>{const t=new Set,n=e.doc;for(const[o,r]of e.afterState.entries()){const s=e.beforeState.get(o)||0;r!==s&&E1e(e,n.store.clients.get(o),s,r,i=>{!i.deleted&&i.content.constructor===R1&&i.constructor!==Rs&&t.add(i.parent)})}ln(n,o=>{O1e(e,e.deleteSet,r=>{if(r instanceof Rs||!r.parent._hasFormatting||t.has(r.parent))return;const s=r.parent;r.content.constructor===R1?t.add(s):G8e(o,r)});for(const r of t)K8e(r)})},mV=(e,t,n)=>{const o=n,r=i8(t.currentAttributes),s=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case bl:case df:case Pa:n{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){const t=this.target.doc,n=[];ln(t,o=>{const r=new Map,s=new Map;let i=this.target._start,c=null;const l={};let u="",d=0,p=0;const f=()=>{if(c!==null){let b=null;switch(c){case"delete":p>0&&(b={delete:p}),p=0;break;case"insert":(typeof u=="object"||u.length>0)&&(b={insert:u},r.size>0&&(b.attributes={},r.forEach((h,g)=>{h!==null&&(b.attributes[g]=h)}))),u="";break;case"retain":d>0&&(b={retain:d},ERe(l)||(b.attributes=WRe({},l))),d=0;break}b&&n.push(b),c=null}};for(;i!==null;){switch(i.content.constructor){case bl:case df:this.adds(i)?this.deletes(i)||(f(),c="insert",u=i.content.getContent()[0],f()):this.deletes(i)?(c!=="delete"&&(f(),c="delete"),p+=1):i.deleted||(c!=="retain"&&(f(),c="retain"),d+=1);break;case Pa:this.adds(i)?this.deletes(i)||(c!=="insert"&&(f(),c="insert"),u+=i.content.str):this.deletes(i)?(c!=="delete"&&(f(),c="delete"),p+=i.length):i.deleted||(c!=="retain"&&(f(),c="retain"),d+=i.length);break;case R1:{const{key:b,value:h}=i.content;if(this.adds(i)){if(!this.deletes(i)){const g=r.get(b)??null;tu(g,h)?h!==null&&i.delete(o):(c==="retain"&&f(),tu(h,s.get(b)??null)?delete l[b]:l[b]=h)}}else if(this.deletes(i)){s.set(b,h);const g=r.get(b)??null;tu(g,h)||(c==="retain"&&f(),l[b]=g)}else if(!i.deleted){s.set(b,h);const g=l[b];g!==void 0&&(tu(g,h)?g!==null&&i.delete(o):(c==="retain"&&f(),h===null?delete l[b]:l[b]=h))}i.deleted||(c==="insert"&&f(),bh(r,i.content));break}}i=i.right}for(f();n.length>0;){const b=n[n.length-1];if(b.retain!==void 0&&b.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class k2 extends ho{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(o=>o())}catch(o){console.error(o)}this._pending=null}_copy(){return new k2}clone(){const t=new k2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const o=new Z8e(this,t,n);Fx(this,t,o),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Pa&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?ln(this.doc,o=>{const r=new f8(null,this._start,0,new Map);for(let s=0;s0)&&Z6(o,this,r,c,i.attributes||{})}else i.retain!==void 0?hV(o,this,r,i.retain,i.attributes||{}):i.delete!==void 0&&mV(o,r,i.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,o){const r=[],s=new Map,i=this.doc;let c="",l=this._start;function u(){if(c.length>0){const p={};let f=!1;s.forEach((h,g)=>{f=!0,p[g]=h});const b={insert:c};f&&(b.attributes=p),r.push(b),c=""}}const d=()=>{for(;l!==null;){if(tb(l,t)||n!==void 0&&tb(l,n))switch(l.content.constructor){case Pa:{const p=s.get("ychange");t!==void 0&&!tb(l,t)?(p===void 0||p.user!==l.id.client||p.type!=="removed")&&(u(),s.set("ychange",o?o("removed",l.id):{type:"removed"})):n!==void 0&&!tb(l,n)?(p===void 0||p.user!==l.id.client||p.type!=="added")&&(u(),s.set("ychange",o?o("added",l.id):{type:"added"})):p!==void 0&&(u(),s.delete("ychange")),c+=l.content.str;break}case bl:case df:{u();const p={insert:l.content.getContent()[0]};if(s.size>0){const f={};p.attributes=f,s.forEach((b,h)=>{f[h]=b})}r.push(p);break}case R1:tb(l,t)&&(u(),bh(s,l.content));break}l=l.right}u()};return t||n?ln(i,p=>{t&&d8(p,t),n&&d8(p,n),d()},"cleanup"):d(),r}insert(t,n,o){if(n.length<=0)return;const r=this.doc;r!==null?ln(r,s=>{const i=tA(s,this,t,!o);o||(o={},i.currentAttributes.forEach((c,l)=>{o[l]=c})),Z6(s,this,i,n,o)}):this._pending.push(()=>this.insert(t,n,o))}insertEmbed(t,n,o){const r=this.doc;r!==null?ln(r,s=>{const i=tA(s,this,t,!o);Z6(s,this,i,n,o||{})}):this._pending.push(()=>this.insertEmbed(t,n,o||{}))}delete(t,n){if(n===0)return;const o=this.doc;o!==null?ln(o,r=>{mV(r,tA(r,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,o){if(n===0)return;const r=this.doc;r!==null?ln(r,s=>{const i=tA(s,this,t,!1);i.right!==null&&hV(s,this,i,n,o)}):this._pending.push(()=>this.format(t,n,o))}removeAttribute(t){this.doc!==null?ln(this.doc,n=>{fv(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?ln(this.doc,o=>{nN(o,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return oN(this,t)}getAttributes(){return U1e(this)}_write(t){t.writeTypeRef(mWe)}}const Q8e=e=>new k2;class Q6{constructor(t,n=()=>!0){this._filter=n,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,n=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(n)))do if(n=t.content.type,!t.deleted&&(n.constructor===q2||n.constructor===Wp)&&n._start!==null)t=n._start;else for(;t!==null;)if(t.right!==null){t=t.right;break}else t.parent===this._root?t=null:t=t.parent._item;while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class Wp extends ho{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Wp}clone(){const t=new Wp;return t.insert(0,this.toArray().map(n=>n instanceof ho?n.clone():n)),t}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new Q6(this,t)}querySelector(t){t=t.toUpperCase();const o=new Q6(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return o.done?null:o.value}querySelectorAll(t){return t=t.toUpperCase(),Gc(new Q6(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){Fx(this,t,new tWe(this,n,t))}toString(){return D1e(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},o){const r=t.createDocumentFragment();return o!==void 0&&o._createAssociation(r,this),kg(this,s=>{r.insertBefore(s.toDOM(t,n,o),null)}),r}insert(t,n){this.doc!==null?ln(this.doc,o=>{V1e(o,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)ln(this.doc,o=>{const r=t&&t instanceof ho?t._item:t;pv(o,this,r,n)});else{const o=this._prelimContent,r=t===null?0:o.findIndex(s=>s===t)+1;if(r===0&&t!==null)throw Ri("Reference item not found");o.splice(r,0,...n)}}delete(t,n=1){this.doc!==null?ln(this.doc,o=>{H1e(o,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return I1e(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return F1e(this,t)}slice(t=0,n=this.length){return P1e(this,t,n)}forEach(t){kg(this,t)}_write(t){t.writeTypeRef(gWe)}}const J8e=e=>new Wp;class q2 extends Wp{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((o,r)=>{this.setAttribute(r,o)}),this._prelimAttrs=null}_copy(){return new q2(this.nodeName)}clone(){const t=new q2(this.nodeName),n=this.getAttributes();return TRe(n,(o,r)=>{typeof o=="string"&&t.setAttribute(r,o)}),t.insert(0,this.toArray().map(o=>o instanceof ho?o.clone():o)),t}toString(){const t=this.getAttributes(),n=[],o=[];for(const c in t)o.push(c);o.sort();const r=o.length;for(let c=0;c0?" "+n.join(" "):"";return`<${s}${i}>${super.toString()}${s}>`}removeAttribute(t){this.doc!==null?ln(this.doc,n=>{fv(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?ln(this.doc,o=>{nN(o,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return oN(this,t)}hasAttribute(t){return X1e(this,t)}getAttributes(t){return t?$8e(this,t):U1e(this)}toDOM(t=document,n={},o){const r=t.createElement(this.nodeName),s=this.getAttributes();for(const i in s){const c=s[i];typeof c=="string"&&r.setAttribute(i,c)}return kg(this,i=>{r.appendChild(i.toDOM(t,n,o))}),o!==void 0&&o._createAssociation(r,this),r}_write(t){t.writeTypeRef(MWe),t.writeKey(this.nodeName)}}const eWe=e=>new q2(e.readKey());class tWe extends Ix{constructor(t,n,o){super(t,o),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}}class bv extends w2{constructor(t){super(),this.hookName=t}_copy(){return new bv(this.hookName)}clone(){const t=new bv(this.hookName);return this.forEach((n,o)=>{t.set(o,n)}),t}toDOM(t=document,n={},o){const r=n[this.hookName];let s;return r!==void 0?s=r.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),o!==void 0&&o._createAssociation(s,this),s}_write(t){t.writeTypeRef(zWe),t.writeKey(this.hookName)}}const nWe=e=>new bv(e.readKey());class hv extends k2{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new hv}clone(){const t=new hv;return t.applyDelta(this.toDelta()),t}toDOM(t=document,n,o){const r=t.createTextNode(this.toString());return o!==void 0&&o._createAssociation(r,this),r}toString(){return this.toDelta().map(t=>{const n=[];for(const r in t.attributes){const s=[];for(const i in t.attributes[r])s.push({key:i,value:t.attributes[r][i]});s.sort((i,c)=>i.keyr.nodeName"}o+=t.insert;for(let r=n.length-1;r>=0;r--)o+=`${n[r].nodeName}>`;return o}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(OWe)}}const oWe=e=>new hv;class rN{constructor(t,n){this.id=t,this.length=n}get deleted(){throw ka()}mergeWith(t){return!1}write(t,n,o){throw ka()}integrate(t,n){throw ka()}}const rWe=0;class Rs extends rN{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){n>0&&(this.id.clock+=n,this.length-=n),T1e(t.doc.store,this)}write(t,n){t.writeInfo(rWe),t.writeLen(this.length-n)}getMissing(t,n){return null}}class Kz{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Kz(this.content)}splice(t){throw ka()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}}const sWe=e=>new Kz(e.readBuf());class qg{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new qg(this.len)}splice(t){const n=new qg(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){uv(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}}const iWe=e=>new qg(e.readLen()),Q1e=(e,t)=>new fh({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class Yz{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Yz(Q1e(this.doc.guid,this.opts))}splice(t){throw ka()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}const aWe=e=>new Yz(Q1e(e.readString(),e.readAny()));class df{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new df(this.embed)}splice(t){throw ka()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}}const cWe=e=>new df(e.readJSON());class R1{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new R1(this.key,this.value)}splice(t){throw ka()}mergeWith(t){return!1}integrate(t,n){const o=n.parent;o._searchMarker=null,o._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}const lWe=e=>new R1(e.readKey(),e.readJSON());class mv{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new mv(this.arr)}splice(t){const n=new mv(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const o=this.arr.length;t.writeLen(o-n);for(let r=n;r{const t=e.readLen(),n=[];for(let o=0;o{const t=e.readLen(),n=[];for(let o=0;o=55296&&o<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const pWe=e=>new Pa(e.readString()),fWe=[H8e,X8e,Q8e,eWe,J8e,nWe,oWe],bWe=0,hWe=1,mWe=2,MWe=3,gWe=4,zWe=5,OWe=6;class bl{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new bl(this.type._copy())}splice(t){throw ka()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(o=>{o.deleted?o.id.clock<(t.beforeState.get(o.id.client)||0)&&t._mergeStructs.push(o):o.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(o=>{for(;o!==null;)o.gc(t,!0),o=o.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}}const AWe=e=>new bl(fWe[e.readTypeRef()](e)),Mv=(e,t,n)=>{const{client:o,clock:r}=t.id,s=new Wo(M0(o,r+n),t,M0(o,r+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&s.markDeleted(),t.keep&&(s.keep=!0),t.redone!==null&&(s.redone=M0(t.redone.client,t.redone.clock+n)),t.right=s,s.right!==null&&(s.right.left=s),e._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),t.length=n,s};let Wo=class b8 extends rN{constructor(t,n,o,r,s,i,c,l){super(t,l.getLength()),this.origin=o,this.left=n,this.right=r,this.rightOrigin=s,this.parent=i,this.parentSub=c,this.redone=null,this.content=l,this.info=this.content.isCountable()?G$:0}set marker(t){(this.info&H6)>0!==t&&(this.info^=H6)}get marker(){return(this.info&H6)>0}get keep(){return(this.info&X$)>0}set keep(t){this.keep!==t&&(this.info^=X$)}get countable(){return(this.info&G$)>0}get deleted(){return(this.info&V6)>0}set deleted(t){this.deleted!==t&&(this.info^=V6)}markDeleted(){this.info|=V6}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=H1(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=H1(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Hb&&this.id.client!==this.parent.client&&this.parent.clock>=H1(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=uV(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Bu(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Rs||this.right&&this.right.constructor===Rs)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===b8&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===b8&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Hb){const o=Y6(n,this.parent);o.constructor===Rs?this.parent=null:this.parent=o.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=uV(t,t.doc.store,M0(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let o=this.left,r;if(o!==null)r=o.right;else if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start;const s=new Set,i=new Set;for(;r!==null&&r!==this.right;){if(i.add(r),s.add(r),JO(this.origin,r.origin)){if(r.id.client{o.p===t&&(o.p=this,!this.deleted&&this.countable&&(o.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),uv(t.deleteSet,this.id.client,this.id.clock,this.length),pV(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw La();this.content.gc(t),n?k8e(t,this,new Rs(this.id,this.length)):this.content=new qg(this.length)}write(t,n){const o=n>0?M0(this.id.client,this.id.clock+n-1):this.origin,r=this.rightOrigin,s=this.parentSub,i=this.content.getRef()&Bx|(o===null?0:es)|(r===null?0:Wc)|(s===null?0:vg);if(t.writeInfo(i),o!==null&&t.writeLeftID(o),r!==null&&t.writeRightID(r),o===null&&r===null){const c=this.parent;if(c._item!==void 0){const l=c._item;if(l===null){const u=_8e(c);t.writeParentInfo(!0),t.writeString(u)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else c.constructor===String?(t.writeParentInfo(!0),t.writeString(c)):c.constructor===Hb?(t.writeParentInfo(!1),t.writeLeftID(c)):La();s!==null&&t.writeString(s)}this.content.write(t,n)}};const J1e=(e,t)=>yWe[t&Bx](e),yWe=[()=>{La()},iWe,uWe,sWe,pWe,cWe,lWe,AWe,dWe,aWe,()=>{La()}],vWe=10;class Ws extends rN{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){La()}write(t,n){t.writeInfo(vWe),Wt(t.restEncoder,this.length-n)}getMissing(t,n){return null}}const eoe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},toe="__ $YJS$ __";eoe[toe]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");eoe[toe]=!0;const pf=e=>v2((t,n)=>{e.onerror=o=>n(new Error(o.target.error)),e.onsuccess=o=>t(o.target.result)}),xWe=(e,t)=>v2((n,o)=>{const r=indexedDB.open(e);r.onupgradeneeded=s=>t(s.target.result),r.onerror=s=>o(Ri(s.target.error)),r.onsuccess=s=>{const i=s.target.result;i.onversionchange=()=>{i.close()},n(i)}}),_We=e=>pf(indexedDB.deleteDatabase(e)),wWe=(e,t)=>t.forEach(n=>e.createObjectStore.apply(e,n)),oM=(e,t,n="readwrite")=>{const o=e.transaction(t,n);return t.map(r=>EWe(o,r))},noe=(e,t)=>pf(e.count(t)),kWe=(e,t)=>pf(e.get(t)),ooe=(e,t)=>pf(e.delete(t)),qWe=(e,t,n)=>pf(e.put(t,n)),h8=(e,t)=>pf(e.add(t)),SWe=(e,t,n)=>pf(e.getAll(t,n)),CWe=(e,t,n)=>{let o=null;return TWe(e,t,r=>(o=r,!1),n).then(()=>o)},RWe=(e,t=null)=>CWe(e,t,"prev"),WWe=(e,t)=>v2((n,o)=>{e.onerror=o,e.onsuccess=async r=>{const s=r.target.result;if(s===null||await t(s)===!1)return n();s.continue()}}),TWe=(e,t,n,o="next")=>WWe(e.openKeyCursor(t,o),r=>n(r.key)),EWe=(e,t)=>e.objectStore(t),BWe=(e,t)=>IDBKeyRange.upperBound(e,t),NWe=(e,t)=>IDBKeyRange.lowerBound(e,t),J6="custom",roe="updates",soe=500,ioe=(e,t=()=>{},n=()=>{})=>{const[o]=oM(e.db,[roe]);return SWe(o,NWe(e._dbref,!1)).then(r=>{e._destroyed||(t(o),ln(e.doc,()=>{r.forEach(s=>q1e(e.doc,s))},e,!1),n(o))}).then(()=>RWe(o).then(r=>{e._dbref=r+1})).then(()=>noe(o).then(r=>{e._dbsize=r})).then(()=>o)},LWe=(e,t=!0)=>ioe(e).then(n=>{(t||e._dbsize>=soe)&&h8(n,ZB(e.doc)).then(()=>ooe(n,BWe(e._dbref,!0))).then(()=>noe(n).then(o=>{e._dbsize=o}))});class jWe extends Hz{constructor(t,n){super(),this.doc=n,this.name=t,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=xWe(t,o=>wWe(o,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=v2(o=>this.on("synced",()=>o(this))),this._db.then(o=>{this.db=o,ioe(this,i=>h8(i,ZB(n)),()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(o,r)=>{if(this.db&&r!==this){const[s]=oM(this.db,[roe]);h8(s,o),++this._dbsize>=soe&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{LWe(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},n.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),n.on("destroy",this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then(t=>{t.close()})}clearData(){return this.destroy().then(()=>{_We(this.name)})}get(t){return this._db.then(n=>{const[o]=oM(n,[J6],"readonly");return kWe(o,t)})}set(t,n){return this._db.then(o=>{const[r]=oM(o,[J6]);return qWe(r,n,t)})}del(t){return this._db.then(n=>{const[o]=oM(n,[J6]);return ooe(o,t)})}}function PWe(e,t,n){const o=`${t}-${e}`,r=new jWe(o,n);return new Promise(s=>{r.on("synced",()=>{s(()=>r.destroy())})})}const IWe=1200,DWe=2500,gv=3e4,m8=e=>{if(e.shouldConnect&&e.ws===null){const t=new WebSocket(e.url),n=e.binaryType;let o=null;n&&(t.binaryType=n),e.ws=t,e.connecting=!0,e.connected=!1,t.onmessage=i=>{e.lastMessageReceived=Kc();const c=i.data,l=typeof c=="string"?JSON.parse(c):c;l&&l.type==="pong"&&(clearTimeout(o),o=setTimeout(s,gv/2)),e.emit("message",[l,e])};const r=i=>{e.ws!==null&&(e.ws=null,e.connecting=!1,e.connected?(e.connected=!1,e.emit("disconnect",[{type:"disconnect",error:i},e])):e.unsuccessfulReconnects++,setTimeout(m8,NB(YCe(e.unsuccessfulReconnects+1)*IWe,DWe),e)),clearTimeout(o)},s=()=>{e.ws===t&&e.send({type:"ping"})};t.onclose=()=>r(null),t.onerror=i=>r(i),t.onopen=()=>{e.lastMessageReceived=Kc(),e.connecting=!1,e.connected=!0,e.unsuccessfulReconnects=0,e.emit("connect",[{type:"connect"},e]),o=setTimeout(s,gv/2)}}};class FWe extends Hz{constructor(t,{binaryType:n}={}){super(),this.url=t,this.ws=null,this.binaryType=n||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&gvn.key===t&&this.onmessage!==null&&this.onmessage({data:VB(n.newValue||"")}),CRe(this._onChange)}postMessage(t){i1e.setItem(this.room,f1e(HRe(t)))}close(){RRe(this._onChange)}}const VWe=typeof BroadcastChannel>"u"?$We:BroadcastChannel,sN=e=>Fo(aoe,e,()=>{const t=Eu(),n=new VWe(e);return n.onmessage=o=>t.forEach(r=>r(o.data,"broadcastchannel")),{bc:n,subs:t}}),HWe=(e,t)=>(sN(e).subs.add(t),t),UWe=(e,t)=>{const n=sN(e),o=n.subs.delete(t);return o&&n.subs.size===0&&(n.bc.close(),aoe.delete(e)),o},XWe=(e,t,n=null)=>{const o=sN(e);o.bc.postMessage(t),o.subs.forEach(r=>r(t,n))},GWe=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}};function nA(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var coe={exports:{}};(function(e,t){(function(n){e.exports=n()})(function(){var n=Math.floor,o=Math.abs,r=Math.pow;return function(){function s(i,c,l){function u(f,b){if(!c[f]){if(!i[f]){var h=typeof nA=="function"&&nA;if(!b&&h)return h(f,!0);if(d)return d(f,!0);var g=new Error("Cannot find module '"+f+"'");throw g.code="MODULE_NOT_FOUND",g}var z=c[f]={exports:{}};i[f][0].call(z.exports,function(y){var x=i[f][1][y];return u(x||y)},z,z.exports,s,i,c,l)}return c[f].exports}for(var d=typeof nA=="function"&&nA,p=0;p>16,S[C++]=255&A>>8,S[C++]=255&A;return q===2&&(A=g[M.charCodeAt(_)]<<2|g[M.charCodeAt(_+1)]>>4,S[C++]=255&A),q===1&&(A=g[M.charCodeAt(_)]<<10|g[M.charCodeAt(_+1)]<<4|g[M.charCodeAt(_+2)]>>2,S[C++]=255&A>>8,S[C++]=255&A),S}function p(M){return h[63&M>>18]+h[63&M>>12]+h[63&M>>6]+h[63&M]}function f(M,A,_){for(var w,k=[],q=A;q<_;q+=3)w=(16711680&M[q]<<16)+(65280&M[q+1]<<8)+(255&M[q+2]),k.push(p(w));return k.join("")}function b(M){for(var A,_=M.length,w=_%3,k=[],q=16383,S=0,C=_-w;SC?C:S+q));return w===1?(A=M[_-1],k.push(h[A>>2]+h[63&A<<4]+"==")):w===2&&(A=(M[_-2]<<8)+M[_-1],k.push(h[A>>10]+h[63&A>>4]+h[63&A<<2]+"=")),k.join("")}c.byteLength=function(M){var A=l(M),_=A[0],w=A[1];return 3*(_+w)/4-w},c.toByteArray=d,c.fromByteArray=b;for(var h=[],g=[],z=typeof Uint8Array>"u"?Array:Uint8Array,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=0,v=y.length;xR)throw new RangeError('The value "'+R+'" is invalid for option "size"')}function h(R,j,V){return b(R),0>=R||j===void 0?d(R):typeof V=="string"?d(R).fill(j,V):d(R).fill(j)}function g(R){return b(R),d(0>R?0:0|M(R))}function z(R,j){if((typeof j!="string"||j==="")&&(j="utf8"),!p.isEncoding(j))throw new TypeError("Unknown encoding: "+j);var V=0|A(R,j),de=d(V),ge=de.write(R,j);return ge!==V&&(de=de.slice(0,ge)),de}function y(R){for(var j=0>R.length?0:0|M(R.length),V=d(j),de=0;dej||R.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|R}function A(R,j){if(p.isBuffer(R))return R.length;if(ArrayBuffer.isView(R)||G(R,ArrayBuffer))return R.byteLength;if(typeof R!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof R);var V=R.length,de=2>>1;case"base64":return K(R).length;default:if(ge)return de?-1:be(R).length;j=(""+j).toLowerCase(),ge=!0}}function _(R,j,V){var de=!1;if((j===void 0||0>j)&&(j=0),j>this.length||((V===void 0||V>this.length)&&(V=this.length),0>=V)||(V>>>=0,j>>>=0,V<=j))return"";for(R||(R="utf8");;)switch(R){case"hex":return U(this,j,V);case"utf8":case"utf-8":return L(this,j,V);case"ascii":return P(this,j,V);case"latin1":case"binary":return H(this,j,V);case"base64":return E(this,j,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,j,V);default:if(de)throw new TypeError("Unknown encoding: "+R);R=(R+"").toLowerCase(),de=!0}}function w(R,j,V){var de=R[j];R[j]=R[V],R[V]=de}function k(R,j,V,de,ge){if(R.length===0)return-1;if(typeof V=="string"?(de=V,V=0):2147483647V&&(V=-2147483648),V=+V,re(V)&&(V=ge?0:R.length-1),0>V&&(V=R.length+V),V>=R.length){if(ge)return-1;V=R.length-1}else if(0>V)if(ge)V=0;else return-1;if(typeof j=="string"&&(j=p.from(j,de)),p.isBuffer(j))return j.length===0?-1:q(R,j,V,de,ge);if(typeof j=="number")return j&=255,typeof Uint8Array.prototype.indexOf=="function"?ge?Uint8Array.prototype.indexOf.call(R,j,V):Uint8Array.prototype.lastIndexOf.call(R,j,V):q(R,[j],V,de,ge);throw new TypeError("val must be string, number or Buffer")}function q(R,j,V,de,ge){function ve(Ue,Xe){return Ne===1?Ue[Xe]:Ue.readUInt16BE(Xe*Ne)}var Ne=1,et=R.length,mt=j.length;if(de!==void 0&&(de=(de+"").toLowerCase(),de==="ucs2"||de==="ucs-2"||de==="utf16le"||de==="utf-16le")){if(2>R.length||2>j.length)return-1;Ne=2,et/=2,mt/=2,V/=2}var Mt;if(ge){var Ke=-1;for(Mt=V;Mtet&&(V=et-mt),Mt=V;0<=Mt;Mt--){for(var Nt=!0,zt=0;ztge&&(de=ge)):de=ge;var ve=j.length;de>ve/2&&(de=ve/2);for(var Ne,et=0;etve&&(Ne=ve):et===2?(mt=R[ge+1],(192&mt)==128&&(Nt=(31&ve)<<6|63&mt,127Nt||57343Nt&&(Ne=Nt)))}Ne===null?(Ne=65533,et=1):65535>>10),Ne=56320|1023&Ne),de.push(Ne),ge+=et}return I(de)}function I(R){var j=R.length;if(j<=4096)return l.apply(String,R);for(var V="",de=0;dej)&&(j=0),(!V||0>V||V>de)&&(V=de);for(var ge="",ve=j;veR)throw new RangeError("offset is not uint");if(R+j>V)throw new RangeError("Trying to access beyond buffer length")}function ne(R,j,V,de,ge,ve){if(!p.isBuffer(R))throw new TypeError('"buffer" argument must be a Buffer instance');if(j>ge||jR.length)throw new RangeError("Index out of range")}function oe(R,j,V,de){if(V+de>R.length)throw new RangeError("Index out of range");if(0>V)throw new RangeError("Index out of range")}function Y(R,j,V,de,ge){return j=+j,V>>>=0,ge||oe(R,j,V,4),he.write(R,j,V,de,23,4),V+4}function ee(R,j,V,de,ge){return j=+j,V>>>=0,ge||oe(R,j,V,8),he.write(R,j,V,de,52,8),V+8}function ie(R){if(R=R.split("=")[0],R=R.trim().replace(Q,""),2>R.length)return"";for(;R.length%4!=0;)R+="=";return R}function se(R){return 16>R?"0"+R.toString(16):R.toString(16)}function be(R,j){j=j||1/0;for(var V,de=R.length,ge=null,ve=[],Ne=0;NeV){if(!ge){if(56319V){-1<(j-=3)&&ve.push(239,191,189),ge=V;continue}V=(ge-55296<<10|V-56320)+65536}else ge&&-1<(j-=3)&&ve.push(239,191,189);if(ge=null,128>V){if(0>(j-=1))break;ve.push(V)}else if(2048>V){if(0>(j-=2))break;ve.push(192|V>>6,128|63&V)}else if(65536>V){if(0>(j-=3))break;ve.push(224|V>>12,128|63&V>>6,128|63&V)}else if(1114112>V){if(0>(j-=4))break;ve.push(240|V>>18,128|63&V>>12,128|63&V>>6,128|63&V)}else throw new Error("Invalid code point")}return ve}function ye(R){for(var j=[],V=0;V(j-=2));++Ne)V=R.charCodeAt(Ne),de=V>>8,ge=V%256,ve.push(ge),ve.push(de);return ve}function K(R){return Me.toByteArray(ie(R))}function pe(R,j,V,de){for(var ge=0;ge=j.length||ge>=R.length);++ge)j[ge+V]=R[ge];return ge}function G(R,j){return R instanceof j||R!=null&&R.constructor!=null&&R.constructor.name!=null&&R.constructor.name===j.name}function re(R){return R!==R}var Me=s("base64-js"),he=s("ieee754");c.Buffer=p,c.SlowBuffer=function(R){return+R!=R&&(R=0),p.alloc(+R)},c.INSPECT_MAX_BYTES=50,c.kMaxLength=2147483647,p.TYPED_ARRAY_SUPPORT=function(){try{var R=new Uint8Array(1);return R.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},R.foo()===42}catch{return!1}}(),p.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){return p.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){return p.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&p[Symbol.species]===p&&Object.defineProperty(p,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),p.poolSize=8192,p.from=function(R,j,V){return f(R,j,V)},p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,p.alloc=function(R,j,V){return h(R,j,V)},p.allocUnsafe=function(R){return g(R)},p.allocUnsafeSlow=function(R){return g(R)},p.isBuffer=function(R){return R!=null&&R._isBuffer===!0&&R!==p.prototype},p.compare=function(R,j){if(G(R,Uint8Array)&&(R=p.from(R,R.offset,R.byteLength)),G(j,Uint8Array)&&(j=p.from(j,j.offset,j.byteLength)),!p.isBuffer(R)||!p.isBuffer(j))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(R===j)return 0;for(var V=R.length,de=j.length,ge=0,ve=u(V,de);gej&&(R+=" ... "),""},p.prototype.compare=function(R,j,V,de,ge){if(G(R,Uint8Array)&&(R=p.from(R,R.offset,R.byteLength)),!p.isBuffer(R))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof R);if(j===void 0&&(j=0),V===void 0&&(V=R?R.length:0),de===void 0&&(de=0),ge===void 0&&(ge=this.length),0>j||V>R.length||0>de||ge>this.length)throw new RangeError("out of range index");if(de>=ge&&j>=V)return 0;if(de>=ge)return-1;if(j>=V)return 1;if(j>>>=0,V>>>=0,de>>>=0,ge>>>=0,this===R)return 0;for(var ve=ge-de,Ne=V-j,et=u(ve,Ne),mt=this.slice(de,ge),Mt=R.slice(j,V),Ke=0;Ke>>=0,isFinite(V)?(V>>>=0,de===void 0&&(de="utf8")):(de=V,V=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ge=this.length-j;if((V===void 0||V>ge)&&(V=ge),0V||0>j)||j>this.length)throw new RangeError("Attempt to write outside buffer bounds");de||(de="utf8");for(var ve=!1;;)switch(de){case"hex":return S(this,R,j,V);case"utf8":case"utf-8":return C(this,R,j,V);case"ascii":return T(this,R,j,V);case"latin1":case"binary":return W(this,R,j,V);case"base64":return B(this,R,j,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,R,j,V);default:if(ve)throw new TypeError("Unknown encoding: "+de);de=(""+de).toLowerCase(),ve=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},p.prototype.slice=function(R,j){var V=this.length;R=~~R,j=j===void 0?V:~~j,0>R?(R+=V,0>R&&(R=0)):R>V&&(R=V),0>j?(j+=V,0>j&&(j=0)):j>V&&(j=V),j>>=0,j>>>=0,V||Z(R,j,this.length);for(var de=this[R],ge=1,ve=0;++ve>>=0,j>>>=0,V||Z(R,j,this.length);for(var de=this[R+--j],ge=1;0>>=0,j||Z(R,1,this.length),this[R]},p.prototype.readUInt16LE=function(R,j){return R>>>=0,j||Z(R,2,this.length),this[R]|this[R+1]<<8},p.prototype.readUInt16BE=function(R,j){return R>>>=0,j||Z(R,2,this.length),this[R]<<8|this[R+1]},p.prototype.readUInt32LE=function(R,j){return R>>>=0,j||Z(R,4,this.length),(this[R]|this[R+1]<<8|this[R+2]<<16)+16777216*this[R+3]},p.prototype.readUInt32BE=function(R,j){return R>>>=0,j||Z(R,4,this.length),16777216*this[R]+(this[R+1]<<16|this[R+2]<<8|this[R+3])},p.prototype.readIntLE=function(R,j,V){R>>>=0,j>>>=0,V||Z(R,j,this.length);for(var de=this[R],ge=1,ve=0;++ve=ge&&(de-=r(2,8*j)),de},p.prototype.readIntBE=function(R,j,V){R>>>=0,j>>>=0,V||Z(R,j,this.length);for(var de=j,ge=1,ve=this[R+--de];0=ge&&(ve-=r(2,8*j)),ve},p.prototype.readInt8=function(R,j){return R>>>=0,j||Z(R,1,this.length),128&this[R]?-1*(255-this[R]+1):this[R]},p.prototype.readInt16LE=function(R,j){R>>>=0,j||Z(R,2,this.length);var V=this[R]|this[R+1]<<8;return 32768&V?4294901760|V:V},p.prototype.readInt16BE=function(R,j){R>>>=0,j||Z(R,2,this.length);var V=this[R+1]|this[R]<<8;return 32768&V?4294901760|V:V},p.prototype.readInt32LE=function(R,j){return R>>>=0,j||Z(R,4,this.length),this[R]|this[R+1]<<8|this[R+2]<<16|this[R+3]<<24},p.prototype.readInt32BE=function(R,j){return R>>>=0,j||Z(R,4,this.length),this[R]<<24|this[R+1]<<16|this[R+2]<<8|this[R+3]},p.prototype.readFloatLE=function(R,j){return R>>>=0,j||Z(R,4,this.length),he.read(this,R,!0,23,4)},p.prototype.readFloatBE=function(R,j){return R>>>=0,j||Z(R,4,this.length),he.read(this,R,!1,23,4)},p.prototype.readDoubleLE=function(R,j){return R>>>=0,j||Z(R,8,this.length),he.read(this,R,!0,52,8)},p.prototype.readDoubleBE=function(R,j){return R>>>=0,j||Z(R,8,this.length),he.read(this,R,!1,52,8)},p.prototype.writeUIntLE=function(R,j,V,de){if(R=+R,j>>>=0,V>>>=0,!de){var ge=r(2,8*V)-1;ne(this,R,j,V,ge,0)}var ve=1,Ne=0;for(this[j]=255&R;++Ne>>=0,V>>>=0,!de){var ge=r(2,8*V)-1;ne(this,R,j,V,ge,0)}var ve=V-1,Ne=1;for(this[j+ve]=255&R;0<=--ve&&(Ne*=256);)this[j+ve]=255&R/Ne;return j+V},p.prototype.writeUInt8=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,1,255,0),this[j]=255&R,j+1},p.prototype.writeUInt16LE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,2,65535,0),this[j]=255&R,this[j+1]=R>>>8,j+2},p.prototype.writeUInt16BE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,2,65535,0),this[j]=R>>>8,this[j+1]=255&R,j+2},p.prototype.writeUInt32LE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,4,4294967295,0),this[j+3]=R>>>24,this[j+2]=R>>>16,this[j+1]=R>>>8,this[j]=255&R,j+4},p.prototype.writeUInt32BE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,4,4294967295,0),this[j]=R>>>24,this[j+1]=R>>>16,this[j+2]=R>>>8,this[j+3]=255&R,j+4},p.prototype.writeIntLE=function(R,j,V,de){if(R=+R,j>>>=0,!de){var ge=r(2,8*V-1);ne(this,R,j,V,ge-1,-ge)}var ve=0,Ne=1,et=0;for(this[j]=255&R;++veR&&et===0&&this[j+ve-1]!==0&&(et=1),this[j+ve]=255&(R/Ne>>0)-et;return j+V},p.prototype.writeIntBE=function(R,j,V,de){if(R=+R,j>>>=0,!de){var ge=r(2,8*V-1);ne(this,R,j,V,ge-1,-ge)}var ve=V-1,Ne=1,et=0;for(this[j+ve]=255&R;0<=--ve&&(Ne*=256);)0>R&&et===0&&this[j+ve+1]!==0&&(et=1),this[j+ve]=255&(R/Ne>>0)-et;return j+V},p.prototype.writeInt8=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,1,127,-128),0>R&&(R=255+R+1),this[j]=255&R,j+1},p.prototype.writeInt16LE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,2,32767,-32768),this[j]=255&R,this[j+1]=R>>>8,j+2},p.prototype.writeInt16BE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,2,32767,-32768),this[j]=R>>>8,this[j+1]=255&R,j+2},p.prototype.writeInt32LE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,4,2147483647,-2147483648),this[j]=255&R,this[j+1]=R>>>8,this[j+2]=R>>>16,this[j+3]=R>>>24,j+4},p.prototype.writeInt32BE=function(R,j,V){return R=+R,j>>>=0,V||ne(this,R,j,4,2147483647,-2147483648),0>R&&(R=4294967295+R+1),this[j]=R>>>24,this[j+1]=R>>>16,this[j+2]=R>>>8,this[j+3]=255&R,j+4},p.prototype.writeFloatLE=function(R,j,V){return Y(this,R,j,!0,V)},p.prototype.writeFloatBE=function(R,j,V){return Y(this,R,j,!1,V)},p.prototype.writeDoubleLE=function(R,j,V){return ee(this,R,j,!0,V)},p.prototype.writeDoubleBE=function(R,j,V){return ee(this,R,j,!1,V)},p.prototype.copy=function(R,j,V,de){if(!p.isBuffer(R))throw new TypeError("argument should be a Buffer");if(V||(V=0),de||de===0||(de=this.length),j>=R.length&&(j=R.length),j||(j=0),0j)throw new RangeError("targetStart out of bounds");if(0>V||V>=this.length)throw new RangeError("Index out of range");if(0>de)throw new RangeError("sourceEnd out of bounds");de>this.length&&(de=this.length),R.length-jge||de==="latin1")&&(R=ge)}}else typeof R=="number"&&(R&=255);if(0>j||this.length>>=0,V=V===void 0?this.length:V>>>0,R||(R=0);var ve;if(typeof R=="number")for(ve=j;ve{g==="%%"||(b++,g==="%c"&&(h=b))}),p.splice(h,0,f)},c.save=function(p){try{p?c.storage.setItem("debug",p):c.storage.removeItem("debug")}catch{}},c.load=u,c.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},c.storage=function(){try{return localStorage}catch{}}(),c.destroy=(()=>{let p=!1;return()=>{p||(p=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),c.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],c.log=console.debug||console.log||(()=>{}),i.exports=s("./common")(c);const{formatters:d}=i.exports;d.j=function(p){try{return JSON.stringify(p)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}}).call(this)}).call(this,s("_process"))},{"./common":5,_process:12}],5:[function(s,i){i.exports=function(c){function l(p){function f(...g){if(!f.enabled)return;const z=f,y=+new Date,x=y-(b||y);z.diff=x,z.prev=b,z.curr=y,b=y,g[0]=l.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let v=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(A,_)=>{if(A==="%%")return"%";v++;const w=l.formatters[_];if(typeof w=="function"){const k=g[v];A=w.call(z,k),g.splice(v,1),v--}return A}),l.formatArgs.call(z,g),(z.log||l.log).apply(z,g)}let b,h=null;return f.namespace=p,f.useColors=l.useColors(),f.color=l.selectColor(p),f.extend=u,f.destroy=l.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>h===null?l.enabled(p):h,set:g=>{h=g}}),typeof l.init=="function"&&l.init(f),f}function u(p,f){const b=l(this.namespace+(typeof f>"u"?":":f)+p);return b.log=this.log,b}function d(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}return l.debug=l,l.default=l,l.coerce=function(p){return p instanceof Error?p.stack||p.message:p},l.disable=function(){const p=[...l.names.map(d),...l.skips.map(d).map(f=>"-"+f)].join(",");return l.enable(""),p},l.enable=function(p){l.save(p),l.names=[],l.skips=[];let f;const b=(typeof p=="string"?p:"").split(/[\s,]+/),h=b.length;for(f=0;f{l[p]=c[p]}),l.names=[],l.skips=[],l.formatters={},l.selectColor=function(p){let f=0;for(let b=0;bB&&!E.warned){E.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+E.length+" "+(C+" listeners added. Use emitter.setMaxListeners() to increase limit"));L.name="MaxListenersExceededWarning",L.emitter=S,L.type=C,L.count=E.length,c(L)}return S}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function b(S,C,T){var W={fired:!1,wrapFn:void 0,target:S,type:C,listener:T},B=f.bind(W);return B.listener=T,W.wrapFn=B,B}function h(S,C,T){var W=S._events;if(W===void 0)return[];var B=W[C];return B===void 0?[]:typeof B=="function"?T?[B.listener||B]:[B]:T?x(B):z(B,B.length)}function g(S){var C=this._events;if(C!==void 0){var T=C[S];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}function z(S,C){for(var T=Array(C),W=0;WS||k(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");q=S}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(S){if(typeof S!="number"||0>S||k(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this},l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(S){for(var C=[],T=1;TB)return this;B===0?T.shift():y(T,B),T.length===1&&(W[S]=T[0]),W.removeListener!==void 0&&this.emit("removeListener",S,E||C)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(S){var C,T,W;if(T=this._events,T===void 0)return this;if(T.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):T[S]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete T[S]),this;if(arguments.length===0){var B,N=Object.keys(T);for(W=0;W"u")return null;var c={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return c.RTCPeerConnection?c:null}},{}],9:[function(s,i,c){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */c.read=function(l,u,d,p,f){var b,h,g=8*f-p-1,z=(1<>1,x=-7,v=d?f-1:0,M=d?-1:1,A=l[u+v];for(v+=M,b=A&(1<<-x)-1,A>>=-x,x+=g;0>=-x,x+=p;0>1,_=f===23?r(2,-24)-r(2,-77):0,w=p?0:b-1,k=p?1:-1,q=0>u||u===0&&0>1/u?1:0;for(u=o(u),isNaN(u)||u===1/0?(g=isNaN(u)?1:0,h=M):(h=n(x(u)/y),1>u*(z=r(2,-h))&&(h--,z*=2),u+=1<=h+A?_/z:_*r(2,1-A),2<=u*z&&(h++,z/=2),h+A>=M?(g=0,h=M):1<=h+A?(g=(u*z-1)*r(2,f),h+=A):(g=u*r(2,A-1)*r(2,f),h=0));8<=f;l[d+w]=255&g,w+=k,g/=256,f-=8);for(h=h<=1.5*h?"s":"")}i.exports=function(f,b){b=b||{};var h=typeof f;if(h=="string"&&0 */let l;i.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?c:window):u=>(l||(l=Promise.resolve())).then(u).catch(d=>setTimeout(()=>{throw d},0))}).call(this)}).call(this,typeof In>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:In)},{}],14:[function(s,i){(function(c,l){(function(){var u=s("safe-buffer").Buffer,d=l.crypto||l.msCrypto;i.exports=d&&d.getRandomValues?function(p,f){if(p>4294967295)throw new RangeError("requested too many random bytes");var b=u.allocUnsafe(p);if(0"u"?typeof self>"u"?typeof window>"u"?{}:window:self:In)},{_process:12,"safe-buffer":30}],15:[function(s,i){function c(h,g){h.prototype=Object.create(g.prototype),h.prototype.constructor=h,h.__proto__=g}function l(h,g,z){function y(v,M,A){return typeof g=="string"?g:g(v,M,A)}z||(z=Error);var x=function(v){function M(A,_,w){return v.call(this,y(A,_,w))||this}return c(M,v),M}(z);x.prototype.name=z.name,x.prototype.code=h,b[h]=x}function u(h,g){if(Array.isArray(h)){var z=h.length;return h=h.map(function(y){return y+""}),2h.length)&&(z=h.length),h.substring(z-g.length,z)===g}function f(h,g,z){return typeof z!="number"&&(z=0),!(z+g.length>h.length)&&h.indexOf(g,z)!==-1}var b={};l("ERR_INVALID_OPT_VALUE",function(h,g){return'The value "'+g+'" is invalid for option "'+h+'"'},TypeError),l("ERR_INVALID_ARG_TYPE",function(h,g,z){var y;typeof g=="string"&&d(g,"not ")?(y="must not be",g=g.replace(/^not /,"")):y="must be";var x;if(p(h," argument"))x="The ".concat(h," ").concat(y," ").concat(u(g,"type"));else{var v=f(h,".")?"property":"argument";x='The "'.concat(h,'" ').concat(v," ").concat(y," ").concat(u(g,"type"))}return x+=". Received type ".concat(typeof z),x},TypeError),l("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),l("ERR_METHOD_NOT_IMPLEMENTED",function(h){return"The "+h+" method is not implemented"}),l("ERR_STREAM_PREMATURE_CLOSE","Premature close"),l("ERR_STREAM_DESTROYED",function(h){return"Cannot call "+h+" after a stream was destroyed"}),l("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),l("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),l("ERR_STREAM_WRITE_AFTER_END","write after end"),l("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),l("ERR_UNKNOWN_ENCODING",function(h){return"Unknown encoding: "+h},TypeError),l("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),i.exports.codes=b},{}],16:[function(s,i){(function(c){(function(){function l(y){return this instanceof l?(f.call(this,y),b.call(this,y),this.allowHalfOpen=!0,void(y&&(y.readable===!1&&(this.readable=!1),y.writable===!1&&(this.writable=!1),y.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u))))):new l(y)}function u(){this._writableState.ended||c.nextTick(d,this)}function d(y){y.end()}var p=Object.keys||function(y){var x=[];for(var v in y)x.push(v);return x};i.exports=l;var f=s("./_stream_readable"),b=s("./_stream_writable");s("inherits")(l,f);for(var h,g=p(b.prototype),z=0;z>>1,Q|=Q>>>2,Q|=Q>>>4,Q|=Q>>>8,Q|=Q>>>16,Q++),Q}function x(Q,R){return 0>=Q||R.length===0&&R.ended?0:R.objectMode?1:Q===Q?(Q>R.highWaterMark&&(R.highWaterMark=y(Q)),Q<=R.length?Q:R.ended?R.length:(R.needReadable=!0,0)):R.flowing&&R.length?R.buffer.head.data.length:R.length}function v(Q,R){if(P("onEofChunk"),!R.ended){if(R.decoder){var j=R.decoder.end();j&&j.length&&(R.buffer.push(j),R.length+=R.objectMode?1:j.length)}R.ended=!0,R.sync?M(Q):(R.needReadable=!1,!R.emittedReadable&&(R.emittedReadable=!0,A(Q)))}}function M(Q){var R=Q._readableState;P("emitReadable",R.needReadable,R.emittedReadable),R.needReadable=!1,R.emittedReadable||(P("emitReadable",R.flowing),R.emittedReadable=!0,c.nextTick(A,Q))}function A(Q){var R=Q._readableState;P("emitReadable_",R.destroyed,R.length,R.ended),!R.destroyed&&(R.length||R.ended)&&(Q.emit("readable"),R.emittedReadable=!1),R.needReadable=!R.flowing&&!R.ended&&R.length<=R.highWaterMark,W(Q)}function _(Q,R){R.readingMore||(R.readingMore=!0,c.nextTick(w,Q,R))}function w(Q,R){for(;!R.reading&&!R.ended&&(R.length=R.length?(j=R.decoder?R.buffer.join(""):R.buffer.length===1?R.buffer.first():R.buffer.concat(R.length),R.buffer.clear()):j=R.buffer.consume(Q,R.decoder),j}function N(Q){var R=Q._readableState;P("endReadable",R.endEmitted),R.endEmitted||(R.ended=!0,c.nextTick(E,R,Q))}function E(Q,R){if(P("endReadableNT",Q.endEmitted,Q.length),!Q.endEmitted&&Q.length===0&&(Q.endEmitted=!0,R.readable=!1,R.emit("end"),Q.autoDestroy)){var j=R._writableState;(!j||j.autoDestroy&&j.finished)&&R.destroy()}}function L(Q,R){for(var j=0,V=Q.length;j=R.highWaterMark)||R.ended))return P("read: emitReadable",R.length,R.ended),R.length===0&&R.ended?N(this):M(this),null;if(Q=x(Q,R),Q===0&&R.ended)return R.length===0&&N(this),null;var V=R.needReadable;P("need readable",V),(R.length===0||R.length-Q"u"?typeof self>"u"?typeof window>"u"?{}:window:self:In)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(s,i){function c(y,x){var v=this._transformState;v.transforming=!1;var M=v.writecb;if(M===null)return this.emit("error",new b);v.writechunk=null,v.writecb=null,x!=null&&this.push(x),M(y);var A=this._readableState;A.reading=!1,(A.needReadable||A.length"u"?typeof self>"u"?typeof window>"u"?{}:window:self:In)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(s,i){(function(c){(function(){function l(k,q,S){return q in k?Object.defineProperty(k,q,{value:S,enumerable:!0,configurable:!0,writable:!0}):k[q]=S,k}function u(k,q){return{value:k,done:q}}function d(k){var q=k[g];if(q!==null){var S=k[A].read();S!==null&&(k[v]=null,k[g]=null,k[z]=null,q(u(S,!1)))}}function p(k){c.nextTick(d,k)}function f(k,q){return function(S,C){k.then(function(){return q[x]?void S(u(void 0,!0)):void q[M](S,C)},C)}}var b,h=s("./end-of-stream"),g=Symbol("lastResolve"),z=Symbol("lastReject"),y=Symbol("error"),x=Symbol("ended"),v=Symbol("lastPromise"),M=Symbol("handlePromise"),A=Symbol("stream"),_=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((b={get stream(){return this[A]},next:function(){var k=this,q=this[y];if(q!==null)return Promise.reject(q);if(this[x])return Promise.resolve(u(void 0,!0));if(this[A].destroyed)return new Promise(function(W,B){c.nextTick(function(){k[y]?B(k[y]):W(u(void 0,!0))})});var S,C=this[v];if(C)S=new Promise(f(C,this));else{var T=this[A].read();if(T!==null)return Promise.resolve(u(T,!1));S=new Promise(this[M])}return this[v]=S,S}},l(b,Symbol.asyncIterator,function(){return this}),l(b,"return",function(){var k=this;return new Promise(function(q,S){k[A].destroy(null,function(C){return C?void S(C):void q(u(void 0,!0))})})}),b),_);i.exports=function(k){var q,S=Object.create(w,(q={},l(q,A,{value:k,writable:!0}),l(q,g,{value:null,writable:!0}),l(q,z,{value:null,writable:!0}),l(q,y,{value:null,writable:!0}),l(q,x,{value:k._readableState.endEmitted,writable:!0}),l(q,M,{value:function(C,T){var W=S[A].read();W?(S[v]=null,S[g]=null,S[z]=null,C(u(W,!1))):(S[g]=C,S[z]=T)},writable:!0}),q));return S[v]=null,h(k,function(C){if(C&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"){var T=S[z];return T!==null&&(S[v]=null,S[g]=null,S[z]=null,T(C)),void(S[y]=C)}var W=S[g];W!==null&&(S[v]=null,S[g]=null,S[z]=null,W(u(void 0,!0))),S[x]=!0}),k.on("readable",p.bind(null,S)),S}}).call(this)}).call(this,s("_process"))},{"./end-of-stream":24,_process:12}],22:[function(s,i){function c(v,M){var A=Object.keys(v);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(v);M&&(_=_.filter(function(w){return Object.getOwnPropertyDescriptor(v,w).enumerable})),A.push.apply(A,_)}return A}function l(v){for(var M,A=1;A>>0),_=this.head,w=0;_;)b(_.data,A,w),w+=_.data.length,_=_.next;return A}},{key:"consume",value:function(M,A){var _;return Mk.length?k.length:M;if(w+=q===k.length?k:k.slice(0,M),M-=q,M===0){q===k.length?(++_,this.head=A.next?A.next:this.tail=null):(this.head=A,A.data=k.slice(q));break}++_}return this.length-=_,w}},{key:"_getBuffer",value:function(M){var A=g.allocUnsafe(M),_=this.head,w=1;for(_.data.copy(A),M-=_.data.length;_=_.next;){var k=_.data,q=M>k.length?k.length:M;if(k.copy(A,A.length-M,0,q),M-=q,M===0){q===k.length?(++w,this.head=_.next?_.next:this.tail=null):(this.head=_,_.data=k.slice(q));break}++w}return this.length-=w,A}},{key:x,value:function(M,A){return y(this,l({},A,{depth:0,customInspect:!1}))}}]),v}()},{buffer:3,util:2}],23:[function(s,i){(function(c){(function(){function l(p,f){d(p,f),u(p)}function u(p){p._writableState&&!p._writableState.emitClose||p._readableState&&!p._readableState.emitClose||p.emit("close")}function d(p,f){p.emit("error",f)}i.exports={destroy:function(p,f){var b=this,h=this._readableState&&this._readableState.destroyed,g=this._writableState&&this._writableState.destroyed;return h||g?(f?f(p):p&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,c.nextTick(d,this,p)):c.nextTick(d,this,p)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(p||null,function(z){!f&&z?b._writableState?b._writableState.errorEmitted?c.nextTick(u,b):(b._writableState.errorEmitted=!0,c.nextTick(l,b,z)):c.nextTick(l,b,z):f?(c.nextTick(u,b),f(z)):c.nextTick(u,b)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(p,f){var b=p._readableState,h=p._writableState;b&&b.autoDestroy||h&&h.autoDestroy?p.destroy(f):p.emit("error",f)}}}).call(this)}).call(this,s("_process"))},{_process:12}],24:[function(s,i){function c(f){var b=!1;return function(){if(!b){b=!0;for(var h=arguments.length,g=Array(h),z=0;zv.length)throw new z("streams");var _,w=v.map(function(k,q){var S=qb){var h=f?p:"highWaterMark";throw new l(h,b)}return n(b)}return u.objectMode?16:16384}}},{"../../../errors":15}],28:[function(s,i){i.exports=s("events").EventEmitter},{events:7}],29:[function(s,i,c){c=i.exports=s("./lib/_stream_readable.js"),c.Stream=c,c.Readable=c,c.Writable=s("./lib/_stream_writable.js"),c.Duplex=s("./lib/_stream_duplex.js"),c.Transform=s("./lib/_stream_transform.js"),c.PassThrough=s("./lib/_stream_passthrough.js"),c.finished=s("./lib/internal/streams/end-of-stream.js"),c.pipeline=s("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(s,i,c){function l(f,b){for(var h in f)b[h]=f[h]}function u(f,b,h){return p(f,b,h)}/*! safe-buffer. MIT License. Feross Aboukhadijeh */var d=s("buffer"),p=d.Buffer;p.from&&p.alloc&&p.allocUnsafe&&p.allocUnsafeSlow?i.exports=d:(l(d,c),c.Buffer=u),u.prototype=Object.create(p.prototype),l(p,u),u.from=function(f,b,h){if(typeof f=="number")throw new TypeError("Argument must not be a number");return p(f,b,h)},u.alloc=function(f,b,h){if(typeof f!="number")throw new TypeError("Argument must be a number");var g=p(f);return b===void 0?g.fill(0):typeof h=="string"?g.fill(b,h):g.fill(b),g},u.allocUnsafe=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return p(f)},u.allocUnsafeSlow=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return d.SlowBuffer(f)}},{buffer:3}],31:[function(s,i,c){function l(w){if(!w)return"utf8";for(var k;;)switch(w){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return w;default:if(k)return;w=(""+w).toLowerCase(),k=!0}}function u(w){var k=l(w);if(typeof k!="string"&&(A.isEncoding===_||!_(w)))throw new Error("Unknown encoding: "+w);return k||w}function d(w){this.encoding=u(w);var k;switch(this.encoding){case"utf16le":this.text=g,this.end=z,k=4;break;case"utf8":this.fillLast=h,k=4;break;case"base64":this.text=y,this.end=x,k=3;break;default:return this.write=v,void(this.end=M)}this.lastNeed=0,this.lastTotal=0,this.lastChar=A.allocUnsafe(k)}function p(w){return 127>=w?0:w>>5==6?2:w>>4==14?3:w>>3==30?4:w>>6==2?-1:-2}function f(w,k,q){var S=k.length-1;if(S=S)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1],q.slice(0,-1)}return q}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=w[w.length-1],w.toString("utf16le",k,w.length-1)}function z(w){var k=w&&w.length?this.write(w):"";if(this.lastNeed){var q=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,q)}return k}function y(w,k){var q=(w.length-k)%3;return q==0?w.toString("base64",k):(this.lastNeed=3-q,this.lastTotal=3,q==1?this.lastChar[0]=w[w.length-1]:(this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1]),w.toString("base64",k,w.length-q))}function x(w){var k=w&&w.length?this.write(w):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function v(w){return w.toString(this.encoding)}function M(w){return w&&w.length?this.write(w):""}var A=s("safe-buffer").Buffer,_=A.isEncoding||function(w){switch(w=""+w,w&&w.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};c.StringDecoder=d,d.prototype.write=function(w){if(w.length===0)return"";var k,q;if(this.lastNeed){if(k=this.fillLast(w),k===void 0)return"";q=this.lastNeed,this.lastNeed=0}else q=0;return q"u"?typeof self>"u"?typeof window>"u"?{}:window:self:In)},{}],"/":[function(s,i){function c(x){return x.replace(/a=ice-options:trickle\s\n/g,"")}function l(x){console.warn(x)}/*! simple-peer. MIT License. Feross Aboukhadijeh */const u=s("debug")("simple-peer"),d=s("get-browser-rtc"),p=s("randombytes"),f=s("readable-stream"),b=s("queue-microtask"),h=s("err-code"),{Buffer:g}=s("buffer"),z=65536;class y extends f.Duplex{constructor(v){if(v=Object.assign({allowHalfOpen:!1},v),super(v),this._id=p(4).toString("hex").slice(0,7),this._debug("new peer %o",v),this.channelName=v.initiator?v.channelName||p(20).toString("hex"):null,this.initiator=v.initiator||!1,this.channelConfig=v.channelConfig||y.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},y.config,v.config),this.offerOptions=v.offerOptions||{},this.answerOptions=v.answerOptions||{},this.sdpTransform=v.sdpTransform||(M=>M),this.streams=v.streams||(v.stream?[v.stream]:[]),this.trickle=v.trickle===void 0||v.trickle,this.allowHalfTrickle=v.allowHalfTrickle!==void 0&&v.allowHalfTrickle,this.iceCompleteTimeout=v.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=v.wrtc&&typeof v.wrtc=="object"?v.wrtc:d(),!this._wrtc)throw h(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(M){return void this.destroy(h(M,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=M=>{this._onIceCandidate(M)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(M=>{this.destroy(h(M,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=M=>{this._setupData(M)},this.streams&&this.streams.forEach(M=>{this.addStream(M)}),this._pc.ontrack=M=>{this._onTrack(M)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(v){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof v=="string")try{v=JSON.parse(v)}catch{v={}}this._debug("signal()"),v.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),v.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(v.transceiverRequest.kind,v.transceiverRequest.init)),v.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(v.candidate):this._pendingCandidates.push(v.candidate)),v.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(v)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(M=>{this._addIceCandidate(M)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(M=>{this.destroy(h(M,"ERR_SET_REMOTE_DESCRIPTION"))}),v.sdp||v.candidate||v.renegotiate||v.transceiverRequest||this.destroy(h(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(v){const M=new this._wrtc.RTCIceCandidate(v);this._pc.addIceCandidate(M).catch(A=>{!M.address||M.address.endsWith(".local")?l("Ignoring unsupported ICE candidate."):this.destroy(h(A,"ERR_ADD_ICE_CANDIDATE"))})}send(v){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(v)}}addTransceiver(v,M){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(v,M),this._needsNegotiation()}catch(A){this.destroy(h(A,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:v,init:M}})}}addStream(v){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),v.getTracks().forEach(M=>{this.addTrack(M,v)})}}addTrack(v,M){if(this.destroying)return;if(this.destroyed)throw h(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const A=this._senderMap.get(v)||new Map;let _=A.get(M);if(!_)_=this._pc.addTrack(v,M),A.set(M,_),this._senderMap.set(v,A),this._needsNegotiation();else throw _.removed?h(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):h(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(v,M,A){if(this.destroying)return;if(this.destroyed)throw h(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const _=this._senderMap.get(v),w=_?_.get(A):null;if(!w)throw h(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");M&&this._senderMap.set(M,_),w.replaceTrack==null?this.destroy(h(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):w.replaceTrack(M)}removeTrack(v,M){if(this.destroying)return;if(this.destroyed)throw h(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const A=this._senderMap.get(v),_=A?A.get(M):null;if(!_)throw h(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{_.removed=!0,this._pc.removeTrack(_)}catch(w){w.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(_):this.destroy(h(w,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(v){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),v.getTracks().forEach(M=>{this.removeTrack(M,v)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,b(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(v){this._destroy(v,()=>{})}_destroy(v,M){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",v&&(v.message||v)),b(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",v&&(v.message||v)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,v&&this.emit("error",v),this.emit("close"),M()}))}_setupData(v){if(!v.channel)return this.destroy(h(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=v.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=z),this.channelName=this._channel.label,this._channel.onmessage=A=>{this._onChannelMessage(A)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=A=>{const _=A.error instanceof Error?A.error:new Error(`Datachannel error: ${A.message} ${A.filename}:${A.lineno}:${A.colno}`);this.destroy(h(_,"ERR_DATA_CHANNEL"))};let M=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(M&&this._onChannelClose(),M=!0):M=!1},5e3)}_read(){}_write(v,M,A){if(this.destroyed)return A(h(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(v)}catch(_){return this.destroy(h(_,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>z?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=A):A(null)}else this._debug("write before connect"),this._chunk=v,this._cb=A}_onFinish(){if(!this.destroyed){const v=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?v():this.once("connect",v)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(v=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(v.sdp=c(v.sdp)),v.sdp=this.sdpTransform(v.sdp);const M=()=>{if(!this.destroyed){const A=this._pc.localDescription||v;this._debug("signal"),this.emit("signal",{type:A.type,sdp:A.sdp})}};this._pc.setLocalDescription(v).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?M():this.once("_iceComplete",M))}).catch(A=>{this.destroy(h(A,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(v=>{this.destroy(h(v,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(v=>{v.mid||!v.sender.track||v.requested||(v.requested=!0,this.addTransceiver(v.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(v=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(v.sdp=c(v.sdp)),v.sdp=this.sdpTransform(v.sdp);const M=()=>{if(!this.destroyed){const A=this._pc.localDescription||v;this._debug("signal"),this.emit("signal",{type:A.type,sdp:A.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(v).then(()=>{this.destroyed||(this.trickle||this._iceComplete?M():this.once("_iceComplete",M))}).catch(A=>{this.destroy(h(A,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(v=>{this.destroy(h(v,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(h(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const v=this._pc.iceConnectionState,M=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",v,M),this.emit("iceStateChange",v,M),(v==="connected"||v==="completed")&&(this._pcReady=!0,this._maybeReady()),v==="failed"&&this.destroy(h(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),v==="closed"&&this.destroy(h(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(v){const M=A=>(Object.prototype.toString.call(A.values)==="[object Array]"&&A.values.forEach(_=>{Object.assign(A,_)}),A);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(A=>{const _=[];A.forEach(w=>{_.push(M(w))}),v(null,_)},A=>v(A)):0{if(this.destroyed)return;const _=[];A.result().forEach(w=>{const k={};w.names().forEach(q=>{k[q]=w.stat(q)}),k.id=w.id,k.type=w.type,k.timestamp=w.timestamp,_.push(M(k))}),v(null,_)},A=>v(A)):v(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const v=()=>{this.destroyed||this.getStats((M,A)=>{if(this.destroyed)return;M&&(A=[]);const _={},w={},k={};let q=!1;A.forEach(C=>{(C.type==="remotecandidate"||C.type==="remote-candidate")&&(_[C.id]=C),(C.type==="localcandidate"||C.type==="local-candidate")&&(w[C.id]=C),(C.type==="candidatepair"||C.type==="candidate-pair")&&(k[C.id]=C)});const S=C=>{q=!0;let T=w[C.localCandidateId];T&&(T.ip||T.address)?(this.localAddress=T.ip||T.address,this.localPort=+T.port):T&&T.ipAddress?(this.localAddress=T.ipAddress,this.localPort=+T.portNumber):typeof C.googLocalAddress=="string"&&(T=C.googLocalAddress.split(":"),this.localAddress=T[0],this.localPort=+T[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let W=_[C.remoteCandidateId];W&&(W.ip||W.address)?(this.remoteAddress=W.ip||W.address,this.remotePort=+W.port):W&&W.ipAddress?(this.remoteAddress=W.ipAddress,this.remotePort=+W.portNumber):typeof C.googRemoteAddress=="string"&&(W=C.googRemoteAddress.split(":"),this.remoteAddress=W[0],this.remotePort=+W[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(A.forEach(C=>{C.type==="transport"&&C.selectedCandidatePairId&&S(k[C.selectedCandidatePairId]),(C.type==="googCandidatePair"&&C.googActiveConnection==="true"||(C.type==="candidatepair"||C.type==="candidate-pair")&&C.selected)&&S(C)}),!q&&(!Object.keys(k).length||Object.keys(w).length))return void setTimeout(v,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(T){return this.destroy(h(T,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const C=this._cb;this._cb=null,C(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};v()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>z)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(v=>{this._pc.removeTrack(v),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(v){this.destroyed||(v.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:v.candidate.candidate,sdpMLineIndex:v.candidate.sdpMLineIndex,sdpMid:v.candidate.sdpMid}}):!v.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),v.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(v){if(this.destroyed)return;let M=v.data;M instanceof ArrayBuffer&&(M=g.from(M)),this.push(M)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const v=this._cb;this._cb=null,v(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(v){this.destroyed||v.streams.forEach(M=>{this._debug("on track"),this.emit("track",v.track,M),this._remoteTracks.push({track:v.track,stream:M}),this._remoteStreams.some(A=>A.id===M.id)||(this._remoteStreams.push(M),b(()=>{this._debug("on stream"),this.emit("stream",M)}))})}_debug(){const v=[].slice.call(arguments);v[0]="["+this._id+"] "+v[0],u.apply(null,v)}}y.WEBRTC_SUPPORT=!!d(),y.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},y.channelConfig={},i.exports=y},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})})(coe);var KWe=coe.exports;const YWe=yo(KWe),iN=0,aN=1,loe=2,uoe=(e,t)=>{Wt(e,iN);const n=v8e(t);Qn(e,n)},doe=(e,t,n)=>{Wt(e,aN),Qn(e,ZB(t,n))},ZWe=(e,t,n)=>doe(t,n,P1(e)),poe=(e,t,n)=>{try{q1e(t,P1(e),n)}catch(o){console.error("Caught error while handling a Yjs update",o)}},QWe=(e,t)=>{Wt(e,loe),Qn(e,t)},JWe=poe,eTe=(e,t,n,o)=>{const r=Jt(e);switch(r){case iN:ZWe(e,t,n);break;case aN:poe(e,n,o);break;case loe:JWe(e,n,o);break;default:throw new Error("Unknown message type")}return r},eq=3e4;class tTe extends Hz{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Kc();this.getLocalState()!==null&&eq/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const o=[];this.meta.forEach((r,s)=>{s!==this.clientID&&eq<=n-r.lastUpdated&&this.states.has(s)&&o.push(s)}),o.length>0&&M8(this,o,"timeout")},Na(eq/10)),t.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){const n=this.clientID,o=this.meta.get(n),r=o===void 0?0:o.clock+1,s=this.states.get(n);t===null?this.states.delete(n):this.states.set(n,t),this.meta.set(n,{clock:r,lastUpdated:Kc()});const i=[],c=[],l=[],u=[];t===null?u.push(n):s==null?t!=null&&i.push(n):(c.push(n),EM(s,t)||l.push(n)),(i.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:i,updated:l,removed:u},"local"]),this.emit("update",[{added:i,updated:c,removed:u},"local"])}setLocalStateField(t,n){const o=this.getLocalState();o!==null&&this.setLocalState({...o,[t]:n})}getStates(){return this.states}}const M8=(e,t,n)=>{const o=[];for(let r=0;r0&&(e.emit("change",[{added:[],updated:[],removed:o},n]),e.emit("update",[{added:[],updated:[],removed:o},n]))},zv=(e,t,n=e.states)=>{const o=t.length,r=F1();Wt(r,o);for(let s=0;s{const o=Ka(t),r=Kc(),s=[],i=[],c=[],l=[],u=Jt(o);for(let d=0;d0||c.length>0||l.length>0)&&e.emit("change",[{added:s,updated:c,removed:l},n]),(s.length>0||i.length>0||l.length>0)&&e.emit("update",[{added:s,updated:i,removed:l},n])},oTe=(e,t)=>{const n=c8(e).buffer,o=c8(t).buffer;return crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveKey"]).then(r=>crypto.subtle.deriveKey({name:"PBKDF2",salt:o,iterations:1e5,hash:"SHA-256"},r,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]))},foe=(e,t)=>{if(!t)return DB(e);const n=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:n},t,e).then(o=>{const r=F1();return wa(r,"AES-GCM"),Qn(r,n),Qn(r,new Uint8Array(o)),Fn(r)})},rTe=(e,t)=>{const n=F1();return A2(n,e),foe(Fn(n),t)},boe=(e,t)=>{if(!t)return DB(e);const n=Ka(e);Tc(n)!=="AES-GCM"&&qRe(Ri("Unknown encryption algorithm"));const r=P1(n),s=P1(n);return crypto.subtle.decrypt({name:"AES-GCM",iv:r},t,s).then(i=>new Uint8Array(i))},hoe=(e,t)=>boe(e,t).then(n=>y2(Ka(new Uint8Array(n)))),U1=i8e("y-webrtc"),Xb=0,moe=3,Sg=1,cN=4,Cg=new Map,qa=new Map,Moe=e=>{let t=!0;e.webrtcConns.forEach(n=>{n.synced||(t=!1)}),(!t&&e.synced||t&&!e.synced)&&(e.synced=t,e.provider.emit("synced",[{synced:t}]),U1("synced ",Ls,e.name,Cp," with all peers"))},goe=(e,t,n)=>{const o=Ka(t),r=F1(),s=Jt(o);if(e===void 0)return null;const i=e.awareness,c=e.doc;let l=!1;switch(s){case Xb:{Wt(r,Xb);const u=eTe(o,r,c,e);u===aN&&!e.synced&&n(),u===iN&&(l=!0);break}case moe:Wt(r,Sg),Qn(r,zv(i,Array.from(i.getStates().keys()))),l=!0;break;case Sg:nTe(i,P1(o),e);break;case cN:{const u=Sp(o)===1,d=Tc(o);if(d!==e.peerId&&(e.bcConns.has(d)&&!u||!e.bcConns.has(d)&&u)){const p=[],f=[];u?(e.bcConns.add(d),f.push(d)):(e.bcConns.delete(d),p.push(d)),e.provider.emit("peers",[{added:f,removed:p,webrtcPeers:Array.from(e.webrtcConns.keys()),bcPeers:Array.from(e.bcConns)}]),zoe(e)}break}default:return console.error("Unable to compute message"),r}return l?r:null},sTe=(e,t)=>{const n=e.room;return U1("received message from ",Ls,e.remotePeerId,HB," (",n.name,")",Cp,jx),goe(n,t,()=>{e.synced=!0,U1("synced ",Ls,n.name,Cp," with ",Ls,e.remotePeerId),Moe(n)})},tq=(e,t)=>{U1("send message to ",Ls,e.remotePeerId,Cp,HB," (",e.room.name,")",jx);try{e.peer.send(Fn(t))}catch{}},iTe=(e,t)=>{U1("broadcast message in ",Ls,e.name,Cp),e.webrtcConns.forEach(n=>{try{n.peer.send(t)}catch{}})};class Ov{constructor(t,n,o,r){U1("establishing connection to ",Ls,o),this.room=r,this.remotePeerId=o,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new YWe({initiator:n,...r.provider.peerOpts}),this.peer.on("signal",s=>{this.glareToken===void 0&&(this.glareToken=Date.now()+Math.random()),$x(t,r,{to:o,from:r.peerId,type:"signal",token:this.glareToken,signal:s})}),this.peer.on("connect",()=>{U1("connected to ",Ls,o),this.connected=!0;const i=r.provider.doc,c=r.awareness,l=F1();Wt(l,Xb),uoe(l,i),tq(this,l);const u=c.getStates();if(u.size>0){const d=F1();Wt(d,Sg),Qn(d,zv(c,Array.from(u.keys()))),tq(this,d)}}),this.peer.on("close",()=>{this.connected=!1,this.closed=!0,r.webrtcConns.has(this.remotePeerId)&&(r.webrtcConns.delete(this.remotePeerId),r.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(r.webrtcConns.keys()),bcPeers:Array.from(r.bcConns)}])),Moe(r),this.peer.destroy(),U1("closed connection to ",Ls,o),g8(r)}),this.peer.on("error",s=>{U1("Error in connection to ",Ls,o,": ",s),g8(r)}),this.peer.on("data",s=>{const i=sTe(this,s);i!==null&&tq(this,i)})}destroy(){this.peer.destroy()}}const Vl=(e,t)=>foe(t,e.key).then(n=>e.mux(()=>XWe(e.name,n))),MV=(e,t)=>{e.bcconnected&&Vl(e,t),iTe(e,t)},g8=e=>{Cg.forEach(t=>{t.connected&&(t.send({type:"subscribe",topics:[e.name]}),e.webrtcConns.size{if(e.provider.filterBcConns){const t=F1();Wt(t,cN),_g(t,1),wa(t,e.peerId),Vl(e,Fn(t))}};class aTe{constructor(t,n,o,r){this.peerId=r1e(),this.doc=t,this.awareness=n.awareness,this.provider=n,this.synced=!1,this.name=o,this.key=r,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=GWe(),this.bcconnected=!1,this._bcSubscriber=s=>boe(new Uint8Array(s),r).then(i=>this.mux(()=>{const c=goe(this,i,()=>{});c&&Vl(this,Fn(c))})),this._docUpdateHandler=(s,i)=>{const c=F1();Wt(c,Xb),QWe(c,s),MV(this,Fn(c))},this._awarenessUpdateHandler=({added:s,updated:i,removed:c},l)=>{const u=s.concat(i).concat(c),d=F1();Wt(d,Sg),Qn(d,zv(this.awareness,u)),MV(this,Fn(d))},this._beforeUnloadHandler=()=>{M8(this.awareness,[t.clientID],"window unload"),qa.forEach(s=>{s.disconnect()})},typeof window<"u"?window.addEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.on("exit",this._beforeUnloadHandler)}connect(){this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),g8(this);const t=this.name;HWe(t,this._bcSubscriber),this.bcconnected=!0,zoe(this);const n=F1();Wt(n,Xb),uoe(n,this.doc),Vl(this,Fn(n));const o=F1();Wt(o,Xb),doe(o,this.doc),Vl(this,Fn(o));const r=F1();Wt(r,moe),Vl(this,Fn(r));const s=F1();Wt(s,Sg),Qn(s,zv(this.awareness,[this.doc.clientID])),Vl(this,Fn(s))}disconnect(){Cg.forEach(n=>{n.connected&&n.send({type:"unsubscribe",topics:[this.name]})}),M8(this.awareness,[this.doc.clientID],"disconnect");const t=F1();Wt(t,cN),_g(t,0),wa(t,this.peerId),Vl(this,Fn(t)),UWe(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach(n=>n.destroy())}destroy(){this.disconnect(),typeof window<"u"?window.removeEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.off("exit",this._beforeUnloadHandler)}}const cTe=(e,t,n,o)=>{if(qa.has(n))throw Ri(`A Yjs Doc connected to room "${n}" already exists!`);const r=new aTe(e,t,n,o);return qa.set(n,r),r},$x=(e,t,n)=>{t.key?rTe(n,t.key).then(o=>{e.send({type:"publish",topic:t.name,data:f1e(o)})}):e.send({type:"publish",topic:t.name,data:n})};class Ooe extends FWe{constructor(t){super(t),this.providers=new Set,this.on("connect",()=>{U1(`connected (${t})`);const n=Array.from(qa.keys());this.send({type:"subscribe",topics:n}),qa.forEach(o=>$x(this,o,{type:"announce",from:o.peerId}))}),this.on("message",n=>{switch(n.type){case"publish":{const o=n.topic,r=qa.get(o);if(r==null||typeof o!="string")return;const s=i=>{const c=r.webrtcConns,l=r.peerId;if(i==null||i.from===l||i.to!==void 0&&i.to!==l||r.bcConns.has(i.from))return;const u=c.has(i.from)?()=>{}:()=>r.provider.emit("peers",[{removed:[],added:[i.from],webrtcPeers:Array.from(r.webrtcConns.keys()),bcPeers:Array.from(r.bcConns)}]);switch(i.type){case"announce":c.sizenew Ov(this,!0,i.from,r)),u());break;case"signal":if(i.signal.type==="offer"){const d=c.get(i.from);if(d){const p=i.token,f=d.glareToken;if(f&&f>p){U1("offer rejected: ",i.from);return}d.glareToken=void 0}}if(i.signal.type==="answer"){U1("offer answered by: ",i.from);const d=c.get(i.from);d.glareToken=void 0}i.to===l&&(Fo(c,i.from,()=>new Ov(this,!1,i.from,r)).peer.signal(i.signal),u());break}};r.key?typeof n.data=="string"&&hoe(VB(n.data),r.key).then(s):s(n.data)}}}),this.on("disconnect",()=>U1(`disconnect (${t})`))}}class lTe extends Hz{constructor(t,n,{signaling:o=["wss://y-webrtc-eu.fly.dev"],password:r=null,awareness:s=new tTe(n),maxConns:i=20+Na(wRe()*15),filterBcConns:c=!0,peerOpts:l={}}={}){super(),this.roomName=t,this.doc=n,this.filterBcConns=c,this.awareness=s,this.shouldConnect=!1,this.signalingUrls=o,this.signalingConns=[],this.maxConns=i,this.peerOpts=l,this.key=r?oTe(r,t):DB(null),this.room=null,this.key.then(u=>{this.room=cTe(n,this,t,u),this.shouldConnect?this.room.connect():this.room.disconnect()}),this.connect(),this.destroy=this.destroy.bind(this),n.on("destroy",this.destroy)}get connected(){return this.room!==null&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach(t=>{const n=Fo(Cg,t,()=>new Ooe(t));this.signalingConns.push(n),n.providers.add(this)}),this.room&&this.room.connect()}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach(t=>{t.providers.delete(this),t.providers.size===0&&(t.destroy(),Cg.delete(t.url))}),this.room&&this.room.disconnect()}destroy(){this.doc.off("destroy",this.destroy),this.key.then(()=>{this.room.destroy(),qa.delete(this.roomName)}),super.destroy()}}function uTe(e,t){e.on("connect",()=>{U1(`connected (${t})`);const n=Array.from(qa.keys());e.send({type:"subscribe",topics:n}),qa.forEach(o=>$x(e,o,{type:"announce",from:o.peerId}))}),e.on("message",n=>{switch(n.type){case"publish":{const o=n.topic,r=qa.get(o);if(r===null||typeof o!="string"||r===void 0)return;const s=i=>{const c=r.webrtcConns,l=r.peerId;if(i===null||i.from===l||i.to!==void 0&&i.to!==l||r.bcConns.has(i.from))return;const u=c.has(i.from)?()=>{}:()=>r.provider.emit("peers",[{removed:[],added:[i.from],webrtcPeers:Array.from(r.webrtcConns.keys()),bcPeers:Array.from(r.bcConns)}]);switch(i.type){case"announce":c.size