From d660cd05fafc627a7216cbdf7b68e4cf50bd2cc1 Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Tue, 27 Oct 2026 15:25:24 +0100 Subject: [PATCH] fix(32): CR-04 take widget actions dispatched from connectedCallback WidgetField assigned its element after append(), so an action the element dispatched from connectedCallback (inside append) found no target and was dropped without a result or an error state; widgets that load on connect never started. The element is now the action target before it is connected. Rebuilt the embedded admin dist. --- .../components/form/fields/WidgetField.vue | 4 +- admin/tests/form/WidgetField.test.ts | 40 +++++++++++++++++++ docs/backend/partials-and-widgets.md | 2 +- ...{editor-u3XVNuem.js => editor-CxeFI7rG.js} | 2 +- .../{index-BgYjF4nQ.js => index-BNWI_4R0.js} | 2 +- modules/boardwalk/dist/index.html | 2 +- 6 files changed, 47 insertions(+), 5 deletions(-) rename modules/boardwalk/dist/assets/{editor-u3XVNuem.js => editor-CxeFI7rG.js} (99%) rename modules/boardwalk/dist/assets/{index-BgYjF4nQ.js => index-BNWI_4R0.js} (99%) diff --git a/admin/src/components/form/fields/WidgetField.vue b/admin/src/components/form/fields/WidgetField.vue index a025ccde..e040fd64 100644 --- a/admin/src/components/form/fields/WidgetField.vue +++ b/admin/src/components/form/fields/WidgetField.vue @@ -158,8 +158,10 @@ onMounted(async () => { created.setAttribute('label', props.field.actionLabel || props.field.label || props.field.name) created.setAttribute('busy-label', t('backend::lang.extension.busy')) created.addEventListener(WIDGET_EVENT, listener) - mountPoint.value.append(created) + // The element is the action target before it is connected: an action + // its connectedCallback dispatches (inside append) is taken, not dropped. element = created + mountPoint.value.append(created) status.value = 'ready' } catch { if (!unmounted) { diff --git a/admin/tests/form/WidgetField.test.ts b/admin/tests/form/WidgetField.test.ts index 7662d59e..5a254930 100644 --- a/admin/tests/form/WidgetField.test.ts +++ b/admin/tests/form/WidgetField.test.ts @@ -49,6 +49,7 @@ interface Options { assets?: () => Promise source?: typeof SOURCE | null routes?: Record + attachTo?: HTMLElement } function mountWidget(options: Options = {}) { @@ -59,6 +60,7 @@ function mountWidget(options: Options = {}) { }) const calls = mockApi(options.routes ?? {}) const wrapper = mount(WidgetField, { + attachTo: options.attachTo, props: { field: options.field ?? lookupField(), modelValue: undefined, @@ -367,6 +369,44 @@ describe('summer-action (D-05, D-07)', () => { }) }) +describe('an action from connectedCallback (CR-04)', () => { + it('posts the action an element dispatches while it is being connected', async () => { + const tag = 'acme-demo-eager' + if (!customElements.get(tag)) { + customElements.define( + tag, + class extends HTMLElement { + connectedCallback(): void { + this.dispatchEvent(new CustomEvent(WIDGET_EVENT, { bubbles: true, composed: true, detail: { payload: { op: 'context' } } })) + } + }, + ) + } + const action = deferred() + const host = document.createElement('div') + document.body.append(host) + const { wrapper, calls } = mountWidget({ + field: lookupField({ widget: tag }), + attachTo: host, + routes: { [`POST ${ACTION}`]: action.route }, + }) + await flushPromises() + const target = wrapper.find(tag).element as HTMLElement + expect(target.isConnected).toBe(true) + expect(target.hasAttribute('busy')).toBe(true) + const posts = requestsTo(calls, 'POST', ACTION) + expect(posts).toHaveLength(1) + const body = (await posts[0]!.json()) as Record + expect(body.payload).toEqual({ op: 'context' }) + const seen = results(target) + action.release({ body: { data: { message: '', fill: {} }, meta: {} } }) + await flushPromises() + expect(target.hasAttribute('busy')).toBe(false) + expect(seen).toHaveLength(1) + wrapper.unmount() + }) +}) + describe('payload and data (summer-result)', () => { const OK: Reply = { body: { data: { message: '', fill: {} }, meta: {} } } const DATA_REPLY: Reply = { diff --git a/docs/backend/partials-and-widgets.md b/docs/backend/partials-and-widgets.md index 02c3ee6a..f34fa5e5 100644 --- a/docs/backend/partials-and-widgets.md +++ b/docs/backend/partials-and-widgets.md @@ -83,7 +83,7 @@ The SPA talks to the plugin element through attributes and two events, nothing e The events: -- `summer-action` is dispatched by the element (with `bubbles` and `composed`) to ask for its action. Its optional `detail.payload` is any JSON value; the SPA posts it as `payload`. A detail without a `payload` property sends none. +- `summer-action` is dispatched by the element (with `bubbles` and `composed`) to ask for its action. Its optional `detail.payload` is any JSON value; the SPA posts it as `payload`. A detail without a `payload` property sends none. The SPA listens before it connects the element, so an action dispatched from `connectedCallback` (a first load, for example) is taken; one dispatched while `busy` is set is dropped, so wait for `busy` to clear before asking again. - `summer-result` is dispatched by the SPA on the element after a successful action, with `detail` `{data, fill, message}`: the response data as returned (`undefined` when none), the fill object and the message. A failed action dispatches nothing. The element never receives a token, a cookie, a Vue instance or a function, and it must not make requests of its own: the SPA owns HTTP and the admin session. Render server data with `textContent`, not `innerHTML`: `data` is the plugin's own answer, but it still came over the wire. The `acme-demo-lookup` fixture under `modules/cabana/testdata/extension/assets/js/lookup.js` is a complete reorder widget: a click sends the new id order as the payload and the returned item list is rendered from the `data` attribute and the `summer-result` event. diff --git a/modules/boardwalk/dist/assets/editor-u3XVNuem.js b/modules/boardwalk/dist/assets/editor-CxeFI7rG.js similarity index 99% rename from modules/boardwalk/dist/assets/editor-u3XVNuem.js rename to modules/boardwalk/dist/assets/editor-CxeFI7rG.js index 6feae3f5..2b888d6d 100644 --- a/modules/boardwalk/dist/assets/editor-u3XVNuem.js +++ b/modules/boardwalk/dist/assets/editor-CxeFI7rG.js @@ -1,4 +1,4 @@ -import{L as mu,i as gu}from"./index-BgYjF4nQ.js";var Vs=Object.defineProperty,yu=(n,e)=>{let t={};for(var r in n)Vs(t,r,{get:n[r],enumerable:!0});return Vs(t,Symbol.toStringTag,{value:"Module"}),t};function Q(n){this.content=n}Q.prototype={constructor:Q,find:function(n){for(var e=0;e>1}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Cl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d=56320&&n<57344}function El(n){return n>=55296&&n<56320}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;re&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new k(r,i)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Rn(t+1,s):Rn(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return k.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};B.none=[];class gn extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Al(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(vl(this.content,e+this.openStart,t+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,t){if(!t)return w.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(k.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new w(e,r,i)}}w.empty=new w(k.empty,0,0);function vl(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vl(s.content,e-i-1,t-i-1)))}function Al(n,e,t,r,i,s){let{index:o,offset:l}=n.findIndex(e),a=n.maybeChild(o);if(l==e||a.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=Al(a.content,e-l-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,a);return c&&n.replaceChild(o,a.copy(c))}function ku(n,e,t){if(t.openStart>n.depth)throw new gn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gn("Inconsistent open depths");return Ol(n,e,t,0)}function Ol(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function nn(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(mt(n.nodeAfter,r),s++));for(let l=s;li&&Ai(n,e,i+1),o=r.depth>i&&Ai(t,r,i+1),l=[];return nn(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Nl(s,o),mt(gt(s,Dl(n,e,t,r,i+1)),l)):(s&&mt(gt(s,Qn(n,e,i+1)),l),nn(e,t,i,l),o&&mt(gt(o,Qn(t,r,i+1)),l)),nn(r,null,i,l),new k(l)}function Qn(n,e,t){let r=[];if(nn(null,n,t,r),n.depth>t){let i=Ai(n,e,t+1);mt(gt(i,Qn(n,e,t+1)),r)}return nn(e,null,t,r),new k(r)}function bu(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class yn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Zn(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=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new yn(t,r,s)}static resolveCached(e,t){let r=Hs.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Il(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=k.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};yt.prototype.text=void 0;class er extends yt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Il(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new er(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new er(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Il(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function js(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class xt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Cu(e,t);if(r.next==null)return xt.empty;let i=Rl(r);r.next&&r.err("Unexpected trailing text");let s=Nu(Ou(i));return Du(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +import{L as mu,i as gu}from"./index-BNWI_4R0.js";var Vs=Object.defineProperty,yu=(n,e)=>{let t={};for(var r in n)Vs(t,r,{get:n[r],enumerable:!0});return Vs(t,Symbol.toStringTag,{value:"Module"}),t};function Q(n){this.content=n}Q.prototype={constructor:Q,find:function(n){for(var e=0;e>1}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Cl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d=56320&&n<57344}function El(n){return n>=55296&&n<56320}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;re&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new k(r,i)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Rn(t+1,s):Rn(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return k.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};B.none=[];class gn extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Al(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(vl(this.content,e+this.openStart,t+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,t){if(!t)return w.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(k.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new w(e,r,i)}}w.empty=new w(k.empty,0,0);function vl(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vl(s.content,e-i-1,t-i-1)))}function Al(n,e,t,r,i,s){let{index:o,offset:l}=n.findIndex(e),a=n.maybeChild(o);if(l==e||a.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=Al(a.content,e-l-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,a);return c&&n.replaceChild(o,a.copy(c))}function ku(n,e,t){if(t.openStart>n.depth)throw new gn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gn("Inconsistent open depths");return Ol(n,e,t,0)}function Ol(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function nn(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(mt(n.nodeAfter,r),s++));for(let l=s;li&&Ai(n,e,i+1),o=r.depth>i&&Ai(t,r,i+1),l=[];return nn(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Nl(s,o),mt(gt(s,Dl(n,e,t,r,i+1)),l)):(s&&mt(gt(s,Qn(n,e,i+1)),l),nn(e,t,i,l),o&&mt(gt(o,Qn(t,r,i+1)),l)),nn(r,null,i,l),new k(l)}function Qn(n,e,t){let r=[];if(nn(null,n,t,r),n.depth>t){let i=Ai(n,e,t+1);mt(gt(i,Qn(n,e,t+1)),r)}return nn(e,null,t,r),new k(r)}function bu(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class yn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Zn(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=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new yn(t,r,s)}static resolveCached(e,t){let r=Hs.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Il(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=k.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};yt.prototype.text=void 0;class er extends yt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Il(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new er(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new er(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Il(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function js(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class xt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Cu(e,t);if(r.next==null)return xt.empty;let i=Rl(r);r.next&&r.err("Unexpected trailing text");let s=Nu(Ou(i));return Du(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` `)}}xt.empty=new xt(!0);class Cu{constructor(e,t){this.string=e,this.nodeTypes=t,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 Rl(n){let e=[];do e.push(Mu(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Mu(n){let e=[];do e.push(Tu(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Tu(n){let e=Au(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Eu(n,e);else break;return e}function Ws(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Eu(n,e){let t=Ws(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ws(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function vu(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Au(n){if(n.eat("(")){let e=Rl(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=vu(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ou(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new xt(r.indexOf(n.length-1)>-1);for(let o=0;o-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:Bl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new yt(this,this.computeAttrs(e),k.from(t),B.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new yt(this,this.computeAttrs(e),t,B.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(k.empty,!0);return s?new yt(this,e,t.append(s),B.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new $l(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Iu(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class Ru{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Iu(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Fr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=zl(e,i.attrs),this.excluded=null;let s=Pl(this.attrs);this.instance=s?new B(this,s):null}create(e=null){return!e&&this.instance?this.instance:new B(this,Bl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Fr(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Fl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Q.from(e.nodes),t.marks=Q.from(e.marks||{}),this.nodes=Us.compile(this.spec.nodes,this),this.marks=Fr.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=xt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?_s(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:_s(this,o.split(" "))}this.nodeFromJSON=i=>yt.fromJSON(this,i),this.markFromJSON=i=>B.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Us){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(t,r,i)}text(e,t){let r=this.nodes.text;return new er(r,r.defaultAttrs,e,B.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function _s(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Lu(n){return n.tag!=null}function Pu(n){return n.style!=null}class Xe{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Lu(i))this.tags.push(i);else if(Pu(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Js(this,t,!1);return r.addAll(e,B.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Js(this,t,!0);return r.addAll(e,B.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=Gs(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Gs(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Xe(e,Xe.schemaRules(e)))}}const Vl={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},Bu={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hl={ol:!0,ul:!0},kn=1,Ni=2,rn=4;function qs(n,e,t){return e!=null?(e?kn:0)|(e==="full"?Ni:0):n&&n.whitespace=="pre"?kn|Ni:t&~rn}class Ln{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=B.none,this.match=s||(o&rn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&kn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Js{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=qs(null,t.preserveWhitespace,0)|(r?rn:0);i?s=new Ln(i.type,i.attrs,B.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Ln(null,null,B.none,!0,null,o):s=new Ln(e.schema.topNodeType,null,B.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&Ni?"full":this.localPreserveWS||(i.options&kn)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,` `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o(o.type?o.type.allowsMarkType(c.type):Ys(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ln(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=kn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function zu(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function $u(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Gs(n){let e={};for(let t in n)e[t]=n[t];return e}function Ys(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&_n(Pn(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:_n(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Tt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Xs(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Xs(e.marks)}}function Xs(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Pn(n){return n.document||window.document}const Qs=new WeakMap;function Fu(n){let e=Qs.get(n);return e===void 0&&Qs.set(n,e=Vu(n)),e}function Vu(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-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 o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),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?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;du)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(n.createTextNode(f));else{let{dom:h,contentDOM:p}=_n(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const jl=65535,Wl=Math.pow(2,16);function Hu(n,e){return n+e*Wl}function Zs(n){return n&jl}function ju(n){return(n-(n&jl))/Wl}const Kl=1,Ul=2,qn=4,_l=8;class Di{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&_l)>0}get deletedBefore(){return(this.delInfo&(Kl|qn))>0}get deletedAfter(){return(this.delInfo&(Ul|qn))>0}get deletedAcross(){return(this.delInfo&qn)>0}}class de{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&de.empty)return de.empty}recover(e){let t=0,r=Zs(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Hu(l/3,e-a),m=0;return c&&(m|=e==a?Ul:e==d?Kl:qn,(t<0?e!=a:e!=d)&&(m|=_l)),new Di(h,m,p)}i+=u-c}return r?e+i:new Di(e+i,0,null)}touches(e,t){let r=0,i=Zs(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new bn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return K.fromReplace(e,this.from,this.to,s)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ge(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ge(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("addMark",Ge);class Ce extends se{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(ss(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return K.fromReplace(e,this.from,this.to,r)}invert(){return new Ge(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ce(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ce(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("removeMark",Ce);class Ye extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return K.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return K.fromReplace(e,this.pos,this.pos+1,new w(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new G(t.pos,r.pos,i,s,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new G(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}se.jsonID("replaceAround",G);function Ii(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Wu(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function Ku(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Fr){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;un.step(new Ce(o.from,o.to,o.style)))}function ls(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a=0;a--)n.step(o[a])}function Uu(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function _t(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+i,a=n.$to.indexAfter(r)-s;if(rt;p--)m||r.index(p)>0?(m=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new G(i,s,i,s,new w(r,0,0),t.length,!0))}function Yu(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&Xu(n.doc,n.mapping.slice(s).map(l),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&&Jl(n,o,l,s),ls(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let u=n.mapping.slice(s),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new G(d,f,d+1,f-1,new w(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&ql(n,o,l,s),!1}})}function ql(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Jl(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(` diff --git a/modules/boardwalk/dist/assets/index-BgYjF4nQ.js b/modules/boardwalk/dist/assets/index-BNWI_4R0.js similarity index 99% rename from modules/boardwalk/dist/assets/index-BgYjF4nQ.js rename to modules/boardwalk/dist/assets/index-BNWI_4R0.js index c9b045f3..318a5c2d 100644 --- a/modules/boardwalk/dist/assets/index-BgYjF4nQ.js +++ b/modules/boardwalk/dist/assets/index-BNWI_4R0.js @@ -8,4 +8,4 @@ Defaulting to \`null\`.`),null)}function IM(e){return Li(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${is}\`.`),is)}var qM=ae({__name:"ProgressRoot",props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:is},getValueLabel:{type:Function,required:!1,default:(e,t)=>Li(e)?`${Math.round(e/t*is)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["update:modelValue","update:max"],setup(e,{emit:t}){const n=e,a=t;Xe();const r=Pt(n,"modelValue",a,{passive:n.modelValue===void 0}),l=Pt(n,"max",a,{passive:n.max===void 0});Ve(()=>r.value,async s=>{const u=RM(s,n.max);u!==s&&(await Ye(),r.value=u)},{immediate:!0}),Ve(()=>n.max,s=>{const u=IM(n.max);u!==s&&(l.value=u)},{immediate:!0});const o=b(()=>gn(r.value)?"indeterminate":r.value===l.value?"complete":"loading");return PM({modelValue:r,max:l,progressState:o}),(s,u)=>(m(),V(i(tt),{"as-child":s.asChild,as:s.as,"aria-valuemax":i(l),"aria-valuemin":0,"aria-valuenow":Li(i(r))?i(r):void 0,"aria-valuetext":s.getValueText?.(i(r),i(l)),"aria-label":s.getValueLabel(i(r),i(l)),role:"progressbar","data-state":o.value,"data-value":i(r)??void 0,"data-max":i(l)},{default:N(()=>[be(s.$slots,"default",{modelValue:i(r)})]),_:3},8,["as-child","as","aria-valuemax","aria-valuenow","aria-valuetext","aria-label","data-state","data-value","data-max"]))}}),wc=qM,LM=ae({__name:"ProgressIndicator",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,n=MM();return Xe(),(a,r)=>(m(),V(i(tt),ze(t,{"data-state":i(n).progressState.value,"data-value":i(n).modelValue?.value??void 0,"data-max":i(n).max.value}),{default:N(()=>[be(a.$slots,"default")]),_:3},16,["data-state","data-value","data-max"]))}}),$c=LM;const NM="radio.select";function BM(e,t,n){pf(NM,n,{originalEvent:e,value:t})}var FM=ae({__name:"Radio",props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:checked","select"],setup(e,{emit:t}){const n=e,a=t,r=Pt(n,"checked",a,{passive:n.checked===void 0}),{value:l}=Wt(n),{forwardRef:o,currentElement:s}=Xe(),u=Df(s),d=b(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText??n.value:void 0);function c(f){n.disabled||BM(f,n.value,v=>{a("select",v),!v?.defaultPrevented&&(r.value=!0,u.value&&v.stopPropagation())})}return(f,v)=>(m(),V(i(tt),ze(f.$attrs,{id:f.id,ref:i(o),role:"radio",type:f.as==="button"?"button":void 0,as:f.as,"aria-checked":i(r),"aria-label":d.value,"as-child":f.asChild,disabled:f.disabled?"":void 0,"data-state":i(r)?"checked":"unchecked","data-disabled":f.disabled?"":void 0,value:i(l),required:f.required,name:f.name,onClick:vt(c,["stop"])}),{default:N(()=>[be(f.$slots,"default",{checked:i(r)}),i(u)&&f.name?(m(),V(i(Lf),{key:0,type:"radio",tabindex:"-1",value:i(l),checked:!!i(r),name:f.name,disabled:f.disabled,required:f.required},null,8,["value","checked","name","disabled","required"])):ne("v-if",!0)]),_:3},16,["id","type","as","aria-checked","aria-label","as-child","disabled","data-state","data-disabled","value","required","name"]))}}),VM=FM;const[zM,jM]=$t("RadioGroupRoot");var UM=ae({__name:"RadioGroupRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,{forwardRef:r,currentElement:l}=Xe(),o=Pt(n,"modelValue",a,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:u,orientation:d,name:c,required:f,dir:v}=Wt(n),p=La(v),h=Df(l);return jM({modelValue:o,changeModelValue:k=>{o.value=k},disabled:s,loop:u,orientation:d,name:c?.value,required:f}),(k,C)=>(m(),V(i(Gf),{"as-child":"",orientation:i(d),dir:i(p),loop:i(u)},{default:N(()=>[F(i(tt),{ref:i(r),role:"radiogroup","data-disabled":i(s)?"":void 0,"as-child":k.asChild,as:k.as,"aria-orientation":i(d),"aria-required":i(f),dir:i(p)},{default:N(()=>[be(k.$slots,"default",{modelValue:i(o)}),i(h)&&i(c)?(m(),V(i(Lf),{key:0,required:i(f),disabled:i(s),value:i(o),name:i(c)},null,8,["required","disabled","value","name"])):ne("v-if",!0)]),_:3},8,["data-disabled","as-child","as","aria-orientation","aria-required","dir"])]),_:3},8,["orientation","dir","loop"]))}}),k1=UM;const[Dz,HM]=$t("RadioGroupItem");var KM=ae({inheritAttrs:!1,__name:"RadioGroupItem",props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["select"],setup(e,{emit:t}){const n=e,a=t,{forwardRef:r,currentElement:l}=Xe(),o=zM(),s=b(()=>o.disabled.value||n.disabled),u=b(()=>o.required.value||n.required),d=b(()=>ns(o.modelValue?.value,n.value));HM({disabled:s,checked:d});const c=I(!1),f=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];Hl("keydown",p=>{f.includes(p.key)&&(c.value=!0)}),Hl("keyup",()=>{c.value=!1});function v(){setTimeout(()=>{c.value&&l.value?.click()},0)}return(p,h)=>(m(),V(i(Yf),{checked:d.value,disabled:s.value,"as-child":"",focusable:!s.value,active:d.value},{default:N(()=>[F(VM,ze({...p.$attrs,...n},{ref:i(r),checked:d.value,required:u.value,disabled:s.value,"onUpdate:checked":h[0]||(h[0]=k=>i(o).changeModelValue(p.value)),onSelect:h[1]||(h[1]=k=>a("select",k)),onKeydown:h[2]||(h[2]=Oa(vt(()=>{},["prevent"]),["enter"])),onFocus:v}),{default:N(()=>[be(p.$slots,"default",{checked:d.value,required:u.value,disabled:s.value})]),_:3},16,["checked","required","disabled"])]),_:3},8,["checked","disabled","focusable","active"]))}}),w1=KM,WM=ae({__name:"BaseSeparator",props:{orientation:{type:String,required:!1,default:"horizontal"},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,n=["horizontal","vertical"];function a(s){return n.includes(s)}const r=b(()=>a(t.orientation)?t.orientation:"horizontal"),l=b(()=>r.value==="vertical"?t.orientation:void 0),o=b(()=>t.decorative?{role:"none"}:{"aria-orientation":l.value,role:"separator"});return(s,u)=>(m(),V(i(tt),ze({as:s.as,"as-child":s.asChild,"data-orientation":r.value},o.value),{default:N(()=>[be(s.$slots,"default")]),_:3},16,["as","as-child","data-orientation"]))}}),GM=WM;const[YM,JM]=$t("TimeFieldRoot");function Us(e,t=ws(Un())){return e&&"day"in e?e:ia(t,e)}var ZM=ae({inheritAttrs:!1,__name:"TimeFieldRoot",props:{defaultValue:{type:Object,required:!1,default:void 0},defaultPlaceholder:{type:Object,required:!1},placeholder:{type:Object,required:!1,default:void 0},modelValue:{type:[Object,null],required:!1},hourCycle:{type:null,required:!1},step:{type:Object,required:!1},stepSnapping:{type:Boolean,required:!1,default:!1},granularity:{type:String,required:!1},hideTimeZone:{type:Boolean,required:!1},maxValue:{type:Object,required:!1},minValue:{type:Object,required:!1},locale:{type:String,required:!1},disabled:{type:Boolean,required:!1,default:!1},readonly:{type:Boolean,required:!1,default:!1},id:{type:String,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue","update:placeholder"],setup(e,{expose:t,emit:n}){const a=e,r=n,{disabled:l,readonly:o,granularity:s,defaultValue:u,minValue:d,maxValue:c,stepSnapping:f,dir:v,locale:p}=Wt(a),h=_u(p),k=La(v),C=Of(h.value,{hourCycle:ls(a.hourCycle)}),{primitiveElement:x,currentElement:S}=Ur(),q=I(new Set),O=b(()=>Db(a)),E=b(()=>d.value?Us(d.value):void 0),R=b(()=>c.value?Us(c.value):void 0);Ct(()=>{Bv(S.value).forEach(me=>q.value.add(me))});const L=Pt(a,"modelValue",r,{defaultValue:u.value,passive:a.modelValue===void 0}),K=b({get(){return gn(L.value)?L.value:Us(L.value)},set(me){return me?L.value=L.value&&"day"in L.value?me:new na(me.hour,me.minute,me.second,L.value?.millisecond):L.value=me,me}}),$=GA({defaultPlaceholder:a.placeholder,defaultValue:L.value}),M=Pt(a,"placeholder",r,{defaultValue:a.defaultPlaceholder??$.copy(),passive:a.placeholder===void 0}),H=b({get(){return Us(M.value)},set(me){return me&&(M.value="day"in M.value?me.copy():new na(me.hour,me.minute,me.second,M.value?.millisecond)),me}}),P=b(()=>s.value?s.value:"minute"),W=b(()=>L.value?!!(E.value&&nr(K.value,E.value)||R.value&&nr(R.value,K.value)):!1),Z=E4(P.value),U=I(L.value?{...Ed({value:K.value,formatter:C})}:{...Z}),j=b(()=>s1({granularity:P.value,dateRef:H.value,formatter:C,hideTimeZone:a.hideTimeZone,hourCycle:a.hourCycle,segmentValues:U.value,locale:h,isTimeValue:!0})),le=b(()=>{const me=j.value.arr;return a.hourCycle===12?me.map(Y=>{if(Y.part==="hour"&&"hour"in U.value){const fe=U.value.hour;if(fe!==null){const G=fe===0?12:fe>12?fe-12:fe;return{...Y,value:G.toString()}}}return Y}):me}),ue=b(()=>le.value.filter(({part:me})=>me!=="literal"));Ve(h,me=>{C.getLocale()!==me&&(C.setLocale(me),Ye(()=>{q.value.clear(),Bv(S.value).forEach(Y=>q.value.add(Y))}))}),Ve(K,me=>{!gn(me)&&(!Rl(H.value,me)||H.value.compare(me)!==0)&&(M.value=me.copy())}),Ve([K,h],([me])=>{gn(me)?Object.values(U.value).every(Y=>Y!==null)&&gn(me)&&(U.value={...Z}):U.value={...Ed({value:me,formatter:C})}});const we=I(null),De=b(()=>Array.from(q.value).findIndex(me=>me.getAttribute("data-reka-time-field-segment")===we.value?.getAttribute("data-reka-time-field-segment"))),Ae=b(()=>{const me=k.value==="rtl"?-1:1;return(me<0?De.value<0:De.value>q.value.size-1)?null:Array.from(q.value)[De.value+me]}),ie=b(()=>{const me=k.value==="rtl"?-1:1;return(me>0?De.value<0:De.value>q.value.size-1)?null:Array.from(q.value)[De.value-me]}),_e=Jl();function z(me){me.isComposing||ha(me.key)&&(me.key===_e.ARROW_LEFT&&ie.value?.focus(),me.key===_e.ARROW_RIGHT&&Ae.value?.focus())}function ke(me){we.value=me}return JM({locale:h,modelValue:K,placeholder:H,disabled:l,formatter:C,hourCycle:a.hourCycle,step:O,stepSnapping:f,readonly:o,segmentValues:U,isInvalid:W,segmentContents:ue,elements:q,setFocusedElement:ke,focusNext(){Ae.value?.focus()}}),t({setFocusedElement:ke}),(me,Y)=>(m(),V(i(tt),ze(me.$attrs,{ref_key:"primitiveElement",ref:x,role:"group","aria-disabled":i(l)?!0:void 0,"data-disabled":i(l)?"":void 0,"data-readonly":i(o)?"":void 0,"data-invalid":W.value?"":void 0,dir:i(k),onKeydown:Oa(z,["left","right"])}),{default:N(()=>[be(me.$slots,"default",{modelValue:i(L),segments:le.value,isInvalid:W.value}),F(i(qf),{id:me.id,as:"input",feature:"focusable",tabindex:"-1",value:i(L)?i(L).toString():"",name:me.name,disabled:i(l),required:me.required,onFocus:Y[0]||(Y[0]=fe=>Array.from(q.value)?.[0]?.focus())},null,8,["id","value","name","disabled","required"])]),_:3},16,["aria-disabled","data-disabled","data-readonly","data-invalid","dir"]))}}),zv=ZM,XM=ae({__name:"TimeFieldInput",props:{part:{type:null,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,n=YM(),a=I(!0),r=I(!1),{handleSegmentClick:l,handleSegmentKeydown:o,handleSegmentBeforeInput:s,handleSegmentCompositionStart:u,handleSegmentCompositionEnd:d,handleSegmentFocusOut:c,attributes:f}=i1({hasLeftFocus:a,lastKeyZero:r,placeholder:n.placeholder,hourCycle:n.hourCycle,step:n.step,stepSnapping:n.stepSnapping,segmentValues:n.segmentValues,formatter:n.formatter,part:t.part,disabled:n.disabled,readonly:n.readonly,focusNext:n.focusNext,modelValue:n.modelValue}),v=b(()=>n.disabled.value),p=b(()=>n.readonly.value),h=b(()=>n.isInvalid.value);return(k,C)=>(m(),V(i(tt),ze({as:k.as,"as-child":k.asChild},i(f),{contenteditable:v.value||p.value?!1:k.part!=="literal","data-reka-time-field-segment":k.part,"aria-disabled":v.value?!0:void 0,"aria-readonly":p.value?!0:void 0,"data-disabled":v.value?"":void 0,"data-invalid":h.value?"":void 0,"aria-invalid":h.value?!0:void 0},Ay(k.part!=="literal"?{mousedown:i(l),keydown:i(o),beforeinput:i(s),compositionstart:i(u),compositionend:i(d),focusout:()=>{a.value=!0,i(c)()},focusin:x=>{i(n).setFocusedElement(x.target)}}:{})),{default:N(()=>[be(k.$slots,"default")]),_:3},16,["as","as-child","contenteditable","data-reka-time-field-segment","aria-disabled","aria-readonly","data-disabled","data-invalid","aria-invalid"]))}}),jv=XM,QM=ae({__name:"ToolbarButton",props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(e){const t=e,{forwardRef:n}=Xe();return(a,r)=>(m(),V(i(Yf),{"as-child":"",focusable:!a.disabled},{default:N(()=>[F(i(tt),ze({ref:i(n),type:a.as==="button"?"button":void 0},t),{default:N(()=>[be(a.$slots,"default")]),_:3},16,["type"])]),_:3},8,["focusable"]))}}),_o=QM;const[e5,t5]=$t("ToolbarRoot");var n5=ae({__name:"ToolbarRoot",props:{orientation:{type:String,required:!1,default:"horizontal"},dir:{type:String,required:!1},loop:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{orientation:n,dir:a}=Wt(t),r=La(a),{forwardRef:l}=Xe();return t5({orientation:n,dir:r}),(o,s)=>(m(),V(i(Gf),{"as-child":"",orientation:i(n),dir:i(r),loop:o.loop},{default:N(()=>[F(i(tt),{ref:i(l),role:"toolbar","aria-orientation":i(n),"as-child":o.asChild,as:o.as},{default:N(()=>[be(o.$slots,"default")]),_:3},8,["aria-orientation","as-child","as"])]),_:3},8,["orientation","dir","loop"]))}}),a5=n5,r5=ae({__name:"ToolbarSeparator",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,n=e5();return Xe(),(a,r)=>(m(),V(GM,{orientation:i(n).orientation.value,"as-child":t.asChild,as:a.as},{default:N(()=>[be(a.$slots,"default")]),_:3},8,["orientation","as-child","as"]))}}),Cc=r5;const l5=/^filter\[(.+)\]$/,o5=/^[1-9]\d*$/;function pl(e){const t=Array.isArray(e)?e[e.length-1]:e;return typeof t=="string"?t:""}function Uv(e){return o5.test(e)?Number(e):void 0}function $1(e){const t={},n=pl(e.search).trim();n!==""&&(t.search=n);const a=pl(e.sort).trim();if(a!==""){t.sort=a;const s=pl(e.dir);t.dir=s==="desc"?"desc":"asc"}const r=Uv(pl(e.page));r!==void 0&&(t.page=r);const l=Uv(pl(e.per_page));l!==void 0&&(t.per_page=l);const o={};for(const s of Object.keys(e).sort()){const u=l5.exec(s)?.[1],d=pl(e[s]);u&&d!==""&&(o[u]=d)}return Object.keys(o).length>0&&(t.filter=o),t}function Ni(e){const t={};e.search&&(t.search=e.search),e.sort&&(t.sort=e.sort,t.dir=e.dir==="desc"?"desc":"asc"),e.page!==void 0&&e.page>1&&(t.page=String(e.page)),e.per_page!==void 0&&(t.per_page=String(e.per_page));for(const n of Object.keys(e.filter??{}).sort()){const a=e.filter?.[n];a!==void 0&&a!==""&&(t[`filter[${n}]`]=a)}return t}function Sl(e){return JSON.stringify(Ni(e))}const C1="summer-admin.list:",s5=Sl({});let Td=null;function Au(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function S1(e){return`${C1}${e}:`}function E1(e){return Td===null?null:S1(Td)+e}function Od(e){try{Au()?.removeItem(e)}catch{}}function Hv(e){const t=Au();if(t)try{const n=[];for(let a=0;a!0);return}const n=S1(t);Hv(a=>!a.startsWith(n))}function i5(e){const t=E1(e);if(t===null)return{};let n=null;try{n=Au()?.getItem(t)??null}catch{return{}}if(n===null)return{};let a;try{a=JSON.parse(n)}catch{return Od(t),{}}return typeof a!="object"||a===null||Array.isArray(a)||Object.getPrototypeOf(a)!==Object.prototype||!Object.values(a).every(r=>typeof r=="string")?(Od(t),{}):$1(a)}function Hs(e,t){const n=E1(e);if(n!==null){if(Sl(t)===s5){Od(n);return}try{Au()?.setItem(n,JSON.stringify(Ni(t)))}catch{}}}const Nr=I(null),A1=I(null);let Ko=null;function T1(e){O1(),A1.value=e,!(e===null||e<=0)&&(Ko=setTimeout(()=>{Ko=null,ef()},e*800))}function O1(){Ko!==null&&(clearTimeout(Ko),Ko=null)}Bw(T1);const un=kt(Nr);async function u5(e,t){const{data:n,response:a}=await Ne.POST("/auth/login",{body:{login:e,password:t}});return!a.ok||!n?!1:(T1(typeof n.data.expires_in=="number"?n.data.expires_in:null),!0)}async function D1(){const{data:e,response:t}=await Ne.GET("/auth/me");return Nr.value=t.ok&&e?e.data:null,Qf(Nr.value?.id??null),await tE(Nr.value),Nr.value}function M1(e){if(!e)return"";const t=[e.first_name,e.last_name].map(n=>n.trim()).filter(Boolean);return t.length>0?t.slice(0,2).map(n=>n.charAt(0).toUpperCase()).join(""):e.login.slice(0,2).toUpperCase()}function Sc(e){Nr.value=e,Qf(e.id)}function P1(){O1(),Nr.value=null,A1.value=null,Qf(null)}function c5(e){P1();const t=e.currentRoute.value;t.name!=="login"&&e.push({name:"login",query:{redirect:t.fullPath}}).catch(()=>{})}async function d5(e){try{await Ne.POST("/auth/logout")}catch{}finally{P1(),Hw([]),Gw([])}e&&await e.replace({name:"login"}).catch(()=>{})}const f5=["src"],p5={key:1,class:"flex size-[34px] shrink-0 items-center justify-center rounded-full bg-accent text-[13px] font-bold text-on-accent","aria-hidden":"true","data-user-initials":""},m5={class:"flex flex-col leading-tight max-[1099px]:hidden","data-user-identity":""},v5={class:"font-semibold"},h5={key:0,class:"text-[12px] text-muted","data-user-role":""},y5={class:"flex items-center gap-3 px-2 py-2"},g5=["src"],b5={key:1,class:"flex size-10 shrink-0 items-center justify-center rounded-full bg-accent text-[14px] font-bold text-on-accent","aria-hidden":"true"},_5={class:"flex min-w-0 flex-col leading-tight"},x5={class:"truncate font-bold"},k5={class:"truncate text-[13px] text-muted"},w5={class:"flex size-[18px] items-center justify-center"},$5=ae({__name:"UserMenu",setup(e){const t=br(),n=b(()=>{const v=un.value;if(!v)return"";const p=`${v.first_name} ${v.last_name}`.trim();return p===""?v.login:p}),a=b(()=>M1(un.value)),r=b(()=>un.value?.avatar?.thumb_url||un.value?.avatar?.url||""),l=b(()=>un.value?.role?.name??""),o=b(()=>YS.value||sa.value);function s(v){try{const p=new Intl.DisplayNames([v],{type:"language"}).of(v);if(p&&p!==v)return p.charAt(0).toLocaleUpperCase(v)+p.slice(1)}catch{}return v.toUpperCase()}const u=b(()=>zw.value.map(v=>({code:v,name:s(v)})));function d(v){typeof v=="string"&&v!==""&&nE(v)}async function c(){await t.push({name:"account"}).catch(()=>{})}async function f(){await d5(t)}return(v,p)=>(m(),V(i(g1),{modal:!1},{default:N(()=>[F(i(x1),{"data-user-menu":"",disabled:!i(un),"aria-label":`${i(_)("backend::lang.nav.user_menu")}: ${n.value}`,class:"flex h-input items-center gap-2.5 rounded-inner px-2 text-left transition-colors duration-150 ease-out hover:bg-hover"},{default:N(()=>[r.value?(m(),g("img",{key:0,src:r.value,alt:"","data-user-avatar":"",class:"size-[34px] shrink-0 rounded-full object-cover"},null,8,f5)):(m(),g("span",p5,T(a.value),1)),w("span",m5,[w("span",v5,T(n.value),1),l.value?(m(),g("span",h5,T(l.value),1)):ne("",!0)]),F(i(sr),{size:16,class:"text-muted","aria-hidden":"true"})]),_:1},8,["disabled","aria-label"]),F(i(_1),null,{default:N(()=>[F(i(b1),{"data-user-menu-content":"",align:"end","side-offset":8,class:"z-50 flex w-[280px] flex-col rounded-[14px] border border-border bg-surface p-2 text-text shadow-menu"},{default:N(()=>[w("div",y5,[r.value?(m(),g("img",{key:0,src:r.value,alt:"","data-user-avatar":"",class:"size-10 shrink-0 rounded-full object-cover"},null,8,g5)):(m(),g("span",b5,T(a.value),1)),w("span",_5,[w("span",x5,T(n.value),1),w("span",k5,T(i(un)?.email),1)])]),F(i(Ad),{"data-action":"account",class:"flex h-10 cursor-pointer items-center gap-2.5 rounded-control px-3 font-medium outline-none transition-colors duration-150 ease-out data-[highlighted]:bg-hover",onSelect:c},{default:N(()=>[F(i(OS),{size:18,"aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.myaccount.menu_label")),1)]),_:1}),u.value.length>1?(m(),g(pe,{key:0},[F(i(Vv),{class:"my-1 h-px bg-border"}),F(i($M),{class:"px-3 pt-1 pb-1 text-[12px] font-semibold text-muted","data-language-label":""},{default:N(()=>[xe(T(i(_)("backend::lang.nav.language")),1)]),_:1}),F(i(EM),{"model-value":o.value,"onUpdate:modelValue":d},{default:N(()=>[(m(!0),g(pe,null,Re(u.value,h=>(m(),V(i(TM),{key:h.code,value:h.code,"data-locale-option":h.code,lang:h.code,class:"flex h-10 cursor-pointer items-center gap-2.5 rounded-control px-3 font-medium outline-none transition-colors duration-150 ease-out data-[highlighted]:bg-hover"},{default:N(()=>[w("span",w5,[F(i(kM),null,{default:N(()=>[F(i(Da),{size:18,"aria-hidden":"true"})]),_:1})]),w("span",null,T(h.name),1)]),_:2},1032,["value","data-locale-option","lang"]))),128))]),_:1},8,["model-value"])],64)):ne("",!0),F(i(Vv),{class:"my-1 h-px bg-border"}),F(i(Ad),{"data-action":"logout",class:"flex h-10 cursor-pointer items-center gap-2.5 rounded-control px-3 font-medium outline-none transition-colors duration-150 ease-out data-[highlighted]:bg-hover",onSelect:f},{default:N(()=>[F(i(Lg),{size:18,"aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.auth.logout")),1)]),_:1})]),_:1})]),_:1})]),_:1}))}}),C5=["role","data-tone"],S5={class:"font-medium"},E5=["aria-label","onClick"],A5=ae({__name:"Toast",setup(e){return(t,n)=>(m(),V(fk,{tag:"div",name:"toast",class:"pointer-events-none fixed inset-x-0 bottom-[88px] z-50 flex flex-col items-center gap-2 px-4"},{default:N(()=>[(m(!0),g(pe,null,Re(i(WS),a=>(m(),g("div",{key:a.id,role:a.tone==="danger"?"alert":"status","data-tone":a.tone,class:"pointer-events-auto flex max-w-[560px] items-center gap-3 rounded-[14px] bg-[#1d2740] py-3 pr-2.5 pl-3.5 text-white shadow-toast"},[w("span",{class:he([a.tone==="danger"?"bg-[#f58a8a] text-[#1d2740]":"bg-accent text-on-accent","flex size-[26px] shrink-0 items-center justify-center rounded-full"]),"aria-hidden":"true"},[a.tone==="danger"?(m(),V(i(bt),{key:0,size:16})):(m(),V(i(Da),{key:1,size:16}))],2),w("span",S5,T(a.text),1),w("button",{type:"button","aria-label":i(_)("backend::lang.form.close"),class:"flex size-8 items-center justify-center rounded-pager text-[#c3cbda] transition-colors duration-150 ease-out hover:bg-side-hover hover:text-white",onClick:r=>i(Gg)(a.id)},[F(i(ln),{size:16,"aria-hidden":"true"})],8,E5)],8,C5))),128))]),_:1}))}}),T5=[{combo:"mod+s",labelKey:"backend::lang.form.save"},{combo:"mod+enter",labelKey:"backend::lang.form.save_and_close"},{combo:"mod+shift+s",labelKey:"backend::lang.form.create_and_new"},{combo:"escape",labelKey:"backend::lang.shortcuts.leave"},{combo:"/",labelKey:"backend::lang.shortcuts.search"},{combo:"?",labelKey:"backend::lang.shortcuts.help"}],O5=new Set(["mod+s","mod+enter","mod+shift+s"]);function ep(e){const t=typeof navigator>"u"?"":navigator.platform||"";return/mac|iphone|ipad|ipod/i.test(t)}function D5(e){if(/^[a-z]$/i.test(e.key))return e.key.toLowerCase();const t=/^Key([A-Z])$/.exec(e.code??"");return t?t[1].toLowerCase():""}function R1(e){if(e.isComposing)return null;if(e.ctrlKey||e.metaKey)return e.altKey?null:e.key==="Enter"?e.shiftKey?null:"mod+enter":D5(e)==="s"?e.shiftKey?"mod+shift+s":"mod+s":null;if(e.altKey)return null;switch(e.key){case"Escape":return"escape";case"/":return"/";case"?":return"?";default:return null}}function M5(e){if(!e||typeof e.closest!="function")return!1;const t=e;return t.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"])')!==null?!0:t.tagName.includes("-")&&t.closest('form, [role="form"]')!==null}function P5(e){return(typeof e.composedPath=="function"?e.composedPath():[])[0]??e.target}function I1(e,t=ep()){switch(e){case"mod+s":return t?["⌘","S"]:["Ctrl","S"];case"mod+enter":return t?["⌘","↩"]:["Ctrl","Enter"];case"mod+shift+s":return t?["⇧","⌘","S"]:["Ctrl","Shift","S"];case"escape":return["Esc"];default:return[e]}}function R5(e,t=ep()){return I1(e,t).join(t?"":"+")}function qn(e,t,n=ep()){return _("backend::lang.shortcuts.hint",{label:e,keys:R5(t,n)})}const Kv={"mod+s":"Control+S Meta+S","mod+enter":"Control+Enter Meta+Enter","mod+shift+s":"Control+Shift+S Meta+Shift+S",escape:"Escape","/":"/","?":"?"};function Tu(e){return e.split(/\s+/).filter(t=>t in Kv).map(t=>Kv[t]).join(" ")}function q1(e=document){return Array.from(e.querySelectorAll('[role="dialog"][aria-modal="true"], [role="alertdialog"]')).filter(n=>n.getAttribute("data-state")!=="closed").at(-1)??e}function tp(e,t){return t.querySelector(`[data-hotkey~="${e}"]`)}function I5(e=document){const t=q1(e);return T5.filter(n=>n.combo==="?"||tp(n.combo,t)!==null)}const np=I(null),Wv=kt(np);function q5(){np.value=I5()}function L1(){np.value=null}function N1(e){return e.disabled===!0||e.getAttribute("aria-disabled")==="true"}function Gv(e){const t=R1(e);if(!t||!O5.has(t))return;t==="mod+s"&&e.preventDefault();const n=e.target?.ownerDocument??document,a=tp(t,q1(n));if(!a||(e.preventDefault(),e.stopPropagation(),e.repeat||N1(a)))return;const r=Yv(n),l=r instanceof HTMLElement&&r!==a&&r!==n.body?r:null;l&&(a.focus({preventScroll:!0}),Yv(n)===l&&l.blur()),a.click();const o=n.activeElement;l?.isConnected&&(o===a||o===n.body||o===null)&&l.focus({preventScroll:!0})}function Yv(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Jv(e){const t=R1(e);if(t!=="escape"&&t!=="/"&&t!=="?"||e.defaultPrevented||M5(P5(e)))return;const n=e.target?.ownerDocument??document;if(n.querySelector("[data-dismissable-layer]"))return;if(t==="?"){e.preventDefault(),q5();return}const a=tp(t,n);!a||N1(a)||(e.preventDefault(),a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement?(a.focus(),a.select()):a.click())}let Ks=0;function L5(){Ks===0&&(window.addEventListener("keydown",Gv,!0),window.addEventListener("keydown",Jv)),Ks++;let e=!1;return()=>{e||(e=!0,Ks--,Ks===0&&(window.removeEventListener("keydown",Gv,!0),window.removeEventListener("keydown",Jv)))}}const N5={class:"flex items-start gap-3"},B5={class:"flex min-w-0 flex-1 flex-col gap-1"},F5={class:"flex flex-col gap-2.5"},V5=["data-shortcut"],z5={class:"flex shrink-0 items-center gap-1"},j5={class:"text-right text-muted"},U5=ae({__name:"ShortcutHelpDialog",setup(e){function t(n){n||L1()}return(n,a)=>(m(),V(i(Jr),{open:i(Wv)!==null,"onUpdate:open":t},{default:N(()=>[F(i(Xl),null,{default:N(()=>[F(i(Xr),{"data-dialog-overlay":"",class:"fixed inset-0 z-40 bg-overlay"}),F(i(Zr),{"data-shortcut-help":"","data-dialog-content":"","aria-modal":"true",class:"fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100vh-32px)] w-[calc(100%-32px)] max-w-[440px] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-y-auto rounded-modal bg-surface p-6 text-text shadow-pop"},{default:N(()=>[w("div",N5,[w("div",B5,[F(i(Qr),{class:"text-[20px] font-bold tracking-[-0.01em]"},{default:N(()=>[xe(T(i(_)("backend::lang.shortcuts.title")),1)]),_:1}),F(i(dr),{class:"text-muted"},{default:N(()=>[xe(T(i(_)("backend::lang.shortcuts.description")),1)]),_:1})]),F(i(Hr),{"data-action":"close","aria-label":i(_)("backend::lang.form.close"),class:"flex size-[34px] shrink-0 items-center justify-center rounded-tab bg-subtle text-muted hover:bg-hover hover:text-text"},{default:N(()=>[F(i(ln),{size:16,"aria-hidden":"true"})]),_:1},8,["aria-label"])]),w("dl",F5,[(m(!0),g(pe,null,Re(i(Wv)??[],r=>(m(),g("div",{key:r.combo,"data-shortcut":r.combo,class:"flex items-center justify-between gap-4"},[w("dt",z5,[(m(!0),g(pe,null,Re(i(I1)(r.combo),l=>(m(),g("kbd",{key:l,class:"inline-flex min-w-6 items-center justify-center rounded-pager border border-border bg-subtle px-1.5 font-mono text-[13px]"},T(l),1))),128))]),w("dd",j5,T(i(_)(r.labelKey)),1)],8,V5))),128))])]),_:1})]),_:1})]),_:1},8,["open"]))}}),H5={class:"flex min-w-0 flex-1 flex-col"},K5={class:"flex h-header shrink-0 items-center justify-between gap-4 border-b border-border bg-surface pr-6 pl-8"},W5={class:"flex shrink-0 items-center gap-1"},G5=["title","aria-label"],Y5={class:"min-w-0 flex-1 px-8 py-7"},J5=ae({__name:"AppShell",setup(e){const t=Mn(),{collapsed:n,watchViewport:a}=Xg(),r=a();Dt(r);const l=L5();Dt(()=>{l(),L1()});const o=`${window.location.origin}/`,s=b(()=>ys(String(t.params.vendor??""),String(t.params.plugin??""))),u=b(()=>s.value?null:t.name==="settings-form"?Nm(es(String(t.params.code??""))):Nm(uu(Gl(t.path)))),d=b(()=>(s.value||u.value)&&!n.value?"calc(var(--spacing-rail) + var(--spacing-panel))":"var(--spacing-rail)");return(c,f)=>(m(),g("div",{class:"flex min-h-screen bg-bg text-text",style:Tn({"--shell-offset":d.value})},[F(hE),s.value&&!i(n)?(m(),V(xE,{key:0,entry:s.value},null,8,["entry"])):u.value&&!i(n)?(m(),V(SE,{key:1,section:u.value},null,8,["section"])):ne("",!0),w("div",H5,[w("header",K5,[F(OE),w("div",W5,[w("a",{"data-view-site":"",href:o,target:"_blank",rel:"noopener noreferrer",title:i(_)("backend::lang.nav.view_site"),"aria-label":i(_)("backend::lang.nav.view_site"),class:"flex size-input items-center justify-center rounded-inner text-muted transition-colors duration-150 ease-out hover:bg-hover hover:text-text"},[F(i(Pg),{class:"size-[18px]","aria-hidden":"true"})],8,G5),F($5)])]),w("main",Y5,[be(c.$slots,"default")])]),F(A5),F(U5)],4))}}),B1=I(0),Z5=kt(B1);function X5(){B1.value++}const Q5=ae({__name:"App",setup(e){const t=Mn(),n=b(()=>t.meta.shell===!0);return xn(()=>{document.title=Jw(t)}),(a,r)=>n.value?(m(),V(J5,{key:0},{default:N(()=>[F(i(ld),null,{default:N(({Component:l,route:o})=>[(m(),V(Vt(l),{key:`${o.path}#${i(Z5)}`}))]),_:1})]),_:1})):(m(),V(i(ld),{key:1}))}}),e6="data-summer-controller",F1="*",Ec=new Map,Dd=new Map;let V1="";function z1(){return`${iu.base}/assets/`}function j1(e){if(!e.startsWith(z1())||e.includes("\\"))return!1;for(const n of e){const a=n.codePointAt(0)??0;if(a<=32||a===127)return!1}return!(e.split(/[?#]/,1)[0]??"").split("/").some(n=>{const a=n.toLowerCase().replaceAll("%2e",".");return a==="."||a===".."})}function U1(e){if(!j1(e))return Promise.reject(new Error(`plugin script outside ${z1()}: ${e}`));const t=Ec.get(e);if(t)return t;const n=new Promise((a,r)=>{const l=document.createElement("script");l.type="module",l.addEventListener("load",()=>a(),{once:!0}),l.addEventListener("error",()=>{Ec.delete(e),l.remove(),r(new Error(`plugin script failed to load: ${e}`))},{once:!0}),l.src=e,document.head.appendChild(l)});return Ec.set(e,n),n}function H1(e,t){for(const n of t){const a=`${e} ${n}`;if(!j1(n)||Dd.has(a))continue;const r=document.createElement("link");r.rel="stylesheet",r.setAttribute(e6,e),r.disabled=!K1(e),r.href=n,Dd.set(a,{owner:e,link:r}),document.head.appendChild(r)}}function t6(e){V1=e;for(const{owner:t,link:n}of Dd.values())n.disabled=!K1(t)}function K1(e){return e===F1||e===V1}function n6(e){H1(F1,e)}async function ap(e,t){H1(e,t?.styles??[]);const n=t?.scripts??[],a=await Promise.allSettled(n.map(r=>U1(r)));return n.filter((r,l)=>a[l]?.status==="rejected")}const W1=new Map;async function G1(){let e=[];try{const{data:t,response:n}=await Ne.GET("/field-types");e=n.ok&&t?t.data:[]}catch{return[]}for(const t of e){n6(t.styles??[]);const n=t.scripts??[];W1.set(t.element,Promise.allSettled(n.map(a=>U1(a))).then(a=>n.filter((r,l)=>a[l]?.status==="rejected")))}return e}function a6(e){return W1.get(e)??Promise.resolve([])}const r6={class:"flex min-h-screen items-center justify-center px-4",style:{background:"radial-gradient(ellipse at 50% 35%, #2b3a5c 0%, #1d2740 60%)"}},l6={class:"flex w-full max-w-[400px] flex-col gap-6"},o6={class:"flex items-center justify-center gap-3"},s6={class:"flex size-[34px] items-center justify-center rounded-full bg-accent-soft"},i6={class:"text-[22px] font-bold tracking-[-0.02em]"},u6={class:"flex flex-col gap-1.5"},c6={class:"font-semibold"},d6={class:"flex flex-col gap-1.5"},f6={class:"font-semibold"},p6=["aria-invalid"],m6={key:0,role:"alert",class:"flex items-center gap-2.5 rounded-control bg-[#fdf0f0] px-3.5 py-3 text-[#c62828]"},v6=["disabled"],h6=ae({__name:"LoginView",setup(e){const t=Mn(),n=br(),a=I(""),r=I(""),l=I(!1),o=I(!1);async function s(){if(!o.value){o.value=!0,l.value=!1;try{if(!await u5(a.value.trim(),r.value)||!await D1()){l.value=!0;return}r.value="",await Promise.all([wg(),$g().catch(()=>[]),G1()]),await n.replace(q0(t.query.redirect)??"/")}finally{o.value=!1}}}return(u,d)=>(m(),g("main",r6,[w("div",l6,[w("div",o6,[w("span",s6,[F(i(fu),{size:20,class:"text-accent","aria-hidden":"true"})]),d[2]||(d[2]=w("span",{class:"text-[18px] font-bold text-white"},[xe("Summer"),w("span",{class:"text-accent"},"CMS")],-1))]),w("form",{class:"flex flex-col gap-[18px] rounded-card bg-white p-8 text-[#141b2d] shadow-login",novalidate:"",onSubmit:vt(s,["prevent"])},[w("h1",i6,T(i(_)("backend::lang.auth.title")),1),w("label",u6,[w("span",c6,T(i(_)("backend::lang.auth.login")),1),oa(w("input",{"onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),name:"login",type:"text",autocomplete:"username",required:"",class:"h-input rounded-control border border-[#d2d8e2] bg-white px-3.5"},null,512),[[Vl,a.value]])]),w("label",d6,[w("span",f6,T(i(_)("backend::lang.auth.password")),1),oa(w("input",{"onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),name:"password",type:"password",autocomplete:"current-password",required:"","aria-invalid":l.value?"true":void 0,class:he([l.value?"border-[#c62828]":"border-[#d2d8e2]","h-input rounded-control border bg-white px-3.5"])},null,10,p6),[[Vl,r.value]])]),l.value?(m(),g("div",m6,[F(i(bt),{size:18,"aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.auth.invalid")),1)])):ne("",!0),w("button",{type:"submit",disabled:o.value,class:"h-input rounded-control bg-[#22304d] font-semibold text-white disabled:opacity-60"},T(i(_)("backend::lang.auth.submit")),9,v6)],32)])]))}}),Zv=/^\d+$/;function Y1(e,t,n){const a=ou(t),r=zn(t);if(!a||!r)return"/";const o=((e??"").trim().split(/[?#]/,1)[0]??"").split("/").filter(c=>c!==""),s=[a.vendor,a.plugin,a.controller];if(!s.every((c,f)=>o[f]?.toLowerCase()===c.toLowerCase()))return r;const d=o.slice(s.length);if(d.length===0)return r;if(d.length===1&&d[0]==="create")return`${r}/create`;if(d.length===2&&d[0]==="update"){const c=d[1]===":id"?String(n??""):d[1]??"";return Zv.test(c)?`${r}/${c}`:r}if(d.length===2&&d[0]==="preview"){const c=d[1]===":id"?String(n??""):d[1]??"";return Zv.test(c)?`${r}/${c}/preview`:r}return r}const Xv=/^[0-9]+$/;function y6(e,t){const n=e.replace(/[\s ]/g,"");if(n==="")return{value:null,error:null};let a=n,r=!1;a.startsWith("-")&&(r=!0,a=a.slice(1));const l=a.match(/[.,]/g)??[];if(l.length>1)return{value:null,error:"invalid"};const[o,s=""]=a.split(/[.,]/);if(!Xv.test(o??"")||l.length===1&&!Xv.test(s))return{value:null,error:"invalid"};if(s.replace(/0+$/,"").length>t)return{value:null,error:"too_precise"};const u=s===""?o:`${o}.${s}`;return{value:`${r?"-":""}${u}`,error:null}}function g6(e){const[t,n]=e.split(".");if(n===void 0||n.length<=2)return e;let a=n.length;for(;a>2&&n.charAt(a-1)==="0";)a-=1;return`${t}.${n.slice(0,a)}`}function b6(e){return new Intl.NumberFormat(e).formatToParts(1.1).find(n=>n.type==="decimal")?.value??"."}function J1(e,t,n,a=4){const r={minimumFractionDigits:2,maximumFractionDigits:Math.max(2,a)},l=t===""?{style:"decimal",...r}:{style:"currency",currency:t,currencyDisplay:"code",...r};let o;try{o=new Intl.NumberFormat(n,l)}catch{return`${new Intl.NumberFormat(n,{style:"decimal",...r}).format(e)} ${t}`.trim()}return o.format(e)}const _6={key:0,"data-switch":"true",class:"inline-flex h-6 items-center gap-1 rounded-pill bg-ok-bg px-2.5 text-[12px] font-semibold text-ok-text"},x6={key:1,"data-switch":"false",class:"inline-flex h-6 items-center rounded-pill border border-border-strong px-2.5 text-[12px] font-semibold text-muted"},k6={key:1,class:"text-muted","data-empty":""},w6={key:2,class:"text-[13px] text-muted tabular-nums"},$6={key:3,"data-money":"",class:"tabular-nums whitespace-nowrap"},ml=ae({__name:"CellValue",props:{column:{},value:{},row:{}},setup(e){const t=e;function n(p){return p==null||p===""}function a(p){return n(p)?"":Array.isArray(p)?p.map(a).filter(h=>h!=="").join(", "):typeof p=="boolean"?_(p?"backend::lang.list.column_switch_true":"backend::lang.list.column_switch_false"):typeof p=="object"?"":String(p)}function r(p){return String(p).padStart(2,"0")}function l(p){if(typeof p!="string"&&typeof p!="number")return"";const h=new Date(p);return Number.isNaN(h.getTime())?String(p):`${h.getFullYear()}-${r(h.getMonth()+1)}-${r(h.getDate())} ${r(h.getHours())}:${r(h.getMinutes())}`}function o(p){if(typeof p!="string")return"";const h=/^\d{4}-\d{2}-\d{2}/.exec(p.trim());return h?h[0]:p.trim()}function s(p){if(typeof p!="string")return"";const h=/(\d{2}):(\d{2})/.exec(p);return h?`${h[1]}:${h[2]}`:p.trim()}function u(p){return typeof p=="string"?p!==""&&p!=="0"&&p.toLowerCase()!=="false":!!p}function d(){if(t.column.currencyFrom){const p=t.row?.[t.column.currencyFrom];return typeof p=="string"?p.trim():""}return t.column.currency??""}function c(p){return typeof p!="string"||p.trim()===""?"":J1(p.trim(),d(),sa.value,4)}const f=b(()=>t.column.type==="switch"?"switch":t.column.type==="money"?"money":t.column.type==="datetime"?"datetime":t.column.type==="date"?"date":t.column.type==="time"?"time":"text"),v=b(()=>{switch(f.value){case"datetime":return l(t.value);case"date":return o(t.value);case"time":return s(t.value);case"money":return c(t.value);default:return a(t.value)}});return(p,h)=>f.value==="switch"&&!n(e.value)?(m(),g(pe,{key:0},[u(e.value)?(m(),g("span",_6,[F(i(Eg),{size:14,"aria-hidden":"true"}),xe(T(i(_)("backend::lang.list.column_switch_true")),1)])):(m(),g("span",x6,T(i(_)("backend::lang.list.column_switch_false")),1))],64)):v.value===""?(m(),g("span",k6,"—")):f.value==="datetime"||f.value==="date"||f.value==="time"?(m(),g("span",w6,T(v.value),1)):f.value==="money"?(m(),g("span",$6,T(v.value),1)):(m(),g(pe,{key:4},[xe(T(v.value),1)],64))}}),C6={key:0,class:"flex shrink-0 gap-2"},S6=["data-row-state"],E6=ae({__name:"RowStateBadges",props:{states:{},labels:{}},setup(e){const t=e,n={deleted:"border border-border-strong text-muted",negative:"bg-danger-soft text-danger",disabled:"bg-subtle text-muted"},a=["deleted","negative","disabled"],r=b(()=>a.filter(l=>t.states.includes(l)));return(l,o)=>r.value.length>0?(m(),g("span",C6,[(m(!0),g(pe,null,Re(r.value,s=>(m(),g("span",{key:s,"data-row-state":s,class:he([n[s],"inline-flex h-6 shrink-0 items-center rounded-pill px-2.5 text-[12px] font-semibold whitespace-nowrap"])},T(e.labels[s]??s),11,S6))),128))])):ne("",!0)}}),A6={class:"overflow-x-auto"},T6={class:"sticky top-0 z-10"},O6={class:"h-row-head border-y border-border bg-subtle"},D6={key:0,scope:"col","data-select":"",class:"w-[52px] pl-5"},M6=["aria-checked","aria-label","disabled"],P6=["aria-sort"],R6=["data-sort","onClick"],I6={key:1,class:"w-[56px] pr-5"},q6=["aria-busy"],L6={key:0,class:"pl-5"},N6={key:1,class:"pr-5"},B6={key:1},F6=["colspan"],V6={class:"text-muted"},z6=["aria-selected","data-row-states","onClick"],j6={key:0,"data-select":"",class:"pl-5"},U6=["aria-checked","aria-label","onClick"],H6={key:0,class:"flex items-center gap-3"},K6={"data-avatar":"",class:"flex size-[30px] shrink-0 items-center justify-center rounded-full bg-subtle text-[12px] font-bold text-text","aria-hidden":"true"},W6=["onClick"],G6={key:1,class:"flex items-center gap-2"},Y6={key:1,"data-trailing":"",class:"w-[56px] pr-5"},Z1=ae({__name:"DataTable",props:{columns:{},rows:{},loading:{type:Boolean,default:!1},rowLink:{type:Function,default:void 0},selectable:{type:Boolean,default:!1},selected:{default:()=>[]},sortable:{type:Boolean,default:!1},sort:{default:null},variant:{default:"list"},openable:{type:Boolean,default:!1},trailing:{type:Boolean,default:!1},rowStates:{default:()=>({})},stateLabels:{default:()=>({})}},emits:["update:selected","sort","open"],setup(e,{emit:t}){const n=e,a=t,r=br();function l(Z){const U=Z.id;return typeof U=="number"||typeof U=="string"?U:null}function o(Z,U){const j=l(Z);return j===null?`row-${U}`:String(j)}function s(Z){return n.rowLink?n.rowLink(Z):null}function u(Z,U){if(Z.target?.closest("a, button, input, label, select"))return;if(n.openable){const ue=Z.currentTarget?.querySelector("[data-row-open]")??null;a("open",U,ue);return}const le=s(U);le&&r.push(le)}const d=b(()=>n.rows.map(l).filter(Z=>Z!==null)),c=b(()=>new Set(n.selected.map(String))),f=b(()=>{const Z=d.value,U=Z.filter(j=>c.value.has(String(j))).length;return U===0?"false":U===Z.length?"true":"mixed"});function v(Z){const U=l(Z);return U!==null&&c.value.has(String(U))}function p(){a("update:selected",f.value==="true"?[]:[...d.value])}function h(Z){const U=l(Z);U!==null&&(c.value.has(String(U))?a("update:selected",n.selected.filter(j=>String(j)!==String(U))):a("update:selected",[...n.selected,U]))}function k(Z){if(n.sort?.column===Z.key)return n.sort.dir==="desc"?"descending":"ascending"}function C(Z){return n.sortable&&Z.sortable}const x=b(()=>n.variant==="relation"),S=b(()=>x.value?"h-[56px]":"h-row"),q=b(()=>x.value?3:8);function O(Z){return(typeof Z=="string"||typeof Z=="number"?String(Z):"").split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(j=>j.charAt(0).toUpperCase()).join("")}const E=["deleted","negative","disabled"];function R(Z){const U=l(Z),j=U===null?void 0:n.rowStates[String(U)];return Array.isArray(j)?E.filter(le=>j.includes(le)):[]}function L(Z,U,j=[]){const le=j.includes("deleted")||j.includes("disabled"),ue=K(Z);return U===0?[le?"font-semibold text-muted":"font-semibold",ue].filter(Boolean).join(" "):[le||x.value||Z.relation?"text-muted":"",ue].filter(Boolean).join(" ")}function K(Z){return Z.type==="money"?"text-right":""}function $(Z){return["min-w-0 truncate",Z.includes("deleted")?"line-through":"no-underline",Z.includes("negative")?"text-danger":Z.includes("deleted")||Z.includes("disabled")?"text-muted":"text-text"]}const M=b(()=>n.columns.filter(Z=>!Z.invisible)),H=b(()=>Math.max(M.value.length+(n.selectable?1:0)+(n.trailing?1:0),1));function P(Z,U){a("open",U,Z.currentTarget)}const W=["w-3/5","w-2/5","w-1/2","w-3/4","w-1/3","w-2/3","w-1/2","w-2/5"];return(Z,U)=>(m(),g("div",A6,[w("table",{class:he([x.value?"min-w-[480px]":"min-w-[640px]","w-full border-collapse text-left"])},[w("thead",T6,[w("tr",O6,[e.selectable?(m(),g("th",D6,[w("button",{type:"button",role:"checkbox","aria-checked":f.value,"aria-label":i(_)("backend::lang.list.select_all"),disabled:e.loading||d.value.length===0,class:he([f.value==="false"?"border-border-strong bg-surface":"border-primary bg-primary text-on-primary","flex size-[18px] items-center justify-center rounded-checkbox border disabled:opacity-60"]),onClick:p},[f.value==="mixed"?(m(),V(i(Ng),{key:0,size:14,"aria-hidden":"true"})):f.value==="true"?(m(),V(i(Da),{key:1,size:14,"aria-hidden":"true"})):ne("",!0)],10,M6)])):ne("",!0),(m(!0),g(pe,null,Re(M.value,j=>(m(),g("th",{key:j.key,scope:"col","aria-sort":C(j)?k(j)??"none":void 0,class:he([[k(j)?"text-text":"text-muted",K(j)],"px-3.5 text-[12px] font-semibold first:pl-5 last:pr-5"])},[C(j)?(m(),g("button",{key:0,type:"button","data-sort":j.key,class:"inline-flex items-center gap-1 font-semibold",onClick:le=>a("sort",j.key)},[xe(T(j.label)+" ",1),k(j)==="ascending"?(m(),V(i(Ag),{key:0,size:14,"aria-hidden":"true"})):k(j)==="descending"?(m(),V(i(Cg),{key:1,size:14,"aria-hidden":"true"})):ne("",!0)],8,R6)):(m(),g(pe,{key:1},[xe(T(j.label),1)],64))],10,P6))),128)),e.trailing?(m(),g("td",I6)):ne("",!0)])]),w("tbody",{"aria-busy":e.loading?"true":void 0},[e.loading?(m(!0),g(pe,{key:0},Re(q.value,j=>(m(),g("tr",{key:`skeleton-${j}`,"data-skeleton":"",class:he([S.value,"border-b border-border"])},[e.selectable?(m(),g("td",L6,[...U[0]||(U[0]=[w("span",{class:"block size-[18px] rounded-checkbox bg-skel"},null,-1)])])):ne("",!0),(m(!0),g(pe,null,Re(M.value,le=>(m(),g("td",{key:le.key,class:"px-3.5 first:pl-5 last:pr-5"},[w("span",{class:he([W[(j-1)%W.length],"block h-3 rounded-[6px] bg-skel"])},null,2)]))),128)),e.trailing?(m(),g("td",N6)):ne("",!0)],2))),128)):e.rows.length===0?(m(),g("tr",B6,[w("td",{colspan:H.value,class:"px-5 py-20 text-center"},[be(Z.$slots,"empty",{},()=>[w("span",V6,T(i(_)("backend::lang.list.no_records")),1)])],8,F6)])):(m(!0),g(pe,{key:2},Re(e.rows,(j,le)=>(m(),g("tr",{key:o(j,le),class:he([[S.value,v(j)?"bg-sel":s(j)||e.openable?"hover:bg-hover":"",s(j)||e.openable?"cursor-pointer":""],"border-b border-border transition-colors duration-150 ease-out"]),"aria-selected":e.selectable?v(j)?"true":"false":void 0,"data-row-states":R(j).length>0?R(j).join(" "):void 0,onClick:ue=>u(ue,j)},[e.selectable?(m(),g("td",j6,[w("button",{type:"button",role:"checkbox","aria-checked":v(j)?"true":"false","aria-label":i(_)("backend::lang.list.select_row"),class:he([v(j)?"border-primary bg-primary text-on-primary":"border-border-strong bg-surface","flex size-[18px] items-center justify-center rounded-checkbox border"]),onClick:ue=>h(j)},[v(j)?(m(),V(i(Da),{key:0,size:14,"aria-hidden":"true"})):ne("",!0)],10,U6)])):ne("",!0),(m(!0),g(pe,null,Re(M.value,(ue,we)=>(m(),g("td",{key:ue.key,class:he([L(ue,we,R(j)),"px-3.5 first:pl-5 last:pr-5"])},[x.value&&we===0?(m(),g("span",H6,[w("span",K6,T(O(j[ue.key])),1),e.openable?(m(),g("button",{key:0,type:"button","data-row-open":"",class:"min-w-0 truncate text-left font-semibold text-text",onClick:De=>P(De,j)},[F(ml,{column:ue,value:j[ue.key],row:j},null,8,["column","value","row"])],8,W6)):(m(),V(ml,{key:1,column:ue,value:j[ue.key],row:j},null,8,["column","value","row"]))])):we===0&&R(j).length>0?(m(),g("span",G6,[s(j)?(m(),V(i(Vn),{key:0,to:s(j),class:he($(R(j)))},{default:N(()=>[F(ml,{column:ue,value:j[ue.key],row:j},null,8,["column","value","row"])]),_:2},1032,["to","class"])):(m(),g("span",{key:1,class:he($(R(j)))},[F(ml,{column:ue,value:j[ue.key],row:j},null,8,["column","value","row"])],2)),F(E6,{states:R(j),labels:e.stateLabels},null,8,["states","labels"])])):we===0&&s(j)?(m(),V(i(Vn),{key:2,to:s(j),class:"text-text no-underline"},{default:N(()=>[F(ml,{column:ue,value:j[ue.key],row:j},null,8,["column","value","row"])]),_:2},1032,["to"])):(m(),V(ml,{key:3,column:ue,value:j[ue.key],row:j},null,8,["column","value","row"]))],2))),128)),e.trailing?(m(),g("td",Y6,[be(Z.$slots,"trailing",{row:j})])):ne("",!0)],10,z6))),128))],8,q6)],2)]))}}),J6=["aria-label"],Z6={key:0,class:"flex flex-col gap-1 text-[13px]"},X6={class:"font-semibold text-muted"},Q6=["data-filter","value","onChange"],e8=["value"],t8={key:1,class:"flex flex-col gap-1 text-[13px]"},n8={class:"mb-1 font-semibold text-muted"},a8={class:"flex items-center gap-2"},r8=["data-filter","aria-label","value","onChange"],l8=["data-filter","aria-label","value","onChange"],o8={key:2,class:"flex flex-col gap-1 text-[13px]"},s8={class:"font-semibold text-muted"},i8=["data-filter","value","onChange"],u8=["value"],xo="",Ws="h-button rounded-control border border-border-strong bg-surface px-3 text-text",c8=ae({__name:"FilterBar",props:{filters:{},values:{},source:{}},emits:["update"],setup(e,{emit:t}){const n=e,a=t;function r(f){if(f.options&&f.options.length>0)return f.options.map(p=>({value:JSON.stringify(p.value),label:p.label}));const v=[];return f.trueValue!==void 0&&v.push({value:JSON.stringify(f.trueValue),label:_("backend::lang.list.column_switch_true")}),f.falseValue!==void 0&&v.push({value:JSON.stringify(f.falseValue),label:_("backend::lang.list.column_switch_false")}),v}const l=I({});async function o(f){const{data:v}=await Ne.GET("/{vendor}/{plugin}/{controller}/filters/{scope}/options",{params:{path:{...n.source,scope:f.name}}});l.value={...l.value,[f.name]:v?.data??[]}}Ct(()=>{for(const f of n.filters)f.type==="scope"&&o(f)});const s=Ln({});function u(){for(const f of n.filters){if(f.type!=="daterange")continue;const[v="",p=""]=(n.values[f.name]??"").split(".."),h=s[f.name];(!h||n.values[f.name]!==void 0||h.from!==""&&h.to!=="")&&(s[f.name]={from:v,to:p})}}Ve(()=>n.values,u,{immediate:!0,deep:!0});function d(f,v,p){const h={...s[f.name]??{from:"",to:""},[v]:p};s[f.name]=h,h.from!==""&&h.to!==""?a("update",f.name,`${h.from}..${h.to}`):(h.from===""&&h.to===""||n.values[f.name]!==void 0)&&a("update",f.name,null)}function c(f,v){a("update",f.name,v===xo?null:v)}return(f,v)=>(m(),g("div",{role:"group","aria-label":i(_)("backend::lang.list.filters"),"data-filter-bar":"",class:"flex flex-wrap items-end gap-4 border-t border-border px-5 py-3.5"},[(m(!0),g(pe,null,Re(e.filters,p=>(m(),g(pe,{key:p.name},[p.type==="switch"?(m(),g("label",Z6,[w("span",X6,T(p.label||p.name),1),w("select",{"data-filter":p.name,value:e.values[p.name]??xo,class:he(Ws),onChange:h=>c(p,h.target.value)},[w("option",{value:xo},T(i(_)("backend::lang.list.filter_all")),1),(m(!0),g(pe,null,Re(r(p),h=>(m(),g("option",{key:h.value,value:h.value},T(h.label),9,e8))),128))],40,Q6)])):p.type==="daterange"?(m(),g("fieldset",t8,[w("legend",n8,T(p.label||p.name),1),w("div",a8,[w("input",{type:"date","data-filter":`${p.name}-from`,"aria-label":i(_)("backend::lang.list.filter_from"),value:s[p.name]?.from??"",class:he(Ws),onChange:h=>d(p,"from",h.target.value)},null,40,r8),v[0]||(v[0]=w("span",{"aria-hidden":"true"},"–",-1)),w("input",{type:"date","data-filter":`${p.name}-to`,"aria-label":i(_)("backend::lang.list.filter_to"),value:s[p.name]?.to??"",class:he(Ws),onChange:h=>d(p,"to",h.target.value)},null,40,l8)])])):p.type==="scope"?(m(),g("label",o8,[w("span",s8,T(p.label||p.name),1),(m(),g("select",{key:`${p.name}-${l.value[p.name]?.length??-1}`,"data-filter":p.name,value:e.values[p.name]??xo,class:he(Ws),onChange:h=>c(p,h.target.value)},[w("option",{value:xo},T(i(_)("backend::lang.list.filter_all")),1),(m(!0),g(pe,null,Re(l.value[p.name]??[],h=>(m(),g("option",{key:h.value,value:h.value},T(h.label),9,u8))),128))],40,i8))])):ne("",!0)],64))),128))],8,J6))}}),d8=["type","disabled","data-hotkey","aria-keyshortcuts"],Ge=ae({__name:"Button",props:{variant:{default:"outline"},size:{default:"md"},type:{default:"button"},disabled:{type:Boolean,default:!1},icon:{default:void 0},to:{default:void 0},hotkey:{default:void 0}},setup(e){const t=e,n={primary:"bg-primary text-on-primary hover:opacity-90",outline:"border border-border-strong bg-surface text-text hover:bg-hover",ghost:"text-muted hover:bg-hover hover:text-text",danger:"border border-danger bg-surface text-danger hover:bg-danger-soft"},a=b(()=>t.hotkey?Tu(t.hotkey):void 0),r=b(()=>["inline-flex shrink-0 items-center justify-center gap-2 rounded-control px-4 font-semibold whitespace-nowrap no-underline transition-colors duration-150 ease-out disabled:cursor-not-allowed disabled:opacity-60",t.size==="sm"?"h-[38px]":"h-button",n[t.variant]]);return(l,o)=>e.to!==void 0?(m(),V(i(Vn),{key:0,to:e.to,class:he(r.value),"data-hotkey":e.hotkey,"aria-keyshortcuts":a.value},{default:N(()=>[e.icon?(m(),V(Vt(e.icon),{key:0,size:16,"aria-hidden":"true"})):ne("",!0),be(l.$slots,"default")]),_:3},8,["to","class","data-hotkey","aria-keyshortcuts"])):(m(),g("button",{key:1,type:e.type,disabled:e.disabled,class:he(r.value),"data-hotkey":e.hotkey,"aria-keyshortcuts":a.value},[e.icon?(m(),V(Vt(e.icon),{key:0,size:16,"aria-hidden":"true"})):ne("",!0),be(l.$slots,"default")],10,d8))}}),f8=ae({__name:"BulkActionsMenu",props:{actions:{},disabled:{type:Boolean}},emits:["select"],setup(e,{expose:t,emit:n}){const a=n,r=I(null);function l(){const o=r.value?.$el;o instanceof HTMLElement&&o.focus()}return t({focus:l}),(o,s)=>(m(),V(i(g1),{modal:!1},{default:N(()=>[F(i(x1),{"as-child":"",disabled:e.disabled},{default:N(()=>[F(Ge,{ref_key:"trigger",ref:r,variant:"outline",size:"md","data-action":"bulk-actions",disabled:e.disabled},{default:N(()=>[xe(T(i(_)("backend::lang.list.bulk_actions"))+" ",1),F(i(sr),{size:16,class:"text-muted","aria-hidden":"true"})]),_:1},8,["disabled"])]),_:1},8,["disabled"]),F(i(_1),null,{default:N(()=>[F(i(b1),{"data-bulk-menu":"",align:"end","side-offset":8,class:"z-50 flex w-[240px] max-w-[320px] flex-col rounded-[14px] border border-border bg-surface p-2 text-text shadow-menu"},{default:N(()=>[(m(!0),g(pe,null,Re(e.actions,u=>(m(),V(i(Ad),{key:u.name,"data-bulk-action":u.name,class:"flex min-h-10 cursor-pointer items-center rounded-control px-3 py-2 outline-none transition-colors duration-150 ease-out data-[highlighted]:bg-hover",onSelect:d=>a("select",u.name)},{default:N(()=>[xe(T(u.label),1)]),_:2},1032,["data-bulk-action","onSelect"]))),128))]),_:1})]),_:1})]),_:1}))}}),p8={class:"flex flex-wrap items-center justify-between gap-3 px-5 py-4"},m8={key:0,class:"relative block w-[320px] max-w-full"},v8={class:"sr-only"},h8=["value","placeholder"],y8={key:1},g8={class:"flex flex-wrap items-center justify-end gap-2.5"},b8={key:0,"data-selected-pill":"",class:"inline-flex h-8 items-center gap-1.5 rounded-pill bg-sel px-3 text-[13px] font-semibold"},_8=ae({__name:"ListToolbar",props:{showSearch:{type:Boolean},search:{},searchPrompt:{},buttons:{},selectedCount:{},selectedLabel:{},deleteLabel:{},actions:{default:()=>[]},busyAction:{default:null},bulkActions:{default:()=>[]},bulkBusy:{type:Boolean,default:!1}},emits:["update:search","delete","action","bulk"],setup(e,{expose:t,emit:n}){const a=e,r=n,l=b(()=>new Map(a.actions.map(u=>[u.name,u.label]))),o=I(null);function s(){o.value?.focus()}return t({focusBulk:s}),(u,d)=>(m(),g("div",p8,[e.showSearch?(m(),g("label",m8,[w("span",v8,T(i(_)("backend::lang.list.search")),1),F(i(du),{size:18,class:"pointer-events-none absolute top-1/2 left-3.5 -translate-y-1/2 text-muted","aria-hidden":"true"}),w("input",{type:"search","data-list-search":"","data-hotkey":"/","aria-keyshortcuts":"/",value:e.search,placeholder:e.searchPrompt,class:"h-button w-full rounded-control border border-transparent bg-subtle pr-3.5 pl-10",onInput:d[0]||(d[0]=c=>r("update:search",c.target.value))},null,40,h8)])):(m(),g("span",y8)),w("div",g8,[e.selectedCount>0?(m(),g("span",b8,[F(i(Da),{size:14,"aria-hidden":"true"}),xe(T(e.selectedLabel),1)])):ne("",!0),e.bulkActions.length>0?(m(),V(f8,{key:1,ref_key:"bulkMenu",ref:o,actions:e.bulkActions,disabled:e.selectedCount===0||e.bulkBusy,onSelect:d[1]||(d[1]=c=>r("bulk",c))},null,8,["actions","disabled"])):ne("",!0),(m(!0),g(pe,null,Re(e.buttons,c=>(m(),g(pe,{key:c},[c==="delete"?(m(),V(Ge,{key:0,"data-action":"delete",variant:e.selectedCount>0?"danger":"outline",icon:i(_r),disabled:e.selectedCount===0,onClick:d[2]||(d[2]=f=>r("delete"))},{default:N(()=>[xe(T(e.deleteLabel),1)]),_:1},8,["variant","icon","disabled"])):l.value.has(c)?(m(),V(Ge,{key:1,variant:"outline",size:"md","data-action":c,disabled:e.busyAction===c,"aria-busy":e.busyAction===c?"true":void 0,onClick:f=>r("action",c)},{default:N(()=>[xe(T(l.value.get(c)),1)]),_:2},1032,["data-action","disabled","aria-busy","onClick"])):ne("",!0)],64))),128))])]))}}),x8={class:"flex flex-wrap items-center gap-x-6 gap-y-3 border-t border-border px-5 py-3.5 text-[13px] text-muted"},k8={"data-range":""},w8={key:0,class:"flex items-center gap-2"},$8=["value"],C8=["value"],S8=["aria-label"],E8=["disabled"],A8={key:0,"aria-hidden":"true",class:"px-1"},T8=["data-page","aria-current","onClick"],O8=["disabled"],Ac="inline-flex h-pager min-w-pager items-center justify-center gap-1 rounded-pager border border-border px-2.5 text-[13px] text-text disabled:cursor-not-allowed disabled:opacity-60 hover:bg-hover",X1=ae({__name:"Pagination",props:{meta:{},loading:{type:Boolean},perPageOptions:{},perPage:{}},emits:["page","perPage"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>n.meta?.total??0),l=b(()=>n.meta?.page??1),o=b(()=>Math.max(n.meta?.last_page??1,1)),s=b(()=>{const c=n.meta;if(!c||c.total===0)return Vr("backend::lang.list.results",0);const f=(c.page-1)*c.per_page+1,v=Math.min(c.page*c.per_page,c.total);return _("backend::lang.list.pagination_range",{from:f,to:v,total:c.total})}),u=b(()=>{const c=o.value,f=l.value,v=new Set([1,c,f-1,f,f+1].filter(k=>k>=1&&k<=c));f<=3&&[2,3].forEach(k=>k<=c&&v.add(k)),f>=c-2&&[c-1,c-2].forEach(k=>k>=1&&v.add(k));const p=[...v].sort((k,C)=>k-C),h=[];return p.forEach((k,C)=>{const x=p[C-1];x!==void 0&&k-x>1&&h.push(null),h.push(k)}),h});function d(c){const f=Number(c.target.value);Number.isFinite(f)&&f>0&&a("perPage",f)}return(c,f)=>(m(),g("footer",x8,[w("span",k8,T(e.loading?i(_)("backend::lang.list.loading"):s.value),1),e.perPageOptions.length>1?(m(),g("label",w8,[w("span",null,T(i(_)("backend::lang.list.records_per_page")),1),w("select",{"data-per-page":"",value:String(e.perPage),class:"h-pager rounded-pager border border-border-strong bg-surface px-2 text-text",onChange:d},[(m(!0),g(pe,null,Re(e.perPageOptions,v=>(m(),g("option",{key:v,value:String(v)},T(v),9,C8))),128))],40,$8)])):ne("",!0),!e.loading&&r.value>0?(m(),g("nav",{key:1,"aria-label":i(_)("backend::lang.list.pagination"),class:"ml-auto flex items-center gap-1.5"},[w("button",{type:"button","data-page":"prev",class:he(Ac),disabled:l.value<=1,onClick:f[0]||(f[0]=v=>a("page",l.value-1))},[F(i(cu),{size:14,"aria-hidden":"true"}),xe(T(i(_)("backend::lang.list.prev_page")),1)],8,E8),(m(!0),g(pe,null,Re(u.value,(v,p)=>(m(),g(pe,{key:v??`gap-${p}`},[v===null?(m(),g("span",A8,"…")):(m(),g("button",{key:1,type:"button","data-page":v,"aria-current":v===l.value?"page":void 0,class:he([Ac,v===l.value?"border-transparent bg-sel font-bold":""]),onClick:h=>v!==l.value&&a("page",v)},T(v),11,T8))],64))),128)),w("button",{type:"button","data-page":"next",class:he(Ac),disabled:l.value>=o.value,onClick:f[1]||(f[1]=v=>a("page",l.value+1))},[xe(T(i(_)("backend::lang.list.next_page")),1),F(i(bs),{size:14,"aria-hidden":"true"})],8,O8)],8,S8)):ne("",!0)]))}}),D8={role:"alert","data-extension-failure":"",class:"flex min-h-input items-center rounded-control border-[1.5px] border-dashed border-border-strong bg-subtle px-3.5 py-2.5 text-[13px] text-muted"},M8={class:"flex min-w-0 items-start gap-2.5"},P8={class:"min-w-0 [overflow-wrap:anywhere]"},Ou=ae({__name:"ExtensionFailure",props:{text:{}},setup(e){return(t,n)=>(m(),g("div",D8,[w("span",M8,[F(i(bt),{size:16,class:"mt-0.5 shrink-0 text-danger","aria-hidden":"true"}),w("span",P8,T(e.text),1)])]))}}),R8=new Set(["div","span","p","strong","em","b","i","u","s","small","mark","code","pre","br","hr","ul","ol","li","dl","dt","dd","h2","h3","h4","h5","h6","table","thead","tbody","tfoot","tr","th","td","caption","section","header","footer","figure","figcaption","blockquote","q","abbr","time","data","meter","progress","sup","sub","a","img"]),I8=new Set(["script","style","template","iframe","object","embed","noscript","textarea","title","xmp","svg","math","form","input","button","select","link","meta","base"]),q8=32,L8=2e3,N8=new Set(["class","title","lang","dir","role"]),B8={a:new Set(["href"]),img:new Set(["src","alt","width","height"]),td:new Set(["colspan","rowspan","scope"]),th:new Set(["colspan","rowspan","scope"]),time:new Set(["datetime"]),data:new Set(["value"]),meter:new Set(["value","min","max","low","high","optimum"]),progress:new Set(["value","max"])},F8=/^(aria|data)-[a-z0-9_-]+$/;function V8(e,t){if(e==="")return!1;for(const n of e){const a=n.codePointAt(0)??0;if(a<=32||a===127)return!1}return e.startsWith("#")?t:e.startsWith("/")?e.length===1||e[1]!=="/"&&e[1]!=="\\":!1}function z8(e,t,n){return N8.has(t)||B8[e]?.has(t)===!0||F8.test(t)?e==="a"&&t==="href"||e==="img"&&t==="src"?V8(n,e==="a"):!0:!1}function j8(e,t){const n={};for(const[a,r]of Object.entries(t??{})){const l=a.toLowerCase();typeof r=="string"&&z8(e,l,r)&&(n[l]=r)}return n}function Md(e,t,n){const a=[];for(const r of e??[]){if(n.left<=0)break;if(r.tag===void 0||r.tag===""){typeof r.text=="string"&&r.text!==""&&(n.left-=1,a.push(r.text));continue}const l=r.tag.toLowerCase();if(I8.has(l))continue;if(!R8.has(l)){a.push(...Md(r.children,t,n));continue}if(t+1>q8)continue;n.left-=1;const o=Md(r.children,t+1,n);a.push(On(l,j8(l,r.attrs),o.length>0?o:void 0))}return a}function U8(e){return Md(e,0,{left:L8})}const H8={key:1,"data-partial-loading":"","aria-busy":"true"},K8=["data-partial","aria-busy"],rp=ae({__name:"PartialHost",props:{source:{},name:{},recordId:{default:null},variant:{},reloadKey:{default:0},hint:{type:Boolean,default:!1}},setup(e){const t=e,n=I(null),a=I(!1),r=I(!1);let l=0;const o=u=>U8(u.nodes);o.props=["nodes"];async function s(){const u=++l;r.value=!0;let d=null;try{d=(await Ne.GET("/{vendor}/{plugin}/{controller}/partials/{name}",{params:{path:{...t.source,name:t.name},query:t.recordId!=null?{id:t.recordId}:void 0}})).data?.data.nodes??null}catch{d=null}u===l&&(r.value=!1,a.value=d===null,n.value=d)}return Ve(()=>t.reloadKey,()=>{s()}),s(),(u,d)=>a.value?(m(),V(Ou,{key:0,"data-partial-failed":"",text:i(_)("backend::lang.extension.partial_failed")},null,8,["text"])):n.value===null?(m(),g("div",H8,[w("div",{"data-partial-skeleton":"",class:he([e.hint?"h-[68px] w-full rounded-inner":e.variant==="header"?"h-[80px] w-full rounded-card":"h-[44px] w-full rounded-control","bg-skel"]),"aria-hidden":"true"},null,2)])):n.value.length>0?(m(),g("div",{key:2,class:"summer-partial","data-partial":e.variant,"aria-busy":r.value?"true":void 0},[F(o,{nodes:n.value},null,8,["nodes"])],8,K8)):ne("",!0)}}),W8={key:0,class:"flex flex-col gap-1.5","data-confirm-prompt":""},G8=["for"],Y8=["id","maxlength","placeholder","aria-describedby","disabled","value","onKeydown"],J8=["id"],Z8={class:"flex gap-2.5"},X8=["disabled","aria-busy"],wr=ae({__name:"ConfirmDialog",props:{open:{type:Boolean},message:{},title:{default:void 0},confirmLabel:{default:void 0},cancelLabel:{default:void 0},danger:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},prompt:{default:null},value:{default:""}},emits:["update:open","update:value","confirm","cancel"],setup(e,{emit:t}){const n=e,a=t,r=`confirm-${yy()}`,l=I(null),o=b(()=>!!n.prompt&&n.value.trim()==="");function s(c){!c&&n.busy||(a("update:open",c),c||a("cancel"))}function u(){n.busy||o.value||(a("confirm"),a("update:open",!1))}function d(c){a("update:value",c.target.value)}return Ve(()=>n.open&&!!n.prompt,async c=>{c&&(await Ye(),l.value?.focus())}),(c,f)=>(m(),V(i(nT),{open:e.open,"onUpdate:open":s},{default:N(()=>[F(i(eT),null,{default:N(()=>[F(i(X3),{class:"pointer-events-auto fixed inset-0 z-[80] bg-overlay"}),F(i(K3),{"data-confirm-dialog":"",class:"pointer-events-auto fixed top-1/2 left-1/2 z-[90] flex w-[calc(100%-32px)] max-w-[440px] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-modal bg-surface p-6 text-text shadow-pop"},{default:N(()=>[F(i(rT),{class:"text-[20px] font-bold tracking-[-0.01em]"},{default:N(()=>[xe(T(e.title??i(_)("backend::lang.form.confirm")),1)]),_:1}),F(i(J3),{class:"text-muted [overflow-wrap:anywhere]"},{default:N(()=>[xe(T(e.message),1)]),_:1}),e.prompt?(m(),g("div",W8,[w("label",{for:`${r}-value`,class:"text-[13px] font-semibold"},T(e.prompt.label),9,G8),w("input",{id:`${r}-value`,ref_key:"promptInput",ref:l,type:"text",autocomplete:"off",maxlength:e.prompt.maxLength,placeholder:e.prompt.placeholder,"aria-describedby":e.prompt.comment?`${r}-comment`:void 0,disabled:e.busy,value:e.value,class:"h-control w-full rounded-control border border-border-strong bg-surface px-3 text-text outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-60",onInput:d,onKeydown:Oa(vt(u,["prevent"]),["enter"])},null,40,Y8),e.prompt.comment?(m(),g("p",{key:0,id:`${r}-comment`,class:"text-[13px] text-muted"},T(e.prompt.comment),9,J8)):ne("",!0)])):ne("",!0),w("div",Z8,[F(i(G3),{"data-action":"cancel",disabled:e.busy,class:"inline-flex h-button flex-1 items-center justify-center rounded-control border border-border-strong bg-surface font-semibold hover:bg-hover disabled:cursor-not-allowed disabled:opacity-60"},{default:N(()=>[xe(T(e.cancelLabel??i(_)("backend::lang.form.cancel")),1)]),_:1},8,["disabled"]),w("button",{type:"button","data-action":"confirm",disabled:e.busy||o.value,"aria-busy":e.busy?"true":void 0,class:he([e.danger?"bg-danger text-white":"bg-primary text-on-primary","inline-flex h-button flex-1 items-center justify-center gap-2 rounded-control font-semibold hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60"]),onClick:vt(u,["prevent"])},[e.busy?(m(),V(i(Ml),{key:0,size:16,class:"animate-spin","aria-hidden":"true"})):ne("",!0),xe(" "+T(e.confirmLabel??i(_)("backend::lang.form.confirm")),1)],10,X8)])]),_:1})]),_:1})]),_:1},8,["open"]))}});function $r(){const e=I(null),t=I(!1),n=I("");let a=null,r=null;function l(c){const f=a;a=null,r=null,e.value=null,f?.(c)}function o(c,f){return l(!1),n.value="",e.value=c,r=f??null,new Promise(v=>{a=v})}async function s(){if(t.value||e.value?.prompt&&n.value.trim()==="")return;const c=r;if(c){t.value=!0;try{await c()}finally{t.value=!1}}l(!0)}function u(){t.value||l(!1)}function d(c){n.value=c}return{request:e,busy:t,value:n,ask:o,confirm:s,cancel:u,setValue:d}}const Q8={class:"flex flex-col gap-5"},eP={class:"flex flex-wrap items-end justify-between gap-4"},tP={class:"flex flex-col"},nP={class:"text-[26px] font-bold tracking-[-0.02em]"},aP={key:0,"data-record-count":"",class:"text-muted"},rP={key:0,class:"flex items-center gap-2.5"},lP={class:"overflow-hidden rounded-card border border-border bg-surface shadow-card"},oP={key:2,"data-list-failed":"",class:"flex flex-wrap items-center justify-between gap-3 border-t border-border px-5 py-4"},sP={role:"alert",class:"text-danger"},iP={key:0,"data-empty-search":"",class:"flex flex-col items-center gap-3"},uP={class:"flex size-14 items-center justify-center rounded-full bg-subtle text-muted"},cP={class:"text-[17px] font-bold"},dP={class:"max-w-[420px] text-muted"},fP={key:1,"data-empty-list":"",class:"text-muted"},pP=300,mP=ae({__name:"ListView",setup(e){const t=Mn(),n=br(),a={vendor:String(t.params.vendor??""),plugin:String(t.params.plugin??""),controller:String(t.params.controller??"")},r=hs(a),l=zn(r)??"/",o=I(null),s=I([]),u=I(null),d=I(!0),c=I(!1),f=I(!1),v=b(()=>c.value||f.value),p=I([]),h=I(!1),k=I(0),C=$r(),x=b(()=>$1(t.query)),S=I(x.value.search??""),q=b(()=>o.value?.messages),O=b(()=>o.value?.title?o.value.title:ys(a.vendor,a.plugin)?.sideMenu.find($e=>$e.controller===r)?.label??r),E=b(()=>u.value?We(q.value?.recordCount,u.value.total):""),R=b(()=>o.value?.toolbarButtons??[]),L=b(()=>R.value.filter(oe=>oe==="create")),K=b(()=>{const oe=o.value?.reorder;if(!oe)return null;const $e=oe.partition?.column,ye=$e?o.value?.filters.find(Be=>Be.column===$e||Be.name===$e):void 0,qe=ye?x.value.filter?.[ye.name]:void 0;return{path:`${l}/reorder`,query:qe!==void 0&&qe!==""?{partition:String(qe)}:{}}}),$=b(()=>o.value?.toolbarActions??[]),M=b(()=>R.value.filter(oe=>oe==="delete"||$.value.some($e=>$e.name===oe))),H=I(null),P=b(()=>u.value?.row_states??{}),W=b(()=>({deleted:We(q.value?.rowStateDeleted),negative:We(q.value?.rowStateNegative),disabled:We(q.value?.rowStateDisabled)})),Z=b(()=>(o.value?.bulkActions??[]).filter(oe=>oe.name!=="delete")),U=I(!1),j=I(null),le=b(()=>{const oe=o.value?.perPageOptions??[];return oe.length>0?oe:[o.value?.recordsPerPage||20]}),ue=b(()=>x.value.per_page??u.value?.per_page??o.value?.recordsPerPage??20),we=b(()=>x.value.sort?{column:x.value.sort,dir:x.value.dir==="desc"?"desc":"asc"}:null);function De(oe){const $e=o.value?.recordUrl,ye=oe.id;return!$e||typeof ye!="number"&&typeof ye!="string"?null:Y1($e,r,ye)}function Ae(oe){Hs(r,oe),n.replace({path:t.path,query:Ni(oe)})}const ie=Sl({}),_e=b(()=>Sl(x.value)!==ie);let z=0,ke=null;function me(){Ae({})}async function Y(oe=!1){const $e=++z;d.value=!0,f.value=!1;let ye=null;try{ye=await G()}catch{ye=null}if($e!==z)return;if(!ye?.data&&oe){Hs(r,{}),n.replace({path:t.path,query:{}});return}if(!ye?.data&&ye?.response?.status===404&&await fe($e))return;if(s.value=ye?.data?.data??[],u.value=ye?.data?.meta??null,f.value=!ye?.data,d.value=!1,ye?.response?.status===422){Hs(r,{});return}const qe=u.value?.last_page??0;qe>=1&&(u.value?.page??0)>qe&&Ae({...x.value,page:qe})}async function fe(oe){try{const{data:$e}=await Ne.GET("/{vendor}/{plugin}/{controller}/singleton",{params:{path:a}});return oe!==z?!0:$e?(await n.replace(`${l}/${$e.data.id}`),!0):!1}catch{return!1}}function G(){return Ne.GET("/{vendor}/{plugin}/{controller}",{params:{path:a,query:x.value}})}async function X(){const oe=await Ne.GET("/{vendor}/{plugin}/{controller}/schema/list",{params:{path:a}});o.value=oe.data?.data??null,c.value=!o.value,o.value&&ap(r,o.value.assets)}X(),Ve(()=>Sl(x.value),oe=>{if(oe===ie){const ye=i5(r),qe=Sl(ye);if(qe!==ie){ke=qe,n.replace({path:t.path,query:Ni(ye)});return}}const $e=ke!==null&&ke===oe;ke=null,Hs(r,x.value),p.value=[],S.value=x.value.search??"",Y($e)},{immediate:!0});let ee=null;function y(oe){S.value=oe,ee!==null&&clearTimeout(ee),ee=setTimeout(()=>{ee=null;const $e=oe.trim();Ae({...x.value,search:$e===""?void 0:$e,page:void 0})},pP)}Dt(()=>{ee!==null&&clearTimeout(ee)});function A(){S.value="",Ae({...x.value,search:void 0,page:void 0})}function D(oe){const $e=we.value;$e?.column!==oe?Ae({...x.value,sort:oe,dir:"asc",page:void 0}):$e.dir==="asc"?Ae({...x.value,sort:oe,dir:"desc",page:void 0}):Ae({...x.value,sort:void 0,dir:void 0,page:void 0})}function re(oe){Ae({...x.value,page:oe})}function Q(oe){Ae({...x.value,per_page:oe,page:void 0})}function ce(oe,$e){const ye={...x.value.filter??{}};$e===null?delete ye[oe]:ye[oe]=$e,Ae({...x.value,filter:ye,page:void 0})}async function Ee(){const oe=p.value.map(Number).filter(ye=>Number.isInteger(ye)&&ye>0);if(!(oe.length===0||h.value||!await C.ask({message:We(q.value?.deleteConfirm,oe.length),confirmLabel:_("backend::lang.form.delete"),danger:!0}))){h.value=!0;try{const ye=await Ne.POST("/{vendor}/{plugin}/{controller}/bulk-delete",{params:{path:a},body:{ids:oe}});if(ye.data){Le(We(q.value?.deleted,ye.data.data.deleted)),p.value=[],await Y(),k.value+=1;return}Le(ye.error?.error.message||_("backend::lang.list.delete_failed"),"danger")}catch{Le(_("backend::lang.list.delete_failed"),"danger")}finally{h.value=!1}}}async function Ce(oe){const $e=Z.value.find(at=>at.name===oe),ye=p.value.map(Number).filter(at=>Number.isInteger(at)&&at>0);if(!$e||ye.length===0||U.value)return;const qe=$e.label??oe;let Be=0,He=null,Je="";const Ze=await C.ask({message:$e.confirm||Vr("backend::lang.list.bulk_confirm",ye.length,{action:qe}),confirmLabel:qe,danger:!1},async()=>{U.value=!0;try{const at=await Ne.POST("/{vendor}/{plugin}/{controller}/bulk/{action}",{params:{path:{...a,action:oe}},body:{ids:ye}});Be=at.response.status,He=at.data?.data??null,Je=at.error?.error.message??""}catch{Be=0}finally{U.value=!1}});if(await new Promise(at=>setTimeout(at,0)),j.value?.focusBulk(),!Ze)return;const ot=He;if(ot){Le(ot.message||Vr("backend::lang.list.bulk_done",ot.affected)),p.value=[],await Y(),k.value+=1;return}if(Be===409){Le(_("backend::lang.list.bulk_stale"),"danger"),p.value=[],await Y();return}if(Be===403){Le(Je||_("backend::lang.list.action_forbidden"),"danger");return}Le(Je||_("backend::lang.extension.action_failed"),"danger")}async function Te(oe){if(H.value===null){H.value=oe;try{const $e=await Ne.POST("/{vendor}/{plugin}/{controller}/toolbar/{action}",{params:{path:{...a,action:oe}},body:{}});if($e.data){$e.data.data.message&&Le($e.data.data.message),await Y(),k.value+=1;return}Le($e.error?.error.message||_("backend::lang.extension.action_failed"),"danger")}catch{Le(_("backend::lang.extension.action_failed"),"danger")}finally{H.value=null}}}return(oe,$e)=>(m(),g("section",Q8,[w("header",eP,[w("div",tP,[w("h1",nP,T(O.value),1),E.value?(m(),g("p",aP,T(E.value),1)):ne("",!0)]),L.value.length>0||K.value?(m(),g("div",rP,[K.value?(m(),V(Ge,{key:0,"data-action":"reorder",variant:"outline",icon:i(Sg),to:K.value},{default:N(()=>[xe(T(i(_)("backend::lang.messages.list.reorder")),1)]),_:1},8,["icon","to"])):ne("",!0),(m(!0),g(pe,null,Re(L.value,ye=>(m(),V(Ge,{key:ye,"data-action":"create",variant:"primary",icon:i(_s),to:`${i(l)}/create`},{default:N(()=>[xe(T(i(We)(q.value?.create)),1)]),_:1},8,["icon","to"]))),128))])):ne("",!0)]),o.value?.headerPartial?(m(),V(rp,{key:0,variant:"header",source:a,name:o.value.headerPartial,"reload-key":k.value},null,8,["name","reload-key"])):ne("",!0),w("div",lP,[o.value?(m(),V(_8,{key:0,ref_key:"toolbar",ref:j,"show-search":o.value.showSearch,search:S.value,"search-prompt":i(We)(q.value?.searchPrompt),buttons:M.value,"selected-count":p.value.length,"selected-label":i(We)(q.value?.selected,p.value.length),"delete-label":i(We)(q.value?.deleteSelected,p.value.length),actions:$.value,"busy-action":H.value,"bulk-actions":Z.value,"bulk-busy":U.value,"onUpdate:search":y,onDelete:Ee,onAction:Te,onBulk:Ce},null,8,["show-search","search","search-prompt","buttons","selected-count","selected-label","delete-label","actions","busy-action","bulk-actions","bulk-busy"])):ne("",!0),o.value&&o.value.filters.length>0?(m(),V(c8,{key:1,filters:o.value.filters,values:x.value.filter??{},source:a,onUpdate:ce},null,8,["filters","values"])):ne("",!0),v.value&&!d.value?(m(),g("div",oP,[w("p",sP,T(i(_)("backend::lang.list.load_failed")),1),f.value&&_e.value?(m(),V(Ge,{key:0,"data-action":"reset-list",onClick:me},{default:N(()=>[xe(T(i(_)("backend::lang.list.reset_list")),1)]),_:1})):ne("",!0)])):(m(),V(Z1,{key:3,columns:o.value?.columns??[],rows:s.value,loading:d.value||!o.value,"row-link":De,selectable:o.value?.showCheckboxes??!1,selected:p.value,sortable:o.value?.showSorting??!1,sort:we.value,"row-states":P.value,"state-labels":W.value,"onUpdate:selected":$e[0]||($e[0]=ye=>p.value=ye),onSort:D},{empty:N(()=>[x.value.search?(m(),g("div",iP,[w("span",uP,[F(i(Vg),{size:24,"aria-hidden":"true"})]),w("p",cP,T(i(We)(q.value?.emptySearch,void 0,{term:x.value.search})),1),w("p",dP,T(i(We)(q.value?.emptySearchHint,void 0,{term:x.value.search})),1),F(Ge,{"data-action":"clear-search",onClick:A},{default:N(()=>[xe(T(i(_)("backend::lang.list.clear_search")),1)]),_:1})])):(m(),g("p",fP,T(i(We)(q.value?.empty)||o.value?.noRecordsMessage||i(_)("backend::lang.list.no_records")),1))]),_:1},8,["columns","rows","loading","selectable","selected","sortable","sort","row-states","state-labels"])),F(X1,{meta:u.value,loading:d.value||!o.value,"per-page-options":le.value,"per-page":ue.value,onPage:re,onPerPage:Q},null,8,["meta","loading","per-page-options","per-page"])]),F(wr,{open:i(C).request.value!==null,message:i(C).request.value?.message??"","confirm-label":i(C).request.value?.confirmLabel,danger:i(C).request.value?.danger,busy:i(C).busy.value,onConfirm:i(C).confirm,onCancel:i(C).cancel},null,8,["open","message","confirm-label","danger","busy","onConfirm","onCancel"])]))}}),mr="X-Session-Key",Q1="X-Child-Session-Key",vP=32;function us(){const e=new Uint8Array(vP);globalThis.crypto.getRandomValues(e);let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const hP="X-Upload-Id";async function ar(e){try{const t=await e();return{data:t.data?t.data.data:null,status:t.response.status,error:t.error?.error??null}}catch{return{data:null,status:0,error:null}}}async function Bi(e){try{const t=await e();return t.response.ok&&t.data instanceof Blob?t.data:null}catch{return null}}function wa(e){return encodeURIComponent(String(e))}function e0(e){return`${iu.api}/${wa(e.vendor)}/${wa(e.plugin)}/${wa(e.controller)}`}function yP(e){try{return e===""?null:JSON.parse(e)}catch{return null}}function lp(e){if(!e)return"";for(const t of Object.values(e.details??{})){const n=Array.isArray(t)?t.find(a=>typeof a=="string"&&a!==""):t;if(typeof n=="string"&&n!=="")return n}return e.message??""}function gP(e,t){const n=t;if((e===200||e===201)&&n?.data)return{ok:!0,item:n.data};const a=lp(n?.error);return e===413?{ok:!1,reason:"too_large",status:e,message:a}:e===422?{ok:!1,reason:"invalid",status:e,message:a}:e===0?{ok:!1,reason:"network",status:e,message:a}:{ok:!1,reason:"failed",status:e,message:a}}function t0(e,t,n,a,r){let l=null,o=!1;const s=()=>new Promise(d=>{const c=new XMLHttpRequest;l=c,c.open("POST",e),c.setRequestHeader("X-Requested-With",bg),c.setRequestHeader("Accept","application/json");for(const[v,p]of Object.entries(n))c.setRequestHeader(v,p);r&&c.setRequestHeader(hP,r),c.upload.onprogress=v=>{v.lengthComputable&&a?.(v.loaded,v.total)},c.onload=()=>d({status:c.status,body:yP(c.responseText)}),c.onerror=()=>d("network"),c.ontimeout=()=>d("network"),c.onabort=()=>d("aborted");const f=new FormData;f.append("file_data",t,t.name),c.send(f)});return{promise:(async()=>{let d=await s();return typeof d=="object"&&d.status===401&&!o&&(await ef()&&(d=o?"aborted":await s()),typeof d=="object"&&d.status===401&&Nw()),d==="aborted"||o?{ok:!1,reason:"aborted",status:0,message:""}:d==="network"?{ok:!1,reason:"network",status:0,message:""}:gP(d.status,d.body)})(),abort(){o=!0,l?.abort()}}}function n0(e,t,n,a){const r={...e,id:t,field:n},l={[mr]:a},o=`${e0(e)}/${wa(t)}/files/${wa(n)}`;return{list:()=>ar(()=>Ne.GET("/{vendor}/{plugin}/{controller}/{id}/files/{field}",{params:{path:r,header:l}})),upload:(s,u,d)=>t0(o,s,{...l},u,d),update:(s,u)=>ar(()=>Ne.PUT("/{vendor}/{plugin}/{controller}/{id}/files/{field}/{file}",{params:{path:{...r,file:s},header:l},body:u})),remove:s=>ar(()=>Ne.DELETE("/{vendor}/{plugin}/{controller}/{id}/files/{field}/{file}",{params:{path:{...r,file:s},header:l}})),reorder:s=>ar(()=>Ne.POST("/{vendor}/{plugin}/{controller}/{id}/files/{field}/reorder",{params:{path:r,header:l},body:{ids:s}})),download:s=>Bi(()=>Ne.GET("/{vendor}/{plugin}/{controller}/{id}/files/{field}/{file}/download",{params:{path:{...r,file:s},header:l},parseAs:"blob"})),thumb:s=>Bi(()=>Ne.GET("/{vendor}/{plugin}/{controller}/{id}/files/{field}/{file}/thumb",{params:{path:{...r,file:s},header:l},parseAs:"blob"}))}}function bP(e,t,n,a,r,l,o){const s={...e,id:t,name:n,child:a,field:r},u={[mr]:l,[Q1]:o},d=`${e0(e)}/${wa(t)}/relations/${wa(n)}/records/${wa(a)}/files/${wa(r)}`;return{list:()=>ar(()=>Ne.GET("/{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}/files/{field}",{params:{path:s,header:u}})),upload:(c,f,v)=>t0(d,c,{...u},f,v),update:(c,f)=>ar(()=>Ne.PUT("/{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}/files/{field}/{file}",{params:{path:{...s,file:c},header:u},body:f})),remove:c=>ar(()=>Ne.DELETE("/{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}/files/{field}/{file}",{params:{path:{...s,file:c},header:u}})),reorder:c=>ar(()=>Ne.POST("/{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}/files/{field}/reorder",{params:{path:s,header:u},body:{ids:c}})),download:c=>Bi(()=>Ne.GET("/{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}/files/{field}/{file}/download",{params:{path:{...s,file:c},header:u},parseAs:"blob"})),thumb:c=>Bi(()=>Ne.GET("/{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}/files/{field}/{file}/thumb",{params:{path:{...s,file:c},header:u},parseAs:"blob"}))}}const _P=new Set(["readonly","placeholder","maxlength","minlength","min","max","step","autocomplete","spellcheck","pattern"]);function Cr(e){const t={};for(const[n,a]of Object.entries(e.attributes??{})){const r=n.toLowerCase();!_P.has(r)||a===null||a===!1||(t[r]=a)}return t}function Ft(e){return["w-full rounded-control border bg-surface px-3.5 text-text transition-colors duration-150 ease-out",e?"border-danger":"border-border-strong"].join(" ")}function Du(e){return typeof e=="string"?e!==""&&e!=="0"&&e.toLowerCase()!=="false":!!e}function a0(e,t){return typeof e=="number"?t?1:0:t}function r0(e,t,n){const a={};if(t===null||typeof t!="object"||Array.isArray(t))return a;const r=t;for(const l of e.permissionOptions??[]){if(n?.has(l.code))continue;const o=Number(r[l.code]);(o===1||e.mode==="radio"&&o===-1)&&(a[l.code]=o)}return a}const xP=new Set(["mltext","mltextarea","mlmarkdown"]);function kP(e){return e!==void 0&&xP.has(e)}function vr(e){return e?kP(e.type)||!!e.element&&e.translatable===!0:!1}const cs="summer:ml-locale";function wP(e){typeof window>"u"||e===""||window.dispatchEvent(new CustomEvent(cs,{detail:e}))}function ra(e){const t={};if(e===null||typeof e!="object"||Array.isArray(e))return t;for(const[n,a]of Object.entries(e))typeof a=="string"&&(t[n]=a);return t}const $P={class:"flex min-w-0 flex-col"},CP=["for"],SP={key:0,class:"text-danger","aria-hidden":"true"},EP=["id"],AP=["id","name","checked","aria-invalid","aria-describedby"],TP=ae({__name:"CheckboxField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>Du(n.modelValue));function l(o){a("update:modelValue",a0(n.modelValue,o.target.checked))}return(o,s)=>(m(),g("div",{class:he([e.invalid?"border-danger":"border-border","flex items-center justify-between gap-4 rounded-inner border px-4 py-3.5"]),"data-toggle-card":""},[w("div",$P,[w("label",{for:e.controlId,class:"font-semibold"},[xe(T(e.field.label||e.field.name),1),e.field.required?(m(),g("span",SP," *")):ne("",!0)],8,CP),e.field.comment?(m(),g("p",{key:0,id:`${e.controlId}-comment`,class:"text-[13px] text-muted"},T(e.field.comment),9,EP)):ne("",!0)]),w("input",{id:e.controlId,type:"checkbox",name:e.field.name,checked:r.value,"aria-invalid":e.invalid?"true":void 0,"aria-describedby":e.describedBy||void 0,class:"size-5 shrink-0 rounded-[6px] accent-primary",onChange:l},null,40,AP)],2))}});function OP(e){return e==="date"||e==="time"?e:"datetime"}function sn(e,t=2){return String(e).padStart(t,"0")}const DP=/(Z|[+-]\d{2}:?\d{2})$/i;function MP(e,t,n=!1){if(typeof t!="string"||t.trim()==="")return null;const a=t.trim();try{if(e==="date")return gb(a.slice(0,10));if(e==="time"){const l=/(\d{2}:\d{2}(:\d{2})?)/.exec(a.includes("T")?a.slice(a.indexOf("T")):a);return l?bA(l[1]):null}const r=DP.test(a)?a.replace(" ","T"):`${a.replace(" ","T")}Z`;return n?ia(rv(r,"UTC")):rv(r,Un())}catch{return null}}function Tc(e){return`${sn(e.year,4)}-${sn(e.month)}-${sn(e.day)}`}function Oc(e){return`${sn(e.hour)}:${sn(e.minute)}:${sn(e.second)}`}function Qv(e,t,n=!1){if(!t)return null;if(e==="time")return"hour"in t?Oc(t):null;if(!("year"in t))return null;if(e==="date")return Tc(t);if(n){const l=t instanceof Ma?ia(t):t,o="hour"in l?Oc(l):"00:00:00";return`${Tc(l)}T${o}Z`}const a=t instanceof Ma?t:_f(t instanceof yt?ia(t):t,Un()),r=yu(a,"UTC");return`${Tc(r)}T${Oc(r)}Z`}const PP={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm",time:"HH:mm"},RP=/\[([^\]]*)\]|YYYY|YY|MMMM|MMM|MM|M|dddd|ddd|DD|D|HH|H|hh|h|mm|ss|A|a/g;function IP(e){return"year"in e?new yt(e.year,e.month,e.day):null}function Dc(e,t,n,a){return new Rn(e,{...n,timeZone:"UTC"}).formatToParts(t.toDate("UTC")).find(l=>l.type===a)?.value??""}function qP(e,t,n,a){if(!e)return"";const r=n||PP[t],l=IP(e),o="hour"in e?e:null,s=/D/.test(r.replace(/\[[^\]]*\]/g,""));return r.replace(RP,(u,d)=>{if(d!==void 0)return d;switch(u){case"YYYY":return l?sn(l.year,4):"";case"YY":return l?sn(l.year%100):"";case"MMMM":case"MMM":{if(!l)return"";const c=u==="MMMM"?"long":"short";return s?Dc(a,l,{day:"numeric",month:c},"month"):Dc(a,l,{month:c},"month")}case"MM":return l?sn(l.month):"";case"M":return l?String(l.month):"";case"dddd":case"ddd":return l?Dc(a,l,{weekday:u==="dddd"?"long":"short"},"weekday"):"";case"DD":return l?sn(l.day):"";case"D":return l?String(l.day):"";case"HH":return o?sn(o.hour):"";case"H":return o?String(o.hour):"";case"hh":return o?sn(o.hour%12||12):"";case"h":return o?String(o.hour%12||12):"";case"mm":return o?sn(o.minute):"";case"ss":return o?sn(o.second):"";case"A":return o?o.hour<12?"AM":"PM":"";case"a":return o?o.hour<12?"am":"pm":"";default:return u}})}const LP=new yt(2026,10,4);function NP(e,t){if(typeof t=="number"&&Number.isInteger(t)&&t>=0&&t<=6)return t;try{return(7-hu(LP,e))%7}catch{return 1}}function eh(e){if(e)try{return gb(e.slice(0,10))}catch{return}}function BP(e,t=ws(Un())){const n=eh(e.minDate),a=eh(e.maxDate);if(n||a)return{min:n,max:a};const r=e.yearRange??[];return r.length===1&&typeof r[0]=="number"?{min:new yt(t.year-r[0],1,1),max:new yt(t.year+r[0],12,31)}:r.length===2&&typeof r[0]=="number"&&typeof r[1]=="number"?{min:new yt(r[0],1,1),max:new yt(r[1],12,31)}:{}}function Pd(e,t,n,a){if(!e||t==="time")return;if(t==="date")return e;const r=new ur(e.year,e.month,e.day,a?23:0,a?59:0,a?59:0);return n?r:yu(_f(r,"UTC"),Un())}function FP(e,t){const n=ws(Un());return Pd(n,e==="time"?"datetime":e,t,!1)??n}const VP=["id","aria-describedby"],zP={key:0},jP={key:1,class:"text-muted","data-empty":""},UP=["aria-label"],HP={class:"flex size-8 shrink-0 items-center justify-center text-muted","aria-hidden":"true"},KP=["data-mode"],WP=["aria-label"],GP={key:0,"data-datepicker-time":"",class:"mt-3 flex items-center gap-2 border-t border-border pt-3"},ko="flex size-8 shrink-0 items-center justify-center rounded-pager text-muted transition-colors duration-150 ease-out hover:bg-hover hover:text-text",YP=ae({__name:"DatepickerField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>OP(n.field.mode)),l=b(()=>r.value==="datetime"&&!!n.field.ignoreTimezone),o=b(()=>sa.value||"pl"),s=b(()=>{const ie=n.field.attributes?.readonly;return!!n.field.readOnly||ie!=null&&ie!==!1}),u=b(()=>MP(r.value,n.modelValue,l.value)),d=b(()=>r.value==="time"?null:u.value),c=b(()=>r.value==="time"?u.value:null),f=b(()=>BP(n.field)),v=b(()=>Pd(f.value.min,r.value,l.value,!1)),p=b(()=>Pd(f.value.max,r.value,l.value,!0)),h=FP(r.value,l.value),k=b(()=>NP(o.value,n.field.firstDay)),C=b(()=>n.field.twelveHour?12:24),x=b(()=>r.value==="date"?"day":"minute"),S=b(()=>qP(u.value,r.value,n.field.displayFormat,o.value)),q=b(()=>!n.field.required&&u.value!==null&&!s.value),O=b(()=>{const ie=d.value;return ie?!!v.value&&ie.compare(v.value)<0||!!p.value&&ie.compare(p.value)>0:!1}),E=new Set(["day","month","year","hour","minute","second"]),R=I(null),L=I(!1);function K(){const ie=R.value;if(!ie){L.value=!1;return}const _e=Array.from(ie.querySelectorAll("[data-reka-date-field-segment], [data-reka-time-field-segment]")).filter(ke=>E.has(ke.dataset.rekaDateFieldSegment??ke.dataset.rekaTimeFieldSegment??"")),z=_e.filter(ke=>!ke.hasAttribute("data-placeholder")).length;L.value=z>0&&z<_e.length}function $(){Ye(K)}Ve(u,$);const M=b(()=>!!n.invalid||O.value||L.value),H=b(()=>Qv(r.value,u.value,l.value));function P(ie){const _e=Qv(r.value,ie??null,l.value);$(),!(_e===H.value&&(_e!==null||n.modelValue===null))&&a("update:modelValue",_e)}function W(ie){if(!ie||r.value!=="datetime"){P(ie);return}const _e=d.value,z=j.value,ke=!_e||_e.year!==ie.year||_e.month!==ie.month||_e.day!==ie.day,me=!("hour"in ie)||ie.hour!==z.hour||ie.minute!==z.minute;ke&&me&&(ie=le(ie,z)),U.value=ie,P(ie)}function Z(){a("update:modelValue",null),$()}const U=I(null);Ve(d,ie=>{U.value=ie},{immediate:!0});const j=b(()=>{const ie=U.value??d.value;return ie&&"hour"in ie?new na(ie.hour,ie.minute):new na(0,0)});function le(ie,_e){return"hour"in ie?ie.set({hour:_e.hour,minute:_e.minute,second:0,millisecond:0}):new ur(ie.year,ie.month,ie.day,_e.hour,_e.minute)}function ue(ie){if(!ie)return;const _e=ie instanceof na?ie:new na(ie.hour,ie.minute),z=U.value??d.value??h,ke=le(z,_e);U.value=ke,P(ke)}function we(ie){return ie.charAt(0).toLocaleUpperCase(o.value)+ie.slice(1)}const De=b(()=>[Ft(M.value),"h-input flex min-w-0 items-center gap-1 pl-3.5 pr-1.5","focus-within:border-primary focus-within:shadow-[0_0_0_3px_var(--c-ring)]","has-[[data-invalid]]:border-danger"]);function Ae(ie){return ie==="literal"?"text-muted":ie==="timeZoneName"?"ml-2 min-w-0 truncate text-[13px] text-muted":"rounded-[4px] px-0.5 tabular-nums outline-none focus:bg-sel focus:text-text focus-visible:outline-none data-[placeholder]:text-placeholder focus:data-[placeholder]:text-text"}return(ie,_e)=>s.value?(m(),g("p",{key:0,id:e.controlId,"data-datepicker-readonly":"","aria-describedby":e.describedBy||void 0,class:"flex min-h-input items-center rounded-control border border-border bg-subtle px-3.5 tabular-nums"},[S.value!==""?(m(),g("span",zP,T(S.value),1)):(m(),g("span",jP,"—"))],8,VP)):r.value==="time"?(m(),g("div",{key:1,ref_key:"container",ref:R,"data-datepicker":"","data-mode":"time",class:he(De.value),onKeyup:$,onFocusout:$},[F(i(zv),{id:e.controlId,"model-value":c.value,locale:o.value,"hour-cycle":C.value,granularity:"minute",name:e.field.name,required:e.field.required||void 0,"aria-invalid":M.value?"true":void 0,"aria-describedby":e.describedBy||void 0,class:"flex min-w-0 flex-1 items-center","onUpdate:modelValue":P},{default:N(({segments:z})=>[(m(!0),g(pe,null,Re(z,ke=>(m(),V(i(jv),{key:ke.part,part:ke.part,class:he(Ae(ke.part))},{default:N(()=>[xe(T(ke.value),1)]),_:2},1032,["part","class"]))),128))]),_:1},8,["id","model-value","locale","hour-cycle","name","required","aria-invalid","aria-describedby"]),q.value?(m(),g("button",{key:0,type:"button","data-action":"clear","aria-label":i(_)("backend::lang.datepicker.clear"),class:he(ko),onClick:Z},[F(i(ln),{size:16,"aria-hidden":"true"})],8,UP)):ne("",!0),w("span",HP,[F(i(id),{size:16})])],34)):(m(),V(i(OD),{key:2,id:e.controlId,"model-value":d.value,"default-placeholder":i(h),locale:o.value,granularity:x.value,"hour-cycle":C.value,"hide-time-zone":r.value!=="datetime"||l.value,"min-value":v.value,"max-value":p.value,"week-starts-on":k.value,name:e.field.name,required:e.field.required||void 0,"close-on-select":r.value==="date","prevent-deselect":"","onUpdate:modelValue":W},{default:N(()=>[w("div",{ref_key:"container",ref:R,"data-datepicker":"","data-mode":r.value,class:he(De.value),onKeyup:$,onFocusout:$},[F(i(WD),{"aria-invalid":M.value?"true":void 0,"aria-describedby":e.describedBy||void 0,class:"flex min-w-0 flex-1 items-center overflow-hidden"},{default:N(({segments:z})=>[(m(!0),g(pe,null,Re(z,ke=>(m(),V(i(iM),{key:ke.part,part:ke.part,class:he(Ae(ke.part))},{default:N(()=>[xe(T(ke.value),1)]),_:2},1032,["part","class"]))),128))]),_:1},8,["aria-invalid","aria-describedby"]),q.value?(m(),g("button",{key:0,type:"button","data-action":"clear","aria-label":i(_)("backend::lang.datepicker.clear"),class:he(ko),onClick:Z},[F(i(ln),{size:16,"aria-hidden":"true"})],8,WP)):ne("",!0),F(i(hM),{"data-action":"open-calendar","aria-label":i(_)("backend::lang.datepicker.open_calendar"),class:he(ko)},{default:N(()=>[F(i(Tg),{size:16,"aria-hidden":"true"})]),_:1},8,["aria-label"])],42,KP),F(i(HD),{"data-datepicker-calendar":"","side-offset":4,align:"end",class:"z-50 w-[284px] rounded-inner border border-border bg-surface p-4 text-text shadow-menu"},{default:N(()=>[F(i(MD),null,{default:N(({weekDays:z,grid:ke})=>[F(i(rM),{class:"flex h-9 items-center justify-between"},{default:N(()=>[F(i(fM),{"aria-label":i(_)("backend::lang.datepicker.prev_month"),class:he(ko)},{default:N(()=>[F(i(cu),{size:16,"aria-hidden":"true"})]),_:1},8,["aria-label"]),F(i(oM),{class:"font-semibold"},{default:N(({headingValue:me})=>[xe(T(we(me)),1)]),_:1}),F(i(cM),{"aria-label":i(_)("backend::lang.datepicker.next_month"),class:he(ko)},{default:N(()=>[F(i(bs),{size:16,"aria-hidden":"true"})]),_:1},8,["aria-label"])]),_:1}),(m(!0),g(pe,null,Re(ke,me=>(m(),V(i(YD),{key:me.value.toString(),class:"mt-2 w-full border-collapse select-none"},{default:N(()=>[F(i(QD),null,{default:N(()=>[F(i(Fv),{class:"flex"},{default:N(()=>[(m(!0),g(pe,null,Re(z,Y=>(m(),V(i(nM),{key:Y,class:"flex h-9 w-9 items-center justify-center text-[13px] font-normal text-muted"},{default:N(()=>[xe(T(Y),1)]),_:2},1024))),128))]),_:2},1024)]),_:2},1024),F(i(ZD),null,{default:N(()=>[(m(!0),g(pe,null,Re(me.rows,(Y,fe)=>(m(),V(i(Fv),{key:`week-${fe}`,class:"flex"},{default:N(()=>[(m(!0),g(pe,null,Re(Y,G=>(m(),V(i(RD),{key:G.toString(),date:G,class:"p-0"},{default:N(()=>[F(i(qD),{day:G,month:me.value,class:"flex size-9 items-center justify-center rounded-pager tabular-nums text-text transition-colors duration-150 ease-out hover:bg-hover data-[outside-view]:text-placeholder data-[today]:font-semibold data-[today]:shadow-[inset_0_0_0_1px_var(--c-border-strong)] data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-on-primary data-[disabled]:cursor-not-allowed data-[disabled]:text-placeholder data-[disabled]:opacity-40 data-[disabled]:hover:bg-transparent data-[unavailable]:cursor-not-allowed data-[unavailable]:opacity-40"},null,8,["day","month"])]),_:2},1032,["date"]))),128))]),_:2},1024))),128))]),_:2},1024)]),_:2},1024))),128))]),_:1}),r.value==="datetime"?(m(),g("div",GP,[F(i(id),{size:16,class:"shrink-0 text-muted","aria-hidden":"true"}),F(i(zv),{"model-value":j.value,locale:o.value,"hour-cycle":C.value,granularity:"minute","hide-time-zone":"",class:"flex min-w-0 items-center","onUpdate:modelValue":ue},{default:N(({segments:z})=>[(m(!0),g(pe,null,Re(z,ke=>(m(),V(i(jv),{key:ke.part,part:ke.part,class:he(Ae(ke.part))},{default:N(()=>[xe(T(ke.value),1)]),_:2},1032,["part","class"]))),128))]),_:1},8,["model-value","locale","hour-cycle"])])):ne("",!0)]),_:1})]),_:1},8,["id","model-value","default-placeholder","locale","granularity","hour-cycle","hide-time-zone","min-value","max-value","week-starts-on","name","required","close-on-select"]))}}),op=Symbol("summer.form.values"),sp=Symbol("summer.form.patch"),ip=Symbol("summer.form.locale"),Fi=Symbol("summer.form.enabledLocales"),l0=Symbol("summer.form.assets");function up(){const e=I(0);return{activeUploads:e,beginUpload(){e.value++;let t=!1;return()=>{t||(t=!0,e.value>0&&e.value--)}}}}const no=Symbol("summer.form.session"),o0=Symbol("summer.settings.secrets"),cp=Symbol("summer.form.permissionLocks"),dp=Symbol("summer.form.triggerNotes"),th="summer-action",JP="summer-result",nh="summer-change",ah="summer-upload",ZP="summer-upload-result",s0=5e3,fp=Symbol("summer.form.feedback"),$s=Symbol("summer.form.fieldScope"),pp=Symbol("summer.form.rememberLabel"),i0=Symbol("summer.form.dependentCache"),XP=["data-dependent"],QP={class:"relative"},eR=["id","name","value","disabled","required","aria-required","aria-invalid","aria-busy","aria-describedby"],tR={key:0,value:"state",class:"text-muted"},nR=["value"],aR=["id"],rR={key:1,class:"flex flex-wrap items-center gap-2"},lR=["id"],Gs="empty",Ys="placeholder",oR=ae({__name:"DropdownField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=" ".repeat(4),l=it($s,null),o=it(fp,null),s=it(i0,null)??new Map,u=b(()=>n.field.dependsOn??""),d=b(()=>u.value!==""),c=I("waiting"),f=I([]),v=b(()=>{const j=l?.values.value[u.value];return j==null||j===""||typeof j=="object"?null:String(j)}),p=b(()=>l?.fields.value.find(j=>j.name===u.value)),h=b(()=>p.value?.label||u.value),k=b(()=>(p.value?.options??[]).find(le=>x(le.value,v.value))?.label??v.value??""),C=b(()=>d.value?f.value:n.field.options??[]);function x(j,le){return j==null||le===null||le===void 0?j===le||j==null&&le==null:String(j)===String(le)}function S(){return n.modelValue!==null&&n.modelValue!==void 0&&n.modelValue!==""}function q(){S()&&(a("update:modelValue",null),o?.announce(_("backend::lang.form.dependent_cleared",{field:n.field.label||n.field.name})))}function O(j,le){if(!j.applies){f.value=[],c.value="unused",le&&q();return}f.value=j.options.map(ue=>({value:ue.value,label:r.repeat(Math.max(0,ue.depth))+ue.label})),c.value=f.value.length>0?"ready":"empty",le&&S()&&!f.value.some(ue=>x(ue.value,n.modelValue))&&q()}let E=0,R=!1;async function L(j){const le=++E,ue=v.value;if(ue===null){f.value=[],c.value="waiting",j&&q();return}const we=l?.path(n.field.name)??n.field.name,De=`${we}\0${ue}`,Ae=s.get(De);if(Ae){O(Ae,j);return}if(!n.source){R=j,c.value="failed";return}c.value="loading";try{const{data:ie}=await Ne.GET("/{vendor}/{plugin}/{controller}/fields/{field}/dependent-options",{params:{path:{...n.source,field:we},query:{[`values[${u.value}]`]:ue}}});if(le!==E)return;if(!ie){R=j,c.value="failed";return}s.set(De,ie.data),O(ie.data,j)}catch{le===E&&(R=j,c.value="failed")}}function K(){L(R)}Ve(v,(j,le)=>{d.value&&j!==le&&L(!0)}),Ct(()=>{d.value&&L(!1)}),Dt(()=>{E++});const $=b(()=>{const j=C.value.findIndex(le=>x(le.value,n.modelValue));return j>=0?String(j):n.field.emptyOption!==void 0&&!S()?Gs:Ys}),M=b(()=>{switch(c.value){case"waiting":return _("backend::lang.form.dependent_waiting",{field:h.value});case"loading":return _("backend::lang.form.loading_options");case"unused":return _("backend::lang.form.dependent_not_used");case"empty":return _("backend::lang.form.dependent_empty",{type:k.value});case"failed":return _("backend::lang.form.dependent_failed");default:return""}}),H=b(()=>d.value&&c.value!=="ready"),P=b(()=>H.value||$.value===Gs||$.value===Ys),W=b(()=>`${n.controlId}-dependent`),Z=b(()=>[n.describedBy??"",d.value&&(c.value==="empty"||c.value==="failed")?W.value:""].filter(Boolean).join(" "));function U(j){const le=j.target.value;if(le===Gs){a("update:modelValue",null);return}const ue=C.value[Number(le)];ue&&a("update:modelValue",ue.value)}return(j,le)=>(m(),g("div",{class:"flex flex-col gap-1.5","data-dependent":d.value?c.value:void 0},[w("div",QP,[w("select",{id:e.controlId,name:e.field.name,value:H.value?"state":$.value,disabled:H.value||void 0,required:e.field.required||void 0,"aria-required":e.field.required?"true":void 0,"aria-invalid":e.invalid?"true":void 0,"aria-busy":d.value&&c.value==="loading"?"true":void 0,"aria-describedby":Z.value||void 0,class:he([[i(Ft)(e.invalid),P.value?"text-muted":""],"h-input appearance-none pr-10 disabled:cursor-not-allowed"]),onChange:U},[H.value?(m(),g("option",tR,T(M.value),1)):(m(),g(pe,{key:1},[e.field.emptyOption!==void 0?(m(),g("option",{key:0,value:Gs,class:"text-muted"},T(e.field.emptyOption),1)):ne("",!0),$.value===Ys?(m(),g("option",{key:1,value:Ys,disabled:""},T(i(_)("backend::lang.form.select_placeholder")),1)):ne("",!0),(m(!0),g(pe,null,Re(C.value,(ue,we)=>(m(),g("option",{key:we,value:String(we),class:"text-text"},T(ue.label),9,nR))),128))],64))],42,eR),F(i(sr),{size:16,class:"pointer-events-none absolute top-1/2 right-3.5 -translate-y-1/2 text-muted","aria-hidden":"true"})]),d.value&&c.value==="empty"?(m(),g("p",{key:0,id:W.value,"data-dependent-hint":"",class:"text-[13px] text-muted"},T(M.value),9,aR)):d.value&&c.value==="failed"?(m(),g("div",rR,[w("p",{id:W.value,role:"alert",class:"flex items-center gap-1.5 text-[13px] text-danger"},[F(i(bt),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.form.dependent_failed")),1)],8,lR),F(Ge,{variant:"ghost",size:"sm",icon:i(ai),"data-action":"dependent-retry",onClick:K},{default:N(()=>[xe(T(i(_)("backend::lang.form.dependent_retry")),1)]),_:1},8,["icon"])])):ne("",!0)],8,XP))}}),sR={class:"flex items-start gap-3"},iR={class:"flex min-w-0 flex-1 flex-col gap-1"},uR={key:0,class:"flex items-center gap-4"},cR=["src"],dR={key:1,class:"flex size-16 shrink-0 items-center justify-center rounded-inner bg-subtle","aria-hidden":"true"},fR=["title"],pR={class:"flex flex-col gap-1.5"},mR=["for"],vR=["id","disabled","aria-invalid","aria-describedby"],hR=["id"],yR={class:"flex flex-col gap-1.5"},gR=["for"],bR=["id","disabled","aria-invalid","aria-describedby"],_R=["id"],xR={class:"flex gap-2.5"},kR=["disabled"],wR=["aria-keyshortcuts","title","disabled"],$R=ae({__name:"FileCaptionModal",props:{open:{type:Boolean},file:{},routes:{},preview:{},idPrefix:{}},emits:["update:open","saved","closed"],setup(e,{emit:t}){const n=e,a=t,r=I(""),l=I(""),o=I({}),s=I(!1),u=$r();function d(C){const x={};for(const[S,q]of Object.entries(C??{})){const O=(Array.isArray(q)?q:[q]).filter(E=>typeof E=="string"&&E!=="");O.length>0&&(x[S]=O)}return x}const c=b(()=>`${n.idPrefix}-caption-title`),f=b(()=>`${n.idPrefix}-caption-description`),v=b(()=>!!n.file&&(r.value!==n.file.title||l.value!==n.file.description));Ve(()=>n.open,C=>{C&&n.file&&(r.value=n.file.title??"",l.value=n.file.description??"",o.value={},s.value=!1)},{immediate:!0});async function p(C){if(C){a("update:open",!0);return}s.value||v.value&&!await u.ask({message:_("backend::lang.form.unsaved_confirm"),confirmLabel:_("backend::lang.form.discard"),danger:!0})||a("update:open",!1)}async function h(){if(!(s.value||!n.file||!n.routes)){s.value=!0;try{const C=await n.routes.update(n.file.id,{title:r.value,description:l.value});if(C.data){o.value={},a("saved",C.data),a("update:open",!1),Le(_("backend::lang.fileupload.details_saved"));return}if(C.status===422){o.value=d(C.error?.details),Object.keys(o.value).length===0&&(o.value={title:[lp(C.error)||_("backend::lang.form.error_generic")]});return}Le(C.error?.message||_("backend::lang.form.error_generic"),"danger")}finally{s.value=!1}}}function k(C){C.preventDefault(),a("closed")}return(C,x)=>(m(),g(pe,null,[F(i(Jr),{open:e.open,"onUpdate:open":p},{default:N(()=>[F(i(Xl),null,{default:N(()=>[F(i(Xr),{"data-dialog-overlay":"",class:"fixed inset-0 z-40 bg-overlay"}),F(i(Zr),{"data-caption-modal":"","data-dialog-content":"","aria-modal":"true",class:"fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100vh-32px)] w-[calc(100%-32px)] max-w-[560px] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-y-auto rounded-modal bg-surface p-6 text-text shadow-pop",onCloseAutoFocus:k},{default:N(()=>[w("div",sR,[w("div",iR,[F(i(Qr),{class:"text-[20px] font-bold tracking-[-0.01em]"},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.attachment")),1)]),_:1}),F(i(dr),{class:"text-muted"},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.help")),1)]),_:1})]),F(i(Hr),{"data-action":"close","aria-label":i(_)("backend::lang.form.close"),disabled:s.value,class:"flex size-[34px] shrink-0 items-center justify-center rounded-tab bg-subtle text-muted hover:bg-hover hover:text-text"},{default:N(()=>[F(i(ln),{size:16,"aria-hidden":"true"})]),_:1},8,["aria-label","disabled"])]),e.file?(m(),g("div",uR,[e.preview?(m(),g("img",{key:0,src:e.preview,alt:"",class:"size-16 shrink-0 rounded-inner object-cover"},null,8,cR)):(m(),g("span",dR,[F(i(Cl),{size:16,class:"text-muted"})])),w("span",{class:"min-w-0 truncate text-[13px] text-muted",title:e.file.file_name},T(e.file.file_name),9,fR)])):ne("",!0),w("form",{class:"flex flex-col gap-4",novalidate:"",onSubmit:vt(h,["prevent"])},[w("div",pR,[w("label",{for:c.value,class:"font-semibold"},T(i(_)("backend::lang.fileupload.title_label")),9,mR),oa(w("input",{id:c.value,"onUpdate:modelValue":x[0]||(x[0]=S=>r.value=S),type:"text","data-caption-title":"",disabled:s.value,"aria-invalid":o.value.title?"true":void 0,"aria-describedby":o.value.title?`${c.value}-error`:void 0,class:he([i(Ft)(!!o.value.title),"h-input"])},null,10,vR),[[Vl,r.value]]),o.value.title?(m(),g("p",{key:0,id:`${c.value}-error`,class:"flex items-center gap-1.5 text-[13px] text-danger"},[F(i(bt),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(o.value.title.join(" ")),1)],8,hR)):ne("",!0)]),w("div",yR,[w("label",{for:f.value,class:"font-semibold"},T(i(_)("backend::lang.fileupload.description_label")),9,gR),oa(w("textarea",{id:f.value,"onUpdate:modelValue":x[1]||(x[1]=S=>l.value=S),rows:"3","data-caption-description":"",disabled:s.value,"aria-invalid":o.value.description?"true":void 0,"aria-describedby":o.value.description?`${f.value}-error`:void 0,class:he([i(Ft)(!!o.value.description),"min-h-input resize-y py-2.5"])},null,10,bR),[[Vl,l.value]]),o.value.description?(m(),g("p",{key:0,id:`${f.value}-error`,class:"flex items-center gap-1.5 text-[13px] text-danger"},[F(i(bt),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(o.value.description.join(" ")),1)],8,_R)):ne("",!0)]),w("div",xR,[w("button",{type:"button","data-action":"cancel",disabled:s.value,class:"inline-flex h-button flex-1 items-center justify-center rounded-control border border-border-strong bg-surface font-semibold hover:bg-hover disabled:cursor-not-allowed disabled:opacity-60",onClick:x[2]||(x[2]=S=>p(!1))},T(i(_)("backend::lang.form.cancel")),9,kR),w("button",{type:"submit","data-action":"save-caption","data-hotkey":"mod+s mod+enter","aria-keyshortcuts":i(Tu)("mod+s mod+enter"),title:i(qn)(i(_)("backend::lang.fileupload.details_submit"),"mod+s"),disabled:s.value,class:"inline-flex h-button flex-1 items-center justify-center rounded-control bg-primary font-semibold text-on-primary hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60"},T(s.value?i(_)("backend::lang.form.saving"):i(_)("backend::lang.fileupload.details_submit")),9,wR)])],32)]),_:1})]),_:1})]),_:1},8,["open"]),F(wr,{open:i(u).request.value!==null,message:i(u).request.value?.message??"","confirm-label":i(u).request.value?.confirmLabel,danger:i(u).request.value?.danger,onConfirm:i(u).confirm,onCancel:i(u).cancel},null,8,["open","message","confirm-label","danger","onConfirm","onCancel"])],64))}}),CR=["id","data-field-name","aria-labelledby","aria-describedby","aria-busy"],SR={key:0,"data-fileupload-loading":"",class:"h-[112px] rounded-control bg-skel","aria-hidden":"true"},ER={key:1,role:"alert","data-fileupload-failed":"",class:"rounded-inner bg-danger-soft px-[18px] py-3.5 text-danger"},AR={key:0,"data-fileupload-empty":"",class:"flex min-h-input items-center rounded-control border border-border bg-subtle px-3.5 text-muted"},TR={key:1,"data-fileupload-grid":"",class:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-4"},OR=["data-file-item","data-state","onDragover","onDrop"],DR={class:"relative flex aspect-square items-center justify-center bg-subtle"},MR=["href","aria-label"],PR=["src","alt","onError"],RR=["aria-label","onClick"],IR=["src","alt"],qR={key:2,"data-preview-unavailable":"",class:"flex flex-col items-center gap-2 text-[13px] text-muted"},LR=["data-handle","aria-label","onKeydown","onDragstart"],NR={key:5,class:"absolute top-2 right-2 flex gap-1"},BR=["data-caption","aria-label","onClick"],FR=["aria-label","onClick"],VR=["aria-label","onClick"],zR={class:"flex flex-col gap-1 p-2"},jR=["title"],UR={class:"flex items-center gap-2 text-[13px] text-muted tabular-nums"},HR={key:0},KR={key:1},WR={key:2},GR={key:3,"data-unsaved-chip":"",class:"inline-flex h-6 items-center rounded-pill bg-sel px-2 text-[13px] font-semibold text-text"},YR={key:1,"data-file-error":"",class:"text-[13px] text-danger"},JR={class:"sr-only"},ZR={key:2,"data-fileupload-single":"",class:"flex flex-col gap-2"},XR=["data-file-item","data-state"],QR=["src","alt","onError"],eI={key:3,"data-preview-unavailable":"",class:"flex flex-col items-center gap-2 text-[13px] text-muted"},tI={class:"flex min-w-0 flex-1 flex-col gap-1"},nI=["title"],aI={class:"flex items-center gap-2 text-[13px] text-muted tabular-nums"},rI={key:0},lI={key:1},oI={key:2},sI={key:3,"data-unsaved-chip":"",class:"inline-flex h-6 items-center rounded-pill bg-sel px-2 text-[13px] font-semibold text-text"},iI={key:1,"data-file-error":"",class:"text-[13px] text-danger"},uI={class:"sr-only"},cI={key:2,class:"mt-1 flex flex-wrap gap-2"},dI={key:3,"data-fileupload-rows":"",class:"flex flex-col gap-2"},fI=["data-file-item","data-state","onDragover","onDrop"],pI={class:"flex items-center gap-3"},mI=["data-handle","aria-label","onKeydown","onDragstart"],vI={class:"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-pager bg-subtle"},hI=["src","onError"],yI={class:"flex min-w-0 flex-1 flex-col leading-tight"},gI=["title"],bI=["title"],_I=["title"],xI={class:"flex shrink-0 items-center gap-2 text-[13px] text-muted tabular-nums"},kI={key:0},wI={key:1},$I={key:2},CI={key:3,"data-unsaved-chip":"",class:"inline-flex h-6 items-center rounded-pill bg-sel px-2 text-[13px] font-semibold text-text"},SI={class:"flex shrink-0 items-center gap-1"},EI=["href","aria-label"],AI=["aria-label","onClick"],TI=["data-caption","aria-label","onClick"],OI=["aria-label","onClick"],DI=["aria-label","onClick"],MI={key:1,"data-file-error":"",class:"text-[13px] text-danger"},PI={class:"sr-only"},RI=["aria-describedby"],II={class:"flex size-10 items-center justify-center rounded-full bg-surface","aria-hidden":"true"},qI={class:"text-text"},LI={key:0,"data-fileupload-limits":"",class:"text-[13px] text-muted tabular-nums"},NI={key:5,"data-fileupload-limits":"",class:"text-[13px] text-muted tabular-nums"},BI={key:6,role:"alert","data-fileupload-too-many":"",class:"flex items-center gap-1.5 text-[13px] text-danger"},FI=["accept","multiple"],VI={class:"sr-only","aria-live":"polite","data-fileupload-live":""},zI=1<<20,jI=400,Mc="inline-flex size-8 items-center justify-center rounded-pager border border-border bg-surface text-muted hover:text-text",UI="inline-flex size-8 items-center justify-center rounded-pager border border-border bg-surface text-muted hover:bg-danger-soft hover:text-danger",vl="inline-flex size-8 shrink-0 items-center justify-center rounded-pager text-muted hover:bg-hover hover:text-text",HI=ae({__name:"FileuploadField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},setup(e){const t=e,n=it(no,null),a=["jpg","jpeg","png","gif","webp"],r=["image/jpeg","image/png","image/gif","image/webp"];let l=1;const o=I([]),s=I("loading"),u=I(!1),d=I(0),c=I(""),f=I(null),v=I(null),p=I(null),h=I(null),k=I(null),C=I(!1),x=I({}),S=I(new Set),q=I(new Set),O=new Set,E=[],R=n?n.routes(t.field.name):null;let L=null,K=null,$=!1,M=null,H=0,P=!1;const W=b(()=>{const J=t.field.attributes?.readonly;return!!t.field.readOnly||J!=null&&J!==!1}),Z=b(()=>t.field.multiple===!0),U=b(()=>t.field.mode==="image"),j=b(()=>Z.value?t.field.maxFiles:1),le=b(()=>(n?.recordId??0)!==0),ue=b(()=>o.value.filter(J=>J.state!=="failed")),we=b(()=>{if(Z.value)return o.value;const J=ue.value,Oe=J[J.length-1];return o.value.filter(te=>te.state==="failed"||te===Oe)}),De=b(()=>we.value.filter(J=>J.state!=="failed").length),Ae=b(()=>W.value||s.value!=="ready"?!1:Z.value?j.value===void 0||j.value===null||ue.value.lengthZ.value&&!W.value&&typeof j.value=="number"&&ue.value.length>=j.value),_e=b(()=>t.field.fileTypes?.length?t.field.fileTypes.map(J=>J.toLowerCase()):U.value&&!t.field.mimeTypes?.length?a:null),z=b(()=>(t.field.fileTypes?.length?t.field.fileTypes:t.field.mimeTypes??[]).join(", ")),ke=b(()=>{const J=[];for(const Oe of t.field.fileTypes??[])J.push(`.${Oe.toLowerCase()}`);for(const Oe of t.field.mimeTypes??[])J.push(Oe.includes("/")?Oe:`.${Oe.toLowerCase()}`);return J.length===0&&U.value&&J.push(...r),J.length>0?J.join(","):void 0}),me=b(()=>t.field.prompt||_(Z.value?"backend::lang.fileupload.default_prompt_many":"backend::lang.fileupload.default_prompt"));function Y(J,Oe){return new Intl.NumberFormat(sa.value,{minimumFractionDigits:Oe,maximumFractionDigits:Oe}).format(J)}function fe(J){const Oe=["B","kB","MB","GB"];let te=J,Ie=0;for(;te>=1e3&&Ie{const J=t.field.maxFilesize;return typeof J=="number"?`${new Intl.NumberFormat(sa.value).format(J)} MB`:""}),X=b(()=>{const J=[];return z.value!==""&&J.push(_("backend::lang.fileupload.limits_types",{types:z.value})),G.value!==""&&J.push(_("backend::lang.fileupload.limits_size",{size:G.value})),Z.value&&typeof j.value=="number"&&J.push(_("backend::lang.fileupload.limits_count",{current:ue.value.length,max:j.value})),J.join(" · ")});function ee(J){const Oe=J.lastIndexOf(".");return Oe<0?"":J.slice(Oe+1).toLowerCase()}function y(J){const Oe=t.field.mimeTypes??[];if(Oe.length===0||J.type==="")return!0;const te=J.type.toLowerCase(),Ie=ee(J.name);return Oe.some(et=>{const Tt=et.toLowerCase();return Tt.includes("/")?Tt.endsWith("/*")?te.startsWith(Tt.slice(0,-1)):te===Tt:Tt===Ie})}function A(J){const Oe=_e.value;if(Oe&&!Oe.includes(ee(J.name)))return _("backend::lang.fileupload.wrong_type",{name:J.name,types:Oe.join(", ")});if(!y(J))return _("backend::lang.fileupload.wrong_type",{name:J.name,types:z.value});const te=t.field.maxFilesize;return typeof te=="number"&&J.size>Math.ceil(te*zI)?_("backend::lang.fileupload.too_large",{name:J.name,size:G.value}):""}function D(J){return Ln({uid:l++,name:J.file_name,size:J.file_size,state:"done",progress:100,error:"",retryable:!1,file:J,source:null,handle:null,uploadId:""})}function re(){return globalThis.crypto?.randomUUID?.()??`u${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function Q(J,Oe){return Ln({uid:l++,name:J.name,size:J.size,state:Oe===""?"queued":"failed",progress:0,error:Oe,retryable:!1,file:null,source:di(J),handle:null,uploadId:re()})}function ce(J){return o.value.find(Oe=>Oe.uid===J)}async function Ee(J){if(!R){s.value="failed";return}J&&(s.value="loading");const Oe=await R.list();if(P)return;if(!Oe.data){J&&(s.value="failed");return}const te=o.value.filter(Ie=>Ie.state!=="done");for(const Ie of o.value)Ie.state==="done"&&nl(Ie.uid);o.value=[...Oe.data.map(D),...te],s.value="ready"}function Ce(){W.value||f.value?.click()}function Te(J){if(J.length===0||W.value)return;if(d.value=0,!Z.value)for(const et of[...o.value])et.state!=="failed"&&(et.state!=="done"||et.file?.pending)&&ot(et);let Oe=Z.value?typeof j.value=="number"?Math.max(j.value-ue.value.length,0):Number.POSITIVE_INFINITY:1,te=0;const Ie=[];for(const et of J.slice(0,Z.value?J.length:1)){const Tt=A(et);if(Tt===""&&Oe<=0){te++;continue}Tt===""&&Oe--,Ie.push(Q(et,Tt))}o.value=[...o.value,...Ie],d.value=te,Be()}function oe(J){const Oe=J.target;Te(Array.from(Oe.files??[])),Oe.value=""}function $e(J){return p.value===null&&Array.from(J.dataTransfer?.types??[]).includes("Files")}function ye(J){$e(J)&&(J.preventDefault(),u.value=!0)}function qe(J){$e(J)&&(J.preventDefault(),u.value=!1,Te(Array.from(J.dataTransfer?.files??[])))}function Be(){if(!R||o.value.some(Oe=>Oe.state==="uploading"))return;const J=o.value.find(Oe=>Oe.state==="queued");J&&He(J)}async function He(J){if(!R||!J.source)return;J.state="uploading",J.progress=0,J.error="",J.retryable=!1;const Oe=new Set(o.value.filter(Ie=>Ie.file).map(Ie=>Ie.file.id)),te=n?.beginUpload();try{const Ie=R.upload(J.source,(Kn,Va)=>{J.progress=Va>0?Math.min(100,Math.round(Kn/Va*100)):0},J.uploadId||void 0);J.handle=di(Ie);const et=await Ie.promise;J.handle=null;const Tt=!!ce(J.uid);if(et.ok)!Tt||P?R.remove(et.item.id):(J.state="done",J.progress=100,J.file=et.item,J.name=et.item.file_name,J.size=et.item.file_size,n?.markDirty());else if(et.reason==="aborted"||et.reason==="network"){const Kn=await Je(Oe);if(et.reason==="aborted"){for(const Va of Kn)R.remove(Va.id);o.value=o.value.filter(Va=>Va.uid!==J.uid),nl(J.uid)}else Tt&&Kn[0]&&Kn.length===1?(J.state="done",J.progress=100,J.file=Kn[0],J.name=Kn[0].file_name,J.size=Kn[0].file_size,n?.markDirty()):(J.state="failed",J.error=_("backend::lang.fileupload.upload_failed"),J.retryable=!0)}else if(Tt)switch(J.state="failed",et.reason){case"too_large":J.error=G.value?_("backend::lang.fileupload.too_large",{name:J.name,size:G.value}):et.message||_("backend::lang.fileupload.upload_failed");break;case"invalid":J.error=et.message||_("backend::lang.fileupload.upload_failed");break;default:J.error=et.message||_("backend::lang.fileupload.upload_failed"),J.retryable=et.status>=500}}finally{te?.(),P||Be()}}async function Je(J){if(!R)return[];const Oe=await R.list();return Oe.data?Oe.data.filter(te=>te.pending&&!J.has(te.id)):[]}function Ze(J){J.state!=="failed"||!J.source||(J.state="queued",J.error="",J.retryable=!1,Be())}async function ot(J){const Oe=o.value.findIndex(Ie=>Ie.uid===J.uid);if(Oe<0)return;switch(o.value=o.value.filter(Ie=>Ie.uid!==J.uid),nl(J.uid),J.state){case"uploading":J.handle?.abort(),n?.markDirty(),Be();return;case"queued":case"failed":return}if(!R||!J.file)return;n?.markDirty();const te=await R.remove(J.file.id);if(!te.data&&!P){const Ie=[...o.value];Ie.splice(Math.min(Oe,Ie.length),0,J),o.value=Ie,Le(te.error?.message||_("backend::lang.form.error_generic"),"danger")}}function at(){return o.value.map(J=>J.uid)}function St(J){const Oe=new Map(o.value.map(et=>[et.uid,et])),te=J.map(et=>Oe.get(et)).filter(et=>!!et),Ie=o.value.filter(et=>!J.includes(et.uid));o.value=[...te,...Ie]}function At(){L!==null&&clearTimeout(L),L=setTimeout(()=>{L=null,Fe()},jI)}function qt(){return o.value.filter(J=>J.state==="done"&&J.file).map(J=>J.file.id)}async function Fe(){if(!R)return;const J=qt();if($){M=J;return}const Oe=K;K=null;const te=++H;$=!0;try{const Ie=await R.reorder(J);if(M)return;!Ie.data&&!P&&te===H&&(Oe&&St(Oe),Le(_("backend::lang.fileupload.reorder_failed"),"danger"))}finally{$=!1,M&&(M=null,Fe())}}function de(J,Oe){const te=o.value.findIndex(Tt=>Tt.uid===J);if(te<0||Oe<0||Oe>=o.value.length||Oe===te)return!1;K===null&&(K=at());const Ie=[...o.value],[et]=Ie.splice(te,1);return Ie.splice(Oe,0,et),o.value=Ie,c.value=_("backend::lang.fileupload.moved",{name:et.name,position:Oe+1,total:Ie.length}),At(),!0}async function ge(J,Oe){const te=o.value.findIndex(et=>et.uid===Oe.uid);let Ie;switch(J.key){case"ArrowUp":case"ArrowLeft":Ie=te-1;break;case"ArrowDown":case"ArrowRight":Ie=te+1;break;default:return}J.preventDefault(),de(Oe.uid,Ie)&&(await Ye(),v.value?.querySelector(`[data-handle="${Oe.uid}"]`)?.focus())}function je(J,Oe){p.value=Oe.uid,J.dataTransfer&&(J.dataTransfer.effectAllowed="move",J.dataTransfer.setData("text/plain",Oe.name))}function rt(J,Oe){p.value!==null&&(J.preventDefault(),h.value=Oe.uid)}function zt(J,Oe){p.value!==null&&(J.preventDefault(),de(p.value,o.value.findIndex(te=>te.uid===Oe.uid)),Lt())}function Lt(){p.value=null,h.value=null}function Pn(J){const Oe=J.file?.content_type??J.source?.type??"";return r.includes(Oe.toLowerCase())}function Gt(J){return!J.file||!Pn(J)||S.value.has(J.uid)?null:!t.field.protected&&!q.value.has(J.uid)?J.file.thumb_url||J.file.url||null:x.value[J.uid]??null}function lo(){return typeof URL.revokeObjectURL=="function"}function nl(J){const Oe=x.value[J];if(Oe!==void 0){lo()&&URL.revokeObjectURL(Oe);const te={...x.value};delete te[J],x.value=te}if(O.delete(J),q.value.has(J)){const te=new Set(q.value);te.delete(J),q.value=te}}async function oo(J){if(!R||!J.file||O.has(J.uid)||typeof URL.createObjectURL!="function")return;O.add(J.uid);const Oe=await R.thumb(J.file.id);if(!(P||!ce(J.uid)||!O.has(J.uid))){if(!Oe){S.value=new Set([...S.value,J.uid]);return}x.value={...x.value,[J.uid]:URL.createObjectURL(Oe)}}}Ve(()=>o.value.map(J=>`${J.uid}:${J.state}`).join(","),()=>{if(t.field.protected)for(const J of o.value)J.state==="done"&&Pn(J)&&oo(J)});function al(J){if(!t.field.protected&&!q.value.has(J.uid)&&(q.value=new Set([...q.value,J.uid]),R&&typeof URL.createObjectURL=="function")){oo(J);return}S.value=new Set([...S.value,J.uid])}async function so(J,Oe){if(!R||!J.file||typeof URL.createObjectURL!="function")return;const te=await R.download(J.file.id);if(!te){Le(_("backend::lang.form.error_generic"),"danger");return}const Ie=URL.createObjectURL(te);E.push(Ie);const et=document.createElement("a");et.href=Ie,et.rel="noopener",Oe?et.download=J.file.file_name:et.target="_blank",et.click()}function kn(J){return t.field.useCaption&&J.file?.title?J.file.title:J.name}function Fa(J){return le.value&&!!J.file?.pending}const Qt=b(()=>k.value===null?void 0:ce(k.value));function Hn(J){k.value=J.uid,C.value=!0}function io(J){const Oe=Qt.value;Oe&&(Oe.file=J)}function uo(){const J=k.value;k.value=null,J!==null&&v.value?.querySelector(`[data-caption="${J}"]`)?.focus()}const co=b(()=>{const J=t.field.thumbOptions?.mode;return J==="fit"||J==="auto"?"object-contain":"object-cover"});return Ct(()=>{Ee(!0)}),n&&Ve(n.revision,()=>{Ee(!1)}),Dt(()=>{P=!0,L!==null&&(clearTimeout(L),L=null);for(const J of o.value)J.handle?.abort();if(lo()){for(const J of Object.values(x.value))URL.revokeObjectURL(J);for(const J of E)URL.revokeObjectURL(J)}}),(J,Oe)=>(m(),g("div",{id:e.controlId,ref_key:"root",ref:v,role:"group","data-fileupload":"","data-field-name":e.field.name,"aria-labelledby":e.field.label?`${e.controlId}-label`:void 0,"aria-describedby":e.describedBy||void 0,"aria-busy":s.value==="loading"?"true":void 0,class:"flex min-w-0 flex-col gap-4"},[s.value==="loading"?(m(),g("span",SR)):s.value==="failed"?(m(),g("p",ER,T(i(_)("backend::lang.fileupload.load_failed")),1)):(m(),g(pe,{key:2},[W.value&&we.value.length===0?(m(),g("p",AR,T(i(_)("backend::lang.fileupload.empty")),1)):U.value&&Z.value&&we.value.length>0?(m(),g("ul",TR,[(m(!0),g(pe,null,Re(we.value,te=>(m(),g("li",{key:te.uid,"data-file-item":te.uid,"data-state":te.state,class:he([[te.state==="failed"?"border-danger":"border-border",p.value===te.uid?"opacity-50":"",h.value===te.uid&&p.value!==te.uid?"border-2 border-dashed border-primary bg-sel":""],"relative overflow-hidden rounded-inner border bg-surface"]),onDragover:Ie=>rt(Ie,te),onDrop:Ie=>zt(Ie,te)},[w("div",DR,[te.state==="uploading"?(m(),V(i(Ml),{key:0,size:20,class:"animate-spin text-muted","aria-hidden":"true"})):te.state==="failed"?(m(),V(i(bt),{key:1,size:16,class:"text-danger","aria-hidden":"true"})):te.state==="done"?(m(),g(pe,{key:2},[Gt(te)&&!e.field.protected&&te.file?.url?(m(),g("a",{key:0,href:te.file.url,target:"_blank",rel:"noopener",class:"block size-full","aria-label":i(_)("backend::lang.fileupload.open_preview",{name:te.name})},[w("img",{src:Gt(te)??void 0,alt:kn(te),class:he([co.value,"size-full"]),onError:Ie=>al(te)},null,42,PR)],8,MR)):Gt(te)?(m(),g("button",{key:1,type:"button",class:"block size-full","aria-label":i(_)("backend::lang.fileupload.open_preview",{name:te.name}),onClick:Ie=>so(te,!1)},[w("img",{src:Gt(te)??void 0,alt:kn(te),class:he([co.value,"size-full"])},null,10,IR)],8,RR)):S.value.has(te.uid)?(m(),g("span",qR,[F(i(zm),{size:20,"aria-hidden":"true"}),xe(" "+T(i(_)("backend::lang.fileupload.preview_unavailable")),1)])):(m(),V(i(Cl),{key:3,size:20,class:"text-muted","aria-hidden":"true"}))],64)):(m(),V(i(Cl),{key:3,size:20,class:"text-muted","aria-hidden":"true"})),!W.value&&te.state==="done"?(m(),g("button",{key:4,type:"button",draggable:"true","data-handle":te.uid,"aria-label":i(_)("backend::lang.fileupload.move",{name:te.name}),class:he([Mc,"absolute top-2 left-2 cursor-grab"]),onKeydown:Ie=>ge(Ie,te),onDragstart:Ie=>je(Ie,te),onDragend:Lt},[F(i(Si),{size:16,"aria-hidden":"true"})],40,LR)):ne("",!0),W.value?ne("",!0):(m(),g("div",NR,[e.field.useCaption&&te.state==="done"?(m(),g("button",{key:0,type:"button","data-caption":te.uid,"aria-label":i(_)("backend::lang.fileupload.edit_details",{name:te.name}),class:he(Mc),onClick:Ie=>Hn(te)},[F(i(zo),{size:16,"aria-hidden":"true"})],8,BR)):ne("",!0),te.state==="failed"&&te.retryable?(m(),g("button",{key:1,type:"button","data-action":"retry","aria-label":i(_)("backend::lang.fileupload.retry"),class:he(Mc),onClick:Ie=>Ze(te)},[F(i(ai),{size:16,"aria-hidden":"true"})],8,FR)):ne("",!0),w("button",{type:"button","data-action":"remove-file","aria-label":te.state==="uploading"||te.state==="queued"?i(_)("backend::lang.fileupload.cancel_upload",{name:te.name}):i(_)("backend::lang.form.remove_item",{name:te.name}),class:he(UI),onClick:Ie=>ot(te)},[F(i(ln),{size:16,"aria-hidden":"true"})],8,VR)]))]),w("div",zR,[w("span",{class:"truncate text-[13px]",title:kn(te)},T(kn(te)),9,jR),w("span",UR,[te.state==="queued"?(m(),g("span",HR,T(i(_)("backend::lang.fileupload.queued")),1)):te.state==="uploading"?(m(),g("span",KR,T(i(_)("backend::lang.fileupload.uploading",{percent:te.progress})),1)):(m(),g("span",WR,T(fe(te.size)),1)),Fa(te)?(m(),g("span",GR,T(i(_)("backend::lang.fileupload.unsaved")),1)):ne("",!0)]),te.state==="uploading"?(m(),V(i(wc),{key:0,"model-value":te.progress,max:100,"aria-label":i(_)("backend::lang.fileupload.uploading",{percent:te.progress}),class:"h-1 w-full overflow-hidden rounded-pill bg-subtle"},{default:N(()=>[F(i($c),{class:"h-full bg-primary",style:Tn({width:`${te.progress}%`})},null,8,["style"])]),_:2},1032,["model-value","aria-label"])):ne("",!0),te.state==="failed"?(m(),g("p",YR,[w("span",JR,T(i(_)("backend::lang.fileupload.upload_error"))+": ",1),xe(T(te.error),1)])):ne("",!0)])],42,OR))),128))])):U.value&&!Z.value&&we.value.length>0?(m(),g("div",ZR,[(m(!0),g(pe,null,Re(we.value,te=>(m(),g("div",{key:te.uid,"data-file-item":te.uid,"data-state":te.state,class:"flex items-start gap-4"},[w("div",{class:he([te.state==="failed"?"border-danger":"border-border","flex size-40 shrink-0 items-center justify-center overflow-hidden rounded-inner border bg-subtle"])},[te.state==="uploading"?(m(),V(i(Ml),{key:0,size:20,class:"animate-spin text-muted","aria-hidden":"true"})):te.state==="failed"?(m(),V(i(bt),{key:1,size:16,class:"text-danger","aria-hidden":"true"})):Gt(te)?(m(),g("img",{key:2,src:Gt(te)??void 0,alt:kn(te),class:he([co.value,"size-full"]),onError:Ie=>al(te)},null,42,QR)):S.value.has(te.uid)?(m(),g("span",eI,[F(i(zm),{size:20,"aria-hidden":"true"}),xe(" "+T(i(_)("backend::lang.fileupload.preview_unavailable")),1)])):(m(),V(i(Cl),{key:4,size:20,class:"text-muted","aria-hidden":"true"}))],2),w("div",tI,[w("span",{class:"truncate font-semibold",title:kn(te)},T(kn(te)),9,nI),w("span",aI,[te.state==="queued"?(m(),g("span",rI,T(i(_)("backend::lang.fileupload.queued")),1)):te.state==="uploading"?(m(),g("span",lI,T(i(_)("backend::lang.fileupload.uploading",{percent:te.progress})),1)):(m(),g("span",oI,T(fe(te.size)),1)),Fa(te)?(m(),g("span",sI,T(i(_)("backend::lang.fileupload.unsaved")),1)):ne("",!0)]),te.state==="uploading"?(m(),V(i(wc),{key:0,"model-value":te.progress,max:100,"aria-label":i(_)("backend::lang.fileupload.uploading",{percent:te.progress}),class:"h-1 w-full overflow-hidden rounded-pill bg-subtle"},{default:N(()=>[F(i($c),{class:"h-full bg-primary",style:Tn({width:`${te.progress}%`})},null,8,["style"])]),_:2},1032,["model-value","aria-label"])):ne("",!0),te.state==="failed"?(m(),g("p",iI,[w("span",uI,T(i(_)("backend::lang.fileupload.upload_error"))+": ",1),xe(T(te.error),1)])):ne("",!0),W.value?ne("",!0):(m(),g("div",cI,[te.state!=="failed"?(m(),V(Ge,{key:0,size:"sm",variant:"outline","data-action":"replace-file",icon:i(ri),onClick:Ce},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.replace_file")),1)]),_:1},8,["icon"])):ne("",!0),te.state==="failed"&&te.retryable?(m(),V(Ge,{key:1,size:"sm",variant:"outline","data-action":"retry",icon:i(ai),onClick:Ie=>Ze(te)},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.retry")),1)]),_:1},8,["icon","onClick"])):ne("",!0),e.field.useCaption&&te.state==="done"?(m(),V(Ge,{key:2,size:"sm",variant:"outline","data-caption":te.uid,icon:i(zo),onClick:Ie=>Hn(te)},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.details_submit")),1)]),_:1},8,["data-caption","icon","onClick"])):ne("",!0),F(Ge,{size:"sm",variant:"danger","data-action":"remove-file",icon:i(ln),onClick:Ie=>ot(te)},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.remove_file")),1)]),_:1},8,["icon","onClick"])]))])],8,XR))),128))])):we.value.length>0?(m(),g("ul",dI,[(m(!0),g(pe,null,Re(we.value,te=>(m(),g("li",{key:te.uid,"data-file-item":te.uid,"data-state":te.state,class:he([[te.state==="failed"?"border-danger":"border-border",p.value===te.uid?"opacity-50":"",h.value===te.uid&&p.value!==te.uid?"border-2 border-dashed border-primary bg-sel":""],"flex min-h-14 flex-col justify-center gap-1 rounded-inner border bg-surface px-3 py-2"]),onDragover:Ie=>rt(Ie,te),onDrop:Ie=>zt(Ie,te)},[w("div",pI,[Z.value&&!W.value&&te.state==="done"?(m(),g("button",{key:0,type:"button",draggable:"true","data-handle":te.uid,"aria-label":i(_)("backend::lang.fileupload.move",{name:te.name}),class:he([vl,"cursor-grab"]),onKeydown:Ie=>ge(Ie,te),onDragstart:Ie=>je(Ie,te),onDragend:Lt},[F(i(Si),{size:16,"aria-hidden":"true"})],40,mI)):ne("",!0),w("span",vI,[te.state==="uploading"?(m(),V(i(Ml),{key:0,size:16,class:"animate-spin text-muted","aria-hidden":"true"})):te.state==="failed"?(m(),V(i(bt),{key:1,size:16,class:"text-danger","aria-hidden":"true"})):Gt(te)?(m(),g("img",{key:2,src:Gt(te)??void 0,alt:"",class:"size-8 object-cover",onError:Ie=>al(te)},null,40,hI)):(m(),V(i(Cl),{key:3,size:16,class:"text-muted","aria-hidden":"true"}))]),w("span",yI,[e.field.useCaption&&te.file?.title?(m(),g(pe,{key:0},[w("span",{class:"truncate font-semibold",title:te.file.title},T(te.file.title),9,gI),w("span",{class:"truncate text-[13px] text-muted",title:te.name},T(te.name),9,bI)],64)):(m(),g("span",{key:1,class:"truncate",title:te.name},T(te.name),9,_I))]),w("span",xI,[te.state==="queued"?(m(),g("span",kI,T(i(_)("backend::lang.fileupload.queued")),1)):te.state==="uploading"?(m(),g("span",wI,T(i(_)("backend::lang.fileupload.uploading",{percent:te.progress})),1)):(m(),g("span",$I,T(fe(te.size)),1)),Fa(te)?(m(),g("span",CI,T(i(_)("backend::lang.fileupload.unsaved")),1)):ne("",!0)]),!Z.value&&!W.value&&te.state!=="failed"?(m(),V(Ge,{key:1,size:"sm",variant:"outline","data-action":"replace-file",icon:i(ri),onClick:Ce},{default:N(()=>[xe(T(i(_)("backend::lang.fileupload.replace_file")),1)]),_:1},8,["icon"])):ne("",!0),w("span",SI,[te.state==="done"&&te.file?(m(),g(pe,{key:0},[!e.field.protected&&te.file.url?(m(),g("a",{key:0,href:te.file.url,download:"",target:"_blank",rel:"noopener","aria-label":i(_)("backend::lang.fileupload.download",{name:te.name}),class:he(vl)},[F(i(ud),{size:16,"aria-hidden":"true"})],8,EI)):e.field.protected?(m(),g("button",{key:1,type:"button","data-action":"download","aria-label":i(_)("backend::lang.fileupload.download",{name:te.name}),class:he(vl),onClick:Ie=>so(te,!0)},[F(i(ud),{size:16,"aria-hidden":"true"})],8,AI)):ne("",!0),e.field.useCaption&&!W.value?(m(),g("button",{key:2,type:"button","data-caption":te.uid,"aria-label":i(_)("backend::lang.fileupload.edit_details",{name:te.name}),class:he(vl),onClick:Ie=>Hn(te)},[F(i(zo),{size:16,"aria-hidden":"true"})],8,TI)):ne("",!0)],64)):ne("",!0),te.state==="failed"&&te.retryable?(m(),g("button",{key:1,type:"button","data-action":"retry","aria-label":i(_)("backend::lang.fileupload.retry"),class:he(vl),onClick:Ie=>Ze(te)},[F(i(ai),{size:16,"aria-hidden":"true"})],8,OI)):ne("",!0),W.value?ne("",!0):(m(),g("button",{key:2,type:"button","data-action":"remove-file","aria-label":te.state==="uploading"||te.state==="queued"?i(_)("backend::lang.fileupload.cancel_upload",{name:te.name}):i(_)("backend::lang.form.remove_item",{name:te.name}),class:he([vl,"hover:bg-danger-soft hover:text-danger"]),onClick:Ie=>ot(te)},[F(i(ln),{size:16,"aria-hidden":"true"})],8,DI))])]),te.state==="uploading"?(m(),V(i(wc),{key:0,"model-value":te.progress,max:100,"aria-label":i(_)("backend::lang.fileupload.uploading",{percent:te.progress}),class:"h-1 w-full overflow-hidden rounded-pill bg-subtle"},{default:N(()=>[F(i($c),{class:"h-full bg-primary",style:Tn({width:`${te.progress}%`})},null,8,["style"])]),_:2},1032,["model-value","aria-label"])):ne("",!0),te.state==="failed"?(m(),g("p",MI,[w("span",PI,T(i(_)("backend::lang.fileupload.upload_error"))+": ",1),xe(T(te.error),1)])):ne("",!0)],42,fI))),128))])):ne("",!0),Ae.value?(m(),g("button",{key:4,type:"button","data-fileupload-dropzone":"","aria-describedby":e.describedBy||void 0,class:he([[u.value?"border-solid border-primary bg-sel":e.invalid?"border-dashed border-danger bg-subtle":"border-dashed border-border-strong bg-subtle"],"flex min-h-[112px] w-full flex-col items-center justify-center gap-2 rounded-control border-[1.5px] px-4 py-6 text-center transition-colors duration-150 ease-out hover:bg-hover"]),onClick:Ce,onDragover:ye,onDragleave:Oe[0]||(Oe[0]=te=>u.value=!1),onDrop:qe},[w("span",II,[F(i(ri),{size:20,class:"text-muted"})]),w("span",qI,T(me.value),1),X.value!==""?(m(),g("span",LI,T(X.value),1)):ne("",!0)],42,RI)):ie.value&&X.value!==""?(m(),g("p",NI,T(X.value),1)):ne("",!0),d.value>0?(m(),g("p",BI,[F(i(bt),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(i(Vr)("backend::lang.fileupload.too_many",d.value,{max:j.value??0})),1)])):ne("",!0)],64)),w("input",{ref_key:"input",ref:f,type:"file",hidden:"",tabindex:"-1","data-fileupload-input":"",accept:ke.value,multiple:Z.value||void 0,onChange:oe},null,40,FI),w("p",VI,T(c.value),1),e.field.useCaption?(m(),V($R,{key:3,open:C.value,"onUpdate:open":Oe[1]||(Oe[1]=te=>C.value=te),file:Qt.value?.file??null,routes:i(R),preview:Qt.value?Gt(Qt.value):null,"id-prefix":e.controlId,onSaved:io,onClosed:uo},null,8,["open","file","routes","preview","id-prefix"])):ne("",!0)],8,CR))}}),KI=["id","name","value","required","aria-required","aria-invalid","aria-describedby"],WI=ae({__name:"NumberField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>n.modelValue===null||n.modelValue===void 0?"":String(n.modelValue)),l=b(()=>Cr(n.field));function o(s){const u=s.target.value.trim();if(u===""){a("update:modelValue",null);return}const d=Number(u);a("update:modelValue",Number.isFinite(d)?d:null)}return(s,u)=>(m(),g("input",ze({id:e.controlId},l.value,{name:e.field.name,type:"number",inputmode:"decimal",value:r.value,required:e.field.required||void 0,"aria-required":e.field.required?"true":void 0,"aria-invalid":e.invalid?"true":void 0,"aria-describedby":e.describedBy||void 0,class:[i(Ft)(e.invalid),"h-input tabular-nums"],onInput:o}),null,16,KI))}}),GI=["id","aria-labelledby","aria-describedby"],YI=ae({__name:"PartialField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},setup(e){const t=e;return(n,a)=>(m(),g("div",{id:e.controlId,role:"group","data-partial-field":"","aria-labelledby":t.field.label?`${e.controlId}-label`:void 0,"aria-describedby":e.describedBy||void 0},[e.source?(m(),V(rp,{key:0,variant:"field",source:e.source,name:t.field.path||t.field.name,"record-id":e.recordId??null},null,8,["source","name","record-id"])):(m(),V(Ou,{key:1,"data-partial-failed":"",text:i(_)("backend::lang.extension.partial_failed")},null,8,["text"]))],8,GI))}}),JI={class:"flex min-w-0 flex-col gap-1.5"},ZI={class:"relative"},XI=["id","name","type","value","placeholder","disabled","required","aria-required","aria-invalid","aria-describedby"],QI=["aria-pressed","aria-label","disabled"],eq=["id","data-secret-state","role"],tq={key:3},nq=ae({__name:"PasswordField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=I(!1),l=b(()=>typeof n.modelValue=="string"?n.modelValue:""),o=b(()=>Cr(n.field)),s=it(no,null);s&&Ve(s.revision,()=>{r.value=!1});const u=it(o0,null),d=b(()=>u?.value[n.field.name]??""),c=b(()=>d.value!==""),f=b(()=>d.value==="stored"&&n.modelValue===null),v=b(()=>`${n.controlId}-secret`),p=b(()=>[n.describedBy??"",c.value?v.value:""].filter(Boolean).join(" ")),h=b(()=>{if(d.value==="stored"&&!f.value)return _("backend::lang.secret.placeholder_stored");const x=o.value.placeholder;return typeof x=="string"?x:void 0});function k(){r.value=!1,a("update:modelValue",null)}function C(){a("update:modelValue","")}return(x,S)=>(m(),g("div",JI,[w("div",ZI,[w("input",ze({id:e.controlId,autocomplete:"new-password",spellcheck:"false"},o.value,{name:e.field.name,type:r.value?"text":"password",value:f.value?"":l.value,placeholder:h.value,disabled:f.value||void 0,required:e.field.required||void 0,"aria-required":e.field.required?"true":void 0,"aria-invalid":e.invalid?"true":void 0,"aria-describedby":p.value||void 0,class:[i(Ft)(e.invalid),"h-input pr-12"],onInput:S[0]||(S[0]=q=>a("update:modelValue",q.target.value))}),null,16,XI),w("button",{type:"button","data-password-toggle":"","aria-pressed":r.value?"true":"false","aria-label":i(_)(r.value?"backend::lang.form.hide_password":"backend::lang.form.show_password"),disabled:f.value||void 0,class:"absolute top-1/2 right-1.5 flex size-8 -translate-y-1/2 items-center justify-center rounded-pager text-muted transition-colors duration-150 ease-out hover:bg-hover hover:text-text disabled:opacity-60",onClick:S[1]||(S[1]=q=>r.value=!r.value)},[(m(),V(Vt(r.value?i(d$):i(p$)),{size:16,"aria-hidden":"true"}))],8,QI)]),c.value?(m(),g("p",{key:0,id:v.value,"data-secret-state":f.value?"clearing":d.value,role:f.value?"status":void 0,class:he([f.value?"text-danger":"text-muted","flex flex-wrap items-center gap-2 text-[13px]"])},[f.value?(m(),g(pe,{key:0},[F(i(bt),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.secret.clear_pending")),1),F(Ge,{variant:"ghost",size:"sm",icon:i(Ug),"data-action":"secret-undo",onClick:C},{default:N(()=>[xe(T(i(_)("backend::lang.secret.undo")),1)]),_:1},8,["icon"])],64)):d.value==="stored"?(m(),g(pe,{key:1},[F(i(er),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.secret.stored")),1),F(Ge,{variant:"ghost",size:"sm",icon:i(_r),"data-action":"secret-clear",onClick:k},{default:N(()=>[xe(T(i(_)("backend::lang.secret.clear")),1)]),_:1},8,["icon"])],64)):d.value==="env"?(m(),g(pe,{key:2},[F(i(Yl),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(i(_)("backend::lang.secret.env")),1)],64)):(m(),g("span",tq,T(i(_)("backend::lang.secret.empty")),1))],10,eq)):ne("",!0)]))}}),aq=["aria-labelledby","data-ml-field"],rq={class:"flex flex-wrap items-center gap-2"},lq=["value","aria-label"],oq=["value"],Mu=ae({__name:"MLField",props:{inner:{},innerType:{},mlType:{},contentLocale:{type:Boolean},field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>ra(n.modelValue)),l=it(Fi,null),o=b(()=>{const x=l?.value;return x&&x.length>0?[...x]:[]}),s=I(o.value[0]??"en"),u=b(()=>`${n.controlId}-label`),d=b(()=>`${n.controlId}-editor`),c=b(()=>r.value[s.value]??""),f=b(()=>({...n.field,type:n.innerType})),v=b(()=>n.contentLocale?{contentLocale:s.value}:{});function p(x){x&&(s.value=x)}function h(x){const S=x.target.value;p(S),wP(S)}function k(x){a("update:modelValue",{...r.value,[s.value]:x})}function C(x){const S=x.detail;typeof S=="string"&&S!==""&&p(S)}return Ct(()=>{window.addEventListener(cs,C)}),Ia(()=>{window.removeEventListener(cs,C)}),(x,S)=>(m(),g("div",{class:"flex flex-col gap-1.5",role:"group","aria-labelledby":u.value,"data-ml-field":e.mlType},[w("div",rq,[w("select",{"data-ml-locale":"",class:"rounded-control border border-border-strong bg-surface px-2 py-1 text-[13px]",value:s.value,"aria-label":`Locale for ${e.field.label||e.field.name}`,onChange:h},[(m(!0),g(pe,null,Re(o.value,q=>(m(),g("option",{key:q,value:q},T(q),9,oq))),128))],40,lq)]),(m(),V(Vt(e.inner),ze({field:f.value,"model-value":c.value,"control-id":d.value,invalid:e.invalid,"described-by":e.describedBy,source:e.source,"record-id":e.recordId},v.value,{"onUpdate:modelValue":k}),null,16,["field","model-value","control-id","invalid","described-by","source","record-id"]))],8,aq))}}),sq=["id","aria-labelledby","aria-describedby","aria-busy"],iq={key:0,"data-plugin-field-skeleton":"",class:"h-[42px] w-full rounded-control bg-skel","aria-hidden":"true"},u0=ae({__name:"PluginField",props:{contentLocale:{},field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=it(ip,null),l=I("loading"),o=I(null);let s=null,u=!1;const d=b(()=>r?.value||sa.value),c=b(()=>JSON.stringify(n.field.typeOptions??{})),f=b(()=>n.field.readOnly===!0);function v(E,R){if(Object.is(E,R))return!0;if(E===null||R===null||typeof E!="object"||typeof R!="object")return!1;try{return JSON.stringify(E)===JSON.stringify(R)}catch{return!1}}function p(E,R){v(E.value,R)||(E.value=R)}function h(E,R,L){L?E.setAttribute(R,""):E.removeAttribute(R)}function k(E){E.setAttribute("field-name",n.field.name),E.setAttribute("record-id",n.recordId==null?"":String(n.recordId)),E.setAttribute("locale",n.contentLocale??""),E.setAttribute("ui-locale",d.value),E.setAttribute("options",c.value),h(E,"disabled",f.value),h(E,"invalid",n.invalid===!0)}function C(E){let R;return{promise:new Promise((K,$)=>{R=setTimeout(()=>$(new Error("field type element was not defined in time")),E)}),cancel:()=>clearTimeout(R)}}async function x(E){const R=await a6(E);if(customElements.get(E))return;if(R.length>0)throw new Error(`plugin script failed: ${R.join(", ")}`);const L=C(s0);try{await Promise.race([customElements.whenDefined(E),L.promise])}finally{L.cancel()}}async function S(E){const R=s,L=E.detail;if(!R||L===null||typeof L!="object")return;const{id:K,file:$}=L,M=Z=>{!u&&s===R&&R.dispatchEvent(new CustomEvent(ZP,{detail:{id:K,...Z}}))},H=()=>_("backend::lang.fileupload.upload_failed"),P=n.source;if(!($ instanceof Blob)||!P){M({error:H()});return}const W=$ instanceof File&&$.name!==""?$.name:"upload";try{const Z=await Ne.POST("/{vendor}/{plugin}/{controller}/{id}/fields/{field}/upload",{params:{path:{...P,id:n.recordId??0,field:n.field.name}},body:{file:""},bodySerializer:()=>{const j=new FormData;return j.append("file",$,W),j}});if(Z.data){M({url:Z.data.data.url});return}const U=Z.response.status===422?lp(Z.error?.error):"";M({error:U||H()})}catch{M({error:H()})}}function q(E){S(E)}function O(E){const R=E.detail;R!==null&&typeof R=="object"&&Object.hasOwn(R,"value")&&a("update:modelValue",R.value)}return Ct(async()=>{const E=n.field.element??"";try{if(E==="")throw new Error("plugin field without an element");if(await x(E),u||!o.value)return;const R=document.createElement(E);k(R),p(R,n.modelValue),R.addEventListener(nh,O),R.addEventListener(ah,q),o.value.append(R),s=R,l.value="ready"}catch{u||(l.value="failed")}}),Ve(()=>[n.recordId,n.invalid,n.contentLocale,f.value,d.value,c.value],()=>{s&&k(s)}),Ve(()=>n.modelValue,E=>{s&&p(s,E)},{deep:!0}),Dt(()=>{u=!0,s?.removeEventListener(nh,O),s?.removeEventListener(ah,q),s=null}),(E,R)=>l.value==="failed"?(m(),V(Ou,{key:0,id:e.controlId,"data-plugin-field-failed":"","aria-describedby":e.describedBy||void 0,text:i(_)("backend::lang.extension.widget_failed")},null,8,["id","aria-describedby","text"])):(m(),g("div",{key:1,id:e.controlId,role:"group","data-plugin-field":"","aria-labelledby":e.field.label?`${e.controlId}-label`:void 0,"aria-describedby":e.describedBy||void 0,"aria-busy":l.value==="loading"?"true":void 0,class:"flex min-h-input min-w-0 flex-col"},[l.value==="loading"?(m(),g("span",iq)):ne("",!0),w("div",{ref_key:"mountPoint",ref:o,class:"contents"},null,512)],8,sq))}}),uq=ae({__name:"MLPluginField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t;return(r,l)=>(m(),V(Mu,ze(n,{inner:u0,"inner-type":e.field.type,"ml-type":e.field.type,"content-locale":"","onUpdate:modelValue":l[0]||(l[0]=o=>a("update:modelValue",o))}),null,16,["inner-type","ml-type"]))}}),cq=["id"],dq=["id","aria-labelledby","aria-label","aria-describedby","data-mode"],fq=["aria-labelledby"],pq=["id"],mq={class:"min-w-0 [overflow-wrap:anywhere]"},vq={key:0,class:"shrink-0 text-[12px] font-semibold text-muted","aria-hidden":"true"},hq=["data-permission","data-locked","data-locked-by"],yq={class:"flex min-w-0 flex-col"},gq=["id"],bq=["id"],_q=ae({__name:"PermissionEditorField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=it(cp,null),l=b(()=>{const O=new Map;for(const E of r?.value[n.field.name]??[])O.set(E.code,E);return O}),o=b(()=>n.field.permissionOptions??[]),s=b(()=>n.field.mode==="radio"),u=b(()=>!!n.field.readOnly||!!Cr(n.field).readonly),d=b(()=>r0(n.field,n.modelValue)),c=b(()=>{const O=[],E=[];for(const R of o.value){if(!R.tab){E.push(R);continue}let L=O.find(K=>K.label===R.tab);L||(L={key:`tab:${R.tab}`,label:R.tab,options:[]},O.push(L)),L.options.push(R)}return E.length>0&&O.push({key:"other",label:_("backend::lang.permissioneditor.other"),options:E}),O}),f=[{value:"1",label:"backend::lang.permissioneditor.allow",checked:"data-[state=checked]:bg-ok-bg data-[state=checked]:text-ok-text"},{value:"0",label:"backend::lang.permissioneditor.inherit",checked:"data-[state=checked]:bg-surface data-[state=checked]:text-text data-[state=checked]:shadow-tab"},{value:"-1",label:"backend::lang.permissioneditor.deny",checked:"data-[state=checked]:bg-danger-soft data-[state=checked]:text-danger"}],v=b(()=>`${n.controlId}-label`);function p(O,E){return`${n.controlId}-${O}-${E}`}function h(O){return l.value.get(O.code)}function k(O){return u.value||!!O.locked||h(O)!==void 0}function C(O){return(!!O.locked||h(O)!==void 0)&&!u.value}function x(O){return h(O)?.note||_("backend::lang.permissioneditor.locked")}function S(O){const E=h(O);return E?E.value===1||s.value&&E.value===-1?E.value:0:d.value[O.code]??0}function q(O,E){if(k(O))return;const R={...d.value};E===1||s.value&&E===-1?R[O.code]=E:delete R[O.code],a("update:modelValue",R)}return(O,E)=>o.value.length===0?(m(),g("div",{key:0,id:e.controlId,"data-permission-empty":"",class:"flex min-h-input items-center rounded-control border border-border bg-subtle px-3.5 text-muted"},T(i(_)("backend::lang.permissioneditor.empty")),9,cq)):(m(),g("div",{key:1,id:e.controlId,role:"group","aria-labelledby":e.field.label?v.value:void 0,"aria-label":e.field.label?void 0:e.field.name,"aria-describedby":e.describedBy||void 0,class:he([e.invalid?"border-danger":"border-border","overflow-hidden rounded-inner border"]),"data-permission-editor":"","data-mode":s.value?"radio":"checkbox"},[(m(!0),g(pe,null,Re(c.value,(R,L)=>(m(),g("div",{key:R.key,role:"group","aria-labelledby":`${e.controlId}-section-${L}`,"data-permission-section":""},[w("h3",{id:`${e.controlId}-section-${L}`,class:he([L>0?"border-t border-border":"","flex h-row-head items-center justify-between gap-4 bg-subtle px-4 font-semibold"])},[w("span",mq,T(R.label),1),s.value?ne("",!0):(m(),g("span",vq,T(i(_)("backend::lang.permissioneditor.allow")),1))],10,pq),(m(!0),g(pe,null,Re(R.options,(K,$)=>(m(),g("div",{key:K.code,"data-permission":K.code,"data-locked":C(K)?"":void 0,"data-locked-by":C(K)&&h(K)?"record":void 0,class:"flex min-h-[56px] items-center justify-between gap-x-4 gap-y-2 border-t border-border px-4 py-3 max-sm:flex-col max-sm:items-start"},[w("div",yq,[(m(),V(Vt(s.value?"span":"label"),{id:`${p(L,$)}-label`,for:s.value?void 0:p(L,$),class:"[overflow-wrap:anywhere]"},{default:N(()=>[xe(T(K.label||K.code)+" ",1),C(K)?(m(),V(i(er),{key:0,size:14,class:"ml-1 inline-block align-[-2px] text-muted","aria-hidden":"true"})):ne("",!0)]),_:2},1032,["id","for"])),C(K)?(m(),g("p",{key:0,id:`${p(L,$)}-note`,class:"text-[13px] text-muted [overflow-wrap:anywhere]","data-permission-locked":""},T(x(K)),9,gq)):K.comment?(m(),g("p",{key:1,id:`${p(L,$)}-note`,class:"text-[13px] text-muted [overflow-wrap:anywhere]"},T(K.comment),9,bq)):ne("",!0)]),s.value?(m(),V(i(k1),{key:0,orientation:"horizontal","model-value":String(S(K)),disabled:k(K),"aria-disabled":k(K)?"true":void 0,"aria-labelledby":`${p(L,$)}-label`,"aria-describedby":C(K)||K.comment?`${p(L,$)}-note`:void 0,class:"inline-flex shrink-0 gap-1 rounded-inner border border-border bg-subtle p-1","onUpdate:modelValue":M=>q(K,Number(M))},{default:N(()=>[(m(),g(pe,null,Re(f,M=>F(i(w1),{key:M.value,value:M.value,"data-segment":M.value,class:he([M.checked,"inline-flex h-pager items-center rounded-tab px-4 text-[13px] whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-text disabled:cursor-not-allowed disabled:hover:text-muted data-[state=checked]:text-[14px] data-[state=checked]:font-semibold"])},{default:N(()=>[xe(T(i(_)(M.label)),1)]),_:2},1032,["value","data-segment","class"])),64))]),_:1},8,["model-value","disabled","aria-disabled","aria-labelledby","aria-describedby","onUpdate:modelValue"])):(m(),V(i(OO),{key:1,id:p(L,$),"model-value":S(K)===1,disabled:k(K),"aria-disabled":k(K)?"true":void 0,"aria-labelledby":`${p(L,$)}-label`,"aria-describedby":C(K)||K.comment?`${p(L,$)}-note`:void 0,class:"flex size-[18px] shrink-0 items-center justify-center rounded-checkbox border border-border-strong bg-surface disabled:cursor-not-allowed disabled:opacity-60 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-on-primary","onUpdate:modelValue":M=>q(K,M===!0?1:0)},{default:N(()=>[F(i(MO),null,{default:N(()=>[F(i(Da),{size:14,"aria-hidden":"true"})]),_:1})]),_:1},8,["id","model-value","disabled","aria-disabled","aria-labelledby","aria-describedby","onUpdate:modelValue"]))],8,hq))),128))],8,fq))),128))],10,dq))}}),xq=ae({__name:"FieldRenderer",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>C0(n.field));return(l,o)=>(m(),V(Vt(r.value),{field:e.field,"model-value":e.modelValue,"control-id":e.controlId,invalid:e.invalid,"described-by":e.describedBy,labels:e.labels,source:e.source,"record-id":e.recordId,"onUpdate:modelValue":o[0]||(o[0]=s=>a("update:modelValue",s))},null,8,["field","model-value","control-id","invalid","described-by","labels","source","record-id"]))}}),kq=["data-field"],wq=["id"],$q={key:0,class:"text-danger","aria-hidden":"true"},Cq=["id","for"],Sq={key:0,class:"text-danger","aria-hidden":"true"},Eq=["id"],Aq=["id"],Tq=["id"],Oq=["id"],Dq=ae({__name:"FormField",props:{field:{},modelValue:{},errors:{},notices:{},labels:{},source:{},recordId:{},idPrefix:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=b(()=>`${n.idPrefix??"field"}-${n.field.name}`),l=b(()=>r.value),o=b(()=>`${r.value}-comment`),s=b(()=>`${r.value}-error`),u=b(()=>`${r.value}-notice`),d=b(()=>`${r.value}-trigger`),c=it($s,null),f=it(dp,null),v=b(()=>f?.value[c?c.path(n.field.name):n.field.name]??""),p=b(()=>(n.errors?.length??0)>0),h=b(()=>(n.notices?.length??0)>0),k=b(()=>ZB(n.field.type)),C=b(()=>XB(n.field.type)||Ru(n.field)),x=b(()=>!k.value&&!!n.field.comment),S=b(()=>[v.value!==""?d.value:"",x.value||k.value&&n.field.comment?o.value:"",p.value?s.value:"",h.value?u.value:""].filter(Boolean).join(" "));return(q,O)=>(m(),g("div",{class:"flex min-w-0 flex-col gap-1.5","data-field":e.field.name},[C.value&&e.field.label?(m(),g("span",{key:0,id:`${l.value}-label`,class:"font-semibold"},[xe(T(e.field.label),1),e.field.required?(m(),g("span",$q," *")):ne("",!0)],8,wq)):!k.value&&!C.value?(m(),g("label",{key:1,id:`${l.value}-label`,for:l.value,class:"font-semibold"},[xe(T(e.field.label||e.field.name),1),e.field.required?(m(),g("span",Sq," *")):ne("",!0)],8,Cq)):ne("",!0),v.value!==""?(m(),g("p",{key:2,id:d.value,"data-trigger-note":"",class:"flex items-center gap-2 text-[13px] text-muted"},[F(i(Yl),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(v.value),1)],8,Eq)):ne("",!0),F(xq,{field:e.field,"model-value":e.modelValue,"control-id":l.value,invalid:p.value,"described-by":S.value,labels:e.labels,source:e.source,"record-id":e.recordId,"onUpdate:modelValue":O[0]||(O[0]=E=>a("update:modelValue",E))},null,8,["field","model-value","control-id","invalid","described-by","labels","source","record-id"]),x.value?(m(),g("p",{key:3,id:o.value,class:"text-[13px] text-muted"},T(e.field.comment),9,Aq)):ne("",!0),h.value?(m(),g("div",{key:4,id:u.value,role:"status","data-field-notice":"",class:"summer-callout summer-callout--warning text-[13px]!"},[(m(!0),g(pe,null,Re(e.notices,(E,R)=>(m(),g("p",{key:R,class:"summer-callout__text"},T(E),1))),128))],8,Tq)):ne("",!0),p.value?(m(),g("div",{key:5,id:s.value,class:"flex flex-col gap-0.5 text-[13px] text-danger"},[(m(!0),g(pe,null,Re(e.errors,(E,R)=>(m(),g("p",{key:R,class:"flex items-center gap-1.5"},[F(i(bt),{size:14,class:"shrink-0","aria-hidden":"true"}),w("span",null,T(E),1)]))),128))],8,Oq)):ne("",!0)],8,kq))}}),Mq={class:"grid grid-cols-1 gap-x-6 gap-y-[22px] min-[600px]:grid-cols-2"},ao=ae({__name:"FormGrid",props:{fields:{},values:{},errors:{},notices:{},labels:{},source:{},recordId:{},idPrefix:{},scopePath:{}},emits:["update"],setup(e,{emit:t}){const n=e,a=t;ht($s,{fields:b(()=>n.fields),values:b(()=>n.values),path:l=>n.scopePath?`${n.scopePath}.${l}`:l});function r(l){if(l.type===tl)return"col-span-full";switch(l.span){case"left":return"min-[600px]:col-start-1";case"right":return"min-[600px]:col-start-2";case"auto":case"row":return"";default:return"col-span-full"}}return(l,o)=>(m(),g("div",Mq,[(m(!0),g(pe,null,Re(e.fields,s=>(m(),V(Dq,{key:s.name,class:he(r(s)),field:s,"model-value":e.values[s.name],errors:e.errors[s.name],notices:e.notices?.[s.name],labels:e.labels?.[s.name],source:e.source,"record-id":e.recordId,"id-prefix":e.idPrefix,"onUpdate:modelValue":u=>a("update",s.name,u)},null,8,["class","field","model-value","errors","notices","labels","source","record-id","id-prefix","onUpdate:modelValue"]))),128))]))}}),Pq=["data-preview-field"],Rq=["id"],Iq={class:"m-0 min-w-0"},qq={key:0,"data-switch":"true",class:"inline-flex h-6 items-center rounded-pill bg-ok-bg px-2.5 text-[12px] font-semibold text-ok-text"},Lq={key:1,"data-switch":"false",class:"inline-flex h-6 items-center rounded-pill border border-border-strong px-2.5 text-[12px] font-semibold text-muted"},Nq={class:"flex size-[22px] shrink-0 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-on-primary","aria-hidden":"true"},Bq={class:"font-semibold"},Fq={key:0,class:"px-2 text-muted","data-empty":""},Vq={key:0},zq={key:1,class:"text-muted","data-empty":""},jq={key:0},Uq={key:1,class:"text-muted","data-empty":""},Pc="flex min-h-input items-center rounded-control border border-border bg-subtle px-3.5 [overflow-wrap:anywhere]",c0=ae({__name:"PreviewField",props:{field:{},value:{},labels:{},source:{},recordId:{},idPrefix:{}},setup(e){const t=e,n=new Set(["datepicker","fileupload","partial","permissioneditor","richeditor","repeater","money","taglist"]),a=b(()=>`${t.idPrefix??"preview"}-${t.field.name}`),r=b(()=>`${a.value}-label`),l=b(()=>{const p=t.field.type;return n.has(p)||Ru(t.field)?"control":p==="checkbox"||p==="switch"?"toggle":p==="relation"?t.field.multiple?"chips":"relation":p==="textarea"?"textarea":"text"}),o=b(()=>({...t.field,readOnly:!0})),s=b(()=>C0(t.field));function u(p){return p==null||p===""}const d=b(()=>{const p=t.value;if(u(p)||typeof p=="object")return"";if(t.field.type==="dropdown"){const h=(t.field.options??[]).find(k=>String(k.value)===String(p));return h?h.label:String(p)}return String(p)}),c=b(()=>t.labels?.[0]?.label??""),f=b(()=>Array.isArray(t.value)?t.labels??[]:[]);function v(p){return p.trim().split(/\s+/).filter(Boolean).slice(0,2).map(k=>k.charAt(0).toUpperCase()).join("")}return(p,h)=>(m(),g("div",{class:"flex min-w-0 flex-col gap-1.5","data-preview-field":e.field.name},[w("dt",{id:r.value,class:"font-semibold"},T(e.field.label||e.field.name),9,Rq),w("dd",Iq,[l.value==="control"?(m(),V(Vt(s.value),{key:0,field:o.value,"model-value":e.value,"control-id":a.value,labels:e.labels,source:e.source,"record-id":e.recordId},null,8,["field","model-value","control-id","labels","source","record-id"])):l.value==="toggle"?(m(),g(pe,{key:1},[i(Du)(e.value)?(m(),g("span",qq,T(i(_)("backend::lang.list.column_switch_true")),1)):(m(),g("span",Lq,T(i(_)("backend::lang.list.column_switch_false")),1))],64)):l.value==="chips"?(m(),g("div",{key:2,"data-preview-value":"",class:he([Pc,"flex-wrap gap-1.5 p-1.5"])},[(m(!0),g(pe,null,Re(f.value,k=>(m(),g("span",{key:String(k.value),"data-chip":"",class:"inline-flex min-h-[30px] items-center gap-1.5 rounded-pill bg-surface pr-3 pl-1"},[w("span",Nq,T(v(k.label)),1),w("span",Bq,T(k.label),1)]))),128)),f.value.length===0?(m(),g("span",Fq,T(i(_)("backend::lang.list.empty_value")),1)):ne("",!0)])):l.value==="relation"?(m(),g("div",{key:3,"data-preview-value":"",class:he(Pc)},[c.value!==""?(m(),g("span",Vq,T(c.value),1)):(m(),g("span",zq,T(e.field.emptyOption||i(_)("backend::lang.list.empty_value")),1))])):(m(),g("div",{key:4,"data-preview-value":"",class:he([Pc,l.value==="textarea"?"items-start! py-3 whitespace-pre-wrap":""])},[d.value!==""?(m(),g("span",jq,T(d.value),1)):(m(),g("span",Uq,T(i(_)("backend::lang.list.empty_value")),1))],2))])],8,Pq))}}),d0=new Set(["p","br","strong","b","em","i","u","s","h3","ul","ol","li","blockquote","a","div","span"]);function f0(e){const t=document.createElement("template");return t.innerHTML=e,t.content}function Hq(e){if(e==="")return[];const t=new Set;for(const n of Array.from(f0(e).querySelectorAll("*")))t.add(n.localName.toLowerCase());return[...t]}function rh(e){return Hq(e).some(t=>!d0.has(t))}const Kq=["aria-labelledby","aria-describedby","data-repeater"],Wq={key:0,"data-repeater-empty":"",class:"flex flex-col items-center gap-2 rounded-inner border border-dashed border-border-strong px-6 py-8 text-center"},Gq={class:"font-semibold"},Yq={key:0,class:"max-w-[420px] text-[13px] text-muted"},Jq={key:0,"data-repeater-slot":"",class:"h-12 rounded-inner border-2 border-dashed border-primary bg-sel"},Zq=["data-repeater-row","data-repeater-key","onDragover"],Xq=["data-repeater-handle","aria-label","onKeydown","onDragstart"],Qq={class:"text-[13px] text-muted tabular-nums"},eL=["title"],tL={key:1,"data-repeater-errors":"",class:"inline-flex h-6 items-center rounded-pill bg-danger-soft px-2.5 text-[13px] font-semibold text-danger"},nL={key:2,class:"flex gap-1"},aL=["aria-label","disabled","onClick"],rL=["aria-label","disabled","onClick"],lL=["aria-label","aria-expanded","aria-controls","onClick"],oL=["aria-label","disabled","onClick"],sL=["id"],iL={key:0,class:"m-0 grid grid-cols-1 gap-x-6 gap-y-[22px] min-[600px]:grid-cols-2"},uL={key:2,class:"flex flex-wrap items-center gap-4"},cL={key:0,"data-repeater-count":"",class:"text-[13px] text-muted tabular-nums"},wo="inline-flex size-8 shrink-0 items-center justify-center rounded-pager text-muted transition-colors duration-150 ease-out hover:bg-hover hover:text-text disabled:cursor-not-allowed disabled:opacity-40",dL=ae({__name:"RepeaterField",props:{field:{},modelValue:{},controlId:{},invalid:{type:Boolean},describedBy:{},labels:{},source:{},recordId:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,a=t,r=it(fp,null),l=b(()=>n.field.form?.fields??[]),o=b(()=>!!n.field.readOnly),s=b(()=>Array.isArray(n.modelValue)?n.modelValue.map(G=>G!==null&&typeof G=="object"&&!Array.isArray(G)?G:{}):[]),u=b(()=>typeof n.field.maxItems=="number"?n.field.maxItems:null),d=b(()=>typeof n.field.minItems=="number"?n.field.minItems:0),c=b(()=>n.field.prompt||_("backend::lang.repeater.add")),f=b(()=>`${n.controlId}-label`);let v=0;const p=I([]),h=I(new Set);let k;function C(){return v+=1,`r${v}`}Ve(()=>n.modelValue,G=>{G===k&&p.value.length===s.value.length||p.value.length!==s.value.length&&(p.value=s.value.map(()=>C()),h.value=new Set)},{immediate:!0});function x(G,X){p.value=X,k=G,a("update:modelValue",G)}function S(G){return G==null||G===""||G===!1||Array.isArray(G)&&G.length===0}function q(){const G={};for(const X of l.value)X.default!==void 0?G[X.name]=X.default:X.type==="checkbox"||X.type==="switch"?G[X.name]=!1:G[X.name]=null;return G}function O(G){return l.value.some(X=>{const ee=G[X.name];return S(ee)?!1:X.default===void 0||String(X.default)!==String(ee)})}function E(G){return(f0(G).textContent??"").replace(/\s+/g," ").trim()}function R(G){const X=s.value[G]??{},ee=l.value.find(D=>D.name===n.field.titleFrom),y=ee?X[ee.name]:void 0;let A="";return ee&&!S(y)&&typeof y!="object"&&(ee.type==="dropdown"?A=(ee.options??[]).find(D=>String(D.value)===String(y))?.label??String(y):ee.type==="richeditor"?A=E(String(y)):A=String(y).trim()),A!==""?A:_("backend::lang.repeater.untitled",{n:G+1})}function L(G,X){const ee=`${n.field.name}.${X}.`,y={};for(const[A,D]of Object.entries(G??{}))A.startsWith(ee)&&A.length>ee.length&&(y[A.slice(ee.length)]=D);return y}const K=b(()=>s.value.map((G,X)=>L(r?.errors.value,X))),$=b(()=>s.value.map((G,X)=>L(r?.notices.value,X))),M=G=>Object.keys(K.value[G]??{}).length;Ve(K,G=>{const X=G.flatMap((ee,y)=>Object.keys(ee).length>0?[p.value[y]]:[]);if(X.length>0){const ee=new Set(h.value);for(const y of X)ee.delete(y);h.value=ee}});function H(G){return o.value||!h.value.has(G)}function P(G,X){const ee=new Set(h.value);X?ee.delete(G):ee.add(G),h.value=ee}const W=b(()=>p.value.some(G=>!h.value.has(G)));function Z(){h.value=W.value?new Set(p.value):new Set}const U=I(null),j=I(null);function le(G){return U.value?.querySelector(`[data-repeater-handle="${G}"]`)??null}function ue(G,X,ee){const y=s.value.map((A,D)=>D===G?{...A,[X]:ee}:A);x(y,[...p.value]),r?.clearError(`${n.field.name}.${G}.${X}`)}async function we(){if(o.value||u.value!==null&&s.value.length>=u.value)return;const G=C();x([...s.value,q()],[...p.value,G]),await Ye(),U.value?.querySelector(`[data-repeater-key="${G}"]`)?.querySelector('[data-repeater-body] input, [data-repeater-body] select, [data-repeater-body] textarea, [data-repeater-body] [contenteditable="true"]')?.focus()}async function De(G){const X=s.value[G];if(!X||o.value||s.value.length<=d.value)return;if(O(X)&&r){const D=R(G);if(!await r.confirm({message:_("backend::lang.repeater.remove_confirm",{title:D}),confirmLabel:_("backend::lang.repeater.remove"),danger:!0}))return}const ee=p.value.filter((D,re)=>re!==G);x(s.value.filter((D,re)=>re!==G),ee),await Ye();const y=ee[G]??ee[G-1],A=y?le(y):null;A?A.focus():j.value?.$el.focus()}async function Ae(G,X){const ee=s.value.length;if(o.value||G===X||G<0||X<0||G>=ee||X>=ee)return;const y=[...s.value],A=[...p.value],[D]=y.splice(G,1),[re]=A.splice(G,1);y.splice(X,0,D),A.splice(X,0,re),x(y,A),await Ye(),le(re)?.focus(),r?.announce(_("backend::lang.repeater.moved",{title:R(X),position:X+1,total:ee}))}function ie(G,X){(G.key==="ArrowUp"||G.key==="ArrowDown")&&(G.preventDefault(),Ae(X,G.key==="ArrowUp"?X-1:X+1))}const _e=I(null),z=I(null);function ke(G,X){_e.value=X,z.value=null,G.dataTransfer?.setData("text/plain",p.value[X]??""),G.dataTransfer&&(G.dataTransfer.effectAllowed="move")}function me(G,X){if(_e.value===null)return;G.preventDefault();const y=G.currentTarget.getBoundingClientRect();z.value=G.clientY>y.top+y.height/2?X+1:X}function Y(G){if(_e.value===null||z.value===null)return;G.preventDefault();const X=_e.value,ee=z.value>X?z.value-1:z.value;fe(),Ae(X,ee)}function fe(){_e.value=null,z.value=null}return(G,X)=>(m(),g("div",{ref_key:"root",ref:U,role:"group","aria-labelledby":f.value,"aria-describedby":e.describedBy||void 0,"data-repeater":e.field.name,class:"flex flex-col gap-4"},[s.value.length===0?(m(),g("div",Wq,[w("p",Gq,T(i(_)("backend::lang.repeater.empty")),1),o.value?ne("",!0):(m(),g("p",Yq,T(i(_)("backend::lang.repeater.empty_hint",{prompt:c.value})),1))])):ne("",!0),(m(!0),g(pe,null,Re(s.value,(ee,y)=>(m(),g(pe,{key:p.value[y]},[_e.value!==null&&z.value===y&&z.value!==_e.value&&z.value!==_e.value+1?(m(),g("div",Jq)):ne("",!0),w("div",{"data-repeater-row":y,"data-repeater-key":p.value[y],class:he([[M(y)>0?"border-danger":"border-border",_e.value===y?"opacity-50":""],"rounded-inner border bg-surface"]),onDragover:A=>me(A,y),onDrop:Y},[w("div",{class:he([H(p.value[y])?"rounded-t-inner border-b border-border":"rounded-inner","flex min-h-12 items-center gap-2 bg-subtle px-2"])},[o.value?ne("",!0):(m(),g("button",{key:0,type:"button",draggable:"true","data-repeater-handle":p.value[y],"aria-label":i(_)("backend::lang.repeater.move",{title:R(y)}),class:he([wo,"cursor-grab"]),onKeydown:A=>ie(A,y),onDragstart:A=>ke(A,y),onDragend:fe},[F(i(Si),{size:16,"aria-hidden":"true"})],40,Xq)),w("span",Qq,T(y+1)+".",1),w("span",{"data-repeater-title":"",class:"min-w-0 flex-1 truncate font-semibold",title:R(y)},T(R(y)),9,eL),M(y)>0?(m(),g("span",tL,T(i(Vr)("backend::lang.form.tab_errors",M(y))),1)):ne("",!0),o.value?ne("",!0):(m(),g("div",nL,[w("button",{type:"button","data-action":"repeater-up","aria-label":i(_)("backend::lang.repeater.move_up",{title:R(y)}),disabled:y===0,class:he(wo),onClick:A=>Ae(y,y-1)},[F(i(Og),{size:16,"aria-hidden":"true"})],8,aL),w("button",{type:"button","data-action":"repeater-down","aria-label":i(_)("backend::lang.repeater.move_down",{title:R(y)}),disabled:y===s.value.length-1,class:he(wo),onClick:A=>Ae(y,y+1)},[F(i(sr),{size:16,"aria-hidden":"true"})],8,rL),w("button",{type:"button","data-action":"repeater-toggle","aria-label":i(_)(H(p.value[y])?"backend::lang.repeater.collapse":"backend::lang.repeater.expand",{title:R(y)}),"aria-expanded":H(p.value[y])?"true":"false","aria-controls":`${e.controlId}-${p.value[y]}-body`,class:he(wo),onClick:A=>P(p.value[y],!H(p.value[y]))},[F(i(sr),{size:16,class:he([H(p.value[y])?"rotate-180":"","transition-transform duration-150"]),"aria-hidden":"true"},null,8,["class"])],8,lL),w("button",{type:"button","data-action":"repeater-remove","aria-label":i(_)("backend::lang.repeater.remove_named",{title:R(y)}),disabled:s.value.length<=d.value,class:he([wo,"hover:bg-danger-soft hover:text-danger"]),onClick:A=>De(y)},[F(i(_r),{size:16,"aria-hidden":"true"})],8,oL)]))],2),H(p.value[y])?(m(),g("div",{key:0,id:`${e.controlId}-${p.value[y]}-body`,"data-repeater-body":"",class:"p-4"},[o.value?(m(),g("dl",iL,[(m(!0),g(pe,null,Re(l.value,A=>(m(),V(c0,{key:A.name,class:he(A.span==="left"?"min-[600px]:col-start-1":A.span==="right"?"min-[600px]:col-start-2":"col-span-full"),field:{...A,readOnly:!0},value:ee[A.name],source:e.source,"record-id":e.recordId,"id-prefix":`${e.controlId}-${p.value[y]}`},null,8,["class","field","value","source","record-id","id-prefix"]))),128))])):(m(),V(ao,{key:1,fields:l.value,values:ee,errors:K.value[y]??{},notices:$.value[y],source:e.source,"record-id":e.recordId,"id-prefix":`${e.controlId}-${p.value[y]}`,"scope-path":e.field.name,onUpdate:(A,D)=>ue(y,A,D)},null,8,["fields","values","errors","notices","source","record-id","id-prefix","scope-path","onUpdate"]))],8,sL)):ne("",!0)],42,Zq)],64))),128)),_e.value!==null&&z.value===s.value.length&&z.value!==_e.value+1?(m(),g("div",{key:1,"data-repeater-slot":"",class:"h-12 rounded-inner border-2 border-dashed border-primary bg-sel",onDragover:X[0]||(X[0]=vt(()=>{},["prevent"])),onDrop:Y},null,32)):ne("",!0),o.value?ne("",!0):(m(),g("div",uL,[F(Ge,{ref_key:"addButton",ref:j,variant:"outline",size:"sm",icon:i(_s),"data-action":"repeater-add",disabled:u.value!==null&&s.value.length>=u.value,onClick:we},{default:N(()=>[xe(T(c.value),1)]),_:1},8,["icon","disabled"]),u.value!==null?(m(),g("span",cL,T(i(_)("backend::lang.repeater.count",{current:s.value.length,max:u.value})),1)):ne("",!0),s.value.length>1?(m(),V(Ge,{key:1,variant:"ghost",size:"sm",class:"ml-auto","data-action":"repeater-toggle-all",onClick:Z},{default:N(()=>[xe(T(i(_)(W.value?"backend::lang.repeater.collapse_all":"backend::lang.repeater.expand_all")),1)]),_:1})):ne("",!0)]))],8,Kq))}}),fL="modulepreload",pL=function(e,t){return new URL(e,t).href},lh={},mL=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let d=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const o=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),u=s?.nonce||s?.getAttribute("nonce");r=d(n.map(c=>{if(c=pL(c,a),c in lh)return;lh[c]=!0;const f=c.endsWith(".css"),v=f?'[rel="stylesheet"]':"";if(a)for(let h=o.length-1;h>=0;h--){const k=o[h];if(k.href===c&&(!f||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${v}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":fL,f||(p.as="script"),p.crossOrigin="",p.href=c,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((h,k)=>{p.addEventListener("load",h),p.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${c}`)))})}))}function l(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return r.then(o=>{for(const s of o||[])s.status==="rejected"&&l(s.reason);return t().catch(l)})};function oh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n2?a-2:0),l=2;l1?n-1:0),r=1;r"u"?null:It(BigInt.prototype.toString),fh=typeof Symbol>"u"?null:It(Symbol.prototype.toString),on=It(Object.prototype.hasOwnProperty),So=It(Object.prototype.toString),Yt=It(RegExp.prototype.test),Ka=AL(TypeError);function It(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Po;if(sh&&sh(e,null),!Nl(t))return e;let a=t.length;for(;a--;){let r=t[a];if(typeof r=="string"){const l=n(r);l!==r&&(_L(t)||(t[a]=l),r=l)}e[r]=!0}return e}function TL(e){for(let t=0;t/g),qL=Ut(/\${[\w\W]*/g),LL=Ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),NL=Ut(/^aria-[\-\w]+$/),yh=Ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),BL=Ut(/^(?:\w+script|data):/i),FL=Ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),VL=Ut(/^html$/i),zL=Ut(/^[a-z][.\w]*(-[.\w]+)+$/i),gh=Ut(/<[/\w!]/g),bh=Ut(/<[/\w]/g),jL=Ut(/<\/no(script|embed|frames)/i),UL=Ut(/\/>/i),vn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},v0=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],HL=Bt(ct({},v0)),KL=(function(){const e={};return Rr(v0,t=>{e[t]=Ut(new RegExp("])","i"))}),Bt(e)})(),WL=function(){return typeof window>"u"?null:window},GL=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(a=n.getAttribute(r));const l="dompurify"+(a?"#"+a:"");try{return t.createPolicy(l,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},_h=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Wa=function(t,n,a,r){return on(t,n)&&Nl(t[n])?ct(r.base?hn(r.base):{},t[n],r.transform):a},Bc=function(t,n,a){const r=on(t,n)?t[n]:void 0;return r&&typeof r=="object"?hn(r):a()};function h0(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:WL();const t=Me=>h0(Me);if(t.version="3.4.16",t.removed=[],!e||!e.document||e.document.nodeType!==vn.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const a=n,r=a.currentScript;e.DocumentFragment;const l=e.HTMLTemplateElement,o=e.Node,s=e.Element,u=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,c=e.trustedTypes,f=s.prototype,v=Cn(f,"cloneNode"),p=Cn(f,"remove"),h=Cn(f,"removeAttributeNode"),k=Cn(f,"nextSibling"),C=Cn(f,"childNodes"),x=Cn(f,"parentNode"),S=Cn(f,"shadowRoot"),q=Cn(f,"attributes"),O=o&&o.prototype?Cn(o.prototype,"nodeType"):null,E=o&&o.prototype?Cn(o.prototype,"nodeName"):null,R=o&&o.prototype?Cn(o.prototype,"ownerDocument"):null,L=function(B){return O?O(B):B.nodeType},K=function(B){return E?E(B):B.nodeName};if(typeof l=="function"){const Me=n.createElement("template");Me.content&&Me.content.ownerDocument&&(n=Me.content.ownerDocument)}let $,M="",H,P=!1,W=0;const Z=function(){if(W>0)throw Ka('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},U=function(B){Z(),W++;try{return $.createHTML(B)}finally{W--}},j=function(B){Z(),W++;try{return $.createScriptURL(B)}finally{W--}},le=function(){return P||(H=GL(c,r),P=!0),H},ue=n,we=ue.implementation,De=ue.createNodeIterator,Ae=ue.createDocumentFragment,ie=ue.getElementsByTagName,_e=a.importNode;let z=_h();t.isSupported=typeof p0=="function"&&typeof x=="function"&&we&&we.createHTMLDocument!==void 0;const ke=RL,me=IL,Y=qL,fe=LL,G=NL,X=BL,ee=FL,y=zL;let A=yh,D=null;const re=ct({},[...ph,...Ic,...qc,...Lc,...mh]);let Q=null;const ce=ct({},[...vh,...Nc,...hh,...Js]);let Ee=Object.seal(kl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,Te=null;const oe=Object.seal(kl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,ye=!0,qe=!1,Be=!0,He=!1,Je=!0,Ze=!1,ot=!1,at=null,St=null,At=!1,qt=!1,Fe=!1,de=!1,ge=!0,je=!1;const rt="user-content-";let zt=!0,Lt=!1,Pn={},Gt=null;const lo=ct({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let nl=null;const oo=ct({},["audio","video","img","source","image","track"]);let al=null;const so=ct({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kn="http://www.w3.org/1998/Math/MathML",Fa="http://www.w3.org/2000/svg",Qt="http://www.w3.org/1999/xhtml";let Hn=Qt,io=!1,uo=null;const co=ct({},[kn,Fa,Qt],Rc),J=Bt(["mi","mo","mn","ms","mtext"]);let Oe=ct({},J);const te=Bt(["annotation-xml"]);let Ie=ct({},te);const et=ct({},["title","style","font","a","script"]);let Tt=null;const Kn=["application/xhtml+xml","text/html"],Va="text/html";let Ot=null,rl=null;const L0=n.createElement("form"),vp=function(B){return B instanceof RegExp||B instanceof Function},Iu=function(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(rl&&rl===B)return;(!B||typeof B!="object")&&(B={}),B=hn(B),Tt=Kn.indexOf(B.PARSER_MEDIA_TYPE)===-1?Va:B.PARSER_MEDIA_TYPE,Ot=Tt==="application/xhtml+xml"?Rc:Po,D=Wa(B,"ALLOWED_TAGS",re,{transform:Ot}),Q=Wa(B,"ALLOWED_ATTR",ce,{transform:Ot}),uo=Wa(B,"ALLOWED_NAMESPACES",co,{transform:Rc}),al=Wa(B,"ADD_URI_SAFE_ATTR",so,{transform:Ot,base:so}),nl=Wa(B,"ADD_DATA_URI_TAGS",oo,{transform:Ot,base:oo}),Gt=Wa(B,"FORBID_CONTENTS",lo,{transform:Ot}),Ce=Wa(B,"FORBID_TAGS",hn({}),{transform:Ot}),Te=Wa(B,"FORBID_ATTR",hn({}),{transform:Ot}),Pn=on(B,"USE_PROFILES")?B.USE_PROFILES&&typeof B.USE_PROFILES=="object"?hn(B.USE_PROFILES):B.USE_PROFILES:!1,$e=B.ALLOW_ARIA_ATTR!==!1,ye=B.ALLOW_DATA_ATTR!==!1,qe=B.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=B.ALLOW_SELF_CLOSE_IN_ATTR!==!1,He=B.SAFE_FOR_TEMPLATES||!1,Je=B.SAFE_FOR_XML!==!1,Ze=B.WHOLE_DOCUMENT||!1,qt=B.RETURN_DOM||!1,Fe=B.RETURN_DOM_FRAGMENT||!1,de=B.RETURN_TRUSTED_TYPE||!1,At=B.FORCE_BODY||!1,ge=B.SANITIZE_DOM!==!1,je=B.SANITIZE_NAMED_PROPS||!1,zt=B.KEEP_CONTENT!==!1,Lt=B.IN_PLACE||!1,A=DL(B.ALLOWED_URI_REGEXP)?B.ALLOWED_URI_REGEXP:yh,Hn=typeof B.NAMESPACE=="string"?B.NAMESPACE:Qt,Oe=Bc(B,"MATHML_TEXT_INTEGRATION_POINTS",()=>ct({},J)),Ie=Bc(B,"HTML_INTEGRATION_POINTS",()=>ct({},te));const se=Bc(B,"CUSTOM_ELEMENT_HANDLING",()=>kl(null));if(Ee=kl(null),on(se,"tagNameCheck")&&vp(se.tagNameCheck)&&(Ee.tagNameCheck=se.tagNameCheck),on(se,"attributeNameCheck")&&vp(se.attributeNameCheck)&&(Ee.attributeNameCheck=se.attributeNameCheck),on(se,"allowCustomizedBuiltInElements")&&typeof se.allowCustomizedBuiltInElements=="boolean"&&(Ee.allowCustomizedBuiltInElements=se.allowCustomizedBuiltInElements),Ut(Ee),He&&(ye=!1),Fe&&(qt=!0),Pn&&(D=ct({},mh),Q=kl(null),Pn.html===!0&&(ct(D,ph),ct(Q,vh)),Pn.svg===!0&&(ct(D,Ic),ct(Q,Nc),ct(Q,Js)),Pn.svgFilters===!0&&(ct(D,qc),ct(Q,Nc),ct(Q,Js)),Pn.mathMl===!0&&(ct(D,Lc),ct(Q,hh),ct(Q,Js))),oe.tagCheck=null,oe.attributeCheck=null,on(B,"ADD_TAGS")&&(typeof B.ADD_TAGS=="function"?oe.tagCheck=B.ADD_TAGS:Nl(B.ADD_TAGS)&&(D===re&&(D=hn(D)),ct(D,B.ADD_TAGS,Ot))),on(B,"ADD_ATTR")&&(typeof B.ADD_ATTR=="function"?oe.attributeCheck=B.ADD_ATTR:Nl(B.ADD_ATTR)&&(Q===ce&&(Q=hn(Q)),ct(Q,B.ADD_ATTR,Ot))),on(B,"ADD_FORBID_CONTENTS")&&Nl(B.ADD_FORBID_CONTENTS)&&(Gt===lo&&(Gt=hn(Gt)),ct(Gt,B.ADD_FORBID_CONTENTS,Ot)),zt&&(D["#text"]=!0),Ze&&ct(D,["html","head","body"]),D.table&&(ct(D,["tbody"]),delete Ce.tbody),B.TRUSTED_TYPES_POLICY){if(typeof B.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ka('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof B.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ka('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Se=$;$=B.TRUSTED_TYPES_POLICY;try{M=U("")}catch(Pe){throw $=Se,Pe}}else B.TRUSTED_TYPES_POLICY===null?($=void 0,M=""):($===void 0&&($=le()),$&&typeof M=="string"&&(M=U("")));Bt&&Bt(B),rl=B},hp=ct({},[...Ic,...qc,...ML]),yp=ct({},[...Lc,...PL]),N0=function(B,se,Se){return se.namespaceURI===Qt?B==="svg":se.namespaceURI===kn?B==="svg"&&(Se==="annotation-xml"||Oe[Se]):!!hp[B]},B0=function(B,se,Se){return se.namespaceURI===Qt?B==="math":se.namespaceURI===Fa?B==="math"&&Ie[Se]:!!yp[B]},F0=function(B,se,Se){return se.namespaceURI===Fa&&!Ie[Se]||se.namespaceURI===kn&&!Oe[Se]?!1:!yp[B]&&(et[B]||!hp[B])},V0=function(B){let se=x(B);(!se||!se.tagName)&&(se={namespaceURI:Hn,tagName:"template"});const Se=Po(B.tagName),Pe=Po(se.tagName);return uo[B.namespaceURI]?B.namespaceURI===Fa?N0(Se,se,Pe):B.namespaceURI===kn?B0(Se,se,Pe):B.namespaceURI===Qt?F0(Se,se,Pe):!!(Tt==="application/xhtml+xml"&&uo[B.namespaceURI]):!1},za=function(B){$o(t.removed,{element:B});try{x(B).removeChild(B)}catch{if(p(B),!x(B))throw Ka("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},gp=function(B,se,Se){try{h(B,se)}catch{try{B.removeAttribute(Se)}catch{}}},Ss=function(B){Es(B);const se=C(B);if(se){const Pe=[];Rr(se,Ue=>{$o(Pe,Ue)}),Rr(Pe,Ue=>{try{p(Ue)}catch{}})}const Se=q(B);if(Se)for(let Pe=Se.length-1;Pe>=0;--Pe){const Ue=Se[Pe],st=Ue&&Ue.name;typeof st=="string"&&gp(B,Ue,st)}},Sr=function(B,se,Se){if(!Se)try{Se=se.getAttributeNode(B)}catch{Se=null}$o(t.removed,{attribute:Se||null,from:se});try{Se?h(se,Se):se.removeAttribute(B)}catch{try{se.removeAttribute(B)}catch{}}if(B==="is")if(qt||Fe)try{za(se)}catch{}else try{se.setAttribute(B,"")}catch{}},z0=function(B){const se=q(B);if(se)for(let Se=se.length-1;Se>=0;--Se){const Pe=se[Se],Ue=Pe&&Pe.name;typeof Ue!="string"||Q[Ot(Ue)]||gp(B,Pe,Ue)}},Es=function(B){const se=[B];for(;se.length>0;){const Se=se.pop();L(Se)===vn.element&&z0(Se);const Pe=C(Se);if(Pe)for(let Ue=Pe.length-1;Ue>=0;--Ue)se.push(Pe[Ue])}},bp=function(B,se){return Je?B==="patchsrc"?!0:B==="for"&&se!=="label"&&se!=="output":!1},j0=function(B){if(!Je)return;const se=[B];for(;se.length>0;){const Se=se.pop(),Pe=L(Se);if(Pe===vn.processingInstruction||Pe===vn.comment&&Yt(bh,Se.data)){try{p(Se)}catch{}continue}if(Pe===vn.element){const st=Se,ut=Ot(K(Se));try{st.hasAttribute&&st.hasAttribute("patchsrc")&&st.removeAttribute("patchsrc"),st.hasAttribute&&st.hasAttribute("for")&&bp("for",ut)&&st.removeAttribute("for")}catch{}}const Ue=C(Se);if(Ue)for(let st=Ue.length-1;st>=0;--st)se.push(Ue[st])}},_p=function(B){let se=null,Se=null;if(At)B=""+B;else{const st=uh(B,/^[\r\n\t ]+/);Se=st&&st[0]}Tt==="application/xhtml+xml"&&Hn===Qt&&(B=''+B+"");const Pe=$?U(B):B;if(Hn===Qt)try{se=new d().parseFromString(Pe,Tt)}catch{}if(!se||!se.documentElement){se=we.createDocument(Hn,"template",null);try{se.documentElement.innerHTML=io?M:Pe}catch{}}const Ue=se.body||se.documentElement;return B&&Se&&Ue.insertBefore(n.createTextNode(Se),Ue.childNodes[0]||null),Hn===Qt?ie.call(se,Ze?"html":"body")[0]:Ze?se.documentElement:Ue},xp=function(B){const se=R?R(B):B.ownerDocument;return De.call(se||B,B,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},As=function(B){return B=Co(B,ke," "),B=Co(B,me," "),B=Co(B,Y," "),B},qu=function(B){var se;B.normalize();const Se=R?R(B):B.ownerDocument,Pe=De.call(Se||B,B,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let Ue=Pe.nextNode();for(;Ue;)Ue.data=As(Ue.data),Ue=Pe.nextNode();const st=(se=B.querySelectorAll)===null||se===void 0?void 0:se.call(B,"template");st&&Rr(st,ut=>{ll(ut.content)&&qu(ut.content)})},Ts=function(B){const se=E?E(B):null;return typeof se!="string"||Ot(se)!=="form"?!1:typeof B.nodeName!="string"||typeof B.textContent!="string"||typeof B.removeChild!="function"||B.attributes!==q(B)||typeof B.removeAttribute!="function"||typeof B.removeAttributeNode!="function"||typeof B.getAttributeNode!="function"||typeof B.setAttribute!="function"||typeof B.namespaceURI!="string"||typeof B.insertBefore!="function"||typeof B.hasChildNodes!="function"||B.nodeType!==O(B)||B.childNodes!==C(B)},ll=function(B){if(!O||typeof B!="object"||B===null)return!1;try{return O(B)===vn.documentFragment}catch{return!1}},fo=function(B){if(!O||typeof B!="object"||B===null)return!1;try{return typeof O(B)=="number"}catch{return!1}};function Wn(Me,B,se){Me.length!==0&&Rr(Me,Se=>{Se.call(t,B,se,rl)})}const U0=function(B,se){return!!(Je&&B.hasChildNodes()&&!fo(B.firstElementChild)&&Yt(gh,B.textContent)&&Yt(gh,B.innerHTML)||Je&&B.namespaceURI===Qt&&HL[se]&&(fo(B.firstElementChild)||typeof B.textContent=="string"&&Yt(KL[se],B.textContent))||B.nodeType===vn.processingInstruction||Je&&B.nodeType===vn.comment&&Yt(bh,B.data))},Os=function(B,se){if(B instanceof RegExp)return Yt(B,se);if(B instanceof Function){for(var Se=arguments.length,Pe=new Array(Se>2?Se-2:0),Ue=2;Ue=0;--ut){const Et=B===Se?v(Ue[ut],!0):Ue[ut];Pe.insertBefore(Et,k(B))}}}return za(B),!0},kp=function(B,se,Se,Pe){return B.length===0?se:se===Se||se===Pe?hn(se):se},ol=function(B,se){return B===se||x(B)!==null?!1:(Lt&&Es(B),!0)},wp=function(B,se){if(Wn(z.beforeSanitizeElements,B,null),ol(B,se))return!0;if(Ts(B))return za(B),!0;const Se=Ot(K(B));if(D=kp(z.uponSanitizeElement,D,re,at),Wn(z.uponSanitizeElement,B,{tagName:Se,allowedTags:D}),ol(B,se))return!0;if(U0(B,Se))return za(B),!0;if(Ce[Se]||!(oe.tagCheck instanceof Function&&oe.tagCheck(Se))&&!D[Se]){const Pe=H0(B,Se,se);return Pe===!1&&(Wn(z.afterSanitizeElements,B,null),ol(B,se))?!0:Pe}if(L(B)===vn.element&&!V0(B)||(Se==="noscript"||Se==="noembed"||Se==="noframes")&&Yt(jL,B.innerHTML))return za(B),!0;if(He&&B.nodeType===vn.text){const Pe=As(B.textContent);B.textContent!==Pe&&($o(t.removed,{element:B.cloneNode()}),B.textContent=Pe)}return Wn(z.afterSanitizeElements,B,null),ol(B,se)},$p=function(B,se,Se){if(Te[se]||bp(se,B)||ge&&(se==="id"||se==="name")&&(Se in n||Se in L0))return!1;const Pe=Q[se]||oe.attributeCheck instanceof Function&&oe.attributeCheck(se,B);return ye&&Yt(fe,se)||$e&&Yt(G,se)?!0:Pe?al[se]||Yt(A,Co(Se,ee,""))||(se==="src"||se==="xlink:href"||se==="href")&&B!=="script"&&ch(Se,"data:")===0&&nl[B]||qe&&!Yt(X,Co(Se,ee,""))?!0:!Se:Cp(B)&&Os(Ee.tagNameCheck,B)&&Os(Ee.attributeNameCheck,se,B)||se==="is"&&Ee.allowCustomizedBuiltInElements&&Os(Ee.tagNameCheck,Se)},K0=ct({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Cp=function(B){return!K0[Po(B)]&&Yt(y,B)},W0=function(B,se,Se,Pe){if($&&typeof c=="object"&&typeof c.getAttributeType=="function"&&!Se)switch(c.getAttributeType(B,se)){case"TrustedHTML":return U(Pe);case"TrustedScriptURL":return j(Pe)}return Pe},G0=function(B,se,Se,Pe){try{return Se?B.setAttributeNS(Se,se,Pe):B.setAttribute(se,Pe),Ts(B)?(za(B),!1):!0}catch{return Sr(se,B),!1}},Sp=function(B,se){if(Wn(z.beforeSanitizeAttributes,B,null),ol(B,se))return;const Se=B.attributes;if(!Se||Ts(B))return;Q=kp(z.uponSanitizeAttribute,Q,ce,St);const Pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let Ue=Se.length;const st=Ot(B.nodeName);for(;Ue--;){const ut=Se[Ue],Et=ut.name,wn=ut.namespaceURI,pn=ut.value,sl=Ot(Et),Nu=pn;let en=Et==="value"?Nu:CL(Nu),Ep=!1;if(Pe.attrName=sl,Pe.attrValue=en,Pe.keepAttr=!0,Pe.forceKeepAttr=void 0,Wn(z.uponSanitizeAttribute,B,Pe),en=Pe.attrValue,je&&(sl==="id"||sl==="name")&&ch(en,rt)!==0&&(Sr(Et,B,ut),en=rt+en,Ep=!0),Je&&Yt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,en)){Sr(Et,B,ut);continue}if(sl==="attributename"&&uh(en,"href")){Sr(Et,B,ut);continue}if(!Pe.forceKeepAttr){if(!Pe.keepAttr){Sr(Et,B,ut);continue}if(!Be&&Yt(UL,en)){Sr(Et,B,ut);continue}if(He&&(en=As(en)),!$p(st,sl,en)){Sr(Et,B,ut);continue}en=W0(st,sl,wn,en),en!==Nu&&G0(B,Et,wn,en)&&Ep&&ih(t.removed)}}Wn(z.afterSanitizeAttributes,B,null),ol(B,se)},Ds=function(B){let se=null;const Se=xp(B);for(Wn(z.beforeSanitizeShadowDOM,B,null);se=Se.nextNode();)if(Wn(z.uponSanitizeShadowNode,se,null),wp(se,B),Sp(se,B),ll(se.content)&&Ds(se.content),L(se)===vn.element){const Pe=S(se);ll(Pe)&&(Lu(Pe),Ds(Pe))}Wn(z.afterSanitizeShadowDOM,B,null)},Lu=function(B){const se=[{node:B,shadow:null}];for(;se.length>0;){const Se=se.pop();if(Se.shadow){Ds(Se.shadow);continue}const Pe=Se.node,Ue=L(Pe)===vn.element,st=C(Pe);if(st)for(let ut=st.length-1;ut>=0;--ut)se.push({node:st[ut],shadow:null});if(Ue){const ut=E?E(Pe):null;if(typeof ut=="string"&&Ot(ut)==="template"){const Et=Pe.content;ll(Et)&&se.push({node:Et,shadow:null})}}if(Ue){const ut=S(Pe);ll(ut)&&se.push({node:null,shadow:ut},{node:ut,shadow:null})}}};return t.sanitize=function(Me){let B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,Se=null,Pe=null,Ue=null;if(io=!Me,io&&(Me=""),typeof Me!="string"&&!fo(Me)&&(Me=OL(Me),typeof Me!="string"))throw Ka("dirty is not a string, aborting");if(!t.isSupported)return Me;ot?(D=at,Q=St):Iu(B),(z.uponSanitizeElement.length>0||z.uponSanitizeAttribute.length>0)&&(D=hn(D)),z.uponSanitizeAttribute.length>0&&(Q=hn(Q)),t.removed=[];const st=Lt&&typeof Me!="string"&&fo(Me);if(st){j0(Me);const wn=K(Me);if(typeof wn=="string"){const pn=Ot(wn);if(!D[pn]||Ce[pn])throw Ss(Me),Ka("root node is forbidden and cannot be sanitized in-place")}if(Ts(Me))throw Ss(Me),Ka("root node is clobbered and cannot be sanitized in-place");try{Lu(Me)}catch(pn){throw Ss(Me),pn}}else if(fo(Me))se=_p(""),Se=se.ownerDocument.importNode(Me,!0),Se.nodeType===vn.element&&Se.nodeName==="BODY"||Se.nodeName==="HTML"?se=Se:se.appendChild(Se),Lu(se);else{if(!qt&&!He&&!Ze&&Me.indexOf("<")===-1)return $&&de?U(Me):Me;if(se=_p(Me),!se)return qt?null:de?M:""}se&&At&&za(se.firstChild);const ut=st?Me:se;try{const wn=xp(ut);for(;Pe=wn.nextNode();)wp(Pe,ut),Sp(Pe,ut),ll(Pe.content)&&Ds(Pe.content)}catch(wn){throw st&&(Ss(Me),Rr(t.removed,pn=>{pn.element&&Es(pn.element)})),wn}if(st){let wn=!1;if(Rr(t.removed,pn=>{pn.element&&(pn.element===Me&&(wn=!0),Es(pn.element))}),wn)throw Ka("a node selected for removal could not be safely returned; refusing to sanitize in place");return He&&qu(Me),Me}if(qt){if(He&&qu(se),Fe)for(Ue=Ae.call(se.ownerDocument);se.firstChild;)Ue.appendChild(se.firstChild);else Ue=se;return(Q.shadowroot||Q.shadowrootmode)&&(Ue=_e.call(a,Ue,!0)),Ue}let Et=Ze?se.outerHTML:se.innerHTML;return Ze&&D["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&Yt(VL,se.ownerDocument.doctype.name)&&(Et=" -`+Et),He&&(Et=As(Et)),$&&de?U(Et):Et},t.setConfig=function(){let Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Iu(Me),ot=!0,at=D,St=Q},t.clearConfig=function(){rl=null,ot=!1,at=null,St=null,$=H,M=""},t.isValidAttribute=function(Me,B,se){rl||Iu({});const Se=Ot(Me),Pe=Ot(B);return $p(Se,Pe,se)},t.addHook=function(Me,B){typeof B=="function"&&on(z,Me)&&$o(z[Me],B)},t.removeHook=function(Me,B){if(on(z,Me)){if(B!==void 0){const se=wL(z[Me],B);return se===-1?void 0:$L(z[Me],se,1)[0]}return ih(z[Me])}},t.removeHooks=function(Me){on(z,Me)&&(z[Me]=[])},t.removeAllHooks=function(){z=_h()},t}var YL=h0();const JL=["http","https","mailto","tel"],ZL=/[\x00-\x20\x7f]+/g,XL=/^([a-z][a-z0-9+.-]*):/i;function y0(e){if(e==null)return!1;const t=e.replace(ZL,"");if(t==="")return!1;const n=XL.exec(t);if(n)return JL.includes(n[1].toLowerCase());try{return new URL(t,"https://admin.invalid/"),!0}catch{return!1}}const QL=["script","style","template","noscript","iframe","frame","frameset","object","embed","applet","svg","math","title","head","meta","link","base"],g0=Object.freeze({ALLOWED_TAGS:[...d0],ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,ADD_FORBID_CONTENTS:[...QL],KEEP_CONTENT:!0,RETURN_TRUSTED_TYPE:!1}),eN='

a +