headroom-cms 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/admin/assets/{AdminsPage-C4tJy6Vj.js → AdminsPage-BqfhR4Zc.js} +1 -1
  2. package/admin/assets/{AllContentPage-DL0-UlYh.js → AllContentPage-C11eeRMt.js} +1 -1
  3. package/admin/assets/{ApiKeysPage-pZ6nKCZ_.js → ApiKeysPage-DJjOSLoR.js} +1 -1
  4. package/admin/assets/AuditPage-DJNk7IaW.js +1 -0
  5. package/admin/assets/{BlockEditor-D0Jk8u7w.js → BlockEditor-DDsml97y.js} +2 -2
  6. package/admin/assets/BlockTypeEditPage-Cg7BifaZ.js +1 -0
  7. package/admin/assets/{BlockTypesPage-Q7keQKxn.js → BlockTypesPage-BDFj8TSL.js} +1 -1
  8. package/admin/assets/{BulkActionBar-BGDrNwCg.js → BulkActionBar-CastJGEP.js} +1 -1
  9. package/admin/assets/CollectionEditPage-DGW4iMfo.js +1 -0
  10. package/admin/assets/{CollectionsPage-DDZ-5H7Y.js → CollectionsPage-C8XNxRda.js} +1 -1
  11. package/admin/assets/{ContentCreatePage-C3jn0Etf.js → ContentCreatePage-CX4aOzTR.js} +1 -1
  12. package/admin/assets/ContentEditPage-Dj3RK2BF.js +2 -0
  13. package/admin/assets/ContentListPage-CoDanHrR.js +1 -0
  14. package/admin/assets/{CustomBlockPreview-f9j4g35U.js → CustomBlockPreview-DfDOcbmR.js} +1 -1
  15. package/admin/assets/{FieldBuilder-p1Y8RubR.js → FieldBuilder-8VVLG_j0.js} +2 -2
  16. package/admin/assets/FilterBar-JCp03kkK.js +1 -0
  17. package/admin/assets/{LoginPage-9YUPS1YH.js → LoginPage-gPNC9XRN.js} +1 -1
  18. package/admin/assets/{MediaField-DJpYbUA8.js → MediaField-Du7_gRse.js} +1 -1
  19. package/admin/assets/MediaPage-D9763lEk.js +1 -0
  20. package/admin/assets/RelationshipPicker-D7dFI43Q.js +1 -0
  21. package/admin/assets/SiteSettingsPage-Tfiex2yn.js +1 -0
  22. package/admin/assets/{SiteUsersPage-CtVaB0vq.js → SiteUsersPage-CSV8syR3.js} +1 -1
  23. package/admin/assets/{SitesPage-B-sNyP-Y.js → SitesPage-BFIZ3Y5K.js} +1 -1
  24. package/admin/assets/SubmissionDetailPage-8vtUQsLd.js +1 -0
  25. package/admin/assets/SubmissionEditPage-PgowJuvq.js +1 -0
  26. package/admin/assets/SubmissionListPage-HFDQxPhn.js +1 -0
  27. package/admin/assets/{TagInput-CrI2BIuz.js → TagInput-CDkKZboX.js} +1 -1
  28. package/admin/assets/{TagsPage-BSX5KQvZ.js → TagsPage-BW15-W4H.js} +1 -1
  29. package/admin/assets/{UsersPage-BCTpWULa.js → UsersPage-C-zlDeTy.js} +1 -1
  30. package/admin/assets/{WebhookEditPage-CQO3nmaT.js → WebhookEditPage-cPPALIbH.js} +1 -1
  31. package/admin/assets/{WebhooksPage-ByaTlUGU.js → WebhooksPage-vkPC4m9a.js} +1 -1
  32. package/admin/assets/{card-uKxSQehY.js → card-10FqkZPA.js} +1 -1
  33. package/admin/assets/{checkbox-z1kYnX5o.js → checkbox-fC1QPb_4.js} +1 -1
  34. package/admin/assets/collapsible-B414SspL.js +1 -0
  35. package/admin/assets/{command-CuWC4GrT.js → command-BeacdV75.js} +1 -1
  36. package/admin/assets/{index-HoCNSqv2.css → index-Do_SK4Zl.css} +1 -1
  37. package/admin/assets/{index-b-u0-VCO.js → index-wYNPRVrc.js} +12 -12
  38. package/admin/assets/{popover-rcnajqN6.js → popover-BJDj8C6y.js} +1 -1
  39. package/admin/assets/{select-BKaV0BO_.js → select-BV3jemT6.js} +1 -1
  40. package/admin/assets/{serializeToText-BfR2RCzd.js → serializeToText-BJy0Ms5I.js} +1 -1
  41. package/admin/assets/sortable.esm-QyXA6fio.js +1 -0
  42. package/admin/assets/{table-Bozosvl6.js → table-WkEcC9MH.js} +1 -1
  43. package/admin/assets/{textarea-BnjAxJtk.js → textarea-CHQ9tT69.js} +1 -1
  44. package/admin/assets/{useAdminResolver-B0ady82Q.js → useAdminResolver-CpZj93vH.js} +1 -1
  45. package/admin/assets/useContent-D8yDRTTy.js +1 -0
  46. package/admin/assets/useContentSearch-B-_p0_QX.js +1 -0
  47. package/admin/assets/useFilterParams-DYdEuWPE.js +1 -0
  48. package/admin/assets/{useMedia-CXQpRNYL.js → useMedia-m6zKB__r.js} +1 -1
  49. package/admin/assets/usePageTitle-Bwf-MpTD.js +1 -0
  50. package/admin/assets/{useSiteUsers-BfzIdhvs.js → useSiteUsers-QbiItSH1.js} +1 -1
  51. package/admin/assets/{useTags-B6FtXCHF.js → useTags-CLPWVUB3.js} +1 -1
  52. package/admin/assets/{useWebhooks-iPRX5y4s.js → useWebhooks-no0l3-mF.js} +1 -1
  53. package/admin/index.html +3 -3
  54. package/admin/sw.js +1 -1
  55. package/dist/api.d.ts +1 -0
  56. package/dist/api.d.ts.map +1 -1
  57. package/dist/api.js +1 -1
  58. package/dist/api.js.map +1 -1
  59. package/dist/cdn.js +1 -1
  60. package/dist/cdn.js.map +1 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +1 -0
  63. package/dist/index.js.map +1 -1
  64. package/lambda/api/bootstrap +0 -0
  65. package/lambda/image-lambda/index.mjs +1 -1
  66. package/lambda/webhook-worker/bootstrap +0 -0
  67. package/package.json +1 -1
  68. package/src/api.ts +2 -1
  69. package/src/cdn.ts +1 -1
  70. package/src/index.ts +1 -0
  71. package/admin/assets/AuditPage-aVmcP6Ts.js +0 -1
  72. package/admin/assets/BlockTypeEditPage-DIe2yYEr.js +0 -1
  73. package/admin/assets/CollectionEditPage-Bq75MpXk.js +0 -1
  74. package/admin/assets/ContentEditPage-9tODvFEv.js +0 -2
  75. package/admin/assets/ContentListPage-VCT6GTCF.js +0 -1
  76. package/admin/assets/MediaPage-BgDRQR21.js +0 -1
  77. package/admin/assets/SiteSettingsPage-Diy-PauR.js +0 -1
  78. package/admin/assets/SubmissionDetailPage-DW6QJvAy.js +0 -1
  79. package/admin/assets/SubmissionEditPage-CxYPdI9-.js +0 -1
  80. package/admin/assets/SubmissionListPage-BHF82NF3.js +0 -1
  81. package/admin/assets/sortable.esm-BHilUL-2.js +0 -1
  82. package/admin/assets/useContent-B2MUK4An.js +0 -1
  83. package/admin/assets/usePageTitle-Do4xyFdL.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as y}from"./tanstack-Bs3zYPPV.js";import{g as gC,r as C,b as bC,a as r3,R as Ie,u as yC,f as o3}from"./react-vendor-C2CvUxFh.js";import{_ as eu,b1 as i3,b2 as s3,b3 as Vm,D as EC,k as xC,l as CC,m as kC,n as TC,Z as wC,L as Sf,j as a3,b4 as l3,X as c3,I as vf,B as Sa,o as SC,a0 as vC,V as u3}from"./index-b-u0-VCO.js";import{ag as AC,ah as d3,ai as On,Q as ki,aj as Af,ak as f3,al as _f,am as h3,an as p3,ao as m3,ap as g3,R as b3,aq as y3,ar as Dr,as as Hi,at as Al,au as tu,av as E3,aw as x3,ax as ip,ay as C3,u as k3,s as T3,w as w3,A as S3,t as v3,az as A3,j as _3,L as N3,k as I3,i as M3,a4 as O3,a2 as D3,a3 as L3,a8 as R3,a9 as P3,aa as B3,a6 as F3,a7 as H3,a1 as U3,Y as V3,_ as $3,X as j3,T as z3,aA as q3,aB as W3,aC as G3,b as Y3,aD as K3,I as Q3,C as X3,aE as Z3,aF as J3,a as eN,ab as tN,ac as nN}from"./radix-C1kb_NqW.js";import{P as kd,S as _C}from"./command-CuWC4GrT.js";import{a as rN}from"./MediaField-DJpYbUA8.js";import{m as sp}from"./media-url-DIg_vSyf.js";import{F as oN,C as iN}from"./ContentEditPage-9tODvFEv.js";import{C as sN}from"./CustomBlockPreview-f9j4g35U.js";import"./useMedia-CXQpRNYL.js";import"./select-BKaV0BO_.js";import"./card-uKxSQehY.js";import"./useContent-B2MUK4An.js";import"./useAdminResolver-B0ady82Q.js";import"./usePageTitle-Do4xyFdL.js";import"./serializeToText-BfR2RCzd.js";import"./format-C88SDH8g.js";import"./textarea-BnjAxJtk.js";import"./TagInput-CrI2BIuz.js";import"./sortable.esm-BHilUL-2.js";import"./core.esm-B_kcYf6n.js";import"./useTags-B6FtXCHF.js";import"./popover-rcnajqN6.js";import"./useDebouncedValue-C-cQUcLG.js";import"./checkbox-z1kYnX5o.js";import"./contentStatus-BmaiYVOm.js";function zt(t){this.content=t}zt.prototype={constructor:zt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new zt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new zt(n)},addToStart:function(t,e){return new zt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new zt(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=zt.from(t),t.size?new zt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zt.from(t),t.size?new zt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};zt.from=function(t){if(t instanceof zt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zt(e)};function NC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=NC(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function IC(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=IC(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class V{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new V(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new V(r,o)}cutByIndex(e,n){return e==n?V.empty:e==0&&n==this.content.length?this:new V(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new V(o,i)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return NC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return IC(this,e,n,r)}findIndex(e){if(e==0)return Ql(0,e);if(e==this.size)return Ql(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Ql(n+1,i):Ql(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new V(n||e,r)}static from(e){if(!e)return V.empty;if(e instanceof V)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new V([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const Nf={index:0,offset:0};function Ql(t,e){return Nf.index=t,Nf.offset=e,Nf}function nu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!nu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!nu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ze=class ap{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&nu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ap.none;if(e instanceof ap)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ze.none=[];class ru extends Error{}class Q{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=OC(this.content,e+this.openStart,n);return r&&new Q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Q(MC(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Q.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Q(V.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Q(e,r,o)}}Q.empty=new Q(V.empty,0,0);function MC(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(MC(i.content,e-o-1,n-o-1)))}function OC(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=OC(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function aN(t,e,n){if(n.openStart>t.depth)throw new ru("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ru("Inconsistent open depths");return DC(t,e,n,0)}function DC(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=DC(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return mi(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=lN(n,t);return mi(i,RC(t,s,a,e,r))}else return mi(i,ou(t,e,r))}function LC(t,e){if(!e.type.compatibleContent(t.type))throw new ru("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){let r=t.node(n);return LC(r,e.node(n)),r}function pi(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function va(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(pi(t.nodeAfter,r),i++));for(let a=i;a<s;a++)pi(o.child(a),r);e&&e.depth==n&&e.textOffset&&pi(e.nodeBefore,r)}function mi(t,e){return t.type.checkContent(e),t.copy(e)}function RC(t,e,n,r,o){let i=t.depth>o&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return va(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(LC(i,s),pi(mi(i,RC(t,e,n,r,o+1)),a)):(i&&pi(mi(i,ou(t,e,o+1)),a),va(e,n,o,a),s&&pi(mi(s,ou(n,r,o+1)),a)),va(r,null,o,a),new V(a)}function ou(t,e,n){let r=[];if(va(null,t,n,r),t.depth>n){let o=lp(t,e,n+1);pi(mi(o,ou(t,e,n+1)),r)}return va(e,null,n,r),new V(r)}function lN(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(V.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Ka{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ze.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new iu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ka(n,r,i)}static resolveCached(e,n){let r=h1.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else h1.set(e,r=new cN);let o=r.elts[r.i]=Ka.resolve(e,n);return r.i=(r.i+1)%uN,o}}class cN{constructor(){this.elts=[],this.i=0}}const uN=12,h1=new WeakMap;class iu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const dN=Object.create(null);let ao=class cp{constructor(e,n,r,o=Ze.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&nu(this.attrs,n||e.defaultAttrs||dN)&&Ze.sameSet(this.marks,r||Ze.none)}copy(e=null){return e==this.content?this:new cp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new cp(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Q.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Q(c,o.depth-s,i.depth-s)}replace(e,n,r){return aN(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ka.resolveCached(this,e)}resolveNoCache(e){return Ka.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),PC(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=V.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ze.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ze.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=V.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ao.prototype.text=void 0;class su extends ao{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):PC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new su(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new su(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function PC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ti{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new fN(e,n);if(r.next==null)return Ti.empty;let o=BC(r);r.next&&r.err("Unexpected trailing text");let i=EN(yN(o));return xN(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
1
+ import{j as y}from"./tanstack-Bs3zYPPV.js";import{g as gC,r as C,b as bC,a as r3,R as Ie,u as yC,f as o3}from"./react-vendor-C2CvUxFh.js";import{_ as eu,b2 as i3,b3 as s3,b4 as Vm,D as EC,k as xC,l as CC,m as kC,n as TC,Y as wC,L as Sf,j as a3,b5 as l3,X as c3,I as vf,B as Sa,o as SC,$ as vC,aa as u3}from"./index-wYNPRVrc.js";import{ag as AC,ah as d3,ai as On,Q as ki,aj as Af,ak as f3,al as _f,am as h3,an as p3,ao as m3,ap as g3,R as b3,aq as y3,ar as Dr,as as Hi,at as Al,au as tu,av as E3,aw as x3,ax as ip,ay as C3,u as k3,s as T3,w as w3,A as S3,t as v3,az as A3,j as _3,L as N3,k as I3,i as M3,a4 as O3,a2 as D3,a3 as L3,a8 as R3,a9 as P3,aa as B3,a6 as F3,a7 as H3,a1 as U3,Y as V3,_ as $3,X as j3,T as z3,aA as q3,aB as W3,aC as G3,b as Y3,aD as K3,I as Q3,C as X3,aE as Z3,aF as J3,a as eN,ab as tN,ac as nN}from"./radix-C1kb_NqW.js";import{P as kd,S as _C}from"./command-BeacdV75.js";import{a as rN}from"./MediaField-Du7_gRse.js";import{m as sp}from"./media-url-DIg_vSyf.js";import{F as oN}from"./ContentEditPage-Dj3RK2BF.js";import{C as iN}from"./CustomBlockPreview-DfDOcbmR.js";import{a as sN}from"./RelationshipPicker-D7dFI43Q.js";import"./useMedia-m6zKB__r.js";import"./select-BV3jemT6.js";import"./card-10FqkZPA.js";import"./useContent-D8yDRTTy.js";import"./useAdminResolver-CpZj93vH.js";import"./usePageTitle-Bwf-MpTD.js";import"./serializeToText-BJy0Ms5I.js";import"./format-C88SDH8g.js";import"./textarea-CHQ9tT69.js";import"./TagInput-CDkKZboX.js";import"./collapsible-B414SspL.js";import"./useTags-CLPWVUB3.js";import"./checkbox-fC1QPb_4.js";import"./core.esm-B_kcYf6n.js";import"./sortable.esm-QyXA6fio.js";import"./contentStatus-BmaiYVOm.js";import"./popover-BJDj8C6y.js";import"./useContentSearch-B-_p0_QX.js";import"./useDebouncedValue-C-cQUcLG.js";function zt(t){this.content=t}zt.prototype={constructor:zt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new zt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new zt(n)},addToStart:function(t,e){return new zt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new zt(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=zt.from(t),t.size?new zt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zt.from(t),t.size?new zt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};zt.from=function(t){if(t instanceof zt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zt(e)};function NC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=NC(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function IC(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=IC(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class V{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new V(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new V(r,o)}cutByIndex(e,n){return e==n?V.empty:e==0&&n==this.content.length?this:new V(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new V(o,i)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return NC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return IC(this,e,n,r)}findIndex(e){if(e==0)return Ql(0,e);if(e==this.size)return Ql(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Ql(n+1,i):Ql(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new V(n||e,r)}static from(e){if(!e)return V.empty;if(e instanceof V)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new V([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const Nf={index:0,offset:0};function Ql(t,e){return Nf.index=t,Nf.offset=e,Nf}function nu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!nu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!nu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ze=class ap{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&nu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ap.none;if(e instanceof ap)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ze.none=[];class ru extends Error{}class Q{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=OC(this.content,e+this.openStart,n);return r&&new Q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Q(MC(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Q.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Q(V.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Q(e,r,o)}}Q.empty=new Q(V.empty,0,0);function MC(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(MC(i.content,e-o-1,n-o-1)))}function OC(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=OC(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function aN(t,e,n){if(n.openStart>t.depth)throw new ru("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ru("Inconsistent open depths");return DC(t,e,n,0)}function DC(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=DC(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return mi(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=lN(n,t);return mi(i,RC(t,s,a,e,r))}else return mi(i,ou(t,e,r))}function LC(t,e){if(!e.type.compatibleContent(t.type))throw new ru("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){let r=t.node(n);return LC(r,e.node(n)),r}function pi(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function va(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(pi(t.nodeAfter,r),i++));for(let a=i;a<s;a++)pi(o.child(a),r);e&&e.depth==n&&e.textOffset&&pi(e.nodeBefore,r)}function mi(t,e){return t.type.checkContent(e),t.copy(e)}function RC(t,e,n,r,o){let i=t.depth>o&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return va(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(LC(i,s),pi(mi(i,RC(t,e,n,r,o+1)),a)):(i&&pi(mi(i,ou(t,e,o+1)),a),va(e,n,o,a),s&&pi(mi(s,ou(n,r,o+1)),a)),va(r,null,o,a),new V(a)}function ou(t,e,n){let r=[];if(va(null,t,n,r),t.depth>n){let o=lp(t,e,n+1);pi(mi(o,ou(t,e,n+1)),r)}return va(e,null,n,r),new V(r)}function lN(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(V.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Ka{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ze.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new iu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ka(n,r,i)}static resolveCached(e,n){let r=h1.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else h1.set(e,r=new cN);let o=r.elts[r.i]=Ka.resolve(e,n);return r.i=(r.i+1)%uN,o}}class cN{constructor(){this.elts=[],this.i=0}}const uN=12,h1=new WeakMap;class iu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const dN=Object.create(null);let ao=class cp{constructor(e,n,r,o=Ze.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&nu(this.attrs,n||e.defaultAttrs||dN)&&Ze.sameSet(this.marks,r||Ze.none)}copy(e=null){return e==this.content?this:new cp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new cp(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Q.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Q(c,o.depth-s,i.depth-s)}replace(e,n,r){return aN(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ka.resolveCached(this,e)}resolveNoCache(e){return Ka.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),PC(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=V.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ze.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ze.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=V.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ao.prototype.text=void 0;class su extends ao{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):PC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new su(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new su(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function PC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ti{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new fN(e,n);if(r.next==null)return Ti.empty;let o=BC(r);r.next&&r.err("Unexpected trailing text");let i=EN(yN(o));return xN(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
2
2
  `)}}Ti.empty=new Ti(!0);class fN{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function BC(t){let e=[];do e.push(hN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function hN(t){let e=[];do e.push(pN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function pN(t){let e=bN(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=mN(t,e);else break;return e}function p1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function mN(t,e){let n=p1(t),r=n;return t.eat(",")&&(t.next!="}"?r=p1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function gN(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function bN(t){if(t.eat("(")){let e=BC(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=gN(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function yN(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function FC(t,e){return e-t}function m1(t,e){let n=[];return r(e),n.sort(FC);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function EN(t){let e=Object.create(null);return n(m1(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);m1(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ti(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(FC);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function xN(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function HC(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function UC(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function VC(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function $C(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new kN(t,r,e[r]);return n}let g1=class jC{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=$C(e,r.attrs),this.defaultAttrs=HC(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ti.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:UC(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ao(this,this.computeAttrs(e),V.from(n),Ze.setFrom(r))}createChecked(e=null,n,r){return n=V.from(n),this.checkContent(n),new ao(this,this.computeAttrs(e),n,Ze.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=V.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(V.empty,!0);return i?new ao(this,e,n.append(i),Ze.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){VC(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ze.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new jC(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function CN(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class kN{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?CN(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Td{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=$C(e,o.attrs),this.excluded=null;let i=HC(this.attrs);this.instance=i?new Ze(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ze(this,UC(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Td(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){VC(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let zC=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=zt.from(e.nodes),n.marks=zt.from(e.marks||{}),this.nodes=g1.compile(this.spec.nodes,this),this.marks=Td.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Ti.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?b1(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:b1(this,s.split(" "))}this.nodeFromJSON=o=>ao.fromJSON(this,o),this.markFromJSON=o=>Ze.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof g1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new su(r,r.defaultAttrs,e,Ze.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function b1(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function TN(t){return t.tag!=null}function wN(t){return t.style!=null}let hr=class up{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(TN(o))this.tags.push(o);else if(wN(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new E1(this,n,!1);return r.addAll(e,Ze.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new E1(this,n,!0);return r.addAll(e,Ze.none,n.from,n.to),Q.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(AN(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=x1(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=x1(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new up(e,up.schemaRules(e)))}};const qC={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},SN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},WC={ol:!0,ul:!0},Qa=1,dp=2,Aa=4;function y1(t,e,n){return e!=null?(e?Qa:0)|(e==="full"?dp:0):t&&t.whitespace=="pre"?Qa|dp:n&~Aa}class Xl{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ze.none,this.match=i||(s&Aa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(V.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qa)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=V.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class E1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=y1(null,n.preserveWhitespace,0)|(r?Aa:0);o?i=new Xl(o.type,o.attrs,Ze.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Xl(null,null,Ze.none,!0,null,s):i=new Xl(e.schema.topNodeType,null,Ze.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&dp?"full":this.localPreserveWS||(o.options&Qa)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;WC.hasOwnProperty(s)&&this.parser.normalizeLists&&vN(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:SN.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(qC.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Ze.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):C1(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=y1(e,i,s.options);s.options&Aa&&s.content.length==0&&(a|=Aa);let l=Ze.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):C1(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Xl(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Qa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function vN(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&WC.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function AN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function x1(t){let e={};for(let n in t)e[n]=t[n];return e}function C1(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class Fn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=If(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Oc(If(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Oc(If(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Oc(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=k1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return k1(e.marks)}}function k1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function If(t){return t.document||window.document}const T1=new WeakMap;function _N(t){let e=T1.get(t);return e===void 0&&T1.set(t,e=NN(t)),e}function NN(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Oc(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=_N(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Oc(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const GC=65535,YC=Math.pow(2,16);function IN(t,e){return t+e*YC}function w1(t){return t&GC}function MN(t){return(t-(t&GC))/YC}const KC=1,QC=2,Dc=4,XC=8;class fp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&XC)>0}get deletedBefore(){return(this.delInfo&(KC|Dc))>0}get deletedAfter(){return(this.delInfo&(QC|Dc))>0}get deletedAcross(){return(this.delInfo&Dc)>0}}class Dn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Dn.empty)return Dn.empty}recover(e){let n=0,r=w1(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+MN(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:IN(a/3,e-l),g=e==l?QC:e==d?KC:Dc;return(n<0?e!=l:e!=d)&&(g|=XC),new fp(h,g,p)}o+=u-c}return r?e+o:new fp(e+o,0,null)}touches(e,n){let r=0,o=w1(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Dn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Dn.empty:new Dn(e<0?[0,-e,0]:[0,0,e])}}Dn.empty=new Dn([]);class Ss{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ss(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Ss;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new fp(e,o,null)}}const Mf=Object.create(null);class tn{getMap(){return Dn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Mf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Mf)throw new RangeError("Duplicate use of step JSON ID "+e);return Mf[e]=n,n.prototype.jsonID=e,n}}class vt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new vt(e,null)}static fail(e){return new vt(null,e)}static fromReplace(e,n,r,o){try{return vt.ok(e.replace(n,r,o))}catch(i){if(i instanceof ru)return vt.fail(i.message);throw i}}}function $m(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy($m(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return V.fromArray(r)}class Mo extends tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new Q($m(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,i)}invert(){return new ur(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Mo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mo(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("addMark",Mo);class ur extends tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Q($m(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,r)}invert(){return new Mo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ur(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("removeMark",ur);class Oo extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new Q(V.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Oo(this.pos,n.marks[o]);return new Oo(this.pos,this.mark)}}return new wi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Oo(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("addNodeMark",Oo);class wi extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new Q(V.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Oo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new wi(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("removeNodeMark",wi);class St extends tn{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&hp(e,this.from,this.to)?vt.fail("Structure replace would overwrite content"):vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Dn([this.from,this.to-this.from,this.slice.size])}invert(e){return new St(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new St(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof St)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Q.empty:new Q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new St(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Q.empty:new Q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new St(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new St(n.from,n.to,Q.fromJSON(e,n.slice),!!n.structure)}}tn.jsonID("replace",St);class yt extends tn{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(hp(e,this.from,this.gapFrom)||hp(e,this.gapTo,this.to)))return vt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?vt.fromReplace(e,this.from,this.to,r):vt.fail("Content does not fit in gap")}getMap(){return new Dn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new yt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new yt(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new yt(n.from,n.to,n.gapFrom,n.gapTo,Q.fromJSON(e,n.slice),n.insert,!!n.structure)}}tn.jsonID("replaceAround",yt);function hp(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function ON(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:o.push(s=new ur(f,h,d[g])));a&&a.to==f?a.to=h:i.push(a=new Mo(f,h,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function DN(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Td){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),o.forEach(s=>t.step(new ur(s.from,s.to,s.style)))}function jm(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new St(a,u,Q.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new ur(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new Q(V.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new St(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(V.empty,!0);t.replace(a,a,new Q(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function LN(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $s(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+o,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!LN(s,a,l))break;a&&(o=1),l<s.childCount&&(i=1)}return null}function RN(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=V.empty,d=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=V.from(r.node(p).copy(u)),d++):l--;let f=V.empty,h=0;for(let p=i,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=V.from(o.node(p).copy(f)),h++):c++;t.step(new yt(l,c,s,a,new Q(u.append(f),d,h),u.size-d,!0))}function ZC(t,e,n=null,r=t){let o=PN(t,e),i=o&&BN(r,e);return i?o.map(S1).concat({type:e,attrs:n}).concat(i.map(S1)):null}function S1(t){return{type:t,attrs:null}}function PN(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function BN(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function FN(t,e,n){let r=V.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=V.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new yt(o,i,o,i,new Q(r,0,0),n.length,!0))}function HN(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&UN(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ek(t,s,a,i),jm(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new yt(d,f,d+1,f-1,new Q(V.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&JC(t,s,a,i),!1}})}function JC(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ek(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
@@ -176,4 +176,4 @@ ${b}
176
176
  `);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>Dm(t,u)),{insertedBlocks:o.map(u=>pt(u,r)),removedBlocks:s}}function vK(t,e,n,r,o){let i;if(e)if(typeof e=="string")i=yr([e],t.pmSchema,r);else if(Array.isArray(e))i=yr(e,t.pmSchema,r);else if(e.type==="tableContent")i=Jd(e,t.pmSchema);else throw new Hr(e.type);else throw new Error("blockContent is required");const s=(o?.document??document).createDocumentFragment();for(const a of i)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){const l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=Zg(a,t.schema.inlineContentSchema,t.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},t);if(u){if(s.appendChild(u.dom),u.contentDOM){const d=n.serializeFragment(a.content,o);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(const c of a.marks.toReversed())if(c.type.name in t.schema.styleSpecs){const u=t.schema.styleSpecs[c.type.name].implementation.render(c.attrs.stringValue,t);u.contentDOM.appendChild(l),l=u.dom}else{const u=c.type.spec.toDOM(c,!0),d=Fn.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}s.appendChild(l)}else{const l=n.serializeFragment(V.from([a]),o);s.appendChild(l)}return s}function AK(t,e,n,r){var o,i,s,a,l;const c=t.pmSchema.nodes.blockContainer,u=e.props||{};for(const[p,g]of Object.entries(t.schema.blockSchema[e.type].propSchema))!(p in u)&&g.default!==void 0&&(u[p]=g.default);const d=e.children||[],f=t.blockImplementations[e.type].implementation.render.call({renderType:"dom",props:void 0},{...e,props:u,children:d},t);if(f.contentDOM&&e.content){const p=vK(t,e.content,n,e.type,r);f.contentDOM.appendChild(p)}if(t.pmSchema.nodes[e.type].isInGroup("bnBlock")){if(e.children&&e.children.length>0){const p=OA(t,e.children,n,r);(o=f.contentDOM)==null||o.append(p)}return f.dom}const h=(s=(i=c.spec)==null?void 0:i.toDOM)==null?void 0:s.call(i,c.create({id:e.id,...u}));return(a=h.contentDOM)==null||a.appendChild(f.dom),e.children&&e.children.length>0&&((l=h.contentDOM)==null||l.appendChild(DA(t,e.children,n,r))),h.dom}function OA(t,e,n,r){const o=(r?.document??document).createDocumentFragment();for(const i of e){const s=AK(t,i,n,r);o.appendChild(s)}return o}const DA=(t,e,n,r)=>{var o;const i=t.pmSchema.nodes.blockGroup,s=i.spec.toDOM(i.create({})),a=OA(t,e,n,r);return(o=s.contentDOM)==null||o.appendChild(a),s.dom},_K=(t,e)=>{const n=Fn.fromSchema(t);return{serializeBlocks:(r,o)=>DA(e,r,n,o).outerHTML}};function NK(t){return t.transact(e=>{const n=Go(e.doc,e.selection.anchor);if(e.selection instanceof Ge)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:e.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:e.selection.$headCell.pos-n.posBeforeNode};if(e.selection instanceof le)return{type:"node",anchorBlockId:n.node.attrs.id};{const r=Go(e.doc,e.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:e.selection.anchor-n.posBeforeNode,headOffset:e.selection.head-r.posBeforeNode}}})}function IK(t,e){var n,r;const o=(n=dn(e.anchorBlockId,t.doc))==null?void 0:n.posBeforeNode;if(o===void 0)throw new Error(`Could not find block with ID ${e.anchorBlockId} to update selection`);let i;if(e.type==="cell")i=Ge.create(t.doc,o+e.anchorCellOffset,o+e.headCellOffset);else if(e.type==="node")i=le.create(t.doc,o+1);else{const s=(r=dn(e.headBlockId,t.doc))==null?void 0:r.posBeforeNode;if(s===void 0)throw new Error(`Could not find block with ID ${e.headBlockId} to update selection`);i=ae.create(t.doc,o+e.anchorOffset,s+e.headOffset)}t.setSelection(i)}function Lm(t){return t.map(e=>e.type==="columnList"?e.children.map(n=>Lm(n.children)).flat():{...e,children:Lm(e.children)}).flat()}function LA(t,e,n){t.transact(r=>{var o;const i=((o=t.getSelection())==null?void 0:o.blocks)||[t.getTextCursorPosition().block],s=NK(t);t.removeBlocks(i),t.insertBlocks(Lm(i),e,n),IK(r,s)})}function RA(t){return!t||t.type!=="columnList"}function PA(t,e,n){let r,o;if(e?e.children.length>0?(r=e.children[e.children.length-1],o="after"):(r=e,o="before"):n&&(r=n,o="before"),!r||!o)return;const i=t.getParentBlock(r);return RA(i)?{referenceBlock:r,placement:o}:PA(t,o==="after"?r:t.getPrevBlock(r),i)}function BA(t,e,n){let r,o;if(e?e.children.length>0?(r=e.children[0],o="before"):(r=e,o="after"):n&&(r=n,o="after"),!r||!o)return;const i=t.getParentBlock(r);return RA(i)?{referenceBlock:r,placement:o}:BA(t,o==="before"?r:t.getNextBlock(r),i)}function MK(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[0]||t.getTextCursorPosition().block,r=PA(t,t.getPrevBlock(n),t.getParentBlock(n));r&&LA(t,r.referenceBlock,r.placement)})}function OK(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[e?.blocks.length-1]||t.getTextCursorPosition().block,r=BA(t,t.getNextBlock(n),t.getParentBlock(n));r&&LA(t,r.referenceBlock,r.placement)})}function DK(t,e,n){const{$from:r,$to:o}=t.selection,i=r.blockRange(o,h=>h.childCount>0&&(h.type.name==="blockGroup"||h.type.name==="column"));if(!i)return!1;const s=i.startIndex;if(s===0)return!1;const a=i.parent.child(s-1);if(a.type!==e)return!1;const l=a.lastChild&&a.lastChild.type===n,c=V.from(l?e.create():null),u=new Q(V.from(e.create(null,V.from(n.create(null,c)))),l?3:1,0),d=i.start,f=i.end;return t.step(new yt(d-(l?3:1),f,d,f,u,1,!0)).scrollIntoView(),!0}function FA(t){return t.transact(e=>DK(e,t.pmSchema.nodes.blockContainer,t.pmSchema.nodes.blockGroup))}function LK(t){t._tiptapEditor.commands.liftListItem("blockContainer")}function RK(t){return t.transact(e=>{const{bnBlock:n}=Fl(e);return e.doc.resolve(n.beforePos).nodeBefore!==null})}function PK(t){return t.transact(e=>{const{bnBlock:n}=Fl(e);return e.doc.resolve(n.beforePos).depth>1})}function BK(t,e){const n=typeof e=="string"?e:e.id,r=Et(t),o=dn(n,t);if(o)return pt(o.node,r)}function FK(t,e){const n=typeof e=="string"?e:e.id,r=dn(n,t),o=Et(t);if(!r)return;const i=t.resolve(r.posBeforeNode).nodeBefore;if(i)return pt(i,o)}function HK(t,e){const n=typeof e=="string"?e:e.id,r=dn(n,t),o=Et(t);if(!r)return;const i=t.resolve(r.posBeforeNode+r.node.nodeSize).nodeAfter;if(i)return pt(i,o)}function UK(t,e){const n=typeof e=="string"?e:e.id,r=Et(t),o=dn(n,t);if(!o)return;const i=t.resolve(o.posBeforeNode),s=i.node(),a=i.node(-1),l=a.type.name!=="doc"?s.type.name==="blockGroup"?a:s:void 0;if(l)return pt(l,r)}let VK=class{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>D5(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(n=>BK(n.doc,e))}getPrevBlock(e){return this.editor.transact(n=>FK(n.doc,e))}getNextBlock(e){return this.editor.transact(n=>HK(n.doc,e))}getParentBlock(e){return this.editor.transact(n=>UK(n.doc,e))}forEachBlock(e,n=!1){const r=this.document.slice();n&&r.reverse();function o(i){for(const s of i){if(e(s)===!1)return!1;const a=n?s.children.slice().reverse():s.children;if(!o(a))return!1}return!0}o(r)}insertBlocks(e,n,r="before"){return this.editor.transact(o=>wK(o,e,n,r))}updateBlock(e,n){return this.editor.transact(r=>w8(r,e,n))}removeBlocks(e){return this.editor.transact(n=>Sx(n,e,[]).removedBlocks)}replaceBlocks(e,n){return this.editor.transact(r=>Sx(r,e,n))}canNestBlock(){return RK(this.editor)}nestBlock(){FA(this.editor)}canUnnestBlock(){return PK(this.editor)}unnestBlock(){LK(this.editor)}moveBlocksUp(){return MK(this.editor)}moveBlocksDown(){return OK(this.editor)}},$K=class extends Gg{constructor(e){super(),this.editor=e,e.on("create",()=>{e._tiptapEditor.on("update",({transaction:n,appendedTransactions:r})=>{this.emit("onChange",{editor:e,transaction:n,appendedTransactions:r})}),e._tiptapEditor.on("selectionUpdate",({transaction:n})=>{this.emit("onSelectionChange",{editor:e,transaction:n})}),e._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:e})}),e._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:e})})})}onChange(e,n=!0){const r=({transaction:o,appendedTransactions:i})=>{!n&&vx(o)||e(this.editor,{getChanges(){return Zv(o,i)}})};return this.on("onChange",r),()=>{this.off("onChange",r)}}onSelectionChange(e,n=!1){const r=o=>{!n&&vx(o.transaction)||e(this.editor)};return this.on("onSelectionChange",r),()=>{this.off("onSelectionChange",r)}}onMount(e){return this.on("onMount",e),()=>{this.off("onMount",e)}}onUnmount(e){return this.on("onUnmount",e),()=>{this.off("onUnmount",e)}}};function vx(t){return!!t.getMeta("y-sync$")}function jK(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function zK(t){return t.nodeType===3&&!/\S/.test(t.nodeValue||"")}function qK(t){t.querySelectorAll("li > ul, li > ol").forEach(e=>{const n=jK(e),r=e.parentElement,o=Array.from(r.childNodes).slice(n+1);e.remove(),o.forEach(i=>{i.remove()}),r.insertAdjacentElement("afterend",e),o.reverse().forEach(i=>{if(zK(i))return;const s=document.createElement("li");s.append(i),e.insertAdjacentElement("afterend",s)}),r.childNodes.length===0&&r.remove()})}function WK(t){t.querySelectorAll("li + ul, li + ol").forEach(e=>{var n,r;const o=e.previousElementSibling,i=document.createElement("div");o.insertAdjacentElement("afterend",i),i.append(o);const s=document.createElement("div");for(s.setAttribute("data-node-type","blockGroup"),i.append(s);((n=i.nextElementSibling)==null?void 0:n.nodeName)==="UL"||((r=i.nextElementSibling)==null?void 0:r.nodeName)==="OL";)s.append(i.nextElementSibling)})}let Ax=null;function GK(){return Ax||(Ax=document.implementation.createHTMLDocument("title"))}function YK(t){if(typeof t=="string"){const e=GK().createElement("div");e.innerHTML=t,t=e}return qK(t),WK(t),t}function HA(t,e){const n=YK(t),r=hr.fromSchema(e).parse(n,{topNode:e.nodes.blockGroup.create()}),o=[];for(let i=0;i<r.childCount;i++)o.push(pt(r.child(i),e));return o}function KK(t,e){const n=e.value?e.value:"",r={};e.lang&&(r["data-language"]=e.lang);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(o.data={meta:e.meta}),t.patch(e,o),o=t.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},t.patch(e,o),o}function QK(t,e){var n;const r=String(e?.url||""),o=e!=null&&e.title?String(e.title):void 0;let i={type:"element",tagName:"video",properties:{src:r,"data-name":o,"data-url":r,controls:!0},children:[]};return(n=t.patch)==null||n.call(t,e,i),i=t.applyData?t.applyData(e,i):i,i}function UA(t){return Wv().use(PG).use(qv).use(bY,{handlers:{...Nm,image:(e,n)=>{const r=String(n?.url||"");return p8(r)?QK(e,n):Nm.image(e,n)},code:KK}}).use(CK).processSync(t).value}function XK(t,e){const n=UA(t);return HA(n,e)}let ZK=class{constructor(e){this.editor=e}blocksToHTMLLossy(e=this.editor.document){return bf(this.editor.pmSchema,this.editor).exportBlocks(e,{})}blocksToFullHTML(e=this.editor.document){return _K(this.editor.pmSchema,this.editor).serializeBlocks(e,{})}tryParseHTMLToBlocks(e){return HA(e,this.editor.pmSchema)}blocksToMarkdownLossy(e=this.editor.document){return uq(e,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(e){return XK(e,this.editor.pmSchema)}pasteHTML(e,n=!1){var r;let o=e;if(!n){const i=this.tryParseHTMLToBlocks(e);o=this.blocksToFullHTML(i)}o&&((r=this.editor.prosemirrorView)==null||r.pasteHTML(o))}pasteText(e){var n;return(n=this.editor.prosemirrorView)==null?void 0:n.pasteText(e)}pasteMarkdown(e){const n=UA(e);return this.pasteHTML(n)}};const Y0=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function JK(t,e){if(!t.startsWith(".")||!e.startsWith("."))throw new Error("The strings provided are not valid file extensions.");return t===e}function eQ(t,e){const n=t.split("/"),r=e.split("/");if(n.length!==2)throw new Error(`The string ${t} is not a valid MIME type.`);if(r.length!==2)throw new Error(`The string ${e} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function _x(t,e,n,r="after"){let o;return Array.isArray(e.content)&&e.content.length===0?o=t.updateBlock(e,n).id:o=t.insertBlocks([n],e,r)[0].id,o}async function VA(t,e){var n;if(!e.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}const r="dataTransfer"in t?t.dataTransfer:t.clipboardData;if(r===null)return;let o=null;for(const s of Y0)if(r.types.includes(s)){o=s;break}if(o!=="Files")return;const i=r.items;if(i){t.preventDefault();for(let s=0;s<i.length;s++){let a="file";for(const c of Object.values(e.schema.blockSpecs))for(const u of((n=c.implementation.meta)==null?void 0:n.fileBlockAccept)||[]){const d=u.startsWith("."),f=i[s].getAsFile();if(f&&(!d&&f.type&&eQ(i[s].type,u)||d&&JK("."+f.name.split(".").pop(),u))){a=c.config.type;break}}const l=i[s].getAsFile();if(l){const c={type:a,props:{name:l.name}};let u;if(t.type==="paste"){const h=e.getTextCursorPosition().block;u=_x(e,h,c)}else if(t.type==="drop"){const h={left:t.clientX,top:t.clientY},p=e.prosemirrorView.posAtCoords(h);if(!p)return;u=e.transact(g=>{const b=Go(g.doc,p.pos),E=e.prosemirrorView.dom.querySelector(`[data-id="${b.node.attrs.id}"]`),x=E?.getBoundingClientRect();return _x(e,e.getBlock(b.node.attrs.id),c,x&&(x.top+x.bottom)/2>h.top?"before":"after")})}else return;const d=await e.uploadFile(l,u),f=typeof d=="string"?{props:{url:d}}:{...d};e.updateBlock(u,f)}}}}const tQ=t=>We.create({name:"dropFile",addProseMirrorPlugins(){return[new ye({props:{handleDOMEvents:{drop(e,n){if(!t.isEditable)return;let r=null;for(const o of Y0)if(n.dataTransfer.types.includes(o)){r=o;break}return r===null?!0:r==="Files"?(VA(n,t),!0):!1}}}})]}}),nQ=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,rQ=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,oQ=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,iQ=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,sQ=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,aQ=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,lQ=/\n{2} {0,3}-{2,48}\n{2}/,cQ=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,uQ=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,dQ=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,fQ=/^\s*\|(.+\|)+\s*$/m,hQ=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,pQ=/^\s*\|(.+\|)+\s*$/m,mQ=t=>nQ.test(t)||rQ.test(t)||oQ.test(t)||iQ.test(t)||sQ.test(t)||aQ.test(t)||lQ.test(t)||cQ.test(t)||uQ.test(t)||dQ.test(t)||fQ.test(t)||hQ.test(t)||pQ.test(t);async function gQ(t,e){const{schema:n}=e.state;if(!t.clipboardData)return!1;const r=t.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return e.pasteText(r),!0;const o=t.clipboardData.getData("vscode-editor-data"),i=o?JSON.parse(o):void 0,s=i?.mode;return s?(e.pasteHTML(`<pre><code class="language-${s}">${r.replace(/\r\n?/g,`
177
177
  `)}</code></pre>`),!0):!1}function bQ({event:t,editor:e,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){var o;if(e.transact(a=>a.selection.$from.parent.type.spec.code&&a.selection.$to.parent.type.spec.code)){const a=(o=t.clipboardData)==null?void 0:o.getData("text/plain");if(a)return e.pasteText(a),!0}let i;for(const a of Y0)if(t.clipboardData.types.includes(a)){i=a;break}if(!i)return!0;if(i==="vscode-editor-data")return gQ(t,e.prosemirrorView),!0;if(i==="Files")return VA(t,e),!0;const s=t.clipboardData.getData(i);if(i==="blocknote/html")return e.pasteHTML(s,!0),!0;if(i==="text/markdown")return e.pasteMarkdown(s),!0;if(n){const a=t.clipboardData.getData("text/plain");if(mQ(a))return e.pasteMarkdown(a),!0}return i==="text/html"?(e.pasteHTML(s),!0):r?(e.pasteMarkdown(s),!0):(e.pasteText(s),!0)}const yQ=(t,e)=>We.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new ye({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),!!t.isEditable)return e({event:r,editor:t,defaultPasteHandler:({prioritizeMarkdownOverHTML:o=!0,plainTextAsMarkdown:i=!0}={})=>bQ({event:r,editor:t,prioritizeMarkdownOverHTML:o,plainTextAsMarkdown:i})})}}}})]}});function EQ(t,e,n){var r;let o=!1;const i=t.state.selection instanceof Ge;if(!i){const l=t.state.doc.slice(t.state.selection.from,t.state.selection.to,!1).content,c=[];for(let u=0;u<l.childCount;u++)c.push(l.child(u));o=c.find(u=>u.type.isInGroup("bnBlock")||u.type.name==="blockGroup"||u.type.spec.group==="blockContent")===void 0,o&&(e=l)}let s;const a=bf(t.state.schema,n);if(i){((r=e.firstChild)==null?void 0:r.type.name)==="table"&&(e=e.firstChild.content);const l=f2(e,n.schema.inlineContentSchema,n.schema.styleSchema);s=`<table>${a.exportInlineContent(l,{})}</table>`}else if(o){const l=Zd(e,n.schema.inlineContentSchema,n.schema.styleSchema);s=a.exportInlineContent(l,{})}else{const l=Jv(e);s=a.exportBlocks(l,{})}return s}function $A(t,e){"node"in t.state.selection&&t.state.selection.node.type.spec.group==="blockContent"&&e.transact(s=>s.setSelection(new le(s.doc.resolve(t.state.selection.from-1))));const n=t.serializeForClipboard(t.state.selection.content()).dom.innerHTML,r=t.state.selection.content().content,o=EQ(t,r,e),i=L0(o);return{clipboardHTML:n,externalHTML:o,markdown:i}}const Nx=()=>{const t=window.getSelection();if(!t||t.isCollapsed)return!0;let e=t.focusNode;for(;e;){if(e instanceof HTMLElement&&e.getAttribute("contenteditable")==="false")return!0;e=e.parentElement}return!1},Ix=(t,e,n)=>{n.preventDefault(),n.clipboardData.clearData();const{clipboardHTML:r,externalHTML:o,markdown:i}=$A(e,t);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",o),n.clipboardData.setData("text/plain",i)},xQ=t=>We.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new ye({props:{handleDOMEvents:{copy(e,n){return Nx()||Ix(t,e,n),!0},cut(e,n){return Nx()||(Ix(t,e,n),e.editable&&e.dispatch(e.state.tr.deleteSelection())),!0},dragstart(e,n){if(!("node"in e.state.selection)||e.state.selection.node.type.spec.group!=="blockContent")return;t.transact(s=>s.setSelection(new le(s.doc.resolve(e.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();const{clipboardHTML:r,externalHTML:o,markdown:i}=$A(e,t);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",o),n.dataTransfer.setData("text/plain",i),!0}}}})]}}),CQ=We.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:A8()}}]}}),kQ=Cr.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Hn(this.options.HTMLAttributes,t)]},renderText(){return`
178
178
  `}}),Rm=(t,e)=>{const n=t.resolve(e),r=n.index();if(r===0)return;const o=n.posAtIndex(r-1);return Xd(t.resolve(o))},jA=(t,e)=>{for(;e.childContainer;){const n=e.childContainer.node,r=t.resolve(e.childContainer.beforePos+1).posAtIndex(n.childCount-1);e=Xd(t.resolve(r))}return e},TQ=(t,e)=>t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*"&&t.blockContent.node.childCount>0&&e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*",wQ=(t,e,n,r)=>{if(!r.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){const o=t.doc.resolve(r.childContainer.beforePos+1),i=t.doc.resolve(r.childContainer.afterPos-1),s=o.blockRange(i);if(e){const a=t.doc.resolve(r.bnBlock.beforePos);t.tr.lift(s,a.depth)}}if(e){if(!n.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);e(t.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},Mx=t=>({state:e,dispatch:n})=>{const r=e.doc.resolve(t),o=Xd(r),i=Rm(e.doc,o.bnBlock.beforePos);if(!i)return!1;const s=jA(e.doc,i);return TQ(s,o)?wQ(e,n,s,o):!1},SQ=We.create({priority:50,addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({chain:r,commands:o})=>[()=>o.deleteSelection(),()=>o.undoInputRule(),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;const a=i.selection.from===s.blockContent.beforePos+1,l=s.blockContent.node.type.name==="paragraph";return a&&!l?o.command(k8(s.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;const{blockContent:a}=s;return i.selection.from===a.beforePos+1?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;const{bnBlock:a,blockContent:l}=s,c=i.selection.from===l.beforePos+1,u=i.selection.empty,d=a.beforePos;return c&&u?r().command(Mx(d)).scrollIntoView().run():!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{const l=gn(i);if(!l.isBlockContainer||s.selection.from!==l.blockContent.beforePos+1)return!1;const c=s.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;const u=s.doc.resolve(l.bnBlock.beforePos),d=s.doc.resolve(u.before()),f=d.before();if(a){const h=s.doc.slice(l.bnBlock.beforePos,l.bnBlock.afterPos).content;s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),d.index()===0?(Dm(s,f),s.insert(f,h),s.setSelection(ae.near(s.doc.resolve(f)))):(s.insert(d.pos-1,h),s.setSelection(ae.near(s.doc.resolve(d.pos-1))),Dm(s,f))}return!0}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){const a=Rm(i.doc,s.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){const c=s.bnBlock.beforePos-1-1-1-1-1;l=l.setTextSelection(c)}else if(a.blockContent.node.type.spec.content===""){const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setNodeSelection(c)}else{const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setTextSelection(c)}return l.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)throw new Error("todo");const a=i.selection.from===s.blockContent.beforePos+1,l=i.selection.empty,c=Rm(i.doc,s.bnBlock.beforePos);if(c&&a&&l){const u=jA(i.doc,c);if(!u.isBlockContainer)throw new Error("todo");if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),e=()=>this.editor.commands.first(({commands:r})=>[()=>r.deleteSelection(),()=>r.command(({state:o})=>{const i=gn(o);if(!i.isBlockContainer)return!1;const{bnBlock:s,blockContent:a,childContainer:l}=i,{depth:c}=o.doc.resolve(s.beforePos),u=s.afterPos===o.doc.nodeSize-3,d=o.selection.from===a.afterPos-1,f=o.selection.empty;if(!u&&d&&f&&l===void 0){let h=c,p=s.afterPos+1,g=o.doc.resolve(p).depth;for(;g<h;)h=g,p+=2,g=o.doc.resolve(p).depth;return r.command(Mx(p-1))}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:o,tr:i})=>[()=>o.command(({state:s})=>{const a=gn(s);if(!a.isBlockContainer)return!1;const{bnBlock:l,blockContent:c}=a,{depth:u}=s.doc.resolve(l.beforePos),d=s.selection.$anchor.parentOffset===0,f=s.selection.anchor===s.selection.head,h=c.node.childCount===0,p=u>1;return d&&f&&h&&p?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:s})=>{var a;const l=gn(s),c=((a=this.options.editor.schema.blockSchema[l.blockNoteType].meta)==null?void 0:a.hardBreakShortcut)??"shift+enter";if(c==="none")return!1;if(c==="shift+enter"&&r||c==="enter"){const u=i.storedMarks||i.selection.$head.marks().filter(d=>this.editor.extensionManager.splittableMarks.includes(d.type.name));return i.insert(i.selection.head,i.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>o.command(({state:s,dispatch:a})=>{const l=gn(s);if(!l.isBlockContainer)return!1;const{bnBlock:c,blockContent:u}=l,d=s.selection.$anchor.parentOffset===0,f=s.selection.anchor===s.selection.head,h=u.node.childCount===0;if(d&&f&&h){const p=c.afterPos,g=p+2;if(a){const b=s.schema.nodes.blockContainer.createAndFill();s.tr.insert(p,b).scrollIntoView(),s.tr.setSelection(new ae(s.doc.resolve(g)))}return!0}return!1}),()=>o.command(({state:s,chain:a})=>{const l=gn(s);if(!l.isBlockContainer)return!1;const{blockContent:c}=l,u=s.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(nB(s.selection.from,u,u)).run(),!0)})]);return{Backspace:t,Delete:e,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>{var r,o;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Qo))!=null&&r.store.state||((o=this.options.editor.getExtension(fr))==null?void 0:o.store.state)!==void 0)?!1:FA(this.options.editor)},"Shift-Tab":()=>{var r,o;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Qo))!=null&&r.store.state||((o=this.options.editor.getExtension(fr))==null?void 0:o.store.state)!==void 0)?!1:this.editor.commands.liftListItem("blockContainer")},"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),vQ=rr.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="insertion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["ins",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),AQ=rr.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="deletion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["del",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),_Q=rr.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(t){return t.name!=="modification"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return[n?"span":"div",{"data-type":"modification","data-id":String(e.attrs.id),"data-mod-type":e.attrs.type,"data-mod-prev-val":JSON.stringify(e.attrs.previousValue),"data-mod-new-val":JSON.stringify(e.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal,newValue:e.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal}:!1}}]}}}),NQ=We.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:t=>t.getAttribute("data-text-alignment"),renderHTML:t=>t.textAlignment==="left"?{}:{"data-text-alignment":t.textAlignment}}}}]}}),IQ=We.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:_8()}}]}}),MQ={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},OQ=Cr.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:t=>{if(typeof t=="string")return!1;const e={};for(const[n,r]of Object.entries(MQ))t.getAttribute(r)&&(e[n]=t.getAttribute(r));return e}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:t}){var e;const n=document.createElement("div");n.className="bn-block-outer",n.setAttribute("data-node-type","blockOuter");for(const[i,s]of Object.entries(t))i!=="class"&&n.setAttribute(i,s);const r={...((e=this.options.domAttributes)==null?void 0:e.block)||{},...t},o=document.createElement("div");o.className=ut("bn-block",r.class),o.setAttribute("data-node-type",this.name);for(const[i,s]of Object.entries(r))i!=="class"&&o.setAttribute(i,s);return n.appendChild(o),{dom:n,contentDOM:o}}}),DQ=Cr.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:t=>typeof t=="string"?!1:t.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:t}){var e;const n={...((e=this.options.domAttributes)==null?void 0:e.blockGroup)||{},...t},r=document.createElement("div");r.className=ut("bn-block-group",n.class),r.setAttribute("data-node-type","blockGroup");for(const[o,i]of Object.entries(n))o!=="class"&&r.setAttribute(o,i);return{dom:r,contentDOM:r}}}),LQ=Cr.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"});let Ox=!1;function RQ(t,e){const n=[rs.ClipboardTextSerializer,rs.Commands,rs.Editable,rs.FocusEvents,rs.Tabindex,OW,Qd.configure({types:["blockContainer","columnList","column"],setIdAttribute:e.setIdAttribute}),kQ,iG,vQ,AQ,_Q,oG.extend({inclusive:!1}).configure({defaultProtocol:nA,protocols:Ox?[]:tA}),...Object.values(t.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:t})),IQ,CQ,NQ,We.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var r;return(r=t.getExtension(er))!=null&&r.shown()?!1:(t.blur(),!0)}})}),LQ,OQ.configure({editor:t,domAttributes:e.domAttributes}),SQ.configure({editor:t,tabBehavior:e.tabBehavior}),DQ.configure({domAttributes:e.domAttributes}),...Object.values(t.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:t})),...Object.values(t.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:t,domAttributes:e.domAttributes})]:[]]),xQ(t),yQ(t,e.pasteHandler||(r=>r.defaultPasteHandler())),tQ(t)];return Ox=!0,n}function PQ(t,e){var n;const r=[dq(),yq(e),fr(e),Qo(e),Gl(e),Cq(),Tq(e),ml(e),Er(e),er(e),...e.trailingBlock!==!1?[Rq()]:[]];return e.collaboration?(r.push(pq(e.collaboration)),(n=e.collaboration.provider)!=null&&n.awareness&&r.push(gm(e.collaboration)),r.push(Kc(e.collaboration)),r.push(Qc(e.collaboration)),r.push(bq(e.collaboration))):r.push(Eq()),"table"in t.schema.blockSpecs&&r.push(dt(e)),e.animations!==!1&&r.push(Sq()),r}class BQ{constructor(e,n){Be(this,"disabledExtensions",new Set),Be(this,"extensions",[]),Be(this,"abortMap",new Map),Be(this,"extensionFactories",new Map),Be(this,"extensionPlugins",new Map),this.editor=e,this.options=n,e.onMount(()=>{for(const r of this.extensions)if(r.mount){const o=new window.AbortController,i=r.mount({dom:e.prosemirrorView.dom,root:e.prosemirrorView.root,signal:o.signal});i&&o.signal.addEventListener("abort",()=>{i()}),this.abortMap.set(r,o)}}),e.onUnmount(()=>{for(const[r,o]of this.abortMap.entries())this.abortMap.delete(r),o.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(const r of PQ(this.editor,this.options))this.addExtension(r);for(const r of this.options.extensions??[])this.addExtension(r);for(const r of Object.values(this.editor.schema.blockSpecs))for(const o of r.extensions??[])this.addExtension(o)}registerExtension(e){var n;const r=[].concat(e).filter(Boolean);if(!r.length){console.warn("No extensions found to register",e);return}const o=r.map(s=>this.addExtension(s)).filter(Boolean),i=new Set;for(const s of o)s!=null&&s.tiptapExtensions&&console.warn(`Extension ${s.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,s),(n=s?.inputRules)!=null&&n.length&&console.warn(`Extension ${s.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,s),this.getProsemirrorPluginsFromExtension(s).plugins.forEach(a=>{i.add(a)});this.updatePlugins(s=>[...s,...i])}addExtension(e){let n;if(typeof e=="function"?n=e({editor:this.editor}):n=e,!(!n||this.disabledExtensions.has(n.key))){if(typeof e=="function"){const r=n[Up];typeof r=="function"&&this.extensionFactories.set(r,n)}return this.extensions.push(n),n}}resolveExtensions(e){const n=[];if(typeof e=="function"){const r=this.extensionFactories.get(e);r&&n.push(r)}else if(Array.isArray(e))for(const r of e)n.push(...this.resolveExtensions(r));else if(typeof e=="object"&&"key"in e)n.push(e);else if(typeof e=="string"){const r=this.extensions.find(o=>o.key===e);r&&n.push(r)}return n}unregisterExtension(e){var n;const r=this.resolveExtensions(e);if(!r.length){console.warn("No extensions found to unregister",e);return}let o=!1;const i=new Set;for(const s of r){this.extensions=this.extensions.filter(l=>l!==s),this.extensionFactories.forEach((l,c)=>{l===s&&this.extensionFactories.delete(c)}),(n=this.abortMap.get(s))==null||n.abort(),this.abortMap.delete(s);const a=this.extensionPlugins.get(s);a?.forEach(l=>{i.add(l)}),this.extensionPlugins.delete(s),s.tiptapExtensions&&!o&&(o=!0,console.warn(`Extension ${s.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,e))}this.updatePlugins(s=>s.filter(a=>!i.has(a)))}updatePlugins(e){const n=this.editor.prosemirrorState,r=n.reconfigure({plugins:e(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){var e;const n=RQ(this.editor,this.options),r=cA(this.extensions),o=new Map;for(const i of this.extensions){i.tiptapExtensions&&n.push(...i.tiptapExtensions);const s=r(i.key),{plugins:a,inputRules:l}=this.getProsemirrorPluginsFromExtension(i);a.length&&n.push(We.create({name:i.key,priority:s,addProseMirrorPlugins:()=>a})),l.length&&(o.has(s)||o.set(s,[]),o.get(s).push(...l))}n.push(We.create({name:"blocknote-input-rules",addProseMirrorPlugins(){const i=[];return Array.from(o.keys()).sort().reverse().forEach(s=>{i.push(...o.get(s))}),[wW({rules:i})]}}));for(const i of((e=this.options._tiptapOptions)==null?void 0:e.extensions)??[])n.push(i);return n}getProsemirrorPluginsFromExtension(e){var n,r,o;const i=[...e.prosemirrorPlugins??[]],s=[];return!((n=e.prosemirrorPlugins)!=null&&n.length)&&!Object.keys(e.keyboardShortcuts||{}).length&&!((r=e.inputRules)!=null&&r.length)?{plugins:i,inputRules:s}:(this.extensionPlugins.set(e,i),(o=e.inputRules)!=null&&o.length&&s.push(...e.inputRules.map(a=>new Wi(a.find,(l,c,u,d)=>{const f=a.replace({match:c,range:{from:u,to:d},editor:this.editor});if(f){const h=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[h.block.type].content!=="inline")return null;const p=Fl(l.tr),g=l.tr.deleteRange(u,d);return ef(g,p.bnBlock.beforePos,f),g}return null}))),Object.keys(e.keyboardShortcuts||{}).length&&i.push(Nw(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([a,l])=>[a,()=>l({editor:this.editor})])))),{plugins:i,inputRules:s})}getExtensions(){return new Map(this.extensions.map(e=>[e.key,e]))}getExtension(e){if(typeof e=="string")return this.extensions.find(r=>r.key===e)||void 0;if(typeof e=="function")return this.extensionFactories.get(e)||void 0;throw new Error(`Invalid extension type: ${typeof e}`)}hasExtension(e){return typeof e=="string"?this.extensions.some(n=>n.key===e):typeof e=="object"&&"key"in e?this.extensions.some(n=>n.key===e.key):typeof e=="function"?this.extensionFactories.has(e):!1}}function FQ(t){const e=Et(t);if(t.selection.empty||"node"in t.selection)return;const n=t.doc.resolve(Go(t.doc,t.selection.from).posBeforeNode),r=t.doc.resolve(Go(t.doc,t.selection.to).posBeforeNode),o=(c,u)=>{const d=n.posAtIndex(c,u),f=t.doc.resolve(d).nodeAfter;if(!f)throw new Error(`Error getting selection - node not found at position ${d}`);return pt(f,e)},i=[],s=n.sharedDepth(r.pos),a=n.index(s),l=r.index(s);if(n.depth>s){i.push(pt(n.nodeAfter,e));for(let c=n.depth;c>s;c--)if(n.node(c).type.isInGroup("childContainer")){const u=n.index(c)+1,d=n.node(c).childCount;for(let f=u;f<d;f++)i.push(o(f,c))}}else i.push(o(a,s));for(let c=a+1;c<=l;c++)i.push(o(c,s));if(i.length===0)throw new Error(`Error getting selection - selection doesn't span any blocks (${t.selection})`);return{blocks:i}}function HQ(t,e,n){const r=typeof e=="string"?e:e.id,o=typeof n=="string"?n:n.id,i=Et(t),s=Hl(i);if(r===o)throw new Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);const a=dn(r,t.doc);if(!a)throw new Error(`Block with ID ${r} not found`);const l=dn(o,t.doc);if(!l)throw new Error(`Block with ID ${o} not found`);const c=Yo(a),u=Yo(l),d=s.blockSchema[c.blockNoteType],f=s.blockSchema[u.blockNoteType];if(!c.isBlockContainer||d.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!u.isBlockContainer||f.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${o})`);let h,p;if(d.content==="table"){const g=rt.get(c.blockContent.node);h=c.blockContent.beforePos+g.positionAt(0,0,c.blockContent.node)+1+2}else h=c.blockContent.beforePos+1;if(f.content==="table"){const g=rt.get(u.blockContent.node),b=u.blockContent.beforePos+g.positionAt(g.height-1,g.width-1,u.blockContent.node)+1,E=t.doc.resolve(b).nodeAfter.nodeSize;p=b+E-2}else p=u.blockContent.afterPos-1;t.setSelection(ae.create(t.doc,h,p))}function UQ(t){const e=Et(t);let n=t.selection.$from,r=t.selection.$to;for(;r.parentOffset>=r.parent.nodeSize-2&&r.depth>0;)r=t.doc.resolve(r.pos+1);for(;r.parentOffset===0&&r.depth>0;)r=t.doc.resolve(r.pos-1);for(;n.parentOffset===0&&n.depth>0;)n=t.doc.resolve(n.pos-1);for(;n.parentOffset>=n.parent.nodeSize-2&&n.depth>0;)n=t.doc.resolve(n.pos+1);const o=L5(t.doc.slice(n.pos,r.pos,!0),e);return{_meta:{startPos:n.pos,endPos:r.pos},...o}}function VQ(t){const{bnBlock:e}=Fl(t),n=Et(t.doc),r=t.doc.resolve(e.beforePos),o=r.nodeBefore,i=t.doc.resolve(e.afterPos).nodeAfter;let s;return r.depth>1&&(s=r.node(),s.type.isInGroup("bnBlock")||(s=r.node(r.depth-1))),{block:pt(e.node,n),prevBlock:o===null?void 0:pt(o,n),nextBlock:i===null?void 0:pt(i,n),parentBlock:s===void 0?void 0:pt(s,n)}}function zA(t,e,n="start"){const r=typeof e=="string"?e:e.id,o=Et(t.doc),i=Hl(o),s=dn(r,t.doc);if(!s)throw new Error(`Block with ID ${r} not found`);const a=Yo(s),l=i.blockSchema[a.blockNoteType].content;if(a.isBlockContainer){const c=a.blockContent;if(l==="none"){t.setSelection(le.create(t.doc,c.beforePos));return}if(l==="inline")n==="start"?t.setSelection(ae.create(t.doc,c.beforePos+1)):t.setSelection(ae.create(t.doc,c.afterPos-1));else if(l==="table")n==="start"?t.setSelection(ae.create(t.doc,c.beforePos+4)):t.setSelection(ae.create(t.doc,c.afterPos-4));else throw new Hr(l)}else{const c=n==="start"?a.childContainer.node.firstChild:a.childContainer.node.lastChild;zA(t,c.attrs.id,n)}}class $Q{constructor(e){this.editor=e}getSelection(){return this.editor.transact(e=>FQ(e))}getSelectionCutBlocks(){return this.editor.transact(e=>UQ(e))}setSelection(e,n){return this.editor.transact(r=>HQ(r,e,n))}getTextCursorPosition(){return this.editor.transact(e=>VQ(e))}setTextCursorPosition(e,n="start"){return this.editor.transact(r=>zA(r,e,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;const{selection:e}=this.editor.prosemirrorState,{ranges:n}=e,r=Math.min(...n.map(i=>i.$from.pos)),o=Math.max(...n.map(i=>i.$to.pos));if(qw(e)){const i=this.editor.prosemirrorView.nodeDOM(r);if(i)return i.getBoundingClientRect()}return jg(this.editor.prosemirrorView,r,o).toJSON()}}class jQ{constructor(e){Be(this,"activeTransaction",null),Be(this,"isInCan",!1),this.editor=e}can(e){try{return this.isInCan=!0,e()}finally{this.isInCan=!1}}exec(e){if(this.activeTransaction)throw new Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(e);const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,o=>this.prosemirrorView.dispatch(o),r)}canExec(e){if(this.activeTransaction)throw new Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,void 0,r)}transact(e){if(this.activeTransaction)return e(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;const n=e(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw new Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){var e;return((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}focus(){var e;(e=this.prosemirrorView)==null||e.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(e){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==e&&this.editor._tiptapEditor.setEditable(e)}undo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.undoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw new Error("No undo plugin found")}redo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.redoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw new Error("No redo plugin found")}}function zQ(t,e,n,r={updateSelection:!0}){let{from:o,to:i}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},s=!0,a=!0,l="";if(n.forEach(c=>{c.check(),s&&c.isText&&c.marks.length===0?l+=c.text:s=!1,a=a?c.isBlock:!1}),o===i&&a){const{parent:c}=t.doc.resolve(o);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(o-=1,i+=1)}return s?t.insertText(l,o,i):t.replaceWith(o,i,n),r.updateSelection&&Rw(t,t.steps.length-1,-1),!0}class qQ{constructor(e){this.editor=e}insertInlineContent(e,{updateSelection:n=!1}={}){const r=yr(e,this.editor.pmSchema);this.editor.transact(o=>{zQ(o,{from:o.selection.from,to:o.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(e=>{const n={},r=e.selection.$to.marks();for(const o of r){const i=this.editor.schema.styleSchema[o.type.name];if(!i){o.type.name!=="link"&&!o.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",o.type.name);continue}i.propSchema==="boolean"?n[i.type]=!0:n[i.type]=o.attrs.stringValue}return n})}addStyles(e){for(const[n,r]of Object.entries(e)){const o=this.editor.schema.styleSchema[n];if(!o)throw new Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Hr(o.propSchema)}}removeStyles(e){for(const n of Object.keys(e))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(e){for(const[n,r]of Object.entries(e)){const o=this.editor.schema.styleSchema[n];if(!o)throw new Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Hr(o.propSchema)}}getSelectedText(){return this.editor.transact(e=>e.doc.textBetween(e.selection.from,e.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(e,n){if(e==="")return;const r=this.editor.pmSchema.mark("link",{href:e});this.editor.transact(o=>{const{from:i,to:s}=o.selection;n?o.insertText(n,i,s).addMark(i,i+n.length,r):o.setSelection(ae.create(o.doc,s)).addMark(i,s,r)})}}function WQ(t,e){const n=[];return t.forEach((r,o,i)=>{i!==e&&n.push(r)}),V.from(n)}function GQ(t,e){const n=[];for(let r=0;r<t.childCount;r++)if(t.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){const o=n[n.length-1],i=o.copy(o.content.addToEnd(t.child(r)));n[n.length-1]=i}else{const o=e.nodes.table.createChecked(void 0,t.child(r));n.push(o)}else n.push(t.child(r));return t=V.from(n),t}function YQ(t,e){let n=V.from(t.content);if(n=GQ(n,e.state.schema),!KQ(n,e))return new Q(n,t.openStart,t.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){const o=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){const s=n.child(r+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem"||s.type.name==="checkListItem")&&(o.push(n.child(r+1)),n=WQ(n,r+1))}const i=e.state.schema.nodes.blockContainer.createChecked(void 0,o);n=n.replaceChild(r,i)}return new Q(n,t.openStart,t.openEnd)}function KQ(t,e){var n,r;const o=t.childCount===1,i=((n=t.firstChild)==null?void 0:n.type.spec.content)==="inline*",s=((r=t.firstChild)==null?void 0:r.type.spec.content)==="tableRow+";if(o){if(i)return!1;if(s){const a=gn(e.state);if(a.isBlockContainer)return a.blockContent.node.type.spec.content!=="tableRow+"}}return!0}const QQ={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};let XQ=class qA extends Gg{constructor(e){var n,r,o,i,s,a,l,c,u,d;super(),Be(this,"pmSchema"),Be(this,"_tiptapEditor"),Be(this,"elementRenderer",null),Be(this,"blockCache",new WeakMap),Be(this,"dictionary"),Be(this,"schema"),Be(this,"blockImplementations"),Be(this,"inlineContentImplementations"),Be(this,"styleImplementations"),Be(this,"uploadFile"),Be(this,"onUploadStartCallbacks",[]),Be(this,"onUploadEndCallbacks",[]),Be(this,"resolveFileUrl"),Be(this,"settings"),Be(this,"_blockManager"),Be(this,"_eventManager"),Be(this,"_exportManager"),Be(this,"_extensionManager"),Be(this,"_selectionManager"),Be(this,"_stateManager"),Be(this,"_styleManager"),Be(this,"unregisterExtension",(...x)=>this._extensionManager.unregisterExtension(...x)),Be(this,"registerExtension",(...x)=>this._extensionManager.registerExtension(...x)),Be(this,"getExtension",(...x)=>this._extensionManager.getExtension(...x)),Be(this,"mount",x=>{this._tiptapEditor.mount({mount:x})}),Be(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=e,this.dictionary=e.dictionary||CW,this.settings={tables:{splitCells:((n=e?.tables)==null?void 0:n.splitCells)??!1,cellBackgroundColor:((r=e?.tables)==null?void 0:r.cellBackgroundColor)??!1,cellTextColor:((o=e?.tables)==null?void 0:o.cellTextColor)??!1,headers:((i=e?.tables)==null?void 0:i.headers)??!1}};const f={defaultStyles:!0,schema:e.schema||P0.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=f.schema,this.blockImplementations=f.schema.blockSpecs,this.inlineContentImplementations=f.schema.inlineContentSpecs,this.styleImplementations=f.schema.styleSpecs,f.uploadFile){const x=f.uploadFile;this.uploadFile=async(T,D)=>{this.onUploadStartCallbacks.forEach(O=>O.apply(this,[D]));try{return await x(T,D)}finally{this.onUploadEndCallbacks.forEach(O=>O.apply(this,[D]))}}}this.resolveFileUrl=f.resolveFileUrl,this._eventManager=new $K(this),this._extensionManager=new BQ(this,f);const h=this._extensionManager.getTiptapExtensions(),p=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");p&&f.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const g={...QQ,...f._tiptapOptions,element:null,autofocus:f.autofocus??!1,extensions:h,editorProps:{...(s=f._tiptapOptions)==null?void 0:s.editorProps,attributes:{tabIndex:"0",...(l=(a=f._tiptapOptions)==null?void 0:a.editorProps)==null?void 0:l.attributes,...(c=f.domAttributes)==null?void 0:c.editor,class:ut("bn-editor",f.defaultStyles?"bn-default-styles":"",((d=(u=f.domAttributes)==null?void 0:u.editor)==null?void 0:d.class)||"")},transformPasted:YQ}};try{const x=f.initialContent||(p?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Qd.options.generateID()}]);if(!Array.isArray(x)||x.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+x);const T=m6(g.extensions),D=x.map(v=>$i(v,T,this.schema.styleSchema).toJSON()),O=Iu({type:"doc",content:[{type:"blockGroup",content:D}]},T,g.parseOptions);this._tiptapEditor=new i5({...g,content:O.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(x){throw new Error("Error creating document from blocks passed as `initialContent`",{cause:x})}let b;const E=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...x)=>{if(b)return b;const T=E.apply(this.pmSchema.nodes.doc,x),D=JSON.parse(JSON.stringify(T.toJSON()));return D.content[0].content[0].attrs.id="initialBlockId",b=ao.fromJSON(this.pmSchema,D),b},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new VK(this),this._exportManager=new ZK(this),this._selectionManager=new $Q(this),this._stateManager=new jQ(this),this._styleManager=new qQ(this),this.emit("create")}static create(e){return new qA(e??{})}get extensions(){return this._extensionManager.getExtensions()}exec(e){return this._stateManager.exec(e)}canExec(e){return this._stateManager.canExec(e)}transact(e){return this._stateManager.transact(e)}get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){var e;if(!this.headless)return(e=this.prosemirrorView)==null?void 0:e.dom}isFocused(){var e;return this.headless?!1:((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){this.headless||this.prosemirrorView.dom.blur()}onUploadStart(e){return this.onUploadStartCallbacks.push(e),()=>{const n=this.onUploadStartCallbacks.indexOf(e);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(e){return this.onUploadEndCallbacks.push(e),()=>{const n=this.onUploadEndCallbacks.indexOf(e);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(e){return this._blockManager.getBlock(e)}getPrevBlock(e){return this._blockManager.getPrevBlock(e)}getNextBlock(e){return this._blockManager.getNextBlock(e)}getParentBlock(e){return this._blockManager.getParentBlock(e)}forEachBlock(e,n=!1){this._blockManager.forEachBlock(e,n)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,n="start"){return this._selectionManager.setTextCursorPosition(e,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(){return this._selectionManager.getSelectionCutBlocks()}setSelection(e,n){return this._selectionManager.setSelection(e,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(e){this._stateManager.isEditable=e}insertBlocks(e,n,r="before"){return this._blockManager.insertBlocks(e,n,r)}updateBlock(e,n){return this._blockManager.updateBlock(e,n)}removeBlocks(e){return this._blockManager.removeBlocks(e)}replaceBlocks(e,n){return this._blockManager.replaceBlocks(e,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(e,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(e,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(e){this._styleManager.addStyles(e)}removeStyles(e){this._styleManager.removeStyles(e)}toggleStyles(e){this._styleManager.toggleStyles(e)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(e,n){this._styleManager.createLink(e,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(e=this.document){return this._exportManager.blocksToHTMLLossy(e)}blocksToFullHTML(e=this.document){return this._exportManager.blocksToFullHTML(e)}tryParseHTMLToBlocks(e){return this._exportManager.tryParseHTMLToBlocks(e)}blocksToMarkdownLossy(e=this.document){return this._exportManager.blocksToMarkdownLossy(e)}tryParseMarkdownToBlocks(e){return this._exportManager.tryParseMarkdownToBlocks(e)}onChange(e,n){return this._eventManager.onChange(e,n)}onSelectionChange(e,n){return this._eventManager.onSelectionChange(e,n)}onMount(e){this._eventManager.onMount(e)}onUnmount(e){this._eventManager.onUnmount(e)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){const e=this.document;return e.length===0||e.length===1&&e[0].type==="paragraph"&&e[0].content.length===0}pasteHTML(e,n=!1){this._exportManager.pasteHTML(e,n)}pasteText(e){return this._exportManager.pasteText(e)}pasteMarkdown(e){return this._exportManager.pasteMarkdown(e)}};var Gh={exports:{}},Yh={};var Dx;function ZQ(){if(Dx)return Yh;Dx=1;var t=r3(),e=g3();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Yh.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function E(v){if(!x){if(x=!0,T=v,v=f(v),h!==void 0&&g.hasValue){var R=g.value;if(h(R,v))return D=R}return D=v}if(R=D,r(T,v))return R;var j=f(v);return h!==void 0&&h(R,j)?(T=v,R):(T=v,D=j)}var x=!1,T,D,O=d===void 0?null:d;return[function(){return E(u())},O===null?void 0:function(){return E(O())}]},[u,d,f,h]);var b=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Yh}var Lx;function JQ(){return Lx||(Lx=1,Gh.exports=ZQ()),Gh.exports}var eX=JQ();function tX(t,e=n=>n){return eX.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,e,nX)}function nX(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,o]of t)if(!e.has(r)||!Object.is(o,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const n=Rx(t);if(n.length!==Rx(e).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!Object.is(t[n[r]],e[n[r]]))return!1;return!0}function Rx(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}var rX=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},oX=({contentComponent:t})=>{const e=y3.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return y.jsx(y.Fragment,{children:Object.values(e)})};function iX(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:b3.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var sX=class extends Ie.Component{constructor(t){var e;super(t),this.editorContentRef=Ie.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=iX(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:rX(e,this.editorContentRef),...n}),t?.contentComponent&&y.jsx(oX,{contentComponent:t.contentComponent})]})}},aX=C.forwardRef((t,e)=>{const n=Ie.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ie.createElement(sX,{key:n,innerRef:e,...t})}),lX=Ie.memo(aX),WA=C.createContext({editor:null});WA.Consumer;var GA=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),YA=()=>C.useContext(GA),cX=Ie.forwardRef((t,e)=>{const{onDragStart:n}=YA(),r=t.as||"div";return y.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Px(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Bx(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function uX(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function dX(t){if(Px(t)||Bx(t))return!0;if(uX(t)){const e=t.type;if(e)return Px(e)||Bx(e)}return!1}function fX(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var hX=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?ki.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,o=fX(),i=dX(e),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=a=>{this.ref=a}),this.reactElement=y.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Ie.createContext({markViewContentRef:()=>{}});var pX=class extends m5{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,o){var i;return r==="storage"?(i=t.storage[e.name])!=null?i:{}:Reflect.get(n,r,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},o=this.component,i=C.memo(l=>y.jsx(GA.Provider,{value:r,children:C.createElement(o,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new hX(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=El(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function mX(t,e){return n=>n.editor.contentComponent?new pX(t,n,e):{}}var K0=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});K0.displayName="TiptapContext";var gX=()=>C.useContext(K0);function KA({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=C.useMemo(()=>({editor:r}),[r]),i=C.useMemo(()=>({editor:r}),[r]);return y.jsx(WA.Provider,{value:i,children:y.jsx(K0.Provider,{value:o,children:n})})}KA.displayName="Tiptap";function QA({...t}){const{editor:e}=gX();return y.jsx(lX,{editor:e,...t})}QA.displayName="Tiptap.Content";Object.assign(KA,{Content:QA});var bX=Object.defineProperty,yX=(t,e,n)=>e in t?bX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pa=(t,e,n)=>yX(t,typeof e!="symbol"?e+"":e,n);const XA=C.createContext(void 0);function zr(t){return C.useContext(XA)}const ZA=C.createContext(void 0);function fe(){return C.useContext(ZA)}function ge(t){const e=zr();if(!(e!=null&&e.editor))throw new Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return e.editor}function ve(){return zr().editor.dictionary}const EX=t=>{const e=fe(),n=ve(),r=ge(),o=r.getBlock(t.blockId),[i,s]=C.useState(""),a=C.useCallback(u=>{s(u.currentTarget.value)},[]),l=C.useCallback(u=>{u.key==="Enter"&&(u.preventDefault(),r.updateBlock(o.id,{props:{name:xy(i),url:i}}))},[r,o.id,i]),c=C.useCallback(()=>{r.updateBlock(o.id,{props:{name:xy(i),url:i}})},[r,o.id,i]);return y.jsxs(e.FilePanel.TabPanel,{className:"bn-tab-panel",children:[y.jsx(e.FilePanel.TextInput,{className:"bn-text-input",placeholder:n.file_panel.embed.url_placeholder,value:i,onChange:a,onKeyDown:l,"data-test":"embed-input"}),y.jsx(e.FilePanel.Button,{className:"bn-button",onClick:c,"data-test":"embed-input-button",children:n.file_panel.embed.embed_button[o.type]||n.file_panel.embed.embed_button.file})]})},xX=t=>{var e,n;const r=fe(),o=ve(),{setLoading:i}=t,s=ge(),a=s.getBlock(t.blockId),[l,c]=C.useState(!1);C.useEffect(()=>{l&&setTimeout(()=>{c(!1)},3e3)},[l]);const u=C.useCallback(h=>{if(h===null)return;async function p(g){if(i(!0),s.uploadFile!==void 0)try{let b=await s.uploadFile(g,t.blockId);typeof b=="string"&&(b={props:{name:g.name,url:b}}),s.updateBlock(t.blockId,b)}catch{c(!0)}finally{i(!1)}}p(h)},[t.blockId,s,i]),d=s.schema.blockSpecs[a.type],f=(n=(e=d.implementation.meta)==null?void 0:e.fileBlockAccept)!=null&&n.length?d.implementation.meta.fileBlockAccept.join(","):"*/*";return y.jsxs(r.FilePanel.TabPanel,{className:"bn-tab-panel",children:[y.jsx(r.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:f,placeholder:o.file_panel.upload.file_placeholder[a.type]||o.file_panel.upload.file_placeholder.file,value:null,onChange:u}),l&&y.jsx("div",{className:"bn-error-text",children:o.file_panel.upload.upload_error})]})},JA=t=>{const e=fe(),n=ve(),r=ge(),[o,i]=C.useState(!1),s=t.tabs??[...r.uploadFile!==void 0?[{name:n.file_panel.upload.title,tabPanel:y.jsx(xX,{blockId:t.blockId,setLoading:i})}]:[],{name:n.file_panel.embed.title,tabPanel:y.jsx(EX,{blockId:t.blockId})}],[a,l]=C.useState(t.defaultOpenTab||s[0].name);return y.jsx(e.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:l,tabs:s,loading:o})};function CX(t){let e=new DOMRect;const n="getBoundingClientRect"in t?()=>t.getBoundingClientRect():()=>t.element.getBoundingClientRect();return()=>"element"in t&&(t.cacheMountedBoundingClientRect??!0)?(t.element.isConnected&&(e=n()),e):n()}const Or=t=>{var e,n,r;const{refs:o,floatingStyles:i,context:s}=aW({whileElementsMounted:E3,...t.useFloatingOptions}),{isMounted:a,styles:l}=uW(s,t.useTransitionStylesProps),{status:c}=aA(s,t.useTransitionStatusProps),u=iW(s,t.useDismissProps),d=tW(s,{enabled:!1,...t.useHoverProps}),{getFloatingProps:f}=lW([u,d]),h=C.useRef(""),p=C.useRef(null),g=qq([p,o.setFloating]);if(C.useEffect(()=>{t.reference&&("element"in t.reference&&o.setReference(t.reference.element),o.setPositionReference({getBoundingClientRect:CX(t.reference)}))},[t.reference,o]),C.useEffect(()=>{var E;(c==="initial"||c==="open")&&(E=p.current)!=null&&E.innerHTML&&(h.current=p.current.innerHTML)},[c,t.reference,t.children]),!a)return!1;const b={...t.elementProps,style:{display:"flex",...(e=t.elementProps)==null?void 0:e.style,zIndex:`calc(var(--bn-ui-base-z-index) + ${((r=(n=t.elementProps)==null?void 0:n.style)==null?void 0:r.zIndex)||0})`,...i,...l},...f()};return c==="close"?y.jsx("div",{ref:g,...b,dangerouslySetInnerHTML:{__html:h.current}}):y.jsx("div",{ref:g,...b,children:t.children})},e_=t=>{const{blockId:e,children:n,...r}=t,o=ge(),i=C.useMemo(()=>o.transact(s=>{if(!e)return;const a=dn(e,s.doc);if(!a)return;const{node:l}=o.prosemirrorView.domAtPos(a.posBeforeNode+1);if(l instanceof Element)return{element:l}}),[o,e]);return y.jsx(Or,{reference:i,...r,children:e!==void 0&&n})};function Re(t,e){const n=(e?.editor??ge()).getExtension(t);if(!n)throw new Error("Extension not found",{cause:{plugin:t}});return n}function et(t,e){const{store:n}=Re(t,e);if(!n)throw new Error("Store not found on plugin",{cause:{plugin:t}});return tX(n,e?.selector)}const kX=t=>{const e=ge(),n=Re(fr),r=et(fr),o=C.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:(s,a,l)=>{s||n.closeMenu(),l==="escape-key"&&e.focus()},middleware:[Dr(10),Hi()]},elementProps:{style:{zIndex:90}},...t.floatingUIOptions}),[r,e,n,t.floatingUIOptions]),i=t.filePanel||JA;return y.jsx(e_,{blockId:r,...o,children:r&&y.jsx(i,{blockId:r})})};function TX(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var wX=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n};const SX=TX(wX);var t_={exports:{}},Kh={},Fx={exports:{}},Qh={};var Hx;function vX(){if(Hx)return Qh;Hx=1;var t=Ie;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function a(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),g=p[0].inst,b=p[1];return i(function(){g.value=h,g.getSnapshot=f,l(g)&&b({inst:g})},[d,h,f]),o(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),s(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Qh.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Qh}var Ux;function AX(){return Ux||(Ux=1,Fx.exports=vX()),Fx.exports}var Vx;function _X(){if(Vx)return Kh;Vx=1;var t=Ie,e=AX();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Kh.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function E(v){if(!x){if(x=!0,T=v,v=f(v),h!==void 0&&g.hasValue){var R=g.value;if(h(R,v))return D=R}return D=v}if(R=D,r(T,v))return R;var j=f(v);return h!==void 0&&h(R,j)?(T=v,R):(T=v,D=j)}var x=!1,T,D,O=d===void 0?null:d;return[function(){return E(u())},O===null?void 0:function(){return E(O())}]},[u,d,f,h]);var b=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Kh}t_.exports=_X();var NX=t_.exports;const IX=typeof window<"u"?C.useLayoutEffect:C.useEffect;class MX{constructor(e){pa(this,"transactionNumber",0),pa(this,"lastTransactionNumber",0),pa(this,"lastSnapshot"),pa(this,"editor"),pa(this,"subscribers",new Set),this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e,n){if(this.editor=e,this.editor){const r=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},o=this.editor._tiptapEditor,i={all:"transaction",selection:"selectionUpdate",change:"update"};return o.on(i[n],r),()=>{o.off(i[n],r)}}}}function Ot(t){const e=zr(),n=t.editor||e?.editor||null,r=t.on||"all",[o]=C.useState(()=>new MX(n)),i=NX.useSyncExternalStoreWithSelector(o.subscribe,o.getSnapshot,o.getServerSnapshot,t.selector,t.equalityFn??SX);return IX(()=>o.watch(n,r),[n,o,r]),C.useDebugValue(i),i}const Q0=t=>{const{position:e,children:n,...r}=t,{from:o,to:i}=e||{},s=ge(),a=C.useMemo(()=>{var l;if(!(o===void 0||i===void 0))return{element:((l=s.domElement)==null?void 0:l.firstElementChild)||void 0,getBoundingClientRect:()=>jg(s.prosemirrorView,o,i??o)}},[s,o,i]);return y.jsx(Or,{reference:a,...r,children:e!==void 0&&n})};var n_={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},$x=Ie.createContext&&Ie.createContext(n_),OX=["attr","size","title"];function DX(t,e){if(t==null)return{};var n=LX(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function LX(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function md(){return md=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},md.apply(this,arguments)}function jx(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function gd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jx(Object(n),!0).forEach(function(r){RX(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jx(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RX(t,e,n){return e=PX(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PX(t){var e=BX(t,"string");return typeof e=="symbol"?e:e+""}function BX(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function r_(t){return t&&t.map((e,n)=>Ie.createElement(e.tag,gd({key:n},e.attr),r_(e.child)))}function he(t){return e=>Ie.createElement(FX,md({attr:gd({},t.attr)},e),r_(t.child))}function FX(t){var e=n=>{var{attr:r,size:o,title:i}=t,s=DX(t,OX),a=o||n.size||"1em",l;return n.className&&(l=n.className),t.className&&(l=(l?l+" ":"")+t.className),Ie.createElement("svg",md({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:gd(gd({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Ie.createElement("title",null,i),t.children)};return $x!==void 0?Ie.createElement($x.Consumer,null,n=>e(n)):e(n_)}function HX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(t)}function o_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(t)}function UX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(t)}function VX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(t)}function $X(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(t)}function jX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(t)}function zX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(t)}function qX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(t)}function WX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(t)}function GX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(t)}function YX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(t)}function zx(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(t)}function bd(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(t)}function yd(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(t)}function Ed(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function i_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(t)}function s_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function a_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(t)}function KX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(t)}function QX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(t)}function qx(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(t)}function XX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(t)}function ZX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(t)}function l_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(t)}function c_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(t)}function u_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function d_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function JX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(t)}function eZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(t)}function f_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(t)}function tZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(t)}function nZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(t)}function X0(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(t)}function rZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(t)}function oZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(t)}function iZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(t)}function sZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(t)}function aZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(t)}function h_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(t)}function lZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(t)}function cZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(t)}function uZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(t)}function dZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function fZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function hZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(t)}function pZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(t)}function mZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(t)}function gZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(t)}function bZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(t)}function Wx(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(t)}const yZ={bold:GX,italic:XX,underline:rZ,strike:tZ,code:VX};function EZ(t,e){return t in e.schema.styleSchema&&e.schema.styleSchema[t].type===t&&e.schema.styleSchema[t].propSchema==="boolean"}const Ic=t=>{const e=ve(),n=fe(),r=ge(),o=Ot({editor:r,selector:({editor:a})=>{var l;if(!(!a.isEditable||!EZ(t.basicTextStyle,a)||!(((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return t.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),i=C.useCallback(a=>{r.focus(),r.toggleStyles({[a]:!0})},[r,t]);if(o===void 0)return null;const s=yZ[t.basicTextStyle];return y.jsx(n.FormattingToolbar.Button,{className:"bn-button","data-test":t.basicTextStyle,onClick:()=>i(t.basicTextStyle),isSelected:o.active,label:e.formatting_toolbar[t.basicTextStyle].tooltip,mainTooltip:e.formatting_toolbar[t.basicTextStyle].tooltip,secondaryTooltip:Mn(e.formatting_toolbar[t.basicTextStyle].secondary_tooltip,e.generic.ctrl_shortcut),icon:y.jsx(s,{})})},Pm=t=>{const e=t.textColor||"default",n=t.backgroundColor||"default",r=t.size||16,o=C.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return y.jsx("div",{className:"bn-color-icon","data-background-color":n,"data-text-color":e,style:o,children:"A"})},Gx=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],Ef=t=>{const e=fe(),n=ve();return y.jsxs(y.Fragment,{children:[y.jsx(()=>t.text?y.jsxs(y.Fragment,{children:[y.jsx(e.Generic.Menu.Label,{children:n.color_picker.text_title}),Gx.map(r=>y.jsx(e.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.text.setColor(r)},"data-test":"text-color-"+r,icon:y.jsx(Pm,{textColor:r,size:t.iconSize}),checked:t.text.color===r,children:n.color_picker.colors[r]},"text-color-"+r))]}):null,{}),y.jsx(()=>t.background?y.jsxs(y.Fragment,{children:[y.jsx(e.Generic.Menu.Label,{children:n.color_picker.background_title}),Gx.map(r=>y.jsx(e.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.background.setColor(r)},"data-test":"background-color-"+r,icon:y.jsx(Pm,{backgroundColor:r,size:t.iconSize}),checked:t.background.color===r,children:n.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function Mc(t,e){return`${t}Color`in e.schema.styleSchema&&e.schema.styleSchema[`${t}Color`].type===`${t}Color`&&e.schema.styleSchema[`${t}Color`].propSchema==="string"}const xZ=()=>{const t=fe(),e=ve(),n=ge(),r=Mc("text",n),o=Mc("background",n),i=Ot({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable||!(((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block]).find(f=>f.content!==void 0))return;const u=Mc("text",l),d=Mc("background",l);if(!(!u&&!d))return{textColor:u?l.getActiveStyles().textColor||"default":void 0,backgroundColor:d?l.getActiveStyles().backgroundColor||"default":void 0}}}),s=C.useCallback(l=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");l==="default"?n.removeStyles({textColor:l}):n.addStyles({textColor:l}),setTimeout(()=>{n.focus()})},[n,r]),a=C.useCallback(l=>{if(!o)throw Error("Tried to set background color, but style does not exist in editor schema.");l==="default"?n.removeStyles({backgroundColor:l}):n.addStyles({backgroundColor:l}),setTimeout(()=>{n.focus()})},[o,n]);return i===void 0?null:y.jsxs(t.Generic.Menu.Root,{children:[y.jsx(t.Generic.Menu.Trigger,{children:y.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:e.formatting_toolbar.colors.tooltip,mainTooltip:e.formatting_toolbar.colors.tooltip,icon:y.jsx(Pm,{textColor:i.textColor,backgroundColor:i.backgroundColor,size:20})})}),y.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{text:i.textColor?{color:i.textColor,setColor:s}:void 0,background:i.backgroundColor?{color:i.backgroundColor,setColor:a}:void 0})})]})},Yx=t=>{for(const e of tA)if(t.startsWith(e))return t;return`${nA}://${t}`},p_=t=>{const e=fe(),n=ve(),{editLink:r}=Re(Gl),{url:o,text:i,showTextField:s}=t,[a,l]=C.useState(o),[c,u]=C.useState(i);C.useEffect(()=>{l(o),u(i)},[i,o]);const d=C.useCallback(g=>{var b,E;g.key==="Enter"&&(g.preventDefault(),r(Yx(a),c,t.range.from),(b=t.setToolbarOpen)==null||b.call(t,!1),(E=t.setToolbarFrozen)==null||E.call(t,!1))},[r,a,c,t]),f=C.useCallback(g=>l(g.currentTarget.value),[]),h=C.useCallback(g=>u(g.currentTarget.value),[]),p=C.useCallback(()=>{var g,b;r(Yx(a),c,t.range.from),(g=t.setToolbarOpen)==null||g.call(t,!1),(b=t.setToolbarFrozen)==null||b.call(t,!1)},[r,a,c,t]);return y.jsxs(e.Generic.Form.Root,{children:[y.jsx(e.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:y.jsx(l_,{}),autoFocus:!0,placeholder:n.link_toolbar.form.url_placeholder,value:a,onKeyDown:d,onChange:f,onSubmit:p}),s!==!1&&y.jsx(e.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:y.jsx(X0,{}),placeholder:n.link_toolbar.form.title_placeholder,value:c,onKeyDown:d,onChange:h,onSubmit:p})]})};function CZ(t){return"link"in t.schema.inlineContentSchema&&t.schema.inlineContentSchema.link==="link"}const kZ=()=>{const t=ge(),e=fe(),n=ve(),r=Re(Qo),{showSelection:o}=Re(ml),[i,s]=C.useState(!1);C.useEffect(()=>{o(i)},[i,o]);const a=Ot({editor:t,selector:({editor:l})=>{var c;if(!(!l.isEditable||!CZ(l)||Jp(l.prosemirrorState.selection)||!(((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block]).find(u=>u.content!==void 0)))return{url:l.getSelectedLinkUrl(),text:l.getSelectedText(),range:{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}}}});return C.useEffect(()=>{const l=c=>{(c.ctrlKey||c.metaKey)&&c.key==="k"&&(s(!0),c.preventDefault())};return t.prosemirrorView.dom.addEventListener("keydown",l),()=>{t.prosemirrorView.dom.removeEventListener("keydown",l)}},[t.prosemirrorView,t.headless]),a===void 0?null:y.jsxs(e.Generic.Popover.Root,{open:i,children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:Mn(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:y.jsx(l_,{}),onClick:()=>s(!0)})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(p_,{url:a.url||"",text:a.text,range:a.range,showTextField:!1,setToolbarOpen:l=>r.store.setState(l)})})]})},TZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block];if(u.length!==1)return;const d=u[0];if(kn(d,l,d.type,{url:"string",caption:"string"}))return d}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.caption)},[r]);const s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&st(n,r.type,{caption:"string"})&&l.key==="Enter"&&(l.preventDefault(),n.updateBlock(r.id,{props:{caption:o}}))},[r,o,n]);return r===void 0?null:y.jsxs(e.Generic.Popover.Root,{children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_caption.tooltip,mainTooltip:t.formatting_toolbar.file_caption.tooltip,icon:y.jsx(qx,{})})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(e.Generic.Form.Root,{children:y.jsx(e.Generic.Form.TextInput,{name:"file-caption",icon:y.jsx(qx,{}),value:o||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},wZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!i.isEditable)return;const a=((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(kn(l,i,l.type,{url:"string"}))return l}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.removeBlocks([r.id]))},[r,n]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,mainTooltip:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,icon:y.jsx(dZ,{}),onClick:o})},SZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block];if(u.length!==1)return;const d=u[0];if(kn(d,l,d.type,{url:"string",name:"string"}))return d}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.name)},[r]);const s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&st(n,r.type,{name:"string"})&&l.key==="Enter"&&(l.preventDefault(),n.updateBlock(r.id,{props:{name:o}}))},[r,o,n]);return r===void 0?null:y.jsxs(e.Generic.Popover.Root,{children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,mainTooltip:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,icon:y.jsx(zx,{})})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(e.Generic.Form.Root,{children:y.jsx(e.Generic.Form.TextInput,{name:"file-name",icon:y.jsx(zx,{}),value:o||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_rename.input_placeholder[r.type]||t.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},vZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:o})=>{var i;if(!o.isEditable)return;const s=((i=o.getSelection())==null?void 0:i.blocks)||[o.getTextCursorPosition().block];if(s.length!==1)return;const a=s[0];if(kn(a,o,a.type,{url:"string"}))return a}});return r===void 0?null:y.jsxs(e.Generic.Popover.Root,{position:"bottom",children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",mainTooltip:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,label:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,icon:y.jsx(aZ,{})})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:y.jsx(JA,{blockId:r.id})})]})},AZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!(!i.isEditable||!(((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block]).find(a=>a.content!==void 0)))return{canNestBlock:i.canNestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canNestBlock&&(n.focus(),n.nestBlock())},[n,r]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:o,isDisabled:!r.canNestBlock,label:t.formatting_toolbar.nest.tooltip,mainTooltip:t.formatting_toolbar.nest.tooltip,secondaryTooltip:Mn(t.formatting_toolbar.nest.secondary_tooltip,t.generic.ctrl_shortcut),icon:y.jsx(QX,{})})},_Z=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!(!i.isEditable||!(((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block]).find(a=>a.content!==void 0)))return{canUnnestBlock:i.canUnnestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(n.focus(),n.unnestBlock())},[n,r]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:o,isDisabled:!r.canUnnestBlock,label:t.formatting_toolbar.unnest.tooltip,mainTooltip:t.formatting_toolbar.unnest.tooltip,secondaryTooltip:Mn(t.formatting_toolbar.unnest.secondary_tooltip,t.generic.ctrl_shortcut),icon:y.jsx(KX,{})})},NZ=t=>[{name:t.slash_menu.paragraph.title,type:"paragraph",icon:X0},{name:t.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:bd},{name:t.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:yd},{name:t.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:Ed},{name:t.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:i_},{name:t.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:s_},{name:t.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:a_},{name:t.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:bd},{name:t.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:yd},{name:t.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:Ed},{name:t.slash_menu.quote.title,type:"quote",icon:f_},{name:t.slash_menu.toggle_list.title,type:"toggleListItem",icon:h_},{name:t.slash_menu.bullet_list.title,type:"bulletListItem",icon:d_},{name:t.slash_menu.numbered_list.title,type:"numberedListItem",icon:u_},{name:t.slash_menu.check_list.title,type:"checkListItem",icon:c_}],IZ=t=>{const e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:a})=>{var l;return((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block]}}),o=r[0],i=C.useMemo(()=>(t.items||NZ(n.dictionary)).filter(a=>st(n,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([l,c])=>[l,typeof c])))),[n,t.items]),s=C.useMemo(()=>i.map(a=>{const l=a.icon,c=a.type===o.type,u=Object.entries(a.props||{}).filter(([d,f])=>f!==o.props[d]).length===0;return{text:a.name,icon:y.jsx(l,{size:16}),onClick:()=>{n.focus(),n.transact(()=>{for(const d of r)n.updateBlock(d,{type:a.type,props:a.props})})},isSelected:c&&u}}),[n,i,o.props,o.type,r]);return!C.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!n.isEditable?null:y.jsx(e.FormattingToolbar.Select,{className:"bn-select",items:s})},MZ=()=>{const t=ve(),e=fe(),n=Re("comments"),{store:r}=Re(Qo),o=C.useCallback(()=>{n.startPendingComment(),r.setState(!1)},[n,r]);return y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:y.jsx(o_,{}),onClick:o})},OZ=()=>ge().getExtension("comments")?y.jsx(MZ,{}):null,DZ=()=>{const t=ve(),e=fe(),n=ge(),r=C.useCallback(()=>{n._tiptapEditor.chain().focus().addPendingComment().run()},[n]);return!n._tiptapEditor.commands.addPendingComment||!n.isEditable?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:y.jsx(o_,{}),onClick:r})};function Bm(t,e){try{const n=new URL(t,e);if(n.protocol!=="javascript:")return n.href}catch{}return"#"}const LZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;const a=((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(kn(l,i,l.type,{url:"string"}))return l}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.resolveFileUrl?n.resolveFileUrl(r.props.url).then(i=>window.open(Bm(i,window.location.href))):window.open(Bm(r.props.url,window.location.href)))},[r,n]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,mainTooltip:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,icon:y.jsx(hZ,{}),onClick:o})},RZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!i.isEditable)return;const a=((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(kn(l,i,l.type,{url:"string",showPreview:"boolean"}))return l}}),o=C.useCallback(()=>{r!==void 0&&st(n,r.type,{showPreview:"boolean"})&&n.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,n]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:t.formatting_toolbar.file_preview_toggle.tooltip,icon:y.jsx(sZ,{}),isSelected:r.props.showPreview,onClick:o})},PZ=()=>{const t=ve(),e=fe(),n=ge(),r=Re(dt),o=Ot({editor:n,selector:({editor:s})=>{var a;if(!s.isEditable||!s.settings.tables.splitCells)return;const l=((a=s.getSelection())==null?void 0:a.blocks)||[s.getTextCursorPosition().block];if(l.length!==1)return;const c=l[0];if(c.type==="table")return{mergeDirection:r.getMergeDirection(c)}}}),i=C.useCallback(()=>{r?.mergeCells()},[r]);return o===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:t.formatting_toolbar.table_cell_merge.tooltip,icon:o.mergeDirection==="horizontal"?y.jsx(JX,{}):y.jsx(eZ,{}),onClick:i})},BZ={left:qX,center:jX,right:WX,justify:zX},Xh=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),i=Ot({editor:r,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block],d=u[0];if(kn(d,l,d.type,{textAlignment:He.textAlignment}))return{textAlignment:d.props.textAlignment,blocks:u};if(u.length===1&&kn(d,l,"table"))return o.getCellSelection()?{textAlignment:qo(d.content.rows[0].cells[0]).props.textAlignment,blocks:[d]}:void 0}}),s=C.useCallback(l=>{if(i!==void 0){r.focus();for(const c of i.blocks)if(kn(c,r,c.type,{textAlignment:He.textAlignment})&&st(r,c.type,{textAlignment:He.textAlignment}))r.updateBlock(c,{props:{textAlignment:l}});else if(c.type==="table"){const u=o.getCellSelection();if(!u)continue;const d=c.content.rows.map(f=>({...f,cells:f.cells.map(h=>qo(h))}));u.cells.forEach(({row:f,col:h})=>{d[f].cells[h].props.textAlignment=l}),r.updateBlock(c,{type:"table",content:{...c.content,type:"tableContent",rows:d}}),r.setTextCursorPosition(c)}}},[r,i,o]);if(i===void 0)return null;const a=BZ[t.textAlignment];return y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${t.textAlignment.slice(0,1).toUpperCase()+t.textAlignment.slice(1)}`,onClick:()=>s(t.textAlignment),isSelected:i.textAlignment===t.textAlignment,label:n.formatting_toolbar[`align_${t.textAlignment}`].tooltip,mainTooltip:n.formatting_toolbar[`align_${t.textAlignment}`].tooltip,icon:y.jsx(a,{})})},Z0=t=>[y.jsx(IZ,{items:t},"blockTypeSelect"),y.jsx(PZ,{},"tableCellMergeButton"),y.jsx(TZ,{},"fileCaptionButton"),y.jsx(vZ,{},"replaceFileButton"),y.jsx(SZ,{},"fileRenameButton"),y.jsx(wZ,{},"fileDeleteButton"),y.jsx(LZ,{},"fileDownloadButton"),y.jsx(RZ,{},"filePreviewButton"),y.jsx(Ic,{basicTextStyle:"bold"},"boldStyleButton"),y.jsx(Ic,{basicTextStyle:"italic"},"italicStyleButton"),y.jsx(Ic,{basicTextStyle:"underline"},"underlineStyleButton"),y.jsx(Ic,{basicTextStyle:"strike"},"strikeStyleButton"),y.jsx(Xh,{textAlignment:"left"},"textAlignLeftButton"),y.jsx(Xh,{textAlignment:"center"},"textAlignCenterButton"),y.jsx(Xh,{textAlignment:"right"},"textAlignRightButton"),y.jsx(xZ,{},"colorStyleButton"),y.jsx(AZ,{},"nestBlockButton"),y.jsx(_Z,{},"unnestBlockButton"),y.jsx(kZ,{},"createLinkButton"),y.jsx(OZ,{},"addCommentButton"),y.jsx(DZ,{},"addTiptapCommentButton")],J0=t=>{const e=fe();return y.jsx(e.FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:t.children||Z0(t.blockTypeSelectItems)})},FZ=t=>{switch(t){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},e1=t=>{const e=ge(),n=Re(Qo,{editor:e}),r=et(Qo,{editor:e}),o=Ot({editor:e,selector:({editor:l})=>n.store.state?{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}:void 0}),i=Ot({editor:e,selector:({editor:l})=>{const c=l.getTextCursorPosition().block;return kn(c,l,c.type,{textAlignment:He.textAlignment})?FZ(c.props.textAlignment):"top-start"}}),s=C.useMemo(()=>({useFloatingOptions:{open:r,onOpenChange:(l,c,u)=>{n.store.setState(l),u==="escape-key"&&e.focus()},placement:i,middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:40}},...t.floatingUIOptions}),[r,i,t.floatingUIOptions,n.store,e]),a=t.formattingToolbar||J0;return y.jsx(Q0,{position:o,...s,children:r&&y.jsx(a,{})})},m_=t=>{const e=fe(),n=ve(),{deleteLink:r}=Re(Gl);return y.jsx(e.LinkToolbar.Button,{className:"bn-button",label:n.link_toolbar.delete.tooltip,mainTooltip:n.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{var o;r(t.range.from),(o=t.setToolbarOpen)==null||o.call(t,!1)},icon:y.jsx(ZX,{})})},g_=t=>{const e=fe(),n=ve();return y.jsxs(e.Generic.Popover.Root,{onOpenChange:t.setToolbarFrozen,children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.edit.tooltip,isSelected:!1,children:n.link_toolbar.edit.text})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(p_,{url:t.url,text:t.text,range:t.range,setToolbarOpen:t.setToolbarOpen,setToolbarFrozen:t.setToolbarFrozen})})]})},HZ=t=>{const e=fe(),n=ve();return y.jsx(e.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.open.tooltip,label:n.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(Bm(t.url,window.location.href),"_blank")},icon:y.jsx(pZ,{})})},b_=t=>{const e=fe();return y.jsx(e.LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(g_,{url:t.url,text:t.text,range:t.range,setToolbarFrozen:t.setToolbarFrozen,setToolbarOpen:t.setToolbarOpen}),y.jsx(HZ,{url:t.url}),y.jsx(m_,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})})},y_=t=>{const e=ge(),[n,r]=C.useState(!1),[o,i]=C.useState(!1),s=Re(Gl),a=Ot({editor:e,selector:()=>{const p=s.getLinkAtSelection();if(p)return{url:p.mark.attrs.href,text:p.text,range:p.range,element:s.getLinkElementAtPos(p.range.from)}}});C.useEffect(()=>{o||(r(!!a),a&&c(void 0))},[o,a]);const[l,c]=C.useState(void 0);C.useEffect(()=>{const p=g=>{if(a||!(g.target instanceof HTMLElement))return;const b=s.getLinkAtElement(g.target);b&&c({url:b.mark.attrs.href,text:b.text,range:b.range,element:s.getLinkElementAtPos(b.range.from)})};return document.body.addEventListener("mouseover",p),()=>{document.body.removeEventListener("mouseover",p)}},[o,s,l?.url,a]);const u=a||l,d=C.useMemo(()=>({useFloatingOptions:{open:n,onOpenChange:(p,g,b)=>{o||a&&b==="hover"||(b==="escape-key"&&e.focus(),r(p))},placement:"top-start",middleware:[Dr(10),Hi()]},useHoverProps:{enabled:!a&&!!l,delay:{open:250,close:250},handleClose:fW()},elementProps:{style:{zIndex:50}},...t.floatingUIOptions}),[e,o,l,n,t.floatingUIOptions,a]),f=C.useMemo(()=>u!=null&&u.element?{element:u.element}:void 0,[u?.element]);if(!e.isEditable)return null;const h=t.linkToolbar||b_;return y.jsx(Or,{reference:f,...d,children:u&&y.jsx(h,{url:u.url,text:u.text,range:u.range,setToolbarFrozen:i,setToolbarOpen:r})})};function UZ(t){return he({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(t)}const VZ=()=>{const t=fe(),e=ve(),n=ge(),r=Re(er),o=et(Er,{editor:n,selector:s=>s?.block}),i=C.useCallback(()=>{if(o===void 0)return;const s=o.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)n.setTextCursorPosition(o),r.openSuggestionMenu("/");else{const a=n.insertBlocks([{type:"paragraph"}],o,"after")[0];n.setTextCursorPosition(a),r.openSuggestionMenu("/")}},[o,n,r]);return o===void 0?null:y.jsx(t.SideMenu.Button,{className:"bn-button",label:e.side_menu.add_block_label,icon:y.jsx(UZ,{size:24,onClick:i,"data-test":"dragHandleAdd"})})};function E_(t){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function $Z(t){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(t)}const jZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:o=>o?.block});return r===void 0||!kn(r,n,r.type,{textColor:"string"})&&!kn(r,n,r.type,{backgroundColor:"string"})?null:y.jsxs(e.Generic.Menu.Root,{position:"right",sub:!0,children:[y.jsx(e.Generic.Menu.Trigger,{sub:!0,children:y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children})}),y.jsx(e.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{iconSize:18,text:kn(r,n,r.type,{textColor:"string"})&&st(n,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:o=>n.updateBlock(r,{type:r.type,props:{textColor:o}})}:void 0,background:kn(r,n,r.type,{backgroundColor:"string"})&&st(n,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:o=>n.updateBlock(r,{props:{backgroundColor:o}})}:void 0})})]})},zZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:o=>o?.block});return r===void 0?null:y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>n.removeBlocks([r]),children:t.children})},qZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;const o=!!r.content.headerRows;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerRows:o?void 0:1}})},children:t.children})},WZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;const o=!!r.content.headerCols;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerCols:o?void 0:1}})},children:t.children})},GZ=t=>{const e=fe(),n=ve();return y.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(zZ,{children:n.drag_handle.delete_menuitem}),y.jsx(jZ,{children:n.drag_handle.colors_menuitem}),y.jsx(qZ,{children:n.drag_handle.header_row_menuitem}),y.jsx(WZ,{children:n.drag_handle.header_column_menuitem})]})})},YZ=t=>{const e=fe(),n=ve(),r=Re(Er),o=et(Er,{selector:s=>s?.block});if(o===void 0)return null;const i=t.dragHandleMenu||GZ;return y.jsxs(e.Generic.Menu.Root,{onOpenChange:s=>{s?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[y.jsx(e.Generic.Menu.Trigger,{children:y.jsx(e.SideMenu.Button,{label:n.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>r.blockDragStart(s,o),onDragEnd:r.blockDragEnd,className:"bn-button",icon:y.jsx(E_,{size:24,"data-test":"dragHandle"})})}),y.jsx(i,{children:t.children})]})},KZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:i=>i?.block}),o=C.useMemo(()=>{var i;if(r===void 0)return{};const s={"data-block-type":r.type};return r.type==="heading"&&(s["data-level"]=r.props.level.toString()),(i=n.schema.blockSpecs[r.type].implementation.meta)!=null&&i.fileBlockAccept&&(r.props.url?s["data-url"]="true":s["data-url"]="false"),s},[r,n.schema.blockSpecs]);return y.jsx(e.SideMenu.Root,{className:"bn-side-menu",...o,children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(VZ,{}),y.jsx(YZ,{})]})})},QZ=t=>{const e=et(Er,{selector:s=>s!==void 0?{show:s.show,block:s.block}:void 0}),{show:n,block:r}=e||{},o=C.useMemo(()=>({useFloatingOptions:{open:n,placement:"left-start"},useDismissProps:{enabled:!1},elementProps:{style:{zIndex:20}},...t.floatingUIOptions}),[t.floatingUIOptions,n]),i=t.sideMenu||KZ;return y.jsx(e_,{blockId:n?r?.id:void 0,...o,children:r?.id&&y.jsx(i,{})})};async function XZ(t,e){return(await Bq(t,e)).map(({id:n,onItemClick:r})=>({id:n,onItemClick:r,icon:n}))}function ZZ(t){const e=fe(),n=ve(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s,columns:a}=t,l=o==="loading-initial"||o==="loading"?y.jsx(e.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,c=C.useMemo(()=>{const u=[];for(let d=0;d<r.length;d++){const f=r[d];u.push(y.jsx(e.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:f,id:`bn-grid-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.id))}return u},[e,r,s,i]);return y.jsxs(e.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[l,c,c.length===0&&t.loadingState==="loaded"&&y.jsx(e.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:n.suggestion_menu.no_items_title})]})}function x_(t,e,n,r=3){const o=C.useRef(0);C.useEffect(()=>{e!==void 0&&(t.length>0?o.current=e.length:e.length-o.current>r&&n())},[n,r,t.length,e])}function C_(t,e){const[n,r]=C.useState([]),[o,i]=C.useState(!1),s=C.useRef(void 0),a=C.useRef(void 0);return C.useEffect(()=>{const l=t;s.current=t,i(!0),e(t).then(c=>{s.current===l&&(r(c),i(!1),a.current=l)})},[t,e]),{items:n||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":o?"loading":"loaded"}}function JZ(t,e,n,r,o){const[i,s]=C.useState(0),a=r!==void 0&&r>1;return C.useEffect(()=>{var l;const c=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),n.length&&s((i-1+n.length)%n.length)),u.key==="ArrowRight"&&(u.preventDefault(),n.length&&s((i+1+n.length)%n.length)),u.key==="ArrowUp"?(u.preventDefault(),n.length&&s((i-r+n.length)%n.length),!0):u.key==="ArrowDown"?(u.preventDefault(),n.length&&s((i+r)%n.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),n.length&&o?.(n[i]),!0):!1);return(l=t.domElement)==null||l.addEventListener("keydown",c,!0),()=>{var u;(u=t.domElement)==null||u.removeEventListener("keydown",c,!0)}},[t.domElement,n,i,o,r,a]),C.useEffect(()=>{s(0)},[e]),{selectedIndex:n.length===0?void 0:i}}function eJ(t){const e=zr().setContentEditableProps,n=ge(),{getItems:r,gridSuggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l,columns:c}=t,u=C.useCallback(g=>{a(),s(),l?.(g)},[l,a,s]),{items:d,usedQuery:f,loadingState:h}=C_(i,r);x_(d,f,a);const{selectedIndex:p}=JZ(n,i,d,c,u);return C.useEffect(()=>(e(g=>({...g,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{e(g=>({...g,"aria-expanded":!1,"aria-controls":void 0}))}),[e]),C.useEffect(()=>(e(g=>({...g,"aria-activedescendant":p?"bn-suggestion-menu-item-"+p:void 0})),()=>{e(g=>({...g,"aria-activedescendant":void 0}))}),[e,p]),y.jsx(o,{items:d,onItemClick:u,loadingState:h,selectedIndex:p,columns:c})}function tJ(t){var e;const n=ge(),{triggerCharacter:r,gridSuggestionMenuComponent:o,columns:i,minQueryLength:s,onItemClick:a,getItems:l}=t,c=C.useMemo(()=>a||(b=>{b.onItemClick(n)}),[n,a]),u=C.useMemo(()=>l||(async b=>await XZ(n,b)),[n,l]),d=Re(er);C.useEffect(()=>{d.addTriggerCharacter(r)},[d,r]);const f=et(er),h=et(er,{selector:b=>b?.referencePos||new DOMRect}),p=C.useMemo(()=>{var b;return{element:((b=n.domElement)==null?void 0:b.firstChild)||void 0,getBoundingClientRect:()=>h}},[(e=n.domElement)==null?void 0:e.firstChild,h]),g=C.useMemo(()=>({useFloatingOptions:{open:f?.show&&f?.triggerCharacter===r,onOpenChange:b=>{b||d.closeMenu()},placement:"bottom-start",middleware:[Dr(10),Hi({mainAxis:!0,crossAxis:!1}),Al(),tu({apply({availableHeight:b,elements:E}){Object.assign(E.floating.style,{maxHeight:`${b-10}px`})}})]},elementProps:{onMouseDownCapture:b=>b.preventDefault(),style:{zIndex:70}},...t.floatingUIOptions}),[t.floatingUIOptions,f?.show,f?.triggerCharacter,d,r]);return!f||!f.ignoreQueryLength&&s&&(f.query.startsWith(" ")||f.query.length<s)?null:y.jsx(Or,{reference:p,...g,children:r&&y.jsx(eJ,{query:f.query,closeMenu:d.closeMenu,clearQuery:d.clearQuery,getItems:u,columns:i,gridSuggestionMenuComponent:o||ZZ,onItemClick:c})})}function nJ(t){const e=fe(),n=ve(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s}=t,a=o==="loading-initial"||o==="loading"?y.jsx(e.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,l=C.useMemo(()=>{let c;const u=[];for(let d=0;d<r.length;d++){const f=r[d];f.group!==c&&(c=f.group,u.push(y.jsx(e.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:c},c))),u.push(y.jsx(e.SuggestionMenu.Item,{className:ut("bn-suggestion-menu-item",f.size==="small"?"bn-suggestion-menu-item-small":""),item:f,id:`bn-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.title))}return u},[e,r,s,i]);return y.jsxs(e.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[l,l.length===0&&(t.loadingState==="loading"||t.loadingState==="loaded")&&y.jsx(e.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:n.suggestion_menu.no_items_title}),a]})}function rJ(t,e){const[n,r]=C.useState(0);return{selectedIndex:n,setSelectedIndex:r,handler:o=>{if(o.key==="ArrowUp")return o.preventDefault(),t.length&&r((n-1+t.length)%t.length),!0;if(o.key==="ArrowDown")return o.preventDefault(),t.length&&r((n+1)%t.length),!0;const i=oJ(o)?o.nativeEvent.isComposing:o.isComposing;return o.key==="Enter"&&!i?(o.preventDefault(),o.stopPropagation(),t.length&&e?.(t[n]),!0):!1}}}function oJ(t){return t.nativeEvent!==void 0}function iJ(t,e,n,r,o){const{selectedIndex:i,setSelectedIndex:s,handler:a}=rJ(n,r);return C.useEffect(()=>{var l;return(l=t.domElement)==null||l.addEventListener("keydown",a,!0),()=>{var c;(c=t.domElement)==null||c.removeEventListener("keydown",a,!0)}},[t.domElement,n,i,r,o,a]),C.useEffect(()=>{s(0)},[e,s]),{selectedIndex:n.length===0?void 0:i}}function sJ(t){const e=zr().setContentEditableProps,n=ge(),{getItems:r,suggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l}=t,c=C.useCallback(p=>{a(),s(),l?.(p)},[l,a,s]),{items:u,usedQuery:d,loadingState:f}=C_(i,r);x_(u,d,a);const{selectedIndex:h}=iJ(n,i,u,c);return C.useEffect(()=>(e(p=>({...p,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{e(p=>({...p,"aria-expanded":!1,"aria-controls":void 0}))}),[e]),C.useEffect(()=>(e(p=>({...p,"aria-activedescendant":h?"bn-suggestion-menu-item-"+h:void 0})),()=>{e(p=>({...p,"aria-activedescendant":void 0}))}),[e,h]),y.jsx(o,{items:u,onItemClick:c,loadingState:f,selectedIndex:h})}const aJ={heading:bd,heading_2:yd,heading_3:Ed,heading_4:i_,heading_5:s_,heading_6:a_,toggle_heading:bd,toggle_heading_2:yd,toggle_heading_3:Ed,quote:f_,toggle_list:h_,numbered_list:u_,bullet_list:d_,check_list:c_,paragraph:X0,table:nZ,image:iZ,video:oZ,audio:lZ,file:$X,emoji:bZ,code_block:YX,divider:gZ};function k_(t){return LB(t).map(e=>{const n=aJ[e.key];return{...e,icon:y.jsx(n,{size:18})}})}function T_(t){var e;const n=ge(),{triggerCharacter:r,suggestionMenuComponent:o,minQueryLength:i,onItemClick:s,getItems:a}=t,l=C.useMemo(()=>s||(g=>{g.onItemClick(n)}),[n,s]),c=C.useMemo(()=>a||(async g=>RB(k_(n),g)),[n,a]),u=Re(er);C.useEffect(()=>{u.addTriggerCharacter(r)},[u,r]);const d=et(er),f=et(er,{selector:g=>g?.referencePos||new DOMRect}),h=C.useMemo(()=>{var g;return{element:((g=n.domElement)==null?void 0:g.firstChild)||void 0,getBoundingClientRect:()=>f}},[(e=n.domElement)==null?void 0:e.firstChild,f]),p=C.useMemo(()=>({useFloatingOptions:{open:d?.show&&d?.triggerCharacter===r,onOpenChange:g=>{g||u.closeMenu()},placement:"bottom-start",middleware:[Dr(10),Hi({mainAxis:!0,crossAxis:!1}),Al(),tu({apply({availableHeight:g,elements:b}){Object.assign(b.floating.style,{maxHeight:`${g-10}px`,minHeight:"300px"})}})]},elementProps:{onMouseDownCapture:g=>g.preventDefault(),style:{zIndex:80}},...t.floatingUIOptions}),[t.floatingUIOptions,d?.show,d?.triggerCharacter,u,r]);return!d||!d.ignoreQueryLength&&i&&(d.query.startsWith(" ")||d.query.length<i)?null:y.jsx(Or,{reference:h,...p,children:r&&y.jsx(sJ,{query:d.query,closeMenu:u.closeMenu,clearQuery:u.clearQuery,getItems:c,suggestionMenuComponent:o||nJ,onItemClick:l})})}const lJ=(t,e=.3)=>{const n=Math.floor(t)+e,r=Math.ceil(t)-e;return t>=n&&t<=r?Math.round(t):t<n?Math.floor(t):Math.ceil(t)},cJ=t=>{const e=fe(),n=ge(),r=Re(dt),o=et(dt,{selector:u=>u?.block}),i=C.useRef(!1),[s,a]=C.useState(),l=C.useCallback(u=>{r.freezeHandles(),t.hideOtherElements(!0),o&&(a({originalContent:o.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(o,t.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:t.orientation==="addOrRemoveColumns"?u.clientX:u.clientY}),i.current=!1,u.preventDefault())},[o,t,r]),c=C.useCallback(()=>{!o||i.current||n.updateBlock(o,{type:"table",content:{...o.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(o,"columns",1):r.addRowsOrColumns(o,"rows",1)}})},[o,n,t.orientation,r]);return C.useEffect(()=>{const u=d=>{var f,h;if(!o)return;if(!s)throw new Error("editingState is undefined");i.current=!0;const p=(t.orientation==="addOrRemoveColumns"?d.clientX:d.clientY)-s.startPos,g=t.orientation==="addOrRemoveColumns"?((f=s.originalCroppedContent.rows[0])==null?void 0:f.cells.length)??0:s.originalCroppedContent.rows.length,b=t.orientation==="addOrRemoveColumns"?((h=s.originalContent.rows[0])==null?void 0:h.cells.length)??0:s.originalContent.rows.length,E=t.orientation==="addOrRemoveColumns"?o.content.rows[0].cells.length:o.content.rows.length,x=b+lJ(p/(t.orientation==="addOrRemoveColumns"?a0:gB),.3);x>=g&&x>0&&x!==E&&(n.updateBlock(o,{type:"table",content:{...o.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",x-g):r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",x-g)}}),o.content&&n.setTextCursorPosition(o))};return s&&window.addEventListener("mousemove",u),()=>{window.removeEventListener("mousemove",u)}},[o,s,n,t.orientation,r]),C.useEffect(()=>{const u=()=>{t.hideOtherElements(!1),r.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",u),()=>{window.removeEventListener("mouseup",u)}},[s,t,r]),n.isEditable?y.jsx(e.TableHandle.ExtendButton,{className:ut("bn-extend-button",t.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s!==null?"bn-extend-button-editing":""),onClick:c,onMouseDown:l,children:t.children||y.jsx(cZ,{size:18,"data-test":"extendButton"})}):null},Kx=t=>{const e=fe(),n=ve(),r=Re(dt),o=et(dt,{selector:i=>t.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:y.jsx(e.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(o,t.orientation==="row"?{orientation:"row",side:t.side}:{orientation:"column",side:t.side})},children:n.table_handle[`add_${t.side}_menuitem`]})},uJ=t=>{const e=fe(),n=ve(),r=Re(dt),o=et(dt,{selector:i=>t.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:y.jsx(e.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(o,t.orientation),children:t.orientation==="row"?n.table_handle.delete_row_menuitem:n.table_handle.delete_column_menuitem})},dJ=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),{block:i,index:s}=et(dt,{selector:u=>({block:u?.block,index:t.orientation==="column"?u?.colIndex:u?.rowIndex})}),a=C.useMemo(()=>o===void 0||i===void 0||s===void 0?[]:t.orientation==="row"?o.getCellsAtRowHandle(i,s):o.getCellsAtColumnHandle(i,s),[i,s,t.orientation,o]),l=(u,d)=>{if(i===void 0)return;const f=i.content.rows.map(h=>({...h,cells:h.cells.map(p=>qo(p))}));a.forEach(({row:h,col:p})=>{d==="text"?f[h].cells[p].props.textColor=u:f[h].cells[p].props.backgroundColor=u}),r.updateBlock(i,{type:"table",content:{...i.content,rows:f}}),r.setTextCursorPosition(i)};if(!a||!a[0]||!o||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;const c=qo(a[0].cell);return y.jsxs(e.Generic.Menu.Root,{position:"right",sub:!0,children:[y.jsx(e.Generic.Menu.Trigger,{sub:!0,children:y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||n.drag_handle.colors_menuitem})}),y.jsx(e.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{iconSize:18,text:r.settings.tables.cellTextColor?{color:a.every(({cell:u})=>Wo(u)&&u.props.textColor===c.props.textColor)?c.props.textColor:"default",setColor:u=>{l(u,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:a.every(({cell:u})=>Wo(u)&&u.props.backgroundColor===c.props.backgroundColor)?c.props.backgroundColor:"default",setColor:u=>l(u,"background")}:void 0})})]})},fJ=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),{block:i,index:s}=et(dt,{selector:l=>({block:l?.block,index:t.orientation==="column"?l?.colIndex:l?.rowIndex})});if(o===void 0||i===void 0||s!==0||t.orientation!=="row"||!r.settings.tables.headers)return null;const a=!!i.content.headerRows;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerRows:a?void 0:1}})},children:n.drag_handle.header_row_menuitem})},hJ=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),i=et(dt,{selector:l=>l?.block}),s=et(dt,{selector:l=>t.orientation==="column"?l?.colIndex:l?.rowIndex});if(!o||s!==0||!i||t.orientation!=="column"||!r.settings.tables.headers)return null;const a=!!i.content.headerCols;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerCols:a?void 0:1}})},children:n.drag_handle.header_column_menuitem})},pJ=t=>{const e=fe();return y.jsx(e.Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(uJ,{orientation:t.orientation}),y.jsx(Kx,{orientation:t.orientation,side:t.orientation==="row"?"above":"left"}),y.jsx(Kx,{orientation:t.orientation,side:t.orientation==="row"?"below":"right"}),y.jsx(fJ,{orientation:t.orientation}),y.jsx(hJ,{orientation:t.orientation}),y.jsx(dJ,{orientation:t.orientation})]})})},mJ=t=>{const e=ge(),n=fe(),[r,o]=C.useState(!1),i=t.tableHandleMenu||pJ,s=Re(dt),a=et(dt),l=C.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:t.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:c})=>Di(c)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:c})=>Cl(c)===1),[t.orientation,a,s]);return a?y.jsxs(n.Generic.Menu.Root,{onOpenChange:c=>{c?(s.freezeHandles(),t.hideOtherElements(!0)):(s.unfreezeHandles(),t.hideOtherElements(!1),e.focus())},position:"right",children:[y.jsx(n.Generic.Menu.Trigger,{children:y.jsx(n.TableHandle.Root,{className:ut("bn-table-handle",r?"bn-table-handle-dragging":"",l?"":"bn-table-handle-not-draggable"),draggable:l,onDragStart:c=>{o(!0),t.hideOtherElements(!0),t.orientation==="column"?s.colDragStart(c):s.rowDragStart(c)},onDragEnd:()=>{s.dragEnd(),t.hideOtherElements(!1),o(!1)},style:t.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:t.children||y.jsx(E_,{size:24,"data-test":"tableHandle"})})}),y.jsx(i,{orientation:t.orientation})]}):null},gJ=t=>{var e,n;const r=fe(),o=ve(),i=ge(),{block:s,colIndex:a,rowIndex:l}=et(dt,{selector:d=>({block:d?.block,colIndex:d?.colIndex,rowIndex:d?.rowIndex})}),c=(d,f)=>{if(s===void 0||a===void 0||l===void 0)return;const h=s.content.rows.map(p=>({...p,cells:p.cells.map(g=>qo(g))}));f==="text"?h[l].cells[a].props.textColor=d:h[l].cells[a].props.backgroundColor=d,i.updateBlock(s,{type:"table",content:{...s.content,rows:h}}),i.setTextCursorPosition(s)};if(s===void 0||a===void 0||l===void 0)return null;const u=(n=(e=s.content.rows[l])==null?void 0:e.cells)==null?void 0:n[a];return!u||i.settings.tables.cellTextColor===!1&&i.settings.tables.cellBackgroundColor===!1?null:y.jsxs(r.Generic.Menu.Root,{position:"right",sub:!0,children:[y.jsx(r.Generic.Menu.Trigger,{sub:!0,children:y.jsx(r.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||o.drag_handle.colors_menuitem})}),y.jsx(r.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{iconSize:18,text:i.settings.tables.cellTextColor?{color:Wo(u)?u.props.textColor:"default",setColor:d=>c(d,"text")}:void 0,background:i.settings.tables.cellBackgroundColor?{color:Wo(u)?u.props.backgroundColor:"default",setColor:d=>c(d,"background")}:void 0})})]})},bJ=()=>{var t,e;const n=fe(),r=ve(),o=ge(),i=Re(dt),{block:s,colIndex:a,rowIndex:l}=et(dt,{selector:u=>({block:u?.block,colIndex:u?.colIndex,rowIndex:u?.rowIndex})});if(s===void 0||a===void 0||l===void 0)return null;const c=(e=(t=s.content.rows[l])==null?void 0:t.cells)==null?void 0:e[a];return!c||!Wo(c)||Cl(c)===1&&Di(c)===1||!o.settings.tables.splitCells?null:y.jsx(n.Generic.Menu.Item,{onClick:()=>{i.splitCell({row:l,col:a})},children:r.table_handle.split_cell_menuitem})},yJ=t=>{const e=fe();return y.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(bJ,{}),y.jsx(gJ,{})]})})},EJ=t=>{const e=fe(),n=ge(),r=Re(dt),o=t.tableCellMenu||yJ;return!n.settings.tables.splitCells&&!n.settings.tables.cellBackgroundColor&&!n.settings.tables.cellTextColor?null:y.jsxs(e.Generic.Menu.Root,{onOpenChange:i=>{i?(r.freezeHandles(),t.hideOtherElements(!0)):(r.unfreezeHandles(),t.hideOtherElements(!1),n.focus())},position:"right",children:[y.jsx(e.Generic.Menu.Trigger,{children:y.jsx(e.Generic.Menu.Button,{className:"bn-table-cell-handle",children:t.children||y.jsx($Z,{size:12,"data-test":"tableCellHandle"})})}),y.jsx(o,{})]})},xJ=t=>{const e=ge(),[n,r]=C.useState(),o=et(dt),i=C.useMemo(()=>{if(o===void 0||o.rowIndex===void 0||o.colIndex===void 0)return{};const c=dn(o.block.id,e.prosemirrorState.doc);if(!c)return{};const u=c.posBeforeNode+1,d=e.prosemirrorView.domAtPos(u+1).node;if(!(d instanceof Element))return{};const f={element:d},h=e.prosemirrorState.doc.resolve(u+1).posAtIndex(o.rowIndex),p=e.prosemirrorState.doc.resolve(h+1).posAtIndex(o.colIndex),g=e.prosemirrorView.domAtPos(p+1).node;return g instanceof Element?{tableReference:f,cellReference:{element:g},rowReference:{element:d,getBoundingClientRect:()=>{const b=d.getBoundingClientRect(),E=g.getBoundingClientRect();return new DOMRect(b.x,o.draggingState&&o.draggingState.draggedCellOrientation==="row"?o.draggingState.mousePos-E.height/2:E.y,b.width,E.height)}},columnReference:{element:d,getBoundingClientRect:()=>{const b=d.getBoundingClientRect(),E=g.getBoundingClientRect();return new DOMRect(o.draggingState&&o.draggingState.draggedCellOrientation==="col"?o.draggingState.mousePos-E.width/2:E.x,b.y,E.width,b.height)}}}:{}},[e,o]);if(!o)return null;const s=t.tableHandle||mJ,a=t.extendButton||cJ,l=t.tableCellHandle||EJ;return y.jsxs(y.Fragment,{children:[y.jsx(Or,{reference:i?.rowReference,useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle"),placement:"left",middleware:[Dr(-10)]},elementProps:{style:{zIndex:10}},children:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle")&&y.jsx(s,{orientation:"row",hideOtherElements:c=>r(c?"rowTableHandle":void 0)})}),y.jsx(Or,{reference:i?.columnReference,useFloatingOptions:{open:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle"),placement:"top",middleware:[Dr(-12)]},elementProps:{style:{zIndex:10}},children:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle")&&y.jsx(s,{orientation:"column",hideOtherElements:c=>r(c?"columnTableHandle":void 0)})}),y.jsx(Or,{reference:i?.cellReference,useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle"),placement:"top-end",middleware:[Dr({mainAxis:-15,crossAxis:-1})]},elementProps:{style:{zIndex:10}},children:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle")&&y.jsx(l,{hideOtherElements:c=>r(c?"tableCellHandle":void 0)})}),y.jsx(Or,{reference:i?.tableReference,useFloatingOptions:{open:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton"),placement:"bottom",middleware:[tu({apply({rects:c,elements:u}){Object.assign(u.floating.style,{width:`${c.reference.width}px`})}})]},elementProps:{style:{zIndex:10}},children:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton")&&y.jsx(a,{orientation:"addOrRemoveRows",hideOtherElements:c=>r(c?"extendRowsButton":void 0)})}),y.jsx(Or,{reference:i?.tableReference,useFloatingOptions:{open:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton"),placement:"right",middleware:[tu({apply({rects:c,elements:u}){Object.assign(u.floating.style,{height:`${c.reference.height}px`})}})]},elementProps:{style:{zIndex:10}},children:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton")&&y.jsx(a,{orientation:"addOrRemoveColumns",hideOtherElements:c=>r(c?"extendColumnsButton":void 0)})})]})},CJ=C.lazy(()=>Promise.resolve().then(()=>qJ)),kJ=C.lazy(()=>Promise.resolve().then(()=>YJ));function TJ(t){const e=ge();if(!e)throw new Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return y.jsxs(y.Fragment,{children:[e.getExtension(Qo)&&t.formattingToolbar!==!1&&y.jsx(e1,{}),e.getExtension(Gl)&&t.linkToolbar!==!1&&y.jsx(y_,{}),e.getExtension(er)&&t.slashMenu!==!1&&y.jsx(T_,{triggerCharacter:"/"}),e.getExtension(er)&&t.emojiPicker!==!1&&y.jsx(tJ,{triggerCharacter:":",columns:10,minQueryLength:2}),e.getExtension(Er)&&t.sideMenu!==!1&&y.jsx(QZ,{}),e.getExtension(fr)&&t.filePanel!==!1&&y.jsx(kX,{}),e.getExtension(dt)&&t.tableHandles!==!1&&y.jsx(xJ,{}),e.getExtension(nr)&&t.comments!==!1&&y.jsxs(C.Suspense,{children:[y.jsx(CJ,{}),y.jsx(kJ,{})]})]})}function wJ(t,e){const n=zr();e||(e=n?.editor),C.useEffect(()=>{if(!e)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return e.onChange(t)},[t,e])}function SJ(t,e,n){const r=zr();e||(e=r?.editor),C.useEffect(()=>{if(!e)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return e.onSelectionChange(t,n)},[t,e,n])}const vJ=()=>{const t=C.useMemo(()=>{var s;return(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: dark)")},[]),e=C.useMemo(()=>{var s;return(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: light)")},[]),n=t?.matches,r=e?.matches,[o,i]=C.useState(n?"dark":r?"light":"no-preference");return C.useEffect(()=>{i(n?"dark":r?"light":"no-preference")},[n,r]),C.useEffect(()=>{if(typeof t?.addEventListener=="function"){const s=({matches:l})=>l&&i("dark"),a=({matches:l})=>l&&i("light");return t?.addEventListener("change",s),e?.addEventListener("change",a),()=>{t?.removeEventListener("change",s),e?.removeEventListener("change",a)}}else{const s=()=>i(t.matches?"dark":e.matches?"light":"no-preference");return t?.addEventListener("change",s),e?.addEventListener("change",s),()=>{t?.removeEventListener("change",s),e?.removeEventListener("change",s)}}},[t,e]),o},w_=C.createContext(void 0);function AJ(){return C.useContext(w_)}function _J(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:ki.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}const NJ=({contentComponent:t})=>{const e=C.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return y.jsx(y.Fragment,{children:Object.values(e)})},IJ=C.forwardRef((t,e)=>{const[n,r]=C.useState();return C.useImperativeHandle(e,()=>(o,i)=>{ki.flushSync(()=>{r({node:o,container:i})}),r(void 0)},[]),y.jsx(y.Fragment,{children:n&&ki.createPortal(n.node,n.container)})}),Qx=()=>{};function MJ(t,e){const{editor:n,className:r,theme:o,children:i,editable:s,onSelectionChange:a,onChange:l,formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:b,autoFocus:E,renderEditor:x=!0,...T}=t,[D,O]=C.useState(),v=zr(),R=vJ(),j=v?.colorSchemePreference||R,z=o||(j==="dark"?"dark":"light");wJ(l||Qx,n),SJ(a||Qx,n),C.useEffect(()=>{n.isEditable=s!==!1},[s,n]);const I=C.useCallback(W=>{n.elementRenderer=W},[n]),X=C.useMemo(()=>({...v,editor:n,setContentEditableProps:O,colorSchemePreference:z}),[v,n,z]),F=C.useMemo(()=>({editorProps:{autoFocus:E,contentEditableProps:D},defaultUIProps:{formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:b}}),[E,D,c,u,d,f,h,p,g,b]);return y.jsx(XA.Provider,{value:X,children:y.jsxs(w_.Provider,{value:F,children:[y.jsx(IJ,{ref:I}),y.jsx(OJ,{className:r,renderEditor:x,editable:s,editorColorScheme:z,ref:e,...T,children:i})]})})}const OJ=Ie.forwardRef(({className:t,renderEditor:e,editable:n,editorColorScheme:r,children:o,...i},s)=>y.jsx("div",{className:ut("bn-container",r,t),"data-color-scheme":r,...i,ref:s,children:e?y.jsx(LJ,{editable:n,children:o}):o})),DJ=Ie.forwardRef(MJ),LJ=t=>{const e=AJ(),n=ge(),r=C.useMemo(()=>_J(),[]),o=C.useCallback(i=>{t.editable!==void 0&&t.editable!==n.isEditable&&(n.isEditable=t.editable),n._tiptapEditor.contentComponent=r,i?n.mount(i):n.unmount()},[n,r,t.editable]);return y.jsxs(y.Fragment,{children:[y.jsx(NJ,{contentComponent:r}),y.jsx(RJ,{...e.editorProps,...t,mount:o}),y.jsx(TJ,{...e.defaultUIProps}),t.children]})},RJ=t=>{const{autoFocus:e,mount:n,contentEditableProps:r}=t;return y.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":e,ref:n,...r})};function Xx(t,e){let n;const r=document.createElement("div");let o;if(e!=null&&e.elementRenderer)e.elementRenderer(t(l=>n=l||void 0),r);else{if(!(e!=null&&e.headless))throw new Error("elementRenderer not available, expected headless editor");o=i3.createRoot(r),ki.flushSync(()=>{o.render(t(l=>n=l||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};n?.setAttribute("data-tmp-find","true");const i=r.cloneNode(!0),s=i.firstElementChild,a=i.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),o?.unmount(),{dom:s,contentDOM:a||void 0}}function Zh(t){var e;return y.jsx(cX,{onDragOver:n=>n.preventDefault(),...Object.fromEntries(Object.entries(t.domAttributes||{}).filter(([n])=>n!=="class")),className:ut("bn-block-content",((e=t.domAttributes)==null?void 0:e.class)||""),"data-content-type":t.blockType,...Object.fromEntries(Object.entries(t.blockProps).filter(([n,r])=>{const o=t.propSchema[n];return r!==o.default}).map(([n,r])=>[Ou(n),r])),"data-file-block":t.isFileBlock===!0||void 0,children:t.children})}function S_(t,e,n){return(r={})=>{const o=typeof t=="function"?t(r):t,i=typeof e=="function"?e(r):e;return{config:o,implementation:{...i,toExternalHTML(a,l){const c=i.toExternalHTML||i.render;return Xx(u=>y.jsx(Zh,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:y.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)},render(a,l){if(this.renderType==="nodeView")return mX(c=>{var u;const d=A2(c.getPos,l,c.editor,o.type),f=YA().nodeViewContentRef;if(!f)throw new Error("nodeViewContentRef is not set");const h=i.render;return y.jsx(Zh,{blockType:d.type,blockProps:d.props,propSchema:o.propSchema,isFileBlock:!!((u=i.meta)!=null&&u.fileBlockAccept),domAttributes:this.blockContentDOMAttributes,children:y.jsx(h,{block:d,editor:l,contentRef:p=>{f(p),p&&(p.className=ut("bn-inline-content",p.className),p.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{const c=i.render;return Xx(u=>y.jsx(Zh,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:y.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)}}},extensions:void 0}}}const xf=(t={},e=[])=>C.useMemo(()=>{const n=XQ.create(t);return window&&(window.ProseMirror=n._tiptapEditor),n},e),t1=t=>{const[e,n]=C.useState(!1),r=Ot({editor:t.editor,selector:({editor:a})=>a.isEmpty}),o=fe(),i=C.useCallback(()=>{n(!0)},[]),s=C.useCallback(()=>{n(!1)},[]);return C.useEffect(()=>{t.editable&&t.autoFocus&&t.editor.focus()},[t.autoFocus,t.editable,t.editor]),y.jsxs(y.Fragment,{children:[y.jsx(o.Comments.Editor,{autoFocus:t.autoFocus,className:"bn-comment-editor",editor:t.editor,onFocus:i,onBlur:s,editable:t.editable}),t.actions&&y.jsx("div",{className:"bn-comment-actions-wrapper",children:y.jsx(t.actions,{isFocused:e,isEmpty:r})})]})};let Jh;async function PJ(){return Jh||(Jh=(async()=>{const[t,e]=await Promise.all([eu(()=>import("./module-RjUF93sV.js"),[]),eu(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in t?t.default:t,r="default"in e?e.default:e;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),Jh)}function BJ(t){const e=C.useRef(null),n=C.useRef(null);return n.current&&n.current.update(t),C.useEffect(()=>((async()=>{const{emojiMart:r}=await PJ();n.current=new r.Picker({...t,ref:e})})(),()=>{n.current=null}),[]),Ie.createElement("div",{ref:e})}const Zx=t=>{const[e,n]=C.useState(!1),r=fe(),o=ge(),i=zr();return y.jsxs(r.Generic.Popover.Root,{open:e,children:[y.jsx(r.Generic.Popover.Trigger,{children:y.jsx("div",{onClick:s=>{var a;s.preventDefault(),s.stopPropagation(),n(!e),(a=t.onOpenChange)==null||a.call(t,!e)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:t.children})}),ki.createPortal(y.jsx(r.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:y.jsx(BJ,{perLine:7,onClickOutside:()=>{var s;n(!1),(s=t.onOpenChange)==null||s.call(t,!1)},onEmojiSelect:s=>{var a;t.onEmojiSelect(s),n(!1),(a=t.onOpenChange)==null||a.call(t,!1)},theme:i?.colorSchemePreference})}),o.domElement.parentElement)]})};function FJ(t){return n1([t]).get(t)}function n1(t){const e=Re(nr).userStore,n=C.useCallback(()=>{const i=new Map;for(const s of t){const a=e.getUser(s);a&&i.set(s,a)}return i},[e,t]),r=C.useMemo(()=>({current:n()}),[n]),o=C.useCallback(i=>{const s=e.subscribe(a=>{r.current=n(),i()});return e.loadUsers(t),s},[e,n,t,r]);return C.useSyncExternalStore(o,()=>r.current)}const HJ=t=>{const e=fe(),n=ve(),r=Re(nr),o=t.comment.reactions.find(l=>l.emoji===t.emoji);if(!o)throw new Error("Trying to render reaction badge for non-existing reaction");const[i,s]=C.useState([]),a=n1(i);return y.jsx(e.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-reaction"),text:o.userIds.length.toString(),icon:o.emoji,isSelected:r.threadStore.auth.canDeleteReaction(t.comment,o.emoji),onClick:()=>t.onReactionSelect(o.emoji),onMouseEnter:()=>s(o.userIds),mainTooltip:n.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(l=>l.username).join(`
179
- `)}`},o.emoji)},{textColor:Wre,backgroundColor:Gre,...UJ}=l0,r1=P0.create({blockSpecs:{paragraph:F2()},styleSpecs:UJ}),VJ=({comment:t,thread:e,showResolveButton:n})=>{const r=Re(nr),o=ve(),i=xf({initialContent:t.body,trailingBlock:!1,dictionary:{...o,placeholders:{emptyDocument:o.placeholders.edit_comment}},schema:r.commentEditorSchema||r1}),s=fe(),[a,l]=C.useState(!1),[c,u]=C.useState(!1),d=r.threadStore,f=C.useCallback(()=>{l(!0)},[]),h=C.useCallback(()=>{i.replaceBlocks(i.document,t.body),l(!1)},[i,t.body]),p=C.useCallback(async I=>{await d.updateComment({commentId:t.id,comment:{body:i.document},threadId:e.id}),l(!1)},[t,e.id,i,d]),g=C.useCallback(async()=>{await d.deleteComment({commentId:t.id,threadId:e.id})},[t,e.id,d]),b=C.useCallback(async I=>{d.auth.canAddReaction(t,I)?await d.addReaction({threadId:e.id,commentId:t.id,emoji:I}):d.auth.canDeleteReaction(t,I)&&await d.deleteReaction({threadId:e.id,commentId:t.id,emoji:I})},[d,t,e.id]),E=C.useCallback(async()=>{await d.resolveThread({threadId:e.id})},[e.id,d]),x=C.useCallback(async()=>{await d.unresolveThread({threadId:e.id})},[e.id,d]),T=FJ(t.userId);if(!t.body)return null;let D;const O=d.auth.canAddReaction(t),v=d.auth.canDeleteComment(t),R=d.auth.canUpdateComment(t),j=n&&(e.resolved?d.auth.canUnresolveThread(e):d.auth.canResolveThread(e));a||(D=y.jsxs(s.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[O&&y.jsx(Zx,{onEmojiSelect:I=>b(I.native),onOpenChange:u,children:y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.add_reaction,variant:"compact",children:y.jsx(Wx,{size:16})},"add-reaction")}),j&&(e.resolved?y.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:x,children:y.jsx(HX,{size:16})},"reopen"):y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.resolve,variant:"compact",onClick:E,children:y.jsx(uZ,{size:16})},"resolve")),(v||R)&&y.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[y.jsx(s.Generic.Menu.Trigger,{children:y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.more_actions,variant:"compact",children:y.jsx(mZ,{size:16})},"more-actions")}),y.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[R&&y.jsx(s.Generic.Menu.Item,{icon:y.jsx(UX,{}),onClick:f,children:o.comments.actions.edit_comment},"edit-comment"),v&&y.jsx(s.Generic.Menu.Item,{icon:y.jsx(fZ,{}),onClick:g,children:o.comments.actions.delete_comment},"delete-comment")]})]})]}));const z=t.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!t.body)throw new Error("soft deletes are not yet supported");return y.jsx(s.Comments.Comment,{authorInfo:T??"loading",timeString:z,edited:t.updatedAt.getTime()!==t.createdAt.getTime(),showActions:"hover",actions:D,className:"bn-thread-comment",emojiPickerOpen:c,children:y.jsx(t1,{autoFocus:a,editor:i,editable:a,actions:t.reactions.length>0||a?({isEmpty:I})=>y.jsxs(y.Fragment,{children:[t.reactions.length>0&&!a&&y.jsxs(s.Generic.Badge.Group,{className:ut("bn-badge-group","bn-comment-reactions"),children:[t.reactions.map(X=>y.jsx(HJ,{comment:t,emoji:X.emoji,onReactionSelect:b},X.emoji)),O&&y.jsx(Zx,{onEmojiSelect:X=>b(X.native),onOpenChange:u,children:y.jsx(s.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-add-reaction"),text:"+",icon:y.jsx(Wx,{size:16}),mainTooltip:o.comments.actions.add_reaction})})]}),a&&y.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:[y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.save_button_text,variant:"compact",onClick:p,isDisabled:I,children:o.comments.save_button_text}),y.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:o.comments.cancel_button_text,variant:"compact",onClick:h,children:o.comments.cancel_button_text})]})]}):void 0})})},$J=({thread:t,maxCommentsBeforeCollapse:e})=>{const n=fe(),r=ve(),o=n1(t.resolvedBy?[t.resolvedBy]:[]),i=t.comments.map((s,a)=>y.jsx(VJ,{thread:t,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(t.resolved&&t.resolvedUpdatedAt&&t.resolvedBy){if(!o.get(t.resolvedBy))throw new Error(`User ${t.resolvedBy} resolved thread ${t.id}, but their data could not be found.`);const s=t.comments.findLastIndex(a=>t.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,y.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:t.resolvedBy&&o.get(t.resolvedBy)||"loading",timeString:t.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:y.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return e&&i.length>e&&i.splice(1,i.length-2,y.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(t.comments.length-2)},"expand-prompt")),i};function jJ(){const t=Re(nr),e=fe(),n=ve(),r=xf({trailingBlock:!1,dictionary:{...n,placeholders:{emptyDocument:n.placeholders.new_comment}},schema:t.commentEditorSchema||r1});return y.jsx(e.Comments.Card,{className:"bn-thread",children:y.jsx(t1,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:o})=>y.jsx(e.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:y.jsx(e.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:o,onClick:async()=>{await t.createThread({initialComment:{body:r.document}}),t.stopPendingComment()},children:"Save"})})})})}function zJ(t){const[e,n]=C.useState(!1),r=ge(),o=Re(nr),i=et(nr,{editor:r,selector:c=>c.pendingComment});C.useEffect(()=>{n(i)},[i]);const s=Ot({editor:r,selector:({editor:c})=>i?{from:c.prosemirrorState.selection.from,to:c.prosemirrorState.selection.to}:void 0}),a=C.useMemo(()=>({useFloatingOptions:{open:e,onOpenChange:c=>{c||(o.stopPendingComment(),r.focus()),n(c)},placement:"bottom",middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:60}},...t.floatingUIOptions}),[o,r,e,t.floatingUIOptions]),l=t.floatingComposer||jJ;return y.jsx(Q0,{position:s,...a,children:y.jsx(l,{})})}const qJ=Object.freeze(Object.defineProperty({__proto__:null,default:zJ},Symbol.toStringTag,{value:"Module"})),v_=({thread:t,selected:e,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:o,onBlur:i,tabIndex:s})=>{const a=fe(),l=ve(),c=Re(nr),u=xf({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||r1}),d=C.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:t.id}),u.removeBlocks(u.document)},[c,u,t.id]);return y.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:o,onBlur:i,selected:e,tabIndex:s,children:[y.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:y.jsx($J,{thread:t,maxCommentsBeforeCollapse:e?void 0:r||5})}),e&&y.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:y.jsx(t1,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:f})=>f?null:y.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:y.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:f,onClick:d,children:l.comments.save_button_text})})})})]})};function WJ(){const t=Re(nr).threadStore,e=C.useRef(void 0);e.current||(e.current=t.getThreads());const n=C.useCallback(r=>t.subscribe(o=>{e.current=o,r()}),[t]);return C.useSyncExternalStore(n,()=>e.current)}function GJ(t){const e=ge(),[n,r]=C.useState(!1),o=Re(nr),i=et(nr,{editor:e,selector:u=>u.selectedThreadId?{id:u.selectedThreadId,position:u.threadPositions.get(u.selectedThreadId)}:void 0});C.useEffect(()=>{r(!!i)},[i]);const s=WJ(),a=C.useMemo(()=>i?s.get(i.id):void 0,[i,s]),l=C.useMemo(()=>({useFloatingOptions:{open:n,onOpenChange:(u,d,f)=>{f==="escape-key"&&e.focus(),u||o.selectThread(void 0),r(u)},placement:"bottom",middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:30}},...t.floatingUIOptions}),[o,e,n,t.floatingUIOptions]),c=t.floatingThread||v_;return y.jsx(Q0,{position:i?.position,...l,children:a&&y.jsx(c,{thread:a,selected:!0})})}const YJ=Object.freeze(Object.defineProperty({__proto__:null,default:GJ},Symbol.toStringTag,{value:"Module"}));Ie.memo(({thread:t,selectedThreadId:e,maxCommentsBeforeCollapse:n,referenceText:r})=>{const o=Re(nr),i=C.useCallback(a=>{a.target.closest(".bn-action-toolbar")||o.selectThread(t.id)},[o,t.id]),s=C.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;const l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&o.selectThread(void 0)},[o]);return y.jsx(v_,{thread:t,selected:t.id===e,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:i,onBlur:s,tabIndex:0})});function KJ(t){return t.currentTarget instanceof HTMLElement&&t.relatedTarget instanceof HTMLElement?t.currentTarget.contains(t.relatedTarget):!1}function QJ({onBlur:t,onFocus:e}={}){const n=C.useRef(null),[r,o]=C.useState(!1),i=C.useRef(!1),s=c=>{o(c),i.current=c},a=c=>{i.current||(s(!0),e?.(c))},l=c=>{i.current&&!KJ(c)&&(s(!1),t?.(c))};return C.useEffect(()=>{const c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function A_(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=n.top<r.top,i=n.bottom>r.bottom;return o&&i?"both":o?"top":i?"bottom":"none"}function __(t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var Yl=t=>t.type==="checkbox",hi=t=>t instanceof Date,yn=t=>t==null;const N_=t=>typeof t=="object";var At=t=>!yn(t)&&!Array.isArray(t)&&N_(t)&&!hi(t),XJ=t=>At(t)&&t.target?Yl(t.target)?t.target.checked:t.target.value:t,ZJ=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,JJ=(t,e)=>t.has(ZJ(e)),eee=t=>{const e=t.constructor&&t.constructor.prototype;return At(e)&&e.hasOwnProperty("isPrototypeOf")},o1=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Mt(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(o1&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(At(t)&&eee(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Mt(t[o]));return r}var Cf=t=>/^\w*$/.test(t),ht=t=>t===void 0,i1=t=>Array.isArray(t)?t.filter(Boolean):[],s1=t=>i1(t.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(t,e,n)=>{if(!e||!At(t))return n;const r=(Cf(e)?[e]:s1(e)).reduce((o,i)=>yn(o)?o:o[i],t);return ht(r)||r===t?ht(t[e])?n:t[e]:r},Nr=t=>typeof t=="boolean",lr=t=>typeof t=="function",ct=(t,e,n)=>{let r=-1;const o=Cf(e)?[e]:s1(e),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let l=n;if(r!==s){const c=t[a];l=At(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;t[a]=l,t=t[a]}};const Jx={BLUR:"blur",FOCUS_OUT:"focusout"},cr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Jr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},I_=Ie.createContext(null);I_.displayName="HookFormControlContext";var tee=(t,e,n,r=!0)=>{const o={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(o,i,{get:()=>{const s=i;return e._proxyFormState[s]!==cr.all&&(e._proxyFormState[s]=!r||cr.all),t[s]}});return o};const nee=typeof window<"u"?Ie.useLayoutEffect:Ie.useEffect;var Rn=t=>typeof t=="string",ree=(t,e,n,r,o)=>Rn(t)?(r&&e.watch.add(t),ce(n,t,o)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),ce(n,i))):(r&&(e.watchAll=!0),n),Fm=t=>yn(t)||!N_(t);function Io(t,e,n=new WeakSet){if(Fm(t)||Fm(e))return Object.is(t,e);if(hi(t)&&hi(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const i of r){const s=t[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=e[i];if(hi(s)&&hi(a)||At(s)&&At(a)||Array.isArray(s)&&Array.isArray(a)?!Io(s,a,n):!Object.is(s,a))return!1}}return!0}const M_=Ie.createContext(null);M_.displayName="HookFormContext";const oee=t=>{const{children:e,watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:b,subscribe:E}=t;return Ie.createElement(M_.Provider,{value:Ie.useMemo(()=>({watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:b,subscribe:E}),[s,p,c,o,r,f,g,d,u,i,b,a,E,l,h,n])},Ie.createElement(I_.Provider,{value:p},e))};var iee=(t,e,n,r,o)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:o||!0}}:{},Ga=t=>Array.isArray(t)?t:[t],eC=()=>{let t=[];return{get observers(){return t},next:o=>{for(const i of t)i.next&&i.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(i=>i!==o)}}),unsubscribe:()=>{t=[]}}};function O_(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=e[r];if(o&&At(o)&&i){const s=O_(o,i);At(s)&&(n[r]=s)}else t[r]&&(n[r]=i)}return n}var on=t=>At(t)&&!Object.keys(t).length,a1=t=>t.type==="file",xd=t=>{if(!o1)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},D_=t=>t.type==="select-multiple",l1=t=>t.type==="radio",see=t=>l1(t)||Yl(t),ep=t=>xd(t)&&t.isConnected;function aee(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=ht(t)?r++:t[e[r++]];return t}function lee(t){for(const e in t)if(t.hasOwnProperty(e)&&!ht(t[e]))return!1;return!0}function Tt(t,e){const n=Array.isArray(e)?e:Cf(e)?[e]:s1(e),r=n.length===1?t:aee(t,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(At(r)&&on(r)||Array.isArray(r)&&lee(r))&&Tt(t,n.slice(0,-1)),t}var cee=t=>{for(const e in t)if(lr(t[e]))return!0;return!1};function L_(t){return Array.isArray(t)||At(t)&&!cee(t)}function Hm(t,e={}){for(const n in t){const r=t[n];L_(r)?(e[n]=Array.isArray(r)?[]:{},Hm(r,e[n])):ht(r)||(e[n]=!0)}return e}function as(t,e,n){n||(n=Hm(e));for(const r in t){const o=t[r];if(L_(o))ht(e)||Fm(n[r])?n[r]=Hm(o,Array.isArray(o)?[]:{}):as(o,yn(e)?{}:e[r],n[r]);else{const i=e[r];n[r]=!Io(o,i)}}return n}const tC={value:!1,isValid:!1},nC={value:!0,isValid:!0};var R_=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ht(t[0].attributes.value)?ht(t[0].value)||t[0].value===""?nC:{value:t[0].value,isValid:!0}:nC:tC}return tC},P_=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ht(t)?t:e?t===""?NaN:t&&+t:n&&Rn(t)?new Date(t):r?r(t):t;const rC={isValid:!1,value:null};var B_=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,rC):rC;function oC(t){const e=t.ref;return a1(e)?e.files:l1(e)?B_(t.refs).value:D_(e)?[...e.selectedOptions].map(({value:n})=>n):Yl(e)?R_(t.refs).value:P_(ht(e.value)?t.ref.value:e.value,t)}var uee=(t,e,n,r)=>{const o={};for(const i of t){const s=ce(e,i);s&&ct(o,i,s._f)}return{criteriaMode:n,names:[...t],fields:o,shouldUseNativeValidation:r}},Cd=t=>t instanceof RegExp,ma=t=>ht(t)?t:Cd(t)?t.source:At(t)?Cd(t.value)?t.value.source:t.value:t,iC=t=>({isOnSubmit:!t||t===cr.onSubmit,isOnBlur:t===cr.onBlur,isOnChange:t===cr.onChange,isOnAll:t===cr.all,isOnTouch:t===cr.onTouched});const sC="AsyncFunction";var dee=t=>!!t&&!!t.validate&&!!(lr(t.validate)&&t.validate.constructor.name===sC||At(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===sC)),fee=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),aC=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Ya=(t,e,n,r)=>{for(const o of n||Object.keys(t)){const i=ce(t,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],o)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(Ya(a,e))break}else if(At(a)&&Ya(a,e))break}}};function lC(t,e,n){const r=ce(t,n);if(r||Cf(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ce(e,i),a=ce(t,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var hee=(t,e,n,r)=>{n(t);const{name:o,...i}=t;return on(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(s=>e[s]===(!r||cr.all))},pee=(t,e,n)=>!t||!e||t===e||Ga(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),mee=(t,e,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(e||t):(n?r.isOnBlur:o.isOnBlur)?!t:(n?r.isOnChange:o.isOnChange)?t:!0,gee=(t,e)=>!i1(ce(t,e)).length&&Tt(t,e),bee=(t,e,n)=>{const r=Ga(ce(t,n));return ct(r,"root",e[n]),ct(t,n,r),t};function cC(t,e,n="validate"){if(Rn(t)||Array.isArray(t)&&t.every(Rn)||Nr(t)&&!t)return{type:n,message:Rn(t)?t:"",ref:e}}var es=t=>At(t)&&!Cd(t)?t:{value:t,message:""},uC=async(t,e,n,r,o,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:b,mount:E}=t._f,x=ce(n,g);if(!E||e.has(g))return{};const T=a?a[0]:s,D=F=>{o&&T.reportValidity&&(T.setCustomValidity(Nr(F)?"":F||""),T.reportValidity())},O={},v=l1(s),R=Yl(s),j=v||R,z=(b||a1(s))&&ht(s.value)&&ht(x)||xd(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,I=iee.bind(null,g,r,O),X=(F,W,B,q=Jr.maxLength,oe=Jr.minLength)=>{const Z=F?W:B;O[g]={type:F?q:oe,message:Z,ref:s,...I(F?q:oe,Z)}};if(i?!Array.isArray(x)||!x.length:l&&(!j&&(z||yn(x))||Nr(x)&&!x||R&&!R_(a).isValid||v&&!B_(a).isValid)){const{value:F,message:W}=Rn(l)?{value:!!l,message:l}:es(l);if(F&&(O[g]={type:Jr.required,message:W,ref:T,...I(Jr.required,W)},!r))return D(W),O}if(!z&&(!yn(d)||!yn(f))){let F,W;const B=es(f),q=es(d);if(!yn(x)&&!isNaN(x)){const oe=s.valueAsNumber||x&&+x;yn(B.value)||(F=oe>B.value),yn(q.value)||(W=oe<q.value)}else{const oe=s.valueAsDate||new Date(x),Z=S=>new Date(new Date().toDateString()+" "+S),ee=s.type=="time",ie=s.type=="week";Rn(B.value)&&x&&(F=ee?Z(x)>Z(B.value):ie?x>B.value:oe>new Date(B.value)),Rn(q.value)&&x&&(W=ee?Z(x)<Z(q.value):ie?x<q.value:oe<new Date(q.value))}if((F||W)&&(X(!!F,B.message,q.message,Jr.max,Jr.min),!r))return D(O[g].message),O}if((c||u)&&!z&&(Rn(x)||i&&Array.isArray(x))){const F=es(c),W=es(u),B=!yn(F.value)&&x.length>+F.value,q=!yn(W.value)&&x.length<+W.value;if((B||q)&&(X(B,F.message,W.message),!r))return D(O[g].message),O}if(h&&!z&&Rn(x)){const{value:F,message:W}=es(h);if(Cd(F)&&!x.match(F)&&(O[g]={type:Jr.pattern,message:W,ref:s,...I(Jr.pattern,W)},!r))return D(W),O}if(p){if(lr(p)){const F=await p(x,n),W=cC(F,T);if(W&&(O[g]={...W,...I(Jr.validate,W.message)},!r))return D(W.message),O}else if(At(p)){let F={};for(const W in p){if(!on(F)&&!r)break;const B=cC(await p[W](x,n),T,W);B&&(F={...B,...I(W,B.message)},D(B.message),r&&(O[g]=F))}if(!on(F)&&(O[g]={ref:T,...F},!r))return O}}return D(!0),O};const yee={mode:cr.onSubmit,reValidateMode:cr.onChange,shouldFocusError:!0};function Eee(t={}){let e={...yee,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:lr(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},o=At(e.defaultValues)||At(e.values)?Mt(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:Mt(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:eC(),state:eC()},p=e.criteriaMode===cr.all,g=N=>P=>{clearTimeout(c),c=setTimeout(N,P)},b=async N=>{if(!s.keepIsValid&&!e.disabled&&(d.isValid||f.isValid||N)){let P;e.resolver?(P=on((await j()).errors),E()):P=await I(r,!0),P!==n.isValid&&h.state.next({isValid:P})}},E=(N,P)=>{!e.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((N||Array.from(a.mount)).forEach($=>{$&&(P?ct(n.validatingFields,$,P):Tt(n.validatingFields,$))}),h.state.next({validatingFields:n.validatingFields,isValidating:!on(n.validatingFields)}))},x=(N,P=[],$,re,te=!0,M=!0)=>{if(re&&$&&!e.disabled){if(s.action=!0,M&&Array.isArray(ce(r,N))){const H=$(ce(r,N),re.argA,re.argB);te&&ct(r,N,H)}if(M&&Array.isArray(ce(n.errors,N))){const H=$(ce(n.errors,N),re.argA,re.argB);te&&ct(n.errors,N,H),gee(n.errors,N)}if((d.touchedFields||f.touchedFields)&&M&&Array.isArray(ce(n.touchedFields,N))){const H=$(ce(n.touchedFields,N),re.argA,re.argB);te&&ct(n.touchedFields,N,H)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=as(o,i)),h.state.next({name:N,isDirty:F(N,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ct(i,N,P)},T=(N,P)=>{ct(n.errors,N,P),h.state.next({errors:n.errors})},D=N=>{n.errors=N,h.state.next({errors:n.errors,isValid:!1})},O=(N,P,$,re)=>{const te=ce(r,N);if(te){const M=ce(i,N,ht($)?ce(o,N):$);ht(M)||re&&re.defaultChecked||P?ct(i,N,P?M:oC(te._f)):q(N,M),s.mount&&!s.action&&b()}},v=(N,P,$,re,te)=>{let M=!1,H=!1;const ne={name:N};if(!e.disabled){if(!$||re){(d.isDirty||f.isDirty)&&(H=n.isDirty,n.isDirty=ne.isDirty=F(),M=H!==ne.isDirty);const se=Io(ce(o,N),P);H=!!ce(n.dirtyFields,N),se?Tt(n.dirtyFields,N):ct(n.dirtyFields,N,!0),ne.dirtyFields=n.dirtyFields,M=M||(d.dirtyFields||f.dirtyFields)&&H!==!se}if($){const se=ce(n.touchedFields,N);se||(ct(n.touchedFields,N,$),ne.touchedFields=n.touchedFields,M=M||(d.touchedFields||f.touchedFields)&&se!==$)}M&&te&&h.state.next(ne)}return M?ne:{}},R=(N,P,$,re)=>{const te=ce(n.errors,N),M=(d.isValid||f.isValid)&&Nr(P)&&n.isValid!==P;if(e.delayError&&$?(l=g(()=>T(N,$)),l(e.delayError)):(clearTimeout(c),l=null,$?ct(n.errors,N,$):Tt(n.errors,N)),($?!Io(te,$):te)||!on(re)||M){const H={...re,...M&&Nr(P)?{isValid:P}:{},errors:n.errors,name:N};n={...n,...H},h.state.next(H)}},j=async N=>(E(N,!0),await e.resolver(i,e.context,uee(N||a.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),z=async N=>{const{errors:P}=await j(N);if(E(N),N)for(const $ of N){const re=ce(P,$);re?ct(n.errors,$,re):Tt(n.errors,$)}else n.errors=P;return P},I=async(N,P,$={valid:!0})=>{for(const re in N){const te=N[re];if(te){const{_f:M,...H}=te;if(M){const ne=a.array.has(M.name),se=te._f&&dee(te._f);se&&d.validatingFields&&E([M.name],!0);const xe=await uC(te,a.disabled,i,p,e.shouldUseNativeValidation&&!P,ne);if(se&&d.validatingFields&&E([M.name]),xe[M.name]&&($.valid=!1,P||t.shouldUseNativeValidation))break;!P&&(ce(xe,M.name)?ne?bee(n.errors,xe,M.name):ct(n.errors,M.name,xe[M.name]):Tt(n.errors,M.name))}!on(H)&&await I(H,P,$)}}return $.valid},X=()=>{for(const N of a.unMount){const P=ce(r,N);P&&(P._f.refs?P._f.refs.every($=>!ep($)):!ep(P._f.ref))&&$e(N)}a.unMount=new Set},F=(N,P)=>!e.disabled&&(N&&P&&ct(i,N,P),!Io(Ee(),o)),W=(N,P,$)=>ree(N,a,{...s.mount?i:ht(P)?o:Rn(N)?{[N]:P}:P},$,P),B=N=>i1(ce(s.mount?i:o,N,e.shouldUnregister?ce(o,N,[]):[])),q=(N,P,$={})=>{const re=ce(r,N);let te=P;if(re){const M=re._f;M&&(!M.disabled&&ct(i,N,P_(P,M)),te=xd(M.ref)&&yn(P)?"":P,D_(M.ref)?[...M.ref.options].forEach(H=>H.selected=te.includes(H.value)):M.refs?Yl(M.ref)?M.refs.forEach(H=>{(!H.defaultChecked||!H.disabled)&&(Array.isArray(te)?H.checked=!!te.find(ne=>ne===H.value):H.checked=te===H.value||!!te)}):M.refs.forEach(H=>H.checked=H.value===te):a1(M.ref)?M.ref.value="":(M.ref.value=te,M.ref.type||h.state.next({name:N,values:Mt(i)})))}($.shouldDirty||$.shouldTouch)&&v(N,te,$.shouldTouch,$.shouldDirty,!0),$.shouldValidate&&S(N)},oe=(N,P,$)=>{for(const re in P){if(!P.hasOwnProperty(re))return;const te=P[re],M=N+"."+re,H=ce(r,M);(a.array.has(N)||At(te)||H&&!H._f)&&!hi(te)?oe(M,te,$):q(M,te,$)}},Z=(N,P,$={})=>{const re=ce(r,N),te=a.array.has(N),M=Mt(P);ct(i,N,M),te?(h.array.next({name:N,values:Mt(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&$.shouldDirty&&h.state.next({name:N,dirtyFields:as(o,i),isDirty:F(N,M)})):re&&!re._f&&!yn(M)?oe(N,M,$):q(N,M,$),aC(N,a)?h.state.next({...n,name:N,values:Mt(i)}):h.state.next({name:s.mount?N:void 0,values:Mt(i)})},ee=async N=>{s.mount=!0;const P=N.target;let $=P.name,re=!0;const te=ce(r,$),M=se=>{re=Number.isNaN(se)||hi(se)&&isNaN(se.getTime())||Io(se,ce(i,$,se))},H=iC(e.mode),ne=iC(e.reValidateMode);if(te){let se,xe;const It=P.type?oC(te._f):XJ(N),Kt=N.type===Jx.BLUR||N.type===Jx.FOCUS_OUT,or=!fee(te._f)&&!e.resolver&&!ce(n.errors,$)&&!te._f.deps||mee(Kt,ce(n.touchedFields,$),n.isSubmitted,ne,H),qr=aC($,a,Kt);ct(i,$,It),Kt?(!P||!P.readOnly)&&(te._f.onBlur&&te._f.onBlur(N),l&&l(0)):te._f.onChange&&te._f.onChange(N);const Wr=v($,It,Kt),rn=!on(Wr)||qr;if(!Kt&&h.state.next({name:$,type:N.type,values:Mt(i)}),or)return(d.isValid||f.isValid)&&(e.mode==="onBlur"?Kt&&b():Kt||b()),rn&&h.state.next({name:$,...qr?{}:Wr});if(!Kt&&qr&&h.state.next({...n}),e.resolver){const{errors:Gr}=await j([$]);if(E([$]),M(It),re){const ir=lC(n.errors,r,$),f1=lC(Gr,r,ir.name||$);se=f1.error,$=f1.name,xe=on(Gr)}}else E([$],!0),se=(await uC(te,a.disabled,i,p,e.shouldUseNativeValidation))[$],E([$]),M(It),re&&(se?xe=!1:(d.isValid||f.isValid)&&(xe=await I(r,!0)));re&&(te._f.deps&&(!Array.isArray(te._f.deps)||te._f.deps.length>0)&&S(te._f.deps),R($,xe,se,Wr))}},ie=(N,P)=>{if(ce(n.errors,P)&&N.focus)return N.focus(),1},S=async(N,P={})=>{let $,re;const te=Ga(N);if(e.resolver){const M=await z(ht(N)?N:te);$=on(M),re=N?!te.some(H=>ce(M,H)):$}else N?(re=(await Promise.all(te.map(async M=>{const H=ce(r,M);return await I(H&&H._f?{[M]:H}:H)}))).every(Boolean),!(!re&&!n.isValid)&&b()):re=$=await I(r);return h.state.next({...!Rn(N)||(d.isValid||f.isValid)&&$!==n.isValid?{}:{name:N},...e.resolver||!N?{isValid:$}:{},errors:n.errors}),P.shouldFocus&&!re&&Ya(r,ie,N?te:a.mount),re},Ee=(N,P)=>{let $={...s.mount?i:o};return P&&($=O_(P.dirtyFields?n.dirtyFields:n.touchedFields,$)),ht(N)?$:Rn(N)?ce($,N):N.map(re=>ce($,re))},be=(N,P)=>({invalid:!!ce((P||n).errors,N),isDirty:!!ce((P||n).dirtyFields,N),error:ce((P||n).errors,N),isValidating:!!ce(n.validatingFields,N),isTouched:!!ce((P||n).touchedFields,N)}),_=N=>{N&&Ga(N).forEach(P=>Tt(n.errors,P)),h.state.next({errors:N?n.errors:{}})},ft=(N,P,$)=>{const re=(ce(r,N,{_f:{}})._f||{}).ref,te=ce(n.errors,N)||{},{ref:M,message:H,type:ne,...se}=te;ct(n.errors,N,{...se,...P,ref:re}),h.state.next({name:N,errors:n.errors,isValid:!1}),$&&$.shouldFocus&&re&&re.focus&&re.focus()},Ue=(N,P)=>lr(N)?h.state.subscribe({next:$=>"values"in $&&N(W(void 0,P),$)}):W(N,P,!0),Ve=N=>h.state.subscribe({next:P=>{pee(N.name,P.name,N.exact)&&hee(P,N.formState||d,Tf,N.reRenderRoot)&&N.callback({values:{...i},...n,...P,defaultValues:o})}}).unsubscribe,Lt=N=>(s.mount=!0,f={...f,...N.formState},Ve({...N,formState:{...u,...N.formState}})),$e=(N,P={})=>{for(const $ of N?Ga(N):a.mount)a.mount.delete($),a.array.delete($),P.keepValue||(Tt(r,$),Tt(i,$)),!P.keepError&&Tt(n.errors,$),!P.keepDirty&&Tt(n.dirtyFields,$),!P.keepTouched&&Tt(n.touchedFields,$),!P.keepIsValidating&&Tt(n.validatingFields,$),!e.shouldUnregister&&!P.keepDefaultValue&&Tt(o,$);h.state.next({values:Mt(i)}),h.state.next({...n,...P.keepDirty?{isDirty:F()}:{}}),!P.keepIsValid&&b()},Ye=({disabled:N,name:P})=>{if(Nr(N)&&s.mount||N||a.disabled.has(P)){const te=a.disabled.has(P)!==!!N;N?a.disabled.add(P):a.disabled.delete(P),te&&s.mount&&!s.action&&b()}},xt=(N,P={})=>{let $=ce(r,N);const re=Nr(P.disabled)||Nr(e.disabled);return ct(r,N,{...$||{},_f:{...$&&$._f?$._f:{ref:{name:N}},name:N,mount:!0,...P}}),a.mount.add(N),$?Ye({disabled:Nr(P.disabled)?P.disabled:e.disabled,name:N}):O(N,!0,P.value),{...re?{disabled:P.disabled||e.disabled}:{},...e.progressive?{required:!!P.required,min:ma(P.min),max:ma(P.max),minLength:ma(P.minLength),maxLength:ma(P.maxLength),pattern:ma(P.pattern)}:{},name:N,onChange:ee,onBlur:ee,ref:te=>{if(te){xt(N,P),$=ce(r,N);const M=ht(te.value)&&te.querySelectorAll&&te.querySelectorAll("input,select,textarea")[0]||te,H=see(M),ne=$._f.refs||[];if(H?ne.find(se=>se===M):M===$._f.ref)return;ct(r,N,{_f:{...$._f,...H?{refs:[...ne.filter(ep),M,...Array.isArray(ce(o,N))?[{}]:[]],ref:{type:M.type,name:N}}:{ref:M}}}),O(N,!1,void 0,M)}else $=ce(r,N,{}),$._f&&($._f.mount=!1),(e.shouldUnregister||P.shouldUnregister)&&!(JJ(a.array,N)&&s.action)&&a.unMount.add(N)}}},Rt=()=>e.shouldFocusError&&Ya(r,ie,a.mount),Vn=N=>{Nr(N)&&(h.state.next({disabled:N}),Ya(r,(P,$)=>{const re=ce(r,$);re&&(P.disabled=re._f.disabled||N,Array.isArray(re._f.refs)&&re._f.refs.forEach(te=>{te.disabled=re._f.disabled||N}))},0,!1))},Gi=(N,P)=>async $=>{let re;$&&($.preventDefault&&$.preventDefault(),$.persist&&$.persist());let te=Mt(i);if(h.state.next({isSubmitting:!0}),e.resolver){const{errors:M,values:H}=await j();E(),n.errors=M,te=Mt(H)}else await I(r);if(a.disabled.size)for(const M of a.disabled)Tt(te,M);if(Tt(n.errors,"root"),on(n.errors)){h.state.next({errors:{}});try{await N(te,$)}catch(M){re=M}}else P&&await P({...n.errors},$),Rt(),setTimeout(Rt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:on(n.errors)&&!re,submitCount:n.submitCount+1,errors:n.errors}),re)throw re},ta=(N,P={})=>{ce(r,N)&&(ht(P.defaultValue)?Z(N,Mt(ce(o,N))):(Z(N,P.defaultValue),ct(o,N,Mt(P.defaultValue))),P.keepTouched||Tt(n.touchedFields,N),P.keepDirty||(Tt(n.dirtyFields,N),n.isDirty=P.defaultValue?F(N,Mt(ce(o,N))):F()),P.keepError||(Tt(n.errors,N),d.isValid&&b()),h.state.next({...n}))},na=(N,P={})=>{const $=N?Mt(N):o,re=Mt($),te=on(N),M=te?o:re;if(P.keepDefaultValues||(o=$),!P.keepValues){if(P.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(as(o,i))]);for(const ne of Array.from(H)){const se=ce(n.dirtyFields,ne),xe=ce(i,ne),It=ce(M,ne);se&&!ht(xe)?ct(M,ne,xe):!se&&!ht(It)&&Z(ne,It)}}else{if(o1&&ht(N))for(const H of a.mount){const ne=ce(r,H);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(xd(se)){const xe=se.closest("form");if(xe){xe.reset();break}}}}if(P.keepFieldsRef)for(const H of a.mount)Z(H,ce(M,H));else r={}}i=e.shouldUnregister?P.keepDefaultValues?Mt(o):{}:Mt(M),h.array.next({values:{...M}}),h.state.next({values:{...M}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!e.shouldUnregister&&!on(M),s.watch=!!e.shouldUnregister,s.keepIsValid=!!P.keepIsValid,s.action=!1,P.keepErrors||(n.errors={}),h.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:te?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Io(N,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:te?{}:P.keepDirtyValues?P.keepDefaultValues&&i?as(o,i):n.dirtyFields:P.keepDefaultValues&&N?as(o,N):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ra=(N,P)=>na(lr(N)?N(i):N,{...e.resetOptions,...P}),Kl=(N,P={})=>{const $=ce(r,N),re=$&&$._f;if(re){const te=re.refs?re.refs[0]:re.ref;te.focus&&setTimeout(()=>{te.focus(),P.shouldSelect&&lr(te.select)&&te.select()})}},Tf=N=>{n={...n,...N}},oa={control:{register:xt,unregister:$e,getFieldState:be,handleSubmit:Gi,setError:ft,_subscribe:Ve,_runSchema:j,_updateIsValidating:E,_focusError:Rt,_getWatch:W,_getDirty:F,_setValid:b,_setFieldArray:x,_setDisabledField:Ye,_setErrors:D,_getFieldArray:B,_reset:na,_resetDefaultValues:()=>lr(e.defaultValues)&&e.defaultValues().then(N=>{ra(N,e.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:X,_disableForm:Vn,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(N){s=N},get _defaultValues(){return o},get _names(){return a},set _names(N){a=N},get _formState(){return n},get _options(){return e},set _options(N){e={...e,...N}}},subscribe:Lt,trigger:S,register:xt,handleSubmit:Gi,watch:Ue,setValue:Z,getValues:Ee,reset:ra,resetField:ta,clearErrors:_,unregister:$e,setError:ft,setFocus:Kl,getFieldState:be};return{...oa,formControl:oa}}function xee(t={}){const e=Ie.useRef(void 0),n=Ie.useRef(void 0),[r,o]=Ie.useState({isDirty:!1,isValidating:!1,isLoading:lr(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:lr(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!lr(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:s,...a}=Eee(t);e.current={...a,formState:r}}const i=e.current.control;return i._options=t,nee(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Ie.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),Ie.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),Ie.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),Ie.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),Ie.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Ie.useEffect(()=>{var s;t.values&&!Io(t.values,n.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),n.current=t.values,o(a=>({...a}))):i._resetDefaultValues()},[i,t.values]),Ie.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=Ie.useMemo(()=>tee(r,i),[i,r]),e.current}function Cee(t,e=[]){let n=[];function r(i,s){const a=C.createContext(s);a.displayName=i+"Context";const l=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,g=f?.[t]?.[l]||a,b=C.useMemo(()=>p,Object.values(p));return y.jsx(g.Provider,{value:b,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[l]||a,p=C.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(a){const l=a?.[t]||i;return C.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,kee(o,...e)]}function kee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var c1="Avatar",[Tee]=Cee(c1),[wee,F_]=Tee(c1),H_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[o,i]=C.useState("idle");return y.jsx(wee,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:y.jsx(kd.span,{...r,ref:e})})});H_.displayName=c1;var U_="AvatarImage",V_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=t,s=F_(U_,n),a=See(r,i),l=x3(c=>{o(c),s.onImageLoadingStatusChange(c)});return ip(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?y.jsx(kd.img,{...i,ref:e,src:r}):null});V_.displayName=U_;var $_="AvatarFallback",j_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...o}=t,i=F_($_,n),[s,a]=C.useState(r===void 0);return C.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?y.jsx(kd.span,{...o,ref:e}):null});j_.displayName=$_;function dC(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function See(t,{referrerPolicy:e,crossOrigin:n}){const r=C3(),o=C.useRef(null),i=r?(o.current||(o.current=new window.Image),o.current):null,[s,a]=C.useState(()=>dC(i,t));return ip(()=>{a(dC(i,t))},[i,t]),ip(()=>{const l=d=>()=>{a(d)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,e]),s}var vee=H_,Aee=V_,_ee=j_;const u1="-",Nee=t=>{const e=Mee(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const a=s.split(u1);return a[0]===""&&a.length!==1&&a.shift(),z_(a,e)||Iee(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},z_=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?z_(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const i=t.join(u1);return e.validators.find(({validator:s})=>s(i))?.classGroupId},fC=/^\[(.+)\]$/,Iee=t=>{if(fC.test(t)){const e=fC.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Mee=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return Dee(Object.entries(t.classGroups),n).forEach(([i,s])=>{Um(s,r,i,e)}),r},Um=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){const i=o===""?e:hC(e,o);i.classGroupId=n;return}if(typeof o=="function"){if(Oee(o)){Um(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Um(s,hC(e,i),n,r)})})},hC=(t,e)=>{let n=t;return e.split(u1).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Oee=t=>t.isThemeGetter,Dee=(t,e)=>e?t.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[e+s,a])):i);return[n,o]}):t,Lee=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},q_="!",Ree=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,o=e[0],i=e.length,s=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let E=a[b];if(c===0){if(E===o&&(r||a.slice(b,b+i)===e)){l.push(a.slice(u,b)),u=b+i;continue}if(E==="/"){d=b;continue}}E==="["?c++:E==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(q_),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:s}):s},Pee=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},Bee=t=>({cache:Lee(t.cacheSize),parseClassName:Ree(t),...Nee(t)}),Fee=/\s+/,Hee=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=e,i=[],s=t.trim().split(Fee);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,g=r(p?f.substring(0,h):f);if(!g){if(!p){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}p=!1}const b=Pee(u).join(":"),E=d?b+q_:b,x=E+g;if(i.includes(x))continue;i.push(x);const T=o(g,p);for(let D=0;D<T.length;++D){const O=T[D];i.push(E+O)}a=c+(a.length>0?" "+a:a)}return a};function Uee(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=W_(e))&&(r&&(r+=" "),r+=n);return r}const W_=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=W_(t[r]))&&(n&&(n+=" "),n+=e);return n};function Vee(t,...e){let n,r,o,i=s;function s(l){const c=e.reduce((u,d)=>d(u),t());return n=Bee(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=Hee(l,n);return o(l,u),u}return function(){return i(Uee.apply(null,arguments))}}const it=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},G_=/^\[(?:([a-z-]+):)?(.+)\]$/i,$ee=/^\d+\/\d+$/,jee=new Set(["px","full","screen"]),zee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,eo=t=>ws(t)||jee.has(t)||$ee.test(t),yo=t=>ea(t,"length",nte),ws=t=>!!t&&!Number.isNaN(Number(t)),tp=t=>ea(t,"number",ws),ga=t=>!!t&&Number.isInteger(Number(t)),Kee=t=>t.endsWith("%")&&ws(t.slice(0,-1)),Te=t=>G_.test(t),Eo=t=>zee.test(t),Qee=new Set(["length","size","percentage"]),Xee=t=>ea(t,Qee,Y_),Zee=t=>ea(t,"position",Y_),Jee=new Set(["image","url"]),ete=t=>ea(t,Jee,ote),tte=t=>ea(t,"",rte),ba=()=>!0,ea=(t,e,n)=>{const r=G_.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},nte=t=>qee.test(t)&&!Wee.test(t),Y_=()=>!1,rte=t=>Gee.test(t),ote=t=>Yee.test(t),ite=()=>{const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),o=it("borderColor"),i=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),c=it("grayscale"),u=it("hueRotate"),d=it("invert"),f=it("gap"),h=it("gradientColorStops"),p=it("gradientColorStopPositions"),g=it("inset"),b=it("margin"),E=it("opacity"),x=it("padding"),T=it("saturate"),D=it("scale"),O=it("sepia"),v=it("skew"),R=it("space"),j=it("translate"),z=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",Te,e],F=()=>[Te,e],W=()=>["",eo,yo],B=()=>["auto",ws,Te],q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>["start","end","center","between","around","evenly","stretch"],ie=()=>["","0",Te],S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ee=()=>[ws,Te];return{cacheSize:500,separator:":",theme:{colors:[ba],spacing:[eo,yo],blur:["none","",Eo,Te],brightness:Ee(),borderColor:[t],borderRadius:["none","","full",Eo,Te],borderSpacing:F(),borderWidth:W(),contrast:Ee(),grayscale:ie(),hueRotate:Ee(),invert:ie(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[Kee,yo],inset:X(),margin:X(),opacity:Ee(),padding:F(),saturate:Ee(),scale:Ee(),sepia:ie(),skew:Ee(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Te]}],container:["container"],columns:[{columns:[Eo]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...q(),Te]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ga,Te]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Te]}],grow:[{grow:ie()}],shrink:[{shrink:ie()}],order:[{order:["first","last","none",ga,Te]}],"grid-cols":[{"grid-cols":[ba]}],"col-start-end":[{col:["auto",{span:["full",ga,Te]},Te]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[ba]}],"row-start-end":[{row:["auto",{span:[ga,Te]},Te]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Te]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ee()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ee(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ee(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Te,e]}],"min-w":[{"min-w":[Te,e,"min","max","fit"]}],"max-w":[{"max-w":[Te,e,"none","full","min","max","fit","prose",{screen:[Eo]},Eo]}],h:[{h:[Te,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Te,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Eo,yo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tp]}],"font-family":[{font:[ba]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Te]}],"line-clamp":[{"line-clamp":["none",ws,tp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",eo,Te]}],"list-image":[{"list-image":["none",Te]}],"list-style-type":[{list:["none","disc","decimal",Te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",eo,yo]}],"underline-offset":[{"underline-offset":["auto",eo,Te]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...q(),Zee]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Xee]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ete]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...oe(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:oe()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...oe()]}],"outline-offset":[{"outline-offset":[eo,Te]}],"outline-w":[{outline:[eo,yo]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[eo,yo]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Eo,tte]}],"shadow-color":[{shadow:[ba]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Eo,Te]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Te]}],duration:[{duration:Ee()}],ease:[{ease:["linear","in","out","in-out",Te]}],delay:[{delay:Ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",Te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[ga,Te]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Te]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[eo,yo,tp]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ste=Vee(ite);const ate=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lte=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),pC=t=>{const e=lte(t);return e.charAt(0).toUpperCase()+e.slice(1)},K_=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),cte=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var ute={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dte=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>C.createElement("svg",{ref:l,...ute,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:K_("lucide",o),...!i&&!cte(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>C.createElement(c,u)),...Array.isArray(i)?i:[i]]));const kf=(t,e)=>{const n=C.forwardRef(({className:r,...o},i)=>C.createElement(dte,{ref:i,iconNode:e,className:K_(`lucide-${ate(pC(t))}`,`lucide-${t}`,r),...o}));return n.displayName=pC(t),n};const fte=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Q_=kf("check",fte);const hte=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],X_=kf("chevron-down",hte);const pte=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Z_=kf("chevron-right",pte);const mte=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gte=kf("chevron-up",mte);var bte="Label",J_=C.forwardRef((t,e)=>y.jsx(kd.label,{...t,ref:e,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));J_.displayName=bte;var yte=J_;function ue(...t){return ste(s3(t))}function Ete({className:t,...e}){return y.jsx(vee,{"data-slot":"avatar",className:ue("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function xte({className:t,...e}){return y.jsx(Aee,{"data-slot":"avatar-image",className:ue("aspect-square size-full",t),...e})}function Cte({className:t,...e}){return y.jsx(_ee,{"data-slot":"avatar-fallback",className:ue("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}const kte=Vm("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Tte({className:t,variant:e,asChild:n=!1,...r}){return y.jsx(n?_C:"span",{"data-slot":"badge",className:ue(kte({variant:e}),t),...r})}const wte=Vm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ste({className:t,variant:e,size:n,asChild:r=!1,...o}){return y.jsx(r?_C:"button",{"data-slot":"button",className:ue(wte({variant:e,size:n,className:t})),...o})}function vte({className:t,...e}){return y.jsx("div",{"data-slot":"card",className:ue("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}function Ate({className:t,...e}){return y.jsx("div",{"data-slot":"card-content",className:ue("px-6",t),...e})}function _te({...t}){return y.jsx(eN,{"data-slot":"dropdown-menu",...t})}function Nte({...t}){return y.jsx(z3,{"data-slot":"dropdown-menu-trigger",...t})}function Ite({className:t,sideOffset:e=4,...n}){return y.jsx(X3,{"data-slot":"dropdown-menu-content",sideOffset:e,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",t),...n})}function Mte({className:t,inset:e,variant:n="default",...r}){return y.jsx(Q3,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function Ote({className:t,children:e,checked:n,...r}){return y.jsxs(Z3,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),checked:n,...r,children:[y.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:y.jsx(J3,{children:y.jsx(Q_,{className:"size-4"})})}),e]})}function Dte({className:t,inset:e,...n}){return y.jsx(K3,{"data-slot":"dropdown-menu-label","data-inset":e,className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function Lte({className:t,...e}){return y.jsx(Y3,{"data-slot":"dropdown-menu-separator",className:ue("bg-border -mx-1 my-1 h-px",t),...e})}function Rte({...t}){return y.jsx(G3,{"data-slot":"dropdown-menu-sub",...t})}function Pte({className:t,inset:e,children:n,...r}){return y.jsxs(q3,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:ue("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",t),...r,children:[n,y.jsx(Z_,{className:"ml-auto size-4"})]})}function Bte({className:t,...e}){return y.jsx(W3,{"data-slot":"dropdown-menu-sub-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",t),...e})}function Fte({className:t,...e}){return y.jsx(yte,{"data-slot":"label",className:ue("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",t),...e})}const Hte=oee;C.createContext({});C.createContext({});function Ute({className:t,type:e,...n}){return y.jsx("input",{type:e,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}function Vte({...t}){return y.jsx(j3,{"data-slot":"popover",...t})}function $te({...t}){return y.jsx(V3,{"data-slot":"popover-trigger",...t})}function jte({className:t,align:e="center",sideOffset:n=4,...r}){return y.jsx($3,{"data-slot":"popover-content",align:e,sideOffset:n,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",t),...r})}function zte({...t}){return y.jsx(U3,{"data-slot":"select",...t})}function qte({...t}){return y.jsx(O3,{"data-slot":"select-value",...t})}function Wte({className:t,size:e="default",children:n,...r}){return y.jsxs(D3,{"data-slot":"select-trigger","data-size":e,className:ue("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,y.jsx(L3,{asChild:!0,children:y.jsx(X_,{className:"size-4 opacity-50"})})]})}function Gte({className:t,children:e,position:n="popper",...r}){return y.jsxs(F3,{"data-slot":"select-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[y.jsx(Kte,{}),y.jsx(H3,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),y.jsx(Qte,{})]})}function Yte({className:t,children:e,...n}){return y.jsxs(R3,{"data-slot":"select-item",className:ue("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[y.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:y.jsx(P3,{children:y.jsx(Q_,{className:"size-4"})})}),y.jsx(B3,{children:e})]})}function Kte({className:t,...e}){return y.jsx(tN,{"data-slot":"select-scroll-up-button",className:ue("flex cursor-default items-center justify-center py-1",t),...e,children:y.jsx(gte,{className:"size-4"})})}function Qte({className:t,...e}){return y.jsx(nN,{"data-slot":"select-scroll-down-button",className:ue("flex cursor-default items-center justify-center py-1",t),...e,children:y.jsx(X_,{className:"size-4"})})}function Xte({className:t,...e}){return y.jsx("div",{"data-slot":"skeleton",className:ue("bg-accent animate-pulse rounded-md",t),...e})}function Zte({className:t,...e}){return y.jsx(M3,{"data-slot":"tabs",className:ue("flex flex-col gap-2",t),...e})}function Jte({className:t,...e}){return y.jsx(N3,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...e})}function ene({className:t,...e}){return y.jsx(_3,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...e})}function tne({className:t,...e}){return y.jsx(I3,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",t),...e})}const nne=Vm("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function rne({className:t,variant:e,size:n,...r}){return y.jsx(A3,{"data-slot":"toggle",className:ue(nne({variant:e,size:n,className:t})),...r})}function e3({delayDuration:t=0,...e}){return y.jsx(T3,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function one({...t}){return y.jsx(e3,{children:y.jsx(v3,{"data-slot":"tooltip",...t})})}function ine({...t}){return y.jsx(k3,{"data-slot":"tooltip-trigger",...t})}function sne({className:t,sideOffset:e=0,children:n,...r}){return y.jsxs(w3,{"data-slot":"tooltip-content",sideOffset:e,className:ue("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",t),...r,children:[n,y.jsx(S3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}const ane={Avatar:{Avatar:Ete,AvatarFallback:Cte,AvatarImage:xte},Badge:{Badge:Tte},Button:{Button:Ste},Card:{Card:vte,CardContent:Ate},DropdownMenu:{DropdownMenu:_te,DropdownMenuCheckboxItem:Ote,DropdownMenuContent:Ite,DropdownMenuItem:Mte,DropdownMenuLabel:Dte,DropdownMenuSeparator:Lte,DropdownMenuSub:Rte,DropdownMenuSubContent:Bte,DropdownMenuSubTrigger:Pte,DropdownMenuTrigger:Nte},Form:{Form:Hte},Input:{Input:Ute},Label:{Label:Fte},Popover:{Popover:Vte,PopoverContent:jte,PopoverTrigger:$te},Select:{Select:zte,SelectContent:Gte,SelectItem:Yte,SelectTrigger:Wte,SelectValue:qte},Skeleton:{Skeleton:Xte},Tabs:{Tabs:Zte,TabsContent:tne,TabsList:Jte,TabsTrigger:ene},Toggle:{Toggle:rne},Tooltip:{Tooltip:one,TooltipContent:sne,TooltipProvider:e3,TooltipTrigger:ine}},t3=C.createContext(void 0);function Ke(){return C.useContext(t3)}const lne=t=>{const{children:e,...n}=t;Se(n);const r=Ke(),o=xee();return y.jsx(r.Form.Form,{...o,children:e})},cne=C.forwardRef((t,e)=>{const{className:n,name:r,label:o,variant:i,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:d,onChange:f,onSubmit:h,autoComplete:p,rightSection:g,...b}=t;Se(b);const E=Ke();return y.jsxs("div",{className:ue(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,y.jsxs("div",{className:"flex-1",children:[o&&y.jsx(E.Label.Label,{htmlFor:o,children:o}),y.jsx(E.Input.Input,{className:ue(n,"h-auto border-none p-0"),id:o,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:d,onChange:f,onSubmit:h,ref:e})]}),g]})}),une=t=>C.forwardRef((e,n)=>y.jsx(t,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{const o=new PointerEvent("pointerdown",r.nativeEvent);o.fakeEvent=!0,r.target.dispatchEvent(o)},...e,ref:n})),dne=t=>{const{children:e,onOpenChange:n,position:r,sub:o,...i}=t;Se(i);const s=Ke();return o?y.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:e}):y.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:e})},fne=t=>{const{children:e,sub:n,...r}=t;Se(r);const o=Ke(),i=C.useMemo(()=>une(o.DropdownMenu.DropdownMenuTrigger),[o.DropdownMenu.DropdownMenuTrigger]);return n?y.jsx(o.DropdownMenu.DropdownMenuSubTrigger,{children:e}):y.jsx(i,{asChild:!0,...r,children:e})},hne=C.forwardRef((t,e)=>{const{className:n,children:r,sub:o,...i}=t;Se(i);const s=Ke();return o?y.jsx(s.DropdownMenu.DropdownMenuSubContent,{className:n,ref:e,children:r}):y.jsx(s.DropdownMenu.DropdownMenuContent,{className:n,ref:e,children:r})}),pne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,checked:i,subTrigger:s,onClick:a,...l}=t;Se(l);const c=Ke();return s?y.jsxs(y.Fragment,{children:[o,r]}):i!==void 0?y.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:ue(n,"gap-1",i?"":"px-2"),ref:e,checked:i,onClick:a,...l,children:[o,r]}):y.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:e,onClick:a,...l,children:[o,r,s&&y.jsx(Z_,{className:"ml-auto h-4 w-4"})]})}),mne=C.forwardRef((t,e)=>{const{className:n,...r}=t;Se(r);const o=Ke();return y.jsx(o.DropdownMenu.DropdownMenuSeparator,{className:n,ref:e})}),gne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o);const i=Ke();return y.jsx(i.DropdownMenu.DropdownMenuLabel,{className:n,ref:e,children:r})}),bne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=t;Se(u,!1);const d=Ke();return y.jsxs(d.Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:e,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),yne=C.forwardRef((t,e)=>{const{className:n,tabs:r,defaultOpenTab:o,openTab:i,setOpenTab:s,loading:a,...l}=t;Se(l);const c=Ke();return y.jsxs(c.Tabs.Tabs,{className:ue(n,"bg-popover max-w-screen rounded-lg p-2"),ref:e,value:i,defaultValue:o,onValueChange:s,children:[y.jsx(c.Tabs.TabsList,{children:r.map(u=>y.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>y.jsx(c.Tabs.TabsContent,{value:u.name,children:y.jsx(c.Card.Card,{children:y.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),Ene=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue(n,"flex flex-col items-start justify-center gap-2"),ref:e,children:r})}),xne=C.forwardRef((t,e)=>{const{className:n,value:r,placeholder:o,onKeyDown:i,onChange:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Input.Input,{"data-test":"embed-input",className:ue(n,"w-80 max-w-full"),ref:e,value:r,placeholder:o,onKeyDown:i,onChange:s})}),Cne=t=>{const{children:e,open:n,onOpenChange:r,position:o,...i}=t;Se(i);const s=Ke();return y.jsx(s.Popover.Popover,{open:n,onOpenChange:r,children:e})},kne=C.forwardRef((t,e)=>{const{children:n,...r}=t;Se(r);const o=Ke();return y.jsx(o.Popover.PopoverTrigger,{ref:e,asChild:!0,children:n})}),Tne=C.forwardRef((t,e)=>{const{className:n,variant:r,children:o,...i}=t;Se(i);const s=Ke();return y.jsx(s.Popover.PopoverContent,{sideOffset:8,className:ue(n,"z-[10000] flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:e,children:o})}),wne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o,!1),y.jsx("div",{className:n,ref:e,...o,children:r})}),Sne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=t;Se(u,!1);const d=Ke();return y.jsxs(d.Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:e,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),vne=C.forwardRef((t,e)=>{const{className:n,children:r,id:o,columns:i,...s}=t;return Se(s),y.jsx("div",{className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:e,id:o,role:"grid",children:r})}),Ane=C.forwardRef((t,e)=>{const{className:n,children:r,columns:o,...i}=t;return Se(i),y.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:e,children:r})}),_ne=C.forwardRef((t,e)=>{const{className:n,children:r,id:o,...i}=t;return Se(i),y.jsx("div",{id:o,role:"listbox",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:e,children:r})}),Nne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:e,children:y.jsx("div",{children:r})})}),Ine=C.forwardRef((t,e)=>{const n=Ke(),{className:r,item:o,isSelected:i,onClick:s,id:a,...l}=t;Se(l);const c=C.useRef(null);return C.useEffect(()=>{if(!c.current||!i)return;const u=A_(c.current,document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu"));u==="top"?c.current.scrollIntoView(!0):u==="bottom"&&c.current.scrollIntoView(!1)},[i]),y.jsxs("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",t.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:__([e,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":i||void 0,children:[o.icon&&y.jsx("div",{className:ue("p-3",t.item.size==="small"?"p-0":"",r),"data-position":"left",children:o.icon}),y.jsxs("div",{className:"flex-1",children:[y.jsx("div",{className:ue("text-base",t.item.size==="small"?"text-sm":"",r),children:o.title}),y.jsx("div",{className:ue("text-xs",t.item.size==="small"?"hidden":"",r),children:o.subtext})]}),o.badge&&y.jsx("div",{"data-position":"right",className:"text-xs",children:y.jsx(n.Badge.Badge,{variant:"secondary",children:o.badge})})]})}),Mne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:e,children:r})}),One=C.forwardRef((t,e)=>{const{className:n,...r}=t;return Se(r),y.jsx("div",{className:ue(n,"animate-spin"),ref:e,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:y.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),Dne=C.forwardRef((t,e)=>{const{className:n,children:r,onMouseDown:o,onClick:i,...s}=t;Se(s,!1);const a=Ke();return y.jsx(a.Button.Button,{variant:"ghost",className:ue(n,"h-full w-full p-0 text-gray-400",n!=null&&n.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n!=null&&n.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:e,onClick:i,onMouseDown:o,...s,children:r})}),Lne=C.forwardRef((t,e)=>{const{className:n,children:r,draggable:o,onDragStart:i,onDragEnd:s,style:a,label:l,...c}=t;Se(c,!1);const u=Ke();return y.jsx(u.Button.Button,{variant:"ghost",className:ue(n,"h-fit w-fit p-0 text-gray-400"),ref:e,"aria-label":l,draggable:o,onDragStart:i,onDragEnd:s,style:a,...c,children:r})}),np=C.forwardRef((t,e)=>{const{className:n,children:r,onMouseEnter:o,onMouseLeave:i,variant:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Tooltip.TooltipProvider,{delayDuration:0,children:y.jsx("div",{className:ue(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:e,onMouseEnter:o,onMouseLeave:i,children:r})})}),rp=C.forwardRef((t,e)=>{const{className:n,children:r,mainTooltip:o,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:d,...f}=t;Se(f,!1);const h=Ke(),p=a===void 0?y.jsxs(h.Button.Button,{className:ue(n,d==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:d==="compact"?"sm":"default",disabled:l,onClick:c,ref:e,"aria-label":u,...f,children:[s,r]}):y.jsxs(h.Toggle.Toggle,{className:ue(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",d==="compact"?"h-6 min-w-6 p-0":""),size:d==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:e,...f,children:[s,r]});return y.jsxs(h.Tooltip.Tooltip,{children:[y.jsx(h.Tooltip.TooltipTrigger,{asChild:!0,children:p}),y.jsxs(h.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[y.jsx("span",{children:o}),i&&y.jsx("span",{children:i})]})]})}),op=C.forwardRef((t,e)=>{const{className:n,items:r,isDisabled:o,...i}=t;Se(i);const s=Ke(),a=c=>y.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?y.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>{var u,d;return(d=(u=r.find(f=>f.text===c)).onClick)==null?void 0:d.call(u)},disabled:o,children:[y.jsx(s.Select.SelectTrigger,{className:"border-none",children:y.jsx(s.Select.SelectValue,{})}),y.jsx(s.Select.SelectContent,{className:n,ref:e,children:r.map(c=>y.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:y.jsx(a,{...c})},c.text))})]}):null}),Rne=C.forwardRef((t,e)=>{const{className:n,children:r,selected:o,headerText:i,onFocus:s,onBlur:a,tabIndex:l,...c}=t;Se(c);const u=Ke();return y.jsxs(u.Card.Card,{className:ue(n,"w-[300px]",o?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:e,children:[i&&y.jsx("div",{className:"px-4 pt-4 text-sm italic",children:i}),r]})}),Pne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue(n,"p-4",n!=null&&n.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:e,children:r})}),Bne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o,!1);const i=Ke();return y.jsx(i.Button.Button,{className:ue(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:e,children:r})}),Fne=C.forwardRef((t,e)=>{const{authorInfo:n,timeString:r,edited:o,...i}=t,s=ve();Se(i,!1);const a=Ke();return n==="loading"?y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[y.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),y.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[y.jsxs(a.Avatar.Avatar,{children:[y.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),y.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[y.jsx("span",{className:"text-sm font-bold",children:n.username}),y.jsxs("span",{className:"text-xs",children:[r," ",o&&`(${s.comments.edited})`]})]})]})}),Hne=C.forwardRef((t,e)=>{const{className:n,showActions:r,authorInfo:o,timeString:i,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=t;Se(u);const[d,f]=C.useState(!1),{focused:h,ref:p}=QJ(),g=s&&(r===!0||r===void 0||r==="hover"&&d||h);return y.jsxs("div",{ref:e,className:ue(n,"relative flex flex-col gap-2"),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[g?y.jsx("div",{className:"absolute right-0 top-0 z-10",ref:p,children:s}):null,y.jsx(Fne,{...t}),c]})}),Une=C.forwardRef((t,e)=>{const{className:n,onFocus:r,onBlur:o,autoFocus:i,editor:s,editable:a,...l}=t;Se(l);const c=zr();return y.jsx(n3,{autoFocus:i,className:ue(n,""),theme:c?.colorSchemePreference,editor:t.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:e,onFocus:r,onBlur:o,children:y.jsx(e1,{formattingToolbar:Vne})})}),Vne=()=>{const t=Z0([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton");return y.jsx(J0,{blockTypeSelectItems:[],children:t})},$ne=C.forwardRef((t,e)=>{const{className:n,text:r,icon:o,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=t;Se(u,!1);const d=Ke(),f=y.jsxs(d.Button.Button,{variant:i?"secondary":"outline",className:ue(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:e,children:[y.jsx("span",{children:o}),y.jsx("span",{children:r})]});return s?y.jsxs(d.Tooltip.Tooltip,{children:[y.jsx(d.Tooltip.TooltipTrigger,{asChild:!0,children:f}),y.jsxs(d.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[y.jsx("span",{children:s}),a&&y.jsx("span",{children:a})]})]}):f}),jne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o);const i=Ke();return y.jsx(i.Tooltip.TooltipProvider,{delayDuration:0,children:y.jsx("div",{className:ue(n,"flex w-full flex-row flex-wrap gap-1"),ref:e,children:r})})}),zne=C.forwardRef((t,e)=>{const{className:n,children:r,onClick:o,label:i,...s}=t;Se(s);const a=Ke();return y.jsx(a.Button.Button,{type:"submit",className:n,"aria-label":i,ref:e,onClick:o,children:r})}),qne=C.forwardRef((t,e)=>{const{className:n,accept:r,value:o,placeholder:i,onChange:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Input.Input,{type:"file",className:n,ref:e,accept:r,value:o?o.name:void 0,onChange:async c=>s?.(c.target.files[0]),placeholder:i})}),Wne=C.forwardRef((t,e)=>{const{className:n,isSelected:r,onClick:o,item:i,id:s,...a}=t;Se(a);const l=C.useRef(null);return C.useEffect(()=>{if(!l.current||!r)return;const c=A_(l.current,document.querySelector(".bn-grid-suggestion-menu"));c==="top"?l.current.scrollIntoView(!0):c==="bottom"&&l.current.scrollIntoView(!1)},[r]),y.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:__([e,l]),id:s,role:"option",onClick:o,"aria-selected":r||void 0,children:i.icon})}),Gne=C.forwardRef((t,e)=>{const{className:n,children:r,columns:o,...i}=t;return Se(i),y.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:e,children:r})}),Yne={FormattingToolbar:{Root:np,Button:rp,Select:op},FilePanel:{Root:yne,Button:zne,FileInput:qne,TabPanel:Ene,TextInput:xne},LinkToolbar:{Root:np,Button:rp,Select:op},SideMenu:{Root:wne,Button:Sne},SuggestionMenu:{Root:_ne,Item:Ine,EmptyItem:Nne,Label:Mne,Loader:One},GridSuggestionMenu:{Root:vne,Item:Wne,EmptyItem:Ane,Loader:Gne},TableHandle:{Root:Lne,ExtendButton:Dne},Comments:{Comment:Hne,Editor:Une,Card:Rne,CardSection:Pne,ExpandSectionsPrompt:Bne},Generic:{Badge:{Root:$ne,Group:jne},Toolbar:{Root:np,Button:rp,Select:op},Form:{Root:lne,TextInput:cne},Menu:{Root:dne,Trigger:fne,Dropdown:hne,Divider:mne,Label:gne,Item:pne,Button:bne},Popover:{Root:Cne,Trigger:kne,Content:Tne}}},n3=t=>{const{className:e,shadCNComponents:n,...r}=t,o=C.useMemo(()=>({...ane,...n}),[n]);return y.jsx(t3.Provider,{value:o,children:y.jsx(ZA.Provider,{value:Yne,children:y.jsx(DJ,{className:ut("bn-shadcn",e||""),...r})})})};function mC({open:t,onClose:e,onSave:n,initial:r,hideCaption:o}){const[i,s]=C.useState(r?.url??""),[a,l]=C.useState(r?.mediaId??""),[c,u]=C.useState(r?.alt??""),[d,f]=C.useState(r?.caption??""),[h,p]=C.useState(r?.filename??""),[g,b]=C.useState(r?.width??0),[E,x]=C.useState(r?.height??0),[T,D]=C.useState(r?.thumbUrl??""),[O,v]=C.useState(!1),[R,j]=C.useState(!1),z=!!a,I=i?z&&T?sp(T):sp(i):"";function X(q){if(s(q.url),l(q.mediaId),p(q.filename),b(q.width??0),x(q.height??0),D(q.urls?.thumb_md??""),j(!1),!c.trim()){const oe=q.filename.replace(/\.[\w]+$/,"").replace(/[._-]+/g," ");u(oe)}v(!1)}function F(){s(""),l(""),p(""),b(0),x(0),D(""),j(!1)}function W(q){s(q),l(""),p(""),b(0),x(0),D(""),j(!1)}function B(){n({url:i,mediaId:a,alt:c,caption:d,filename:h,width:g,height:E})}return y.jsxs(y.Fragment,{children:[y.jsx(EC,{open:t,onOpenChange:()=>e(),children:y.jsxs(xC,{children:[y.jsxs(CC,{children:[y.jsx(kC,{children:r?"Edit Image":"Insert Image"}),y.jsx(TC,{className:"sr-only",children:"Set the image URL, alt text, and caption."})]}),y.jsxs("div",{className:"space-y-4",children:[i&&!R?y.jsx("div",{className:"flex justify-center",children:y.jsx("img",{src:I,alt:c||"Preview",className:"max-h-48 rounded-md object-contain",onError:()=>j(!0)})}):i&&R?y.jsx("div",{className:"flex justify-center",children:y.jsx("div",{className:"flex h-32 w-32 items-center justify-center rounded-md bg-muted",children:y.jsx(wC,{className:"h-8 w-8 text-muted-foreground","data-testid":"fallback-icon"})})}):null,y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{children:"Image"}),y.jsxs("div",{className:"flex gap-2",children:[z?y.jsxs(a3,{variant:"secondary",className:"flex max-w-full items-center gap-1.5 px-3 py-1.5 text-sm",children:[y.jsx(l3,{className:"h-3.5 w-3.5 shrink-0"}),y.jsx("span",{className:"truncate",children:h}),y.jsx("button",{type:"button",onClick:F,className:"ml-1 shrink-0 rounded-full p-0.5 hover:bg-muted","aria-label":"Clear media",children:y.jsx(c3,{className:"h-3 w-3"})})]}):y.jsx(vf,{placeholder:"https://example.com/image.jpg",value:i,onChange:q=>W(q.target.value)}),y.jsx(Sa,{type:"button",variant:"outline",onClick:()=>v(!0),children:"Select Media"})]})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{htmlFor:"image-alt",children:"Alt Text"}),y.jsx(vf,{id:"image-alt",value:c,onChange:q=>u(q.target.value),placeholder:"Describe the image"})]}),!o&&y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{htmlFor:"image-caption",children:"Caption (optional)"}),y.jsx(vf,{id:"image-caption",value:d,onChange:q=>f(q.target.value),placeholder:"Photo credit or description"})]})]}),y.jsxs(SC,{children:[y.jsx(Sa,{variant:"outline",onClick:e,children:"Cancel"}),y.jsx(Sa,{onClick:B,disabled:!i.trim(),children:"Save"})]})]})}),O&&y.jsx(rN,{open:O,onClose:()=>v(!1),onSelect:q=>X(q),allowedTypes:["image/*"]})]})}const Kne=S_({type:"image",propSchema:{mediaId:{default:""},url:{default:""},alt:{default:""},caption:{default:""},filename:{default:""},width:{default:0},height:{default:0}},content:"none"},{render:({block:t,editor:e})=>y.jsx(Qne,{block:t,editor:e})});function Qne({block:t,editor:e}){const n=!!t.props.url,[r,o]=C.useState(!n&&e.isEditable),i=n?sp(t.props.url):"";function s(a){e.updateBlock(t,{props:{url:a.url,mediaId:a.mediaId,alt:a.alt,caption:a.caption,filename:a.filename,width:a.width,height:a.height}}),o(!1)}return n?y.jsxs(y.Fragment,{children:[y.jsxs("figure",{className:`group my-2${e.isEditable?" cursor-pointer rounded-lg ring-primary hover:ring-2":""}`,onClick:()=>e.isEditable&&o(!0),children:[y.jsxs("div",{className:"relative inline-block",children:[y.jsx("img",{src:i,alt:t.props.alt,className:"max-w-full rounded-lg"}),e.isEditable&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-black/0 opacity-0 transition-opacity group-hover:bg-black/20 group-hover:opacity-100",children:y.jsx(vC,{className:"h-6 w-6 text-white drop-shadow"})})]}),t.props.caption&&y.jsx("figcaption",{className:"mt-1 text-sm text-muted-foreground",children:t.props.caption})]}),r&&y.jsx(mC,{open:r,onClose:()=>o(!1),onSave:s,initial:{url:t.props.url,mediaId:t.props.mediaId,alt:t.props.alt,caption:t.props.caption,filename:t.props.filename,width:t.props.width,height:t.props.height}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex cursor-pointer flex-col items-center rounded-lg border-2 border-dashed p-8 text-center",onClick:()=>e.isEditable&&o(!0),children:[y.jsx(wC,{className:"mx-auto h-8 w-8 text-muted-foreground"}),y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Click to select an image"})]}),r&&y.jsx(mC,{open:r,onClose:()=>o(!1),onSave:s})]})}function Xne({blockType:t,props:e,onSave:n}){const[r,o]=C.useState(!1),[i,s]=C.useState({});function a(){s({...e}),o(!0)}function l(){n(i),o(!1)}return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"cursor-pointer",onClick:a,children:[y.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[y.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.icon&&y.jsxs(y.Fragment,{children:[t.icon," "]}),t.label]}),y.jsx(vC,{className:"h-3 w-3 text-muted-foreground"})]}),y.jsx(sN,{blockType:t,props:e})]}),y.jsx(EC,{open:r,onOpenChange:o,children:y.jsxs(xC,{className:"max-w-lg",children:[y.jsxs(CC,{children:[y.jsxs(kC,{children:["Edit ",t.label]}),y.jsx(TC,{className:"sr-only",children:"Edit block properties"})]}),y.jsx(oN,{fields:t.fields??[],values:i,onChange:s}),y.jsxs(SC,{children:[y.jsx(Sa,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),y.jsx(Sa,{onClick:l,children:"Save"})]})]})})]})}function Zne(t){const e={};for(const n of t??[])switch(n.type){case"boolean":e[n.name]={default:!1};break;case"number":e[n.name]={default:0};break;default:e[n.name]={default:""}}return e}function Jne(t){const{image:e,...n}=U2,r={...n,image:Kne()};for(const o of t){const i=Zne(o.fields??[]),s=S_({type:o.name,propSchema:i,content:"none"},{render:({block:a,editor:l})=>{const c=a;return y.jsx(Xne,{blockType:o,props:c.props,onSave:u=>{l.updateBlock(a,{props:u})}})}});r[o.name]=s()}return P0.create({blockSpecs:r})}function ere(t){const e=C.useMemo(()=>Jne(t),[t]),n=C.useMemo(()=>t.map(r=>r.name).sort().join(","),[t]);return{schema:e,schemaKey:n}}const d1="headroom://content/";function tre(t){return t.startsWith(d1)}function nre(t){if(!tre(t))return null;const e=t.slice(d1.length),n=e.indexOf("/");if(n===-1)return null;const r=e.slice(0,n),o=e.slice(n+1);return!r||!/^[0-9A-Z]{26}$/.test(o)?null:{collection:r,contentId:o}}function rre(t,e){return`${d1}${t}/${e}`}function ore(){const t=ge(),e=fe(),{host:n}=yC(),{showSelection:r}=Re(ml),[o,i]=C.useState(!1);if(C.useEffect(()=>{r(o)},[o,r]),!e||!n)return null;function s(a){const l=rre(a.collection,a.contentId);t.createLink(l,a.title),i(!1)}return y.jsx(iN,{host:n,selectedIds:[],open:o,onOpenChange:i,onSelect:s,trigger:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"contentLink",label:"Link to Content",icon:y.jsx(u3,{size:18}),onClick:()=>i(!0)})})}function Yre({initialBlocks:t,onChange:e,blockTypes:n,compact:r}){const{schema:o,schemaKey:i}=ere(n);return y.jsx(ire,{schema:o,initialBlocks:t,onChange:e,blockTypes:n,compact:r},i)}function ire({schema:t,initialBlocks:e,onChange:n,blockTypes:r,compact:o}){const i=xf({schema:t,initialContent:e&&e.length>0?e:void 0});C.useMemo(()=>{let a=!1;i.onChange(()=>{if(!a){a=!0;return}n(i.document)})},[i]);const s=C.useMemo(()=>{const a=k_(i),l=r.map(c=>({title:c.label,subtext:`Insert ${c.label} block`,onItemClick:()=>{const u=i.getTextCursorPosition().block;i.insertBlocks([{type:c.name}],u,"after")},aliases:[c.name],group:"Custom Blocks"}));return[...a,...l]},[i,r]);return y.jsx("div",{className:o?"[&_.bn-editor]:min-h-[120px]":"[&_.bn-editor]:min-h-[300px]",children:y.jsxs(n3,{editor:i,slashMenu:!1,filePanel:!1,formattingToolbar:!1,linkToolbar:!1,theme:"light",children:[y.jsx(T_,{triggerCharacter:"/",getItems:async a=>s.filter(l=>l.title.toLowerCase().includes(a.toLowerCase()))}),y.jsx(e1,{formattingToolbar:sre}),y.jsx(y_,{linkToolbar:are})]})})}function sre(t){return y.jsxs(J0,{...t,children:[Z0(t.blockTypeSelectItems),y.jsx(ore,{})]})}function are(t){const{host:e}=yC(),n=o3(),r=fe(),o=nre(t.url);return!o||!r?y.jsx(b_,{...t}):y.jsxs(r.Generic.Toolbar.Root,{className:"bn-toolbar bn-link-toolbar",variant:"action-toolbar",children:[y.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:`Content link · ${o.collection}`,mainTooltip:`Content link · ${o.collection}`,isDisabled:!0,onClick:()=>{}}),y.jsx(g_,{url:t.url,text:t.text,range:t.range,setToolbarFrozen:t.setToolbarFrozen,setToolbarOpen:t.setToolbarOpen}),y.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:"Open",mainTooltip:"Open in editor",onClick:()=>{n(`/sites/${e}/content/${o.contentId}`)}}),y.jsx(m_,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})}export{Yre as default};
179
+ `)}`},o.emoji)},{textColor:Kre,backgroundColor:Qre,...UJ}=l0,r1=P0.create({blockSpecs:{paragraph:F2()},styleSpecs:UJ}),VJ=({comment:t,thread:e,showResolveButton:n})=>{const r=Re(nr),o=ve(),i=xf({initialContent:t.body,trailingBlock:!1,dictionary:{...o,placeholders:{emptyDocument:o.placeholders.edit_comment}},schema:r.commentEditorSchema||r1}),s=fe(),[a,l]=C.useState(!1),[c,u]=C.useState(!1),d=r.threadStore,f=C.useCallback(()=>{l(!0)},[]),h=C.useCallback(()=>{i.replaceBlocks(i.document,t.body),l(!1)},[i,t.body]),p=C.useCallback(async I=>{await d.updateComment({commentId:t.id,comment:{body:i.document},threadId:e.id}),l(!1)},[t,e.id,i,d]),g=C.useCallback(async()=>{await d.deleteComment({commentId:t.id,threadId:e.id})},[t,e.id,d]),b=C.useCallback(async I=>{d.auth.canAddReaction(t,I)?await d.addReaction({threadId:e.id,commentId:t.id,emoji:I}):d.auth.canDeleteReaction(t,I)&&await d.deleteReaction({threadId:e.id,commentId:t.id,emoji:I})},[d,t,e.id]),E=C.useCallback(async()=>{await d.resolveThread({threadId:e.id})},[e.id,d]),x=C.useCallback(async()=>{await d.unresolveThread({threadId:e.id})},[e.id,d]),T=FJ(t.userId);if(!t.body)return null;let D;const O=d.auth.canAddReaction(t),v=d.auth.canDeleteComment(t),R=d.auth.canUpdateComment(t),j=n&&(e.resolved?d.auth.canUnresolveThread(e):d.auth.canResolveThread(e));a||(D=y.jsxs(s.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[O&&y.jsx(Zx,{onEmojiSelect:I=>b(I.native),onOpenChange:u,children:y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.add_reaction,variant:"compact",children:y.jsx(Wx,{size:16})},"add-reaction")}),j&&(e.resolved?y.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:x,children:y.jsx(HX,{size:16})},"reopen"):y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.resolve,variant:"compact",onClick:E,children:y.jsx(uZ,{size:16})},"resolve")),(v||R)&&y.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[y.jsx(s.Generic.Menu.Trigger,{children:y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.more_actions,variant:"compact",children:y.jsx(mZ,{size:16})},"more-actions")}),y.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[R&&y.jsx(s.Generic.Menu.Item,{icon:y.jsx(UX,{}),onClick:f,children:o.comments.actions.edit_comment},"edit-comment"),v&&y.jsx(s.Generic.Menu.Item,{icon:y.jsx(fZ,{}),onClick:g,children:o.comments.actions.delete_comment},"delete-comment")]})]})]}));const z=t.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!t.body)throw new Error("soft deletes are not yet supported");return y.jsx(s.Comments.Comment,{authorInfo:T??"loading",timeString:z,edited:t.updatedAt.getTime()!==t.createdAt.getTime(),showActions:"hover",actions:D,className:"bn-thread-comment",emojiPickerOpen:c,children:y.jsx(t1,{autoFocus:a,editor:i,editable:a,actions:t.reactions.length>0||a?({isEmpty:I})=>y.jsxs(y.Fragment,{children:[t.reactions.length>0&&!a&&y.jsxs(s.Generic.Badge.Group,{className:ut("bn-badge-group","bn-comment-reactions"),children:[t.reactions.map(X=>y.jsx(HJ,{comment:t,emoji:X.emoji,onReactionSelect:b},X.emoji)),O&&y.jsx(Zx,{onEmojiSelect:X=>b(X.native),onOpenChange:u,children:y.jsx(s.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-add-reaction"),text:"+",icon:y.jsx(Wx,{size:16}),mainTooltip:o.comments.actions.add_reaction})})]}),a&&y.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:[y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.save_button_text,variant:"compact",onClick:p,isDisabled:I,children:o.comments.save_button_text}),y.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:o.comments.cancel_button_text,variant:"compact",onClick:h,children:o.comments.cancel_button_text})]})]}):void 0})})},$J=({thread:t,maxCommentsBeforeCollapse:e})=>{const n=fe(),r=ve(),o=n1(t.resolvedBy?[t.resolvedBy]:[]),i=t.comments.map((s,a)=>y.jsx(VJ,{thread:t,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(t.resolved&&t.resolvedUpdatedAt&&t.resolvedBy){if(!o.get(t.resolvedBy))throw new Error(`User ${t.resolvedBy} resolved thread ${t.id}, but their data could not be found.`);const s=t.comments.findLastIndex(a=>t.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,y.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:t.resolvedBy&&o.get(t.resolvedBy)||"loading",timeString:t.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:y.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return e&&i.length>e&&i.splice(1,i.length-2,y.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(t.comments.length-2)},"expand-prompt")),i};function jJ(){const t=Re(nr),e=fe(),n=ve(),r=xf({trailingBlock:!1,dictionary:{...n,placeholders:{emptyDocument:n.placeholders.new_comment}},schema:t.commentEditorSchema||r1});return y.jsx(e.Comments.Card,{className:"bn-thread",children:y.jsx(t1,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:o})=>y.jsx(e.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:y.jsx(e.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:o,onClick:async()=>{await t.createThread({initialComment:{body:r.document}}),t.stopPendingComment()},children:"Save"})})})})}function zJ(t){const[e,n]=C.useState(!1),r=ge(),o=Re(nr),i=et(nr,{editor:r,selector:c=>c.pendingComment});C.useEffect(()=>{n(i)},[i]);const s=Ot({editor:r,selector:({editor:c})=>i?{from:c.prosemirrorState.selection.from,to:c.prosemirrorState.selection.to}:void 0}),a=C.useMemo(()=>({useFloatingOptions:{open:e,onOpenChange:c=>{c||(o.stopPendingComment(),r.focus()),n(c)},placement:"bottom",middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:60}},...t.floatingUIOptions}),[o,r,e,t.floatingUIOptions]),l=t.floatingComposer||jJ;return y.jsx(Q0,{position:s,...a,children:y.jsx(l,{})})}const qJ=Object.freeze(Object.defineProperty({__proto__:null,default:zJ},Symbol.toStringTag,{value:"Module"})),v_=({thread:t,selected:e,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:o,onBlur:i,tabIndex:s})=>{const a=fe(),l=ve(),c=Re(nr),u=xf({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||r1}),d=C.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:t.id}),u.removeBlocks(u.document)},[c,u,t.id]);return y.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:o,onBlur:i,selected:e,tabIndex:s,children:[y.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:y.jsx($J,{thread:t,maxCommentsBeforeCollapse:e?void 0:r||5})}),e&&y.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:y.jsx(t1,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:f})=>f?null:y.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:y.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:f,onClick:d,children:l.comments.save_button_text})})})})]})};function WJ(){const t=Re(nr).threadStore,e=C.useRef(void 0);e.current||(e.current=t.getThreads());const n=C.useCallback(r=>t.subscribe(o=>{e.current=o,r()}),[t]);return C.useSyncExternalStore(n,()=>e.current)}function GJ(t){const e=ge(),[n,r]=C.useState(!1),o=Re(nr),i=et(nr,{editor:e,selector:u=>u.selectedThreadId?{id:u.selectedThreadId,position:u.threadPositions.get(u.selectedThreadId)}:void 0});C.useEffect(()=>{r(!!i)},[i]);const s=WJ(),a=C.useMemo(()=>i?s.get(i.id):void 0,[i,s]),l=C.useMemo(()=>({useFloatingOptions:{open:n,onOpenChange:(u,d,f)=>{f==="escape-key"&&e.focus(),u||o.selectThread(void 0),r(u)},placement:"bottom",middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:30}},...t.floatingUIOptions}),[o,e,n,t.floatingUIOptions]),c=t.floatingThread||v_;return y.jsx(Q0,{position:i?.position,...l,children:a&&y.jsx(c,{thread:a,selected:!0})})}const YJ=Object.freeze(Object.defineProperty({__proto__:null,default:GJ},Symbol.toStringTag,{value:"Module"}));Ie.memo(({thread:t,selectedThreadId:e,maxCommentsBeforeCollapse:n,referenceText:r})=>{const o=Re(nr),i=C.useCallback(a=>{a.target.closest(".bn-action-toolbar")||o.selectThread(t.id)},[o,t.id]),s=C.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;const l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&o.selectThread(void 0)},[o]);return y.jsx(v_,{thread:t,selected:t.id===e,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:i,onBlur:s,tabIndex:0})});function KJ(t){return t.currentTarget instanceof HTMLElement&&t.relatedTarget instanceof HTMLElement?t.currentTarget.contains(t.relatedTarget):!1}function QJ({onBlur:t,onFocus:e}={}){const n=C.useRef(null),[r,o]=C.useState(!1),i=C.useRef(!1),s=c=>{o(c),i.current=c},a=c=>{i.current||(s(!0),e?.(c))},l=c=>{i.current&&!KJ(c)&&(s(!1),t?.(c))};return C.useEffect(()=>{const c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function A_(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=n.top<r.top,i=n.bottom>r.bottom;return o&&i?"both":o?"top":i?"bottom":"none"}function __(t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var Yl=t=>t.type==="checkbox",hi=t=>t instanceof Date,yn=t=>t==null;const N_=t=>typeof t=="object";var At=t=>!yn(t)&&!Array.isArray(t)&&N_(t)&&!hi(t),XJ=t=>At(t)&&t.target?Yl(t.target)?t.target.checked:t.target.value:t,ZJ=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,JJ=(t,e)=>t.has(ZJ(e)),eee=t=>{const e=t.constructor&&t.constructor.prototype;return At(e)&&e.hasOwnProperty("isPrototypeOf")},o1=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Mt(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(o1&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(At(t)&&eee(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Mt(t[o]));return r}var Cf=t=>/^\w*$/.test(t),ht=t=>t===void 0,i1=t=>Array.isArray(t)?t.filter(Boolean):[],s1=t=>i1(t.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(t,e,n)=>{if(!e||!At(t))return n;const r=(Cf(e)?[e]:s1(e)).reduce((o,i)=>yn(o)?o:o[i],t);return ht(r)||r===t?ht(t[e])?n:t[e]:r},Nr=t=>typeof t=="boolean",lr=t=>typeof t=="function",ct=(t,e,n)=>{let r=-1;const o=Cf(e)?[e]:s1(e),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let l=n;if(r!==s){const c=t[a];l=At(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;t[a]=l,t=t[a]}};const Jx={BLUR:"blur",FOCUS_OUT:"focusout"},cr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Jr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},I_=Ie.createContext(null);I_.displayName="HookFormControlContext";var tee=(t,e,n,r=!0)=>{const o={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(o,i,{get:()=>{const s=i;return e._proxyFormState[s]!==cr.all&&(e._proxyFormState[s]=!r||cr.all),t[s]}});return o};const nee=typeof window<"u"?Ie.useLayoutEffect:Ie.useEffect;var Rn=t=>typeof t=="string",ree=(t,e,n,r,o)=>Rn(t)?(r&&e.watch.add(t),ce(n,t,o)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),ce(n,i))):(r&&(e.watchAll=!0),n),Fm=t=>yn(t)||!N_(t);function Io(t,e,n=new WeakSet){if(Fm(t)||Fm(e))return Object.is(t,e);if(hi(t)&&hi(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const i of r){const s=t[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=e[i];if(hi(s)&&hi(a)||At(s)&&At(a)||Array.isArray(s)&&Array.isArray(a)?!Io(s,a,n):!Object.is(s,a))return!1}}return!0}const M_=Ie.createContext(null);M_.displayName="HookFormContext";const oee=t=>{const{children:e,watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:b,subscribe:E}=t;return Ie.createElement(M_.Provider,{value:Ie.useMemo(()=>({watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:b,subscribe:E}),[s,p,c,o,r,f,g,d,u,i,b,a,E,l,h,n])},Ie.createElement(I_.Provider,{value:p},e))};var iee=(t,e,n,r,o)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:o||!0}}:{},Ga=t=>Array.isArray(t)?t:[t],eC=()=>{let t=[];return{get observers(){return t},next:o=>{for(const i of t)i.next&&i.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(i=>i!==o)}}),unsubscribe:()=>{t=[]}}};function O_(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=e[r];if(o&&At(o)&&i){const s=O_(o,i);At(s)&&(n[r]=s)}else t[r]&&(n[r]=i)}return n}var on=t=>At(t)&&!Object.keys(t).length,a1=t=>t.type==="file",xd=t=>{if(!o1)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},D_=t=>t.type==="select-multiple",l1=t=>t.type==="radio",see=t=>l1(t)||Yl(t),ep=t=>xd(t)&&t.isConnected;function aee(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=ht(t)?r++:t[e[r++]];return t}function lee(t){for(const e in t)if(t.hasOwnProperty(e)&&!ht(t[e]))return!1;return!0}function Tt(t,e){const n=Array.isArray(e)?e:Cf(e)?[e]:s1(e),r=n.length===1?t:aee(t,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(At(r)&&on(r)||Array.isArray(r)&&lee(r))&&Tt(t,n.slice(0,-1)),t}var cee=t=>{for(const e in t)if(lr(t[e]))return!0;return!1};function L_(t){return Array.isArray(t)||At(t)&&!cee(t)}function Hm(t,e={}){for(const n in t){const r=t[n];L_(r)?(e[n]=Array.isArray(r)?[]:{},Hm(r,e[n])):ht(r)||(e[n]=!0)}return e}function as(t,e,n){n||(n=Hm(e));for(const r in t){const o=t[r];if(L_(o))ht(e)||Fm(n[r])?n[r]=Hm(o,Array.isArray(o)?[]:{}):as(o,yn(e)?{}:e[r],n[r]);else{const i=e[r];n[r]=!Io(o,i)}}return n}const tC={value:!1,isValid:!1},nC={value:!0,isValid:!0};var R_=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ht(t[0].attributes.value)?ht(t[0].value)||t[0].value===""?nC:{value:t[0].value,isValid:!0}:nC:tC}return tC},P_=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ht(t)?t:e?t===""?NaN:t&&+t:n&&Rn(t)?new Date(t):r?r(t):t;const rC={isValid:!1,value:null};var B_=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,rC):rC;function oC(t){const e=t.ref;return a1(e)?e.files:l1(e)?B_(t.refs).value:D_(e)?[...e.selectedOptions].map(({value:n})=>n):Yl(e)?R_(t.refs).value:P_(ht(e.value)?t.ref.value:e.value,t)}var uee=(t,e,n,r)=>{const o={};for(const i of t){const s=ce(e,i);s&&ct(o,i,s._f)}return{criteriaMode:n,names:[...t],fields:o,shouldUseNativeValidation:r}},Cd=t=>t instanceof RegExp,ma=t=>ht(t)?t:Cd(t)?t.source:At(t)?Cd(t.value)?t.value.source:t.value:t,iC=t=>({isOnSubmit:!t||t===cr.onSubmit,isOnBlur:t===cr.onBlur,isOnChange:t===cr.onChange,isOnAll:t===cr.all,isOnTouch:t===cr.onTouched});const sC="AsyncFunction";var dee=t=>!!t&&!!t.validate&&!!(lr(t.validate)&&t.validate.constructor.name===sC||At(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===sC)),fee=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),aC=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Ya=(t,e,n,r)=>{for(const o of n||Object.keys(t)){const i=ce(t,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],o)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(Ya(a,e))break}else if(At(a)&&Ya(a,e))break}}};function lC(t,e,n){const r=ce(t,n);if(r||Cf(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ce(e,i),a=ce(t,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var hee=(t,e,n,r)=>{n(t);const{name:o,...i}=t;return on(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(s=>e[s]===(!r||cr.all))},pee=(t,e,n)=>!t||!e||t===e||Ga(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),mee=(t,e,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(e||t):(n?r.isOnBlur:o.isOnBlur)?!t:(n?r.isOnChange:o.isOnChange)?t:!0,gee=(t,e)=>!i1(ce(t,e)).length&&Tt(t,e),bee=(t,e,n)=>{const r=Ga(ce(t,n));return ct(r,"root",e[n]),ct(t,n,r),t};function cC(t,e,n="validate"){if(Rn(t)||Array.isArray(t)&&t.every(Rn)||Nr(t)&&!t)return{type:n,message:Rn(t)?t:"",ref:e}}var es=t=>At(t)&&!Cd(t)?t:{value:t,message:""},uC=async(t,e,n,r,o,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:b,mount:E}=t._f,x=ce(n,g);if(!E||e.has(g))return{};const T=a?a[0]:s,D=F=>{o&&T.reportValidity&&(T.setCustomValidity(Nr(F)?"":F||""),T.reportValidity())},O={},v=l1(s),R=Yl(s),j=v||R,z=(b||a1(s))&&ht(s.value)&&ht(x)||xd(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,I=iee.bind(null,g,r,O),X=(F,W,B,q=Jr.maxLength,oe=Jr.minLength)=>{const Z=F?W:B;O[g]={type:F?q:oe,message:Z,ref:s,...I(F?q:oe,Z)}};if(i?!Array.isArray(x)||!x.length:l&&(!j&&(z||yn(x))||Nr(x)&&!x||R&&!R_(a).isValid||v&&!B_(a).isValid)){const{value:F,message:W}=Rn(l)?{value:!!l,message:l}:es(l);if(F&&(O[g]={type:Jr.required,message:W,ref:T,...I(Jr.required,W)},!r))return D(W),O}if(!z&&(!yn(d)||!yn(f))){let F,W;const B=es(f),q=es(d);if(!yn(x)&&!isNaN(x)){const oe=s.valueAsNumber||x&&+x;yn(B.value)||(F=oe>B.value),yn(q.value)||(W=oe<q.value)}else{const oe=s.valueAsDate||new Date(x),Z=S=>new Date(new Date().toDateString()+" "+S),ee=s.type=="time",ie=s.type=="week";Rn(B.value)&&x&&(F=ee?Z(x)>Z(B.value):ie?x>B.value:oe>new Date(B.value)),Rn(q.value)&&x&&(W=ee?Z(x)<Z(q.value):ie?x<q.value:oe<new Date(q.value))}if((F||W)&&(X(!!F,B.message,q.message,Jr.max,Jr.min),!r))return D(O[g].message),O}if((c||u)&&!z&&(Rn(x)||i&&Array.isArray(x))){const F=es(c),W=es(u),B=!yn(F.value)&&x.length>+F.value,q=!yn(W.value)&&x.length<+W.value;if((B||q)&&(X(B,F.message,W.message),!r))return D(O[g].message),O}if(h&&!z&&Rn(x)){const{value:F,message:W}=es(h);if(Cd(F)&&!x.match(F)&&(O[g]={type:Jr.pattern,message:W,ref:s,...I(Jr.pattern,W)},!r))return D(W),O}if(p){if(lr(p)){const F=await p(x,n),W=cC(F,T);if(W&&(O[g]={...W,...I(Jr.validate,W.message)},!r))return D(W.message),O}else if(At(p)){let F={};for(const W in p){if(!on(F)&&!r)break;const B=cC(await p[W](x,n),T,W);B&&(F={...B,...I(W,B.message)},D(B.message),r&&(O[g]=F))}if(!on(F)&&(O[g]={ref:T,...F},!r))return O}}return D(!0),O};const yee={mode:cr.onSubmit,reValidateMode:cr.onChange,shouldFocusError:!0};function Eee(t={}){let e={...yee,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:lr(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},o=At(e.defaultValues)||At(e.values)?Mt(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:Mt(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:eC(),state:eC()},p=e.criteriaMode===cr.all,g=N=>P=>{clearTimeout(c),c=setTimeout(N,P)},b=async N=>{if(!s.keepIsValid&&!e.disabled&&(d.isValid||f.isValid||N)){let P;e.resolver?(P=on((await j()).errors),E()):P=await I(r,!0),P!==n.isValid&&h.state.next({isValid:P})}},E=(N,P)=>{!e.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((N||Array.from(a.mount)).forEach($=>{$&&(P?ct(n.validatingFields,$,P):Tt(n.validatingFields,$))}),h.state.next({validatingFields:n.validatingFields,isValidating:!on(n.validatingFields)}))},x=(N,P=[],$,re,te=!0,M=!0)=>{if(re&&$&&!e.disabled){if(s.action=!0,M&&Array.isArray(ce(r,N))){const H=$(ce(r,N),re.argA,re.argB);te&&ct(r,N,H)}if(M&&Array.isArray(ce(n.errors,N))){const H=$(ce(n.errors,N),re.argA,re.argB);te&&ct(n.errors,N,H),gee(n.errors,N)}if((d.touchedFields||f.touchedFields)&&M&&Array.isArray(ce(n.touchedFields,N))){const H=$(ce(n.touchedFields,N),re.argA,re.argB);te&&ct(n.touchedFields,N,H)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=as(o,i)),h.state.next({name:N,isDirty:F(N,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ct(i,N,P)},T=(N,P)=>{ct(n.errors,N,P),h.state.next({errors:n.errors})},D=N=>{n.errors=N,h.state.next({errors:n.errors,isValid:!1})},O=(N,P,$,re)=>{const te=ce(r,N);if(te){const M=ce(i,N,ht($)?ce(o,N):$);ht(M)||re&&re.defaultChecked||P?ct(i,N,P?M:oC(te._f)):q(N,M),s.mount&&!s.action&&b()}},v=(N,P,$,re,te)=>{let M=!1,H=!1;const ne={name:N};if(!e.disabled){if(!$||re){(d.isDirty||f.isDirty)&&(H=n.isDirty,n.isDirty=ne.isDirty=F(),M=H!==ne.isDirty);const se=Io(ce(o,N),P);H=!!ce(n.dirtyFields,N),se?Tt(n.dirtyFields,N):ct(n.dirtyFields,N,!0),ne.dirtyFields=n.dirtyFields,M=M||(d.dirtyFields||f.dirtyFields)&&H!==!se}if($){const se=ce(n.touchedFields,N);se||(ct(n.touchedFields,N,$),ne.touchedFields=n.touchedFields,M=M||(d.touchedFields||f.touchedFields)&&se!==$)}M&&te&&h.state.next(ne)}return M?ne:{}},R=(N,P,$,re)=>{const te=ce(n.errors,N),M=(d.isValid||f.isValid)&&Nr(P)&&n.isValid!==P;if(e.delayError&&$?(l=g(()=>T(N,$)),l(e.delayError)):(clearTimeout(c),l=null,$?ct(n.errors,N,$):Tt(n.errors,N)),($?!Io(te,$):te)||!on(re)||M){const H={...re,...M&&Nr(P)?{isValid:P}:{},errors:n.errors,name:N};n={...n,...H},h.state.next(H)}},j=async N=>(E(N,!0),await e.resolver(i,e.context,uee(N||a.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),z=async N=>{const{errors:P}=await j(N);if(E(N),N)for(const $ of N){const re=ce(P,$);re?ct(n.errors,$,re):Tt(n.errors,$)}else n.errors=P;return P},I=async(N,P,$={valid:!0})=>{for(const re in N){const te=N[re];if(te){const{_f:M,...H}=te;if(M){const ne=a.array.has(M.name),se=te._f&&dee(te._f);se&&d.validatingFields&&E([M.name],!0);const xe=await uC(te,a.disabled,i,p,e.shouldUseNativeValidation&&!P,ne);if(se&&d.validatingFields&&E([M.name]),xe[M.name]&&($.valid=!1,P||t.shouldUseNativeValidation))break;!P&&(ce(xe,M.name)?ne?bee(n.errors,xe,M.name):ct(n.errors,M.name,xe[M.name]):Tt(n.errors,M.name))}!on(H)&&await I(H,P,$)}}return $.valid},X=()=>{for(const N of a.unMount){const P=ce(r,N);P&&(P._f.refs?P._f.refs.every($=>!ep($)):!ep(P._f.ref))&&$e(N)}a.unMount=new Set},F=(N,P)=>!e.disabled&&(N&&P&&ct(i,N,P),!Io(Ee(),o)),W=(N,P,$)=>ree(N,a,{...s.mount?i:ht(P)?o:Rn(N)?{[N]:P}:P},$,P),B=N=>i1(ce(s.mount?i:o,N,e.shouldUnregister?ce(o,N,[]):[])),q=(N,P,$={})=>{const re=ce(r,N);let te=P;if(re){const M=re._f;M&&(!M.disabled&&ct(i,N,P_(P,M)),te=xd(M.ref)&&yn(P)?"":P,D_(M.ref)?[...M.ref.options].forEach(H=>H.selected=te.includes(H.value)):M.refs?Yl(M.ref)?M.refs.forEach(H=>{(!H.defaultChecked||!H.disabled)&&(Array.isArray(te)?H.checked=!!te.find(ne=>ne===H.value):H.checked=te===H.value||!!te)}):M.refs.forEach(H=>H.checked=H.value===te):a1(M.ref)?M.ref.value="":(M.ref.value=te,M.ref.type||h.state.next({name:N,values:Mt(i)})))}($.shouldDirty||$.shouldTouch)&&v(N,te,$.shouldTouch,$.shouldDirty,!0),$.shouldValidate&&S(N)},oe=(N,P,$)=>{for(const re in P){if(!P.hasOwnProperty(re))return;const te=P[re],M=N+"."+re,H=ce(r,M);(a.array.has(N)||At(te)||H&&!H._f)&&!hi(te)?oe(M,te,$):q(M,te,$)}},Z=(N,P,$={})=>{const re=ce(r,N),te=a.array.has(N),M=Mt(P);ct(i,N,M),te?(h.array.next({name:N,values:Mt(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&$.shouldDirty&&h.state.next({name:N,dirtyFields:as(o,i),isDirty:F(N,M)})):re&&!re._f&&!yn(M)?oe(N,M,$):q(N,M,$),aC(N,a)?h.state.next({...n,name:N,values:Mt(i)}):h.state.next({name:s.mount?N:void 0,values:Mt(i)})},ee=async N=>{s.mount=!0;const P=N.target;let $=P.name,re=!0;const te=ce(r,$),M=se=>{re=Number.isNaN(se)||hi(se)&&isNaN(se.getTime())||Io(se,ce(i,$,se))},H=iC(e.mode),ne=iC(e.reValidateMode);if(te){let se,xe;const It=P.type?oC(te._f):XJ(N),Kt=N.type===Jx.BLUR||N.type===Jx.FOCUS_OUT,or=!fee(te._f)&&!e.resolver&&!ce(n.errors,$)&&!te._f.deps||mee(Kt,ce(n.touchedFields,$),n.isSubmitted,ne,H),qr=aC($,a,Kt);ct(i,$,It),Kt?(!P||!P.readOnly)&&(te._f.onBlur&&te._f.onBlur(N),l&&l(0)):te._f.onChange&&te._f.onChange(N);const Wr=v($,It,Kt),rn=!on(Wr)||qr;if(!Kt&&h.state.next({name:$,type:N.type,values:Mt(i)}),or)return(d.isValid||f.isValid)&&(e.mode==="onBlur"?Kt&&b():Kt||b()),rn&&h.state.next({name:$,...qr?{}:Wr});if(!Kt&&qr&&h.state.next({...n}),e.resolver){const{errors:Gr}=await j([$]);if(E([$]),M(It),re){const ir=lC(n.errors,r,$),f1=lC(Gr,r,ir.name||$);se=f1.error,$=f1.name,xe=on(Gr)}}else E([$],!0),se=(await uC(te,a.disabled,i,p,e.shouldUseNativeValidation))[$],E([$]),M(It),re&&(se?xe=!1:(d.isValid||f.isValid)&&(xe=await I(r,!0)));re&&(te._f.deps&&(!Array.isArray(te._f.deps)||te._f.deps.length>0)&&S(te._f.deps),R($,xe,se,Wr))}},ie=(N,P)=>{if(ce(n.errors,P)&&N.focus)return N.focus(),1},S=async(N,P={})=>{let $,re;const te=Ga(N);if(e.resolver){const M=await z(ht(N)?N:te);$=on(M),re=N?!te.some(H=>ce(M,H)):$}else N?(re=(await Promise.all(te.map(async M=>{const H=ce(r,M);return await I(H&&H._f?{[M]:H}:H)}))).every(Boolean),!(!re&&!n.isValid)&&b()):re=$=await I(r);return h.state.next({...!Rn(N)||(d.isValid||f.isValid)&&$!==n.isValid?{}:{name:N},...e.resolver||!N?{isValid:$}:{},errors:n.errors}),P.shouldFocus&&!re&&Ya(r,ie,N?te:a.mount),re},Ee=(N,P)=>{let $={...s.mount?i:o};return P&&($=O_(P.dirtyFields?n.dirtyFields:n.touchedFields,$)),ht(N)?$:Rn(N)?ce($,N):N.map(re=>ce($,re))},be=(N,P)=>({invalid:!!ce((P||n).errors,N),isDirty:!!ce((P||n).dirtyFields,N),error:ce((P||n).errors,N),isValidating:!!ce(n.validatingFields,N),isTouched:!!ce((P||n).touchedFields,N)}),_=N=>{N&&Ga(N).forEach(P=>Tt(n.errors,P)),h.state.next({errors:N?n.errors:{}})},ft=(N,P,$)=>{const re=(ce(r,N,{_f:{}})._f||{}).ref,te=ce(n.errors,N)||{},{ref:M,message:H,type:ne,...se}=te;ct(n.errors,N,{...se,...P,ref:re}),h.state.next({name:N,errors:n.errors,isValid:!1}),$&&$.shouldFocus&&re&&re.focus&&re.focus()},Ue=(N,P)=>lr(N)?h.state.subscribe({next:$=>"values"in $&&N(W(void 0,P),$)}):W(N,P,!0),Ve=N=>h.state.subscribe({next:P=>{pee(N.name,P.name,N.exact)&&hee(P,N.formState||d,Tf,N.reRenderRoot)&&N.callback({values:{...i},...n,...P,defaultValues:o})}}).unsubscribe,Lt=N=>(s.mount=!0,f={...f,...N.formState},Ve({...N,formState:{...u,...N.formState}})),$e=(N,P={})=>{for(const $ of N?Ga(N):a.mount)a.mount.delete($),a.array.delete($),P.keepValue||(Tt(r,$),Tt(i,$)),!P.keepError&&Tt(n.errors,$),!P.keepDirty&&Tt(n.dirtyFields,$),!P.keepTouched&&Tt(n.touchedFields,$),!P.keepIsValidating&&Tt(n.validatingFields,$),!e.shouldUnregister&&!P.keepDefaultValue&&Tt(o,$);h.state.next({values:Mt(i)}),h.state.next({...n,...P.keepDirty?{isDirty:F()}:{}}),!P.keepIsValid&&b()},Ye=({disabled:N,name:P})=>{if(Nr(N)&&s.mount||N||a.disabled.has(P)){const te=a.disabled.has(P)!==!!N;N?a.disabled.add(P):a.disabled.delete(P),te&&s.mount&&!s.action&&b()}},xt=(N,P={})=>{let $=ce(r,N);const re=Nr(P.disabled)||Nr(e.disabled);return ct(r,N,{...$||{},_f:{...$&&$._f?$._f:{ref:{name:N}},name:N,mount:!0,...P}}),a.mount.add(N),$?Ye({disabled:Nr(P.disabled)?P.disabled:e.disabled,name:N}):O(N,!0,P.value),{...re?{disabled:P.disabled||e.disabled}:{},...e.progressive?{required:!!P.required,min:ma(P.min),max:ma(P.max),minLength:ma(P.minLength),maxLength:ma(P.maxLength),pattern:ma(P.pattern)}:{},name:N,onChange:ee,onBlur:ee,ref:te=>{if(te){xt(N,P),$=ce(r,N);const M=ht(te.value)&&te.querySelectorAll&&te.querySelectorAll("input,select,textarea")[0]||te,H=see(M),ne=$._f.refs||[];if(H?ne.find(se=>se===M):M===$._f.ref)return;ct(r,N,{_f:{...$._f,...H?{refs:[...ne.filter(ep),M,...Array.isArray(ce(o,N))?[{}]:[]],ref:{type:M.type,name:N}}:{ref:M}}}),O(N,!1,void 0,M)}else $=ce(r,N,{}),$._f&&($._f.mount=!1),(e.shouldUnregister||P.shouldUnregister)&&!(JJ(a.array,N)&&s.action)&&a.unMount.add(N)}}},Rt=()=>e.shouldFocusError&&Ya(r,ie,a.mount),Vn=N=>{Nr(N)&&(h.state.next({disabled:N}),Ya(r,(P,$)=>{const re=ce(r,$);re&&(P.disabled=re._f.disabled||N,Array.isArray(re._f.refs)&&re._f.refs.forEach(te=>{te.disabled=re._f.disabled||N}))},0,!1))},Gi=(N,P)=>async $=>{let re;$&&($.preventDefault&&$.preventDefault(),$.persist&&$.persist());let te=Mt(i);if(h.state.next({isSubmitting:!0}),e.resolver){const{errors:M,values:H}=await j();E(),n.errors=M,te=Mt(H)}else await I(r);if(a.disabled.size)for(const M of a.disabled)Tt(te,M);if(Tt(n.errors,"root"),on(n.errors)){h.state.next({errors:{}});try{await N(te,$)}catch(M){re=M}}else P&&await P({...n.errors},$),Rt(),setTimeout(Rt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:on(n.errors)&&!re,submitCount:n.submitCount+1,errors:n.errors}),re)throw re},ta=(N,P={})=>{ce(r,N)&&(ht(P.defaultValue)?Z(N,Mt(ce(o,N))):(Z(N,P.defaultValue),ct(o,N,Mt(P.defaultValue))),P.keepTouched||Tt(n.touchedFields,N),P.keepDirty||(Tt(n.dirtyFields,N),n.isDirty=P.defaultValue?F(N,Mt(ce(o,N))):F()),P.keepError||(Tt(n.errors,N),d.isValid&&b()),h.state.next({...n}))},na=(N,P={})=>{const $=N?Mt(N):o,re=Mt($),te=on(N),M=te?o:re;if(P.keepDefaultValues||(o=$),!P.keepValues){if(P.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(as(o,i))]);for(const ne of Array.from(H)){const se=ce(n.dirtyFields,ne),xe=ce(i,ne),It=ce(M,ne);se&&!ht(xe)?ct(M,ne,xe):!se&&!ht(It)&&Z(ne,It)}}else{if(o1&&ht(N))for(const H of a.mount){const ne=ce(r,H);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(xd(se)){const xe=se.closest("form");if(xe){xe.reset();break}}}}if(P.keepFieldsRef)for(const H of a.mount)Z(H,ce(M,H));else r={}}i=e.shouldUnregister?P.keepDefaultValues?Mt(o):{}:Mt(M),h.array.next({values:{...M}}),h.state.next({values:{...M}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!e.shouldUnregister&&!on(M),s.watch=!!e.shouldUnregister,s.keepIsValid=!!P.keepIsValid,s.action=!1,P.keepErrors||(n.errors={}),h.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:te?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Io(N,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:te?{}:P.keepDirtyValues?P.keepDefaultValues&&i?as(o,i):n.dirtyFields:P.keepDefaultValues&&N?as(o,N):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ra=(N,P)=>na(lr(N)?N(i):N,{...e.resetOptions,...P}),Kl=(N,P={})=>{const $=ce(r,N),re=$&&$._f;if(re){const te=re.refs?re.refs[0]:re.ref;te.focus&&setTimeout(()=>{te.focus(),P.shouldSelect&&lr(te.select)&&te.select()})}},Tf=N=>{n={...n,...N}},oa={control:{register:xt,unregister:$e,getFieldState:be,handleSubmit:Gi,setError:ft,_subscribe:Ve,_runSchema:j,_updateIsValidating:E,_focusError:Rt,_getWatch:W,_getDirty:F,_setValid:b,_setFieldArray:x,_setDisabledField:Ye,_setErrors:D,_getFieldArray:B,_reset:na,_resetDefaultValues:()=>lr(e.defaultValues)&&e.defaultValues().then(N=>{ra(N,e.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:X,_disableForm:Vn,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(N){s=N},get _defaultValues(){return o},get _names(){return a},set _names(N){a=N},get _formState(){return n},get _options(){return e},set _options(N){e={...e,...N}}},subscribe:Lt,trigger:S,register:xt,handleSubmit:Gi,watch:Ue,setValue:Z,getValues:Ee,reset:ra,resetField:ta,clearErrors:_,unregister:$e,setError:ft,setFocus:Kl,getFieldState:be};return{...oa,formControl:oa}}function xee(t={}){const e=Ie.useRef(void 0),n=Ie.useRef(void 0),[r,o]=Ie.useState({isDirty:!1,isValidating:!1,isLoading:lr(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:lr(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!lr(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:s,...a}=Eee(t);e.current={...a,formState:r}}const i=e.current.control;return i._options=t,nee(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Ie.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),Ie.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),Ie.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),Ie.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),Ie.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Ie.useEffect(()=>{var s;t.values&&!Io(t.values,n.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),n.current=t.values,o(a=>({...a}))):i._resetDefaultValues()},[i,t.values]),Ie.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=Ie.useMemo(()=>tee(r,i),[i,r]),e.current}function Cee(t,e=[]){let n=[];function r(i,s){const a=C.createContext(s);a.displayName=i+"Context";const l=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,g=f?.[t]?.[l]||a,b=C.useMemo(()=>p,Object.values(p));return y.jsx(g.Provider,{value:b,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[l]||a,p=C.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(a){const l=a?.[t]||i;return C.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,kee(o,...e)]}function kee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var c1="Avatar",[Tee]=Cee(c1),[wee,F_]=Tee(c1),H_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[o,i]=C.useState("idle");return y.jsx(wee,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:y.jsx(kd.span,{...r,ref:e})})});H_.displayName=c1;var U_="AvatarImage",V_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=t,s=F_(U_,n),a=See(r,i),l=x3(c=>{o(c),s.onImageLoadingStatusChange(c)});return ip(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?y.jsx(kd.img,{...i,ref:e,src:r}):null});V_.displayName=U_;var $_="AvatarFallback",j_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...o}=t,i=F_($_,n),[s,a]=C.useState(r===void 0);return C.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?y.jsx(kd.span,{...o,ref:e}):null});j_.displayName=$_;function dC(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function See(t,{referrerPolicy:e,crossOrigin:n}){const r=C3(),o=C.useRef(null),i=r?(o.current||(o.current=new window.Image),o.current):null,[s,a]=C.useState(()=>dC(i,t));return ip(()=>{a(dC(i,t))},[i,t]),ip(()=>{const l=d=>()=>{a(d)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,e]),s}var vee=H_,Aee=V_,_ee=j_;const u1="-",Nee=t=>{const e=Mee(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const a=s.split(u1);return a[0]===""&&a.length!==1&&a.shift(),z_(a,e)||Iee(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},z_=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?z_(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const i=t.join(u1);return e.validators.find(({validator:s})=>s(i))?.classGroupId},fC=/^\[(.+)\]$/,Iee=t=>{if(fC.test(t)){const e=fC.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Mee=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return Dee(Object.entries(t.classGroups),n).forEach(([i,s])=>{Um(s,r,i,e)}),r},Um=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){const i=o===""?e:hC(e,o);i.classGroupId=n;return}if(typeof o=="function"){if(Oee(o)){Um(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Um(s,hC(e,i),n,r)})})},hC=(t,e)=>{let n=t;return e.split(u1).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Oee=t=>t.isThemeGetter,Dee=(t,e)=>e?t.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[e+s,a])):i);return[n,o]}):t,Lee=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},q_="!",Ree=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,o=e[0],i=e.length,s=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let E=a[b];if(c===0){if(E===o&&(r||a.slice(b,b+i)===e)){l.push(a.slice(u,b)),u=b+i;continue}if(E==="/"){d=b;continue}}E==="["?c++:E==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(q_),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:s}):s},Pee=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},Bee=t=>({cache:Lee(t.cacheSize),parseClassName:Ree(t),...Nee(t)}),Fee=/\s+/,Hee=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=e,i=[],s=t.trim().split(Fee);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,g=r(p?f.substring(0,h):f);if(!g){if(!p){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}p=!1}const b=Pee(u).join(":"),E=d?b+q_:b,x=E+g;if(i.includes(x))continue;i.push(x);const T=o(g,p);for(let D=0;D<T.length;++D){const O=T[D];i.push(E+O)}a=c+(a.length>0?" "+a:a)}return a};function Uee(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=W_(e))&&(r&&(r+=" "),r+=n);return r}const W_=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=W_(t[r]))&&(n&&(n+=" "),n+=e);return n};function Vee(t,...e){let n,r,o,i=s;function s(l){const c=e.reduce((u,d)=>d(u),t());return n=Bee(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=Hee(l,n);return o(l,u),u}return function(){return i(Uee.apply(null,arguments))}}const it=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},G_=/^\[(?:([a-z-]+):)?(.+)\]$/i,$ee=/^\d+\/\d+$/,jee=new Set(["px","full","screen"]),zee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,eo=t=>ws(t)||jee.has(t)||$ee.test(t),yo=t=>ea(t,"length",nte),ws=t=>!!t&&!Number.isNaN(Number(t)),tp=t=>ea(t,"number",ws),ga=t=>!!t&&Number.isInteger(Number(t)),Kee=t=>t.endsWith("%")&&ws(t.slice(0,-1)),Te=t=>G_.test(t),Eo=t=>zee.test(t),Qee=new Set(["length","size","percentage"]),Xee=t=>ea(t,Qee,Y_),Zee=t=>ea(t,"position",Y_),Jee=new Set(["image","url"]),ete=t=>ea(t,Jee,ote),tte=t=>ea(t,"",rte),ba=()=>!0,ea=(t,e,n)=>{const r=G_.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},nte=t=>qee.test(t)&&!Wee.test(t),Y_=()=>!1,rte=t=>Gee.test(t),ote=t=>Yee.test(t),ite=()=>{const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),o=it("borderColor"),i=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),c=it("grayscale"),u=it("hueRotate"),d=it("invert"),f=it("gap"),h=it("gradientColorStops"),p=it("gradientColorStopPositions"),g=it("inset"),b=it("margin"),E=it("opacity"),x=it("padding"),T=it("saturate"),D=it("scale"),O=it("sepia"),v=it("skew"),R=it("space"),j=it("translate"),z=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",Te,e],F=()=>[Te,e],W=()=>["",eo,yo],B=()=>["auto",ws,Te],q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>["start","end","center","between","around","evenly","stretch"],ie=()=>["","0",Te],S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ee=()=>[ws,Te];return{cacheSize:500,separator:":",theme:{colors:[ba],spacing:[eo,yo],blur:["none","",Eo,Te],brightness:Ee(),borderColor:[t],borderRadius:["none","","full",Eo,Te],borderSpacing:F(),borderWidth:W(),contrast:Ee(),grayscale:ie(),hueRotate:Ee(),invert:ie(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[Kee,yo],inset:X(),margin:X(),opacity:Ee(),padding:F(),saturate:Ee(),scale:Ee(),sepia:ie(),skew:Ee(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Te]}],container:["container"],columns:[{columns:[Eo]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...q(),Te]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ga,Te]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Te]}],grow:[{grow:ie()}],shrink:[{shrink:ie()}],order:[{order:["first","last","none",ga,Te]}],"grid-cols":[{"grid-cols":[ba]}],"col-start-end":[{col:["auto",{span:["full",ga,Te]},Te]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[ba]}],"row-start-end":[{row:["auto",{span:[ga,Te]},Te]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Te]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ee()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ee(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ee(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Te,e]}],"min-w":[{"min-w":[Te,e,"min","max","fit"]}],"max-w":[{"max-w":[Te,e,"none","full","min","max","fit","prose",{screen:[Eo]},Eo]}],h:[{h:[Te,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Te,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Eo,yo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tp]}],"font-family":[{font:[ba]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Te]}],"line-clamp":[{"line-clamp":["none",ws,tp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",eo,Te]}],"list-image":[{"list-image":["none",Te]}],"list-style-type":[{list:["none","disc","decimal",Te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",eo,yo]}],"underline-offset":[{"underline-offset":["auto",eo,Te]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...q(),Zee]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Xee]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ete]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...oe(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:oe()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...oe()]}],"outline-offset":[{"outline-offset":[eo,Te]}],"outline-w":[{outline:[eo,yo]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[eo,yo]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Eo,tte]}],"shadow-color":[{shadow:[ba]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Eo,Te]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Te]}],duration:[{duration:Ee()}],ease:[{ease:["linear","in","out","in-out",Te]}],delay:[{delay:Ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",Te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[ga,Te]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Te]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[eo,yo,tp]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ste=Vee(ite);const ate=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lte=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),pC=t=>{const e=lte(t);return e.charAt(0).toUpperCase()+e.slice(1)},K_=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),cte=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var ute={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dte=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>C.createElement("svg",{ref:l,...ute,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:K_("lucide",o),...!i&&!cte(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>C.createElement(c,u)),...Array.isArray(i)?i:[i]]));const kf=(t,e)=>{const n=C.forwardRef(({className:r,...o},i)=>C.createElement(dte,{ref:i,iconNode:e,className:K_(`lucide-${ate(pC(t))}`,`lucide-${t}`,r),...o}));return n.displayName=pC(t),n};const fte=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Q_=kf("check",fte);const hte=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],X_=kf("chevron-down",hte);const pte=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Z_=kf("chevron-right",pte);const mte=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gte=kf("chevron-up",mte);var bte="Label",J_=C.forwardRef((t,e)=>y.jsx(kd.label,{...t,ref:e,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));J_.displayName=bte;var yte=J_;function ue(...t){return ste(s3(t))}function Ete({className:t,...e}){return y.jsx(vee,{"data-slot":"avatar",className:ue("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function xte({className:t,...e}){return y.jsx(Aee,{"data-slot":"avatar-image",className:ue("aspect-square size-full",t),...e})}function Cte({className:t,...e}){return y.jsx(_ee,{"data-slot":"avatar-fallback",className:ue("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}const kte=Vm("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Tte({className:t,variant:e,asChild:n=!1,...r}){return y.jsx(n?_C:"span",{"data-slot":"badge",className:ue(kte({variant:e}),t),...r})}const wte=Vm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ste({className:t,variant:e,size:n,asChild:r=!1,...o}){return y.jsx(r?_C:"button",{"data-slot":"button",className:ue(wte({variant:e,size:n,className:t})),...o})}function vte({className:t,...e}){return y.jsx("div",{"data-slot":"card",className:ue("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}function Ate({className:t,...e}){return y.jsx("div",{"data-slot":"card-content",className:ue("px-6",t),...e})}function _te({...t}){return y.jsx(eN,{"data-slot":"dropdown-menu",...t})}function Nte({...t}){return y.jsx(z3,{"data-slot":"dropdown-menu-trigger",...t})}function Ite({className:t,sideOffset:e=4,...n}){return y.jsx(X3,{"data-slot":"dropdown-menu-content",sideOffset:e,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",t),...n})}function Mte({className:t,inset:e,variant:n="default",...r}){return y.jsx(Q3,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function Ote({className:t,children:e,checked:n,...r}){return y.jsxs(Z3,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),checked:n,...r,children:[y.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:y.jsx(J3,{children:y.jsx(Q_,{className:"size-4"})})}),e]})}function Dte({className:t,inset:e,...n}){return y.jsx(K3,{"data-slot":"dropdown-menu-label","data-inset":e,className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function Lte({className:t,...e}){return y.jsx(Y3,{"data-slot":"dropdown-menu-separator",className:ue("bg-border -mx-1 my-1 h-px",t),...e})}function Rte({...t}){return y.jsx(G3,{"data-slot":"dropdown-menu-sub",...t})}function Pte({className:t,inset:e,children:n,...r}){return y.jsxs(q3,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:ue("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",t),...r,children:[n,y.jsx(Z_,{className:"ml-auto size-4"})]})}function Bte({className:t,...e}){return y.jsx(W3,{"data-slot":"dropdown-menu-sub-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",t),...e})}function Fte({className:t,...e}){return y.jsx(yte,{"data-slot":"label",className:ue("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",t),...e})}const Hte=oee;C.createContext({});C.createContext({});function Ute({className:t,type:e,...n}){return y.jsx("input",{type:e,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}function Vte({...t}){return y.jsx(j3,{"data-slot":"popover",...t})}function $te({...t}){return y.jsx(V3,{"data-slot":"popover-trigger",...t})}function jte({className:t,align:e="center",sideOffset:n=4,...r}){return y.jsx($3,{"data-slot":"popover-content",align:e,sideOffset:n,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",t),...r})}function zte({...t}){return y.jsx(U3,{"data-slot":"select",...t})}function qte({...t}){return y.jsx(O3,{"data-slot":"select-value",...t})}function Wte({className:t,size:e="default",children:n,...r}){return y.jsxs(D3,{"data-slot":"select-trigger","data-size":e,className:ue("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,y.jsx(L3,{asChild:!0,children:y.jsx(X_,{className:"size-4 opacity-50"})})]})}function Gte({className:t,children:e,position:n="popper",...r}){return y.jsxs(F3,{"data-slot":"select-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[y.jsx(Kte,{}),y.jsx(H3,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),y.jsx(Qte,{})]})}function Yte({className:t,children:e,...n}){return y.jsxs(R3,{"data-slot":"select-item",className:ue("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[y.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:y.jsx(P3,{children:y.jsx(Q_,{className:"size-4"})})}),y.jsx(B3,{children:e})]})}function Kte({className:t,...e}){return y.jsx(tN,{"data-slot":"select-scroll-up-button",className:ue("flex cursor-default items-center justify-center py-1",t),...e,children:y.jsx(gte,{className:"size-4"})})}function Qte({className:t,...e}){return y.jsx(nN,{"data-slot":"select-scroll-down-button",className:ue("flex cursor-default items-center justify-center py-1",t),...e,children:y.jsx(X_,{className:"size-4"})})}function Xte({className:t,...e}){return y.jsx("div",{"data-slot":"skeleton",className:ue("bg-accent animate-pulse rounded-md",t),...e})}function Zte({className:t,...e}){return y.jsx(M3,{"data-slot":"tabs",className:ue("flex flex-col gap-2",t),...e})}function Jte({className:t,...e}){return y.jsx(N3,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...e})}function ene({className:t,...e}){return y.jsx(_3,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...e})}function tne({className:t,...e}){return y.jsx(I3,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",t),...e})}const nne=Vm("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function rne({className:t,variant:e,size:n,...r}){return y.jsx(A3,{"data-slot":"toggle",className:ue(nne({variant:e,size:n,className:t})),...r})}function e3({delayDuration:t=0,...e}){return y.jsx(T3,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function one({...t}){return y.jsx(e3,{children:y.jsx(v3,{"data-slot":"tooltip",...t})})}function ine({...t}){return y.jsx(k3,{"data-slot":"tooltip-trigger",...t})}function sne({className:t,sideOffset:e=0,children:n,...r}){return y.jsxs(w3,{"data-slot":"tooltip-content",sideOffset:e,className:ue("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",t),...r,children:[n,y.jsx(S3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}const ane={Avatar:{Avatar:Ete,AvatarFallback:Cte,AvatarImage:xte},Badge:{Badge:Tte},Button:{Button:Ste},Card:{Card:vte,CardContent:Ate},DropdownMenu:{DropdownMenu:_te,DropdownMenuCheckboxItem:Ote,DropdownMenuContent:Ite,DropdownMenuItem:Mte,DropdownMenuLabel:Dte,DropdownMenuSeparator:Lte,DropdownMenuSub:Rte,DropdownMenuSubContent:Bte,DropdownMenuSubTrigger:Pte,DropdownMenuTrigger:Nte},Form:{Form:Hte},Input:{Input:Ute},Label:{Label:Fte},Popover:{Popover:Vte,PopoverContent:jte,PopoverTrigger:$te},Select:{Select:zte,SelectContent:Gte,SelectItem:Yte,SelectTrigger:Wte,SelectValue:qte},Skeleton:{Skeleton:Xte},Tabs:{Tabs:Zte,TabsContent:tne,TabsList:Jte,TabsTrigger:ene},Toggle:{Toggle:rne},Tooltip:{Tooltip:one,TooltipContent:sne,TooltipProvider:e3,TooltipTrigger:ine}},t3=C.createContext(void 0);function Ke(){return C.useContext(t3)}const lne=t=>{const{children:e,...n}=t;Se(n);const r=Ke(),o=xee();return y.jsx(r.Form.Form,{...o,children:e})},cne=C.forwardRef((t,e)=>{const{className:n,name:r,label:o,variant:i,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:d,onChange:f,onSubmit:h,autoComplete:p,rightSection:g,...b}=t;Se(b);const E=Ke();return y.jsxs("div",{className:ue(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,y.jsxs("div",{className:"flex-1",children:[o&&y.jsx(E.Label.Label,{htmlFor:o,children:o}),y.jsx(E.Input.Input,{className:ue(n,"h-auto border-none p-0"),id:o,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:d,onChange:f,onSubmit:h,ref:e})]}),g]})}),une=t=>C.forwardRef((e,n)=>y.jsx(t,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{const o=new PointerEvent("pointerdown",r.nativeEvent);o.fakeEvent=!0,r.target.dispatchEvent(o)},...e,ref:n})),dne=t=>{const{children:e,onOpenChange:n,position:r,sub:o,...i}=t;Se(i);const s=Ke();return o?y.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:e}):y.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:e})},fne=t=>{const{children:e,sub:n,...r}=t;Se(r);const o=Ke(),i=C.useMemo(()=>une(o.DropdownMenu.DropdownMenuTrigger),[o.DropdownMenu.DropdownMenuTrigger]);return n?y.jsx(o.DropdownMenu.DropdownMenuSubTrigger,{children:e}):y.jsx(i,{asChild:!0,...r,children:e})},hne=C.forwardRef((t,e)=>{const{className:n,children:r,sub:o,...i}=t;Se(i);const s=Ke();return o?y.jsx(s.DropdownMenu.DropdownMenuSubContent,{className:n,ref:e,children:r}):y.jsx(s.DropdownMenu.DropdownMenuContent,{className:n,ref:e,children:r})}),pne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,checked:i,subTrigger:s,onClick:a,...l}=t;Se(l);const c=Ke();return s?y.jsxs(y.Fragment,{children:[o,r]}):i!==void 0?y.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:ue(n,"gap-1",i?"":"px-2"),ref:e,checked:i,onClick:a,...l,children:[o,r]}):y.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:e,onClick:a,...l,children:[o,r,s&&y.jsx(Z_,{className:"ml-auto h-4 w-4"})]})}),mne=C.forwardRef((t,e)=>{const{className:n,...r}=t;Se(r);const o=Ke();return y.jsx(o.DropdownMenu.DropdownMenuSeparator,{className:n,ref:e})}),gne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o);const i=Ke();return y.jsx(i.DropdownMenu.DropdownMenuLabel,{className:n,ref:e,children:r})}),bne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=t;Se(u,!1);const d=Ke();return y.jsxs(d.Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:e,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),yne=C.forwardRef((t,e)=>{const{className:n,tabs:r,defaultOpenTab:o,openTab:i,setOpenTab:s,loading:a,...l}=t;Se(l);const c=Ke();return y.jsxs(c.Tabs.Tabs,{className:ue(n,"bg-popover max-w-screen rounded-lg p-2"),ref:e,value:i,defaultValue:o,onValueChange:s,children:[y.jsx(c.Tabs.TabsList,{children:r.map(u=>y.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>y.jsx(c.Tabs.TabsContent,{value:u.name,children:y.jsx(c.Card.Card,{children:y.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),Ene=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue(n,"flex flex-col items-start justify-center gap-2"),ref:e,children:r})}),xne=C.forwardRef((t,e)=>{const{className:n,value:r,placeholder:o,onKeyDown:i,onChange:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Input.Input,{"data-test":"embed-input",className:ue(n,"w-80 max-w-full"),ref:e,value:r,placeholder:o,onKeyDown:i,onChange:s})}),Cne=t=>{const{children:e,open:n,onOpenChange:r,position:o,...i}=t;Se(i);const s=Ke();return y.jsx(s.Popover.Popover,{open:n,onOpenChange:r,children:e})},kne=C.forwardRef((t,e)=>{const{children:n,...r}=t;Se(r);const o=Ke();return y.jsx(o.Popover.PopoverTrigger,{ref:e,asChild:!0,children:n})}),Tne=C.forwardRef((t,e)=>{const{className:n,variant:r,children:o,...i}=t;Se(i);const s=Ke();return y.jsx(s.Popover.PopoverContent,{sideOffset:8,className:ue(n,"z-[10000] flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:e,children:o})}),wne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o,!1),y.jsx("div",{className:n,ref:e,...o,children:r})}),Sne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=t;Se(u,!1);const d=Ke();return y.jsxs(d.Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:e,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),vne=C.forwardRef((t,e)=>{const{className:n,children:r,id:o,columns:i,...s}=t;return Se(s),y.jsx("div",{className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:e,id:o,role:"grid",children:r})}),Ane=C.forwardRef((t,e)=>{const{className:n,children:r,columns:o,...i}=t;return Se(i),y.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:e,children:r})}),_ne=C.forwardRef((t,e)=>{const{className:n,children:r,id:o,...i}=t;return Se(i),y.jsx("div",{id:o,role:"listbox",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:e,children:r})}),Nne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:e,children:y.jsx("div",{children:r})})}),Ine=C.forwardRef((t,e)=>{const n=Ke(),{className:r,item:o,isSelected:i,onClick:s,id:a,...l}=t;Se(l);const c=C.useRef(null);return C.useEffect(()=>{if(!c.current||!i)return;const u=A_(c.current,document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu"));u==="top"?c.current.scrollIntoView(!0):u==="bottom"&&c.current.scrollIntoView(!1)},[i]),y.jsxs("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",t.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:__([e,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":i||void 0,children:[o.icon&&y.jsx("div",{className:ue("p-3",t.item.size==="small"?"p-0":"",r),"data-position":"left",children:o.icon}),y.jsxs("div",{className:"flex-1",children:[y.jsx("div",{className:ue("text-base",t.item.size==="small"?"text-sm":"",r),children:o.title}),y.jsx("div",{className:ue("text-xs",t.item.size==="small"?"hidden":"",r),children:o.subtext})]}),o.badge&&y.jsx("div",{"data-position":"right",className:"text-xs",children:y.jsx(n.Badge.Badge,{variant:"secondary",children:o.badge})})]})}),Mne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:e,children:r})}),One=C.forwardRef((t,e)=>{const{className:n,...r}=t;return Se(r),y.jsx("div",{className:ue(n,"animate-spin"),ref:e,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:y.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),Dne=C.forwardRef((t,e)=>{const{className:n,children:r,onMouseDown:o,onClick:i,...s}=t;Se(s,!1);const a=Ke();return y.jsx(a.Button.Button,{variant:"ghost",className:ue(n,"h-full w-full p-0 text-gray-400",n!=null&&n.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n!=null&&n.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:e,onClick:i,onMouseDown:o,...s,children:r})}),Lne=C.forwardRef((t,e)=>{const{className:n,children:r,draggable:o,onDragStart:i,onDragEnd:s,style:a,label:l,...c}=t;Se(c,!1);const u=Ke();return y.jsx(u.Button.Button,{variant:"ghost",className:ue(n,"h-fit w-fit p-0 text-gray-400"),ref:e,"aria-label":l,draggable:o,onDragStart:i,onDragEnd:s,style:a,...c,children:r})}),np=C.forwardRef((t,e)=>{const{className:n,children:r,onMouseEnter:o,onMouseLeave:i,variant:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Tooltip.TooltipProvider,{delayDuration:0,children:y.jsx("div",{className:ue(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:e,onMouseEnter:o,onMouseLeave:i,children:r})})}),rp=C.forwardRef((t,e)=>{const{className:n,children:r,mainTooltip:o,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:d,...f}=t;Se(f,!1);const h=Ke(),p=a===void 0?y.jsxs(h.Button.Button,{className:ue(n,d==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:d==="compact"?"sm":"default",disabled:l,onClick:c,ref:e,"aria-label":u,...f,children:[s,r]}):y.jsxs(h.Toggle.Toggle,{className:ue(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",d==="compact"?"h-6 min-w-6 p-0":""),size:d==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:e,...f,children:[s,r]});return y.jsxs(h.Tooltip.Tooltip,{children:[y.jsx(h.Tooltip.TooltipTrigger,{asChild:!0,children:p}),y.jsxs(h.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[y.jsx("span",{children:o}),i&&y.jsx("span",{children:i})]})]})}),op=C.forwardRef((t,e)=>{const{className:n,items:r,isDisabled:o,...i}=t;Se(i);const s=Ke(),a=c=>y.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?y.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>{var u,d;return(d=(u=r.find(f=>f.text===c)).onClick)==null?void 0:d.call(u)},disabled:o,children:[y.jsx(s.Select.SelectTrigger,{className:"border-none",children:y.jsx(s.Select.SelectValue,{})}),y.jsx(s.Select.SelectContent,{className:n,ref:e,children:r.map(c=>y.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:y.jsx(a,{...c})},c.text))})]}):null}),Rne=C.forwardRef((t,e)=>{const{className:n,children:r,selected:o,headerText:i,onFocus:s,onBlur:a,tabIndex:l,...c}=t;Se(c);const u=Ke();return y.jsxs(u.Card.Card,{className:ue(n,"w-[300px]",o?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:e,children:[i&&y.jsx("div",{className:"px-4 pt-4 text-sm italic",children:i}),r]})}),Pne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue(n,"p-4",n!=null&&n.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:e,children:r})}),Bne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o,!1);const i=Ke();return y.jsx(i.Button.Button,{className:ue(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:e,children:r})}),Fne=C.forwardRef((t,e)=>{const{authorInfo:n,timeString:r,edited:o,...i}=t,s=ve();Se(i,!1);const a=Ke();return n==="loading"?y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[y.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),y.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[y.jsxs(a.Avatar.Avatar,{children:[y.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),y.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[y.jsx("span",{className:"text-sm font-bold",children:n.username}),y.jsxs("span",{className:"text-xs",children:[r," ",o&&`(${s.comments.edited})`]})]})]})}),Hne=C.forwardRef((t,e)=>{const{className:n,showActions:r,authorInfo:o,timeString:i,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=t;Se(u);const[d,f]=C.useState(!1),{focused:h,ref:p}=QJ(),g=s&&(r===!0||r===void 0||r==="hover"&&d||h);return y.jsxs("div",{ref:e,className:ue(n,"relative flex flex-col gap-2"),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[g?y.jsx("div",{className:"absolute right-0 top-0 z-10",ref:p,children:s}):null,y.jsx(Fne,{...t}),c]})}),Une=C.forwardRef((t,e)=>{const{className:n,onFocus:r,onBlur:o,autoFocus:i,editor:s,editable:a,...l}=t;Se(l);const c=zr();return y.jsx(n3,{autoFocus:i,className:ue(n,""),theme:c?.colorSchemePreference,editor:t.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:e,onFocus:r,onBlur:o,children:y.jsx(e1,{formattingToolbar:Vne})})}),Vne=()=>{const t=Z0([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton");return y.jsx(J0,{blockTypeSelectItems:[],children:t})},$ne=C.forwardRef((t,e)=>{const{className:n,text:r,icon:o,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=t;Se(u,!1);const d=Ke(),f=y.jsxs(d.Button.Button,{variant:i?"secondary":"outline",className:ue(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:e,children:[y.jsx("span",{children:o}),y.jsx("span",{children:r})]});return s?y.jsxs(d.Tooltip.Tooltip,{children:[y.jsx(d.Tooltip.TooltipTrigger,{asChild:!0,children:f}),y.jsxs(d.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[y.jsx("span",{children:s}),a&&y.jsx("span",{children:a})]})]}):f}),jne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o);const i=Ke();return y.jsx(i.Tooltip.TooltipProvider,{delayDuration:0,children:y.jsx("div",{className:ue(n,"flex w-full flex-row flex-wrap gap-1"),ref:e,children:r})})}),zne=C.forwardRef((t,e)=>{const{className:n,children:r,onClick:o,label:i,...s}=t;Se(s);const a=Ke();return y.jsx(a.Button.Button,{type:"submit",className:n,"aria-label":i,ref:e,onClick:o,children:r})}),qne=C.forwardRef((t,e)=>{const{className:n,accept:r,value:o,placeholder:i,onChange:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Input.Input,{type:"file",className:n,ref:e,accept:r,value:o?o.name:void 0,onChange:async c=>s?.(c.target.files[0]),placeholder:i})}),Wne=C.forwardRef((t,e)=>{const{className:n,isSelected:r,onClick:o,item:i,id:s,...a}=t;Se(a);const l=C.useRef(null);return C.useEffect(()=>{if(!l.current||!r)return;const c=A_(l.current,document.querySelector(".bn-grid-suggestion-menu"));c==="top"?l.current.scrollIntoView(!0):c==="bottom"&&l.current.scrollIntoView(!1)},[r]),y.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:__([e,l]),id:s,role:"option",onClick:o,"aria-selected":r||void 0,children:i.icon})}),Gne=C.forwardRef((t,e)=>{const{className:n,children:r,columns:o,...i}=t;return Se(i),y.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:e,children:r})}),Yne={FormattingToolbar:{Root:np,Button:rp,Select:op},FilePanel:{Root:yne,Button:zne,FileInput:qne,TabPanel:Ene,TextInput:xne},LinkToolbar:{Root:np,Button:rp,Select:op},SideMenu:{Root:wne,Button:Sne},SuggestionMenu:{Root:_ne,Item:Ine,EmptyItem:Nne,Label:Mne,Loader:One},GridSuggestionMenu:{Root:vne,Item:Wne,EmptyItem:Ane,Loader:Gne},TableHandle:{Root:Lne,ExtendButton:Dne},Comments:{Comment:Hne,Editor:Une,Card:Rne,CardSection:Pne,ExpandSectionsPrompt:Bne},Generic:{Badge:{Root:$ne,Group:jne},Toolbar:{Root:np,Button:rp,Select:op},Form:{Root:lne,TextInput:cne},Menu:{Root:dne,Trigger:fne,Dropdown:hne,Divider:mne,Label:gne,Item:pne,Button:bne},Popover:{Root:Cne,Trigger:kne,Content:Tne}}},n3=t=>{const{className:e,shadCNComponents:n,...r}=t,o=C.useMemo(()=>({...ane,...n}),[n]);return y.jsx(t3.Provider,{value:o,children:y.jsx(ZA.Provider,{value:Yne,children:y.jsx(DJ,{className:ut("bn-shadcn",e||""),...r})})})};function mC({open:t,onClose:e,onSave:n,initial:r,hideCaption:o}){const[i,s]=C.useState(r?.url??""),[a,l]=C.useState(r?.mediaId??""),[c,u]=C.useState(r?.alt??""),[d,f]=C.useState(r?.caption??""),[h,p]=C.useState(r?.filename??""),[g,b]=C.useState(r?.width??0),[E,x]=C.useState(r?.height??0),[T,D]=C.useState(r?.thumbUrl??""),[O,v]=C.useState(!1),[R,j]=C.useState(!1),z=!!a,I=i?z&&T?sp(T):sp(i):"";function X(q){if(s(q.url),l(q.mediaId),p(q.filename),b(q.width??0),x(q.height??0),D(q.urls?.thumb_md??""),j(!1),!c.trim()){const oe=q.filename.replace(/\.[\w]+$/,"").replace(/[._-]+/g," ");u(oe)}v(!1)}function F(){s(""),l(""),p(""),b(0),x(0),D(""),j(!1)}function W(q){s(q),l(""),p(""),b(0),x(0),D(""),j(!1)}function B(){n({url:i,mediaId:a,alt:c,caption:d,filename:h,width:g,height:E})}return y.jsxs(y.Fragment,{children:[y.jsx(EC,{open:t,onOpenChange:()=>e(),children:y.jsxs(xC,{children:[y.jsxs(CC,{children:[y.jsx(kC,{children:r?"Edit Image":"Insert Image"}),y.jsx(TC,{className:"sr-only",children:"Set the image URL, alt text, and caption."})]}),y.jsxs("div",{className:"space-y-4",children:[i&&!R?y.jsx("div",{className:"flex justify-center",children:y.jsx("img",{src:I,alt:c||"Preview",className:"max-h-48 rounded-md object-contain",onError:()=>j(!0)})}):i&&R?y.jsx("div",{className:"flex justify-center",children:y.jsx("div",{className:"flex h-32 w-32 items-center justify-center rounded-md bg-muted",children:y.jsx(wC,{className:"h-8 w-8 text-muted-foreground","data-testid":"fallback-icon"})})}):null,y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{children:"Image"}),y.jsxs("div",{className:"flex gap-2",children:[z?y.jsxs(a3,{variant:"secondary",className:"flex max-w-full items-center gap-1.5 px-3 py-1.5 text-sm",children:[y.jsx(l3,{className:"h-3.5 w-3.5 shrink-0"}),y.jsx("span",{className:"truncate",children:h}),y.jsx("button",{type:"button",onClick:F,className:"ml-1 shrink-0 rounded-full p-0.5 hover:bg-muted","aria-label":"Clear media",children:y.jsx(c3,{className:"h-3 w-3"})})]}):y.jsx(vf,{placeholder:"https://example.com/image.jpg",value:i,onChange:q=>W(q.target.value)}),y.jsx(Sa,{type:"button",variant:"outline",onClick:()=>v(!0),children:"Select Media"})]})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{htmlFor:"image-alt",children:"Alt Text"}),y.jsx(vf,{id:"image-alt",value:c,onChange:q=>u(q.target.value),placeholder:"Describe the image"})]}),!o&&y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{htmlFor:"image-caption",children:"Caption (optional)"}),y.jsx(vf,{id:"image-caption",value:d,onChange:q=>f(q.target.value),placeholder:"Photo credit or description"})]})]}),y.jsxs(SC,{children:[y.jsx(Sa,{variant:"outline",onClick:e,children:"Cancel"}),y.jsx(Sa,{onClick:B,disabled:!i.trim(),children:"Save"})]})]})}),O&&y.jsx(rN,{open:O,onClose:()=>v(!1),onSelect:q=>X(q),allowedTypes:["image/*"]})]})}const Kne=S_({type:"image",propSchema:{mediaId:{default:""},url:{default:""},alt:{default:""},caption:{default:""},filename:{default:""},width:{default:0},height:{default:0}},content:"none"},{render:({block:t,editor:e})=>y.jsx(Qne,{block:t,editor:e})});function Qne({block:t,editor:e}){const n=!!t.props.url,[r,o]=C.useState(!n&&e.isEditable),i=n?sp(t.props.url):"";function s(a){e.updateBlock(t,{props:{url:a.url,mediaId:a.mediaId,alt:a.alt,caption:a.caption,filename:a.filename,width:a.width,height:a.height}}),o(!1)}return n?y.jsxs(y.Fragment,{children:[y.jsxs("figure",{className:`group my-2${e.isEditable?" cursor-pointer rounded-lg ring-primary hover:ring-2":""}`,onClick:()=>e.isEditable&&o(!0),children:[y.jsxs("div",{className:"relative inline-block",children:[y.jsx("img",{src:i,alt:t.props.alt,className:"max-w-full rounded-lg"}),e.isEditable&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-black/0 opacity-0 transition-opacity group-hover:bg-black/20 group-hover:opacity-100",children:y.jsx(vC,{className:"h-6 w-6 text-white drop-shadow"})})]}),t.props.caption&&y.jsx("figcaption",{className:"mt-1 text-sm text-muted-foreground",children:t.props.caption})]}),r&&y.jsx(mC,{open:r,onClose:()=>o(!1),onSave:s,initial:{url:t.props.url,mediaId:t.props.mediaId,alt:t.props.alt,caption:t.props.caption,filename:t.props.filename,width:t.props.width,height:t.props.height}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex cursor-pointer flex-col items-center rounded-lg border-2 border-dashed p-8 text-center",onClick:()=>e.isEditable&&o(!0),children:[y.jsx(wC,{className:"mx-auto h-8 w-8 text-muted-foreground"}),y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Click to select an image"})]}),r&&y.jsx(mC,{open:r,onClose:()=>o(!1),onSave:s})]})}function Xne({blockType:t,props:e,onSave:n}){const[r,o]=C.useState(!1),[i,s]=C.useState({});function a(){s({...e}),o(!0)}function l(){n(i),o(!1)}return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"cursor-pointer",onClick:a,children:[y.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[y.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.icon&&y.jsxs(y.Fragment,{children:[t.icon," "]}),t.label]}),y.jsx(vC,{className:"h-3 w-3 text-muted-foreground"})]}),y.jsx(iN,{blockType:t,props:e})]}),y.jsx(EC,{open:r,onOpenChange:o,children:y.jsxs(xC,{className:"max-w-lg",children:[y.jsxs(CC,{children:[y.jsxs(kC,{children:["Edit ",t.label]}),y.jsx(TC,{className:"sr-only",children:"Edit block properties"})]}),y.jsx(oN,{fields:t.fields??[],values:i,onChange:s}),y.jsxs(SC,{children:[y.jsx(Sa,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),y.jsx(Sa,{onClick:l,children:"Save"})]})]})})]})}function Zne(t){const e={};for(const n of t??[])switch(n.type){case"boolean":e[n.name]={default:!1};break;case"number":e[n.name]={default:0};break;default:e[n.name]={default:""}}return e}function Jne(t){const{image:e,...n}=U2,r={...n,image:Kne()};for(const o of t){const i=Zne(o.fields??[]),s=S_({type:o.name,propSchema:i,content:"none"},{render:({block:a,editor:l})=>{const c=a;return y.jsx(Xne,{blockType:o,props:c.props,onSave:u=>{l.updateBlock(a,{props:u})}})}});r[o.name]=s()}return P0.create({blockSpecs:r})}function ere(t){const e=C.useMemo(()=>Jne(t),[t]),n=C.useMemo(()=>t.map(r=>r.name).sort().join(","),[t]);return{schema:e,schemaKey:n}}const d1="headroom://content/";function tre(t){return t.startsWith(d1)}function nre(t){if(!tre(t))return null;const e=t.slice(d1.length),n=e.indexOf("/");if(n===-1)return null;const r=e.slice(0,n),o=e.slice(n+1);return!r||!/^[0-9A-Z]{26}$/.test(o)?null:{collection:r,contentId:o}}function rre(t,e){return`${d1}${t}/${e}`}function ore(){const t=ge(),e=fe(),{host:n}=yC(),{showSelection:r}=Re(ml),[o,i]=C.useState(!1);if(C.useEffect(()=>{r(o)},[o,r]),!e||!n)return null;function s(a){const l=rre(a.collection,a.contentId);t.createLink(l,a.title),i(!1)}return y.jsx(sN,{host:n,selectedIds:[],open:o,onOpenChange:i,onSelect:s,trigger:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"contentLink",label:"Link to Content",icon:y.jsx(u3,{size:18}),onClick:()=>i(!0)})})}function Xre({initialBlocks:t,onChange:e,blockTypes:n,compact:r}){const{schema:o,schemaKey:i}=ere(n);return y.jsx(ire,{schema:o,initialBlocks:t,onChange:e,blockTypes:n,compact:r},i)}function ire({schema:t,initialBlocks:e,onChange:n,blockTypes:r,compact:o}){const i=xf({schema:t,initialContent:e&&e.length>0?e:void 0});C.useMemo(()=>{let a=!1;i.onChange(()=>{if(!a){a=!0;return}n(i.document)})},[i]);const s=C.useMemo(()=>{const a=k_(i),l=r.map(c=>({title:c.label,subtext:`Insert ${c.label} block`,onItemClick:()=>{const u=i.getTextCursorPosition().block;i.insertBlocks([{type:c.name}],u,"after")},aliases:[c.name],group:"Custom Blocks"}));return[...a,...l]},[i,r]);return y.jsx("div",{className:o?"[&_.bn-editor]:min-h-[120px]":"[&_.bn-editor]:min-h-[300px]",children:y.jsxs(n3,{editor:i,slashMenu:!1,filePanel:!1,formattingToolbar:!1,linkToolbar:!1,theme:"light",children:[y.jsx(T_,{triggerCharacter:"/",getItems:async a=>s.filter(l=>l.title.toLowerCase().includes(a.toLowerCase()))}),y.jsx(e1,{formattingToolbar:sre}),y.jsx(y_,{linkToolbar:are})]})})}function sre(t){return y.jsxs(J0,{...t,children:[Z0(t.blockTypeSelectItems),y.jsx(ore,{})]})}function are(t){const{host:e}=yC(),n=o3(),r=fe(),o=nre(t.url);return!o||!r?y.jsx(b_,{...t}):y.jsxs(r.Generic.Toolbar.Root,{className:"bn-toolbar bn-link-toolbar",variant:"action-toolbar",children:[y.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:`Content link · ${o.collection}`,mainTooltip:`Content link · ${o.collection}`,isDisabled:!0,onClick:()=>{}}),y.jsx(g_,{url:t.url,text:t.text,range:t.range,setToolbarFrozen:t.setToolbarFrozen,setToolbarOpen:t.setToolbarOpen}),y.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:"Open",mainTooltip:"Open in editor",onClick:()=>{n(`/sites/${e}/content/${o.contentId}`)}}),y.jsx(m_,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})}export{Xre as default};