@ditojs/admin 3.2.6 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/dito-admin.css +1 -1
  2. package/dist/dito-admin.es.js +6012 -5827
  3. package/dist/dito-admin.umd.js +3 -7
  4. package/package.json +18 -17
  5. package/src/DitoAdmin.js +44 -24
  6. package/src/DitoContext.js +28 -2
  7. package/src/DitoTypeComponent.js +1 -0
  8. package/src/appState.js +6 -3
  9. package/src/components/DitoAccount.vue +35 -27
  10. package/src/components/DitoAffixes.vue +9 -2
  11. package/src/components/DitoClipboard.vue +59 -93
  12. package/src/components/DitoConfirmMessage.vue +18 -0
  13. package/src/components/DitoContainer.vue +56 -18
  14. package/src/components/DitoCreateButton.vue +36 -84
  15. package/src/components/DitoDialog.vue +20 -15
  16. package/src/components/DitoDragHandle.vue +44 -0
  17. package/src/components/DitoDraggable.vue +43 -16
  18. package/src/components/DitoEditButtons.vue +48 -24
  19. package/src/components/DitoErrors.vue +9 -56
  20. package/src/components/DitoForm.vue +82 -42
  21. package/src/components/DitoInputAffixes.vue +50 -0
  22. package/src/components/DitoLabel.vue +1 -15
  23. package/src/components/DitoMenu.vue +45 -52
  24. package/src/components/DitoNotifications.vue +38 -14
  25. package/src/components/DitoOptionList.vue +81 -0
  26. package/src/components/DitoOptionsEditButtons.vue +57 -0
  27. package/src/components/DitoPagination.vue +1 -8
  28. package/src/components/DitoPane.vue +51 -39
  29. package/src/components/DitoPanel.vue +12 -26
  30. package/src/components/DitoPanels.vue +11 -5
  31. package/src/components/DitoResizeHandle.vue +47 -0
  32. package/src/components/DitoRoot.vue +113 -320
  33. package/src/components/DitoSchema.vue +72 -63
  34. package/src/components/DitoSchemaInlined.vue +8 -9
  35. package/src/components/DitoScopes.vue +14 -18
  36. package/src/components/DitoSidebar.vue +4 -29
  37. package/src/components/DitoSourceItem.vue +114 -0
  38. package/src/components/DitoTableCell.vue +4 -0
  39. package/src/components/DitoTableHead.vue +15 -17
  40. package/src/components/DitoTabs.vue +25 -0
  41. package/src/components/DitoTrail.vue +25 -25
  42. package/src/components/DitoTreeItem.vue +102 -141
  43. package/src/components/DitoUploadFile.vue +5 -2
  44. package/src/components/DitoView.vue +33 -24
  45. package/src/index.js +4 -1
  46. package/src/mixins/DitoMixin.js +77 -110
  47. package/src/mixins/DomMixin.js +12 -14
  48. package/src/mixins/EmitterMixin.js +3 -2
  49. package/src/mixins/ItemMixin.js +38 -94
  50. package/src/mixins/OptionsMixin.js +38 -25
  51. package/src/mixins/ResourceMixin.js +182 -111
  52. package/src/mixins/RouteMixin.js +61 -44
  53. package/src/mixins/SchemaParentMixin.js +4 -1
  54. package/src/mixins/SourceMixin.js +118 -100
  55. package/src/mixins/TypeMixin.js +42 -40
  56. package/src/mixins/ValidationMixin.js +16 -4
  57. package/src/mixins/ValidatorMixin.js +1 -1
  58. package/src/styles/_settings.scss +4 -0
  59. package/src/styles/_tippy.scss +0 -11
  60. package/src/styles/style.scss +0 -1
  61. package/src/types/DitoTypeButton.vue +11 -14
  62. package/src/types/DitoTypeCheckboxes.vue +35 -17
  63. package/src/types/DitoTypeCode.vue +19 -41
  64. package/src/types/DitoTypeColor.vue +67 -19
  65. package/src/types/DitoTypeDate.vue +11 -14
  66. package/src/types/DitoTypeList.vue +50 -62
  67. package/src/types/DitoTypeMarkup.vue +41 -54
  68. package/src/types/DitoTypeMultiselect.vue +82 -52
  69. package/src/types/DitoTypeNumber.vue +12 -15
  70. package/src/types/DitoTypeObject.vue +4 -38
  71. package/src/types/DitoTypeRadio.vue +19 -6
  72. package/src/types/DitoTypeSection.vue +23 -9
  73. package/src/types/DitoTypeSelect.vue +39 -23
  74. package/src/types/DitoTypeSlider.vue +9 -1
  75. package/src/types/DitoTypeSwitch.vue +1 -1
  76. package/src/types/DitoTypeText.vue +11 -14
  77. package/src/types/DitoTypeTreeList.vue +46 -8
  78. package/src/types/DitoTypeUpload.vue +190 -67
  79. package/src/utils/DataModel.js +368 -146
  80. package/src/utils/FileDropTargets.js +97 -0
  81. package/src/utils/ItemStores.js +31 -0
  82. package/src/utils/ListQuery.js +115 -0
  83. package/src/utils/LoadingTracker.js +76 -0
  84. package/src/utils/SchemaGraph.js +3 -2
  85. package/src/utils/Session.js +151 -0
  86. package/src/utils/ViewRegistry.js +85 -0
  87. package/src/utils/accessor.js +12 -4
  88. package/src/utils/affixes.js +33 -0
  89. package/src/utils/changeOnceEdited.js +33 -0
  90. package/src/utils/clipboard.js +55 -0
  91. package/src/utils/data.js +10 -5
  92. package/src/utils/dialogs.js +59 -0
  93. package/src/utils/dragResize.js +61 -0
  94. package/src/utils/filter.js +36 -2
  95. package/src/utils/html.js +9 -0
  96. package/src/utils/list.js +10 -0
  97. package/src/utils/options.js +4 -0
  98. package/src/utils/registration.js +18 -0
  99. package/src/utils/request.js +108 -13
  100. package/src/utils/route.js +6 -17
  101. package/src/utils/schema/data.js +29 -2
  102. package/src/utils/schema/events.js +19 -0
  103. package/src/utils/schema/item.js +114 -0
  104. package/src/utils/schema/lookup.js +39 -14
  105. package/src/utils/schema/setup.js +5 -5
  106. package/src/utils/schema/validation.js +16 -2
  107. package/src/utils/uid.js +105 -8
  108. package/src/validators/_decimals.js +16 -5
  109. package/types/index.d.ts +168 -41
  110. package/src/mixins/LoadingMixin.js +0 -23
  111. package/src/mixins/PulldownMixin.js +0 -72
  112. package/src/styles/_pulldown.scss +0 -38
@@ -1,7 +1,3 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t(require("vue"),require("vue-router"),require("@kyvg/vue3-notification"),require("@ditojs/utils"),require("tippy.js"),require("nanoid"),require("@vueuse/shared"),require("@vueuse/core"),require("focus-trap"),require("sortablejs"),require("codeflask"),require("vue-color"),require("@tiptap/vue-3"),require("@tiptap/extension-document"),require("@tiptap/extension-text"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-italic"),require("@tiptap/extension-link"),require("@tiptap/extension-strike"),require("@tiptap/extension-subscript"),require("@tiptap/extension-superscript"),require("@tiptap/extension-underline"),require("@tiptap/extension-blockquote"),require("@tiptap/extension-code-block"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-horizontal-rule"),require("@tiptap/extension-ordered-list"),require("@tiptap/extension-bullet-list"),require("@tiptap/extension-list-item"),require("tiptap-footnotes"),require("@tiptap/extension-history"),require("vue-multiselect"),require("vue-upload-component")):typeof define==`function`&&define.amd?define(`vue,vue-router,@kyvg/vue3-notification,@ditojs/utils,tippy.js,nanoid,@vueuse/shared,@vueuse/core,focus-trap,sortablejs,codeflask,vue-color,@tiptap/vue-3,@tiptap/extension-document,@tiptap/extension-text,@tiptap/extension-bold,@tiptap/extension-code,@tiptap/extension-italic,@tiptap/extension-link,@tiptap/extension-strike,@tiptap/extension-subscript,@tiptap/extension-superscript,@tiptap/extension-underline,@tiptap/extension-blockquote,@tiptap/extension-code-block,@tiptap/extension-hard-break,@tiptap/extension-heading,@tiptap/extension-paragraph,@tiptap/extension-horizontal-rule,@tiptap/extension-ordered-list,@tiptap/extension-bullet-list,@tiptap/extension-list-item,tiptap-footnotes,@tiptap/extension-history,vue-multiselect,vue-upload-component`.split(`,`),t):(e=typeof globalThis<`u`?globalThis:e||self,e[`dito-admin`]=t(e.vue,e[`vue-router`],e[`@kyvg/vue3-notification`],e[`@ditojs/utils`],e.tippy.js,e.nanoid,e[`@vueuse/shared`],e[`@vueuse/core`],e[`focus-trap`],e.sortablejs,e.codeflask,e[`vue-color`],e[`@tiptap/vue-3`],e[`@tiptap/extension-document`],e[`@tiptap/extension-text`],e[`@tiptap/extension-bold`],e[`@tiptap/extension-code`],e[`@tiptap/extension-italic`],e[`@tiptap/extension-link`],e[`@tiptap/extension-strike`],e[`@tiptap/extension-subscript`],e[`@tiptap/extension-superscript`],e[`@tiptap/extension-underline`],e[`@tiptap/extension-blockquote`],e[`@tiptap/extension-code-block`],e[`@tiptap/extension-hard-break`],e[`@tiptap/extension-heading`],e[`@tiptap/extension-paragraph`],e[`@tiptap/extension-horizontal-rule`],e[`@tiptap/extension-ordered-list`],e[`@tiptap/extension-bullet-list`],e[`@tiptap/extension-list-item`],e[`tiptap-footnotes`],e[`@tiptap/extension-history`],e[`vue-multiselect`],e[`vue-upload-component`]))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,ee,_,te,ne,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge,_e){var ve=Object.create,ye=Object.defineProperty,be=Object.getOwnPropertyDescriptor,xe=Object.getOwnPropertyNames,Se=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty,we=(e,t)=>{let n={};for(var r in e)ye(n,r,{get:e[r],enumerable:!0});return t||ye(n,Symbol.toStringTag,{value:`Module`}),n},Te=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=xe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Ce.call(e,s)&&s!==n&&ye(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=be(t,s))||r.enumerable});return e},v=(e,t,n)=>(n=e==null?{}:ve(Se(e)),Te(t||!e||!e.__esModule||!Ce.call(e,`default`)?ye(n,`default`,{value:e,enumerable:!0}):n,e));n=v(n,1),i=v(i),l=v(l,1),u=v(u),ge=v(ge),_e=v(_e);function Ee(e=``){let t={},n=e.toLowerCase(),[r]=/(iphone|ipad|linux; android|darwin|win|mac|linux|freebsd|sunos)/.exec(n)||[],i={darwin:`mac`,iphone:`ios`,ipad:`ios`,"linux; android":`android`}[r]||r;return i&&(t.platform=i,t[i]=!0),n.replace(/(opera|chrome|safari|webkit|firefox|msie|trident)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv:v?([.\d]+))?/g,(e,n,r,i,a)=>{if(!t.chrome){let e=a||i||r;(!t.version||n!==`safari`)&&(t.version=e,t.versionNumber=parseFloat(e)),t.browser=n,t[n]=!0}}),t.chrome&&delete t.webkit,t}var De=(0,e.reactive)({title:``,routeComponents:[],user:null,agent:Ee(navigator.userAgent||``),loadCache:{},activeLabel:null,clipboardData:null});function y(e,t){return e?`${e}/${t}`:t}function Oe(e,t){if(e==null||t==null)return null;let n=(0,r.normalizeDataPath)(e),i=(0,r.normalizeDataPath)(t);return n===i?``:i?n.startsWith(`${i}/`)?n.slice(i.length+1):null:n}function ke(e){let t=(0,r.parseDataPath)(e);return t?.pop(),t}function Ae(e){return(0,r.normalizeDataPath)(ke(e))}function je(e,t=!1){return t?ke(e):(0,r.parseDataPath)(e)}function Me(e,t=!1){return(0,r.normalizeDataPath)(je(e,t))}function Ne(e,t=!1){let n=je(e,t);if(n){let e;do e=n.pop();while(e!=null&&(0,r.isInteger)(+e));if(e!=null)return n}return null}function Pe(e,t=!1){return(0,r.normalizeDataPath)(Ne(e,t))}function Fe(e,t,n=!1){let i=je(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Ie(e,t,n=!1){let i=Ne(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Le(e){let t=(0,r.parseDataPath)(e);return t[t.length-1]}function Re(e){let t=Le(e);return t==null||(0,r.isInteger)(+t)?null:t}function ze(e){let t=Le(e),n=t==null?null:+t;return(0,r.isInteger)(n)?n:null}var Be=0;function Ve(e,t=`id`){e[t]=`@${++Be}`}function He(e){return/^@/.test(e)}function Ue(e,t=`id`){return e?.[t]!=null&&Object.keys(e).length===1}var We={},Ge={};function Ke(e,t){We[e]=t}function qe(e,t=!1){let n=We[e]||null;if(!n&&!t&&!Ge[e])throw Ge[e]=!0,Error(`Unknown Dito.js component type: '${e}'`);return n}function Je(e){return(0,r.isObject)(e)?e.type:e}function b(e){return qe(Je(e),!0)??null}function Ye(e){return b(e)?.getSourceType?.(Je(e))??null}function Xe(e,t){for(let n of e)if(lt(n)){let e=t(n.component,n.name,0);if(e!==void 0)return e}else if(x(n))for(let[e,r]of Object.entries(n.components||{})){let n=t(r,e,1);if(n!==void 0)return n}}function Ze(e,t){return e?Xe([e,...mt(e)],t):void 0}function Qe(e,t){return Ze(e,e=>t(e)?e:void 0)??null}function $e(e,t){return Ze(e,(e,n)=>t(e,n)?!0:void 0)??!1}function et(e){return $e(e,()=>!0)??!1}function tt(e,t){return!!Ze(e,(e,n)=>{if(S(e)?n===t:tt(e,t))return!0})}function x(e){return(0,r.isObject)(e)&&(0,r.isString)(e.type)}function nt(e){return x(e)&&e.type===`form`}function rt(e){return x(e)&&e.type===`view`}function it(e){return x(e)&&e.type===`tab`}function at(e){return x(e)&&e.type===`panel`}function ot(e){return at(e)&&!!e.data}function st(e){return x(e)&&e.type===`menu`}function ct(e){return JSON.stringify(e)}function lt(e){return rt(e)&&(0,r.isObject)(e.component)}function ut(e){return!!e.compact}function dt(e){return!!(e.inlined||e.components)}function S(e){return!!(e.nested||b(e)?.defaultNested===!0)}function ft(e,t){let{label:n}=e;return n!==!1&&(!!n||t&&b(e)?.generateLabel)}function pt(e){return!!b(e)?.omitSpacing}function mt(e){return e?.tabs?Object.values(e.tabs):[]}function ht(e){return e?.panels?Object.values(e.panels):[]}function C(e){return Ye(e)===`object`}function w(e){return Ye(e)===`list`}function gt(e){return!!Ye(e)&&!!e.resource}var{hasOwnProperty:_t}=Object.prototype,vt=new WeakMap;function yt(t){let n=(0,e.toRaw)(t),r=n,i;do{if(i=vt.get(r),i)break;r=Object.getPrototypeOf(r)}while(r);return i&&r!==n&&vt.set(r,i),i}function T(e,t,n){let i=yt(e),a=t in i?i[t]:void 0;return a!==void 0||_t.call(i,t)?a:(0,r.isFunction)(n)?n():n}function bt(e,t,n){yt(e)[t]=n}var E=class e{constructor(e,t){t=t?(0,r.isFunction)(t)?t():{...t}:{},t.nested??=!0,t.component=e;let n=Object.setPrototypeOf(t,e);vt.set(this,n)}static get(t,n){return n instanceof e?n:new e(t,n)}static createForSchema(t,{schema:n,name:r,nested:i=S(n),data:a,dataPath:o,rootData:s}){return new e(t,()=>({schema:n,name:r,nested:i,data:a,dataPath:o,rootData:s,get value(){return r==null?void 0:a?.[r]}}))}createChildContext(t,n){let r=S(t),i=!!this.schema&&S(this.schema);return e.createForSchema(this.component,{schema:t,name:n,nested:r,data:i?this.item?.[this.name]:this.item,dataPath:r?y(this.dataPath,n):this.dataPath,rootData:this.rootItem})}extend(e){return Object.setPrototypeOf(e,this)}get nested(){return T(this,`nested`,!0)}get schema(){return T(this,`schema`,null)}get value(){let e=yt(this);return`value`in e?e.value:this.nested?(0,r.getValueAtDataPath)(this.rootItem,this.dataPath,()=>void 0):void 0}get dataPath(){return T(this,`dataPath`,``)}get name(){return T(this,`name`,()=>Re(this.dataPath))}get index(){return T(this,`index`,()=>ze(this.dataPath))}get itemDataPath(){return Me(this.dataPath,this.nested)}get parentItemDataPath(){return Pe(this.dataPath,this.nested)}get itemIndex(){return ze(this.itemDataPath)}get parentItemIndex(){return ze(this.parentItemDataPath)}get item(){return T(this,`data`,()=>Fe(this.rootItem,this.dataPath,this.nested)||null)}get parentItem(){let e=Ie(this.rootItem,this.dataPath,this.nested)||null;return e===this.item?null:e}get rootItem(){return T(this,`rootData`,null)}get processedItem(){return T(this,`processedData`,null)}get processedRootItem(){return T(this,`processedRootData`,null)}get clipboardItem(){return T(this,`clipboardData`,null)}get user(){return T(this,`user`,null)}get api(){return T(this,`api`,null)}get views(){return T(this,`views`,null)}get flattenedViews(){return T(this,`flattenedViews`,null)}get itemLabel(){return T(this,`itemLabel`,null)}get formLabel(){return T(this,`formLabel`,null)}get component(){return T(this,`component`,null)}get schemaComponent(){return T(this,`schemaComponent`,null)}get formComponent(){return T(this,`formComponent`,null)}get viewComponent(){return T(this,`viewComponent`,null)}get dialogComponent(){return T(this,`dialogComponent`,null)}get panelComponent(){return T(this,`panelComponent`,null)}get resourceComponent(){return T(this,`resourceComponent`,null)}get sourceComponent(){return T(this,`sourceComponent`,null)}get option(){return T(this,`option`,void 0)}get options(){return T(this,`options`,void 0)}get open(){return T(this,`open`,void 0)}get searchTerm(){return T(this,`searchTerm`,void 0)}get error(){return T(this,`error`,void 0)}get wasNotified(){return T(this,`wasNotified`,!1)}get isRunning(){return T(this,`isRunning`,!1)}set isRunning(e){bt(this,`isRunning`,e)}get query(){return this.component.$route.query}get request(){return e=>this.component.request(e)}get format(){return(e,t)=>this.component.format(e,t)}get navigate(){return e=>this.component.navigate(e)}get download(){return e=>this.component.download(e)}get getResourceUrl(){return e=>this.component.getResourceUrl(e)}get notify(){return e=>{this.component.notify(e),bt(this,`wasNotified`,!0)}}},xt={data(){return{listeners:null}},methods:{on(e,t){if((0,r.isArray)(e))for(let n of e)this.on(n,t);else if((0,r.isPlainObject)(e))for(let t in e)this.on(t,e[t]);else{let n=this.listeners||=Object.create(null),{callbacks:r}=n[e]||={callbacks:[],queue:[]};r.push(t)}return this},once(e,t){let n=(...r)=>(this.off(e,n),t.apply(this,r));return n.callback=t,this.on(e,n)},off(e,t){if(!arguments.length)delete this.listeners;else if((0,r.isArray)(e))for(let n of e)this.off(n,t);else if((0,r.isPlainObject)(e))for(let t in e)this.off(t,e[t]);else{let n=this.listeners?.[e];if(n){if(!t)delete this.listeners[e];else{let{callbacks:e}=n,r=e.findIndex(e=>e===t||e.callback===t);r!==-1&&e.splice(r,1)}}}return this},emit(e,...t){let n=this.listeners?.[e];if(n){let{queue:r,callbacks:i}=n;return new Promise(n=>{let a=async()=>{let t=r.shift();if(t){let n,r=[];for(let e of i)try{let r=await e.apply(this,t.args);r!==void 0&&(n=r)}catch(e){r.push(e)}if(r.length>0){let n=AggregateError(r,`Errors during event handler for '${e}'`);t.resolve(Promise.reject(n))}else t.resolve(n);a()}};r.push({args:t,resolve:n}),r.length===1&&a()})}return Promise.resolve()},hasListeners(e){if((0,r.isArray)(e)){for(let t of e)if(!this.hasListeners(t))return!1;return e.length>0}return!!this.listeners?.[e]},delegate(e,t){if(t){if((0,r.isArray)(e))for(let n of e)this.delegate(n,t);else this.on(e,(...n)=>t.emit(e,...n))}return this}}},St=new WeakMap,Ct=0;function wt(t,n=null){let r=(0,e.toRaw)(t),i=St.get(r);return!i&&t&&(i=n?.(t)||`@${++Ct}`,St.set(r,i)),i}var Tt=class{graph={};references={};set(e,t,n){e=(0,r.parseDataPath)(e);let i=this.graph;for(let t of e){let e=(0,r.isInteger)(+t)?`*`:t;i=i[e]??={}}i.$settings={...n,...i.$settings,...t}}addSource(e,t){this.set(e,{type:`source`,schema:t},{related:!1})}setSourceRelated(e){this.set(e,{related:!0,reference:this.getReferencePrefix(e)})}addRelation(e,t,n){this.set(e,{type:`relation`,schema:n,internal:!!t,reference:this.getReferencePrefix(t)})}getReferencePrefix(e){return e?this.references[e]??=(0,a.nanoid)(6):null}flatten(){let e=t=>{let n=[];for(let[r,{$settings:i,...a}]of Object.entries(t)){i&&n.push([r,i]);for(let[t,i]of e(a))n.push([`${r}/${t}`,i])}return n};return e(this.graph)}process(e,t,{target:n}){let i=n===`clipboard`;i&&delete t[e.idKey||`id`];for(let[e,n]of this.flatten()){let{type:a,schema:o,internal:s,related:c,reference:l}=n,u=a===`source`,d=a===`relation`;if(u||d&&s){let n=(0,r.getValueAtDataPath)(t,e,()=>null),a=i&&u&&!c,f=i&&(d&&s||u&&c);for(let e of(0,r.asArray)(n).flat()){let t=u&&o.idKey||d&&o.relateBy||`id`,n=e?.[t];if(n!=null&&(a&&delete e[t],f||He(n))){He(n)&&(n=n.slice(1));let r=i?t:u?`#id`:`#ref`;e[r]=i?`@${n}`:l?`${l}-${n}`:n,r!==t&&delete e[t]}}}}return t}},Et={Boolean:r.isBoolean,Number:r.isNumber,String:r.isString,Date:r.isDate,Array:r.isArray,Object:r.isObject,RegExp:r.isRegExp,Function:r.isFunction},Dt={Boolean:e=>!!e,Number:e=>+e,String:e=>String(e),Date:e=>(0,r.isDate)(e)?e:new Date(e),Array:e=>(0,r.isArray)(e)?e:(0,r.isString)(e)?e.split(`,`):(0,r.asArray)(e),Object:e=>(0,r.isObject)(e)?e:e===!0?{}:null,RegExp:e=>(0,r.isRegExp)(e)?e:new RegExp(e)};function Ot(e,t){if(e&&t!=null){for(let n of e)if(Et[n.name]?.(t))return!0}return!1}function kt(e,t){let n=e&&Dt[e.name||e];return n?n(t):t}var At={},jt=new WeakMap;function D(e){return x(e)&&((0,r.isObject)(e.form||e.forms||e.components)||(0,r.isFunction)(e.components))}function Mt(e){return x(e)&&Object.keys(e?.forms||{}).length>1}function Nt(e,t){let{view:n}=e,r=n&&t.flattenedViews[n];return r&&Qe(r,D)||null}function Pt(e,t){return Nt(e,t)?t.flattenedViews[e.view]:null}function Ft(e,t){return!!Pt(e,t)}function It(e,t){let n=Pt(e,t);return n?lt(n)?n.fullPath:`${n.fullPath}/${n.path}`:null}function Lt(e,t,n){let r=It(e,n);return r?`${r}/${t}`:null}function O(e,t,n){let i=t&&Nt(e,t);if(i)e=i;else if(e.view)throw Error(`Unknown view: '${e.view}'`);let{form:a,forms:o}=e;if(!a&&!o){let{name:t,compact:n,clipboard:r,tabs:i,components:o}=e;if(o||i)a={type:`form`,name:t,compact:n,clipboard:r,tabs:i,components:o};else return{}}return o||={default:a},Object.fromEntries(Object.entries(o).map(([e,i])=>(t&&(0,r.isFunction)(i.components)&&(i=Rt(i,t)),[e,n?.(i)??i])))}function Rt(t,n){let{item:i}=n;if(!(0,r.isObject)(i))return zt(t,n);let a=jt.get(t.components);a||(a=new WeakMap,jt.set(t.components,a));let o=a.get(i);return o||(o=(0,e.computed)(()=>zt(t,n)),a.set(i,o)),o.value}function zt(t,n){let r=(0,e.reactive)({...t,components:t.components(n)});return Kn(n.api,r).catch(console.error),r}function Bt(e,t){return e[t?.type]||e.default||null}function Vt(e,t,n){return Bt(O(e,n),t)||At}function Ht(e){return e===At}function k(e,t){let n=(e,n)=>e.length>0?e.reduce((e,r)=>{let i=n(r);return i&&(e[i.name]=i&&t?{...t,...i}:i),e},{}):null;return(0,r.isArray)(e)?n(e,e=>(0,r.isObject)(e)?e:{name:(0,r.camelize)(e,!1)}):(0,r.isObject)(e)?n(Object.entries(e),([e,t])=>(0,r.isObject)(t)?{name:e,...t}:(0,r.isString)(t)?{name:e,label:t}:null):null}function Ut(e){return k(e,{type:`button`})}function Wt(e,t,n,r){return e?{schema:e,dataPath:t,componentPath:n,tabComponent:r}:null}function Gt(e,t,n,r=null,i=[]){if(e)for(let[a,o]of Object.entries(e)){let e=Wt(o,y(t,a),y(n,a),r);e&&i.push(e)}return i}function Kt(e,t,n,r,i,a=null,o=null){let s=b(t)?.getPanelSchema?.(e,t,n,a),c=s?[Wt(s,y(n,s.name),y(r,s.name),o)]:[];return Gt(t?.panels,n,i,o,c),c}function A(e,{type:t,schema:n,callback:i=!0,default:a,context:o}={}){let s=t&&(0,r.asArray)(t),c=n?(0,r.isArray)(e)?(0,r.getValueAtDataPath)(n,e,()=>void 0):n[e]:void 0;if(c===void 0&&a!==void 0)return i&&(0,r.isFunction)(a)&&!Ot(s,a)&&(a=a(o)),a;if(Ot(s,c))return c;if(i&&(0,r.isFunction)(c)&&(c=c(o)),s&&c!=null&&!Ot(s,c))for(let e of s){let t=kt(e,c);if(t!==c)return t}return c}function j(e,t){return A(`if`,{type:Boolean,schema:e,context:t,default:!0})&&(!et(e)||!!Ye(e)||$e(e,(e,n)=>j(e,t.createChildContext(e,n))))}function M(e){return(0,r.isFunction)(e)?e():e}function qt(e,t){let n=e.default===void 0?b(e)?.defaultValue:e.default;return(0,r.isFunction)(n)?n(M(t)):(0,r.clone)(n)}function Jt(e,t,n,r){let i=qt(e,r);i!==void 0&&(t[n]=i)}function Yt(e,t){let n=e.exclude===void 0?b(e)?.excludeValue:e.exclude;return(0,r.isFunction)(n)?n(M(t)):!!n}function Xt(e,t){return!!b(e)?.ignoreMissingValue?.(M(t))}function Zt(e,t,n,r){return!(n in t)||!!b(e)?.treatNullAsMissing?.(M(r))&&t[n]===null}function Qt(e){return!!b(e)?.valueFromDataSchema&&!!(e.data||e.dataPath)}function $t(e){return e.multiple??!!b(e)?.defaultMultiple}function en(e,t,n,r,{shouldSetDefaultsOfComponentsWithCompute:i=!0}={}){return(i||!e.compute)&&Zt(e,t,n,r)&&!Xt(e,r)}function tn(e,t={},n,{dataPath:i=null,rootData:a=t,shouldProcess:o,shouldSkipSourcesWithResource:s=!1,shouldSetDefaultsOfComponentsWithCompute:c=!0}={}){return N(e,t,{dataPath:i,before:({schema:e,data:t,name:i,dataPath:o})=>{let s=()=>new E(n,{schema:e,name:i,data:t,dataPath:o,rootData:a});en(e,t,i,s,{shouldSetDefaultsOfComponentsWithCompute:c})&&Jt(e,t,i,s),ln(e)&&(0,r.isArray)(t[i])&&un(e,t[i])},shouldProcess:o,shouldSkipSourcesWithResource:s,options:{component:n,rootData:a}})}function nn(e,t,n,r,{component:i=null,rootData:a=i?.rootData,getOptions:o=null}={}){let s=()=>new E(i,()=>{let i={schema:e,get value(){return t[n]},name:n,data:t,dataPath:r,rootData:a};return o&&Object.defineProperty(i,"options",{get:o,enumerable:!0}),i}),{compute:c}=e;if(c&&A(`if`,{type:Boolean,schema:e,context:M(s),default:!0})){let e=c(M(s));if(e!==void 0)return e}return rn(e,t,n,s)}function rn(e,t,n,r){return Zt(e,t,n,r)&&!Xt(e,r)?qt(e,r):t[n]}function an(e,t,n){if(n.schemaOnly){let n={},{idKey:r=`id`,orderKey:i}=e,a=t[r];return a!==void 0&&(n[r]=a),Mt(e)&&(n.type=t.type),i&&(n[i]=t[i]),n}return{...t}}function on(e,t,n,i,{component:a,rootData:o,schemaOnly:s,target:c,shouldCallProcess:l=!0}={}){let u={component:a,rootData:o,schemaOnly:s,target:c},d=an(t,n,u),f=new Tt;return N(e,n,{dataPath:i,processedData:d,before:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let s=rn(e,t,n,()=>E.createForSchema(a,{schema:e,name:n,data:t,dataPath:i,rootData:u.rootData}));if((0,r.isArray)(s)){let{wrapPrimitives:t}=e;s=t?s.map(e=>({[t]:e})):[...s]}o[n]=s},after:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let{wrapPrimitives:s,process:c}=e,d=o[n],p=()=>new E(a,{schema:e,value:d,name:n,data:t,dataPath:i,rootData:u.rootData,processedData:o});s&&(0,r.isArray)(d)&&(d=d.map(e=>e[s]));let m=b(e)?.processValue;m&&(d=m(M(p),f)),c&&l&&(d=c(M(p))),(!c||l)&&Yt(e,p)?delete o[n]:o[n]=d},options:u}),f.process(t,d,u)}function N(e,t,{dataPath:n=null,componentPath:i=``,processedData:a=null,wrappedPrimitiveName:o=null,before:s=null,after:c=null,shouldProcess:l=()=>!0,shouldSkipSourcesWithResource:u=!1,options:d}){let f={before:s,after:c,shouldProcess:l,shouldSkipSourcesWithResource:u,options:d},p=(e,t)=>e==null?null:y(e,t),m=(e,i)=>{if(e)for(let[m,g]of Object.entries(e)){let e=S(g),ee=e&&m!==o?p(n,m):n,_={schema:g,data:t,name:m,dataPath:ee,componentPath:y(i,m),processedData:a};if(l(_)){if(u&&gt(g)){h(g.panels,_.componentPath);continue}if(!ot(g)){if(!e)N(g,t,{...f,dataPath:n,componentPath:_.componentPath,processedData:a});else{let{wrapPrimitives:e}=g,n=(n,i=null)=>{e&&!(0,r.isObject)(n)&&(n={[e]:n});let o=i===null?ee:p(ee,i),s=i===null?_.componentPath:y(_.componentPath,i),c=new E(d.component,{schema:g,data:t,dataPath:ee,name:m,rootData:d.rootData}),l=Bt((b(g)?.getFormSchemasForProcessing||O)(g,c),n);if(l){let t=a?an(g,n,d):null;return N(l,n,{...f,dataPath:o,componentPath:s,processedData:t,wrappedPrimitiveName:e??null})}return{...n}};if(s?.(_),D(g)){let e=a?a[m]:t[m];e!=null&&(e=(0,r.isArray)(e)?a?e.map(n):e.forEach(n):n(e),a&&(a[m]=e))}c?.(_),h(g.panels,_.componentPath)}}}}},h=(e,r)=>{for(let[i,o]of Object.entries(e||{})){let e={schema:o,data:t,name:null,dataPath:n,componentPath:y(r,i),processedData:a};l(e)&&!ot(o)&&m(o.components,e.componentPath)}};return m((0,r.isFunction)(e.components)?Vt(e,t,new E(d.component,{schema:e,data:t,dataPath:n,rootData:d.rootData})).components:e.components,i),h(e.tabs,i),h(e.panels,i),a||t}function sn(e,t,n,{componentPath:r=``,component:i=null,rootData:a=t}={}){let o={dataPath:``,componentPath:r};t&&N(e,t,{dataPath:``,componentPath:r,shouldProcess:e=>Oe(n,e.dataPath)!==null,before:e=>{e.dataPath.length>o.dataPath.length&&(o=e)},options:{component:i,rootData:a}});let s=Oe(n,o.dataPath);return s?y(o.componentPath,s):o.componentPath}function cn(e,t){let n=t[e.idKey||`id`];return n==null?void 0:String(n)}function ln(e){return!!e.orderKey&&!e.wrapPrimitives}function un(e,t,n){let{orderKey:r}=e;if(r){let e=n?.[0]||0;for(let n=0;n<t.length;n++)t[n][r]=n+e}return t}function dn(e,t){return wt(t,t=>cn(e,t))}var fn={computed:{value:{get(){let e=rn(this.schema,this.data,this.name,()=>E.createForSchema(this,{schema:this.schema,name:this.name,data:this.data,dataPath:this.dataPath,rootData:this.rootData})),{format:t}=this.schema;return(0,r.isFunction)(t)?t(new E(this,{value:e})):e},set(e){let{parse:t}=this.schema;t&&(e=t(new E(this,{value:e}))),this.parsedValue=e,this.data[this.name]=e}}}},P={computed:{context(){return new E(this,{nested:this.nested})},parentData(){let e=Ie(this.rootData,this.dataPath,this.nested);return e===this.data?null:e},processedData(){return pn(this,this.dataPath,this.nested)},processedRootData(){return pn(this,``,!1)},item(){return this.data},parentItem(){return this.parentData},rootItem(){return this.rootData},processedItem(){return this.processedData},processedRootItem(){return this.processedRootData}}};function pn(e,t,n=!1){let{schemaComponent:r}=e;for(;r.dataPath.length>t.length;)r=r.parentSchemaComponent;return Fe(r.processedData,t.slice(r.dataPath.length),n)}var mn={validate:e=>(0,r.isCreditCard)(e),message:`is invalid`},hn={validate:(e,t)=>{let n=t===`*`?`+`:`{1,${t}}`;return RegExp(`^[-+]?\\d*(\\.\\d${n})?$`).test(e)},message:(e,t)=>`must be numeric and may contain ${!t||t===`*`?``:t} decimal points`},gn={validate:e=>(0,r.isEmail)(e),message:`must be a valid email`},_n={validate:e=>(0,r.isHostname)(e),message:`is not a host name`},vn={validate:e=>(0,r.isDomain)(e),message:`is not a domain`},yn={validate:e=>(0,r.isInteger)(e),message:`must be whole number`},bn={validate:(e,t)=>e<=t,message(e,t){return`must be ${t} or less`}},xn={validate:(e,t)=>e>=t,message(e,t){return`must be ${t} or more`}},Sn={validate:()=>!0},Cn={validate:(e,[t,n])=>e>=t&&e<=n,message(e,[t,n]){return`must be between ${t} and ${n}`}},wn={validate:(e,t,{password:n})=>e!=null&&e!==``||n&&e===void 0,message:`is required`},Tn={validate:e=>(0,r.isUrl)(e),message:`is not a valid URL`},En=we({creditcard:()=>mn,decimals:()=>hn,domain:()=>vn,email:()=>gn,hostname:()=>_n,integer:()=>yn,max:()=>bn,min:()=>xn,password:()=>Sn,range:()=>Cn,required:()=>wn,url:()=>Tn});function Dn(e,t){let n={...b(e)?.getTypeValidations?.(e,t)};A(`required`,{type:Boolean,schema:e,context:t})&&(n.required=!0);for(let[t,r]of Object.entries(e.rules||{}))r===void 0?delete n[t]:n[t]=r;return n}function On(e,t){let n=[];for(let[i,a]of Object.entries(t)){let o=En[i];if(o&&(i===`required`||e!=null&&e!==``)){let{validate:i,message:s}=o;i(e,a,t)||n.push({message:(0,r.isFunction)(s)?s(e,a,t):s})}}return n}function kn(e,t,{dataPath:n=``,component:i=null,rootData:a=t}={}){let o=null,s=({schema:e,data:t,name:n,dataPath:r})=>new E(i,{schema:e,value:n==null?void 0:t[n],name:n,data:t,dataPath:r,rootData:a});return N(e,t,{dataPath:n,shouldProcess:e=>j(e.schema,s(e)),shouldSkipSourcesWithResource:!0,before:e=>{let{schema:t,data:n,name:i,dataPath:a}=e,c=s(e),l=n[i],{format:u}=t;(0,r.isFunction)(u)&&(l=u(c));let d=Dn(t,c),f=On(l,d);f.length>0&&(o||={},o[a]=f)},options:{component:i,rootData:a}}),o}function An(e,t){let n;if((0,r.isFunction)(t))n=t;else if((0,r.isRegExp)(t))n=e=>t.test(e);else{let e=(0,r.asArray)(t).map(r.normalizeDataPath);n=t=>e.includes(t)}let i=Object.entries(e||{}).filter(([e])=>n(e));return i.length>0?Object.fromEntries(i):null}var jn={emits:[`errors`],data(){return{isTouched:!1,isDirty:!1,isValidated:!1,isValid:!1,errors:null,valueWithErrors:void 0}},computed:{hasErrors(){return!!this.errors}},methods:{resetValidation(){this.isTouched=!1,this.isDirty=!1,this.isValidated=!1,this.isValid=!1,this.clearErrors()},validate(e=!0){let t=On(this.value,this.validations),n=t.length===0;if(e){this.clearErrors();for(let{message:e}of t)this.addError(e,!0);this.isValidated=!0,this.isValid=n}return n},verify(){return this.validate(!1)},markTouched(){this.isTouched=!0,this.clearErrors()},markDirty(){this.isDirty=!0,this.isValidated=!1,this.isValid=!1,this.clearErrors()},addError(e,t=!1){this.errors||=[],this.valueWithErrors=this.value,t&&(e=`The ${this.label||this.placeholder||this.name} field ${e}.`),this.errors.push(e),this.$emit(`errors`,this.errors)},showValidationErrors(e,t){if(this.errors=[],e.length===0)return!1;for(let{message:t}of e)this.addError(t,!0);return t&&this.scrollIntoView(),!0},getErrors(){return this.errors?[...this.errors]:null},clearErrors(){this.errors=null,this.$emit(`errors`,this.errors)}}};function F(e,{type:t,default:n,get:i,set:a,callback:o=!0}={}){(0,r.isString)(e)&&e.includes(`.`)&&(e=(0,r.parseDataPath)(e));let s=(0,r.normalizeDataPath)(e);return{get(){let r=!i||i.length>0?this.overrides&&s in this.overrides?this.overrides[s]:this.getSchemaValue(e,{type:t,default:n,callback:o}):void 0;return i?i.call(this,r):r},set(e){a?a.call(this,e):(this.overrides||={},this.overrides[s]=e)}}}function Mn(e,{default:t,get:n,set:i}={}){return{get(){let i=this.getStore(e);return i===void 0&&t!==void 0&&(i=(0,r.isFunction)(t)?t.call(this):t,this[e]=i,this.getStore(e)),n?n.call(this,i):i},set(t){(!i||(t=i.call(this,t))!==void 0)&&this.setStore(e,t)}}}var Nn={mixins:[fn,P,jn],emits:[`update:component`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},width:{type:[Number,String],default:null},label:{type:String,default:null},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},accumulatedBasis:{type:Number,default:null}},data(){return{parsedValue:void 0,focused:!1}},computed:{name(){return this.schema.name},type(){return this.schema.type},labelNode(){let e=this.isMounted?this.$el.previousElementSibling:null;return e?.matches(`.dito-label`)?e:null},visible:F(`visible`,{type:Boolean,default(){return this.$options.defaultVisible}}),exclude:F(`exclude`,{type:Boolean,default:!1}),required:F(`required`,{type:Boolean,default:!1}),readonly:F(`readonly`,{type:Boolean,default:!1}),autofocus:F(`autofocus`,{type:Boolean,default:!1}),clearable:F(`clearable`,{type:Boolean,default:!1,get(e){return e&&!this.readonly}}),disabled:F(`disabled`,{type:Boolean,default:!1}),maxLength:F(`maxLength`,{type:Number}),placeholder:F(`placeholder`,{type:String}),autocomplete:F(`autocomplete`,{type:String}),info:F(`info`,{type:String,default:null}),inlineInfo(){return this.label?null:this.info},events(){let e=this.getEvents();for(let t of Object.keys(this.schema.events||{}))e[`on${(0,r.camelize)(t,!0)}`]??=()=>{this.emitEvent(t)};return e},attributes(){let{nativeField:e,textField:t}=this.$options,n={...this.events,disabled:this.disabled||this.readonly&&!t};return e&&(n.name=this.dataPath,this.label&&(n.title=this.label),n.readonly=this.readonly,n.autofocus=this.autofocus,t&&(n.maxlength=this.maxLength,n.placeholder=this.placeholder,n.autocomplete=this.autocomplete)),n},validations(){return Dn(this.schema,this.context)},showClearButton(){return this.clearable&&this.value!=null}},watch:{value(e){this.hasErrors&&!(0,r.equals)(e,this.valueWithErrors)&&this.clearErrors()},componentPath(e,t){this._registerWithSchemaComponent(!1,t),this._registerWithSchemaComponent(!0,e)}},created(){this._register(!0),this.setupSchemaFields(),this.warnAboutUncomputedValue()},unmounted(){this._register(!1)},methods:{warnAboutUncomputedValue(){this.schema.compute&&!this.dataModel.hasComputedValueEntry(this.componentPath)&&console.warn(`The value of the component at '${this.componentPath}' isn't computed, as its data isn't part of a data model.`)},_register(e){this.$emit(`update:component`,e?this:null),this._registerWithSchemaComponent(e,this.componentPath)},_registerWithSchemaComponent(e,t){this.nested?this.schemaComponent._registerComponent(this,e,t):this.schemaComponent?._registerUnnestedComponent(this,e,t)},getEvents(){let{onFocus:e,onBlur:t,onInput:n,onChange:r}=this;return{onFocus:e,onBlur:t,onInput:n,onChange:r}},async scrollIntoView(){await this.focusSchema(),this.getFocusElement()?.scrollIntoView?.({behavior:`smooth`,block:`center`})},focusElement(){this.getFocusElement()?.focus?.()},blurElement(){this.getFocusElement()?.blur?.()},getFocusElement(){let e=(0,r.asArray)(this.$refs.element)[0]??this;return e.$el??e},async focusSchema(){await this.schemaComponent.focus(),await this.tabComponent?.focus()},async focus(){await this.focusSchema(),this.scrollIntoView(),this.focusElement()},blur(){this.blurElement()},clear(){this.value=null,this.blur(),this.onChange()},onFocus(){this.focused=!0,this.markTouched(),this.emitEvent(`focus`)},onBlur(){this.focused=!1,this.validate(),this.emitEvent(`blur`)},onInput(){this.markDirty(),this.emitEvent(`input`)},onChange(){this.markDirty(),this.emitEvent(`change`,{context:{value:this.parsedValue===void 0?this.value:this.parsedValue},parent:this.schemaComponent})}}},Pn=new WeakMap;async function I(e,t=!1){if(Pn.has(e))return Pn.get(e);let n=e;if((0,r.isFunction)(n)&&(n=n()),(0,r.isPromise)(n)&&(n=await n),(0,r.isModule)(n)&&(n={...n},!n.name&&(t||n.default))){let e=Object.keys(n).filter(e=>e!==`_rerender_only`);if(e.length===1){let t=e[0];n=n[t],t!=="default"&&(n={...n,name:t})}}return Pn.set(e,n),n}async function Fn(e,t=I){let n=(0,r.isFunction)(e)?e():e;return n=await I(n,!1),(0,r.isArray)(n)?n=Object.fromEntries(await(0,r.mapConcurrently)(n,async e=>{let n=await t(e,!0);return[n.name,n]})):(0,r.isObject)(n)&&(n=Object.fromEntries(await(0,r.mapConcurrently)(Object.entries(n),async([e,n])=>[e,await t(n,!0)]))),n}async function In(e){return Fn(e,async(e,t)=>(e=await I(e,t),!e.name&&st(e)&&(e={...e,name:(0,r.camelize)(e.label),items:await Fn(e.items)}),e))}function Ln(e){return Object.fromEntries(Object.entries(e).reduce((e,[t,n])=>(st(n)?e.push(...Object.entries(n.items)):e.push([t,n]),e),[]))}async function Rn(t){let{component:n}=t;n&&(n=await I(n,!0),n&&(t.component=(0,e.markRaw)({...n,mixins:[Qn,Nn,...n.mixins||[]]})))}async function zn(e){await(0,r.mapConcurrently)(Object.values(e||{}),Rn)}var Bn=new WeakMap;function L(e,t,n=null,r=0,i=1){if(t){let a=Bn.get(t)??0;if(a<i){Bn.set(t,a+1);let i=[],o=(t,a,o)=>{i.push(Vn(e,t,a,n,r+o))};return Ze(t,o),Xe(ht(t),o),Promise.all(i)}}}function Vn(e,t,n,i=null,a=0){return R(e,t),Promise.all([(0,r.mapConcurrently)(ht(t),t=>L(e,t,i,a)),b(t)?.processSchema?.(e,t,n,i,a)])}async function Hn(e,t,n,r,i=``){R(t,n),Wn(t,n,r,i);let a=[];if(rt(n))await Yn(t,n),await L(t,n,a);else if(st(n))a=await Promise.all(Object.entries(n.items).map(async([r,i])=>Hn(e,t,i,r,n.fullPath)));else throw Error(`Invalid view schema: '${ct(n)}'`);return{path:n.fullPath,children:a,component:e,meta:{api:t,schema:n}}}function R(e,t){let n=e.defaults[t.type]||e.defaults[(0,r.camelize)(t.type)];if(n&&((0,r.isFunction)(n)&&(n=n(t)),(0,r.isObject)(n)))for(let[e,i]of Object.entries(n))t[e]=t[e]===void 0?i:(0,r.assignDeeply)(t[e],i)}function Un(e,t){Ze(t,t=>{R(e,t);let n=O(t);for(let t of Object.values(n))Un(e,t)})}function Wn(e,t,n,r=null){t.name??=n,t.path??=e.normalizePath(n),r!==null&&(t.fullPath=`${r}/${t.path}`)}async function Gn(e,t,n){let i=[],{form:a,forms:o,components:s,maxDepth:c=1}=t;return o?t.forms=await Fn(o,t=>Kn(e,t,i,n,c)):a?t.form=await Kn(e,a,i,n,c):(0,r.isObject)(s)&&await Kn(e,{type:`form`,components:s},i,n,c),i}async function Kn(e,t,n=null,r=0,i=1){if(t=await I(t,!0),!nt(t))throw Error(`Invalid form schema: '${ct(t)}'`);return R(e,t),await Yn(e,t),await L(e,t,n,r,i),t}async function qn(e,t){if(t=await I(t,!0),!it(t))throw Error(`Invalid tab schema: '${ct(t)}'`);return R(e,t),t}async function Jn(e,t){if(t=await I(t,!0),!at(t))throw Error(`Invalid panel schema: '${ct(t)}'`);return R(e,t),t}async function Yn(e,t){let{tabs:n,panels:r}=t;n&&(t.tabs=await Fn(n,t=>qn(e,t))),r&&(t.panels=await Fn(r,t=>Jn(e,t)))}function Xn(e){return!!z(e.resource)}function z(e,t={}){let{parent:n,...i}=t;return(0,r.isFunction)(e)&&(e=e(t)),e=(0,r.isObject)(e)?{...i,...e}:(0,r.isString)(e)?{...i,path:e}:null,e&&n!==void 0&&e.parent===void 0&&!e.path?.startsWith(`/`)&&(e.parent=n,e.path||(e.path=`.`)),e}function Zn(e,t){return e!=null&&t?.type===`collection`?{type:`member`,...(0,r.pickBy)(t,(e,t)=>[`method`,`path`,`parent`].includes(t)),id:`${e}`}:null}var Qn={mixins:[xt],inject:[`api`,`$verbs`,`$views`,`$isPopulated`,`$parentComponent`,`$schemaComponent`,`$routeComponent`,`$dataComponent`,`$sourceComponent`,`$resourceComponent`,`$dialogComponent`,`$dataModel`,`$panelComponent`,`$tabComponent`],provide(){let e=()=>this;return{$parentComponent:e,...this.providesData&&{$dataComponent:e},$dataModel:()=>this.dataModel}},data(){return{appState:De,isMounted:!1,overrides:null,ownDataModel:null}},computed:{dataModel(){return this.ownDataModel??this.$dataModel()},providesData(){return!1},sourceSchema(){return this.meta?.schema},user(){return De.user},verbs(){return this.$verbs()},views(){return this.$views()},flattenedViews(){return Ln(this.views)},isPopulated(){return this.$isPopulated()},locale(){return this.api.locale},context(){return new E(this,{nested:!1})},rootComponent(){return this.$root.$refs.root},componentPath(){return this.continueParentComponentPath()},dataPathForComponentPath(){return this.dataPath??this.parentComponent?.dataPathForComponentPath},parentComponent(){return this.$parentComponent()},schemaComponent(){return this.$schemaComponent()},routeComponent(){return this.$routeComponent()},formComponent(){let e=this.routeComponent;return e?.isForm?e:null},viewComponent(){let e=this.routeComponent;return e?.isView?e:null},dataComponent(){return this.providesData?this:this.$dataComponent()},sourceComponent(){return this.$sourceComponent()},resourceComponent(){return this.$resourceComponent()},dialogComponent(){return this.$dialogComponent()},panelComponent(){return this.$panelComponent()},tabComponent(){return this.$tabComponent()},parentSchemaComponent(){return er(this,`schemaComponent`)},parentRouteComponent(){return er(this,`routeComponent`)},parentFormComponent(){return er(this,`formComponent`)},parentResourceComponent(){return er(this,`resourceComponent`)},rootData(){return this.dataComponent?.data}},mounted(){this.isMounted=!0},beforeCreate(){let e=$n++;Object.defineProperty(this,"$uid",{get:()=>e})},methods:{labelize:r.labelize,getStore(e){return this.store[e]},setStore(e,t){return this.store[e]=t,t},removeStore(e){delete this.store[e]},getStoreKeyByIndex(e){return this.store.$keysByIndex?.[e]},setStoreKeyByIndex(e,t){this.store.$keysByIndex??={},this.store.$keysByIndex[e]=t},getChildStore(t,n){let r=this.getStore(t);if(!r&&n!=null){let e=this.getStoreKeyByIndex(n);r=this.getStore(e),r&&(this.setStore(t,r),this.removeStore(e))}return r||=this.setStore(t,(0,e.reactive)({})),n!=null&&this.setStoreKeyByIndex(n,t),r},removeChildStore(e,t){this.getChildStore(e,t),this.removeStore(e)},getSchemaValue(e,{type:t,default:n,schema:i=this.schema,context:a=this.context,callback:o=!0}={}){return A(e,{type:t,schema:i,context:a,callback:o,default:(0,r.isFunction)(n)?()=>n.call(this):n})},getLabel(e,t){return e?this.getSchemaValue(`label`,{schema:e,type:[String,Object]})||(0,r.labelize)(t||e.name):(0,r.labelize)(t)||``},getButtonAttributes(e,t=null,n=null){let i=n?null:`${(0,r.labelize)(e)}${t?` ${t}`:``}`;return{class:`dito-button--${e}`,...i&&{title:i,"aria-label":i}}},getQueryLink(e){return{query:e,hash:this.$route.hash}},shouldRenderSchema(e=null){return j(e,this.context)},shouldShowSchema(e=null){return this.getSchemaValue(`visible`,{type:Boolean,default:!0,schema:e})},shouldDisableSchema(e=null){return this.getSchemaValue(`disabled`,{type:Boolean,default:!1,schema:e})},getResourcePath(e){return e=z(e,{parent:this.dataComponent?.getResource({method:e?.method,child:e})??null}),this.api.resources.any(e)},getResourceUrl(e){let t=this.getResourcePath(e);return t?this.api.getApiUrl({url:t,query:e.query}):null},async sendRequest({method:e,url:t,resource:n,query:i,data:a,signal:o,internal:s}){t||=this.getResourceUrl(n),e||=n?.method;let c=!s&&this.api.isApiUrl(t);c&&await this.rootComponent.ensureUser();let l=await this.api.request({method:e,url:t,query:i,data:a,signal:o});return c&&e===`patch`&&(0,r.equals)(n,Zn(this.user.id,this.api.users))&&await this.rootComponent.fetchUser(),l},showDialog({components:e,buttons:t,data:n,settings:r}){return this.rootComponent.showDialog({components:e,buttons:t,data:n,settings:r})},request({cache:e,...t}){let n=(e&&{global:this.appState,local:this.dataComponent}[e])?.loadCache,r=n&&`${t.method||`get`} ${t.url} ${JSON.stringify(t.query||``)} ${JSON.stringify(t.data||``)}`;if(n&&r in n)return n[r];let i=this.sendRequest(t).then(e=>e.data).catch(e=>{let t=e.response?.data;throw t?Object.assign(Error(t.message),t):e});return n&&(n[r]=i),i},format(e,{locale:t=this.api.locale,defaults:n=this.api.formats,...i}={}){return(0,r.format)(e,{locale:t,defaults:n,...i})},async navigate(e){return this.$router.push(e)},download(e={}){(0,r.isString)(e)&&(e={url:e});let t=document.createElement(`a`);t.href=e.url?.startsWith(`blob:`)?e.url:this.api.getApiUrl(e),t.download=e.filename??null;let{body:n}=document;n.appendChild(t),t.click(),n.removeChild(t)},continueParentComponentPath(){let{parentComponent:e}=this,t=e?.componentPath??``,n=Oe(this.dataPath,e?.dataPathForComponentPath);return n?y(t,n):t},notify(e){this.rootComponent.notify(e)},closeNotifications(){this.rootComponent.closeNotifications()},setupSchemaFields(){this.setupMethods(),this.setupComputed(),this.setupEvents()},setupMethods(){for(let[e,t]of Object.entries(this.schema.methods||{}))(0,r.isFunction)(t)?this[e]=t:console.error(`Invalid method definition: ${e}: ${t}`)},setupComputed(){let t=({get:t,set:n})=>{let r=(0,e.computed)(()=>t.call(this));return{get:()=>r.value,set:n?e=>n.call(this,e):void 0}};for(let[e,n]of Object.entries(this.schema.computed||{})){let i=(0,r.isFunction)(n)?t({get:n}):(0,r.isObject)(n)&&(0,r.isFunction)(n.get)?t(n):null;i?Object.defineProperty(this,e,i):console.error(`Invalid computed property definition: ${e}: ${n}`)}},setupEvents(){let{watch:e,events:t}=this.schema;if(e){let t=(0,r.isFunction)(e)?e.call(this):e;(0,r.isObject)(t)&&this.$nextTick(()=>{for(let[e,n]of Object.entries(t)){let t=this.schemaComponent.getComponentByName(e)?`data.${e}`:e;this.$watch(t,n)}})}let n=(e,t,n)=>{(0,r.isFunction)(n)?this.on((0,r.hyphenate)(t),n):console.error(`Invalid event definition: ${e}: ${n}`)};if(t)for(let[e,r]of Object.entries(t))n(e,e,r);for(let[e,t]of Object.entries(this.schema))/^on[A-Z]/.test(e)&&n(e,e.slice(2),t)},emitEvent(e,{context:t=null,parent:n=null}={}){let r=this.hasListeners(e),i=n?.hasListeners(e);if(r||i){let a=n=>n.emit(e,t=E.get(this,t)),o=e=>i&&e!==!1?a(n).then(()=>e):e,s=()=>r?a(this).then(o):o(void 0);return[`load`,`change`].includes(e)?this.waitUntilDataModelSettled().then(s):s()}},async waitUntilDataModelSettled(){await this.$nextTick();let{dataModel:e}=this;if(e?.hasPendingLoads){this.rootComponent.registerLoading(!0);try{await e.waitUntilSettled()}finally{this.rootComponent.registerLoading(!1)}}},emitSchemaEvent(e,t){return this.schemaComponent.emitEvent(e,t)}}},$n=0;function er(e,t){let n=e[t],r=e.parentComponent;for(;r&&r[t]===n;)r=r.parentComponent;return r?.[t]??null}function tr(e){let{mixins:t}=e;return t||e.extends?nr({...e},e):e}function nr(e,t){if(t.extends&&nr(e,t.extends),t.mixins)for(let n of t.mixins)nr(e,n);for(let n of rr)n in t&&(e[n]=t[n]);return e}var rr=[`defaultValue`,`defaultNested`,`defaultVisible`,`generateLabel`,`excludeValue`,`ignoreMissingValue`,`treatNullAsMissing`,`valueFromDataSchema`,`omitSpacing`,`processValue`,`getTypeValidations`,`processSchema`,`getPanelSchema`,`getFormSchemasForProcessing`,`beforeRouteUpdate`,`beforeRouteLeave`],ir={},B={mixins:[Qn],components:ir,component(e,t){if(t&&((0,r.isPlainObject)(t)&&(t=tr({extends:this,name:e,...t})),ir[e]=t),!(e in ir))throw Error(`Component "${e}" not registered`);return ir[e]},methods:{getTypeComponent:qe}};function ar(t){return t&&(0,r.asArray)(t).some(t=>t.type!==e.Comment)}function or(t,n={}){return t=(0,r.isString)(t)?(0,e.useSlots)()[t]:t,ar(t?.(n))}var sr=[`type`,`title`,`disabled`],cr={key:0,class:`dito-button__prefix`},lr={key:1,class:`dito-button__text`},ur={key:2,class:`dito-button__suffix`};function dr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({class:[`dito-button`,[o.classes,{"dito-button--affixed":o.hasAffixes}]],type:r.type,title:r.title,disabled:r.disabled},o.attributes),[o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,cr,[(0,e.renderSlot)(t.$slots,`prefix`)])):(0,e.createCommentVNode)(``,!0),r.text||o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,lr,[(0,e.createTextVNode)((0,e.toDisplayString)(r.text||``),1),(0,e.renderSlot)(t.$slots,`default`)])):(0,e.createCommentVNode)(``,!0),o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ur,[(0,e.renderSlot)(t.$slots,`suffix`)])):(0,e.createCommentVNode)(``,!0)],16,sr)}var V=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},fr=V({inheritAttrs:!1,props:{type:{type:String,default:`button`},text:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1}},computed:{hasAffixes(){return or(this.$slots.prefix)||or(this.$slots.suffix)},classes(){return this.$attrs.class},attributes(){let{class:e,...t}=this.$attrs;return t}}},[[`render`,dr]]);function pr(e){return{year:e?.getFullYear()??0,month:e?.getMonth()??0,day:e?.getDate()??0,hour:e?.getHours()??0,minute:e?.getMinutes()??0,second:e?.getSeconds()??0,millisecond:e?.getMilliseconds()??0}}function mr(e,t={}){return new Date(...Object.values({...pr(e),...t}))}function hr(e,{locale:t=`en-US`,date:n=!0,time:r=!0}={}){let i=r?null:0,a=e?.match(/\s*\b([ap])\.?m\.?$/i);a&&(e=e.slice(0,a.index));let[o,s,c,l,u,,d=i,,f=i,,p=i,,m=i]=_r(e,{date:n,time:r});if(u&&u.length>=4){if((t===`en-US`&&s===`/`&&l===`/`||isNaN(+o)&&!isNaN(+c))&&([o,c]=[c,o]),a&&d!==null){let e=a[1].toLowerCase()===`p`;d=d%12+(e?12:0),d=String(d).padStart(2,`0`)}c=vr(c,{locale:t});let e=e=>e===null||e.length===2;if(c!==null&&(!r||e(d)&&e(f)&&e(p))){let e=new Date(+u,+c,+o,+d,+f,+p,+m);return e.getMonth()===+c&&e.getDate()===+o?e:null}}return null}function gr(e,t,{locale:n=`en-US`,date:r=!0,time:i=!0}={}){let a=_r(e,{date:r,time:i}),o=(e,t=a.length)=>{let n=0,r=0;for(;(e===null||n<=e)&&r<t;)n+=a[r++]?.length??0;return{position:n,index:r}},s=r?0:o(null,6).position;t+=s;let{index:c}=o(t),l=n===`en-US`,u=[l?`month`:`day`,null,l?`day`:`month`,null,`year`,null,`hour`,null,`minute`,null,`second`,null,`millisecond`];for(;c--;)if(u[c]){let e=o(null,c).position-s,t=e+a[c].length;return{name:u[c],start:e,end:t}}return null}function _r(e,{date:t=!0,time:n=!0}={}){let r=e?.split(/([\s.,:/]+)/)||[];return t||r.unshift(`1`,`.`,`1`,`.`,`2000`,` `),!n&&r.length>5&&(r.length=5),r}function vr(e,{locale:t=`en-US`}={}){let n=+e;if(!isNaN(n))return n-1;let r=e.trim().toLowerCase();if(r.length<3)return null;let i=new Intl.DateTimeFormat(t,{month:`short`}),a=new Intl.DateTimeFormat(t,{month:`long`});for(let e=0;e<12;e++){let t=new Date(2e3,e,1);if(i.format(t).toLowerCase().startsWith(r)||a.format(t).toLowerCase().startsWith(r))return e}return null}var yr={class:`dito-calendar`,role:`dialog`,"aria-label":`Choose date`},br={class:`dito-calendar-popup`},xr={class:`dito-calendar-inner`},Sr={class:`dito-calendar-header`},Cr={class:`dito-calendar-body`},wr={class:`dito-calendar-weekdays`},Tr={class:`dito-calendar-dates`,role:`grid`},Er=[`aria-label`,`aria-selected`,`aria-disabled`,`onClick`],Dr={class:`dito-calendar-footer`},Or=[`aria-label`,`title`],kr={class:`dito-calendar-header`},Ar={class:`dito-calendar-body`},jr={class:`dito-calendar-months`,role:`listbox`,"aria-label":`Month`},Mr=[`aria-label`,`aria-selected`,`onClick`],Nr={class:`dito-calendar-header`},Pr={class:`dito-calendar-body`},Fr={class:`dito-calendar-years`,role:`listbox`,"aria-label":`Year`},Ir=[`aria-label`,`aria-selected`,`onClick`];function Lr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,yr,[(0,e.createElementVNode)(`div`,br,[(0,e.createElementVNode)(`div`,xr,[a.currentMode===`day`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createElementVNode)(`div`,Sr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev dito-calendar-step-year`,role:`button`,tabindex:`0`,"aria-label":`Previous year`,onClick:n[0]||=e=>o.stepYear(-1)}),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev dito-calendar-step-month`,role:`button`,tabindex:`0`,"aria-label":`Previous month`,onClick:n[1]||=e=>o.stepMonth(-1)}),(0,e.createElementVNode)(`span`,null,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-year`,role:`button`,tabindex:`0`,"aria-label":`Switch to year selection`,onClick:n[2]||=e=>o.setMode(`year`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1),(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-month`,role:`button`,tabindex:`0`,"aria-label":`Switch to month selection`,onClick:n[3]||=e=>o.setMode(`month`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{month:!0})),1)]),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next dito-calendar-step-month`,role:`button`,tabindex:`0`,"aria-label":`Next month`,onClick:n[4]||=e=>o.stepMonth(1)}),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next dito-calendar-step-year`,role:`button`,tabindex:`0`,"aria-label":`Next year`,onClick:n[5]||=e=>o.stepYear(1)})]),(0,e.createElementVNode)(`div`,Cr,[(0,e.createElementVNode)(`div`,wr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.weekdayNames,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,null,(0,e.toDisplayString)(t.short),1))),256))]),(0,e.createElementVNode)(`div`,Tr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dateRange,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(t.state&&`dito-calendar-item-${t.state}`),role:`gridcell`,"aria-label":o.dateToString(t.date),"aria-selected":t.state===`active`,"aria-disabled":t.state===`disabled`,onClick:e=>t.state!==`disabled`&&o.selectDate(t.date)},(0,e.toDisplayString)(t.text),11,Er))),256))])]),(0,e.createElementVNode)(`div`,Dr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-now`,role:`button`,tabindex:`0`,"aria-label":`Select today (${o.dateToString(new Date)})`,title:o.dateToString(new Date),onClick:n[6]||=e=>o.selectDate(new Date)},null,8,Or)])],64)):a.currentMode===`month`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createElementVNode)(`div`,kr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev`,role:`button`,tabindex:`0`,"aria-label":`Previous year`,onClick:n[7]||=e=>o.stepYear(-1)}),(0,e.createElementVNode)(`span`,null,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-year`,role:`button`,tabindex:`0`,"aria-label":`Switch to year selection`,onClick:n[8]||=e=>o.setMode(`year`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1)]),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next`,role:`button`,tabindex:`0`,"aria-label":`Next year`,onClick:n[9]||=e=>o.stepYear(1)})]),(0,e.createElementVNode)(`div`,Ar,[(0,e.createElementVNode)(`div`,jr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.monthNames,(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(o.getMonthClass(n)),role:`option`,"aria-label":t.long,"aria-selected":o.getMonthClass(n)[`dito-calendar-item-active`],onClick:e=>o.selectMonth(n)},(0,e.toDisplayString)(t.short),11,Mr))),256))])])],64)):a.currentMode===`year`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createElementVNode)(`div`,Nr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev`,role:`button`,tabindex:`0`,"aria-label":`Previous decade`,onClick:n[10]||=e=>o.stepDecade(-1)}),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(o.decadeToString(a.currentValue)),1),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next`,role:`button`,tabindex:`0`,"aria-label":`Next decade`,onClick:n[11]||=e=>o.stepDecade(1)})]),(0,e.createElementVNode)(`div`,Pr,[(0,e.createElementVNode)(`div`,Fr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.yearRange,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(o.getYearClass(t)),role:`option`,"aria-label":String(t),"aria-selected":o.getYearClass(t)[`dito-calendar-item-active`],onClick:e=>o.selectYear(t)},(0,e.toDisplayString)(t),11,Ir))),256))])])],64)):(0,e.createCommentVNode)(``,!0)])])])}var Rr={emits:[`update:modelValue`,`select`],props:{modelValue:{type:Date,default:null},locale:{type:String,default:`en-US`},disabledDate:{type:Function,default:()=>!1},mode:{type:String,default:`day`}},data(){let{weekdayNames:e,monthNames:t}=Br(this.locale);return{weekdayNames:e,monthNames:t,dateRange:[],yearRange:[],currentValue:this.modelValue||mr(new Date,{hour:0,minute:0,second:0,millisecond:0}),currentMode:this.mode}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e||new Date,this.updateDateRange())},currentValue(e,t){+e!=+t&&this.updateDateRange()},disabledDate:`updateDateRange`,mode(e){this.currentMode=e}},mounted(){this.updateDateRange()},methods:{getMonthClass(e){return{"dito-calendar-item-active":this.modelValue&&e===this.modelValue.getMonth()&&this.currentValue.getFullYear()===this.modelValue.getFullYear(),"dito-calendar-item-current":e===this.currentValue.getMonth()}},getYearClass(e){return{"dito-calendar-item-active":this.modelValue&&e===this.modelValue.getFullYear(),"dito-calendar-item-current":e===this.currentValue.getFullYear()}},setDate(e,t=!1){this.currentValue=mr(this.currentValue,e),t&&this.$emit(`update:modelValue`,this.currentValue)},stepDecade(e){this.setDate({year:this.currentValue.getFullYear()+e*10})},setMode(e){this.currentMode=e},stepMonth(e){let{currentValue:t}=this,{year:n,month:r}=this.getYearMonth(t.getFullYear(),t.getMonth()+e);this.setDate({month:r,day:Math.min(this.getDaysInMonth(n,r),this.currentValue.getDate())})},stepYear(e){this.setDate({year:this.currentValue.getFullYear()+e})},selectDate(e){this.setDate(pr(e),!0),this.$emit(`select`)},selectMonth(e){this.setMode(`day`),this.setDate({month:e,day:1},!0)},selectYear(e){this.setMode(`month`),this.setDate({year:e},!0)},getYearMonth(e,t){return t>11?(e++,t=0):t<0&&(e--,t=11),{year:e,month:t}},dateToString(e,{year:t,month:n,day:r}={year:!0,month:!0,day:!0}){return e.toLocaleString(this.locale,{year:t&&`numeric`,month:n&&`long`,day:r&&`numeric`})},decadeToString(e){let t=this.getFirstYearOfDecade(e.getFullYear());return`${t} – ${t+9}`},getDaysInMonth(e,t){return new Date(e,t+1,0).getDate()},getFirstYearOfDecade(e){return+`${e.toString().slice(0,-1)}0`},navigate({step:e,enter:t,mode:n=this.currentMode,update:r=!1}){let{currentValue:i}=this;if(e){switch(n){case`day`:this.setDate({day:i.getDate()+e},r);break;case`month`:this.setDate({month:i.getMonth()+e},r);break;case`year`:this.setDate({year:i.getFullYear()+e},r)}return!0}if(t){switch(this.currentMode){case`day`:this.selectDate(i);break;case`month`:this.setMode(`day`);break;case`year`:this.setMode(`month`)}return!0}},updateDateRange(){this.dateRange=[],this.yearRange=[];let{currentValue:e}=this,t=e.getFullYear(),n=e.getMonth(),r=this.getFirstYearOfDecade(t);for(let e=0;e<10;e++)this.yearRange.push(r+e);let i=new Date(t,n,1).getDay()+1;i===0&&(i=7);let a=this.getDaysInMonth(t,n);if(i>1){let e=this.getYearMonth(t,n-1),r=this.getDaysInMonth(e.year,e.month);for(let t=1;t<i;t++){let n=r-i+t+1,a=new Date(e.year,e.month,n);this.dateRange.push({text:n,date:a,state:this.disabledDate(a)?`disabled`:`gray`})}}let o=new Date;for(let r=1;r<=a;r++){let i=new Date(t,n,r),a=e=>e&&e.getDate()===r&&e.getFullYear()===t&&e.getMonth()===n,s=a(this.modelValue)?`active`:a(o)?`today`:this.disabledDate(i)?`disabled`:a(e)?`current`:null;this.dateRange.push({text:r,date:i,state:s})}let s=42-this.dateRange.length;if(s>0){let e=this.getYearMonth(t,n+1);for(let t=1;t<=s;t++){let n=new Date(e.year,e.month,t),r=this.disabledDate(n)?`disabled`:`gray`;this.dateRange.push({text:t,date:n,state:r})}}}}},zr={};function Br(e){let t=zr[e];if(!t){let n=[];for(let t=0;t<7;t++){let r=new Date(0,0,t);n.push({long:r.toLocaleString(e,{weekday:`long`}),short:r.toLocaleString(e,{weekday:`short`})})}let r=[];for(let t=1;t<=12;t++){let n=new Date(0,t,0);r.push({long:n.toLocaleString(e,{month:`long`}),short:n.toLocaleString(e,{month:`short`})})}t=zr[e]={weekdayNames:n,monthNames:r}}return t}var Vr=V(Rr,[[`render`,Lr]]);function Hr(e,t){e=e instanceof NodeList?Array.from(e):(0,r.asArray)(e);for(let[n,r]of Object.entries(t))for(let t of e)t.addEventListener(n,r,!1);return{remove(){for(let[n,r]of Object.entries(t))for(let t of e)t.removeEventListener(n,r,!1)}}}function Ur(...e){return{remove(){for(let t of e)t.remove()}}}function Wr(e){return{37:`left`,38:`up`,39:`right`,40:`down`,13:`enter`}[e?.keyCode]}function Gr(e){let t=Wr(e);return{hor:{left:-1,right:1}[t]||0,ver:{up:-1,down:1}[t]||0,enter:t===`enter`}}function Kr(e){let t=(0,r.isString)(e.target)?e.$refs[e.target]:e.target;return t?.$el??t}var qr={class:`dito-trigger-container`};function Jr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,qr,[r.alwaysShow?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):r.trigger===`click`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onClick:n[0]||=(...e)=>o.onClick&&o.onClick(...e)},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):r.trigger===`hover`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onMouseenter:n[1]||=e=>o.onHover(!0),onMouseleave:n[2]||=e=>o.onHover(!1)},[(0,e.renderSlot)(t.$slots,`trigger`)],34)):r.trigger===`focus`||r.trigger===`always`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:3,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(e.Transition,{name:`dito-${r.transition}`},{default:(0,e.withCtx)(()=>[r.trigger===`hover`?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,e.normalizeStyle)(o.popupStyle),onMouseenter:n[3]||=e=>o.onHover(!0),onMouseleave:n[4]||=e=>o.onHover(!1)},[a.showPopup?(0,e.renderSlot)(t.$slots,`popup`,{},void 0,void 0,0):(0,e.createCommentVNode)(``,!0)],38)),[[e.vShow,a.showPopup]]):(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,e.normalizeStyle)(o.popupStyle)},[a.showPopup?(0,e.renderSlot)(t.$slots,`popup`,{},void 0,void 0,0):(0,e.createCommentVNode)(``,!0)],6)),[[e.vShow,a.showPopup]])]),_:3},8,[`name`])])}var Yr=V({emits:[`update:show`],props:{trigger:{type:String,default:`click`},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom`},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:null},customClass:{type:String,default:null},zIndex:{type:Number,default:0},keepInView:{type:Boolean,default:!0},hideWhenClickOutside:{type:Boolean,default:!0},alwaysShow:{type:Boolean,default:!1},cover:{type:Boolean,default:!1},hideDelay:{type:Number,default:0}},data(){return{showPopup:this.show,popupPlacement:this.placement,focusEvents:null,closeEvents:null,popupEvents:null,blurTimer:null,mouseLeaveTimer:null}},computed:{triggerClass(){return{"dito-trigger-disabled":this.disabled}},popupClass(){let e={[`dito-popup-${(0,r.hyphenate)(this.placement)}`]:!0};return this.customClass&&(e[this.customClass]=!0),e},popupStyle(){return this.zIndex?`z-index: ${this.zIndex}`:``},triggerTarget(){return Kr(this)}},watch:{show(e){this.showPopup=e||this.alwaysShow},showPopup(e,t){e^t&&(this.$emit(`update:show`,e),this.$nextTick(()=>this.onShowPopup(e)))}},mounted(){let{trigger:e,popup:t}=this.$refs;this.trigger===`focus`&&(this.focusEvents=this.addFocusEvents(this.triggerTarget??e)),this.hideWhenClickOutside&&!this.alwaysShow&&(this.closeEvents=Hr(window,{mouseup:n=>{this.showPopup&&!t.contains(n.target)&&!e.contains(n.target)&&!this.triggerTarget?.contains(n.target)&&(this.showPopup=!1)},blur:()=>{this.showPopup=!1}})),this.alwaysShow&&(this.showPopup=!0)},created(){this.showPopup=this.show},unmounted(){this.focusEvents?.remove(),this.closeEvents?.remove(),this.popupEvents?.remove()},methods:{isPopupFocused(){return!!this.$refs.popup?.matches(`:focus-within`)},updatePosition(){let{trigger:e,popup:t}=this.$refs;if(this.show&&t.offsetWidth===0){setTimeout(()=>this.updatePosition(),0);return}let n=this.triggerTarget??e,r=this.target===`popup`?e:t.firstElementChild;r&&(r.style.width=getComputedStyle(n).width);let i=n.getBoundingClientRect(),a=i.left+window.scrollX,o=i.top+window.scrollY,s=i.width,c=i.height,l=t.offsetWidth,u=t.offsetHeight,[d,f]=this.popupPlacement.split(`-`)||[];if(this.keepInView){let e=window.innerWidth,t=window.innerHeight,n=o,r=t-o-c,i=a,p=e-a-s,m=(e,t,n)=>e<n&&t>e;d===`top`?m(n,r,u)&&(d=`bottom`):d===`bottom`?m(r,n,u)&&(d=`top`):d===`left`?m(i,p,l)&&(d=`right`):d===`right`&&m(p,i,l)&&(d=`left`),f===`top`?m(t-o,o+c,u)&&(f=`bottom`):f===`bottom`?m(o+c,t-o,u)&&(f=`top`):f===`left`?m(e-a,a+s,l)&&(f=`right`):f===`right`&&m(a+s,e-a,l)&&(f=`left`)}let p=0,m=0;switch(d){case`top`:m-=u;break;case`left`:p-=l;break;case`right`:p+=s;break;case`bottom`:m+=c}switch(f){case`right`:p-=l-s;break;case`bottom`:m-=u-c}if(this.cover&&(d===`top`?m+=c:d===`bottom`&&(m-=c)),n!==e){let t=e.getBoundingClientRect();p+=a-t.left,m+=o-t.top}t.style.left=`${p}px`,t.style.top=`${m}px`},addFocusEvents(e){let t=e.querySelectorAll(`input, textarea`),n;return Ur(Hr(t,{focus:()=>{this.showPopup=!0,clearTimeout(this.blurTimer)},blur:()=>{this.blurTimer=setTimeout(()=>{this.isPopupFocused()||(this.showPopup=!1)},0)}}),Hr(e,{mousedown:e=>{e.target.matches(`input, textarea, button`)||(e.preventDefault(),e.stopPropagation()),e.target.matches(`.dito-button-clear`)||(n=(this.triggerTarget??this.$refs.trigger).querySelector(`input, textarea`),n&&!n.hasAttribute(`readonly`)?n.setAttribute(`readonly`,`true`):n=null)},mouseup:e=>{n&&setTimeout(()=>{n.removeAttribute(`readonly`),!e.target.matches(`input, textarea, button`)&&this.isPopupFocused()&&n.focus(),n=null},0)}}))},onShowPopup(e){e?(this.trigger===`focus`&&(this.popupEvents=this.addFocusEvents(this.$refs.popup)),this.updatePosition()):(this.popupEvents?.remove(),this.popupEvents=null)},onClick(){this.disabled||(this.showPopup=!0)},onHover(e){this.disabled||(clearTimeout(this.mouseLeaveTimer),e?this.showPopup=!0:this.hideDelay?this.mouseLeaveTimer=setTimeout(()=>{this.showPopup=!1},this.hideDelay):this.showPopup=!1)}}},[[`render`,Jr]]),Xr=[`id`,`type`,`name`,`title`,`disabled`,`readonly`,`autofocus`,`placeholder`,`autocomplete`,`aria-label`];function Zr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-input`,o.classes]),onMousedown:n[2]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)},[(0,e.renderSlot)(t.$slots,`prefix`),(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:r.id,ref:`input`,"onUpdate:modelValue":n[0]||=e=>a.currentValue=e,type:r.type,name:r.name,title:r.title,disabled:r.disabled,readonly:r.readonly,autofocus:r.autofocus,placeholder:r.placeholder,autocomplete:r.autocomplete,"aria-label":r.title},o.attributes,{onMousedown:n[1]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)}),null,16,Xr),[[e.vModelDynamic,a.currentValue]]),(0,e.renderSlot)(t.$slots,`suffix`)],34)}var H=V({emits:[`update:modelValue`],inheritAttrs:!1,props:{modelValue:{type:[String,Number],default:null},type:{type:String,default:`text`},id:{type:String,default:null},name:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},focused:{type:Boolean,default:!1},placeholder:{type:String,default:null},autocomplete:{type:String,default:`off`}},data(){return{currentValue:this.modelValue}},computed:{classes(){return[this.$attrs.class,{"dito-input--focus":this.focused}]},attributes(){let{class:e,...t}=this.$attrs;return t},input(){return this.$refs.input},size(){let{size:e,min:t,max:n}=this.$attrs,r=e=>e==null?0:`${e}`.length;return e||r(t)||r(n)||void 0}},watch:{modelValue(e,t){e!==t&&(this.currentValue=e)},currentValue(e){e!==this.modelValue&&this.$emit(`update:modelValue`,e)}},methods:{focus(){this.input.focus()},blur(){this.input.blur()},onMouseDown(e){e.target===this.input?e.stopPropagation():!this.disabled&&!this.readonly&&(this.focus(),e.preventDefault())}}},[[`render`,Zr]]);function Qr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`i`,{class:(0,e.normalizeClass)([`dito-icon`,o.classes])},null,2)}var U=V({props:{name:{type:String,required:!0},disabled:{type:Boolean,default:!1}},computed:{classes(){let e=`dito-icon`;return{[`${e}--${this.name}`]:!0,[`${e}--disabled`]:this.disabled}}}},[[`render`,Qr]]);function W(e,{start:t,end:n}){e?.setSelectionRange&&(e.focus(),e.setSelectionRange(t,n))}function $r(e){return e&&`selectionStart`in e?{start:e.selectionStart,end:e.selectionEnd}:null}function ei(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoCalendar`),u=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(u,(0,e.mergeProps)({class:`dito-date-picker`,ref:`trigger`,show:a.showPopup,"onUpdate:show":n[7]||=e=>a.showPopup=e,trigger:`focus`},{transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target}),{trigger:(0,e.withCtx)(()=>[t.$slots.trigger?(0,e.renderSlot)(t.$slots,`trigger`,{},void 0,void 0,0):((0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({key:1,class:`dito-date-picker-input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`calendar`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]))]),popup:(0,e.withCtx)(()=>[(0,e.createVNode)(l,(0,e.mergeProps)({class:`dito-date-picker-popup`,ref:`calendar`,modelValue:a.currentValue,"onUpdate:modelValue":n[5]||=e=>a.currentValue=e},{locale:r.locale,disabledDate:r.disabledDate},{onSelect:n[6]||=e=>a.showPopup=!1}),null,16,[`modelValue`])]),_:3},16,[`show`])}var ti=V({components:{DitoTrigger:Yr,DitoCalendar:Vr,DitoInput:H,DitoIcon:U},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({date:r.defaultFormats.date,time:!1})},disabledDate:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,showPopup:this.show,inputFocused:!1}},computed:{focused(){return this.inputFocused||this.showPopup},input(){return Kr(this)?.querySelector(`input`)},formatOptions(){return{locale:this.locale,...this.format}},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=hr(e,this.formatOptions);t&&(this.currentValue=t)}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))},show(e){this.showPopup=e},showPopup(e,t){e^t&&this.$emit(`update:show`,e)},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{onFocus(e){this.inputFocused=e,this.showPopup=e},onKeyDown(e){if(e.key===`Escape`){this.showPopup=!1,e.preventDefault();return}let{ver:t,enter:n}=Gr(e);if(t||n){e.preventDefault();let r=$r(this.input)?.start,i=e=>gr(this.currentText,e,this.formatOptions);if(t&&!this.showPopup)this.showPopup=!0;else{let{calendar:e}=this.$refs;if(e){let{name:a,start:o}=i(r)||{};a&&e.navigate({step:t,enter:n,mode:a,update:!0})&&this.$nextTick(()=>W(this.input,i(o)))}}}},onMouseDown(e){this.showPopup=!this.disabled&&(!e||!this.showPopup),this.showPopup&&this.focus()},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,ei]]),ni={class:`dito-time-picker-popup`,role:`dialog`,"aria-label":`Choose time`},ri={class:`dito-time-picker-panel`},ii={class:`dito-time-picker-hour`,ref:`hour`,role:`listbox`,"aria-label":`Hour`},ai=[`aria-label`,`aria-selected`,`onClick`],oi={class:`dito-time-picker-panel`},si={class:`dito-time-picker-minute`,ref:`minute`,role:`listbox`,"aria-label":`Minute`},ci=[`aria-label`,`aria-selected`,`onClick`],li={class:`dito-time-picker-panel`},ui={class:`dito-time-picker-second`,ref:`second`,role:`listbox`,"aria-label":`Second`},di=[`aria-label`,`aria-selected`,`onClick`];function fi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(l,(0,e.mergeProps)({class:`dito-time-picker`,ref:`trigger`,show:a.showPopup,"onUpdate:show":n[5]||=e=>a.showPopup=e,trigger:`focus`},{transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target}),{trigger:(0,e.withCtx)(()=>[t.$slots.trigger?(0,e.renderSlot)(t.$slots,`trigger`,{},void 0,void 0,0):((0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({key:1,class:`dito-time-picker-input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`clock`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]))]),popup:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,ni,[(0,e.createElementVNode)(`div`,ri,[(0,e.createElementVNode)(`ul`,ii,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(24,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledHour(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.hour===t-1,class:(0,e.normalizeClass)({selected:o.hour===t-1}),onClick:e=>o.hour=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,ai))],64))),64))],512)]),(0,e.createElementVNode)(`div`,oi,[(0,e.createElementVNode)(`ul`,si,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(60,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledMinute(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.minute===t-1,class:(0,e.normalizeClass)({selected:o.minute===t-1}),onClick:e=>o.minute=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,ci))],64))),64))],512)]),(0,e.createElementVNode)(`div`,li,[(0,e.createElementVNode)(`ul`,ui,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(60,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledSecond(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.second===t-1,class:(0,e.normalizeClass)({selected:o.second===t-1}),onClick:e=>o.second=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,di))],64))),64))],512)])])]),_:3},16,[`show`])}var pi=V({components:{DitoTrigger:Yr,DitoInput:H,DitoIcon:U},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({time:r.defaultFormats.time,date:!1})},disabledHour:{type:Function,default:()=>!1},disabledMinute:{type:Function,default:()=>!1},disabledSecond:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,showPopup:this.show,inputFocused:!1,ignoreNextChange:!1}},computed:{focused(){return this.inputFocused||this.showPopup},input(){return Kr(this)?.querySelector(`input`)},formatOptions(){return{locale:this.locale,...this.format}},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=hr(e,this.formatOptions);t&&(this.currentValue=t)}},currentDate(){return this.currentValue||mr(new Date,{hour:0,minute:0,second:0,millisecond:0})},hour:{get(){return this.currentDate.getHours()},set(e){this.setTime({hour:e})}},minute:{get(){return this.currentDate.getMinutes()},set(e){this.setTime({minute:e})}},second:{get(){return this.currentDate.getSeconds()},set(e){this.setTime({second:e})}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e,this.scrollAll(!0))},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e),this.scrollAll(!0))},currentText(){let{input:e}=this,t=$r(e);this.focused&&!this.ignoreNextChange&&t.start===t.end&&this.$nextTick(()=>W(e,t)),this.ignoreNextChange=!1},show(e){this.showPopup=e},showPopup(e,t){e&&this.scrollAll(!1),e^t&&this.$emit(`update:show`,e)},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{leftPad(e){return(`0`+e).slice(-2)},setTime(e){this.currentValue=mr(this.currentDate,{...e,millisecond:0})},scrollAll(e){let t=(t,n)=>{let r=this.$refs[t];if(r){let t=r.scrollHeight/(r.childElementCount+6),i=Math.round(n*t),a=Math.abs(r.scrollTop-i);r.scrollTo({top:i,behavior:e&&a<100?`smooth`:`auto`})}};this.$nextTick(()=>{t(`hour`,this.hour),t(`minute`,this.minute),t(`second`,this.second)})},onFocus(e){this.inputFocused=e,this.showPopup=e},onKeyDown(e){if(e.key===`Escape`){this.showPopup=!1,e.preventDefault();return}let{input:t}=this,n=$r(t),{ver:i,enter:a}=Gr(e);if(i||a){e.preventDefault();let r=e=>gr(this.currentText,e,this.formatOptions);if(i){if(!this.showPopup)this.showPopup=!0;else{let{name:e,start:a}=r(n.start)||{};if(e){let n=this[e]+i,o=this.$refs[e].childElementCount;this[e]=n<0?n+o:n>=o?n-o:n,this.ignoreNextChange=!0,this.$nextTick(()=>W(t,r(a)))}}}else a&&(this.showPopup=!1)}else if(n.start===n.end){let{value:i}=t,a=n.start,o=e=>!isNaN(Number(e));if(e.key.length===1){if(o(e.key)&&a<i.length)i[a]===`:`&&o(i[a-1])&&o(i[a-2])&&a++,o(i[a])&&(o(i[a+1])||o(i[a-1]))&&(t.value=i.slice(0,a)+i.slice(a+1),W(t,{start:a,end:a}));else{let a=(0,r.format)(this.currentValue,this.formatOptions).length;i.length===a?e.preventDefault():i.length>a&&(t.value=i.slice(0,a),W(t,n),e.preventDefault())}}else e.key===`Backspace`&&(a===1||[` `,`:`].includes(i[a-2]))&&(a===i.length||i[a]===`:`?(a--,t.value=i.slice(0,a)+((i[a-1]??``)+`00`)+i.slice(a+1),W(t,{start:a,end:a})):o(i[a])&&!o(+i[a+1])&&(t.value=i.slice(0,a)+`0`+i.slice(a),W(t,{start:a,end:a})))}},onMouseDown(e){this.showPopup=!this.disabled&&(!e||!this.showPopup),this.showPopup&&this.focus()},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,fi]]),mi={class:`dito-date-time-picker`,ref:`picker`};function hi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoDatePicker`),u=(0,e.resolveComponent)(`DitoTimePicker`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,mi,[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`dito-date-time-picker__inner`,{"dito-date-time-picker__inner--focus":o.focused}])},[(0,e.createVNode)(c,(0,e.mergeProps)({class:`dito-date-time-picker__input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`calendar`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]),(0,e.createVNode)(l,(0,e.mergeProps)({ref:`date`,modelValue:a.currentValue,"onUpdate:modelValue":n[5]||=e=>a.currentValue=e,show:a.showDate,"onUpdate:show":n[6]||=e=>a.showDate=e,placement:`bottom-left`,target:t.$refs.picker},o.attributes),{trigger:(0,e.withCtx)(()=>[...n[9]||=[]]),_:1},16,[`modelValue`,`show`,`target`]),(0,e.createVNode)(u,(0,e.mergeProps)({ref:`time`,modelValue:a.currentValue,"onUpdate:modelValue":n[7]||=e=>a.currentValue=e,show:a.showTime,"onUpdate:show":n[8]||=e=>a.showTime=e,placement:`bottom-right`,target:t.$refs.picker},o.attributes),{trigger:(0,e.withCtx)(()=>[...n[10]||=[]]),_:1},16,[`modelValue`,`show`,`target`])],2)],512)}var gi=V({components:{DitoInput:H,DitoDatePicker:ti,DitoTimePicker:pi,DitoIcon:U},emits:[`update:modelValue`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},locale:{type:String,default:`en-US`},format:{type:Object,default:null}},data(){return{currentValue:this.modelValue,showDate:!1,showTime:!1,inputFocused:!1,dateFocused:!1,timeFocused:!1,closedMode:null}},computed:{attributes(){let{transition:e,disabled:t,locale:n,formatOptions:r}=this;return{transition:e,disabled:t,locale:n,format:r}},focused(){return this.inputFocused||this.showDate||this.showTime},input(){return this.$refs.input.input},formatOptions(){return(0,r.assignDeeply)({locale:this.locale,time:r.defaultFormats.time,date:r.defaultFormats.date},{date:{month:`short`,format:(e,t,n)=>t===`literal`&&/\bat\b/.test(e)?`, `:this.format?.date?.format?.(e,t,n)??e}},this.format)},timeIndex(){let e=this.currentText;if(e){let t=e.match(/([\S]+\s*)$/)?.[1];if(t)return e.length-t.length}return null},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=hr(e,this.formatOptions);if(t){let e=$r(this.input);this.currentValue=t,this.$nextTick(()=>W(this.input,e))}}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{onFocus(e){this.inputFocused=e,e?this.updatePopups():(this.showDate=!1,this.showTime=!1)},onMouseDown(e){e&&(this.showDate||this.showTime)?(this.showDate=!1,this.showTime=!1):this.disabled||(this.focus(),requestAnimationFrame(()=>this.updatePopups()))},onKeyDown(e){let t=this.getMode(e);this.$refs[t].onKeyDown(e),e.defaultPrevented?this.closedMode=t:t!==this.closedMode&&this.updatePopups(t)},getMode(e=null){let{start:t}=$r(this.input),{hor:n}=Gr(e);return this.timeIndex===null||t+n<this.timeIndex?`date`:`time`},updatePopups(e=this.getMode()){e&&(this.closedMode=null),this.showDate=e===`date`,this.showTime=e===`time`},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,hi]]),_i={class:`dito-pagination`,"aria-label":`Pagination`},vi={key:0,class:`dito-pagination-total`},yi={key:1,class:`dito-buttons dito-buttons--round`},bi=[`disabled`,`aria-label`,`aria-current`,`onClick`],xi={key:0};function Si(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,_i,[r.showTotal?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,vi,[r.total>0?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)((0,e.toDisplayString)(o.first)+` – `+(0,e.toDisplayString)(o.last)+` / `+(0,e.toDisplayString)(r.total),1)],64)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),o.numPages>1?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,yi,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(o.buttons,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{class:(0,e.normalizeClass)([`dito-button`,o.getButtonClasses(t)]),disabled:t.disabled,"aria-label":o.getButtonLabel(t),"aria-current":t.active?`page`:null,onClick:e=>o.onClickButton(t)},[t.text?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,xi,(0,e.toDisplayString)(t.text),1)):(0,e.createCommentVNode)(``,!0)],10,bi))),256))])):(0,e.createCommentVNode)(``,!0)])}var Ci=V({emits:[`update:page`],props:{total:{type:Number,default:0},page:{type:Number,default:1},pageSize:{type:Number,default:10},showTotal:{type:Boolean,default:!0}},data(){return{showPrev:!0,showNext:!0,currentPage:this.page}},computed:{first(){return(this.currentPage-1)*this.pageSize+1},last(){return Math.min(this.first+this.pageSize-1,this.total)},numPages(){return Math.ceil(this.total/this.pageSize)},buttons(){let{showPrev:e,showNext:t,currentPage:n,numPages:r}=this,i=e+t+1,a=1,o;r<=i?o=r:n<=e+1?o=i:n>=r-t?(o=r,a=r-i+1):(a=n-e,o=n+t);let s=[];s.push({index:n-1,type:`prev`,disabled:n<=1}),a>=2&&s.push({index:1,text:1}),a>2&&s.push({index:Math.max(1,n-10),type:`ellipsis-prev`});for(let e=a;e<=o;e++)s.push({index:e,text:e,active:e===n});return o<r-1&&s.push({index:Math.min(r,n+10),type:`ellipsis-next`}),o<=r-1&&s.push({index:r,text:r}),s.push({index:n+1,type:`next`,disabled:n>=r}),s}},watch:{page(e){this.currentPage=e},pageSize(){this.currentPage>this.numPages&&(this.currentPage=this.numPages)},currentPage(e,t){e!==t&&this.$emit(`update:page`,e)}},created(){this.currentPage=this.page},methods:{getButtonClasses(e){let t=`dito-button`;return{[`${t}--${e.type}`]:e.type,[`${t}--active`]:e.active}},getButtonLabel(e){return e.type===`prev`?`Previous page`:e.type===`next`?`Next page`:e.text?`Page ${e.text}`:null},onClickButton(e){e.index&&!e.disabled&&e.index!==this.currentPage&&(this.currentPage=e.index)}}},[[`render`,Si]]),wi={class:`dito-switch__pane`},Ti=[`id`,`aria-checked`,`name`,`disabled`],Ei={key:0,class:`dito-switch__label`};function Di(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-switch`,o.classes]),style:(0,e.normalizeStyle)(o.styles)},[(0,e.createElementVNode)(`div`,wi,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:r.id,ref:`input`},o.attributes,{"onUpdate:modelValue":n[0]||=e=>a.checked=e,role:`switch`,type:`checkbox`,"aria-checked":a.checked,name:r.name,disabled:r.disabled}),null,16,Ti),[[e.vModelCheckbox,a.checked]]),n[1]||=(0,e.createElementVNode)(`div`,{class:`dito-switch__button`},null,-1),r.labels?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,Ei,[a.checked?(0,e.renderSlot)(t.$slots,`checked`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.labels.checked||`on`),1)],void 0,0):(0,e.renderSlot)(t.$slots,`unchecked`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.labels.unchecked||`off`),1)],void 0,1)])):(0,e.createCommentVNode)(``,!0)])],6)}var Oi=V({emits:[`update:modelValue`,`change`],inheritAttrs:!1,props:{modelValue:{type:Boolean,default:!1},id:{type:String,default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},labels:{type:[Object,Boolean],default:!1}},data(){return{checked:this.modelValue}},computed:{classes(){let e=`dito-switch`;return[this.$attrs.class,{[`${e}--checked`]:this.checked,[`${e}--disabled`]:this.disabled}]},styles(){let{labels:{checked:e,unchecked:t}={}}=this,n=Math.max(0,e?.length,t?.length);return{"--switch-width":n?`${n*1.5}rem`:null}},attributes(){let{class:e,...t}=this.$attrs;return t}},watch:{modelValue(e){this.checked=e},checked(e){e!==this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))}},methods:{focus(){this.$refs.input.focus()}}},[[`render`,Di]]);function ki({enabled:t},{slots:n}){return t?(0,e.h)(e.Transition,Ni,n):n.default()}ki.props={enabled:{type:Boolean,default:!0}};var Ai=ki,G=(e,t)=>Object.assign(e.style,t),ji=e=>setTimeout(e,0),Mi=e=>getComputedStyle(e).height,Ni={name:`dito-height`,onAfterEnter(e){ji(()=>G(e,{height:null}))},onEnter(e){let{width:t}=getComputedStyle(e);G(e,{width:t,position:`absolute`,visibility:`hidden`,height:`auto`}),ji(()=>{let{height:t}=getComputedStyle(e);G(e,{width:null,position:null,visibility:null,height:0}),Mi(e),ji(()=>G(e,{height:t}))})},onLeave(e){let{height:t}=getComputedStyle(e);G(e,{height:t}),Mi(e),ji(()=>G(e,{height:0}))}},K={data(){return{domHandlers:[]}},unmounted(){for(let{remove:e}of this.domHandlers)e();this.domHandlers=[]},methods:{domOn(e,t,n){let i=Hr(e,(0,r.isObject)(t)?t:{[t]:n});return this.domHandlers.push(i),i}}},Pi=class{hasRole(...e){if(this.roles){for(let t of e)if(this.roles.includes(t))return!0}return!1}},Fi={provide(){return{$schemaParentComponent:()=>this}},data(){return{schemaComponents:[]}},computed:{mainSchemaComponent(){return this.schemaComponents[0]}},methods:{_registerSchemaComponent(e,t){let{schemaComponents:n}=this;t?n.push(e):n.splice(n.indexOf(e),1)}}},Ii={mixins:[Fi],computed:{errors(){return this.schemaComponents.flatMap(({errors:e})=>e||[])},isTouched(){return this.schemaComponents.some(e=>e.isTouched)},isDirty(){return this.schemaComponents.some(e=>e.isDirty)},isValid(){return this.schemaComponents.every(e=>e.isValid)},isValidated(){return this.schemaComponents.every(e=>e.isValid)}},methods:{validateAll(e,t=!0){return this.schemaComponents.every(n=>n.validateAll(e,t))},verifyAll(e){return this.schemaComponents.every(t=>t.verifyAll(e))},resetValidation(){this.schemaComponents.forEach(e=>e.resetValidation())},clearErrors(){this.schemaComponents.forEach(e=>e.clearErrors())},async showValidationErrors(e,t,n=!0){for(let r of this.schemaComponents)await r.showValidationErrors(e,t,n)&&(n=!1);return!n}}},Li={mixins:[Ii],provide(){return{$routeComponent:()=>this}},data(){return{reload:!1,routeRecord:null,store:{},loadCache:{}}},computed:{routeComponent(){return this},routeLevel(){let e=0,t=this;for(;t=t.parentRouteComponent;)e++;return e},matchedRouteRecord(){return this.$route.matched[this.routeLevel]},isLeavingRoute(){return this.matchedRouteRecord?.path!==this.routeRecord?.path},isLastRoute(){let{matched:e}=this.$route;return this.routeRecord===e[e.length-1]},isLastUnnestedRoute(){let{matched:e}=this.$route;for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n.meta.nested)return this.routeRecord===n}return!1},isNestedRoute(){return this.meta.nested},isForm(){return!1},isView(){return!1},meta(){return this.routeRecord?.meta},path(){return this.getRoutePath(this.routeRecord?.path)},label(){return this.getLabel(this.schema)},breadcrumb(){let{breadcrumb:e}=this.schema||{};return e||`${this.breadcrumbPrefix} ${this.label}`},breadcrumbPrefix(){return``},param(){return this.$route.params[this.meta?.param]||null},isMutating(){return!1}},watch:{matchedRouteRecord:{immediate:!0,flush:`sync`,handler(t){t&&(!this.routeRecord||t.path===this.routeRecord.path)&&(this.routeRecord=(0,e.markRaw)(t))}}},beforeRouteUpdate(e,t){return this?.beforeRouteChange(e,t)},beforeRouteLeave(e,t){return this?.beforeRouteChange(e,t)},created(){this.appState.routeComponents.push(this)},unmounted(){let{routeComponents:e}=this.appState;e.splice(e.indexOf(this),1)},methods:{beforeRouteChange(e,t){let n=!0;return t.path.startsWith(this.path)&&!e.path.startsWith(this.path)&&t.path!==e.path&&(this.isFullRouteChange(e,t)||e.path.length<=t.path.length)&&(this.isMutating?n=this.isValidated||this.validateAll():this.isDirty&&(n=window.confirm(`You have unsaved changes. Do you really want to ${this.verbs.cancel}?`))),n},getRoutePath(e){let{path:t}=this.$route;return e?t.split(`/`).slice(0,e.split(`/`).length).join(`/`):t},getChildPath(e){return`${this.path}/${e}`},isFullRouteChange(e,t){let n=this.path.match(/^(\/[^/]*)/)[1];return!(0,r.getCommonPrefix)(e.path,t.path).startsWith(n)}}},Ri=class{currentPromiseOrLoader=null;currentLoadPromise=null;lastFinishedLoad=(0,e.shallowRef)({promiseOrLoader:null,value:void 0,error:null});constructor(t,{createContext:n,onLoadStart:i=null}){this.dataSchema=(0,r.isObject)(t)?t:{data:t},this.createContext=n,this.onLoadStart=i,this.valueOrPromiseOrLoader=(0,e.computed)(()=>this.getValueOrPromiseOrLoader()),this.valueOrUndefinedWhileLoading=(0,e.computed)(()=>this.getValueOrStartLoad())}get value(){return this.valueOrUndefinedWhileLoading.value}get isLoading(){if(this.value!==void 0)return!1;let e=this.valueOrPromiseOrLoader.value;return zi(e)&&this.lastFinishedLoad.value.promiseOrLoader!==e}async waitForValue(){for(;this.isLoading;)await this.currentLoadPromise;return this.value}get lastLoadError(){let{promiseOrLoader:e,error:t}=this.lastFinishedLoad.value;return e===this.valueOrPromiseOrLoader.value?t:null}getValueOrPromiseOrLoader(){let{data:e,dataPath:t}=this.dataSchema;if(e!==void 0)return(0,r.isFunction)(e)?e(this.createContext()):e;if(t){let e=this.createContext();return(0,r.getValueAtDataPath)(e.rootItem,(0,r.normalizeDataPath)(`${e.dataPath}/${t}`),()=>void 0)}}getValueOrStartLoad(){let e=this.valueOrPromiseOrLoader.value;if(!zi(e))return e;let{promiseOrLoader:t,value:n}=this.lastFinishedLoad.value;if(t===e)return n;this.currentPromiseOrLoader!==e&&this.startLoad(e)}startLoad(e){this.currentPromiseOrLoader=e;let t=this.createContext(),n=(t,n=null)=>{this.currentPromiseOrLoader===e&&(this.lastFinishedLoad.value={promiseOrLoader:e,value:t,error:n})},i=Promise.resolve().then(()=>(0,r.isFunction)(e)?e(t):e).then(e=>n(e)).catch(e=>{console.error(e),n(void 0,e)});this.currentLoadPromise=i,this.onLoadStart?.(i)}};function zi(e){return(0,r.isFunction)(e)||(0,r.isPromise)(e)}var Bi=class{computedValueRecords=new Map;optionsRecords=new Map;pendingLoads=new Set;processedDataSnapshot=(0,e.shallowRef)(null);derivedValueDataPaths=null;computedValueWriteCounts=null;constructor({component:t,getSchema:n,getData:r,getSourceSchema:i=null}){this.component=t,this.getSchema=n,this.getData=r,this.getSourceSchema=i,this.rootScope=(0,e.effectScope)(!0),this.rootScope.run(()=>{(0,e.watch)([n,r],([e,t])=>this.initializeData(e,t),Wi),this.dataEntries=(0,e.computed)(()=>this.getDataEntries()),(0,e.watch)(()=>this.dataEntries.value.computedValueEntries,e=>this.updateComputedValueRecords(e),Wi),(0,e.watch)(()=>this.dataEntries.value.entriesWithMissingValues,e=>this.setDefaultValues(e),Wi),i&&(0,e.watch)(r,()=>this.takeProcessedDataSnapshot().catch(console.error),Gi)})}get dataPath(){return this.component.dataPath??``}get componentPath(){return this.component.componentPath??``}get rootData(){return this.component.rootData??this.getData()}get isDirty(){let e=this.processedDataSnapshot.value,t=this.getData();if(!t||e?.data!==t)return!1;let n=this.getProcessedDataForDirtyCheck(),i=this.derivedValueDataPaths?Vi(e.processedData,n,this.derivedValueDataPaths):e.processedData;return!(0,r.equals)(n,i)}stop(){this.rootScope.stop(),this.computedValueRecords.clear(),this.optionsRecords.clear(),this.pendingLoads.clear()}get hasPendingLoads(){return this.pendingLoads.size>0}async waitUntilSettled(){for(;this.hasPendingLoads;)await Promise.all(this.pendingLoads),await(0,e.nextTick)()}async takeProcessedDataSnapshot(){let t=this.getData(),n=t?new Set:null;if(this.derivedValueDataPaths=n,this.processedDataSnapshot.value=t?{data:t,processedData:(0,r.clone)(this.getProcessedDataForDirtyCheck())}:null,!t)return;await(0,e.nextTick)(),await this.waitUntilSettled();let i=this.derivedValueDataPaths!==n,a=!this.rootScope.active;if(i||a)return;this.derivedValueDataPaths=null;let o=this.processedDataSnapshot.value;o?.data===this.getData()&&(this.processedDataSnapshot.value={data:t,processedData:Vi(o.processedData,this.getProcessedDataForDirtyCheck(),n)})}getProcessedDataForDirtyCheck(){let e=this.getSchema(),t=this.getData();return t&&!Ht(e)?on(e,this.getSourceSchema(),t,this.dataPath,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,schemaOnly:!0,target:`clipboard`,shouldCallProcess:!1}):null}async applyCleanChanges(t){let n=this.getData(),i=this.processedDataSnapshot.value?.data===n,a=i?(0,r.clone)(this.getProcessedDataForDirtyCheck()):null;if(t(),i){await(0,e.nextTick)(),await this.waitUntilSettled();let t=this.processedDataSnapshot.value;t?.data===n&&this.rootScope.active&&(this.processedDataSnapshot.value={data:n,processedData:Hi(t.processedData,a,this.getProcessedDataForDirtyCheck())})}}trackPendingLoad(e){this.pendingLoads.add(e),e.finally(()=>this.pendingLoads.delete(e))}initializeData(e,t){t&&!Ht(e)&&tn(e,t,this.component,{dataPath:this.dataPath,rootData:this.rootData,shouldSkipSourcesWithResource:!0,shouldSetDefaultsOfComponentsWithCompute:!1})}getDataEntries(){let e=this.getSchema(),t=this.getData(),n=new Map,r=[];return t&&!Ht(e)&&N(e,t,{dataPath:this.dataPath,componentPath:this.componentPath,shouldProcess:e=>this.isEntryShown(e),shouldSkipSourcesWithResource:!0,before:e=>{Ji(e.schema)&&n.set(e.componentPath,e),this.shouldSetDefaultValue(e)&&r.push(e)},options:{component:this.component,rootData:this.rootData}}),{computedValueEntries:n,entriesWithMissingValues:r}}isEntryShown(e){if(e.schema.if===void 0)return!0;try{return A(`if`,{type:Boolean,schema:e.schema,context:this.createEntryContext(e),default:!0})}catch(e){return console.error(e),!0}}shouldSetDefaultValue(e){let{schema:t,data:n,name:r}=e;return en(t,n,r,()=>this.createEntryContext(e),{shouldSetDefaultsOfComponentsWithCompute:!1})}setDefaultValues(e){for(let t of e)if(this.shouldSetDefaultValue(t)){let{schema:e,data:n,name:r}=t;Jt(e,n,r,()=>this.createEntryContext(t))}}updateComputedValueRecords(e){let t=this.computedValueRecords;this.computedValueRecords=new Map;for(let[n,r]of e){let e=t.get(n);e?.entry.schema===r.schema&&e.entry.data===r.data?t.delete(n):e={entry:r,scope:this.createComputedValueScope(r)},this.computedValueRecords.set(n,e)}for(let{scope:e}of t.values())e.stop()}createComputedValueScope(t){let n=this.rootScope.run(()=>(0,e.effectScope)());return n.run(()=>{let n=(0,e.computed)(()=>this.isEntryCurrent(t));if(t.schema.compute&&(0,e.watch)(()=>n.value?this.getComputedValueResult(t):null,e=>{e&&this.writeComputedValue(t,e.value)},Gi),Qt(t.schema)){let r=this.createDataSchemaResolver(t.schema,t);(0,e.watch)(()=>n.value&&!r.isLoading?{value:r.value}:null,e=>{e&&this.writeComputedValue(t,e.value)},Gi)}}),n}hasComputedValueEntry(e){return this.dataEntries.value.computedValueEntries.has(e)}isEntryCurrent({componentPath:e,schema:t,data:n}){let r=this.dataEntries.value.computedValueEntries.get(e);return r?.schema===t&&r.data===n}getComputedValueResult(e){let{schema:t,data:n,name:r,dataPath:i}=e;try{return{value:nn(t,n,r,i,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,getOptions:t.options?()=>this.getLoadedOptions(e):null})}}catch(e){if(e===Ki)return null;throw e}}getLoadedOptions(e){let t=this.getOptions(e);if(t===void 0)throw Ki;return t}getOptions(e){return this.getOptionsResolver(e).value}getOptionsResolver(e){let{schema:t,data:n,componentPath:r}=e,i=this.optionsRecords.get(r);return(!i||i.entry.schema.options!==t.options||i.entry.data!==n)&&(i={entry:e,resolver:this.createDataSchemaResolver(t.options,e)},this.optionsRecords.set(r,i)),i.resolver}createDataSchemaResolver(e,t){return new Ri(e,{createContext:()=>this.createEntryContext(t),onLoadStart:e=>this.trackPendingLoad(e)})}writeComputedValue(e,t){let{data:n,name:i}=e;if(this.setNestedDefaultValues(e,t),!(0,r.equals)(t,n[i])){let r=this.getRelativeDataPath(e);if(this.isWriteLoop(r))return;this.derivedValueDataPaths?.add(r),n[i]=t}}setNestedDefaultValues(e,t){let{schema:n,data:i,name:a,dataPath:o}=e;if(!(0,r.isPlainObject)(t)&&!(0,r.isArray)(t))return;let s={...i,[a]:t};N({components:{[a]:n}},s,{dataPath:S(n)?Ae(o):o,shouldProcess:e=>this.isEntryShown(e),shouldSkipSourcesWithResource:!0,before:e=>{e.data!==s&&this.shouldSetDefaultValue(e)&&Jt(e.schema,e.data,e.name,()=>this.createEntryContext(e))},options:{component:this.component,rootData:this.rootData}})}isWriteLoop(e){this.computedValueWriteCounts||(this.computedValueWriteCounts=new Map,queueMicrotask(()=>{this.computedValueWriteCounts=null}));let t=(this.computedValueWriteCounts.get(e)??0)+1;return this.computedValueWriteCounts.set(e,t),t===qi+1&&console.error(Error(`The computed value at '${e}' keeps changing, as its sources disagree on it. It isn't written anymore in this update.`)),t>qi}getRelativeDataPath({schema:e,name:t,dataPath:n}){return(S(e)?(0,r.parseDataPath)(n):[...(0,r.parseDataPath)(n),t]).slice((0,r.parseDataPath)(this.dataPath).length).join(`/`)}createEntryContext({schema:e,data:t,name:n,dataPath:r}){return E.createForSchema(this.component,{schema:e,name:n,data:t,dataPath:r,rootData:this.rootData})}};function Vi(e,t,n){if(n.size===0)return e;let i=(0,r.clone)(e);for(let e of n){let n=(0,r.parseDataPath)(e),a=n.slice(0,-1),o=n.at(-1),s=(0,r.getValueAtDataPath)(i,a,()=>null);if(s&&typeof s==`object`){let n=(0,r.getValueAtDataPath)(t,e,()=>Ui);n===Ui?delete s[o]:s[o]=(0,r.clone)(n)}}return i}function Hi(e,t,n){if((0,r.equals)(t,n))return e;if(!((0,r.isPlainObject)(t)&&(0,r.isPlainObject)(n)&&(0,r.isPlainObject)(e)||(0,r.isArray)(t)&&(0,r.isArray)(n)&&(0,r.isArray)(e)&&t.length===n.length&&n.length===e.length))return(0,r.clone)(n);let i=(0,r.isArray)(e)?[...e]:{...e};for(let r of new Set([...Object.keys(t),...Object.keys(n)]))r in n?i[r]=Hi(e[r],t[r],n[r]):delete i[r];return i}var Ui=Symbol(`notFound`),Wi={immediate:!0,flush:`pre`},Gi={immediate:!0,flush:`post`},Ki=Symbol(`optionsNotLoaded`),qi=10;function Ji(e){return!!e.compute||Qt(e)}var Yi=[`data-resource`];function Xi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoRouterView`),c=(0,e.resolveComponent)(`DitoSchema`);return t.user&&t.shouldRenderSchema(t.viewSchema)?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[t.isLastRoute?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-view dito-scroll-parent`,"data-resource":t.sourceSchema.path},[((0,e.openBlock)(),(0,e.createBlock)(c,{key:t.name,schema:t.viewSchema,data:t.data,meta:t.meta,store:t.getChildStore(t.name),padding:`root`,disabled:t.isLoading,scrollable:``,single:``},null,8,[`schema`,`data`,`meta`,`store`,`disabled`]))],8,Yi)):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`]))],64)):(0,e.createCommentVNode)(``,!0)}var Zi=V(B.component(`DitoView`,{mixins:[Li],provide(){return{$sourceComponent:()=>this.mainComponent?.sourceComponent||null,$resourceComponent:()=>this.mainComponent?.resourceComponent||null}},data(){return{isLoading:!1,data:{}}},computed:{schema(){return this.meta.schema??{}},name(){return this.schema.name},isView(){return!0},isSingleComponentView(){return lt(this.schema)},mainComponent(){return this.mainSchemaComponent?.getComponentByDataPath(this.name)},viewSchema(){let{component:e,...t}=this.schema;return this.isSingleComponentView?{...t,components:{[t.name]:{name:t.name,label:!1,...e}}}:t},providesData(){return $e(this.viewSchema,Xn)}},watch:{$route:{flush:`post`,handler(e,t){this.isFullRouteChange(e,t)&&(this.isLoading=!1,this.data={})}}},created(){this.ownDataModel=(0,e.markRaw)(new Bi({component:this,getSchema:()=>this.viewSchema,getData:()=>this.data}))},mounted(){this.shouldRenderSchema(this.viewSchema)||this.$router.replace({path:`/`})},beforeUnmount(){this.ownDataModel.stop()},methods:{setData(e){return this.data=e,this.data},getChildPath(e){return this.isSingleComponentView?this.path:`${this.path}/${e}`},setLoading(e){this.isLoading=!!e}}}),[[`render`,Xi]]);function Qi(t,n={}){let r,{immediate:i,...a}=n,l=(0,e.shallowRef)(!1),u=(0,e.shallowRef)(!1),d=e=>r&&r.activate(e),f=e=>r&&r.deactivate(e),p=()=>{r&&(r.pause(),u.value=!0)},m=()=>{r&&(r.unpause(),u.value=!1)},h=(0,e.computed)(()=>{let n=(0,e.toValue)(t);return(0,s.toArray)(n).map(t=>{let n=(0,e.toValue)(t);return typeof n==`string`?n:(0,s.unrefElement)(n)}).filter(o.notNullish)});return(0,e.watch)(h,e=>{if(e.length){if(!r)r=(0,c.createFocusTrap)(e,{...a,onActivate(e){l.value=!0,n.onActivate&&n.onActivate(e)},onDeactivate(e){l.value=!1,n.onDeactivate&&n.onDeactivate(e)}}),i&&d();else{let t=r?.active;r?.updateContainerElements(e),!t&&i&&d()}}},{flush:`post`}),(0,s.tryOnScopeDispose)(()=>f()),{hasFocus:l,isPaused:u,activate:d,deactivate:f,pause:p,unpause:m}}var $i=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,e.shallowRef)(),i=(0,e.reactive)(Qi(r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:r},n.default(i))}},{name:`UseFocusTrap`,props:[`as`,`options`]}),ea=[`aria-label`];function ta(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoButtons`),c=(0,e.resolveComponent)(`DitoSchema`),l=(0,e.resolveComponent)(`UseFocusTrap`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-dialog`,ref:`dialog`,role:`dialog`,"aria-label":t.schema.label||`Dialog`,"aria-modal":`true`,style:(0,e.normalizeStyle)({"--width":t.settings.width?`${t.settings.width}px`:null}),onMouseup:n[2]||=(...e)=>t.onMouseUp&&t.onMouseUp(...e)},[(0,e.createVNode)(l,{class:`dito-dialog__focus-trap`,options:t.focusTrapOptions},{default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`form`,{class:`dito-dialog__form dito-scroll-parent`,onSubmit:n[0]||=(0,e.withModifiers)((...e)=>t.submit&&t.submit(...e),[`prevent`]),onKeydown:n[1]||=(0,e.withKeys)((...e)=>t.onEnter&&t.onEnter(...e),[`enter`])},[(0,e.withDirectives)((0,e.createElementVNode)(`button`,null,null,512),[[e.vShow,!1]]),(0,e.createVNode)(c,{schema:t.schema,data:t.dialogData,padding:`root`,scrollable:``,generateLabels:``},{buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{class:`dito-buttons--large`,buttons:t.buttonSchemas,data:t.dialogData},null,8,[`buttons`,`data`])]),_:1},8,[`schema`,`data`])],32)]),_:1},8,[`options`])],44,ea)}var na=V(B.component(`DitoDialog`,{mixins:[K],components:{UseFocusTrap:$i},emits:[`remove`],provide(){return{$dialogComponent:()=>this}},props:{components:{type:Object,required:!0},buttons:{type:Object,required:!0},promise:{type:Object,required:!0},data:{type:Object,default:()=>({})},settings:{type:Object,default:()=>({width:480,clickToClose:!1})}},data(){let e=(0,r.clone)(this.data);for(let t in this.components)t in e||(e[t]=null);return{dialogData:e}},computed:{dialogComponent(){return this},schema(){return{type:`dialog`,components:this.components}},buttonSchemas(){return Object.fromEntries(Object.entries(Ut(this.buttons)).map(([e,t])=>(e===`cancel`&&!t.events&&(t={...t,events:{click:()=>this.cancel()}}),[e,t])))},focusTrapOptions(){return{immediate:!0,fallbackFocus:()=>this.$refs.dialog,onDeactivate:this.cancel}},hasButtons(){return Object.keys(this.buttonSchemas).length>0},hasCancel(){return!!this.buttonSchemas.cancel}},created(){this.ownDataModel=(0,e.markRaw)(new Bi({component:this,getSchema:()=>this.schema,getData:()=>this.dialogData}))},mounted(){this.domOn(window,{keyup:e=>{(this.hasCancel||!this.hasButtons)&&e.keyCode===27&&this.cancel()}})},beforeUnmount(){this.ownDataModel.stop()},methods:{remove(){this.$emit(`remove`)},resolve(e){this.promise.resolve(e),this.remove()},reject(e){this.promise.reject(e),this.remove()},onEnter(e){e.target instanceof HTMLInputElement&&this.submit()},async submit(){await this.waitUntilDataModelSettled(),this.resolve(this.dialogData)},cancel(){this.resolve(void 0)},close(){this.cancel()},onMouseUp(){this.settings.clickToClose&&this.close()}}}),[[`render`,ta]]),ra=[`data-agent-browser`,`data-agent-platform`,`data-agent-version`],ia={key:0,class:`dito-drag-overlay`};function aa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoDialog`),c=(0,e.resolveComponent)(`DitoNavigation`),l=(0,e.resolveComponent)(`DitoHeader`),u=(0,e.resolveComponent)(`DitoRouterView`),d=(0,e.resolveComponent)(`DitoAccount`),f=(0,e.resolveComponent)(`DitoSidebar`),p=(0,e.resolveComponent)(`DitoNotifications`),m=(0,e.resolveDirective)(`resize`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-root`,"data-agent-browser":t.appState.agent.browser,"data-agent-platform":t.appState.agent.platform,"data-agent-version":t.appState.agent.versionNumber},[(0,e.createVNode)(e.Transition,{name:`dito-drag`},{default:(0,e.withCtx)(()=>[t.isDraggingFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ia)):(0,e.createCommentVNode)(``,!0)]),_:1}),(0,e.createVNode)(e.TransitionGroup,{name:`dito-dialog`},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.dialogs,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,components:n.components,buttons:n.buttons,promise:n.promise,data:n.data,settings:n.settings,onRemove:e=>t.removeDialog(r)},null,8,[`components`,`buttons`,`promise`,`data`,`settings`,`onRemove`]))),128))]),_:1}),(0,e.createVNode)(c),(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`main`,{class:(0,e.normalizeClass)([`dito-page dito-scroll-parent`,t.pageClasses])},[(0,e.createVNode)(l,{spinner:t.options.spinner,isLoading:t.isLoading},null,8,[`spinner`,`isLoading`]),(0,e.createVNode)(u,{routeLevel:0})],2)),[[m,t.onResizePage]]),(0,e.createVNode)(f,null,{default:(0,e.withCtx)(()=>[t.user?((0,e.openBlock)(),(0,e.createBlock)(d,{key:0})):t.allowLogin?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,{key:1,class:`dito-login`,onClick:n[0]||=e=>t.rootComponent.login()},[...n[1]||=[(0,e.createElementVNode)(`span`,null,`Login`,-1)]])):(0,e.createCommentVNode)(``,!0)]),_:1}),(0,e.createVNode)(p,{ref:`notifications`},null,512)],8,ra)}var oa=B.component(`DitoRoot`,{mixins:[K],components:{DitoDialog:na},provide(){return{$views:()=>this.resolvedViews}},props:{unresolvedViews:{type:[Object,Function,Promise],required:!0},options:{type:Object,default:()=>({})}},data(){return{resolvedViews:{},removeRoutes:null,dialogs:{},pageWidth:0,loadingCount:0,allowLogin:!1,isDraggingFiles:!1}},computed:{notifications(){return this.isMounted&&this.$refs.notifications},isLoading(){return this.loadingCount>0},pageClasses(){let e=`dito-page`;return[this.appState.pageClass,{[`${e}--width-80`]:this.pageWidth<=720,[`${e}--width-60`]:this.pageWidth<=540}]}},created(){this.appState.title=document.title||`Dito.js Admin`,this.appState.routeComponents=[]},async mounted(){this.setupDragAndDrop(),(0,i.delegate)(this.$el,{target:`.dito-info`,theme:`info`,animation:`shift-away-subtle`,interactive:!0,delay:250,zIndex:1,appendTo:e=>e.closest(`.dito-pane`),onShow:e=>e.setContent(e.reference.dataset.info)}),this.domOn(document,{click:e=>{e.target.closest(`.dito-label`)||(this.appState.activeLabel=null)},keyup:e=>{e.code===`Tab`&&(this.appState.activeLabel=null)}});try{this.allowLogin=!1,await this.fetchUser()?await this.resolveViews():await this.login()}catch(e){console.error(e)}this.allowLogin=!0},methods:{setupDragAndDrop(){let e=0,t=[],n=e=>{for(let n of t)n.closest(`.dito-container`).classList.toggle(`dito-drop-target`,e);e||(t=[])},r=e=>{this.isDraggingFiles=e,e?n(!0):setTimeout(()=>n(!1),150)};this.domOn(document,{dragenter:n=>{if(!e&&n.dataTransfer){t=document.querySelectorAll(`.dito-upload`);let e=t.length>0;if(n.dataTransfer.effectAllowed=e?`copy`:`none`,e)r(!0);else{n.preventDefault(),n.stopPropagation();return}}e++},dragleave:t=>{e--,!e&&t.dataTransfer&&r(!1)},dragover:e=>{if(e.dataTransfer){let t=e.target.closest(`.dito-container:has(.dito-upload)`);e.dataTransfer.dropEffect=t?`copy`:`none`,t||(e.preventDefault(),e.stopPropagation())}},drop:t=>{e=0,t.dataTransfer&&r(!1)}})},notify({type:e=`info`,title:t,text:n,error:r,duration:i}={}){this.notifications.notify({type:e,title:t,text:n,error:r,duration:i})},closeNotifications(){this.notifications.destroyAll()},registerLoading(e){this.loadingCount+=e?1:-1},showDialog({components:e,buttons:t,data:n,settings:r}){return new Promise(async(i,a)=>{let o=[];if(await L(this.api,{type:`dialog`,components:e},o,0),o.length>0)throw Error(`Dialogs do not support components that produce routes`);let s=`dialog-${++sa}`;this.dialogs[s]={components:e,buttons:t,data:n,settings:r,promise:{resolve:i,reject:a}}})},removeDialog(e){delete this.dialogs[e]},async login(){this.allowLogin=!0;let{additionalComponents:e,redirectAfterLogin:t}=this.options.login||{},n=await this.showDialog({components:{username:{type:`text`,autofocus:!0},password:{type:`password`},...e},buttons:{login:{type:`submit`,text:`Login`},cancel:{type:`button`,text:`Cancel`}}});if(n)try{let e=await this.sendRequest({resource:this.api.users.login,data:n,internal:!0});t?location.replace(t):(this.setUser(e.data.user),await this.resolveViews())}catch(e){let t=e.response?.data?.error||e;this.notify({type:`error`,error:t,title:`Authentication Error`,text:t}),this.login()}},navigateHome(){return this.navigate(`/`)},async logout(){try{(await this.sendRequest({resource:this.api.users.logout,internal:!0})).data.success&&(this.setUser(null),this.navigateHome())}catch(e){console.error(e)}},async fetchUser(){let e=null;try{e=(await this.sendRequest({resource:this.api.users.session,internal:!0})).data.user||null}catch(e){let t=e.response?.data?.error||e;this.notify({type:`error`,error:t,title:`Authentication Error`,text:t})}return this.setUser(e),e},setUser(e){this.appState.user=e&&Object.setPrototypeOf(e,Pi.prototype),e||(this.resolvedViews={},this.navigateHome())},async ensureUser(){await this.fetchUser()||await this.login()},async resolveViews(){try{this.resolvedViews=await In(this.unresolvedViews)}catch(e){return e.request||console.error(e),this.login()}let e=await(0,r.mapConcurrently)(Object.entries(this.resolvedViews),([e,t])=>Hn(Zi,this.api,t,e)),{fullPath:t}=this.$route;this.removeRoutes?.(),this.removeRoutes=ca(this.$router,[{name:`root`,path:`/`,components:{}},...e.flat()]),this.$router.replace(t)},onResizePage({contentRect:{width:e}}){this.pageWidth=e}}}),sa=0;function ca(e,t){let n=[];for(let r of t)n.push(e.addRoute(r));return()=>{for(let e of n)e()}}var la=V(oa,[[`render`,aa]]),ua={class:`dito-menu__item`},da=[`href`,`aria-current`,`onClick`];function fa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoMenu`,!0),c=(0,e.resolveDirective)(`resize`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:`dito-menu`,style:(0,e.normalizeStyle)({"--width":t.width?`${t.width}px`:null})},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.items,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,ua,[t.shouldShowItem(n)?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-menu__link`,{"dito-menu__link--active":t.isActiveItem(n)}]),href:t.getItemHref(n),"aria-current":t.isActiveItem(n)?`page`:null,onClick:(0,e.withModifiers)(e=>t.onClickItem(n),[`prevent`,`stop`])},(0,e.toDisplayString)(t.getLabel(n)),11,da),n.items?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,class:`dito-menu__sub`,items:n.items,path:t.getItemPath(n,!1)},null,8,[`items`,`path`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0)]))),256))],4)),[[c,t.onResize]])}var pa=V(B.component(`DitoMenu`,{props:{items:{type:[Object,Array],default:()=>[]},path:{type:String,default:``}},data(){return{width:0}},methods:{shouldShowItem(e){return this.shouldRenderSchema(e)&&(!e.items||Object.values(e.items).some(this.shouldRenderSchema))},onResize({contentRect:{width:e}}){e&&(this.width=e)},getItemPath(e,t){let n=e.path?`${this.path}/${e.path}`:null;return t&&n&&e.items?`${n}${this.getItemPath(Object.values(e.items)[0],!1)}`:n},getItemHref(e){let t=this.getItemPath(e,!0);return t?this.$router.resolve(t).href:null},isActiveItem(e){return this.$route.path.startsWith(this.getItemPath(e,!1))||e.items&&Object.values(e.items).some(this.isActiveItem)},onClickItem(e){let t=this.getItemPath(e,!0);t&&this.$router.push({path:t,force:!0})}}}),[[`render`,fa]]),ma={class:`dito-trail`,"aria-label":`Breadcrumb`},ha=[`aria-current`,`href`,`onClick`];function ga(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ma,[(0,e.createElementVNode)(`ul`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.trail,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-trail__link`,{"dito-trail__link--active":n.path===t.$route.path}]),"aria-current":n.path===t.$route.path?`page`:null,href:t.getComponentHref(n),onClick:(0,e.withModifiers)(e=>t.onClickComponent(n),[`prevent`,`stop`])},[(0,e.createElementVNode)(`span`,{class:(0,e.normalizeClass)([`dito-trail__text`,{"dito-trail__text--dirty":n.isDirty}])},(0,e.toDisplayString)(n.breadcrumb),3)],10,ha)]))),256))]),(0,e.renderSlot)(t.$slots,`default`)])}var _a=V(B.component(`DitoTrail`,{computed:{trail(){return this.appState.routeComponents.filter(e=>!e.isLeavingRoute)}},methods:{getComponentRoutePath(e){let{schema:t}=e;return t.type===`menu`?Object.values(t.items)[0].fullPath:e.path},getComponentHref(e){return this.$router.resolve(this.getComponentRoutePath(e)).href},onClickComponent(e){this.$router.push({path:this.getComponentRoutePath(e),force:!0})}}}),[[`render`,ga]]),va=[`aria-busy`];function ya(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSpinner`),c=(0,e.resolveComponent)(`DitoTrail`);return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,{class:`dito-header`,"aria-busy":t.isLoading},[(0,e.createVNode)(c,null,{default:(0,e.withCtx)(()=>[t.isLoading?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,size:t.spinner?.size,color:t.spinner?.color},null,8,[`size`,`color`])):(0,e.createCommentVNode)(``,!0)]),_:1}),n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header__teleport`},null,-1),(0,e.renderSlot)(t.$slots,`default`)],8,va)}var ba=V(B.component(`DitoHeader`,{props:{spinner:{type:Object,default:null},isLoading:{type:Boolean,default:!1}}}),[[`render`,ya]]),xa={class:`dito-navigation dito-scroll-parent`,"aria-label":`Main navigation`};function Sa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`),c=(0,e.resolveComponent)(`DitoMenu`);return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,xa,[(0,e.createElementVNode)(`h1`,null,[(0,e.createVNode)(s,{class:`dito-link`,to:`/`},{default:(0,e.withCtx)(()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.appState.title),1)]),_:1})]),(0,e.createVNode)(c,{class:`dito-scroll`,items:t.views},null,8,[`items`])])}var Ca=V(B.component(`DitoNavigation`,{}),[[`render`,Sa]]),wa={class:`dito-notifications`,"aria-live":`polite`},Ta={class:`dito-notifications__inner`};function Ea(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueNotifications`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,wa,[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header`},[(0,e.createElementVNode)(`span`)],-1),(0,e.createElementVNode)(`div`,Ta,[(0,e.createVNode)(s,{ref:`notifications`,classes:`dito-notification`,dangerouslySetInnerHtml:!0,position:``,width:``},null,512)])])}var Da=V(B.component(`DitoNotifications`,{notifications(){return this.isMounted&&this.$refs.notifications},methods:{notify({type:e=`info`,title:t,text:n,error:i,duration:a}={}){t||={warning:`Warning`,error:`Error`,info:`Information`,success:`Success`}[e]||`Notification`,n=`<p>${(0,r.asArray)(n).join(`</p> <p>`)}</p>`.replace(/\n|\r\n|\r/g,`<br>`);let o={warning:`warn`,error:`error`,info:`log`,success:`log`}[e]||`error`;console[o]((0,r.stripHtml)(n),...e===`error`&&i?[i]:[]);let{notifications:s=!0}=this.api;if(s){let{durationFactor:r=20}=s;a??=(40+n.length+t.length)*r,this.$notify({type:e,title:t,text:n,duration:a===0?-1:a})}},destroyAll(){this.notifications.destroyAll()}}}),[[`render`,Ea]]),Oa={class:`dito-header`};function ka(t,n,r,i,a,o){let s=(0,e.resolveDirective)(`resize`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`aside`,{class:(0,e.normalizeClass)([`dito-sidebar dito-scroll-parent`,t.classes])},[(0,e.createElementVNode)(`nav`,Oa,[(0,e.renderSlot)(t.$slots,`default`)]),n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-sidebar__teleport dito-scroll`},null,-1)],2)),[[s,t.onResizeSidebar]])}var Aa=V(B.component(`DitoSidebar`,{data(){return{sidebarWidth:0}},computed:{classes(){let e=`dito-sidebar`;return{[`${e}--width-99`]:this.sidebarWidth<360,[`${e}--width-60`]:this.sidebarWidth<=216}}},methods:{onResizeSidebar({contentRect:{width:e}}){this.sidebarWidth=e}}}),[[`render`,ka]]),ja={mixins:[K],data(){return{pulldown:{open:!1,startTime:0,checkTime:!0,events:{mousedown:()=>{this.setPulldownOpen(!1),this.pulldown.handlers.remove()},mouseup:()=>{this.onPulldownMouseUp()&&this.pulldown.handlers.remove()}},handlers:null}}},computed:{pulldownTriggerAttributes(){return{"aria-haspopup":`menu`,"aria-expanded":this.pulldown.open}}},methods:{onPulldownMouseDown(e=null){e===null?(this.setPulldownOpen(!0),this.checkTime=!0):this.checkTime=!1},onPulldownMouseUp(e=null){let{startTime:t}=this.pulldown;if(!this.checkTime||t&&Date.now()-t>250)return this.setPulldownOpen(!1),e!==null&&this.onPulldownSelect(e),!0},onPulldownSelect(){},setPulldownOpen(e){this.pulldown.open=e,this.pulldown.startTime=e?Date.now():0,e&&(this.pulldown.handlers=this.domOn(document,this.pulldown.events))}}},Ma={class:`dito-account`},Na=[`onMousedown`,`onMouseup`];function Pa(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ma,[(0,e.createElementVNode)(`a`,(0,e.mergeProps)({role:`button`},t.pulldownTriggerAttributes,{onMousedown:n[0]||=(0,e.withModifiers)(e=>t.onPulldownMouseDown(),[`stop`])}),[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.user.username),1)],16),(0,e.createElementVNode)(`ul`,{class:(0,e.normalizeClass)([`dito-pulldown`,{"dito-pulldown--open":t.pulldown.open}]),role:`menu`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.items,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:`dito-pulldown__item`,role:`menuitem`,onMousedown:(0,e.withModifiers)(e=>t.onPulldownMouseDown(r),[`stop`]),onMouseup:e=>t.onPulldownMouseUp(r)},(0,e.toDisplayString)(n),41,Na)]))),256))],2)])}var Fa=V(B.component(`DitoAccount`,{mixins:[ja],data(){return{items:{settings:`Settings`,logout:`Logout`}}},methods:{onPulldownSelect(e){switch(e){case`logout`:this.rootComponent.logout();break;case`settings`:console.info(`TODO: Implement Settings`)}}}}),[[`render`,Pa]]);function Ia(t,n,r,i,a,o){return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-spinner`,role:`status`,"aria-label":`Loading`,style:(0,e.normalizeStyle)({"--color":t.color,"--size":t.size,"--margin":t.margin})},[...n[0]||=[(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse1`},null,-1),(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse2`},null,-1),(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse3`},null,-1)]],4)),[[e.vShow,t.loading]])}var La=V(B.component(`DitoSpinner`,{props:{loading:{type:Boolean,default:!0},color:{type:String,default:null},size:{type:String,default:null},margin:{type:String,default:null}}}),[[`render`,Ia]]);function Ra(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSpinner`),c=(0,e.resolveComponent)(`DitoIcon`);return t.item.type===`text`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.as||`div`),{key:0},{default:(0,e.withCtx)(()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.item.text),1)]),_:1})):t.item.type===`html`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.as||`div`),{key:1,innerHTML:t.item.html},null,8,[`innerHTML`])):t.item.type===`spinner`?((0,e.openBlock)(),(0,e.createBlock)(s,{key:2,size:t.item.size,color:t.item.color},null,8,[`size`,`color`])):t.item.type===`icon`?((0,e.openBlock)(),(0,e.createBlock)(c,{key:3,name:t.item.name,disabled:t.item.disabled},null,8,[`name`,`disabled`])):t.item.type===`component`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.component),(0,e.normalizeProps)((0,e.mergeProps)({key:4},t.item.props)),null,16)):(0,e.createCommentVNode)(``,!0)}var za=V(B.component(`DitoAffix`,{components:{DitoSpinner:La,DitoIcon:U},props:{item:{type:Object,required:!0},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext}}}),[[`render`,Ra]]),Ba=[`disabled`],Va=[`data-info`];function Ha(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffix`);return t.hasContent?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-affixes`,t.classes])},[(0,e.renderSlot)(t.$slots,`prepend`),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.visibleItems,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{class:(0,e.normalizeClass)([`dito-affix`,t.getItemClasses(n)]),key:r,style:(0,e.normalizeStyle)(n.style),item:n,parentContext:t.parentContext},null,8,[`class`,`style`,`item`,`parentContext`]))),128)),t.clearable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-affixes__clear`,type:`button`,title:`Clear`,disabled:t.disabled,onClick:n[0]||=(0,e.withModifiers)(e=>t.$emit(`clear`),[`stop`]),onMousedown:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},null,40,Ba)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`append`),t.inlineInfo?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.inlineInfo},null,8,Va)):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)}var q=V(B.component(`DitoAffixes`,{components:{DitoAffix:za},emits:[`clear`],props:{items:{type:[String,Object,Array],default:null},mode:{type:String,default:null},position:{type:String,default:null},absolute:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},inlineInfo:{type:String,default:null},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext},processedItems(){return(0,r.asArray)(this.items).filter(Boolean).map(e=>(0,r.isString)(e)?{type:`text`,text:e}:e.type?e:e.text==null?e.html==null?e:{type:`html`,...e}:{type:`text`,...e})},visibleItems(){return this.processedItems.filter(e=>j(e,this.context))},classes(){let e=`dito-affixes`;return{[`${e}--${this.position}`]:this.position,[`${e}--${this.mode}`]:this.mode,[`${e}--absolute`]:this.absolute}},hasContent(){return this.visibleItems.length>0||this.clearable||this.inlineInfo||or(this.$slots.prepend)||or(this.$slots.append)}},methods:{getItemClasses(e){let t=`dito-affix`;return[{[`${t}--${e.type}`]:e.type,[`${t}--ellipsis`]:this.mode===`ellipsis`&&[`text`,`html`].includes(e.type)},e.class]}}}),[[`render`,Ha]]),Ua={key:1,class:`dito-label__inner`},Wa=[`for`,`innerHTML`],Ga=[`data-info`];function Ka(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`);return t.text||t.collapsible?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.collapsible?`button`:`div`),(0,e.mergeProps)({key:0,class:`dito-label`,type:t.collapsible?`button`:null},t.attributes,{class:{"dito-label--active":t.isActive}}),{default:(0,e.withCtx)(()=>[t.collapsible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-chevron`,{"dito-chevron--open":!t.collapsed}])},null,2)):(0,e.createCommentVNode)(``,!0),t.text||t.prefixes.length>0||t.suffixes.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ua,[(0,e.createVNode)(s,{items:t.prefixes,position:`prefix`,parentContext:t.context},null,8,[`items`,`parentContext`]),t.text?((0,e.openBlock)(),(0,e.createElementBlock)(`label`,{key:0,for:t.htmlFor,innerHTML:t.text},null,8,Wa)):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(s,{items:t.suffixes,mode:`ellipsis`,position:`suffix`,parentContext:t.context},null,8,[`items`,`parentContext`]),t.info?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.info},null,8,Ga)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`type`,`class`])):(0,e.createCommentVNode)(``,!0)}var qa=V(B.component(`DitoLabel`,{components:{DitoAffixes:q},emits:[`open`],props:{label:{type:[String,Object],default:null},htmlFor:{type:String,default:null},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},info:{type:String,default:null}},computed:{text(){let{label:e}=this;return(0,r.isObject)(e)?e?.text:e},prefixes(){return(0,r.asArray)(this.label?.prefix)},suffixes(){return(0,r.asArray)(this.label?.suffix)},attributes(){return this.collapsible?{onClick:this.onClick,"aria-expanded":!this.collapsed}:{}},isActive(){return this.appState.activeLabel===this}},methods:{onClick(){this.appState.activeLabel=this,this.$emit(`open`,this.collapsed)}}}),[[`render`,Ka]]),Ja={methods:{getItemFormSchema:Vt,getItemUid:dn,getItemId(e,t,n=null){return this.isTransient&&n!==null?String(n):cn(e,t)},getItemDataPath(e,t){let{dataPath:n}=this;return e!==this.schema&&(n=y(n,e.name)),t!=null&&(n=y(n,t)),n},getItemStore(e,t,n){return this.getChildStore(this.getItemUid(e,t),n)},removeItemStore(e,t,n){this.removeChildStore(this.getItemUid(e,t),n)},findItemIdIndex(e,t,n){let r=this.isTransient?n:t?.findIndex((t,r)=>this.getItemId(e,t,r)===n);return r===-1?null:r},getItemLabel(e,t,{index:n=null,extended:i=!1,asObject:a=!1}={}){let{itemLabel:o}=e;if(!t||!i&&o===!1)return null;let s,c=()=>s??=this.getItemDataPath(e,n),l,u=()=>l??=this.getLabel(Vt(e,t,this.context)),d,f,p;if((0,r.isFunction)(o)){let e=o.call(this,new E(this,{nested:!1,data:t,value:t,index:n,get dataPath(){return c()},get formLabel(){return u()}}));(0,r.isObject)(e)?{text:d,prefix:f,suffix:p}=e:d=e,i=!1}else if((0,r.isString)(o)&&!(o in t))d=o;else{let{columns:n}=e,i=t[(0,r.isString)(o)&&o||w(e)&&n&&Object.keys(n)[0]||`name`];d=(0,r.isString)(i)||(0,r.isNumber)(i)?i:null}let m=!!d;if(d??=(i=!0,w(e)&&n!==null?`${n+1}`:``),i){let e=u();e&&(d=`${e} ${m?`'${d}'`:d}`)}return a?d||f||p?{text:d,prefix:f,suffix:p}:null:d}}},Ya={key:0,class:`dito-schema-header`};function Xa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanels`),c=(0,e.resolveComponent)(`DitoLabel`),l=(0,e.resolveComponent)(`DitoTabs`),u=(0,e.resolveComponent)(`DitoClipboard`),d=(0,e.resolveComponent)(`DitoPane`),f=(0,e.resolveComponent)(`TransitionHeight`);return(0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[(0,e.renderSlot)(t.$slots,`prepend`),(0,e.createElementVNode)(`div`,(0,e.mergeProps)({class:[`dito-schema`,{"dito-scroll-parent":t.scrollable,"dito-schema--open":t.opened}]},t.$attrs),[t.isPopulated&&t.panelEntries.length>0?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:0,to:`.dito-sidebar__teleport`},[t.active?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,panels:t.panelEntries,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),t.hasHeader?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:1,to:t.headerTeleport,disabled:!t.headerTeleport},[t.active?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ya,[t.hasLabel?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,label:t.label,info:t.info,collapsible:t.collapsible,collapsed:!t.opened,onOpen:t.onOpen},null,8,[`label`,`info`,`collapsible`,`collapsed`,`onOpen`])):(0,e.createCommentVNode)(``,!0),t.tabs?((0,e.openBlock)(),(0,e.createBlock)(e.Transition,{key:1,name:`dito-fade`},{default:(0,e.withCtx)(()=>[t.opened?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,modelValue:t.selectedTab,"onUpdate:modelValue":n[0]||=e=>t.selectedTab=e,tabs:t.renderedTabs},null,8,[`modelValue`,`tabs`])):(0,e.createCommentVNode)(``,!0)]),_:1})):(0,e.createCommentVNode)(``,!0),t.clipboard?((0,e.openBlock)(),(0,e.createBlock)(u,{key:2,clipboard:t.clipboard,schema:t.schema},null,8,[`clipboard`,`schema`])):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`edit-buttons`)])):(0,e.createCommentVNode)(``,!0)],8,[`to`,`disabled`])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(f,{enabled:t.inlined},{default:(0,e.withCtx)(()=>[t.opened?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-schema-content`,{"dito-scroll":t.scrollable}]),ref:`content`},[t.hasTabs?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.tabs,(n,r)=>(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(d,{key:r,class:`dito-pane__tab`,ref_for:!0,ref:`tabs`,tab:r,schema:n,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.padding,single:t.single&&!t.inlined&&!t.hasMainPane,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,accumulatedBasis:t.accumulatedBasis},null,8,[`tab`,`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`,`accumulatedBasis`])),[[e.vShow,t.selectedTab===r]])),128)):(0,e.createCommentVNode)(``,!0),t.hasMainPane?((0,e.openBlock)(),(0,e.createBlock)(d,{key:1,class:`dito-pane__main`,ref:`components`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.padding,single:t.single&&!t.inlined&&!t.hasTabs,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,accumulatedBasis:t.accumulatedBasis},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`,`accumulatedBasis`])):(0,e.createCommentVNode)(``,!0),!t.inlined&&t.isPopulated?(0,e.renderSlot)(t.$slots,`buttons`,{},void 0,void 0,2):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)]),_:3},8,[`enabled`]),t.inlined&&!t.hasHeader?(0,e.renderSlot)(t.$slots,`edit-buttons`,{},void 0,void 0,2):(0,e.createCommentVNode)(``,!0)],16),(0,e.renderSlot)(t.$slots,`append`)],64)}var Za=B.component(`DitoSchema`,{mixins:[P,Ja],components:{TransitionHeight:Ai},inheritAttrs:!1,provide(){return{$schemaComponent:()=>this}},inject:[`$schemaParentComponent`],props:{schema:{type:Object,required:!0},dataSchema:{type:Object,default:e=>e.schema},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},label:{type:[String,Object],default:null},info:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},active:{type:Boolean,default:!0},inlined:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},hasOwnData:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},labelNode:{type:HTMLElement,default:null},accumulatedBasis:{type:Number,default:1}},data(){let{data:e}=this.schema;return{...e&&(0,r.isFunction)(e)?e(this.context):e,selectedTab:null,componentsRegistry:{},unnestedComponentsRegistry:{},panesRegistry:{},panelsRegistry:{},scrollPositions:{}}},computed:{nested(){return!1},schemaComponent(){return this},parentSchemaComponent(){return this.hasOwnData?null:this.parentComponent.schemaComponent},panelEntries(){return Gt(this.schema.panels,this.dataPath,this.componentPath)},tabs(){return k(this.schema.tabs)},renderedTabs(){return this.tabs&&this.data?Object.fromEntries(Object.entries(this.tabs).filter(([,e])=>this.shouldRenderSchema(e))):this.tabs},defaultTab(){let e=null;if(this.renderedTabs){let t=Object.values(this.renderedTabs);for(let{name:n,defaultTab:i}of t){if((0,r.isFunction)(i)?i(this.context):i)return n;e??=n}}return e},routeTab(){return this.$route.hash?.slice(1)||null},clipboard(){return this.schema?.clipboard??null},hasHeader(){return this.hasLabel||this.hasTabs||!!this.clipboard},headerTeleport(){return this.isTopLevelSchema?`.dito-header__teleport`:this.labelNode},processedData(){return this.processData({target:`server`,schemaOnly:!0})},clipboardData:{get(){return this.processData({target:`clipboard`,schemaOnly:!0})},set(e){this.setData(e)}},clipboardItem(){return this.clipboardData},formLabel(){return this.getLabel(this.getItemFormSchema(this.sourceSchema,this.data,this.context))},isDirty(){return this.someComponent(e=>e.isDirty)},isTouched(){return this.someComponent(e=>e.isTouched)},isValid(){return this.everyComponent(e=>e.isValid)},isValidated(){return this.everyComponent(e=>e.isValidated)},hasErrors(){return this.someComponent(e=>e.hasErrors)},hasData(){return!!this.data},hasLabel(){return!!this.label||this.collapsible},hasTabs(){return!!this.tabs},isTopLevelSchema(){return!at(this.schema)&&!this.inlined},hasTopLevelTabs(){return this.hasTabs&&this.isTopLevelSchema},hasMainPane(){let{components:e}=this.schema;return!!e&&Object.keys(e).length>0},opened:Mn(`opened`,{default(){return!this.collapsed}}),components(){return Object.values(this.componentsRegistry)},unnestedComponents(){return Object.values(this.unnestedComponentsRegistry)},panes(){return Object.values(this.panesRegistry)},panels(){return Object.values(this.panelsRegistry)},componentsByDataPath(){return this._listEntriesByDataPath(this.componentsRegistry)},panesByDataPath(){return this._listEntriesByDataPath(this.panesRegistry)},panelsByDataPath(){return this._listEntriesByDataPath(this.panelsRegistry)},wide:F(`wide`,{type:Boolean,default:!1})},watch:{schema:{immediate:!0,handler(e){Ht(e)||this.setupSchema()}},routeTab:{immediate:!0,flush:`post`,handler(e){this.hasTopLevelTabs&&(this.selectedTab=e)}},selectedTab(e,t){if(this.scrollable){let{content:n}=this.$refs;this.scrollPositions[t]=n.scrollTop,this.$nextTick(()=>{n.scrollTop=this.scrollPositions[e]??0})}if(this.hasTopLevelTabs){let t=!e||e in this.renderedTabs?e:this.defaultTab;this.$router.replace({query:this.$route.query,hash:t?`#${t}`:null})}this.hasErrors&&this.repositionErrors()}},created(){this._register(!0),this.scrollable&&this.wide&&(this.appState.pageClass=`dito-page--wide`)},mounted(){this.selectedTab=this.routeTab||this.defaultTab},unmounted(){this.emitEvent(`destroy`),this._register(!1),this.scrollable&&this.wide&&(this.appState.pageClass=null)},methods:{setupSchema(){this.setupSchemaFields(),this.delegate(`change`,this.parentSchemaComponent),this.emitEvent(`initialize`)},getComponentsByDataPath(e){return this._getEntriesByDataPath(this.componentsByDataPath,e)},getComponentByDataPath(e){return this.getComponentsByDataPath(e)[0]||null},getComponentsByName(e){return this._getEntriesByName(this.componentsByDataPath,e)},getComponentByName(e){return this.getComponentsByName(e)[0]||null},getComponents(e){return this._getEntries(this.componentsByDataPath,e)},getComponent(e){return this.getComponents(e)[0]||null},getPanelsByDataPath(e){return this._getEntriesByDataPath(this.panelsByDataPath,e)},getPanelByDataPath(e){return this.getPanelsByDataPath(e)[0]||null},getPanels(e){return this._getEntries(this.panelsByDataPath,e)},getPanel(e){return this.getPanels(e)[0]||null},someComponent(e){return this.isPopulated&&this.components.some(e)},everyComponent(e){return this.isPopulated&&this.components.every(e)},onOpen(e){this.emitEvent(`open`,{context:{open:e}}),this.opened=e},onChange(){this.emitEvent(`change`)},resetValidation(){for(let e of this.components)e.resetValidation()},clearErrors(){for(let e of this.components)e.clearErrors()},repositionErrors(){let e=this.$refs.content.closest(`.dito-scroll`),t=()=>e.dispatchEvent(new Event(`scroll`));t(),setTimeout(t,0)},focus(){return this.opened=!0,this.parentSchemaComponent?.focus()},validateAll(e,t=!0){let n=this.hasData?kn(this.schema,this.data,{dataPath:this.dataPath,component:this,rootData:this.rootData}):null,r=e?An(n,e):n;return t&&(r?this._showValidationErrorsByFullDataPath(r,!0,!0).catch(console.error):this.clearErrors()),!r},verifyAll(e){return this.validateAll(e,!1)},async showValidationErrors(e,t,n=!0){let i=Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,r.normalizeDataPath)(this.hasOwnData?y(this.dataPath,e):e),t]));return this._showValidationErrorsByFullDataPath(i,t,n)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let{opened:i}=this;i||(this.opened=!0,await this.$nextTick());let a=[],o=e=>{let n=t?.(e)??!0;return n&&a.push(...e),n},s=async t=>{for(let r of t){let t=`${r.componentPath}/`;a.some(e=>e.componentPath.startsWith(t))||await r.navigateToComponent?.(e,o,{shouldRevealInlinedOnly:n||a.length>0})}},c=this.getComponentsByDataPath(e);c.length>0&&o(c);let l=(0,r.parseDataPath)(e),u=(0,r.parseDataPath)(this.dataPath).length;for(;l.length>u+1;)l.pop(),await s(this.getComponentsByDataPath(l));await s(this.unnestedComponents);let d=a.length>0;return d||(this.opened=i),d},async _showValidationErrorsByFullDataPath(e,t,n){this.clearErrors();let i=[],a=n;for(let[a,o]of Object.entries(e)){let s=null,c=[],l=await this.navigateToComponent(a,e=>{for(let t of e)t.isForm?s=t:c.push(t);return!0});if(Qa(c).forEach((e,r)=>{e.showValidationErrors(o,n&&t&&!s&&r===0)}),s){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e===s.dataPath||e.startsWith(`${s.dataPath}/`)));return s.showValidationErrors(r,n&&t)}if(!l){let e=(0,r.labelize)((0,r.parseDataPath)(a).pop());for(let t of o){let n=e?`The field ${e}`:`The ${this.formLabel}`;i.push(`${n} ${t.message}`)}}n=!1}return a&&!n&&this.notifyErrors(i.join(`
2
- `)),!n},notifyErrors(e){this.notify({type:`error`,title:`Validation Errors`,text:e||`Please correct the highlighted errors.`})},resetData(){Object.assign(this.data,tn(this.dataSchema,{},this)),this.clearErrors()},setData(e){for(let t in e)if(t in this.data&&!(0,r.equals)(this.data[t],e[t])){this.data[t]=e[t];for(let e of this.getComponentsByName(t))e.markDirty()}return this.data},filterData(e){let t={},n={};for(let[i,a]of Object.entries(e)){if(((0,r.isArray)(a)||(0,r.isObject)(a))&&this.getComponentsByName(i).some(e=>e.providesData)){n[i]=a;continue}t[i]=a}return{localData:t,foreignData:n}},processData({target:e=`clipboard`,schemaOnly:t=!0}={}){return on(this.dataSchema,this.sourceSchema,this.data,this.dataPath,{rootData:this.rootData,component:this,schemaOnly:t,target:e})},_register(e){this.$schemaParentComponent()?._registerSchemaComponent(this,e)},_registerComponent(e,t,n){this._registerEntry(this.componentsRegistry,e,t,n),this.parentSchemaComponent?._registerComponent(e,t,n)},_registerUnnestedComponent(e,t,n){this._registerEntry(this.unnestedComponentsRegistry,e,t,n)},_registerPane(e,t,n){this._registerEntry(this.panesRegistry,e,t,n)},_registerPanel(e,t,n){this._registerEntry(this.panelsRegistry,e,t,n)},_registerEntry(e,t,n,r=t.componentPath){n?e[r]=t:e[r]===t&&delete e[r]},_listEntriesByDataPath(e){return Object.values(e).reduce((e,t)=>{let{dataPath:n}=t;return(e[n]||=[]).push(t),e},{})},_getEntries(e,t){return(0,r.normalizeDataPath)(t).startsWith(this.dataPath)?this._getEntriesByDataPath(e,t):this._getEntriesByName(e,t)},_getEntriesByDataPath(e,t){return Qa(e[(0,r.normalizeDataPath)(t)]||[])},_getEntriesByName(e,t){return Qa(e[y(this.dataPath,t)]||[])}}});function Qa(e){return e.length>1?[...e].sort($a):e}function $a(e,t){let n=e.$el,r=t.$el;return!n||!r||n===r?0:n.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var eo=V(Za,[[`render`,Xa]]);function to(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoEditButtons`),c=(0,e.resolveComponent)(`DitoSchema`);return(0,e.openBlock)(),(0,e.createBlock)(c,{class:`dito-schema-inlined`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,label:t.isCompact?null:t.label,info:t.info,padding:t.padding??`inlined`,inlined:!0,disabled:t.disabled,compact:t.isCompact,collapsed:t.collapsed,collapsible:t.collapsible,generateLabels:!t.isCompact,labelNode:t.labelNode,accumulatedBasis:t.accumulatedBasis},{"edit-buttons":(0,e.withCtx)(()=>[t.deletable||t.draggable||t.editable||t.insertIndex!=null?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled,deletable:t.deletable,draggable:t.draggable,editable:t.editable,editPath:t.editPath,creatable:t.insertIndex!=null,createPath:t.createPath,insertIndex:t.insertIndex,onDelete:n[0]||=e=>t.$emit(`delete`)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`creatable`,`createPath`,`insertIndex`])):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`compact`,`collapsed`,`collapsible`,`generateLabels`,`labelNode`,`accumulatedBasis`])}var no=V(B.component(`DitoSchemaInlined`,{emits:[`delete`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},label:{type:[String,Object],default:null},info:{type:String,default:null},padding:{type:String,default:null},disabled:{type:Boolean,required:!0},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null},labelNode:{type:HTMLElement,default:null},accumulatedBasis:{type:Number,default:null}},computed:{isCompact(){return ut(this.schema)},hasLabel(){return!this.isCompact&&!!this.label}}}),[[`render`,to]]),ro=[`id`,`role`,`aria-labelledby`],io={key:0,class:`dito-pane__break`},ao={key:2,class:`dito-pane__break`};function oo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoContainer`),c=(0,e.resolveDirective)(`resize`);return t.isPopulated&&t.componentSchemas.length>0?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-pane`,t.classes]),id:t.tabPanelId,role:t.tab?`tabpanel`:null,"aria-labelledby":t.tabId},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.componentSchemas,({schema:n,dataPath:r,nestedDataPath:i,nested:a,store:o},c)=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[[`before`,`both`].includes(n.break)?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,io)):(0,e.createCommentVNode)(``,!0),t.shouldRenderComponent(n,a,r)?((0,e.openBlock)(),(0,e.createBlock)(s,{ref_for:!0,ref:`containers`,key:i,"data-index":c,schema:n,dataPath:r,data:t.data,meta:t.meta,store:o,single:t.isSingleComponent,nested:a,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,verticalLabels:t.isInLabeledRow(c),accumulatedBasis:t.accumulatedBasis},null,8,[`data-index`,`schema`,`dataPath`,`data`,`meta`,`store`,`single`,`nested`,`disabled`,`compact`,`generateLabels`,`verticalLabels`,`accumulatedBasis`])):(0,e.createCommentVNode)(``,!0),[`after`,`both`].includes(n.break)?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,ao)):(0,e.createCommentVNode)(``,!0)],64))),256))],10,ro)),[[c,t.onResizePane]]):(0,e.createCommentVNode)(``,!0)}var so=V(B.component(`DitoPane`,{mixins:[P],provide(){return{$tabComponent:()=>this.tabComponent}},props:{schema:{type:Object,required:!0},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},tab:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},accumulatedBasis:{type:Number,default:null}},data(){return{positions:[]}},computed:{nested(){return!1},classes(){let e=`dito-pane`;return{[`${e}--single`]:this.isSingleComponent,[`${e}--padding-${this.padding}`]:!!this.padding}},tabComponent(){return this.tab?this:this.$tabComponent()},componentPath(){let{componentPath:e}=this.parentComponent;return this.tab?y(e,this.tab):e},tabId(){let{componentPath:e}=this.schemaComponent;return this.tab?`${e}-tab-${this.tab}`:null},tabPanelId(){let{componentPath:e}=this.schemaComponent;return this.tab?`${e}-tabpanel-${this.tab}`:null},componentSchemas(){let e=this.sourceSchema?.wrapPrimitives;return Object.entries(this.schema?.components||{}).map(([t,n])=>{n={...n,name:t};let r=S(n),i=y(this.dataPath,t),a=r&&!e?i:this.dataPath;return{schema:n,dataPath:a,nestedDataPath:i,nested:r,store:this.getChildStore(t)}})},isSingleComponent(){return this.single&&this.componentSchemas.length===1},verticalLabelsByIndices(){let{positions:e}=this,t=t=>e[t]&&(t===e.length-1||n(t).top>e[t].top),n=t=>{for(let n=t+1;n<e.length;n++)if(e[n])return e[n];return 0},r=[],i=[];for(let n=0;n<e.length;n++)i.push(n),t(n)&&(r.push(i),i=[]);i.length>0&&r.push(i);let a=[];for(let e of r){let t=!1;for(let n of e){let e=this.positions[n];if(e?.height>2&&(e.node.matches(`:has(> .dito-label)`)||e.node.closest(`.dito-container`).matches(`.dito-container--label-vertical`))){t=!0;break}}for(let n of e)a[n]=t}return a}},watch:{"componentSchemas.length"(e){this.positions.length=e},componentPath(e,t){this._register(!1,t),this._register(!0,e)}},created(){this._register(!0)},unmounted(){this._register(!1)},methods:{shouldRenderComponent(e,t,n){return j(e,E.createForSchema(this,{schema:e,name:e.name,nested:t,data:this.data,dataPath:n,rootData:this.rootData}))},_register(e,t=this.componentPath){this.schemaComponent._registerPane(this,e,t)},focus(){if(this.tab)return this.$router.push({hash:`#${this.tab}`})},onResizePane(){this.$nextTick(()=>{for(let e of this.$refs.containers??[]){let t=e.$el,n=+t.dataset.index,r=t.getBoundingClientRect(),i=getComputedStyle(t),a=parseFloat(i.padding),o=parseFloat(i.fontSize),s=r.height-2*a;this.positions[n]=s<=0?null:{top:r.y,height:s/o,node:t}}})},isInLabeledRow(e){return!!this.verticalLabelsByIndices[e]}}}),[[`render`,oo]]);function co(e){let t=(0,r.isString)(e)&&e.match(/^\s*([+-]?\d+)\s*\/\s*([+-]?\d+)\s*$/);if(t){let[,e,n]=t;return parseFloat(e)/parseFloat(n)}return parseFloat(e)}function lo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanels`),c=(0,e.resolveComponent)(`DitoLabel`),l=(0,e.resolveComponent)(`DitoErrors`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-container`,t.containerClasses]),style:(0,e.normalizeStyle)(t.containerStyles)},[t.isMounted&&t.panelEntries.length>0?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:0,to:`.dito-sidebar__teleport`},[(0,e.createVNode)(s,{panels:t.panelEntries,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])])):(0,e.createCommentVNode)(``,!0),t.hasLabel?((0,e.openBlock)(),(0,e.createBlock)(c,{key:1,class:(0,e.normalizeClass)(t.labelClasses),htmlFor:t.labelHtmlFor,label:t.label,info:t.info},null,8,[`class`,`htmlFor`,`label`,`info`])):(0,e.createCommentVNode)(``,!0),t.hasLabel&&t.isLabel?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.typeComponent),{key:2,class:(0,e.normalizeClass)([`dito-component`,t.componentClasses]),ref:`component`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,width:t.width,label:t.label,single:t.single,nested:t.nested,accumulatedBasis:t.combinedBasis,onErrors:t.onErrors,"onUpdate:component":n[0]||=e=>t.component=e},null,40,[`class`,`schema`,`dataPath`,`data`,`meta`,`store`,`width`,`label`,`single`,`nested`,`accumulatedBasis`,`onErrors`])),(0,e.createVNode)(l,{errors:t.errors},null,8,[`errors`])],6)),[[e.vShow,t.componentVisible]])}var uo=V(B.component(`DitoContainer`,{mixins:[fn,P],props:{schema:{type:Object,required:!0},dataPath:{type:String,default:``},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},disabled:{type:Boolean,required:!0},compact:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},verticalLabels:{type:Boolean,default:!1},accumulatedBasis:{type:Number,default:null}},data(){return{errors:null,component:null}},computed:{context(){return new E(this.component??this,{nested:this.nested})},name(){return this.schema.name},componentPath(){return y(this.parentComponent.componentPath,this.name)},type(){return this.schema.type},typeComponent(){return qe(this.type)},isLabel(){return this.type===`label`},hasLabel(){return ft(this.schema,this.generateLabels)},label(){return this.hasLabel?this.getLabel(this.schema):null},labelHtmlFor(){return this.nested?this.componentPath:null},info:F(`info`,{type:String,default:null}),width:F(`width`,{type:[String,Number],default(){return this.typeComponent?.defaultWidth},get(e){return e===void 0?1:(0,r.isString)(e)?e.match(/^\s*[<>]?\s*(.*)$/)[1]:e}}),widthOperator:F(`width`,{type:String,get(e){return(0,r.isString)(e)&&e.match(/^\s*([<>]?)/)[1]||null}}),componentVisible:F(`visible`,{type:Boolean,default(){return this.typeComponent?.defaultVisible}}),componentDisabled:F(`disabled`,{type:Boolean,default:!1,get(e){return e||this.disabled}}),flexGrow(){return this.widthOperator===`>`||this.width===`fill`},flexShrink(){return this.widthOperator===`<`},flexBasis(){let e=this.width;return[null,`auto`,`fill`].includes(e)?`auto`:/%$/.test(e)?parseFloat(e)/100:/[a-z]/.test(e)?e:co(e)},combinedBasis(){let{accumulatedBasis:e,flexBasis:t}=this;return(0,r.isNumber)(e)&&(0,r.isNumber)(t)?e*t:null},containerClasses(){let{class:e}=this.schema,t=`dito-container`;return{[`${t}--disabled`]:this.componentDisabled,[`${t}--has-errors`]:!!this.errors,[`${t}--single`]:this.single,[`${t}--compact`]:this.compact,[`${t}--label-vertical`]:this.verticalLabels,[`${t}--omit-spacing`]:pt(this.schema),...(0,r.isString)(e)?{[e]:!0}:e}},containerStyles(){let{flexBasis:e,combinedBasis:t}=this;return{"--grow":+!!this.flexGrow,"--shrink":+!!this.flexShrink,"--basis":(0,r.isNumber)(e)?`${e*100}%`:e,"--basis-mobile":(0,r.isNumber)(t)&&t<=.25?`${e*200}%`:null}},componentClasses(){return{"dito-component--single":this.single,...this.getLayoutClasses(`dito-component`)}},labelClasses(){return{"dito-label--visible":this.isLabel,...this.getLayoutClasses(`dito-label`)}},panelEntries(){return Kt(this.api,this.schema,this.dataPath,this.nested?this.componentPath:this.parentComponent.componentPath,this.componentPath,this.$refs.component,this.tabComponent)}},methods:{getLayoutClasses(e){return{[`${e}--fill`]:this.width===`fill`||this.flexBasis!==`auto`,[`${e}--grow`]:this.flexGrow,[`${e}--shrink`]:this.flexShrink}},onErrors(e){this.errors=e}}}),[[`render`,lo]]),fo={class:`dito-tabs`,role:`tablist`},po=[`id`,`aria-selected`,`aria-controls`,`tabindex`,`onClick`];function mo(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,fo,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.tabs,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`a`,{class:(0,e.normalizeClass)([`dito-tabs__link`,{"dito-tabs__link--active":t.modelValue===r}]),id:t.getTabId(r),key:r,role:`tab`,"aria-selected":t.modelValue===r,"aria-controls":t.getTabPanelId(r),tabindex:t.modelValue===r?0:-1,onClick:e=>t.$emit(`update:modelValue`,r)},(0,e.toDisplayString)(t.getLabel(n,r)),11,po))),128))])}var ho=V(B.component(`DitoTabs`,{emits:[`update:modelValue`],props:{tabs:{type:Object,default:null},modelValue:{type:String,default:null}},methods:{getTabId(e){return`${this.schemaComponent.componentPath}-tab-${e}`},getTabPanelId(e){return`${this.schemaComponent.componentPath}-tabpanel-${e}`}}}),[[`render`,mo]]);function go(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoButtons`),c=(0,e.resolveComponent)(`DitoSchema`);return t.shouldRenderSchema(t.panelSchema)?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.panelTag),{key:0,class:`dito-panel`,role:`region`,"aria-label":t.getLabel(t.schema),onSubmit:n[0]||=(0,e.withModifiers)(()=>{},[`prevent`])},{default:(0,e.withCtx)(()=>[(0,e.createVNode)(c,{class:`dito-panel__schema`,schema:t.panelSchema,dataSchema:t.panelDataSchema,dataPath:t.panelDataPath,data:t.panelData,meta:t.meta,store:t.store,padding:`nested`,disabled:t.disabled,hasOwnData:t.hasOwnData,generateLabels:``},{prepend:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`h2`,{class:(0,e.normalizeClass)([`dito-panel__header`,{"dito-panel__header--sticky":t.sticky}])},[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabel(t.schema)),1),(0,e.createVNode)(s,{class:`dito-buttons--small`,buttons:t.panelButtonSchemas,buttonsName:`panelButtons`,dataPath:t.panelDataPath,data:t.panelData,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])],2)]),buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{buttons:t.buttonSchemas,dataPath:t.panelDataPath,data:t.panelData,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataSchema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`hasOwnData`])]),_:1},40,[`aria-label`])),[[e.vShow,t.visible&&(!t.panelTabComponent||t.panelTabComponent.visible)]]):(0,e.createCommentVNode)(``,!0)}var _o=V(B.component(`DitoPanel`,{mixins:[P,Ii],provide(){return{$panelComponent:()=>this,$tabComponent:()=>this.panelTabComponent}},props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0},panelTabComponent:{type:Object,default:null},panelComponentPath:{type:String,required:!0}},data(){return{ownData:null}},computed:{nested(){return!0},context(){return new E(this,{nested:!1,data:this.panelData,dataPath:this.panelDataPath})},panelComponent(){return this},componentPath(){return this.panelComponentPath},tabComponent(){return this.panelTabComponent},buttonSchemas(){return Ut(this.schema.buttons)},panelButtonSchemas(){return Ut(this.schema.panelButtons)},hasOwnData(){return!!this.ownData},panelData(){return this.ownData||this.data},panelSchema(){if(this.hasOwnData)return this.schema;{let{data:e,...t}=this.schema;return t}},panelTag(){return this.hasOwnData?`form`:`div`},panelDataSchema(){return this.hasOwnData?this.schema:this.schemaComponent.schema},panelDataPath(){return this.hasOwnData?this.dataPath:this.schemaComponent.dataPath},visible:F(`visible`,{type:Boolean,default:!0}),sticky:F(`sticky`,{type:Boolean,default:!1})},watch:{componentPath(e,t){this._register(!1,t),this._register(!0,e)}},created(){this._register(!0);let{data:e}=this.schema;e&&(this.ownData=(0,r.isFunction)(e)?e(this.context):e)},unmounted(){this._register(!1)},methods:{_register(e,t=this.componentPath){this.schemaComponent._registerPanel(this,e,t)}}}),[[`render`,go]]),vo={key:0,class:`dito-panels`};function yo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanel`);return t.panels.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,vo,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.panels,({schema:n,dataPath:r,componentPath:i,tabComponent:a})=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(n)?((0,e.openBlock)(),(0,e.createBlock)(s,{key:t.getPanelKey(r,a),schema:n,dataPath:r,panelComponentPath:i,data:t.data,meta:t.meta,store:t.getChildStore(n.name),disabled:n.disabled??t.disabled,panelTabComponent:a},null,8,[`schema`,`dataPath`,`panelComponentPath`,`data`,`meta`,`store`,`disabled`,`panelTabComponent`])):(0,e.createCommentVNode)(``,!0)],64))),256))])):(0,e.createCommentVNode)(``,!0)}var bo=V(B.component(`DitoPanels`,{mixins:[P],props:{panels:{type:Array,default:null},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0}},computed:{nested(){return!1}},methods:{getPanelKey(e,t){return t?`${t.tab}_${e}`:e}}}),[[`render`,yo]]),xo={key:0,class:`dito-buttons`},So={key:0,class:`dito-container dito-buttons__container`};function Co(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoContainer`),c=(0,e.resolveComponent)(`DitoVnode`);return t.buttonSchemas||t.hasSlotContent(t.$slots.default)?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,xo,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.buttonSchemas,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(n)?((0,e.openBlock)(),(0,e.createBlock)(s,{class:`dito-buttons__container`,key:r,schema:n,dataPath:r,data:t.data,meta:t.meta,nested:t.nested,store:t.getChildStore(n.name),disabled:t.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`nested`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)],64))),256)),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.$slots.default?.(),n=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.hasVNodeContent(n)?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,So,[(0,e.createVNode)(c,{vnode:n},null,8,[`vnode`])])):(0,e.createCommentVNode)(``,!0)],64))),256))])):(0,e.createCommentVNode)(``,!0)}var wo=V(B.component(`DitoButtons`,{mixins:[P],provide:{$tabComponent:()=>null},props:{buttons:{type:Object,default:null},dataPath:{type:String,default:``},data:{type:[Object,Array],default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},buttonsName:{type:String,default:`buttons`}},computed:{componentPath(){return y(this.continueParentComponentPath(),`$${this.buttonsName}`)},buttonSchemas(){let{dataPath:e,buttons:t}=this;return t?Object.values(t).reduce((t,n)=>(t[y(e,n.name)]=n,t),{}):null}},methods:{hasSlotContent:or,hasVNodeContent:ar}}),[[`render`,Co]]),To=[`disabled`];function Eo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`),c=(0,e.resolveComponent)(`DitoCreateButton`),l=(0,e.resolveComponent)(`DitoButtons`);return(0,e.openBlock)(),(0,e.createBlock)(l,{class:`dito-edit-buttons dito-buttons--round`,buttons:t.buttons,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,onClick:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},{default:(0,e.withCtx)(()=>[t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:0,class:[`dito-button`,{"dito-button--disabled":t.isDraggableDisabled}]},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.editable?((0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({key:1,class:[`dito-button`,{"dito-button--disabled":t.isEditableDisabled}],to:t.editPath?{path:t.editPath}:{}},t.getButtonAttributes(t.verbs.edit)),null,16,[`class`,`to`])):(0,e.createCommentVNode)(``,!0),t.creatable?((0,e.openBlock)(),(0,e.createBlock)(c,{key:2,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,path:t.createPath,verb:t.verbs.create,text:t.insertIndex==null?t.createButtonText:null,disabled:t.isCreatableDisabled,insertIndex:t.insertIndex},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`path`,`verb`,`text`,`disabled`,`insertIndex`])):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:3,class:`dito-button`,type:`button`,disabled:t.isDeletableDisabled},t.getButtonAttributes(t.verbs.delete),{onClick:n[0]||=e=>t.$emit(`delete`)}),null,16,To)):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`nested`])}var Do=V(B.component(`DitoEditButtons`,{mixins:[P],emits:[`delete`],props:{buttons:{type:Object,default:null},schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!1},disabled:{type:Boolean,required:!0},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null}},computed:{formLabel(){return this.getLabel(this.schema.form)},isDraggableDisabled(){return this.disabled||!this.hasSchemaOption(`draggable`)},isDeletableDisabled(){return this.disabled||!this.hasSchemaOption(`deletable`)},isEditableDisabled(){return this.disabled||!this.editPath||!this.hasSchemaOption(`editable`)},isCreatableDisabled(){return this.disabled||!this.createPath||!this.hasSchemaOption(`creatable`)},createButtonText(){return this.schema.creatable?.label||this.formLabel&&`${(0,r.capitalize)(this.verbs.create)} ${this.formLabel}`||null}},methods:{hasSchemaOption(e){return this.getSchemaValue(e,{type:Boolean,default:!0})}}}),[[`render`,Eo]]),Oo={class:`dito-create-button`},ko=[`type`,`disabled`],Ao=[`disabled`],jo=[`onMousedown`,`onMouseup`];function Mo(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Oo,[t.creatableForm?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:0,class:`dito-button`,type:t.isInlined?`button`:`submit`,disabled:t.disabled},t.getButtonAttributes(t.verb,t.formLabel,t.text),{onClick:n[0]||=e=>t.createItem(t.creatableForm)}),(0,e.toDisplayString)(t.text),17,ko)):t.creatableForms?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createElementVNode)(`button`,(0,e.mergeProps)({class:`dito-button`,type:`button`,disabled:t.disabled},{...t.pulldownTriggerAttributes,...t.getButtonAttributes(t.verb,null,t.text)},{onMousedown:n[1]||=(0,e.withModifiers)(e=>t.onPulldownMouseDown(),[`stop`])}),(0,e.toDisplayString)(t.text),17,Ao),(0,e.createElementVNode)(`ul`,{class:(0,e.normalizeClass)([`dito-pulldown`,{"dito-pulldown--open":t.pulldown.open}]),role:`menu`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.creatableForms,(n,r)=>(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-pulldown__item`,{"dito-pulldown__item--disabled":t.shouldDisableSchema(n)}]),role:`menuitem`,onMousedown:(0,e.withModifiers)(e=>t.onPulldownMouseDown(r),[`stop`]),onMouseup:e=>t.onPulldownMouseUp(r)},(0,e.toDisplayString)(t.getLabel(n)),43,jo)],512)),[[e.vShow,t.shouldShowSchema(n)]])),256))],2)],64)):(0,e.createCommentVNode)(``,!0)])}var No=V(B.component(`DitoCreateButton`,{mixins:[P,ja],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!1},path:{type:String,required:!0},verb:{type:String,required:!0},text:{type:String,default:null},disabled:{type:Boolean,required:!0},insertIndex:{type:Number,default:null}},computed:{forms(){return O(this.insertIndex==null?this.schema:this.sourceSchema||this.schema,this.context)},creatableForms(){let e=Object.entries(this.forms).filter(([,e])=>this.isFormCreatable(e));return e.length>0?Object.fromEntries(e):null},creatableForm(){let e=this.creatableForms;return e&&Object.keys(e).length===1&&e.default||null},formLabel(){let e=this.creatableForm;return e?this.getSchemaValue(`label`,{schema:e,type:String}):null},isInlined(){return dt(this.schema)}},methods:{isFormCreatable(e){return this.shouldRenderSchema(e)&&this.getSchemaValue(`creatable`,{type:Boolean,default:!0,schema:e})},createItem(e,t=null){if(this.shouldDisableSchema(e))throw Error(`Not allowed to create item for given form`);if(this.isInlined)this.sourceComponent.createItem(e,t,this.insertIndex);else{let{creatable:e}=this.schema,n={...t&&{type:t},...e?.query?.(this.context)};this.$router.push({path:`${this.path}/create`,query:n})}},onPulldownSelect(e){this.createItem(this.forms[e],e),this.setPulldownOpen(!1)}}}),[[`render`,Mo]]),Po={key:0,class:`dito-clipboard dito-buttons dito-buttons--round`},Fo=[`disabled`],Io=[`disabled`];function Lo(t,n,r,i,a,o){return t.clipboard?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Po,[(0,e.createElementVNode)(`button`,{class:`dito-button dito-button--copy`,ref:`copyData`,type:`button`,title:`Copy Data`,disabled:!t.copyEnabled,onClick:n[0]||=(...e)=>t.onCopy&&t.onCopy(...e)},null,8,Fo),(0,e.createElementVNode)(`button`,{class:`dito-button dito-button--paste`,type:`button`,title:`Paste Data`,disabled:!t.pasteEnabled,onClick:n[1]||=(...e)=>t.onPaste&&t.onPaste(...e)},null,8,Io)])):(0,e.createCommentVNode)(``,!0)}var Ro=V(B.component(`DitoClipboard`,{mixins:[K],props:{clipboard:{type:[Boolean,Object],required:!0},schema:{type:Object,required:!0}},data(){return{copyEnabled:!1,pasteEnabled:!1}},computed:{clipboardOptions(){return(0,r.isObject)(this.clipboard)?this.clipboard:{}},copyData(){let{copy:e}=this.clipboardOptions;return e?t=>e.call(this,new E(this,{clipboardData:t})):e=>(0,r.clone)(e)},pasteData(){let{paste:e}=this.clipboardOptions;return e?t=>e.call(this,new E(this,{clipboardData:t})):e=>e}},watch:{"parentComponent.hasData":{immediate:!0,handler:`updateCopy`},"appState.clipboardData":{immediate:!0,handler:`updatePaste`}},mounted(){this.domOn(document,{copy:this.updatePaste}),this.domOn(window,{focus:this.updatePaste})},methods:{checkClipboardData(e){let{$schema:t,...n}=e||{};return t===this.schema.name?n:null},async getClipboardData(e){let{clipboardData:t}=this.appState;try{let e=await navigator.clipboard?.readText?.();e&&(t=JSON.parse(e))}catch(t){e&&(console.error(t,t.name,t.message),t.name===`SyntaxError`&&alert(r.deindent`
3
- The data in the clipboard appears to be malformed:
4
- ${t.message}
5
- `))}return this.checkClipboardData(t)},updateCopy(){this.copyEnabled=this.parentComponent.hasData},async updatePaste(){if(this.pasteEnabled=!!this.checkClipboardData(this.appState.clipboardData),!this.pasteEnabled&&this.appState.agent.chrome){let e=await this.getClipboardData(!1);this.pasteEnabled=!!e}},async onCopy(){let e=this.parentComponent.clipboardData;try{e&&={$schema:this.schema.name,...this.copyData(e)},this.appState.clipboardData=e,this.pasteEnabled=!0;try{let t=JSON.stringify(e,null,2);await navigator.clipboard?.writeText?.(t)}catch(e){console.error(e,e.name,e.message)}}catch(e){console.error(e),alert(e.message)}},async onPaste(){let e=await this.getClipboardData(!0);try{e&&=this.pasteData(e),e&&(this.parentComponent.clipboardData=e)}catch(e){console.error(e),alert(e.message)}}}}),[[`render`,Lo]]);function zo({routeLevel:n}){return(0,e.h)(t.RouterView,null,{default:({Component:t,route:r})=>t?(0,e.h)(t,{key:r.matched[n]?.path}):null})}zo.props={routeLevel:{type:Number,required:!0}};var Bo=B.component(`DitoRouterView`,zo),Vo={mixins:[Ja,{data(){return{isLoading:!1}},methods:{setLoading(e,{updateRoot:t=!1,updateView:n=!1}={}){!this.isLoading^!e&&(this.isLoading=!!e,t&&this.rootComponent.registerLoading(e),n&&this.viewComponent.setLoading(this.isLoading))}}}],provide(){return{$resourceComponent:()=>this,$verbs:()=>this.verbs,$isPopulated:()=>this.hasData}},data(){return{loadedData:null,abortController:null}},computed:{isInsideForm(){return!this.isForm&&!!this.formComponent},resourceComponent(){return this},resource(){return this.getResource()},providesData(){return!!this.resource},linksToView(){return!1},isTransient(){let e=this.formComponent;return!this.providesData&&!this.linksToView||e&&(e.isTransient||e.isCreating)},transientNote(){return this.isTransient&&`<b>Note</b>: the parent still needs to be saved in order to persist this change.`},shouldLoad(){return!this.isTransient&&!this.isLoading},hasData(){return!!this.loadedData},verbs(){return this.getVerbs()},paginationRange(){let{paginate:e}=this.sourceSchema;if(this.isListSource&&e){let{page:t=0}=this.query||{},n=t*e;return[n,n+e-1]}return null},queryParams(){let e=this.paginationRange,{page:t,...n}=this.query||{};return{...n,...e&&{range:e.join(`,`)}}}},created(){(this.providesData||this.isCreating)&&this.setupData()},methods:{getResource({method:e=`get`,child:t}={}){let n=this.sourceSchema?.resource;return z(n,{type:`collection`,method:e,parent:this.parentResourceComponent?.getResource({method:e,child:n})??null,child:t})},getVerbs(){let e=this.$verbs();return this.isTransient?{...e,create:`add`,created:`added`,save:`apply`,saved:`applied`,delete:`remove`,deleted:`removed`}:e},clearData(){this.loadedData=null},setData(e){return this.loadedData=e,this.loadedData},setupData(){this.ensureData()},ensureData(){this.shouldLoad&&(this.hasData?this.reloadData():this.loadData(!0))},reloadData(){this.loadData(!1)},loadData(e){this.isTransient||(e&&this.clearData(),this.requestData())},createData(e,t){return tn(e,t?{type:t}:{},this)},requestData(){let e=this.queryParams;this.handleRequest({method:`get`,query:e},(e,t)=>{if(e){if(t){let{data:e}=t;if(e?.type===`FilterValidation`&&this.onFilterErrors?.(e.errors))return!0;if(this.isUnauthorizedError(t)&&this.isInsideForm)return this.addUnauthorizedError(),!0}}else this.isForm&&this.isDirty||this.setData(t.data),this.emitSchemaEvent(`load`)})},isValidationError(e){return e?.status===400},isUnauthorizedError(e){return e?.status===401},addUnauthorizedError(){let e=`You don't have permission to load this data.`;this.errors?.includes(e)||this.addError(e)},async handleRequest({method:e,resource:t=this.getResource({method:e}),query:n,data:i},a){let o={updateRoot:!0,updateView:this.isInView};this.abortController?.abort();let s=new AbortController;this.abortController=s;let{signal:c}=s;e=t.method||e;let l={method:e,resource:t,query:n,data:i,signal:c};this.setLoading(!0,o);try{a(null,await this.sendRequest(l))}catch(e){if(e.name!==`AbortError`){let{response:t}=e;if(!a(e,t)){let n=t?.data,i=(0,r.isString)(n?.type)?(0,r.labelize)(n.type):`Error`,a=n?.message??e;this.notify({type:`error`,error:e,title:i,text:a})}}}this.abortController===s&&(this.abortController=null,this.setLoading(!1,o))},getPayloadData(e,t){return[`post`,`put`,`patch`].includes(t)&&(e.getSchemaValue([`resource`,`data`])||e.processedItem)},async submit(e){let{resource:t}=e.schema;if(t=z(t,{parent:this.getResource({method:t?.method,child:t})}),t){let{method:n}=t,r=this.getPayloadData(e,n);return this.submitResource(e,t,n,r)}return!1},async submitResource(e,t,n,i,{setData:a=!1,onSuccess:o,onError:s,notifySuccess:c=()=>this.notify({type:`success`,title:`Request Successful`,text:`Request was successfully sent.`}),notifyError:l=e=>this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to send request${e?`:`:``}`,e?.message||e]})}={}){return new Promise(u=>{this.handleRequest({method:n,resource:t,data:i},async(t,n)=>{let i=n?.data;if(t){let a=this.isValidationError(n)&&i.errors;if(a)await this.showValidationErrors(a,!0);else{let n=(0,r.isObject)(i)?i:t;s?.(n),await this.emitButtonEvent(e,`error`,{notify:l,error:n})}u(!1)}else{if(a&&i){let{foreignData:e}=this.mainSchemaComponent.filterData(this.data),t=this.parentRouteComponent?.routeRecord?.meta;t&&(t.reload=!0),this.setData((0,r.assignDeeply)({},e,i))}o?.(),await this.emitButtonEvent(e,`success`,{notify:c}),u(!0)}})})},async emitButtonEvent(e,t,{notify:n,error:r}){let i=new E(e,{nested:!1,data:this.data,itemLabel:this.itemLabel,error:r}),a=await e.emitEvent(t,{context:i});return n&&a===void 0&&!i.wasNotified&&n(r),a}}};function Ho(e){return new URL(`file:${e}`).pathname}var Uo=[`data-resource`],Wo={type:`submit`,disabled:``};function Go(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoRouterView`),c=(0,e.resolveComponent)(`DitoButtons`),l=(0,e.resolveComponent)(`DitoSchema`),u=(0,e.resolveComponent)(`DitoFormInner`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-form dito-scroll-parent`,{"dito-form-nested":t.isNestedRoute}]),"data-resource":t.sourceSchema.path},[!t.isLastUnnestedRoute&&!t.isNestedRoute?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`])),[[e.vShow,!t.isActiveRoute]]):(0,e.createCommentVNode)(``,!0),(0,e.withDirectives)((0,e.createVNode)(u,{nested:t.isNestedRoute,label:t.itemLabel},{default:(0,e.withCtx)(()=>[(0,e.withDirectives)((0,e.createElementVNode)(`button`,Wo,null,512),[[e.vShow,!1]]),(0,e.createVNode)(l,{schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.isNestedRoute?`nested`:`root`,active:t.isActiveRoute,disabled:t.isLoading,scrollable:!t.isNestedRoute,generateLabels:``},{buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(c,{class:(0,e.normalizeClass)([`dito-buttons--round dito-buttons--large dito-buttons--main`,{"dito-buttons--sticky":!t.isNestedRoute}]),buttons:t.buttonSchemas,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:t.isLoading},null,8,[`class`,`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`active`,`disabled`,`scrollable`])]),_:1},8,[`nested`,`label`]),[[e.vShow,t.isActiveRoute]])],10,Uo)}var Ko=V(B.component(`DitoForm`,{mixins:[Li,Vo],data(){return{createdData:null,clonedData:void 0}},computed:{isForm(){return!0},verbs(){let e=this.getVerbs(),{isCreating:t,providesData:n}=this;return{...e,submit:t?e.create:e.save,submitted:t?e.created:e.saved,cancel:n?e.cancel:e.close,cancelled:n?e.cancelled:e.closed}},schema(){return this.getItemFormSchema(this.sourceSchema,this.data||(this.creationType?{type:this.creationType}:null),this.context)},buttonSchemas(){return Ut((0,r.assignDeeply)({cancel:{type:`button`,events:{click:()=>this.cancel()}},submit:!this.isMutating&&{type:`submit`,closeForm:!0,events:{click:({component:e})=>e.submit()}}},this.schema.buttons))},isActiveRoute(){return this.isLastRoute||this.isLastUnnestedRoute},isTransient(){return!this.providesData},isCreating(){return this.param===`create`},isDirty(){return!this.isMutating&&this.dataModel.isDirty},isMutating(){return!!this.sourceSchema.mutate},selectedTab(){return this.mainSchemaComponent?.selectedTab||null},creationType(){return this.$route.query.type},itemId(){return this.isCreating?null:this.param??null},method(){return this.isCreating?`post`:`patch`},breadcrumbPrefix(){return(0,r.capitalize)(this.isCreating?this.verbs.create:this.verbs.edit)},data(){return this.createdData||this.loadedData||this.inheritedData||null},dataPath(){return this.getDataPathFrom(this.dataComponent)},componentPath(){let{parentRouteComponent:e}=this;return this.isTransient&&e?sn(e.isView?e.viewSchema:e.schema,e.data,this.getDataPathFrom(e),{componentPath:e.componentPath,component:this,rootData:this.rootData}):``},sourceLocation(){let e=this.isLeavingRoute?null:this.parentRouteComponent.data;if(!e)return null;let t=(0,r.parseDataPath)(this.getDataPathFrom(this.parentRouteComponent)),n=this.routeRecord.path.split(`/`),i=n.slice(n.length-t.length),a=t[t.length-1];C(this.sourceSchema)&&a===`create`&&t.length--;let o=null;for(let n=0,r=t.length;n<r&&e;n++){let a=t[n];o=/^:id/.test(i[n])?a===`create`?null:this.findItemIdIndex(this.sourceSchema,e,a):a,n<r-1&&(e=e[o])}return e?{data:e,key:o}:null},sourceData(){return this.sourceLocation?.data??null},sourceKey(){return this.sourceLocation?.key??null},sourceItem(){return this.sourceData&&this.sourceKey!==null?this.sourceData[this.sourceKey]:void 0},inheritedData(){return this.isTransient?this.isMutating?this.sourceItem:this.clonedData:void 0},hasData(){return!!this.data},itemLabel(){return this.getItemLabel(this.sourceSchema,this.data,{extended:!0})}},watch:{$route:{flush:`post`,handler(e,t){let n=this.meta?.param;n&&this.providesData&&t.params[n]!==`create`&&e.params[n]!==t.params[n]&&this.loadData(!0)}},sourceItem:{immediate:!0,handler(e){this.isTransient&&(this.isMutating||(this.clonedData=(0,r.clone)(e)),e===null&&!this.isCreating&&C(this.sourceSchema)&&this.$router.push({path:`${this.path}/create`}))}},isCreating(e){e&&this.setupData()}},created(){this.ownDataModel=(0,e.markRaw)(new Bi({component:this,getSchema:()=>this.schema,getData:()=>this.data,getSourceSchema:()=>this.sourceSchema}))},beforeUnmount(){this.ownDataModel.stop()},methods:{emitSchemaEvent(e,t){return this.mainSchemaComponent?.emitEvent(e,t)},getDataPathFrom(e){return this.api.denormalizePath(this.path.slice((e.isView?0:e.path.length)+1))},getResource(e){let t=Vo.methods.getResource.call(this,e);return Zn(this.itemId,t)||t},setupData(){this.isCreating?this.createdData||=this.createData(this.schema,this.creationType):this.ensureData()},setSourceData(e){if(this.sourceData&&this.sourceKey!==null){let{mainSchemaComponent:t}=this;return this.sourceData[this.sourceKey]=t.filterData(e).localData,t.onChange(),!0}return!1},addSourceData(e){return C(this.sourceSchema)?this.setSourceData(e):!!this.sourceData?.push(e)},clearData(){this.setData(null)},setData(e){return this.isTransient?(this.setSourceData(e),this.sourceItem):(this.createdData=null,this.loadedData=e,this.data)},applyCleanChanges(e){return this.dataModel.applyCleanChanges(e)},async cancel(){return this.close()},async close(){return this.navigate(this.parentRouteComponent.path)},getSubmitVerb(e=!0){return this.isCreating?e?`create`:`created`:e?`submit`:`submitted`},async submit(e,{validate:t=!0,closeForm:n=!1}={}){if(await this.waitUntilDataModelSettled(),t&&!this.validateAll())return!1;let i=e=>this.verbs[this.getSubmitVerb(e)],{method:a}=this,o=this.getResource({method:a}),s=z(e.schema.resource,{parent:o});o=s||o,a=o?.method||a;let c=this.getPayloadData(e,a),l;if(l=!s&&this.isTransient?await this.submitTransient(e,o,a,c,{onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}}),notifySuccess:()=>{let e=i(!1);this.notify({type:`info`,title:this.isCreating?`Item ${(0,r.capitalize)(e)}`:`Change ${(0,r.capitalize)(e)}`,text:[this.isCreating?`${this.itemLabel} was ${e}.`:`Changes to ${this.itemLabel} were ${e}.`,this.transientNote]})},notifyError:e=>{let t=i(!0);this.notify({type:`error`,error:e,title:`Request Error`,text:`Unable to ${t} ${this.itemLabel}.`})}}):await this.submitResource(e,o,a,c,{setData:!0,onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}}),notifySuccess:()=>{let e=i(!1);this.notify({type:`success`,title:`Successfully ${(0,r.capitalize)(e)}`,text:`${this.itemLabel} was ${e}.`})},notifyError:e=>{let t=i(!0);this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to ${t} ${this.itemLabel}${e?`:`:``}`,e?.message||e]})}}),l){if(this.resetValidation(),this.dataModel.takeProcessedDataSnapshot().catch(console.error),n||e.closeForm)this.close();else if(this.isCreating){let e=this.getItemId(this.schema,this.data);this.$router.replace({path:Ho(`${this.path}/../${e}`),hash:this.$route.hash})}}return l},async submitTransient(e,t,n,r,{onSuccess:i,onError:a,notifySuccess:o,notifyError:s}){let c=this.isCreating?this.addSourceData(r):this.setSourceData(r);if(c)i?.(),await this.emitButtonEvent(e,`success`,{notify:o});else{let t=`Could not submit transient item`;a?.(t),await this.emitButtonEvent(e,`error`,{notify:s,error:t})}return c}}}),[[`render`,Go]]),qo={key:0},Jo=[`aria-label`];function Yo(t,n,r,i,a,o){return t.nested?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,qo,[(0,e.renderSlot)(t.$slots,`default`)])):((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{key:1,class:`dito-scroll-parent`,"aria-label":t.label,onSubmit:n[0]||=(0,e.withModifiers)(()=>{},[`prevent`])},[(0,e.renderSlot)(t.$slots,`default`)],40,Jo))}var Xo=V(B.component(`DitoFormInner`,{props:{nested:{type:Boolean,default:!1},label:{type:String,default:null}}}),[[`render`,Yo]]),Zo=B.component(`DitoFormNested`,{extends:Ko}),Qo={key:0,class:`dito-errors`,role:`alert`};function $o(t,n,r,i,a,o){return t.errors?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Qo,[(0,e.createElementVNode)(`ul`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.errors,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,(0,e.toDisplayString)(t),1))),256))])])):(0,e.createCommentVNode)(``,!0)}var es=V(B.component(`DitoErrors`,{props:{errors:{type:Array,default:null}},data(){return{tip:null}},watch:{errors(){this.$nextTick(this.updateErrors)}},unmounted(){this.tip?.destroy()},methods:{updateErrors(){let{tip:t}=this;t?.hide(),this.errors&&(t=this.tip??=(0,e.markRaw)((0,i.default)(this.$el.closest(`.dito-container`))),t.setProps({content:this.errors.join(`
6
- `),theme:`error`,trigger:`manual`,appendTo:`parent`,placement:`bottom-start`,animation:`shift-away-subtle`,popperOptions:{modifiers:[{name:`flip`,enabled:!1}]},interactive:!0,hideOnClick:!1,offset:[3,3],zIndex:1}),t.popper.addEventListener(`mousedown`,()=>t.hide()),t.show())}}}),[[`render`,$o]]),ts={class:`dito-scopes`},ns=[`aria-pressed`,`title`,`onClick`];function rs(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ts,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.scopes,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,to:t.getScopeLink(n),custom:``},{default:(0,e.withCtx)(({navigate:r})=>[(0,e.createElementVNode)(`button`,{class:(0,e.normalizeClass)([`dito-button`,{"dito-button--selected":n.name===t.query.scope}]),type:`button`,"aria-pressed":n.name===t.query.scope,title:n.hint||t.getLabel(n),onClick:r},(0,e.toDisplayString)(t.getLabel(n)),11,ns)]),_:2},1032,[`to`]))),128))])}var is=V(B.component(`DitoScopes`,{props:{query:{type:Object,required:!0},scopes:{type:Object,required:!0}},methods:{getScopeLink(e){let t={...this.query,scope:e.name};return t.page&&=0,this.getQueryLink(t)}}}),[[`render`,rs]]);function as(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`Pagination`);return(0,e.openBlock)(),(0,e.createBlock)(s,{page:t.page,"onUpdate:page":n[0]||=e=>t.page=e,pageSize:t.limit,total:t.total},null,8,[`page`,`pageSize`,`total`])}var os=V(B.component(`DitoPagination`,{components:{Pagination:Ci},props:{query:{type:Object,required:!0},limit:{type:Number,required:!0},total:{type:Number,required:!0}},computed:{page:{get(){return(+this.query.page||0)+1},set(e){this.page!==e&&this.$router.push(this.getQueryLink({...this.query,page:e-1}))}}}}),[[`render`,as]]),ss={data(){return{isDragging:!1}},methods:{getDraggableOptions(e=window.dito.settings?.forceDragFallback??!1){let t=`dito-draggable`;return{animation:150,handle:`.dito-button--drag`,dragClass:`${t}__drag`,chosenClass:`${t}__chosen`,ghostClass:`${t}__ghost`,fallbackClass:`${t}__fallback`,forceFallback:e,onStart:this.onStartDrag,onEnd:this.onEndDrag}},onStartDrag(){this.isDragging=!0},onEndDrag({oldIndex:e,newIndex:t}){this.isDragging=!1,e!==t&&this.onChange()}}},cs=[`id`,`data-path`],ls={key:0,class:`dito-tree-header`},us=[`aria-label`,`aria-expanded`],ds=[`innerHTML`],fs={key:1,class:`dito-tree-info`},ps={key:1,class:`dito-tree-leaf`},ms=[`innerHTML`],hs={key:2,class:`dito-buttons dito-buttons--small`},gs={key:1,class:`dito-properties`};function _s(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoLabel`),c=(0,e.resolveComponent)(`DitoTableCell`),l=(0,e.resolveComponent)(`DitoTreeItem`,!0),u=(0,e.resolveComponent)(`DitoDraggable`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-tree-item`,{"dito-tree-item--dragging":t.isDragging,"dito-tree-item--active":t.active}]),id:t.componentPath,style:(0,e.normalizeStyle)(t.level>0&&{"--level":t.level}),"data-path":t.path},[t.label?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ls,[t.numEntries?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-tree-branch`,role:`button`,tabindex:`0`,"aria-label":t.ariaLabel,"aria-expanded":t.opened,onClick:n[0]||=(0,e.withModifiers)(e=>t.opened=!t.opened,[`stop`]),onKeydown:n[1]||=(0,e.withKeys)((0,e.withModifiers)(e=>t.opened=!t.opened,[`prevent`]),[`enter`,`space`])},[t.numEntries?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-chevron`,{"dito-chevron--open":t.opened}])},null,2)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:t.label},null,8,ds),t.details?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,fs,(0,e.toDisplayString)(t.details),1)):(0,e.createCommentVNode)(``,!0)],40,us)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ps,[(0,e.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:t.label},null,8,ms)])),t.hasEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,hs,[t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:0,class:`dito-button`},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.editable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:1,class:`dito-button`,type:`button`},t.getButtonAttributes(t.verbs.edit),{onClick:n[2]||=(...e)=>t.onEdit&&t.onEdit(...e)}),null,16)):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:2,class:`dito-button`,type:`button`},t.getButtonAttributes(t.verbs.delete),{onClick:n[3]||=(...e)=>t.onDelete&&t.onDelete(...e)}),null,16)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),t.properties?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`table`,gs,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.properties,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,null,[(0,e.createElementVNode)(`td`,null,[n.label===!1?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,label:t.getLabel(n)},null,8,[`label`]))]),(0,e.createVNode)(c,{cell:n,schema:n,dataPath:t.getPropertyDataPath(n),data:t.data,meta:t.nestedMeta,store:t.store,disabled:t.disabled},null,8,[`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])]))),256))],512)),[[e.vShow,t.opened]]):(0,e.createCommentVNode)(``,!0),t.childrenSchema?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(u,{key:2,options:t.getDraggableOptions(!0),draggable:t.childrenDraggable,modelValue:t.childrenList,"onUpdate:modelValue":n[4]||=e=>t.childrenList=e},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.childrenItems,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:t.getItemUid(t.childrenSchema,n.data),schema:t.childrenSchema,dataPath:t.getItemDataPath(t.childrenSchema,r),data:n.data,path:n.path,open:n.open,active:n.active,draggable:t.childrenDraggable,label:t.getItemLabel(t.childrenSchema,n.data,{index:r}),level:t.level+1,onDelete:e=>t.deleteChild(r)},null,8,[`schema`,`dataPath`,`data`,`path`,`open`,`active`,`draggable`,`label`,`level`,`onDelete`]))),128))]),_:1},8,[`options`,`draggable`,`modelValue`])),[[e.vShow,t.opened]]):(0,e.createCommentVNode)(``,!0)],14,cs)}var vs=V(B.component(`DitoTreeItem`,{mixins:[Ja,ss],emits:[`update:data`,`delete`],inject:[`container`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Array,Object],default:null},path:{type:String,default:``},open:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},label:{type:String,default:null},level:{type:Number,default:0}},data(){return{opened:this.open||this.schema.open}},computed:{componentPath(){let{componentPath:e,dataPath:t}=this.container,n=Oe(this.dataPath,t);return n?y(e,n):e},meta(){return this.container.meta},store(){return this.container.store},disabled(){return this.container.disabled},nestedMeta(){return{...this.meta,schema:this.schema}},properties(){return k(this.schema.properties)},childrenSchema(){return this.schema.children},childrenList:{get(){let e=this.childrenSchema?.name;return e&&this.data[e]},set(e){let t=this.childrenSchema?.name;t&&(un(this.childrenSchema,e),this.data[t]=e,this.$emit(`update:data`,e))}},childrenDraggable(){return this.childrenList?.length>1&&this.getSchemaValue(`draggable`,{type:Boolean,default:!1,schema:this.childrenSchema})},numChildren(){return this.childrenList?.length||0},numProperties(){return this.properties?.length||0},numEntries(){return this.numProperties+this.numChildren},childrenItems(){let{childrenSchema:e,childrenList:t}=this;if(e&&t){let{editPath:n}=this.container,r=!this.path&&e.open;return t.map((t,i)=>{let a=e.path&&`${this.path}/${e.path}/${i}`;return{data:t,path:a,open:r||n.startsWith(a)&&a.length<n.length,active:n===a}})}return[]},ariaLabel(){return this.label?(0,r.stripHtml)(this.label):null},details(){let{numChildren:e}=this;return e&&`${e} ${e===1?`item`:`items`}`},hasEditButtons(){return this.draggable||this.editable||this.deletable},creatable:F(`creatable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)}}),editable:F(`editable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)}}),deletable:F(`deletable`,{type:Boolean,default:!1})},methods:{getPropertyDataPath(e){return y(this.dataPath,e.name)},editPath(e){this.$router.push({path:`${this.container.path}${e}`,query:this.$route.query})},onEdit(){this.editPath(this.path)},onDelete(){this.$emit(`delete`)},deleteChild(e){let{childrenSchema:t,container:n}=this,r=this.childrenList[e],i=this.getItemLabel(t,r,{index:e,extended:!0});window.confirm(`Do you really want to ${this.verbs.delete} ${i}?`)&&(this.isEditingChildFrom(e)&&this.$router.push({path:n.path,query:this.$route.query}),this.childrenList=this.childrenList.toSpliced(e,1),this.onChange(),this.notify({type:`info`,title:`Successfully Removed`,text:[`${i} was ${this.verbs.deleted}.`,n.transientNote]}))},isEditingChildFrom(e){let t=this.childrenSchema.path;if(!t)return!1;let n=`${this.path}/${t}/`,{editPath:r}=this.container;if(!r.startsWith(n))return!1;let[i]=r.slice(n.length).split(`/`);return Number(i)>=e},onChange(){this.container.onChange()},onEndDrag(e){ss.methods.onEndDrag.call(this,e);let{item:t}=e;t.classList.contains(`dito-tree-item--active`)&&this.$nextTick(()=>{this.editPath(e.item.dataset.path)})}}}),[[`render`,_s]]),ys={class:`dito-table-head`},bs=[`aria-sort`,`onClick`],xs={key:1},Ss={key:0};function Cs(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`);return(0,e.openBlock)(),(0,e.createElementBlock)(`thead`,ys,[(0,e.createElementVNode)(`tr`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.columns,r=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(r)?((0,e.openBlock)(),(0,e.createElementBlock)(`th`,{key:0,scope:`col`,class:(0,e.normalizeClass)(t.getColumnClass(r))},[r.sortable?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,to:t.getSortLink(r),custom:``},{default:(0,e.withCtx)(({navigate:i})=>[(0,e.createElementVNode)(`button`,{class:(0,e.normalizeClass)([`dito-button`,t.getSortClass(r)]),type:`button`,"aria-sort":t.getSortState(r),onClick:i},[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-button__order-arrows`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabel(r)),1)],10,bs)]),_:2},1032,[`to`])):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,xs,(0,e.toDisplayString)(t.getLabel(r)),1))],2)):(0,e.createCommentVNode)(``,!0)],64))),256)),t.hasEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`th`,Ss,[...n[1]||=[(0,e.createElementVNode)(`span`,null,null,-1)]])):(0,e.createCommentVNode)(``,!0)])])}var ws=V(B.component(`DitoTableHead`,{props:{query:{type:Object,required:!0},columns:{type:Object,required:!0},hasEditButtons:{type:Boolean,required:!0}},computed:{sort(){let e=(this.query.order||``).split(/\s+/);return{name:e[0],order:e[1]}}},methods:{getColumnClass(e){return`dito-column--${(0,r.hyphenate)(e.name)}`},getSortClass(e){return this.sort.name===e.name?`dito-button--selected dito-button--order-${this.sort.order}`:null},getSortState(e){return{asc:`ascending`,desc:`descending`}[this.sort.name===e.name&&this.sort.order]||`none`},getSortLink(e){let t=this.sort.name===e.name&&this.sort.order===`asc`?`desc`:`asc`;return this.getQueryLink({...this.query,order:`${e.name} ${t}`})}}}),[[`render`,Cs]]),Ts=[`innerHTML`];function Es(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`td`,{class:(0,e.normalizeClass)(t.cell.class),style:(0,e.normalizeStyle)(t.cell.style)},[t.cell.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.cell.component),{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,disabled:t.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`])):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:1,innerHTML:t.renderCell(t.data)},null,8,Ts))],6)}var Ds=V(B.component(`DitoTableCell`,{mixins:[P],props:{cell:{type:Object,required:!0},schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},methods:{renderCell(e){let{name:t,render:n}=this.cell,i=e[t];return n?n.call(this,new E(this,{name:t,value:i,data:e,dataPath:y(this.dataPath,t)})):(0,r.escapeHtml)(i)}}}),[[`render`,Es]]),Os={class:`dito-upload-file`},ks={class:`dito-thumbnail__inner`},As=[`src`],js={key:1,class:`dito-thumbnail__type`};function Ms(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Os,[t.thumbnail?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-thumbnail`,`dito-thumbnail--${t.thumbnail}`])},[(0,e.createElementVNode)(`div`,ks,[t.source?((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:0,src:t.source,crossorigin:`anonymous`},null,8,As)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,js,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.type),1)]))])],2)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.file.name),1)])}var Ns=B.component(`DitoUploadFile`,{props:{file:{type:Object,required:!0},thumbnail:{type:String,default:null},thumbnailUrl:{type:String,default:null}},data(){return{uploadUrl:null}},computed:{type(){return Ps[this.file.type]||this.file.name.split(`.`).pop().toUpperCase()},source(){return this.uploadUrl||this.thumbnailUrl}},watch:{"file.upload.file":{immediate:!0,handler(e){if(this.thumbnail&&e?.type.startsWith(`image/`)){let t=new FileReader;t.onload=()=>{this.uploadUrl=t.result},t.readAsDataURL(e)}else this.uploadUrl=null}}}}),Ps={"text/plain":`TXT`,"text/html":`HTML`,"text/css":`CSS`,"text/javascript":`JS`,"image/jpeg":`JPG`,"image/png":`PNG`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"movie/mp4":`MP4`,"audio/mpeg":`MP3`,"application/json":`JSON`,"application/xml":`XML`,"application/pdf":`PDF`,"application/zip":`ZIP`},Fs=V(Ns,[[`render`,Ms]]);function Is(t,n,r={}){let i,{document:a=s.defaultDocument,watchElement:o=!1,...c}=r,u={onUpdate:e=>{zs(n,e.oldIndex,e.newIndex,e)}},d=()=>{i?.destroy(),i=void 0},f=e=>{e&&i===void 0&&(i=new l.default(e,{...u,...c}))},p=()=>{let e=typeof t==`string`?a?.querySelector(t):(0,s.unrefElement)(t);e&&f(e)},m=(e,t)=>{if(t!==void 0)i?.option(e,t);else return i?.option(e)},h;return o&&typeof t!=`string`?h=(0,e.watch)(()=>(0,s.unrefElement)(t),e=>{d(),e&&f(e)},{immediate:!0,flush:`post`}):(0,s.tryOnMounted)(p),(0,s.tryOnScopeDispose)(()=>{h?.(),d()}),{stop:()=>{d()},start:p,option:m}}function Ls(e,t,n){let r=e.children[n];e.insertBefore(t,r)}function Rs(e){e.parentNode&&e.parentNode.removeChild(e)}function zs(t,n,r,i=null){i!=null&&(Rs(i.item),Ls(i.from,i.item,n));let a=(0,e.isRef)(t),o=a?[...(0,e.toValue)(t)]:(0,e.toValue)(t);if(r>=0&&r<o.length){let i=o.splice(n,1)[0];(0,e.nextTick)(()=>{o.splice(r,0,i),a&&(t.value=o)})}}var Bs=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,s.useVModel)(t,`modelValue`),i=(0,e.shallowRef)(),a=(0,e.reactive)(Is(i,r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:i},n.default(a))}},{name:`UseSortable`,props:[`as`,`modelValue`,`options`]});function Vs(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`UseSortable`);return t.draggable?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,class:(0,e.normalizeClass)([`dito-draggable`,{"dito-draggable--dragging":t.isDragging}]),as:t.as,modelValue:t.modelValue,options:{...t.options,onStart:t.onStart,onEnd:t.onEnd},"onUpdate:modelValue":n[0]||=e=>t.$emit(`update:modelValue`,e)},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`default`)]),_:3},8,[`class`,`as`,`modelValue`,`options`])):((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.as),{key:1},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`default`)]),_:3}))}var Hs=V(B.component(`DitoDraggable`,{mixins:[K],components:{UseSortable:Bs},emits:[`update:modelValue`],props:{modelValue:{type:Array,required:!0},as:{type:String,default:`div`},options:{type:Object,required:!0},draggable:{type:Boolean,default:!0}},data(){return{mouseEvents:null,isDragging:!1}},methods:{onStart(e){this.options.onStart?.(e),this.isDragging=!0,this.mouseEvents?.remove()},onEnd(e){this.options.onEnd?.(e),this.mouseEvents=this.domOn(document,{mousedown:this.onMouse,mousemove:this.onMouse,mouseleave:this.onMouse})},onMouse(){this.isDragging=!1,this.mouseEvents?.remove(),this.mouseEvents=null}}}),[[`render`,Vs]]);function Us({vnode:e}){return e}Us.props={vnode:{type:Object,required:!0}};var Ws=B.component(`DitoVnode`,Us),Gs=we({DitoAccount:()=>Fa,DitoAffix:()=>za,DitoAffixes:()=>q,DitoButtons:()=>wo,DitoClipboard:()=>Ro,DitoContainer:()=>uo,DitoCreateButton:()=>No,DitoDialog:()=>na,DitoDraggable:()=>Hs,DitoEditButtons:()=>Do,DitoErrors:()=>es,DitoForm:()=>Ko,DitoFormInner:()=>Xo,DitoFormNested:()=>Zo,DitoHeader:()=>ba,DitoLabel:()=>qa,DitoMenu:()=>pa,DitoNavigation:()=>Ca,DitoNotifications:()=>Da,DitoPagination:()=>os,DitoPane:()=>so,DitoPanel:()=>_o,DitoPanels:()=>bo,DitoRoot:()=>la,DitoRouterView:()=>Bo,DitoSchema:()=>eo,DitoSchemaInlined:()=>no,DitoScopes:()=>is,DitoSidebar:()=>Aa,DitoSpinner:()=>La,DitoTableCell:()=>Ds,DitoTableHead:()=>ws,DitoTabs:()=>ho,DitoTrail:()=>_a,DitoTreeItem:()=>vs,DitoUploadFile:()=>Fs,DitoVNode:()=>Ws,DitoView:()=>Zi}),J={extends:B,mixins:[Nn],nativeField:!1,textField:!1,defaultValue:null,defaultNested:!0,defaultVisible:!0,defaultMultiple:!1,generateLabel:!0,excludeValue:!1,ignoreMissingValue:null,treatNullAsMissing:null,omitSpacing:!1,getTypeValidations:null,component:B.component,get:qe,register(e,t={}){e=(0,r.asArray)(e),Ks(t)&&console.warn(`Type '${e[0]}': The \`getValidations()\` method isn't supported anymore, use the static \`getTypeValidations(schema, context)\` option instead.`);let n=this.component(`DitoType${(0,r.camelize)(e[0],!0)}`,t);for(let t of e)Ke(t,n);return n}};function Ks(e){return[e,...e.mixins??[]].some(({methods:e})=>!!e?.getValidations)}var qs=[`data-info`];function Js(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoButton`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:[`dito-button`,t.buttonClass],id:t.componentPath,ref:`element`,type:t.type,text:t.text,title:t.title,disabled:t.disabled},t.attributes),{prefix:(0,e.withCtx)(()=>[t.prefixes.length>0?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,items:t.prefixes,position:`prefix`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])):(0,e.createCommentVNode)(``,!0)]),suffix:(0,e.withCtx)(()=>[t.suffixes.length>0?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,items:t.suffixes,position:`suffix`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])):(0,e.createCommentVNode)(``,!0),!t.label&&t.info?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.info},null,8,qs)):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`id`,`type`,`text`,`title`,`disabled`,`class`])}var Ys=V(J.register([`button`,`submit`],{components:{DitoAffixes:q,DitoButton:fr},defaultValue:()=>void 0,excludeValue:!0,defaultWidth:`auto`,generateLabel:!1,data(){return{isRunning:!1}},computed:{verb(){return this.verbs[this.name]},buttonClass(){return this.verb?`dito-button--${this.verb}`:null},text:F(`text`,{type:String}),title(){return this.text||(0,r.labelize)(this.verb)},prefixes(){return(0,r.asArray)(this.schema.prefix)},suffixes(){return(0,r.asArray)(this.schema.suffix)},closeForm:F(`closeForm`,{type:Boolean,default:!1})},methods:{getEvents(){let{onFocus:e,onBlur:t,onClick:n}=this;return{onFocus:e,onBlur:t,onClick:n}},async submit(e){return this.resourceComponent?.submit(this,e)},async onClick(){this.isRunning=!0;try{await this.emitEvent(`click`,{parent:this.schemaComponent})===void 0&&Xn(this.schema)&&await this.submit()}catch(e){if(await this.emitEvent(`error`,{error:e})===void 0){if(e instanceof AggregateError)for(let t of e.errors)this.notify({type:`error`,text:t});else this.notify({type:`error`,text:e})}}finally{this.isRunning=!1}}}}),[[`render`,Js]]),Xs={class:`dito-checkbox`},Zs=[`id`];function Qs(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Xs,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`checkbox`},t.attributes),null,16,Zs),[[e.vModelCheckbox,t.value]])])}var $s=V(J.register(`checkbox`,{nativeField:!0}),[[`render`,Qs]]),ec={computed:{multiple(){return $t(this.schema)},selectedValue:{get(){let e=e=>{let t=this.relate?this.getValueForOption(e):e;return this.hasOptions?this.getOptionForValue(t)?t:null:e};return this.multiple&&(0,r.isArray)(this.value)?this.value.map(e).filter(e=>e!==null):e(this.value)},set(e){let t=e=>{if(!this.relate)return e;let t=this.getOptionForValue(e)??this.getRelatedObject(e);return this.shouldSetTemporaryId(t)&&Ve(t,`id`),t};this.value=this.multiple&&(0,r.isArray)(e)?e.map(t):t(e)}},shouldReplaceValueWithSelectedValue(){return this.hasOptions&&!this.areOptionsFiltered&&(this.selectedValue===null&&this.value!==null||Ue(this.value))},selectedOption(){return this.getOptionForValue(this.selectedValue)},optionsResolver(){return this.dataModel.getOptionsResolver({schema:this.schema,data:this.data,name:this.name,dataPath:this.dataPath,componentPath:this.componentPath})},isLoadingOptions(){return this.optionsResolver.isLoading},options(){let e=this.optionsResolver.value??[];if(!(0,r.isArray)(e))throw Error(`Invalid options data, should be array: ${e}`);return this.groupBy?this.groupOptions(e):e},activeOptions(){return this.options},areOptionsFiltered(){return this.activeOptions!==this.options},hasOptions(){return this.activeOptions.length>0},relate:F(`relate`,{type:Boolean,default:!1,callback:!1}),groupBy:F(`groupBy`,{type:String,default:null}),optionLabel:F(`options.label`,{type:[String,Function],default:null,get(e){return e||this.getOptionKey(`label`)||null}}),optionValue:F(`options.value`,{type:[String,Function],default:null,get(e){return e||this.relate&&`id`||this.getOptionKey(`value`)||null}}),optionEquals:F(`options.equals`,{type:Function,default:null}),searchFilter:F(`search`,{type:[Object,Function],default:null,get(e){if(e){let{filter:t,debounce:n}=(0,r.isFunction)(e)?{filter:e}:e;return n?(0,r.debounceAsync)(t,n):t}}}),editable:F(`editable`,{type:Boolean,default:!1,get(e){return e&&Ft(this.schema,this.context)}}),editPath(){return this.editable&&this.selectedValue?Lt(this.schema,this.selectedValue,this.context):null},groupByLabel(){return this.groupBy?`label`:null},groupByOptions(){return this.groupBy?`options`:null}},watch:{shouldReplaceValueWithSelectedValue:{handler(e){e&&this.replaceValueWithSelectedValue()},immediate:!0},value(){this.shouldReplaceValueWithSelectedValue&&this.replaceValueWithSelectedValue()},"optionsResolver.lastLoadError"(e){e&&this.addError(e.message||e)}},methods:{getOptionKey(e){let[t]=this.activeOptions;return(0,r.isObject)(t)&&e in t?e:null},replaceValueWithSelectedValue(){let{selectedValue:e}=this;this.dataModel.applyCleanChanges(()=>{this.selectedValue=e}).catch(console.error)},groupOptions(e){let t={};return e.reduce((e,n)=>{let r=n[this.groupBy],i=t[r];return i||(i=t[r]={[this.groupByLabel]:r,[this.groupByOptions]:[]},e.push(i)),i[this.groupByOptions].push(n),e},[])},shouldSetTemporaryId(e){return this.relate&&(0,r.isObject)(e)&&e.id==null},getOptionForValue(e){let t=(e,n,r)=>{for(let i of e)if(r){let e=t(i.options,n,null);if(e)return e}else if(this.optionEquals?this.optionEquals(new E(this,{value:n,option:i})):n===this.getValueForOption(i))return i},{optionValue:n,groupBy:r}=this;return n?t(this.activeOptions,e,r)??(this.areOptionsFiltered?t(this.options,e,r):void 0):e},getRelatedObject(e){return(0,r.asArray)(this.value).find(t=>this.getValueForOption(t)===e)},getValueForOption(t){if(this.shouldSetTemporaryId(t))return(0,e.toRaw)(t);let{optionValue:n}=this;return(0,r.isString)(n)?t?.[n]??null:(0,r.isFunction)(n)?n(new E(this,{option:t})):t},getLabelForOption(e){let{optionLabel:t}=this;return(0,r.isString)(t)?e?.[t]:(0,r.isFunction)(t)?t(new E(this,{option:e})):(0,r.labelize)(`${e}`)}},processValue({schema:e,value:t,dataPath:n},i){if(e.relate){let a=e.options?.dataPath,o=a?(0,r.normalizeDataPath)(`${n}/${a}`):null;i.addRelation(n,o,e),o&&i.setSourceRelated(o);let s=e=>e&&{id:e.id};t=$t(e)&&(0,r.isArray)(t)?t.map(s):s(t)}return t}},tc=[`id`,`aria-label`],nc={class:`dito-checkbox`},rc=[`value`];function ic(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:(0,e.normalizeClass)([`dito-checkboxes`,`dito-layout--${t.schema.layout||`vertical`}`]),id:t.componentPath,role:`group`,"aria-label":t.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.options,r=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`label`,null,[(0,e.createElementVNode)(`div`,nc,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({ref_for:!0,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedOptions=e,type:`checkbox`,value:t.getValueForOption(r)},{ref_for:!0},t.attributes),null,16,rc),[[e.vModelCheckbox,t.selectedOptions]]),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabelForOption(r)),1)])])]))),256))],10,tc)}var ac=V(J.register(`checkboxes`,{mixins:[ec],nativeField:!0,defaultValue:[],defaultWidth:`auto`,defaultMultiple:!0,computed:{multiple(){return!0},selectedOptions:{get(){return(this.selectedValue||[]).filter(e=>e)},set(e){this.selectedValue=e||[]}}}}),[[`render`,ic]]),oc=[`id`],sc={class:`dito-code__editor`,ref:`editor`};function cc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-code`,id:t.componentPath,style:(0,e.normalizeStyle)(t.style)},[(0,e.createElementVNode)(`div`,sc,null,512),t.resizable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-resize`,onMousedown:n[0]||=(0,e.withModifiers)((...e)=>t.onDragResize&&t.onDragResize(...e),[`stop`,`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0)],12,oc)}var lc=V(J.register(`code`,{mixins:[K],data(){return{height:null}},computed:{lines:F(`lines`,{type:Number,default:3}),language:F(`language`,{type:String,default:`javascript`}),indentSize:F(`indentSize`,{type:Number,default:2}),resizable:F(`resizable`,{type:Boolean,default:!1}),style(){return this.height?{height:this.height}:{"--lines":this.lines}}},mounted(){let e=new u.default(this.$refs.editor,{language:this.language,indentSize:this.indentSize,lineNumbers:!1}),t=!1,n=!1,r=!1,i=()=>{!this.focused&&t&&(t=!1,this.onChange())};this.domOn(this.$refs.editor.querySelector(`textarea`),{focus:()=>this.onFocus(),blur:()=>{this.onBlur(),i()}});let a=t=>{t!==e.code&&(r=!0,e.updateCode(t))},o=e=>{e!==this.value&&(n=!0,this.value=e,t=!0,i())};e.onUpdate(e=>{r?r=!1:o(e)}),this.$watch(`value`,e=>{n?n=!1:a(e||``)}),this.$watch(`language`,t=>{e.updateLanguage(t)}),this.$watch(()=>this.readonly||this.disabled,t=>t?e.enableReadonlyMode():e.disableReadonlyMode(),{immediate:!0}),a(this.value||``)},methods:{focusElement(){this.$el.querySelector(`textarea`)?.focus()},blurElement(){this.$el.querySelector(`textarea`)?.blur()},onDragResize(e){let t=({clientX:e,clientY:t})=>({x:e,y:t}),n=t(e).y,r=parseFloat(getComputedStyle(this.$el).height),i=e=>{let{y:i}=t(e);r+=i-n,n=i,this.height=`${Math.max(r,0)}px`},a=this.domOn(document,{mousemove:i,mouseup(e){i(e),a.remove()}})}}}),[[`render`,cc]]),uc={key:0,class:`dito-color__preview`};function dc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`SketchPicker`),u=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(u,{class:`dito-color`,show:t.showPopup,"onUpdate:show":n[2]||=e=>t.showPopup=e,trigger:`focus`},{trigger:(0,e.withCtx)(()=>[(0,e.createVNode)(c,(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.hexValue,"onUpdate:modelValue":n[0]||=e=>t.hexValue=e,type:`input`,size:`8`,focused:t.showPopup},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},{append:(0,e.withCtx)(()=>[t.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,uc,[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)({background:`#${t.hexValue||`00000000`}`})},null,4)])):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`focused`])]),popup:(0,e.withCtx)(()=>[(0,e.createVNode)(l,{class:`dito-color__picker`,tinyColor:t.colorValue,"onUpdate:tinyColor":n[1]||=e=>t.colorValue=e,disableAlpha:!t.alpha,disableFields:!t.inputs,presetColors:t.presets},null,8,[`tinyColor`,`disableAlpha`,`disableFields`,`presetColors`])]),_:1},8,[`show`])}var fc=J.register(`color`,{components:{DitoTrigger:Yr,DitoInput:H,DitoAffixes:q,SketchPicker:d.SketchPicker},data(){return{showPopup:!1,convertedValue:null}},computed:{canUpdateValue(){return!this.focused||this.readonly},colorValue:{get(){return(0,d.tinycolor)(this.convertedValue||this.value||`#000000`)},set(e){this.convertedValue=null;let{value:t}=this;(!t||e.toHex8String()!==(0,d.tinycolor)(t).toHex8String())&&(this.value=mc(e,this.colorFormat))}},hexValue:{get(){let e=(0,d.tinycolor)(this.value);return e.isValid()?e.toString(e.getAlpha()<1?`hex8`:`hex6`).slice(1).toLowerCase():null},set(e){if((0,d.tinycolor)(e).isValid()){let t=pc(e,this.colorFormat);this.canUpdateValue?this.value=t:this.convertedValue=t}}},colorFormat:F(`format`,{type:String,default:`hex`}),alpha:F(`alpha`,{type:Boolean,default:!1}),inputs:F(`inputs`,{type:Boolean,default:!0}),presets:F(`presets`,{type:Array,default:[`#ffffff`,`#c3c3c3`,`#7f7f7f`,`#000000`,`#880015`,`#ed1c24`,`#ff7f27`,`#fff200`,`#22b14c`,`#00a2e8`,`#3f48cc`,`#a349a4`,`#b97a57`,`#ffaec9`,`#ffc90e`,`#00000000`]})},watch:{value:`onChange`,canUpdateValue(e){e&&this.convertedValue!==null&&(this.value=this.convertedValue,this.convertedValue=null)}}});function pc(e,t){return mc((0,d.tinycolor)(e),t)}function mc(e,t){switch(t){case`rgb`:return e.toRgb();case`prgb`:return e.toPercentageRgb();case`name`:return e.toName();case`hsl`:return e.toHsl();case`hsv`:return e.toHsv();case`hex3`:return`#${e.toHex(!0)}`;case`hex4`:return`#${e.toHex8(!0)}`;case`hex8`:return`#${e.toHex8()}`;default:return e.getAlpha()<1?`#${e.toHex8()}`:`#${e.toHex()}`}}var hc=V(fc,[[`render`,dc]]);function gc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),(0,e.normalizeProps)((0,e.guardReactiveProps)(t.$props)),null,16)}var _c=V(J.register(`component`,{defaultValue:()=>void 0,ignoreMissingValue:({schema:e})=>!(`default`in e),async processSchema(e,t){await Rn(t)}}),[[`render`,gc]]),vc=[`id`,`name`,`value`,`disabled`];function yc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`input`,{class:`dito-text dito-input`,id:t.componentPath,ref:`element`,name:t.name,type:`text`,value:t.value,disabled:t.disabled,readonly:!0},null,8,vc)}var bc=V(J.register([`computed`,`data`,`hidden`],{defaultValue:()=>void 0,defaultVisible:!1,valueFromDataSchema:!0}),[[`render`,yc]]),xc={class:`dito-date`};function Sc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,xc,[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.getComponent(t.type)),(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.dateValue,"onUpdate:modelValue":n[0]||=e=>t.dateValue=e,locale:t.locale,format:t.formats},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`locale`,`format`]))])}var Cc=V(J.register([`date`,`datetime`,`time`],{components:{DitoAffixes:q},nativeField:!0,textField:!0,computed:{dateValue:{get(){let{value:e}=this;return e&&((0,r.parsePlainDate)(e)??new Date(e))},set(e){this.value=e}},formats:F(`formats`,{type:Object,default:null,get(e){let{date:t,time:n}=(0,r.assignDeeply)({},this.api.formats,e);return{date:[`date`,`datetime`].includes(this.type)?t:null,time:[`time`,`datetime`].includes(this.type)?n:null}}})},methods:{getComponent(e){return{date:ti,time:pi,datetime:gi}[e]}},processValue({schema:e,value:t}){return(0,r.isDate)(t)?e.type===`date`?(0,r.formatPlainDate)(t):t.toISOString():t}}),[[`render`,Sc]]);function wc(e){let t=e?(0,r.isArray)(e)?e:Object.entries(e):[];return new URLSearchParams(t.reduce((e,[t,n])=>{if((0,r.isArray)(n))for(let r of n)e.push([t,r??``]);else n!=null&&e.push([t,n]);return e},[])).toString().replaceAll(/%(?:21|24|28|29|2C|2F|3A|3B|3D|3F|40)/g,decodeURIComponent)}function Tc({path:e,query:t,hash:n}){let{location:r}=window;history.replaceState(history.state,null,`${r.origin}${e??r.pathname}?${t?wc(t):r.search.slice(1)}${n??r.hash}`)}var Y={mixins:[Ja,Vo,Fi],defaultValue:e=>w(e.schema)?[]:null,excludeValue:e=>!!e.schema.resource,provide(){return{$sourceComponent:()=>this}},data(){return{wrappedPrimitives:null}},computed:{sourceComponent(){return this},isObjectSource(){return C(this.type)},isListSource(){return w(this.type)},hasData(){return!!this.value},shouldRender(){return this.sourceDepth<this.maxDepth},isReady(){return this.shouldRender&&(this.hasData||!this.providesData)},isInView(){return!!this.viewComponent},wrapPrimitives(){return this.schema.wrapPrimitives},valueListData(){let{value:e}=this;return this.isObjectSource?e==null?[]:[e]:(this.isListResults(e)?e.results:e)||[]},primitiveValues(){return this.wrapPrimitives?[...this.valueListData]:null},listData:{get(){return this.wrapPrimitives?this.wrappedPrimitives||[]:this.valueListData},set(e){this.wrapPrimitives?this.wrappedPrimitives=e:this.value=this.isObjectSource?e?.length>0?e[0]:null:un(this.sourceSchema,e,this.paginationRange)}},objectData:{get(){return this.listData[0]||null},set(e){this.listData=e?[e]:[]}},sourceSchema(){return this.schema},sourceDepth(){return this.$route.matched.reduce((e,t)=>e+ +(t.meta.schema===this.sourceSchema),0)},path(){return this.routeComponent.getChildPath(this.schema.path)},defaultQuery(){let{defaultOrder:e}=this;return e?{order:e}:{}},query:Mn(`query`,{get(e){return{...this.defaultQuery,...e}},set(e){let{scope:t=this.defaultScope?.name,page:n=this.schema.page,type:i}=this.query;return e={...this.query,...t!=null&&{scope:t},...n!=null&&{page:n},...i!=null&&{type:i},...e},(0,r.equals)(e,this.$route.query)||Tc({query:e}),e}}),total:Mn(`total`),columns(){return k(this.schema.columns)},scopes(){return k(this.schema.scopes)},defaultScope(){let e=null;if(this.scopes)for(let t of Object.values(this.scopes)){if(t.defaultScope)return t;e||=t}return e},defaultOrder(){if(this.columns)for(let e of Object.values(this.columns)){let{defaultSort:t}=e;if(t){let n=(0,r.isString)(t)?t:`asc`;return`${e.name} ${n}`}}return null},nestedMeta(){return{...this.meta,schema:this.schema}},forms(){return Object.values(O(this.schema,this.context))},view(){return Pt(this.schema,this.context)},linksToView(){return!!this.view},buttonSchemas(){return Ut(this.schema.buttons)},isCompact(){return this.forms.every(ut)},isInlined(){return dt(this.schema)},paginate:F(`paginate`,{type:Number}),render:F(`render`,{type:Function,default:null}),hasItems(){return this.isListSource||!!this.value},creatable:F(`creatable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)?!this.isObjectSource||!this.value:!1}}),editable:F(`editable`,{type:Boolean,default:!1,get(e){return e&&!this.isInlined&&this.hasItems}}),deletable:F(`deletable`,{type:Boolean,default:!1,get(e){return e&&this.hasItems}}),draggable:F(`draggable`,{type:Boolean,default:!1,get(e){return this.isListSource&&e}}),collapsible:F(`collapsible`,{type:Boolean,default:!1,get(e){return e&&this.isInlined}}),collapsed:F(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}}),maxDepth:F(`maxDepth`,{type:Number,default:1}),createPath(){return this.creatable?It(this.schema,this.context)||this.path:null}},watch:{$route:{flush:`post`,handler(e,t){this.providesData&&(t.path===e.path&&t.hash===e.hash?(this.query=e.query,this.loadData(!1)):this.meta.reload&&t.path!==e.path&&t.path.startsWith(e.path)&&(this.meta.reload=!1,this.loadData(!1)))}},value:{immediate:!0,handler(e){this.isListResults(e)&&this.unwrapListData(e)}},primitiveValues:{immediate:!0,handler(e){if(e&&!(0,r.equals)(e,this.unwrapPrimitives())){let{wrapPrimitives:t}=this;this.wrappedPrimitives=e.map(e=>({[t]:e}))}}},wrappedPrimitives:{deep:!0,handler(){let e=this.unwrapPrimitives();e&&!(0,r.equals)(e,this.primitiveValues)&&(this.value=e)}}},methods:{setupData(){this.query=this.$route.query,this.ensureData()},clearData(){this.total=0,this.setLoadedValue(null)},setData(e){if(this.isListSource&&(0,r.isArray)(e))this.setLoadedListItems(e);else if(!e||this.isObjectSource&&(0,r.isObject)(e))this.setLoadedValue(e);else if(!this.unwrapListData(e)&&(0,r.isObject)(e)&&this.isInView)return this.viewComponent.setData(e);return this.value},isListResults(e){return this.isListSource&&(0,r.isObject)(e)&&(0,r.isNumber)(e.total)&&(0,r.isArray)(e.results)},unwrapPrimitives(){let{wrapPrimitives:e,wrappedPrimitives:t}=this;return e&&t?t.map(t=>t[e]):null},unwrapListData(e){if(this.isListResults(e))return this.total=e.total,this.setLoadedListItems(e.results),this.value},setLoadedListItems(e){this.setLoadedValue(un(this.sourceSchema,e,this.paginationRange))},setLoadedValue(e){this.dataModel.applyCleanChanges(()=>{this.value=e}).catch(console.error)},createItem(e,t,n=null){let r=this.createData(e,t);if(this.isObjectSource)this.objectData=r;else{let{listData:e}=this;n==null?e.push(r):e.splice(n,0,r),this.listData=e}return this.collapsible&&this.$nextTick(()=>this.openSchemaComponent(n??-1)),this.onChange(),r},removeItem(e,t){let n=!1;if(this.isObjectSource)this.objectData=null,n=!0;else{let{listData:e}=this;t>=0&&(e.splice(t,1),this.listData=e,n=!0)}n&&(this.removeItemStore(this.schema,e,t),this.onChange())},deleteItem(e,t){let n=e&&this.getItemLabel(this.schema,e,{index:t,extended:!0}),r=()=>this.notify({type:this.isTransient?`info`:`success`,title:`Successfully Removed`,text:[`${n} was ${this.verbs.deleted}.`,this.transientNote]});if(e&&window.confirm(`Do you really want to ${this.verbs.delete} ${n}?`)){if(this.isTransient)this.removeItem(e,t),r();else{let n=this.getItemId(this.schema,e,t),i=`delete`,a=Zn(n,this.getResource({method:i}));a&&this.handleRequest({method:i,resource:a},n=>{n||(this.removeItem(e,t),r()),this.reloadData()})}}},getSchemaComponent(e){let{listData:t,schemaComponents:n}=this,r=n.at(e);if(t?.length){let i=t.at(e);return i==null?null:r?.data===i?r:n.find(e=>e.data===i)}return r},openSchemaComponent(e){let t=this.getSchemaComponent(e);t&&(t.opened=!0)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let i=e.startsWith(this.dataPath)?this.isListSource?(0,r.parseDataPath)(e.slice(this.dataPath.length+1))[0]??null:0:null;return i!==null&&(0,r.isNumber)(+i)&&await this.getSchemaComponent(+i)?.navigateToComponent(e,t,{shouldRevealInlinedOnly:n})?!0:!n&&this.navigateToRouteComponent(e,t)},navigateToRouteComponent(e,t){return new Promise((n,i)=>{let a=()=>{let{routeComponents:e}=this.appState,r=e[e.length-1];n(t?.([r])??!0)},o=(0,r.parseDataPath)(e);for(;o.length>0;){let e=this.routeComponent.getChildPath(this.api.normalizePath((0,r.normalizeDataPath)(o))),{matched:t}=this.$router.resolve(e);if(t.length&&t[0].name!==`catch-all`){this.$route.path===e?a():this.$router.push({path:e}).catch(i).then(()=>{this.$nextTick(a)});return}o.pop()}n(!1)})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){Wn(e,t,n);let c=dt(t);if(c&&t.resource)throw Error(`Nested ${this.isListSource?`lists`:this.isObjectSource?`objects`:`schema`} cannot load data from their own resources`);let l=`id${i+1}`,u={api:e,schema:t},d={...u,flatten:o,nested:a,param:l},f=await Gn(e,t,i);if(s&&await s(f,i+1),D(t)&&!c){let e=i===0?``:t.path,n={path:Dc(e,w(t)?l:null),component:B.component(a?`DitoFormNested`:`DitoForm`),meta:d};C(t)&&r.push({...n,path:Dc(e,l)}),e&&w(t)&&r.push({path:e,redirect:`.`,meta:u});let[s,c]=f.reduce((e,t)=>(e[+!t.meta.flatten].push(t),e),[[],[]]);if(c.length&&(n.children=c),r.push(n),s.length)for(let e of s)r.push({...e.redirect?e:n,path:`${n.path}/${e.path}`,meta:{...e.meta,flatten:o}})}},processValue({schema:e,value:t,dataPath:n},r){return r.addSource(n,e),D(e)?t:Ec(t)}};function Ec(e){return(0,r.isArray)(e)?e.map(e=>(0,r.isObject)(e)?{...e}:e):(0,r.isObject)(e)?{...e}:e}function Dc(e,t){return t?e?`${e}/:${t}`:`:${t}`:e}var Oc={text(e){let t=[{label:`contains`,value:`contains`},{label:`equals`,value:`equals`},{label:`starts with`,value:`starts-with`},{label:`ends with`,value:`ends-with`}];return{operator:e.operators?{type:`select`,width:`2/5`,options:(0,r.isArray)(e.operators)?t.filter(t=>e.operators.includes(t.value)):t,clearable:!0}:null,text:{type:`text`,width:e.operators?`3/5`:`fill`,clearable:!0}}},"date-range"(){let e={type:`datetime`,width:`1/2`,formats:{date:{day:`2-digit`,month:`2-digit`,year:`numeric`}},clearable:!0};return{from:e,to:e}}};function kc(e,t,n,r){let{sticky:i,...a}=t,o={type:`panel`,label:`Filters`,name:`$filters`,disabled:!1,sticky:i,data(){return Ic(o,r.value)},components:Nc(a),buttons:Ac(!1),panelButtons:Ac(!0),events:{change(){this.applyFilters()}},computed:{filters(){return Fc(this.schema,this.data)},hasFilters(){return this.filters.length>0}},methods:{applyFilters(){r.value={...r.value,filter:this.filters,page:void 0}},clearFilters(){this.resetData(),this.applyFilters()}}};return Un(e,o),o}function Ac(e){return{clear:{type:`button`,text:e?null:`Clear`,disabled:({schemaComponent:e})=>!e.hasFilters,events:{click({schemaComponent:e}){e.clearFilters()}}},submit:{type:`submit`,text:e?null:`Filter`,visible:!e,events:{click({schemaComponent:e}){e.applyFilters()}}}}}function jc(e){return`$${e}`}function Mc(e){return e.startsWith(`$`)?e.slice(1):null}function Nc(e){let t={};for(let n of Object.values(k(e)||{})){let{filter:e,width:i,...a}=n,o=e?Oc[e]?.(n):n.components;if(o){a.type=`form`,a.components={};for(let[e,t]of Object.entries(o))if(t){let n=t.label||(0,r.labelize)(t.name||e);a.components[e]={...t,label:!1,placeholder:n}}t[jc(n.name)]={label:a.label??(0,r.labelize)(n.name),type:`object`,width:i,default:()=>({}),form:a,inlined:!0}}else throw Error(`Invalid filter '${n.name}': Unknown filter type '${e}'.`)}return t}function Pc(e,t){return e.components[t]?.form?.components}function Fc(e,t){let n=[];for(let r in t){let i=t[r];if(i){let t=Object.keys(Pc(e,r)).map(e=>i[e]??null);t.some(e=>e!==null)&&n.push(`${Mc(r)}:${t.map(JSON.stringify).join(`,`)}`)}}return n}function Ic(e,t){let n={};if(t)for(let e of(0,r.asArray)(t.filter)){let[,t,i]=e.match(/^(\w+):(.*)$/);try{n[t]=(0,r.asArray)(JSON.parse(`[${i}]`))}catch{}}let i={};for(let t in e.components){let r={},a=n[Mc(t)];if(a){let n=Pc(e,t);if(n){let e=0;for(let t in n)r[t]=a[e++]}}i[t]=r}return i}var Lc=[`id`,`aria-label`],Rc={key:0,class:`dito-list__header`},zc={key:1,class:`dito-spacer`},Bc=[`id`],Vc={key:1},Hc=[`innerHTML`],Uc=[`innerHTML`],Wc={key:2,class:`dito-table__buttons`},Gc={key:1},Kc=[`colspan`];function qc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoScopes`),c=(0,e.resolveComponent)(`DitoPagination`),l=(0,e.resolveComponent)(`DitoTableHead`),u=(0,e.resolveComponent)(`DitoTableCell`),d=(0,e.resolveComponent)(`DitoSchemaInlined`),f=(0,e.resolveComponent)(`DitoEditButtons`),p=(0,e.resolveComponent)(`DitoDraggable`);return t.isReady?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-list`,id:t.componentPath,role:`region`,"aria-label":t.label||t.labelize(t.schema.name)},[t.scopes||t.hasPagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Rc,[t.scopes?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,query:t.query,scopes:t.scopes},null,8,[`query`,`scopes`])):t.hasPagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,zc)):(0,e.createCommentVNode)(``,!0),t.hasPagination?((0,e.openBlock)(),(0,e.createBlock)(c,{key:2,query:t.query,limit:t.paginate,total:t.total||0},null,8,[`query`,`limit`,`total`])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`table`,{class:(0,e.normalizeClass)([`dito-table`,{"dito-table--separators":t.isInlined,"dito-table--larger-padding":t.hasEditButtons&&!t.isInlined,"dito-table--alternate-colors":!t.isInlined,"dito-table--even-count":t.hasEvenCount}])},[t.columns?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,query:t.query,columns:t.columns,hasEditButtons:t.hasEditButtons},null,8,[`query`,`columns`,`hasEditButtons`])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(p,{as:`tbody`,options:t.getDraggableOptions(),draggable:t.draggable,modelValue:t.listData,"onUpdate:modelValue":n[0]||=e=>t.listData=e},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.listData,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,{id:t.getComponentPath(r),key:t.getItemUid(t.schema,n)},[t.columns?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.columns,i=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(i)?((0,e.openBlock)(),(0,e.createBlock)(u,{key:i.name,class:(0,e.normalizeClass)(t.getCellClass(i)),cell:i,schema:t.schema,dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.store,nested:!1,disabled:t.disabled||t.isLoading},null,8,[`class`,`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)],64))),256)):((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Vc,[t.isInlined?((0,e.openBlock)(),(0,e.createBlock)(d,{key:0,label:t.getItemLabel(t.schema,n,{index:r,asObject:!0}),schema:t.getItemFormSchema(t.schema,n,t.context),dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.getItemStore(t.schema,n,r),disabled:t.disabled||t.isLoading,collapsed:t.collapsed,collapsible:t.collapsible,deletable:t.deletable,draggable:t.draggable&&t.listData.length>1,editable:t.editable,editPath:t.getEditPath(n,r),createPath:t.createPath,insertIndex:t.creatable&&t.draggable?r:null,onDelete:e=>t.deleteItem(n,r)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`draggable`,`editable`,`editPath`,`createPath`,`insertIndex`,`onDelete`])):t.schema.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),{key:1,dataPath:t.getDataPath(r),data:n,nested:!1},null,8,[`dataPath`,`data`])):t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,innerHTML:t.render(t.getContext(n,r))},null,8,Hc)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:3,innerHTML:t.getItemLabel(t.schema,n,{index:r})},null,8,Uc))])),t.hasCellEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Wc,[(0,e.createVNode)(f,{nested:``,schema:t.getItemFormSchema(t.schema,n,t.context),dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.getItemStore(t.schema,n,r),disabled:t.disabled||t.isLoading,deletable:t.deletable,draggable:t.draggable,editable:t.editable,editPath:t.getEditPath(n,r),onDelete:e=>t.deleteItem(n,r)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`onDelete`])])):(0,e.createCommentVNode)(``,!0)],8,Bc))),128))]),_:1},8,[`options`,`draggable`,`modelValue`]),t.hasListButtons&&!t.single?((0,e.openBlock)(),(0,e.createElementBlock)(`tfoot`,Gc,[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`td`,{class:`dito-table__buttons`,colspan:t.numColumns},[(0,e.createVNode)(f,{buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`,`creatable`,`createPath`])],8,Kc)])])):(0,e.createCommentVNode)(``,!0)],2),t.hasListButtons&&t.single?((0,e.openBlock)(),(0,e.createBlock)(f,{key:1,class:`dito-buttons--large dito-buttons--main dito-buttons--sticky`,buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.listData,meta:t.meta,store:t.store,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`creatable`,`createPath`])):(0,e.createCommentVNode)(``,!0)],8,Lc)):(0,e.createCommentVNode)(``,!0)}var Jc=V(J.register(`list`,{mixins:[Y,ss],getSourceType(e){return e},getPanelSchema(t,n,i,a){let{filters:o}=n;if(o)return kc(t,o,i,(0,e.computed)({get(){return a.query},set(e){let t=e=>(0,r.pickBy)(e,e=>e!==void 0);(0,r.equals)(t(e),t(a.query))||(a.query=e,a.loadData(!1))}}))},computed:{hasPagination(){return!!this.paginate},hasListButtons(){return!!(this.buttonSchemas||this.creatable)},hasEditButtons(){let{listData:e}=this;return e.length>0&&(this.editable||this.deletable||this.draggable)},hasCellEditButtons(){return!this.isInlined&&this.hasEditButtons},hasEvenCount(){return!(this.listData.length%2)},numColumns(){return(this.columns?Object.keys(this.columns).length:1)+ +!!this.hasCellEditButtons}},methods:{getDataPath(e){return y(this.dataPath,e)},getComponentPath(e){return y(this.componentPath,e)},getEditPath(e,t){if(this.editable){let n=this.getItemId(this.schema,e,t);return Lt(this.schema,n,this.context)||`${this.path}/${n}`}return null},getCellClass(e){return`dito-cell--${(0,r.hyphenate)(e.name)}`},getContext(e,t){return new E(this,{data:e,value:e,index:t,dataPath:this.getDataPath(t)})},onFilterErrors(e){let t=y(this.dataPath,`$filters`),n=this.schemaComponent.getPanelByDataPath(t);if(n)return n.showValidationErrors(e,!0),!0}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Rn(t),zn(t.columns),Y.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,qc]]);function Yc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoLabel`);return(0,e.openBlock)(),(0,e.createBlock)(s,{class:`dito-label-component`,label:t.value},null,8,[`label`])}var Xc=V(J.register(`label`,{excludeValue:!0,generateLabel:!1}),[[`render`,Yc]]);function Zc(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&el(e.charCodeAt(r-1))&&$c(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Zc(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Qc(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&el(e.charCodeAt(i-1))&&$c(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Qc(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function $c(e){return e>=56320&&e<57344}function el(e){return e>=55296&&e<56320}var X=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Zc(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Qc(this,e,t,n)}findIndex(e){if(e==0)return nl(0,e);if(e==this.size)return nl(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?nl(t+1,i):nl(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};X.empty=new X([],0);var tl={index:0,offset:0};function nl(e,t){return tl.index=e,tl.offset=t,tl}function rl(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!rl(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!rl(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Z=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Z.none=[];var il=class extends Error{},al=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=sl(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(ol(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(X.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};al.empty=new al(X.empty,0,0);function ol(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(ol(a.content,t-i-1,n-i-1)))}function sl(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=sl(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function cl(e,t,n){if(n.openStart>e.depth)throw new il(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new il(`Inconsistent open depths`);return ll(e,t,n,0)}function ll(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ll(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return $(a,ml(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return $(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=hl(n,e);return $(a,pl(e,i,o,t,r))}}function ul(e,t){if(!t.type.compatibleContent(e.type))throw new il(`Cannot join `+t.type.name+` onto `+e.type.name)}function dl(e,t,n){let r=e.node(n);return ul(r,t.node(n)),r}function Q(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function fl(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Q(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Q(i.child(e),r);t&&t.depth==n&&t.textOffset&&Q(t.nodeBefore,r)}function $(e,t){if(!e.type.validContent(t))throw new il(`Invalid content for node `+e.type.name);return e.copy(t)}function pl(e,t,n,r,i){let a=e.depth>i&&dl(e,t,i+1),o=r.depth>i&&dl(n,r,i+1),s=[];return fl(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(ul(a,o),Q($(a,pl(e,t,n,r,i+1)),s)):(a&&Q($(a,ml(e,t,i+1)),s),fl(t,n,i,s),o&&Q($(o,ml(n,r,i+1)),s)),fl(r,null,i,s),new X(s)}function ml(e,t,n){let r=[];return fl(null,e,n,r),e.depth>n&&Q($(dl(e,t,n+1),ml(e,t,n+1)),r),fl(t,null,n,r),new X(r)}function hl(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(X.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var gl=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 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 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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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 n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Z.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new bl(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=yl.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else yl.set(t,r=new _l);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%vl,i}},_l=class{constructor(){this.elts=[],this.i=0}},vl=12,yl=new WeakMap,bl=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},xl=Object.create(null),Sl=class e{constructor(e,t,n,r=Z.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||X.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&rl(this.attrs,t||e.defaultAttrs||xl)&&Z.sameSet(this.marks,n||Z.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return al.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new al(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return cl(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return gl.resolveCached(this,e)}resolveNoCache(e){return gl.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),Cl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=X.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),wl(this.type.attrs,this.attrs,`node`,this.type.name);let e=Z.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];wl(n.type.attrs,n.attrs,`mark`,n.type.name),e=n.addToSet(e)}if(!Z.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=X.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};Sl.prototype.text=void 0;function Cl(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function wl(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}var Tl=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new El(t,n);if(r.next==null)return e.empty;let i=Dl(r);r.next&&r.err(`Unexpected trailing text`);let a=Ll(Pl(i));return Rl(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return X.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
7
- `)}};Tl.empty=new Tl(!0);var El=class{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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Dl(e){let t=[];do t.push(Ol(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ol(e){let t=[];do t.push(kl(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function kl(e){let t=Nl(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=jl(e,t);else break;return t}function Al(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function jl(e,t){let n=Al(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Al(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ml(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Nl(e){if(e.eat(`(`)){let t=Dl(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ml(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Pl(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Fl(e,t){return t-e}function Il(e,t){let n=[];return r(t),n.sort(Fl);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Ll(e){let t=Object.create(null);return n(Il(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Il(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Tl(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Fl);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Rl(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var zl=[`id`],Bl={key:0,class:`dito-buttons dito-buttons--toolbar`},Vl={class:`dito-buttons__group`},Hl=[`aria-label`,`aria-pressed`,`onClick`];function Ul(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`EditorContent`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-markup`,id:t.componentPath},[t.groupedButtons.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Bl,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.groupedButtons,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Vl,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t,({id:t,label:n,icon:r,isActive:i,onClick:a})=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{class:(0,e.normalizeClass)([`dito-button`,{"dito-button--active":i}]),key:t,"aria-label":n,"aria-pressed":i,onClick:a},[(0,e.createVNode)(s,{name:r},null,8,[`name`])],10,Hl))),128))]))),256))])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(c,{class:`dito-markup-editor`,ref:`editor`,editor:t.editor,style:(0,e.normalizeStyle)(t.styles)},null,8,[`editor`,`style`]),t.resizable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-resize`,onMousedown:n[0]||=(0,e.withModifiers)((...e)=>t.onDragResize&&t.onDragResize(...e),[`stop`,`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0)],8,zl)}var Wl=J.register(`markup`,{mixins:[K],components:{EditorContent:f.EditorContent,DitoIcon:U},data(){return{editor:null,height:null}},computed:{lines(){return this.schema.lines||10},hardBreak(){return!!this.schema.hardBreak},styles(){return{height:this.height||`calc(${this.lines}em * var(--line-height))`}},markButtons(){return this.getButtons(`marks`,{bold:!0,italic:!0,underline:!0,strike:!0,small:!0,code:!0,subscript:!0,superscript:!0,link:{onClick:e=>this.onClickLink(e)}})},basicNodeButtons(){return this.getButtons(`nodes`,{paragraph:{command:`setParagraph`},heading:{attribute:`level`,values:[1,2,3,4,5,6]}})},advancedNodeButtons(){return this.getButtons(`nodes`,{bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0})},toolButtons(){return this.getButtons(`tools`,{undo:!0,redo:!0,footnotes:{command:`addFootnote`}})},groupedButtons(){return[this.markButtons,this.basicNodeButtons,this.advancedNodeButtons,this.toolButtons].filter(e=>e.length>0)},parseOptions(){return{preserveWhitespace:{collapse:!1,preserve:!0,"preserve-all":`full`}[this.whitespace]}},editorOptions(){return{editable:!this.readonly,autoFocus:this.autofocus,disableInputRules:!this.enableRules.input,disablePasteRules:!this.enableRules.paste,parseOptions:this.parseOptions,editorProps:this.hardBreak?{handlePaste:(e,t,n)=>{let r=[];n.content.forEach((t,n,i)=>{i>0&&t.type.name===`paragraph`&&r.push(e.state.schema.nodes.hardBreak.create()),t.type.name===`paragraph`?t.content.forEach(e=>r.push(e)):r.push(t)});let i=e.state.schema.nodes.paragraph.create(null,X.from(r));return e.dispatch(e.state.tr.replaceSelection(new al(X.from(i),0,0))),!0}}:{}}},resizable:F(`resizable`,{type:Boolean,default:!1}),whitespace:F(`whitespace`,{type:String,default:`collapse`}),enableRules:F(`enableRules`,{type:[Object,Boolean],default:!1,get(e){return(0,r.isObject)(e)?e:{input:!!e,paste:!!e}}})},watch:{readonly:`updateEditorOptions`,autofocus:`updateEditorOptions`,enableRules:`updateEditorOptions`},created(){let e=!1,t=!1,n=()=>this.onFocus(),i=()=>{s(),this.onBlur(),c()},a=()=>{o(),this.onInput()},o=(0,r.debounce)(()=>s(),100),s=()=>{let n=this.editor.getHTML(),r=this.hardBreak?n.replace(/^<p>(.*?)<\/p>$/s,`$1`):n;r!==this.value&&(e=!0,t=!0,this.value=r),this.focused||c()},c=()=>{e&&(e=!1,this.onChange())};this.$watch(`value`,e=>{if(t)t=!1;else{let t=this.hardBreak?`<p>${e}</p>`:e;this.editor.commands.setContent(t,{emitUpdate:!1,parseOptions:this.parseOptions})}}),this.editor=new f.Editor({...this.editorOptions,onFocus:n,onBlur:i,onUpdate:a,extensions:this.getExtensions(),content:this.value||``})},unmounted(){this.editor.destroy()},methods:{onDragResize(e){let t=({clientX:e,clientY:t})=>({x:e,y:t}),n=t(e).y,r=parseFloat(getComputedStyle(this.$refs.editor.$el).height),i=e=>{let{y:i}=t(e);r+=i-n,n=i,this.height=`${Math.max(r,0)}px`},a=this.domOn(document,{mousemove:i,mouseup(e){i(e),a.remove()}})},updateEditorOptions(){this.editor.setOptions(this.editorOptions)},async onClickLink(e){let t=await this.rootComponent.showDialog({components:{href:{type:`url`,label:`Link`,autofocus:!0},title:{type:`text`,label:`Title`}},buttons:{cancel:{},apply:{type:`submit`},remove:{events:{click({dialogComponent:e}){e.resolve(null)}}}},data:(0,f.getMarkAttributes)(this.editor.state,`link`)});if(t){let{href:n,title:r}=t;if(n)try{new URL(n)}catch{n=`https://${n}`}e.commands.setLink({href:n,title:r})}else t===null&&e.commands.unsetLink()},getExtensions(){let{marks:e={},nodes:t={},tools:n={}}=this.schema;return[n.footnotes?p.Document.extend({content:`block+ footnotes?`}):p.Document,m.Text,le.Paragraph,e.bold&&h.Bold,e.italic&&ee.Italic,e.underline&&ie.Underline,e.strike&&te.Strike,e.small&&Gl,e.code&&g.Code,e.subscript&&re.Superscript,e.superscript&&ne.Subscript,e.link&&Kl,t.blockquote&&ae.Blockquote,t.codeBlock&&oe.CodeBlock,t.heading&&ce.Heading.configure({levels:t.heading}),t.horizontalRule&&ue.HorizontalRule,(t.orderedList||t.bulletList)&&pe.ListItem,t.bulletList&&fe.BulletList,t.orderedList&&de.OrderedList,...n.footnotes?[me.Footnotes,me.Footnote,me.FootnoteReference]:[],n.history&&he.History,se.HardBreak.extend({addKeyboardShortcuts:()=>{let e=()=>this.editor.commands.setHardBreak();return{"Mod-Enter":e,"Shift-Enter":e,...this.hardBreak?{Enter:e}:null}}})].filter(e=>!!e)},getButtons(e,t){let n=[],{commands:i}=this.editor,a=({name:e,id:t=e,label:a=this.labelize(t),icon:o,command:s,attributes:c,onClick:l})=>{n.push({id:t,label:a,icon:o,isActive:this.editor.isActive(e,c),onClick:()=>{s??=e in i?e:`toggle${(0,r.camelize)(e,!0)}`,s in i&&(l?l(this.editor,c):(e=>this.editor.chain()[s](e).focus().run())(c))}})},o=this.schema[e];if(o)for(let[e,n]of Object.entries(t)){let t=o[[`undo`,`redo`].includes(e)?`history`:e],i=(0,r.hyphenate)(e);if(t){if(n===!0)a({name:e,icon:i});else if((0,r.isObject)(n)){let{command:o,attribute:s,values:c,onClick:l}=n;if(s){if((0,r.isArray)(c)&&(0,r.isArray)(t))for(let n of c)t.includes(n)&&a({name:e,id:`${e}-${n}`,icon:`${i}-${n}`,command:o,attributes:{[s]:n},onClick:l})}else a({name:e,icon:i,command:o,onClick:l})}}}return n},focusElement(){this.editor.commands.focus()},blurElement(){this.editor.commands.blur()}}}),Gl=f.Mark.create({name:`small`,parseHTML(){return[{tag:`small`}]},renderHTML(){return[`small`,0]},addCommands(){return{setSmall:e=>({commands:t})=>t.setMark(this.name,e),toggleSmall:e=>({commands:t})=>t.toggleMark(this.name,e),unsetSmall:()=>({commands:e})=>e.unsetMark(this.name)}}}),Kl=_.Link.extend({inclusive:!1,addAttributes(){return{href:{default:null},title:{default:null}}},parseHTML(){return[{tag:`a`,getAttrs:e=>({href:e.getAttribute(`href`),title:e.getAttribute(`title`)})}]},renderHTML({HTMLAttributes:e}){return[`a`,e,0]}}),ql=V(Wl,[[`render`,Ul]]),Jl={class:`dito-multiselect`},Yl={class:`dito-multiselect__inner`},Xl=[`title`],Zl=[`onKeydown`,`onMousedown`];function Ql(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`VueMultiselect`),l=(0,e.resolveComponent)(`DitoEditButtons`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Jl,[(0,e.createElementVNode)(`div`,Yl,[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`]),(0,e.createVNode)(c,(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.selectedOptions,"onUpdate:modelValue":n[1]||=e=>t.selectedOptions=e,"aria-label":t.label,class:t.multiselectClasses,showLabels:!1,placeholder:t.placeholder,tagPlaceholder:`Press enter to add new tag`,options:t.populate&&t.activeOptions||[],customLabel:t.getLabelForOption,trackBy:t.optionValue,groupLabel:t.groupByLabel,groupValues:t.groupByOptions,multiple:t.multiple,taggable:t.taggable,searchable:t.searchable,internalSearch:!t.searchFilter,preserveSearch:!!t.searchFilter,clearOnSelect:!t.searchFilter,closeOnSelect:!t.stayOpen,loading:t.isLoadingOptions||t.isLoadingSearchedOptions},t.attributes,{onOpen:t.onOpen,onClose:t.onClose,onTag:t.onAddTag,onSearchChange:t.onSearchChange}),{tag:(0,e.withCtx)(({option:r,remove:i})=>[(0,e.createElementVNode)(`span`,{class:(0,e.normalizeClass)([`multiselect__tag dito-multiselect__tag`,{"dito-multiselect__tag--unavailable":t.isUnavailableOption(r)}]),title:t.isUnavailableOption(r)?`Not among the options`:null,onMousedown:n[0]||=(0,e.withModifiers)(()=>{},[`prevent`])},[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabelForOption(r)),1),(0,e.createElementVNode)(`i`,{class:`multiselect__tag-icon`,tabindex:`1`,onKeydown:(0,e.withKeys)((0,e.withModifiers)(e=>i(r),[`prevent`]),[`enter`]),onMousedown:(0,e.withModifiers)(e=>i(r),[`prevent`])},null,40,Zl)],42,Xl)]),_:1},16,[`id`,`modelValue`,`aria-label`,`class`,`placeholder`,`options`,`customLabel`,`trackBy`,`groupLabel`,`groupValues`,`multiple`,`taggable`,`searchable`,`internalSearch`,`preserveSearch`,`clearOnSelect`,`closeOnSelect`,`loading`,`onOpen`,`onClose`,`onTag`,`onSearchChange`]),(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),t.editable?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:!1,editable:t.editable,editPath:t.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editable`,`editPath`])):(0,e.createCommentVNode)(``,!0)])}var $l=V(J.register(`multiselect`,{mixins:[ec],components:{DitoAffixes:q,VueMultiselect:ge.default},data(){return{searchedOptions:null,isLoadingSearchedOptions:!1,currentSearchTerm:null,populate:!1}},computed:{selectedOptions:{get(){return this.multiple?this.hasOptions&&(0,r.isArray)(this.value)?this.value.map(e=>{let t=this.relate?this.getValueForOption(e):e;return this.getOptionForValue(t)||this.addTagOption(t)||this.getFallbackOption(e)}):[]:this.selectedOption},set(e){this.selectedValue=this.multiple?(e||[]).map(e=>this.getValueForOption(e)):this.getValueForOption(e),this.onChange()}},activeOptions(){return this.searchedOptions||this.options},multiple:F(`multiple`,{type:Boolean,default:!1}),searchable:F(`searchable`,{type:Boolean,default:!1}),taggable:F(`taggable`,{type:Boolean,default:!1}),stayOpen:F(`stayOpen`,{type:Boolean,default:!1}),multiselectClasses(){let e=`multiselect`;return{[`${e}--multiple`]:this.multiple,[`${e}--loading`]:this.isLoadingOptions||this.isLoadingSearchedOptions,[`${e}--highlight`]:this.showHighlight}},placeholder(){let{placeholder:e,searchable:t,taggable:n}=this.schema;return(0,r.isBoolean)(e)&&(e=e?void 0:null),e===void 0?t&&n?`Search or add a ${this.label}`:t?`Select or search ${this.label}`:void 0:e},showHighlight(){return this.isMounted&&this.$refs.element.pointerDirty}},mounted(){this.autofocus&&this.focus()},methods:{addTagOption(e){if(this.taggable){let{optionLabel:t,optionValue:n}=this,r=t&&n?{[t]:e,[n]:e}:e;return this.options.push(r),r}},isUnavailableOption(e){return this.optionValue?!this.getOptionForValue(this.getValueForOption(e)):!this.options.includes(e)},getFallbackOption(e){let{optionValue:t,optionLabel:n}=this;return(0,r.isObject)(e)||!(0,r.isString)(t)?e:{[t]:e,...(0,r.isString)(n)&&{[n]:`${e}`}}},focusElement(){this.$refs.element.activate()},blurElement(){this.$refs.element.deactivate()},onOpen(){this.populate=!0},onClose(){this.focused&&this.onBlur()},onBlur(){this.$refs.element.isOpen||Nn.methods.onBlur.call(this)},onAddTag(e){let t=this.addTagOption(e);t&&(this.value??=[],this.value.push(this.getValueForOption(t)))},async loadSearchedOptions(e){try{return await this.optionsResolver.waitForValue(),await this.searchFilter(new E(this,{searchTerm:e}))}catch(e){return this.addError(e.message||e),null}},async onSearchChange(e){if(this.searchFilter){if(this.currentSearchTerm=e,e){this.searchedOptions=[];let t=setTimeout(()=>{this.isLoadingSearchedOptions=!0},0),n=await this.loadSearchedOptions(e);clearTimeout(t),e===this.currentSearchTerm&&(this.searchedOptions=n,this.isLoadingSearchedOptions=!1)}else this.searchedOptions=null,this.isLoadingSearchedOptions=!1}}}}),[[`render`,Ql]]),eu={getTypeValidations(e,t){let n=e.type===`integer`,r=n=>A(n,{type:Number,schema:e,context:t}),i=(e,t)=>n&&e!=null?t(e):e,a=A(`range`,{type:Array,schema:e,context:t}),o=i(r(`min`)??a?.[0],Math.floor),s=i(r(`max`)??a?.[1],Math.ceil),c=i(r(`step`),Math.ceil),l=r(`decimals`),u={};if(o!=null&&s!=null?u.range=[o,s]:(o!=null&&(u.min=o),s!=null&&(u.max=s)),l!=null)u.decimals=l;else if(c){let e=(`${c}`.split(`.`)[1]||``).length;e>0?u.decimals=e:u.integer=!0}return n&&(u.integer=!0),u},computed:{inputValue:{get(){return this.value===null?``:this.value},set(e){this.value=e===``?null:this.isInteger?Number(e):parseFloat(e)}},isInteger(){return!1},stepValue(){return this.step==null&&!this.isInteger?`any`:this.step},decimals:F(`decimals`,{type:Number}),step:F(`step`,{type:Number,get(e){return this.isInteger&&e!=null?Math.ceil(e):e}}),min:F(`min`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[0]:e,this.isInteger&&e!=null?Math.floor(e):e}}),max:F(`max`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[1]:e,this.isInteger&&e!=null?Math.ceil(e):e}}),range:F(`range`,{type:Array,get(){let{min:e,max:t}=this;return e!=null&&t!=null?[e,t]:void 0},set(e){(0,r.isArray)(e)&&([this.min,this.max]=e)}})}};function tu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:`dito-number`,id:t.componentPath,ref:`element`,modelValue:t.inputValue,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:`number`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`min`,`max`,`step`])}var nu=V(J.register([`number`,`integer`],{mixins:[eu],components:{DitoInput:H,DitoAffixes:q},nativeField:!0,textField:!0,computed:{isInteger(){return this.type===`integer`}}}),[[`render`,tu]]),ru=[`id`],iu={key:0,class:`dito-object-content`},au=[`innerHTML`],ou=[`innerHTML`];function su(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSchemaInlined`),c=(0,e.resolveComponent)(`DitoEditButtons`);return t.isReady?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-object`,id:t.componentPath},[t.objectData?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,iu,[t.isInlined?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,label:t.objectLabel,schema:t.getItemFormSchema(t.schema,t.objectData,t.context),dataPath:t.dataPath,data:t.objectData,meta:t.nestedMeta,store:t.store,disabled:t.disabled||t.isLoading,collapsed:t.collapsed,collapsible:t.collapsible,deletable:t.deletable,accumulatedBasis:t.accumulatedBasis,onDelete:n[0]||=e=>t.deleteItem(t.objectData)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`accumulatedBasis`])):t.schema.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),{key:1,dataPath:t.dataPath,data:t.objectData,nested:!1},null,8,[`dataPath`,`data`])):t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,innerHTML:t.render(t.getContext())},null,8,au)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:3,innerHTML:t.getItemLabel(t.schema,t.objectData)},null,8,ou))])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(c,{buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.objectData,path:t.path,meta:t.meta,store:t.store,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath,editable:t.editable,editPath:t.path,deletable:!t.isInlined&&t.deletable,onDelete:n[1]||=e=>t.deleteItem(t.objectData)},null,8,[`buttons`,`schema`,`dataPath`,`data`,`path`,`meta`,`store`,`disabled`,`creatable`,`createPath`,`editable`,`editPath`,`deletable`])],8,ru)):(0,e.createCommentVNode)(``,!0)}var cu=V(J.register(`object`,{mixins:[Y],getSourceType(e){return e},computed:{objectLabel(){return this.collapsible?this.getItemLabel(this.schema,this.objectData,{asObject:!0}):null}},methods:{getContext(){return new E(this,{data:this.objectData})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Rn(t),Y.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,su]]),lu=J.register(`panel`,{defaultNested:!1,generateLabel:!1,omitSpacing:!0,getPanelSchema(e,t){return t},async processSchema(e,t,n,r,i){await L(e,t,r,i)},render(){return null}}),uu=[`id`,`value`,`max`];function du(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`progress`,(0,e.mergeProps)({class:`dito-progress`,id:t.componentPath,ref:`element`,value:t.progressValue,max:t.progressMax},t.attributes),null,16,uu)}var fu=V(J.register(`progress`,{mixins:[eu],computed:{progressValue(){let{value:e,range:t,step:n}=this;return e===null?e=``:(t&&(e-=t[0]),n&&(e=Math.round(e/n)*n)),e},progressMax(){let{range:e}=this;return e?e[1]-e[0]:null}}}),[[`render`,du]]),pu=[`id`,`aria-label`],mu=[`value`];function hu(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:(0,e.normalizeClass)([`dito-radio-buttons`,`dito-layout--${t.schema.layout||`vertical`}`]),id:t.componentPath,role:`radiogroup`,"aria-label":t.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.options,r=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`label`,null,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({class:`dito-radio-button`,ref_for:!0,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedValue=e,type:`radio`,value:t.getValueForOption(r)},{ref_for:!0},t.attributes),null,16,mu),[[e.vModelRadio,t.selectedValue]]),(0,e.createTextVNode)((0,e.toDisplayString)(t.getLabelForOption(r)),1)])]))),256))],10,pu)}var gu=V(J.register(`radio`,{mixins:[ec],nativeField:!0,defaultWidth:`auto`}),[[`render`,hu]]);function _u(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSchemaInlined`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-section`,{"dito-section--labelled":t.hasLabel}])},[(0,e.createVNode)(s,{class:`dito-section__schema`,schema:t.getItemFormSchema(t.schema,t.item,t.context),dataPath:t.dataPath,data:t.item,meta:t.meta,store:t.store,label:t.label,info:t.info,padding:t.hasLabel?`nested`:`inlined`,disabled:t.disabled,collapsed:t.collapsed,collapsible:t.collapsible,labelNode:t.labelNode},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`collapsed`,`collapsible`,`labelNode`])],2)}var vu=V(J.register(`section`,{mixins:[Fi],defaultValue:({schema:e})=>e.nested?{}:void 0,ignoreMissingValue:({schema:e})=>!e.nested&&!(`default`in e),treatNullAsMissing:({schema:e})=>!!e.nested,defaultNested:!1,generateLabel:!1,computed:{item(){return this.nested?this.value:this.data},hasLabel(){return!!this.schema.label},collapsible:F(`collapsible`,{type:Boolean,default:!1}),collapsed:F(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}})},methods:{getItemFormSchema:Vt,async navigateToComponent(e,t,n){let{mainSchemaComponent:i}=this,a=this.dataPath?`${this.dataPath}/`:``,o=(0,r.normalizeDataPath)(e),s=o.startsWith(a)?(0,r.parseDataPath)(o.slice(a.length))[0]:null;return!!i&&tt(i.schema,s)&&i.navigateToComponent(e,t,n)}},async processSchema(e,t,n,r,i){await L(e,t,r,i)}}),[[`render`,_u]]),yu={class:`dito-select`},bu={class:`dito-select__inner`},xu=[`id`],Su=[`label`],Cu=[`value`],wu=[`value`],Tu=[`value`];function Eu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoEditButtons`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,yu,[(0,e.createElementVNode)(`div`,bu,[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`]),(0,e.withDirectives)((0,e.createElementVNode)(`select`,(0,e.mergeProps)({id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedValue=e},t.attributes,{onMousedown:n[1]||=e=>t.populate=!0,onFocus:n[2]||=e=>t.populate=!0}),[t.populate?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.options,n=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.groupBy?((0,e.openBlock)(),(0,e.createElementBlock)(`optgroup`,{key:0,label:n[t.groupByLabel]},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(n[t.groupByOptions],n=>((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{value:t.getValueForOption(n)},(0,e.toDisplayString)(t.getLabelForOption(n)),9,Cu))),256))],8,Su)):((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{key:1,value:t.getValueForOption(n)},(0,e.toDisplayString)(t.getLabelForOption(n)),9,wu))],64))),256)):t.selectedOption?((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{key:1,value:t.selectedValue},(0,e.toDisplayString)(t.getLabelForOption(t.selectedOption)),9,Tu)):(0,e.createCommentVNode)(``,!0)],16,xu),[[e.vModelSelect,t.selectedValue]]),(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),t.editable?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:!1,editable:t.editable,editPath:t.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editable`,`editPath`])):(0,e.createCommentVNode)(``,!0)])}var Du=V(J.register(`select`,{mixins:[ec],components:{DitoAffixes:q},nativeField:!0,data(){return{populate:!0}}}),[[`render`,Eu]]),Ou={class:`dito-slider`},ku=[`id`,`min`,`max`,`step`];function Au(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ou,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({class:`dito-range`,id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:`range`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),null,16,ku),[[e.vModelText,t.inputValue]]),t.input?((0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({key:0,class:`dito-number`,modelValue:t.inputValue,"onUpdate:modelValue":n[1]||=e=>t.inputValue=e,type:`number`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),null,16,[`modelValue`,`min`,`max`,`step`])):(0,e.createCommentVNode)(``,!0)])}var ju=V(J.register(`slider`,{mixins:[eu],components:{DitoInput:H},nativeField:!0,computed:{input:F(`input`,{type:Boolean,default:!0})}}),[[`render`,Au]]);function Mu(e,t,n,r,i,a){return null}var Nu=V(J.register(`spacer`,{defaultValue:()=>void 0,excludeValue:!0,generateLabel:!1}),[[`render`,Mu]]);function Pu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSwitch`);return(0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({class:`dito-switch`,id:t.componentPath,ref:`element`,modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,labels:t.labels},t.attributes),null,16,[`id`,`modelValue`,`labels`])}var Fu=V(J.register(`switch`,{defaultValue:!1,defaultWidth:`auto`,components:{DitoSwitch:Oi},computed:{labels(){return this.schema.labels}}}),[[`render`,Pu]]),Iu={computed:{trim:F(`trim`,{type:Boolean,default:!1})},processValue(e){let{schema:t,value:n}=e;return t.trim&&n!=null&&(0,r.isString)(n)&&(n=n.trim()),n===``&&(n=qt(t,e)),n}};function Lu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:`dito-text`,id:t.componentPath,ref:`element`,modelValue:t.inputValue,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:t.inputType},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`type`])}var Ru=`****************`,zu=V(J.register([`text`,`email`,`url`,`hostname`,`domain`,`tel`,`password`,`creditcard`],{mixins:[Iu],components:{DitoInput:H,DitoAffixes:q},nativeField:!0,textField:!0,ignoreMissingValue:({schema:e})=>e.type===`password`,getTypeValidations(e){let t={email:`email`,url:`url`,hostname:`hostname`,domain:`domain`,password:`password`,creditcard:`creditcard`}[e.type];return t?{[t]:!0}:{}},computed:{inputType(){return{creditcard:`text`,hostname:`text`,domain:`text`}[this.type]||this.type},inputValue:{get(){return this.type===`password`&&this.value===void 0&&!this.focused?Ru:this.value},set(e){this.value=e}}}}),[[`render`,Lu]]),Bu=[`id`,`rows`];function Vu(t,n,r,i,a,o){return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,(0,e.mergeProps)({class:`dito-textarea dito-input`,id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.value=e},t.attributes,{rows:t.lines,class:{"dito-textarea--resizable":t.resizable}}),null,16,Bu)),[[e.vModelText,t.value]])}var Hu=V(J.register(`textarea`,{mixins:[Iu],nativeField:!0,textField:!0,computed:{lines(){return this.schema.lines||4},resizable:F(`resizable`,{type:Boolean,default:!1})}}),[[`render`,Vu]]),Uu={class:`dito-tree-list`},Wu={class:`dito-tree-panel`},Gu={key:1,class:`dito-tree-form-container`};function Ku(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoScopes`),c=(0,e.resolveComponent)(`DitoTreeItem`),l=(0,e.resolveComponent)(`DitoRouterView`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Uu,[t.scopes?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,query:t.query,scopes:t.scopes},null,8,[`query`,`scopes`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,Wu,[t.treeData?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,schema:t.treeSchema,dataPath:t.treeDataPath,data:t.treeData,draggable:t.draggable,open:!0,"onUpdate:data":n[0]||=e=>t.value=e},null,8,[`schema`,`dataPath`,`data`,`draggable`])):(0,e.createCommentVNode)(``,!0),t.editPath&&t.hasEditableForms?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Gu,[(0,e.createVNode)(l,{routeLevel:t.routeComponent.routeLevel+1},null,8,[`routeLevel`])])):(0,e.createCommentVNode)(``,!0)])])}var qu=V(J.register([`tree-list`,`tree-object`],{mixins:[Y],provide(){return{container:this}},getSourceType(e){return e===`tree-object`?`object`:`list`},computed:{path(){return this.formComponent?.path},editPath(){let e=this.$route.path.slice(this.path?.length);return e.startsWith(`/${this.schema.path}`)?e:``},treeData(){return this.isListSource?{[this.name]:this.value}:this.value},treeDataPath(){return this.isListSource?Ae(this.dataPath):this.dataPath},treeSchema(){return this.isListSource?{children:{name:this.name,...this.schema}}:this.schema},hasEditableForms(){let e=t=>D(t)&&(this.getSchemaValue(`editable`,{type:Boolean,default:!1,schema:t})||t.children&&e(t.children));return e(this.schema)}},async processSchema(e,t,n,r,i,a=!0,o=!1,s=null){await Promise.all([zn(t.properties),Y.processSchema(e,t,n,r,i,a,o,(n,r)=>{let{children:i}=t;if(i)return i.type=`tree-list`,this.processSchema(e,i,i.name,n,r,a,!0,s)})])},getFormSchemasForProcessing(e,t){let{children:n}=e;return O(e,t,n?e=>({...e,components:{...e.components,[n.name]:n}}):null)}}),[[`render`,Ku]]),Ju=[``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Yu(e,{base:t=10}={}){let n=Zu(t),r=Math.abs(e),i=Math.min(r>=1?Math.floor(Math.log(r)/Math.log(n)):0,Ju.length-1),a=Qu(r,n,i);a>=n&&i<Ju.length-1&&(a=Qu(r,n,++i));let o=Ju[i],s=o?t===10?`${o}B`:`${o.toUpperCase()}iB`:`B`;return`${e<0?`-`:``}${a} ${s}`}function Xu(e,{base:t=10}={}){let[,n,r]=String(e).match(/^([\d.,]*)\s*(\D*)$/)||[],i=parseFloat(n?.replace(`,`,`.`));if(!isFinite(i))throw Error(`Can't interpret file size: ${e}`);let a=Zu(/^[kmgtpezy]ib?$/i.test(r)?2:t),o=r.replace(/^bits?$/,`b`).match(/^([KMGTPEZY]?)b$/);if(o){let e=Ju.indexOf(o[1].replace(`K`,`k`));return Math.round(i*a**e/8)}let s=Ju.findIndex(e=>e.toLowerCase()===r.toLowerCase().replace(/^(bytes?|b)$/,``).replace(/^(\w)(i?b|i)$/,`$1`));if(s>=0)return Math.round(i*a**s);throw Error(`Invalid file size unit: ${r}`)}function Zu(e){return e===10?1e3:1024}function Qu(e,t,n){let r=n>0?100:1;return Math.round(e/t**n*r)/r}var $u={class:`dito-upload`},ed={class:`dito-table dito-table--separators dito-table--background`},td=[`innerHTML`],nd={key:1},rd=[`download`,`href`,`onClick`],id={key:2},ad={class:`dito-upload__size`},od={class:`dito-upload__status`},sd={class:`dito-table__buttons`},cd={class:`dito-buttons dito-buttons--round`},ld=[`title`],ud=[`onClick`],dd={key:0},fd={colspan:4},pd={class:`dito-upload-footer`},md=[`value`],hd={class:`dito-buttons dito-buttons--round`},gd=[`title`];function _d(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueUpload`),c=(0,e.resolveComponent)(`DitoUploadFile`),l=(0,e.resolveComponent)(`DitoDraggable`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,$u,[(0,e.createVNode)(s,{class:`dito-upload__input`,ref:`upload`,modelValue:t.uploads,"onUpdate:modelValue":n[0]||=e=>t.uploads=e,inputId:t.dataPath,name:t.dataPath,disabled:t.disabled,postAction:t.uploadPath,extensions:t.extensions,accept:t.accept,multiple:t.multiple,size:t.maxSize,drop:t.$el?.closest(`.dito-container`),dropDirectory:!0,onInputFilter:t.onInputFilter,onInputFile:t.onInputFile},null,8,[`modelValue`,`inputId`,`name`,`disabled`,`postAction`,`extensions`,`accept`,`multiple`,`size`,`drop`,`onInputFilter`,`onInputFile`]),(0,e.createElementVNode)(`table`,ed,[n[5]||=(0,e.createElementVNode)(`thead`,{class:`dito-table-head`},[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`File`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`Size`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`Status`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`)])])],-1),(0,e.createVNode)(l,{modelValue:t.files,"onUpdate:modelValue":n[2]||=e=>t.files=e,as:`tbody`,options:t.getDraggableOptions(),draggable:t.draggable},{default:(0,e.withCtx)(()=>[t.multiple||!t.isUploadActive?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.files,(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,{key:r.name},[t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,{key:0,innerHTML:t.renderFile(r,i)},null,8,td)):t.downloadUrls[i]?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,nd,[(0,e.createElementVNode)(`a`,{download:r.name,href:t.downloadUrls[i],target:`_blank`,onClick:(0,e.withModifiers)(e=>t.onClickDownload(r,i),[`prevent`])},[(0,e.createVNode)(c,{file:r,thumbnail:t.thumbnails,thumbnailUrl:t.thumbnailUrls[i]},null,8,[`file`,`thumbnail`,`thumbnailUrl`])],8,rd)])):((0,e.openBlock)(),(0,e.createElementBlock)(`td`,id,[(0,e.createVNode)(c,{file:r,thumbnail:t.thumbnails,thumbnailUrl:t.thumbnailUrls[i]},null,8,[`file`,`thumbnail`,`thumbnailUrl`])])),(0,e.createElementVNode)(`td`,ad,(0,e.toDisplayString)(t.formatFileSize(r.size)),1),(0,e.createElementVNode)(`td`,od,[r.upload?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[r.upload.error?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)(`Error: `+(0,e.toDisplayString)(r.upload.error),1)],64)):r.upload.active?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(`Uploading...`)],64)):r.upload.success?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createTextVNode)(`Uploaded`)],64)):(0,e.createCommentVNode)(``,!0)],64)):((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(`Stored`)],64))]),(0,e.createElementVNode)(`td`,sd,[(0,e.createElementVNode)(`div`,cd,[t.multiple?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-button dito-button--upload`,title:t.uploadTitle,onClick:n[1]||=(...e)=>t.onClickUpload&&t.onClickUpload(...e)},null,8,ld)),t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:1,class:`dito-button`},{ref_for:!0},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:2,class:`dito-button`,type:`button`},{ref_for:!0},t.getButtonAttributes(t.verbs.delete),{onClick:e=>t.deleteFile(r,i)}),null,16,ud)):(0,e.createCommentVNode)(``,!0)])])]))),128)):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`modelValue`,`options`,`draggable`]),t.multiple||t.isUploadActive||!t.hasFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`tfoot`,dd,[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`td`,fd,[(0,e.createElementVNode)(`div`,pd,[t.isUploadActive?((0,e.openBlock)(),(0,e.createElementBlock)(`progress`,{key:0,class:`dito-progress`,value:t.uploadProgress,max:`100`},null,8,md)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,hd,[t.isUploadActive?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-button`,type:`button`,onClick:n[3]||=(0,e.withModifiers)(e=>t.upload.active=!1,[`prevent`])},`Cancel`)):(0,e.createCommentVNode)(``,!0),t.multiple||!t.hasFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`dito-button dito-button--upload`,title:t.uploadTitle,onClick:n[4]||=(...e)=>t.onClickUpload&&t.onClickUpload(...e)},null,8,gd)):(0,e.createCommentVNode)(``,!0)])])])])])):(0,e.createCommentVNode)(``,!0)])])}var vd=J.register(`upload`,{mixins:[ss],components:{VueUpload:_e.default},data(){return{uploads:[]}},computed:{upload(){return this.$refs.upload},uploadTitle(){return this.multiple?`Upload Files`:`Upload File`},files(){return yd(this.value)},downloadUrls(){return this.files.map((e,t)=>this.getDownloadUrl(e,t))},thumbnailUrls(){return this.files.map((e,t)=>this.getThumbnailUrl(e,t))},multiple:F(`multiple`,{type:Boolean,default:!1,callback:!1}),extensions:F(`extensions`,{type:[Array,String,RegExp]}),accept:F(`accept`,{type:Array,get(e){return(0,r.isArray)(e)?e.join(`,`):e}}),maxSize:F(`maxSize`,{type:[String,Number],get(e){return e?Xu(e):void 0}}),draggable:F(`draggable`,{type:Boolean,default:!1,get(e){return e&&this.files.length>1}}),deletable:F(`deletable`,{type:Boolean,default:!1}),render:F(`render`,{type:Function,default:null}),thumbnails:F(`thumbnails`,{type:[Boolean,String],default(e){return e??!!this.schema.thumbnailUrl},get(e){return e===!0?`medium`:e||null}}),hasFiles(){return this.files.length>0},hasUploads(){return this.uploads.length>0},isUploadReady(){return this.hasUploads&&!(this.upload.active||this.upload.uploaded)},isUploadActive(){return this.hasUploads&&this.upload.active},uploadProgress(){return this.uploads.reduce((e,t)=>e+ +t.progress,0)/this.uploads.length},uploadPath(){return this.getResourceUrl({type:`upload`,method:`post`,path:this.api.normalizePath(this.dataPath)})}},watch:{isUploadReady(e){e&&this.$nextTick(()=>{this.upload.active=!0})}},methods:{formatFileSize:Yu,getFileContext(e,t){return this.multiple?new E(this,{value:e,data:this.files,index:t,dataPath:y(this.dataPath,t)}):this.context},renderFile(e,t){return this.render(this.getFileContext(e,t))},getDownloadUrl(e,t){return e.url?e.url:!e.upload||e.upload.success?this.getSchemaValue(`downloadUrl`,{type:`String`,default:null,context:this.getFileContext(e,t)}):null},getThumbnailUrl(e,t){return!e.upload||e.upload.success?this.getSchemaValue(`thumbnailUrl`,{type:`String`,default:null,context:this.getFileContext(e,t)})||(e.type.startsWith(`image/`)?e.url:null):null},deleteFile(e,t){let{name:n}=e;e&&window.confirm(`Do you really want to ${this.verbs.remove} ${n}?`)&&(this.multiple?this.value.splice(t,1):this.value=null,e.upload&&this.upload.remove(e.upload),this.onChange(),this.notify({type:`info`,title:`Successfully Removed`,text:`${n} was ${this.verbs.deleted}.`}))},getFileIndex(e){return this.multiple&&this.value?this.value.findIndex(t=>t.id===e.id):-1},addFile(e){this.multiple?this.value?this.value.push(e):this.value=[e]:this.value=e},replaceFile(e,t){if(this.multiple){let n=this.getFileIndex(e);n>=0&&(t?this.value[n]=t:this.value.splice(n,1))}else this.value=t},removeFile(e){this.replaceFile(e,null)},onInputFile(e,t){if(e&&!t){let{id:t,name:n,size:r}=e;this.addFile({id:t,name:n,size:r,upload:e})}if(e&&t){let{success:t,error:n}=e;if(t){this.onChange();let t=e.response[0];t?(t.upload=e,this.replaceFile(e,t)):this.removeFile(e)}else if(n){this.removeFile(e);let t={abort:`Upload aborted`,denied:`Upload denied`,extension:`Unsupported file-type: ${e.name}`,network:`Network error encountered during upload`,server:`Server error occurred during upload`,size:`File is too large: ${Yu(e.size)}`,timeout:`Timeout occurred during upload`}[n]||`Unknown File Upload Error: '${n}'`;this.notify({type:`error`,error:n,title:`File Upload Error`,text:t})}}},onInputFilter(e){let t=e?.xhr;this.api.cors?.credentials&&t&&!t.withCredentials&&(t.withCredentials=!0)},async onClickDownload(e,t){try{let n=await(await fetch(this.downloadUrls[t])).blob();this.download({filename:e.name,url:URL.createObjectURL(n)})}catch(e){console.error(e)}},onClickUpload(e){this.upload.$el.querySelector(`input`).dispatchEvent(new e.constructor(e.type,e))}},processValue({schema:e,value:t}){let n=yd(t).map(({upload:e,...t})=>!e||e.success?t:null).filter(e=>e);return e.multiple?n:n[0]||null}});function yd(e){return e?(0,r.asArray)(e):[]}var bd=V(vd,[[`render`,_d]]),xd=we({DitoDitoTypeComponent:()=>_c,DitoTypeButton:()=>Ys,DitoTypeCheckbox:()=>$s,DitoTypeCheckboxes:()=>ac,DitoTypeCode:()=>lc,DitoTypeColor:()=>hc,DitoTypeComputed:()=>bc,DitoTypeDate:()=>Cc,DitoTypeLabel:()=>Xc,DitoTypeList:()=>Jc,DitoTypeMarkup:()=>ql,DitoTypeMultiselect:()=>$l,DitoTypeNumber:()=>nu,DitoTypeObject:()=>cu,DitoTypePanel:()=>lu,DitoTypeProgress:()=>fu,DitoTypeRadio:()=>gu,DitoTypeSection:()=>vu,DitoTypeSelect:()=>Du,DitoTypeSlider:()=>ju,DitoTypeSpacer:()=>Nu,DitoTypeSwitch:()=>Fu,DitoTypeText:()=>zu,DitoTypeTextarea:()=>Hu,DitoTypeTreeList:()=>qu,DitoTypeUpload:()=>bd}),Sd={mounted(e,t){Cd(e,t.value,t.arg)},unmounted(e,t){wd(e,t.value,t.arg)}};function Cd(e,t,n){Dd.getObserver(n).observe(e,t)}function wd(e,t,n){Dd.getObserver(n).unobserve(e,t)}var Td=typeof ResizeObserver<`u`,Ed={},Dd=class e{constructor(e,t){this.key=e,this.options=t,this.observer=Td?new ResizeObserver(e=>this.handle(e)):null,this.handlersByNode=new WeakMap,this.nodeCount=0}observe(e,t){let n=this.handlersByNode.get(e);n||(n=new Set,this.handlersByNode.set(e,n),this.observer?.observe(e,this.options),this.nodeCount++),n.add(t)}unobserve(e,t){let n=this.handlersByNode.get(e);n?.delete(t)&&n.size===0&&(this.handlersByNode.delete(e),this.observer?.unobserve(e),--this.nodeCount===0&&delete Ed[this.key])}handle(e){for(let t of e){let e=this.handlersByNode.get(t.target);if(e){let n={target:t.target,contentRect:t.contentRect,borderBoxSize:(0,r.asArray)(t.borderBoxSize),contentBoxSize:(0,r.asArray)(t.contentBoxSize),devicePixelContentBoxSize:(0,r.asArray)(t.devicePixelContentBoxSize)};for(let t of e)t(n)}}}static getObserver({box:t=`content-box`}={}){let n={box:t},r=JSON.stringify(n);return Ed[r]||=new e(r,n),Ed[r]}},Od=class extends Error{constructor(e){super(`Request failed with status code: ${e.status} (${e.statusText})`),this.response=e}};async function kd(e,{url:t,method:n=`get`,query:r=null,headers:i=null,data:a=null,signal:o=null,timeout:s=e.timeout??null}){let c=e.isApiUrl(t),l=[o,s&&AbortSignal.timeout(s)];o=AbortSignal.any(l.filter(Boolean));let u=await fetch(e.getApiUrl({url:t,query:r}),{method:n.toUpperCase(),...a&&{body:JSON.stringify(a)},headers:{...c&&e.headers,...i},credentials:c&&e.cors?.credentials?`include`:`same-origin`,signal:o});if(u.headers.get(`Content-Type`)?.includes(`application/json`)&&(u.data=await u.json()),!u.ok)throw new Od(u);return u}function Ad(e,t){return!(0,r.isAbsoluteUrl)(t)||t.startsWith(e.url)}function jd(e,{url:t,query:n}){!t.startsWith(e.url)&&!(0,r.isAbsoluteUrl)(t)&&(t=Md(e.url,t));let i=wc(n);return i?`${t}${t.includes(`?`)?`&`:`?`}${i}`:t}function Md(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}var Nd=[`create`,`created`,`save`,`saved`,`apply`,`applied`,`submit`,`submitted`,`delete`,`deleted`,`remove`,`removed`,`clear`,`cleared`,`edit`,`edited`,`close`,`closed`,`cancel`,`cancelled`,`drag`,`dragged`,`login`,`logged in`].reduce((e,t)=>(e[t]=t,e),{});return class{constructor(i,{dito:a={},api:o,views:s={},...c}={}){this.el=i,this.api=o=(0,r.assignDeeply)({base:`/`},a.api,o),this.options=c,o.locale||=`en-US`,o.formats=(0,r.assignDeeply)({},r.defaultFormats,o.formats),o.request||=e=>kd(o,e),o.getApiUrl||=e=>jd(o,e),o.isApiUrl||=e=>Ad(o,e),o.normalizePath||=o.normalizePaths?r.hyphenate:e=>e,o.denormalizePath||=o.normalizePaths?r.camelize:e=>e,o.defaults||={};let l=z(o.users,{type:`collection`})||{};l.login=z(l.login||`login`,{method:`post`,parent:l}),l.logout=z(l.logout||`logout`,{method:`post`,parent:l}),l.session=z(l.session||`session`,{method:`get`,parent:l}),o.users=l,o.resources={any(e){let t=this[e?.type]||this.default;return e&&t.call(this,e)},default(e){let t=this.any(e.parent);return t?`${t}/${e.path}`:e.path},collection(e){return this.default(e)},member(e){return`${this.default(e)}/${e.id}`},upload(e){return`${this.collection(e.parent)}/upload/${e.path}`},...o.resources},o.headers={"Content-Type":`application/json`,...o.headers},(0,r.isString)(i)&&(i=document.querySelector(i));let u=this.app=(0,e.createApp)({components:{DitoRoot:la,VueNotifications:n.default,...Gs,...xd},provide:{api:o,$verbs:()=>Nd,$views:()=>{},$isPopulated:()=>!0,$parentComponent:()=>null,$schemaComponent:()=>null,$schemaParentComponent:()=>null,$routeComponent:()=>null,$dataComponent:()=>null,$sourceComponent:()=>null,$resourceComponent:()=>null,$dialogComponent:()=>null,$dataModel:()=>null,$panelComponent:()=>null,$tabComponent:()=>null},render:()=>(0,e.h)(la,{ref:`root`,class:a.settings.rootClass,unresolvedViews:s,options:c})});u.config.errorHandler=console.error,u.use(n.default,{componentName:`VueNotifications`,name:`notify`}),u.directive(`resize`,Sd),u.use((0,t.createRouter)({routes:[{name:`catch-all`,path:`/:_(.*)`,components:{}}],history:(0,t.createWebHistory)(a.base),linkActiveClass:``,linkExactActiveClass:``})),i.classList.add(`dito-app`),u.mount(i)}register(e,t){return J.register(e,t)}}});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue"),require("vue-router"),require("@kyvg/vue3-notification"),require("@ditojs/utils"),require("tippy.js"),require("nanoid"),require("@vueuse/integrations/useFocusTrap/component"),require("@vueuse/integrations/useSortable/component"),require("sortablejs"),require("codeflask"),require("vue-color"),require("@tiptap/vue-3"),require("@tiptap/pm/model"),require("@tiptap/extension-document"),require("@tiptap/extension-text"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-italic"),require("@tiptap/extension-link"),require("@tiptap/extension-strike"),require("@tiptap/extension-subscript"),require("@tiptap/extension-superscript"),require("@tiptap/extension-underline"),require("@tiptap/extension-blockquote"),require("@tiptap/extension-code-block"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-horizontal-rule"),require("@tiptap/extension-ordered-list"),require("@tiptap/extension-bullet-list"),require("@tiptap/extension-list-item"),require("tiptap-footnotes"),require("@tiptap/extension-history"),require("vue-multiselect"),require("vue-upload-component")):typeof define==`function`&&define.amd?define(`exports,vue,vue-router,@kyvg/vue3-notification,@ditojs/utils,tippy.js,nanoid,@vueuse/integrations/useFocusTrap/component,@vueuse/integrations/useSortable/component,sortablejs,codeflask,vue-color,@tiptap/vue-3,@tiptap/pm/model,@tiptap/extension-document,@tiptap/extension-text,@tiptap/extension-bold,@tiptap/extension-code,@tiptap/extension-italic,@tiptap/extension-link,@tiptap/extension-strike,@tiptap/extension-subscript,@tiptap/extension-superscript,@tiptap/extension-underline,@tiptap/extension-blockquote,@tiptap/extension-code-block,@tiptap/extension-hard-break,@tiptap/extension-heading,@tiptap/extension-paragraph,@tiptap/extension-horizontal-rule,@tiptap/extension-ordered-list,@tiptap/extension-bullet-list,@tiptap/extension-list-item,tiptap-footnotes,@tiptap/extension-history,vue-multiselect,vue-upload-component`.split(`,`),t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`dito-admin`]={},e.vue,e[`vue-router`],e[`@kyvg/vue3-notification`],e[`@ditojs/utils`],e.tippy.js,e.nanoid,e[`@vueuse/integrations/useFocusTrap/component`],e[`@vueuse/integrations/useSortable/component`],e.sortablejs,e.codeflask,e[`vue-color`],e[`@tiptap/vue-3`],e[`@tiptap/pm/model`],e[`@tiptap/extension-document`],e[`@tiptap/extension-text`],e[`@tiptap/extension-bold`],e[`@tiptap/extension-code`],e[`@tiptap/extension-italic`],e[`@tiptap/extension-link`],e[`@tiptap/extension-strike`],e[`@tiptap/extension-subscript`],e[`@tiptap/extension-superscript`],e[`@tiptap/extension-underline`],e[`@tiptap/extension-blockquote`],e[`@tiptap/extension-code-block`],e[`@tiptap/extension-hard-break`],e[`@tiptap/extension-heading`],e[`@tiptap/extension-paragraph`],e[`@tiptap/extension-horizontal-rule`],e[`@tiptap/extension-ordered-list`],e[`@tiptap/extension-bullet-list`],e[`@tiptap/extension-list-item`],e[`tiptap-footnotes`],e[`@tiptap/extension-history`],e[`vue-multiselect`],e[`vue-upload-component`]))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,ee,te,ne,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge,_e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var ve=Object.create,ye=Object.defineProperty,be=Object.getOwnPropertyDescriptor,xe=Object.getOwnPropertyNames,Se=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty,we=(e,t)=>{let n={};for(var r in e)ye(n,r,{get:e[r],enumerable:!0});return t||ye(n,Symbol.toStringTag,{value:`Module`}),n},Te=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=xe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Ce.call(e,s)&&s!==n&&ye(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=be(t,s))||r.enumerable});return e},Ee=(e,t,n)=>(n=e==null?{}:ve(Se(e)),Te(t||!e||!e.__esModule||!Ce.call(e,`default`)?ye(n,`default`,{value:e,enumerable:!0}):n,e));r=Ee(r,1),l=Ee(l),u=Ee(u),ge=Ee(ge),_e=Ee(_e);function De(e=``){let t={},n=e.toLowerCase(),[r]=/(iphone|ipad|linux; android|darwin|win|mac|linux|freebsd|sunos)/.exec(n)||[],i={darwin:`mac`,iphone:`ios`,ipad:`ios`,"linux; android":`android`}[r]||r;return i&&(t.platform=i,t[i]=!0),n.replace(/(opera|chrome|safari|webkit|firefox|msie|trident)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv:v?([.\d]+))?/g,(e,n,r,i,a)=>{if(!t.chrome){let e=a||i||r;(!t.version||n!==`safari`)&&(t.version=e,t.versionNumber=parseFloat(e)),t.browser=n,t[n]=!0}}),t.chrome&&delete t.webkit,t}var y=(0,t.reactive)({title:``,routeComponents:[],user:null,agent:De(navigator.userAgent||``),loadCache:{},pageClass:null});function b(e,t){return e?`${e}/${t}`:t}function Oe(e,t){if(e==null||t==null)return null;let n=(0,i.normalizeDataPath)(e),r=(0,i.normalizeDataPath)(t);return n===r?``:r?n.startsWith(`${r}/`)?n.slice(r.length+1):null:n}function ke(e){let t=(0,i.parseDataPath)(e);return t?.pop(),t}function Ae(e){return(0,i.normalizeDataPath)(ke(e))}function je(e,t=!1){return t?ke(e):(0,i.parseDataPath)(e)}function Me(e,t=!1){return(0,i.normalizeDataPath)(je(e,t))}function Ne(e,t=!1){let n=je(e,t);if(n){let e;do e=n.pop();while(e!=null&&(0,i.isInteger)(+e));if(e!=null)return n}return null}function Pe(e,t=!1){let n=Ne(e,t);return n?(0,i.normalizeDataPath)(n):null}function Fe(e,t,n=!1){let r=je(t,n);return r?(0,i.getValueAtDataPath)(e,r,()=>null):null}function Ie(e,t,n=!1){let r=Ne(t,n);return r?(0,i.getValueAtDataPath)(e,r,()=>null):null}function Le(e){return(0,i.parseDataPath)(e)?.at(-1)}function Re(e){let t=Le(e);return t==null||(0,i.isInteger)(+t)?null:t}function ze(e){let t=Le(e),n=t==null?null:+t;return(0,i.isInteger)(n)?n:null}var Be=0;function Ve(e,t=`id`){e[t]=`@${++Be}`}function He(e){return/^@/.test(e)}function Ue(e,t=`id`){return e?.[t]!=null&&Object.keys(e).length===1}var We={},Ge={};function Ke(e,t){We[e]=t}function qe(e,t=!1){let n=We[e]||null;if(!n&&!t&&!Ge[e])throw Ge[e]=!0,Error(`Unknown Dito.js component type: '${e}'`);return n}function Je(e){return(0,i.isObject)(e)?e.type:e}function x(e){return qe(Je(e),!0)??null}function Ye(e){return x(e)?.getSourceType?.(Je(e))??null}function Xe(e,t){for(let n of e)if(lt(n)){let e=t(n.component,n.name,0);if(e!==void 0)return e}else if(S(n))for(let[e,r]of Object.entries(n.components||{})){let n=t(r,e,1);if(n!==void 0)return n}}function Ze(e,t){return e?Xe([e,...mt(e)],t):void 0}function Qe(e,t){return Ze(e,e=>t(e)?e:void 0)??null}function $e(e,t){return Ze(e,(e,n)=>t(e,n)?!0:void 0)??!1}function et(e){return $e(e,()=>!0)??!1}function tt(e,t){return!!Ze(e,(e,n)=>{if(C(e)?n===t:tt(e,t))return!0})}function S(e){return(0,i.isObject)(e)&&(0,i.isString)(e.type)}function nt(e){return S(e)&&e.type===`form`}function rt(e){return S(e)&&e.type===`view`}function it(e){return S(e)&&e.type===`tab`}function at(e){return S(e)&&e.type===`panel`}function ot(e){return at(e)&&!!e.data}function st(e){return S(e)&&e.type===`menu`}function ct(e){return JSON.stringify(e)}function lt(e){return rt(e)&&(0,i.isObject)(e.component)}function ut(e){return!!e.compact}function dt(e){return!!(e.inlined||e.components)}function C(e){return!!(e.nested||x(e)?.defaultNested===!0)}function ft(e,t){let{label:n}=e;return n!==!1&&(!!n||t&&x(e)?.generateLabel)}function pt(e){return!!x(e)?.omitSpacing}function mt(e){return e?.tabs?Object.values(e.tabs):[]}function ht(e){return e?.panels?Object.values(e.panels):[]}function w(e){return Ye(e)===`object`}function T(e){return Ye(e)===`list`}function gt(e){return!!Ye(e)&&!!e.resource}function _t(e){if(e==null)return null;let{body:t}=new DOMParser().parseFromString(e,`text/html`);return t.textContent.trim()}var{hasOwnProperty:vt}=Object.prototype,yt=new WeakMap;function bt(e){let n=(0,t.toRaw)(e),r=n,i;do{if(i=yt.get(r),i)break;r=Object.getPrototypeOf(r)}while(r);return i&&r!==n&&yt.set(r,i),i}function E(e,t,n){let r=bt(e),a=t in r?r[t]:void 0;return a!==void 0||vt.call(r,t)?a:(0,i.isFunction)(n)?n():n}function xt(e,t,n){Object.defineProperty(bt(e),t,{value:n,writable:!0,enumerable:!0,configurable:!0})}var D=class e{constructor(e,t){t=t?(0,i.isFunction)(t)?t():{...t}:{},t.nested??=!0,t.component=e;let n=Object.setPrototypeOf(t,e);yt.set(this,n)}static get(t,n){return n instanceof e?n:new e(t,n)}static createForSchema(t,{schema:n,name:r,nested:i=C(n),data:a,dataPath:o,rootData:s}){return new e(t,()=>({schema:n,name:r,nested:i,data:a,dataPath:o,rootData:s,get value(){return r==null?void 0:a?.[r]}}))}createChildContext(t,n){let r=C(t),i=!!this.schema&&C(this.schema);return e.createForSchema(this.component,{schema:t,name:n,nested:r,data:i?this.item?.[this.name]:this.item,dataPath:r?b(this.dataPath,n):this.dataPath,rootData:this.rootItem})}extend(e){return Object.setPrototypeOf(e,this)}get nested(){return E(this,`nested`,!0)}get schema(){return E(this,`schema`,null)}get value(){let e=bt(this);return`value`in e?e.value:this.nested?(0,i.getValueAtDataPath)(this.rootItem,this.dataPath,()=>void 0):void 0}get dataPath(){return E(this,`dataPath`,``)}get name(){return E(this,`name`,()=>Re(this.dataPath))}get index(){return E(this,`index`,()=>ze(this.dataPath))}get itemDataPath(){return Me(this.dataPath,this.nested)}get parentItemDataPath(){return Pe(this.dataPath,this.nested)}get itemIndex(){return ze(this.itemDataPath)}get parentItemIndex(){return ze(this.parentItemDataPath)}get item(){return E(this,`data`,()=>Fe(this.rootItem,this.dataPath,this.nested)||null)}get parentItem(){let e=Ie(this.rootItem,this.dataPath,this.nested)||null;return e===this.item?null:e}get rootItem(){return E(this,`rootData`,null)}get processedItem(){return E(this,`processedData`,null)}get processedRootItem(){return E(this,`processedRootData`,null)}get clipboardItem(){return E(this,`clipboardData`,null)}get user(){return E(this,`user`,null)}get api(){return E(this,`api`,null)}get views(){return E(this,`views`,null)}get flattenedViews(){return E(this,`flattenedViews`,null)}get itemLabel(){return E(this,`itemLabel`,null)}get itemLabelText(){return _t(this.itemLabel)}get formLabel(){return E(this,`formLabel`,null)}get component(){return E(this,`component`,null)}get schemaComponent(){return E(this,`schemaComponent`,null)}get formComponent(){return E(this,`formComponent`,null)}get viewComponent(){return E(this,`viewComponent`,null)}get dialogComponent(){return E(this,`dialogComponent`,null)}get panelComponent(){return E(this,`panelComponent`,null)}get resourceComponent(){return E(this,`resourceComponent`,null)}get sourceComponent(){return E(this,`sourceComponent`,null)}get option(){return E(this,`option`,void 0)}get options(){return E(this,`options`,void 0)}get open(){return E(this,`open`,void 0)}get searchTerm(){return E(this,`searchTerm`,void 0)}get error(){return E(this,`error`,void 0)}get wasNotified(){return E(this,`wasNotified`,!1)}get isRunning(){return E(this,`isRunning`,!1)}set isRunning(e){let{component:t}=this;t&&`isRunning`in t?t.isRunning=e:xt(this,`isRunning`,e)}get query(){return this.component.$route.query}get request(){return e=>this.component.request(e)}get format(){return(e,t)=>this.component.format(e,t)}get navigate(){return e=>this.component.navigate(e)}get download(){return e=>this.component.download(e)}get getResourceUrl(){return e=>this.component.getResourceUrl(e)}get notify(){return e=>{this.component.notify(e),xt(this,`wasNotified`,!0)}}},St={data(){return{listeners:null}},methods:{on(e,t){if((0,i.isArray)(e))for(let n of e)this.on(n,t);else if((0,i.isPlainObject)(e))for(let t in e)this.on(t,e[t]);else{let n=this.listeners||=Object.create(null),{callbacks:r}=n[e]||={callbacks:[],queue:[]};r.push(t)}return this},once(e,t){let n=(...r)=>(this.off(e,n),t.apply(this,r));return n.callback=t,this.on(e,n)},off(e,t){if(!arguments.length)this.listeners=null;else if((0,i.isArray)(e))for(let n of e)this.off(n,t);else if((0,i.isPlainObject)(e))for(let t in e)this.off(t,e[t]);else{let n=this.listeners?.[e];if(n){if(!t)delete this.listeners[e];else{let{callbacks:e}=n,r=e.findIndex(e=>e===t||e.callback===t);r!==-1&&e.splice(r,1)}}}return this},emit(e,...t){let n=this.listeners?.[e];if(n){let{queue:r,callbacks:i}=n;return new Promise(n=>{let a=async()=>{let t=r.shift();if(t){let n,r=[];for(let e of i)try{let r=await e.apply(this,t.args);r!==void 0&&(n=r)}catch(e){r.push(e)}if(r.length>0){let n=AggregateError(r,`Errors during event handler for '${e}'`);t.resolve(Promise.reject(n))}else t.resolve(n);a()}};r.push({args:t,resolve:n}),r.length===1&&a()})}return Promise.resolve()},hasListeners(e){if((0,i.isArray)(e)){for(let t of e)if(!this.hasListeners(t))return!1;return e.length>0}return!!this.listeners?.[e]},delegate(e,t){if(t){if((0,i.isArray)(e))for(let n of e)this.delegate(n,t);else this.on(e,(...n)=>t.emit(e,...n))}return this}}},Ct=new WeakMap,wt=`uid-`,Tt=0;function Et(e,n=null){let r=(0,t.toRaw)(e),i=Ct.get(r);return!i&&e&&(i=n?.(e)||`${wt}${++Tt}`,Ct.set(r,i)),i}function O(e,n){let r=(0,t.toRaw)(e),a=(0,t.toRaw)(n);if(r!==a&&kt(r)&&kt(a)){let e=Ct.get(r);if(At(e)&&!Ct.has(a)&&Ct.set(a,e),(0,i.isArray)(r)&&(0,i.isArray)(a))Dt(r,a);else for(let e of Object.keys(r))e in a&&O(r[e],a[e])}}function Dt(e,t){let n=e.filter(kt),r=t.filter(kt),i=new Map;for(let e of r){let t=Ot(e);t!==void 0&&i.set(t,e)}let a=new Set,o=[];for(let e of n){let t=Ot(e);if(t!==void 0){a.add(t);let n=i.get(t);n&&O(e,n)}else o.push(e)}let s=r.filter(e=>!a.has(Ot(e)));o.length===s.length&&o.forEach((e,t)=>{O(e,s[t])})}function Ot(e){let{id:t}=e;return t!=null&&!He(t)?String(t):void 0}function kt(e){return(0,i.isArray)(e)||(0,i.isPlainObject)(e)}function At(e){return(0,i.isString)(e)&&(e.startsWith(wt)||He(e))}var jt=class{graph={};references={};set(e,t,n){e=(0,i.parseDataPath)(e);let r=this.graph;for(let t of e){let e=(0,i.isInteger)(+t)?`*`:t;r=r[e]??={}}r.$settings={...n,...r.$settings,...t}}addSource(e,t){this.set(e,{type:`source`,schema:t},{related:!1})}setSourceRelated(e){this.set(e,{related:!0,reference:this.getReferencePrefix(e)})}addRelation(e,t,n){this.set(e,{type:`relation`,schema:n,internal:!!t,reference:this.getReferencePrefix(t)})}getReferencePrefix(e){return e?this.references[e]??=(0,o.nanoid)(6):null}flatten(){let e=t=>{let n=[];for(let[r,{$settings:i,...a}]of Object.entries(t)){i&&n.push([r,i]);for(let[t,i]of e(a))n.push([`${r}/${t}`,i])}return n};return e(this.graph)}process(e,t,{target:n}){let r=n===`clipboard`;r&&delete t[e.idKey||`id`];for(let[e,n]of this.flatten()){let{type:a,schema:o,internal:s,related:c,reference:l}=n,u=a===`source`,d=a===`relation`;if(u||d&&s){let n=(0,i.getValueAtDataPath)(t,e,()=>null),a=r&&u&&!c,f=r&&(d&&s||u&&c);for(let e of(0,i.asArray)(n).flat()){let t=u&&o.idKey||d&&o.relateBy||`id`,n=e?.[t];if(n!=null){if(a)delete e[t];else if(f||He(n)){He(n)&&(n=n.slice(1));let i=r?t:u?`#id`:`#ref`;e[i]=r?`@${n}`:l?`${l}-${n}`:n,i!==t&&delete e[t]}}}}}return t}},Mt={Boolean:i.isBoolean,Number:i.isNumber,String:i.isString,Date:i.isDate,Array:i.isArray,Object:i.isObject,RegExp:i.isRegExp,Function:i.isFunction},Nt={Boolean:e=>!!e,Number:e=>+e,String:e=>String(e),Date:e=>(0,i.isDate)(e)?e:new Date(e),Array:e=>(0,i.isArray)(e)?e:(0,i.isString)(e)?e.split(`,`):(0,i.asArray)(e),Object:e=>(0,i.isObject)(e)?e:e===!0?{}:null,RegExp:e=>(0,i.isRegExp)(e)?e:new RegExp(e)};function Pt(e,t){if(e&&t!=null){for(let n of e)if(Mt[n.name]?.(t))return!0}return!1}function Ft(e,t){let n=e&&Nt[e.name||e];return n?n(t):t}var It={},Lt=new WeakMap;function k(e){return S(e)&&((0,i.isObject)(e.form||e.forms||e.components)||(0,i.isFunction)(e.components))}function Rt(e){return S(e)&&Object.keys(e?.forms||{}).length>1}function zt(e,t){let{view:n}=e,r=n&&t.flattenedViews[n];return r&&Qe(r,k)||null}function Bt(e,t){return zt(e,t)?t.flattenedViews[e.view]:null}function Vt(e,t){return!!Bt(e,t)}function Ht(e,t){let n=Bt(e,t);return n?lt(n)?n.fullPath:`${n.fullPath}/${n.path}`:null}function Ut(e,t=e.fullPath){return st(e)?Object.values(e.items)[0].fullPath:t}function Wt(e,t,n){let r=Ht(e,n);return r?`${r}/${t}`:null}function A(e,t,n){let r=t&&zt(e,t);if(r)e=r;else if(e.view)throw Error(`Unknown view: '${e.view}'`);let{form:a,forms:o}=e;if(!a&&!o){let{name:t,compact:n,clipboard:r,tabs:i,components:o}=e;if(o||i)a={type:`form`,name:t,compact:n,clipboard:r,tabs:i,components:o};else return{}}return o||={default:a},Object.fromEntries(Object.entries(o).map(([e,r])=>(t&&(0,i.isFunction)(r.components)&&(r=Gt(r,t)),[e,n?.(r)??r])))}function Gt(e,n){let{item:r}=n;if(!(0,i.isObject)(r))return Kt(e,n);let a=Lt.get(e.components);a||(a=new WeakMap,Lt.set(e.components,a));let o=a.get(r);return o||(o={context:n},o.formWithCreatedComponents=(0,t.computed)(()=>Kt(e,o.context)),a.set(r,o)),o.context=n,o.formWithCreatedComponents.value}function Kt(e,n){let r=(0,t.reactive)({...e,components:e.components(n)});return ir(n.api,r).catch(console.error),r}function qt(e,t){return e[t?.type]||e.default||null}function j(e,t,n){return qt(A(e,n),t)||It}function Jt(e){return e===It}function M(e,t){let n=(e,n)=>e.length>0?e.reduce((e,r)=>{let i=n(r);return i&&(e[i.name]=i&&t?{...t,...i}:i),e},{}):null;return(0,i.isArray)(e)?n(e,e=>(0,i.isObject)(e)?e:{name:(0,i.camelize)(e,!1)}):(0,i.isObject)(e)?n(Object.entries(e),([e,t])=>(0,i.isObject)(t)?{name:e,...t}:(0,i.isString)(t)?{name:e,label:t}:null):null}function Yt(e){return M(e,{type:`button`})}function Xt(e,t,n,r){return e?{schema:e,dataPath:t,componentPath:n,tabName:r?.tabName??null,isTabSelected:r?.isTabSelected??null}:null}function Zt(e,t,n,r=null,i=[]){if(e)for(let[a,o]of Object.entries(e)){let e=Xt(o,b(t,a),b(n,a),r);e&&i.push(e)}return i}function Qt(e,t,n,r,i,a=null,o=null){let s=x(t)?.getPanelSchema?.(e,t,n,a),c=s?[Xt(s,b(n,s.name),b(r,s.name),o)]:[];return Zt(t?.panels,n,i,o,c),c}function N(e,{type:t,schema:n,callback:r=!0,default:a,context:o}={}){let s=t&&(0,i.asArray)(t),c=n?(0,i.isArray)(e)?(0,i.getValueAtDataPath)(n,e,()=>void 0):n[e]:void 0;if(c===void 0&&a!==void 0)return r&&(0,i.isFunction)(a)&&!Pt(s,a)&&(a=a(o)),a;if(Pt(s,c))return c;if(r&&(0,i.isFunction)(c)&&(c=c(o)),s&&c!=null&&!Pt(s,c))for(let e of s){let t=Ft(e,c);if(t!==c)return t}return c}function P(e,t){return N(`if`,{type:Boolean,schema:e,context:t,default:!0})&&(!et(e)||!!Ye(e)||$e(e,(e,n)=>P(e,t.createChildContext(e,n))))}function $t(e,t){return Object.fromEntries(Object.entries(A(e,t)).filter(([,e])=>P(e,t)&&N(`creatable`,{type:Boolean,default:!0,schema:e,context:t})))}function F(e){return(0,i.isFunction)(e)?e():e}function en(e,t){let n=e.default===void 0?x(e)?.defaultValue:e.default;return(0,i.isFunction)(n)?n(F(t)):(0,i.clone)(n)}function tn(e,t,n,r){let i=en(e,r);i!==void 0&&(t[n]=i)}function nn(e,t){let n=e.exclude===void 0?x(e)?.excludeValue:e.exclude;return(0,i.isFunction)(n)?n(F(t)):!!n}function rn(e,t){return!!x(e)?.ignoreMissingValue?.(F(t))}function an(e,t,n,r){return!(n in t)||!!x(e)?.treatNullAsMissing?.(F(r))&&t[n]===null}function on(e){return!!x(e)?.valueFromDataSchema&&!!(e.data||e.dataPath)}function sn(e){return e.multiple??!!x(e)?.defaultMultiple}function cn(e,t,n,r,{shouldSetDefaultsOfComponentsWithCompute:i=!0}={}){return(i||!e.compute)&&an(e,t,n,r)&&!rn(e,r)}function ln(e,t={},n,{dataPath:r=null,rootData:a=t,shouldProcess:o,shouldSkipSourcesWithResource:s=!1,shouldSetDefaultsOfComponentsWithCompute:c=!0}={}){return I(e,t,{dataPath:r,before:({schema:e,data:t,name:r,dataPath:o})=>{let s=()=>new D(n,{schema:e,name:r,data:t,dataPath:o,rootData:a});cn(e,t,r,s,{shouldSetDefaultsOfComponentsWithCompute:c})&&tn(e,t,r,s),gn(e)&&(0,i.isArray)(t[r])&&_n(e,t[r])},shouldProcess:o,shouldSkipSourcesWithResource:s,options:{component:n,rootData:a}})}function un(e,t,n,r,{component:a=null,rootData:o=a?.rootData,getOptions:s=null}={}){let c=()=>new D(a,()=>{let a={schema:e,get value(){return t[n]},name:n,data:t,get dataPath(){return(0,i.isFunction)(r)?r():r},rootData:o};return s&&Object.defineProperty(a,"options",{get:s,enumerable:!0}),a}),{compute:l}=e;if(l&&N(`if`,{type:Boolean,schema:e,context:F(c),default:!0})){let e=l(F(c));if(e!==void 0)return e}return dn(e,t,n,c)}function dn(e,t,n,r){return an(e,t,n,r)&&!rn(e,r)?en(e,r):t[n]}function fn(e,t,n){if(n.schemaOnly){let n={},{idKey:r=`id`,orderKey:i}=e,a=t[r];return a!==void 0&&(n[r]=a),Rt(e)&&(n.type=t.type),i&&(n[i]=t[i]),n}return{...t}}function pn(e,t,n,r,{component:a,rootData:o,schemaOnly:s,target:c,shouldCallProcess:l=!0}={}){let u={component:a,rootData:o,schemaOnly:s,target:c},d=fn(t,n,u),f=new jt;return I(e,n,{dataPath:r,processedData:d,before:({schema:e,data:t,name:n,dataPath:r,processedData:o})=>{let s=dn(e,t,n,()=>D.createForSchema(a,{schema:e,name:n,data:t,dataPath:r,rootData:u.rootData}));if((0,i.isArray)(s)){let{wrapPrimitives:t}=e;s=t?s.map(e=>({[t]:e})):[...s]}o[n]=s},after:({schema:e,data:t,name:n,dataPath:r,processedData:o})=>{let{wrapPrimitives:s,process:c}=e,d=o[n],p=()=>new D(a,{schema:e,value:d,name:n,data:t,dataPath:r,rootData:u.rootData,processedData:o});s&&(0,i.isArray)(d)&&(d=d.map(e=>e[s]));let m=x(e)?.processValue;m&&(d=m(F(p),f)),c&&l&&(d=c(F(p))),(!c||l)&&nn(e,p)?delete o[n]:o[n]=d},options:u}),f.process(t,d,u)}function I(e,t,{dataPath:n=null,componentPath:r=``,processedData:a=null,wrappedPrimitiveName:o=null,before:s=null,after:c=null,shouldProcess:l=()=>!0,shouldSkipSourcesWithResource:u=!1,options:d}){let f={before:s,after:c,shouldProcess:l,shouldSkipSourcesWithResource:u,options:d},p=(e,t)=>e==null?null:b(e,t),m=(e,r)=>{if(e)for(let[m,g]of Object.entries(e)){let e=C(g),_=e&&m!==o?p(n,m):n,v={schema:g,data:t,name:m,dataPath:_,componentPath:b(r,m),processedData:a};if(l(v)){if(u&&gt(g))h(g.panels,v.componentPath);else if(!ot(g)){if(!e)I(g,t,{...f,dataPath:n,componentPath:v.componentPath,processedData:a});else{let{wrapPrimitives:e}=g,n=(n,r=null)=>{if(e&&!(0,i.isObject)(n)&&(n={[e]:n}),!(0,i.isObject)(n))return n;let o=r===null?_:p(_,r),s=r===null?v.componentPath:b(v.componentPath,r),c=new D(d.component,{schema:g,data:t,dataPath:_,name:m,rootData:d.rootData}),l=qt((x(g)?.getFormSchemasForProcessing||A)(g,c),n);if(l){let t=a?fn(g,n,d):null;return I(l,n,{...f,dataPath:o,componentPath:s,processedData:t,wrappedPrimitiveName:e??null})}return{...n}};if(s?.(v),k(g)){let e=a?a[m]:t[m];e!=null&&(e=(0,i.isArray)(e)?a?e.map(n):e.forEach(n):n(e),a&&(a[m]=e))}c?.(v),h(g.panels,v.componentPath)}}}}},h=(e,r)=>{for(let[i,o]of Object.entries(e||{})){let e={schema:o,data:t,name:null,dataPath:n,componentPath:b(r,i),processedData:a};l(e)&&!ot(o)&&m(o.components,e.componentPath)}};return m((0,i.isFunction)(e.components)?j(e,t,new D(d.component,{schema:e,data:t,dataPath:n,rootData:d.rootData})).components:e.components,r),h(e.tabs,r),h(e.panels,r),a||t}function mn(e,t,n,{componentPath:r=``,component:i=null,rootData:a=t}={}){let o={dataPath:``,componentPath:r};t&&I(e,t,{dataPath:``,componentPath:r,shouldProcess:e=>Oe(n,e.dataPath)!==null,before:e=>{e.dataPath.length>o.dataPath.length&&(o=e)},options:{component:i,rootData:a}});let s=Oe(n,o.dataPath);return s?b(o.componentPath,s):o.componentPath}function hn(e,t){let n=t[e.idKey||`id`];return n==null?void 0:String(n)}function gn(e){return!!e.orderKey&&!e.wrapPrimitives}function _n(e,t,n){let{orderKey:r}=e;if(r){let e=n?.[0]||0;for(let n=0;n<t.length;n++)t[n][r]=n+e}return t}function vn(e,t){return Et(t,t=>hn(e,t))}var yn={computed:{value:{get(){let e=dn(this.schema,this.data,this.name,()=>D.createForSchema(this,{schema:this.schema,name:this.name,data:this.data,dataPath:this.dataPath,rootData:this.rootData})),{format:t}=this.schema;return(0,i.isFunction)(t)?t(new D(this,{value:e})):e},set(e){let{parse:t}=this.schema;t&&(e=t(new D(this,{value:e}))),this.parsedValue=e,this.data[this.name]=e}}}},L={computed:{context(){return new D(this,{nested:this.nested})},parentData(){let e=Ie(this.rootData,this.dataPath,this.nested);return e===this.data?null:e},processedData(){return bn(this,this.dataPath,this.nested)},processedRootData(){return bn(this,``,!1)},item(){return this.data},parentItem(){return this.parentData},rootItem(){return this.rootData},processedItem(){return this.processedData},processedRootItem(){return this.processedRootData}}};function bn(e,t,n=!1){let{schemaComponent:r}=e;for(;r.dataPath.length>t.length;)r=r.parentSchemaComponent;return Fe(r.processedData,t.slice(r.dataPath.length),n)}var xn={validate:e=>(0,i.isCreditCard)(e),message:`is invalid`};function Sn(e){return e==null||e===`*`}var Cn={validate:(e,t)=>{let n=Sn(t)?`(\\.\\d+)?`:t>0?`(\\.\\d{1,${t}})?`:``;return RegExp(`^[-+]?\\d*${n}$`).test(e)},message:(e,t)=>Sn(t)?`must be numeric and may contain decimal points`:t>0?`must be numeric and may contain ${t} decimal points`:`must be numeric and may not contain decimal points`},wn={validate:e=>(0,i.isEmail)(e),message:`must be a valid email`},Tn={validate:e=>(0,i.isHostname)(e),message:`is not a host name`},En={validate:e=>(0,i.isDomain)(e),message:`is not a domain`},Dn={validate:e=>(0,i.isInteger)(e),message:`must be whole number`},On={validate:(e,t)=>e<=t,message(e,t){return`must be ${t} or less`}},kn={validate:(e,t)=>e>=t,message(e,t){return`must be ${t} or more`}},An={validate:()=>!0},jn={validate:(e,[t,n])=>e>=t&&e<=n,message(e,[t,n]){return`must be between ${t} and ${n}`}},Mn={validate:(e,t,{password:n})=>e!=null&&e!==``||n&&e===void 0,message:`is required`},Nn={validate:e=>(0,i.isUrl)(e),message:`is not a valid URL`},Pn=we({creditcard:()=>xn,decimals:()=>Cn,domain:()=>En,email:()=>wn,hostname:()=>Tn,integer:()=>Dn,max:()=>On,min:()=>kn,password:()=>An,range:()=>jn,required:()=>Mn,url:()=>Nn});function Fn(e,t){let n={...x(e)?.getTypeValidations?.(e,t)};N(`required`,{type:Boolean,schema:e,context:t})&&(n.required=!0);for(let[t,r]of Object.entries(e.rules||{}))r===void 0?delete n[t]:n[t]=r;return n}function In(e,t){let n=[];for(let[r,a]of Object.entries(t)){let o=Rn(r);if(o&&(r===`required`||e!=null&&e!==``)){let{validate:r,message:s}=o;r(e,a,t)||n.push({message:(0,i.isFunction)(s)?s(e,a,t):s})}}return n}var Ln=new Set;function Rn(e){let t=Pn[e]??null;return!t&&!Ln.has(e)&&(Ln.add(e),console.warn(`Unknown validator '${e}' is ignored.`)),t}function zn(e,t,{dataPath:n=``,component:r=null,rootData:a=t}={}){let o=null,s=({schema:e,data:t,name:n,dataPath:i})=>new D(r,{schema:e,value:n==null?void 0:t[n],name:n,data:t,dataPath:i,rootData:a});return I(e,t,{dataPath:n,shouldProcess:e=>P(e.schema,s(e)),shouldSkipSourcesWithResource:!0,before:e=>{let{schema:t,data:n,name:r,dataPath:a}=e,c=s(e),l=n[r],{format:u}=t;(0,i.isFunction)(u)&&(l=u(c));let d=Fn(t,c),f=In(l,d);f.length>0&&(o||={},o[a]=f)},options:{component:r,rootData:a}}),o}function Bn(e,t){let n;if((0,i.isFunction)(t))n=t;else if((0,i.isRegExp)(t))n=e=>t.test(e);else{let e=(0,i.asArray)(t).map(i.normalizeDataPath);n=t=>e.includes(t)}let r=Object.entries(e||{}).filter(([e])=>n(e));return r.length>0?Object.fromEntries(r):null}var Vn={emits:[`errors`],data(){return{isTouched:!1,isDirty:!1,isValidated:!1,isValid:!1,errors:null,valueWithErrors:void 0}},computed:{hasErrors(){return!!this.errors}},methods:{resetValidation(){this.isTouched=!1,this.isDirty=!1,this.isValidated=!1,this.isValid=!1,this.clearErrors()},validate(e=!0){let t=In(this.value,this.validations),n=t.length===0;if(e){this.clearErrors();for(let{message:e}of t)this.addError(e,!0);this.isValidated=!0,this.isValid=n}return n},verify(){return this.validate(!1)},markTouched(){this.isTouched=!0},markDirty(){this.isDirty=!0,this.isValidated=!1,this.isValid=!1,this.clearErrors()},addError(e,t=!1){this.errors||=[],this.valueWithErrors=this.value,t&&(e=`The ${this.label||this.placeholder||this.name} field ${e}.`),this.errors.push(e),this.$emit(`errors`,this.errors)},removeError(e){let t=this.errors?.lastIndexOf(e)??-1;t>=0&&(this.errors.splice(t,1),this.errors.length===0&&(this.errors=null),this.$emit(`errors`,this.errors))},showValidationErrors(e,t){if(this.clearErrors(),e.length===0)return!1;for(let{message:t}of e)this.addError(t,!0);return t&&this.focus(),!0},getErrors(){return this.errors?[...this.errors]:null},clearErrors(){this.errors=null,this.$emit(`errors`,this.errors)}}};function Hn(e){let t=[];for(let[n,r]of Object.entries(e.events||{}))t.push({key:n,event:(0,i.hyphenate)(n),callback:r});for(let[n,r]of Object.entries(e))/^on[A-Z]/.test(n)&&t.push({key:n,event:(0,i.hyphenate)(n.slice(2)),callback:r});return t}function R(e,{type:t,default:n,get:r,set:a,callback:o=!0}={}){(0,i.isString)(e)&&e.includes(`.`)&&(e=(0,i.parseDataPath)(e));let s=(0,i.normalizeDataPath)(e);return{get(){let i=!r||r.length>0?this.overrides&&s in this.overrides?this.overrides[s]:this.getSchemaValue(e,{type:t,default:n,callback:o}):void 0;return r?r.call(this,i):i},set(e){a?a.call(this,e):(this.overrides||={},this.overrides[s]=e)}}}function Un(e,{default:t,get:n,set:r}={}){return{get(){let r=this.getStore(e);return r===void 0&&t!==void 0&&(r=(0,i.isFunction)(t)?t.call(this):t),n?n.call(this,r):r},set(t){(!r||(t=r.call(this,t))!==void 0)&&this.setStore(e,t)}}}function Wn(e,t){let n=e.componentPath;t(!0,n);let r=e.$watch(`componentPath`,e=>{t(!1,n),n=e,t(!0,e)});return()=>{r(),t(!1,n)}}var Gn={mixins:[yn,L,Vn],emits:[`update:component`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},width:{type:[Number,String],default:null},label:{type:String,default:null},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},errorsElementId:{type:String,default:null}},data(){return{parsedValue:void 0,focused:!1}},computed:{name(){return this.schema.name},type(){return this.schema.type},visible:R(`visible`,{type:Boolean,default(){return this.$options.defaultVisible}}),exclude:R(`exclude`,{type:Boolean,default:!1}),required:R(`required`,{type:Boolean,default:!1}),readonly:R(`readonly`,{type:Boolean,default:!1}),autofocus:R(`autofocus`,{type:Boolean,default:!1}),clearable:R(`clearable`,{type:Boolean,default:!1,get(e){return e&&!this.readonly}}),disabled:R(`disabled`,{type:Boolean,default:!1}),maxLength:R(`maxLength`,{type:Number}),placeholder:R(`placeholder`,{type:String}),autocomplete:R(`autocomplete`,{type:String}),info:R(`info`,{type:String,default:null}),events(){let e=this.getEvents();for(let{event:t}of Hn(this.schema))e[`on${(0,i.camelize)(t,!0)}`]??=()=>{this.emitEvent(t)};return e},attributes(){let{nativeField:e,textField:t}=this.$options,n={...this.events,disabled:this.disabled||this.readonly&&!t,"aria-invalid":this.hasErrors||null,"aria-describedby":this.hasErrors?this.errorsElementId:null};return e&&(n.name=this.dataPath,this.label&&(n.title=this.label),n.readonly=this.readonly,n.autofocus=this.autofocus,t&&(n.maxlength=this.maxLength,n.placeholder=this.placeholder,n.autocomplete=this.autocomplete)),n},validations(){return Fn(this.schema,this.context)}},watch:{value(e){this.hasErrors&&!(0,i.equals)(e,this.valueWithErrors)&&this.clearErrors()}},created(){this.$emit(`update:component`,this),this._unregister=Wn(this,this._registerWithSchemaComponent),this.setupSchemaFields(),this.warnAboutUncomputedValue()},unmounted(){this.$emit(`update:component`,null),this._unregister()},methods:{warnAboutUncomputedValue(){this.schema.compute&&!this.dataModel.hasComputedValueEntry({data:this.data,name:this.name})&&console.warn(`The value of the component at '${this.componentPath}' isn't computed, as its data isn't part of a data model.`)},_registerWithSchemaComponent(e,t){this.nested?this.schemaComponent._registerComponent(this,e,t):this.schemaComponent?._registerUnnestedComponent(this,e,t)},getEvents(){let{onFocus:e,onBlur:t,onInput:n,onChange:r}=this;return{onFocus:e,onBlur:t,onInput:n,onChange:r}},async scrollIntoView(){await this.focusSchema(),this.getFocusElement()?.scrollIntoView?.({behavior:`smooth`,block:`center`})},focusElement(){this._getFocusTarget(`focus`)?.focus?.()},blurElement(){this._getFocusTarget(`blur`)?.blur?.()},_getFocusTarget(e){let t=(0,i.asArray)(this.$refs.element)[0];return t?.[e]?t:this.getFocusElement()},getFocusElement(){let e=(0,i.asArray)(this.$refs.element)[0]??this;return e.$el??e},async focusSchema(){await this.schemaComponent.focus(),await this.tabComponent?.focus()},async focus(){await this.focusSchema(),this.scrollIntoView(),this.focusElement()},blur(){this.blurElement()},clear(){this.value=null,this.blur(),this.onChange()},onFocus(){this.focused=!0,this.markTouched(),this.emitEvent(`focus`)},onBlur(){this.focused=!1,this.validate(),this.emitEvent(`blur`)},onInput(){this.markDirty(),this.emitEvent(`input`)},onChange(){this.markDirty(),this.emitChangeEvent()},emitChangeEvent(){return this.emitEvent(`change`,{context:{value:this.parsedValue===void 0?this.value:this.parsedValue},parent:this.schemaComponent})}}},Kn=new WeakMap;async function z(e,t=!1){if(Kn.has(e))return Kn.get(e);let n=e;if((0,i.isFunction)(n)&&(n=n()),(0,i.isPromise)(n)&&(n=await n),(0,i.isModule)(n)&&(n={...n},!n.name&&(t||n.default))){let e=Object.keys(n).filter(e=>e!==`_rerender_only`);if(e.length===1){let t=e[0];n=n[t],t!=="default"&&(n={...n,name:t})}}return Kn.set(e,n),n}async function qn(e,t=z){let n=(0,i.isFunction)(e)?e():e;return n=await z(n,!1),(0,i.isArray)(n)?n=Object.fromEntries(await(0,i.mapConcurrently)(n,async e=>{let n=await t(e,!0);return[n.name,n]})):(0,i.isObject)(n)&&(n=Object.fromEntries(await(0,i.mapConcurrently)(Object.entries(n),async([e,n])=>[e,await t(n,!0)]))),n}async function Jn(e){return qn(e,async(e,t)=>(e=await z(e,t),st(e)&&(e={...e,name:e.name||(0,i.camelize)(e.label),items:await qn(e.items)}),e))}function Yn(e){return Object.fromEntries(Object.entries(e).reduce((e,[t,n])=>(st(n)?e.push(...Object.entries(n.items)):e.push([t,n]),e),[]))}async function Xn(e){let{component:n}=e;n&&(n=await z(n,!0),n&&(e.component=(0,t.markRaw)({...n,mixins:[wr,Gn,...n.mixins||[]]})))}async function Zn(e){await(0,i.mapConcurrently)(Object.values(e||{}),Xn)}var Qn=new WeakMap;function B(e,t,n=null,r=0,i=1){if(t){let a=Qn.get(t)??0;if(a<i){Qn.set(t,a+1);let i=[],o=(t,a,o)=>{i.push($n(e,t,a,n,r+o))};return Ze(t,o),Xe(ht(t),o),Promise.all(i)}}}function $n(e,t,n,r=null,a=0){return V(e,t),Promise.all([(0,i.mapConcurrently)(ht(t),t=>B(e,t,r,a)),x(t)?.processSchema?.(e,t,n,r,a)])}async function er(e,t,n,r,i=``){V(t,n),nr(t,n,r,i);let a=[];if(rt(n))await sr(t,n),await B(t,n,a);else if(st(n))a=await Promise.all(Object.entries(n.items).map(async([r,i])=>er(e,t,i,r,n.fullPath)));else throw Error(`Invalid view schema: '${ct(n)}'`);return{path:n.fullPath,children:a,component:e,meta:{api:t,schema:n}}}function V(e,t){let n=e.defaults[t.type]||e.defaults[(0,i.camelize)(t.type)];if(n&&((0,i.isFunction)(n)&&(n=n(t)),(0,i.isObject)(n)))for(let[e,r]of Object.entries(n))t[e]=t[e]===void 0?r:(0,i.assignDeeply)(t[e],r)}function tr(e,t){Ze(t,t=>{V(e,t);let n=A(t);for(let t of Object.values(n))tr(e,t)})}function nr(e,t,n,r=null){t.name??=n,t.path??=e.normalizePath(n),r!==null&&(t.fullPath=`${r}/${t.path}`)}async function rr(e,t,n){let r=[],{form:a,forms:o,components:s,maxDepth:c=1}=t;return o?t.forms=await qn(o,t=>ir(e,t,r,n,c)):a?t.form=await ir(e,a,r,n,c):(0,i.isObject)(s)&&await ir(e,{type:`form`,components:s},r,n,c),r}async function ir(e,t,n=null,r=0,i=1){if(t=await z(t,!0),!nt(t))throw Error(`Invalid form schema: '${ct(t)}'`);return V(e,t),await sr(e,t),await B(e,t,n,r,i),t}async function ar(e,t){if(t=await z(t,!0),!it(t))throw Error(`Invalid tab schema: '${ct(t)}'`);return V(e,t),t}async function or(e,t){if(t=await z(t,!0),!at(t))throw Error(`Invalid panel schema: '${ct(t)}'`);return V(e,t),t}async function sr(e,t){let{tabs:n,panels:r}=t;n&&(t.tabs=await qn(n,t=>ar(e,t))),r&&(t.panels=await qn(r,t=>or(e,t)))}function cr(e){return!!H(e.resource)}function H(e,t={}){let{parent:n,...r}=t;return(0,i.isFunction)(e)&&(e=e(t)),e=(0,i.isObject)(e)?{...r,...e}:(0,i.isString)(e)?{...r,path:e}:null,e&&n!==void 0&&e.parent===void 0&&!e.path?.startsWith(`/`)&&(e.parent=n,e.path||(e.path=`.`)),e}function lr(e,t){return e!=null&&t?.type===`collection`?{type:`member`,...(0,i.pickBy)(t,(e,t)=>[`method`,`path`,`parent`].includes(t)),id:`${e}`}:null}function ur(e){let t=e?(0,i.isArray)(e)?e:Object.entries(e):[];return new URLSearchParams(t.reduce((e,[t,n])=>{if((0,i.isArray)(n))for(let r of n)e.push([t,r??``]);else n!=null&&e.push([t,n]);return e},[])).toString().replaceAll(/%(?:21|24|28|29|2C|2F|3A|3B|3D|3F|40)/g,decodeURIComponent)}function U(e,t){let n=t.endsWith(`/`)?t:`${t}/`;return e===t||e.startsWith(n)}var dr=class extends Error{constructor(e){super(`Request failed with status code: ${e.status} (${e.statusText})`),this.response=e}};async function fr(e,{url:t,method:n=`get`,query:r=null,headers:i=null,data:a=null,signal:o=null,timeout:s=e.timeout??null}){let c=_r(e,t),l=await fetch(e.getApiUrl({url:t,query:r}),{method:n.toUpperCase(),...a&&{body:JSON.stringify(a)},headers:{...c.headers,...i},credentials:c.credentials,signal:vr({signal:o,timeout:s})});if(l.headers.get(`Content-Type`)?.includes(`application/json`)&&(l.data=await l.json()),!l.ok)throw new dr(l);return l}function pr({method:e,url:t,query:n,data:r}){return[e||`get`,t,JSON.stringify(n||``),JSON.stringify(r||``)].join(` `)}function mr(e,t){return(0,i.isAbsoluteUrl)(t)||t.startsWith(`/`)?t:e.getApiUrl({url:t})}async function hr(e,t){let n=mr(e,t),r=await fetch(n,_r(e,br(n)));if(!r.ok)throw new dr(r);return r.blob()}function gr(e,t){let{headers:n,credentials:r}=_r(e,t);return{headers:Object.fromEntries(Object.entries(n).filter(([e])=>e.toLowerCase()!==`content-type`)),withCredentials:r===`include`}}function _r(e,t){let n=e.isApiUrl(t);return{headers:{...n&&e.headers},credentials:n&&e.cors?.credentials?`include`:`same-origin`}}function vr({signal:e=null,timeout:t=null}){let n=[e,t&&AbortSignal.timeout(t)];return AbortSignal.any(n.filter(Boolean))}function yr(e,t){return!(0,i.isAbsoluteUrl)(t)||xr(br(t),br(e.url))}function br(e){return new URL(e,document.baseURI).href}function xr(e,t){if(!e.startsWith(t))return!1;let n=e[t.length];return t.endsWith(`/`)||n===void 0||`/?#`.includes(n)}function Sr(e,{url:t,query:n}){!t.startsWith(e.url)&&!(0,i.isAbsoluteUrl)(t)&&(t=Cr(e.url,t));let r=ur(n);return r?`${t}${t.includes(`?`)?`&`:`?`}${r}`:t}function Cr(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}var wr={mixins:[St],inject:[`api`,`session`,`$verbs`,`$views`,`$isPopulated`,`$parentComponent`,`$schemaComponent`,`$routeComponent`,`$dataComponent`,`$sourceComponent`,`$resourceComponent`,`$dialogComponent`,`$dataModel`,`$panelComponent`,`$tabComponent`,`$loadingTracker`],provide(){let e=()=>this;return{$parentComponent:e,...this.providesData&&{$dataComponent:e},$dataModel:()=>this.dataModel}},data(){return{appState:y,isMounted:!1,overrides:null,ownDataModel:null}},computed:{dataModel(){return this.ownDataModel??this.$dataModel()},providesData(){return!1},sourceSchema(){return this.meta?.schema},user(){return this.session.user},verbs(){return this.$verbs()},views(){return this.$views()},flattenedViews(){return Yn(this.views)},isPopulated(){return this.$isPopulated()},locale(){return this.api.locale},context(){return new D(this,{nested:!1})},rootComponent(){return this.$root.$refs.root},componentPath(){return this.continueParentComponentPath()},dataPathForComponentPath(){return this.dataPath??this.parentComponent?.dataPathForComponentPath},parentComponent(){return this.$parentComponent()},schemaComponent(){return this.$schemaComponent()},routeComponent(){return this.$routeComponent()},formComponent(){let e=this.routeComponent;return e?.isForm?e:null},viewComponent(){let e=this.routeComponent;return e?.isView?e:null},dataComponent(){return this.providesData?this:this.$dataComponent()},sourceComponent(){return this.$sourceComponent()},resourceComponent(){return this.$resourceComponent()},dialogComponent(){return this.$dialogComponent()},panelComponent(){return this.$panelComponent()},tabComponent(){return this.$tabComponent()},parentSchemaComponent(){return Dr(this,`schemaComponent`)},parentRouteComponent(){return Dr(this,`routeComponent`)},parentFormComponent(){return Dr(this,`formComponent`)},parentResourceComponent(){return Dr(this,`resourceComponent`)},rootData(){return this.dataComponent?.data}},mounted(){this.isMounted=!0},methods:{labelize:i.labelize,getStore(e){return this.store[e]},setStore(e,t){return this.store[e]=t,t},removeStore(e){delete this.store[e]},getChildStore(e){return this.getStore(e)??this.setStore(e,(0,t.reactive)({}))},getSchemaValue(e,{type:t,default:n,schema:r=this.schema,context:a=this.context,callback:o=!0}={}){return N(e,{type:t,schema:r,context:a,callback:o,default:(0,i.isFunction)(n)?()=>n.call(this):n})},getLabel(e,t){return e?this.getSchemaValue(`label`,{schema:e,type:[String,Object]})||(0,i.labelize)(t||e.name):(0,i.labelize)(t)||``},getQueryLink(e){return{query:e,hash:this.$route.hash}},shouldRenderSchema(e=null){return P(e,this.context)},shouldShowSchema(e=null){return this.getSchemaValue(`visible`,{type:Boolean,default:!0,schema:e})},shouldDisableSchema(e=null){return this.getSchemaValue(`disabled`,{type:Boolean,default:!1,schema:e})},getResourcePath(e){return e=H(e,{parent:this.dataComponent?.getResource({method:e?.method,child:e})??null}),this.api.resources.any(e)},getResourceUrl(e){let t=this.getResourcePath(e);return t?this.api.getApiUrl({url:t,query:e.query}):null},async sendRequest({method:e,url:t,resource:n,query:r,data:a,signal:o,internal:s}){t||=this.getResourceUrl(n),e||=n?.method;let c=!s&&this.api.isApiUrl(t);c&&await this.session.ensureUser();let l=await this.api.request({method:e,url:t,query:r,data:a,signal:o});return c&&e===`patch`&&(0,i.equals)(n,lr(this.user.id,this.api.users))&&await this.session.fetchUser(),l},showDialog({components:e,buttons:t,data:n,settings:r}){return this.rootComponent.showDialog({components:e,buttons:t,data:n,settings:r})},request({cache:e,...t}){let n=e===`global`?this.appState.loadCache:e===`local`?this.routeComponent?.loadCache:null,{resource:r}=t,i=n&&pr({...t,method:t.method||r?.method,url:t.url||(r?this.getResourceUrl(r):null)});if(n&&i in n)return n[i];let a=this.sendRequest(t).then(e=>e.data).catch(e=>{n?.[i]===a&&delete n[i];let t=e.response?.data;throw t?Object.assign(Error(t.message),t):e});return n&&(n[i]=a),a},format(e,{locale:t=this.api.locale,defaults:n=this.api.formats,...r}={}){return(0,i.format)(e,{locale:t,defaults:n,...r})},async navigate(e){return this.$router.push(e)},download(e={}){(0,i.isString)(e)&&(e={url:e});let t=document.createElement(`a`);t.href=e.url?.startsWith(`blob:`)?e.url:this.api.getApiUrl(e),t.download=e.filename??null;let{body:n}=document;n.appendChild(t),t.click(),n.removeChild(t)},continueParentComponentPath(){let{parentComponent:e}=this,t=e?.componentPath??``,n=Oe(this.dataPath,e?.dataPathForComponentPath);return n?b(t,n):t},notify(e){this.rootComponent.notify(e)},closeNotifications(){this.rootComponent.closeNotifications()},setupSchemaFields(){this.setupMethods(),this.setupComputed(),this.setupEvents()},setupMethods(){for(let[e,t]of Object.entries(this.schema.methods||{}))(0,i.isFunction)(t)?(Er(this,e,`method`),this[e]=t):console.error(`Invalid method definition: ${e}: ${t}`)},setupComputed(){let e=({get:e,set:n})=>{let r=(0,t.computed)(()=>e.call(this));return{get:()=>r.value,set:n?e=>n.call(this,e):void 0}};for(let[t,n]of Object.entries(this.schema.computed||{})){let r=(0,i.isFunction)(n)?e({get:n}):(0,i.isObject)(n)&&(0,i.isFunction)(n.get)?e(n):null;r?(Er(this,t,`computed property`),Object.defineProperty(this,t,r)):console.error(`Invalid computed property definition: ${t}: ${n}`)}},setupEvents(){let{watch:e}=this.schema;if(e){let t=(0,i.isFunction)(e)?e.call(this):e;(0,i.isObject)(t)&&this.$nextTick(()=>{for(let[e,n]of Object.entries(t)){let t=this.schemaComponent.getComponentByName(e)?`data.${e}`:e;this.$watch(t,n)}})}let t=Hn(this.schema);for(let{key:e,event:n,callback:r}of t)(0,i.isFunction)(r)?this.on(n,r):console.error(`Invalid event definition: ${e}: ${r}`)},emitEvent(e,{context:t=null,parent:n=null,...r}={}){let i=Object.keys(r);i.length>0&&console.warn(`Unsupported options for event '${e}': ${i.join(`, `)}. Pass them through \`context\`.`);let a=this.hasListeners(e),o=n?.hasListeners(e);if(a||o){let r=n=>n.emit(e,t=D.get(this,t)),i=e=>o&&e!==!1?r(n).then(()=>e):e,s=()=>a?r(this).then(i):i(void 0);return[`load`,`change`].includes(e)?this.waitUntilDataModelSettled().then(s):s()}},async waitUntilDataModelSettled(){await this.$nextTick();let{dataModel:e}=this;e?.hasPendingLoads&&await this.$loadingTracker().root.track(()=>e.waitUntilSettled())},emitSchemaEvent(e,t){return this.schemaComponent.emitEvent(e,t)}}},Tr=new WeakMap;function Er(e,t,n){let r=Tr.get(e);r||(r=new Set,Tr.set(e,r)),t in e&&!r.has(t)&&console.warn(`The schema ${n} '${t}' overrides a member of the component.`),r.add(t)}function Dr(e,t){let n=e[t],r=e.parentComponent;for(;r&&r[t]===n;)r=r.parentComponent;return r?.[t]??null}function Or(e){let{mixins:t}=e;return t||e.extends?kr({...e},e):e}function kr(e,t){if(t.extends&&kr(e,t.extends),t.mixins)for(let n of t.mixins)kr(e,n);for(let n of Ar)n in t&&(e[n]=t[n]);return e}var Ar=[`defaultValue`,`defaultNested`,`defaultVisible`,`defaultMultiple`,`defaultWidth`,`getSourceType`,`generateLabel`,`rendersOwnLabel`,`excludeValue`,`ignoreMissingValue`,`treatNullAsMissing`,`valueFromDataSchema`,`omitSpacing`,`processValue`,`getTypeValidations`,`processSchema`,`getPanelSchema`,`getFormSchemasForProcessing`,`beforeRouteUpdate`,`beforeRouteLeave`],jr={},W={mixins:[wr],components:jr,component(e,t){if(t&&((0,i.isPlainObject)(t)&&(t=Or({extends:this,name:e,...t})),jr[e]=t),!(e in jr))throw Error(`Component "${e}" not registered`);return jr[e]},methods:{getTypeComponent:qe}};function Mr(e){return e&&(0,i.asArray)(e).some(e=>e.type!==t.Comment)}function Nr(e,n={}){return e=(0,i.isString)(e)?(0,t.useSlots)()[e]:e,Mr(e?.(n))}function Pr({verb:e,subject:t=null,text:n=null,hasText:r=!!n}){let a=r?null:`${(0,i.labelize)(e)}${t?` ${t}`:``}`;return{class:`dito-button--${e}`,...a&&{title:a,"aria-label":a}}}var Fr={key:0,class:`dito-button__prefix`},Ir={class:`dito-button__text`},Lr={key:1,class:`dito-button__suffix`};function Rr(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(r.as),(0,t.mergeProps)({class:[`dito-button`,[o.classes,o.verbAttributes.class,{"dito-button--affixed":o.hasAffixes,"dito-button--disabled":o.isAriaDisabled}]],type:o.isNativeButton?r.type:null,disabled:o.isNativeButton?r.disabled:null,"aria-disabled":o.isAriaDisabled?`true`:null,tabindex:o.isAriaDisabled?-1:null,title:r.title??o.verbAttributes.title,"aria-label":o.verbAttributes[`aria-label`]},o.attributes,{onClickCapture:o.onClickCapture}),{default:(0,t.withCtx)(()=>[r.text||o.hasAffixes?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[o.hasAffixes?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fr,[(0,t.renderSlot)(e.$slots,`prefix`)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Ir,[(0,t.createTextVNode)((0,t.toDisplayString)(r.text||``),1),(0,t.renderSlot)(e.$slots,`default`)]),o.hasAffixes?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Lr,[(0,t.renderSlot)(e.$slots,`suffix`)])):(0,t.createCommentVNode)(``,!0)],64)):(0,t.renderSlot)(e.$slots,`default`,{},void 0,void 0,1)]),_:3},16,[`type`,`disabled`,`aria-disabled`,`tabindex`,`title`,`aria-label`,`class`,`onClickCapture`])}var G=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};function zr(e){return(0,i.asArray)(e).some(e=>(0,i.isString)(e)?e.trim()!==``:!!e&&e.type!==t.Comment&&((0,i.isString)(e.children)?e.children.trim()!==``:(0,i.isArray)(e.children)&&zr(e.children)))}var K=G({inheritAttrs:!1,props:{as:{type:[String,Object],default:`button`},type:{type:String,default:`button`},text:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1},verb:{type:String,default:null},subject:{type:String,default:null}},computed:{isNativeButton(){return this.as===`button`},isAriaDisabled(){return this.disabled&&!this.isNativeButton},verbAttributes(){let{verb:e,subject:t,hasText:n}=this;return e?Pr({verb:e,subject:t,hasText:n}):{}},hasText(){return!!this.text||zr(this.$slots.default?.())},hasAffixes(){return Nr(this.$slots.prefix)||Nr(this.$slots.suffix)},classes(){return this.$attrs.class},attributes(){let{class:e,...t}=this.$attrs;return t}},methods:{onClickCapture(e){this.isAriaDisabled&&(e.preventDefault(),e.stopImmediatePropagation())}}},[[`render`,Rr]]);function Br(e){return{year:e?.getFullYear()??0,month:e?.getMonth()??0,day:e?.getDate()??0,hour:e?.getHours()??0,minute:e?.getMinutes()??0,second:e?.getSeconds()??0,millisecond:e?.getMilliseconds()??0}}function q(e,t={}){return new Date(...Object.values({...Br(e),...t}))}function Vr(e,t,n){let r=Br(e);return r[t]+=n,(t===`year`||t===`month`)&&(r.day=Math.min(r.day,Hr(r.year,r.month))),q(e,r)}function Hr(e,t){return new Date(e,t+1,0).getDate()}function Ur(e,{locale:t=`en-US`,date:n=!0,time:r=!0}={}){let i=r?null:0,a=e?.match(/\s*\b([ap])\.?m\.?$/i);a&&(e=e.slice(0,a.index));let[o,s,c,l,u,,d=i,,f=i,,p=i,,m=i]=Gr(e,{date:n,time:r});if(u&&u.length>=4){if((t===`en-US`&&s===`/`&&l===`/`||isNaN(+o)&&!isNaN(+c))&&([o,c]=[c,o]),a&&d!==null){let e=a[1].toLowerCase()===`p`;d=d%12+(e?12:0),d=String(d).padStart(2,`0`)}c=Kr(c,{locale:t});let e=e=>e===null||e.length===2;if(c!==null&&(!r||e(d)&&e(f)&&e(p))){let e=new Date(+u,+c,+o,+d,+f,+p,+m);return e.getMonth()===+c&&e.getDate()===+o?e:null}}return null}function Wr(e,t,{locale:n=`en-US`,date:r=!0,time:i=!0}={}){let a=Gr(e,{date:r,time:i}),o=(e,t=a.length)=>{let n=0,r=0;for(;(e===null||n<=e)&&r<t;)n+=a[r++]?.length??0;return{position:n,index:r}},s=r?0:o(null,6).position;t+=s;let{index:c}=o(t),l=n===`en-US`,u=[l?`month`:`day`,null,l?`day`:`month`,null,`year`,null,`hour`,null,`minute`,null,`second`,null,`millisecond`];for(;c--;)if(u[c]){let e=o(null,c).position-s,t=e+a[c].length;return{name:u[c],start:e,end:t}}return null}function Gr(e,{date:t=!0,time:n=!0}={}){let r=e?.split(/([\s.,:/]+)/)||[];return t||r.unshift(`1`,`.`,`1`,`.`,`2000`,` `),!n&&r.length>5&&(r.length=5),r}function Kr(e,{locale:t=`en-US`}={}){let n=+e;if(!isNaN(n))return n-1;let r=e.trim().toLowerCase();if(r.length<3)return null;let i=new Intl.DateTimeFormat(t,{month:`short`}),a=new Intl.DateTimeFormat(t,{month:`long`});for(let e=0;e<12;e++){let t=new Date(2e3,e,1);if(i.format(t).toLowerCase().startsWith(r)||a.format(t).toLowerCase().startsWith(r))return e}return null}function qr(e,t,{signal:n}={}){e=e instanceof NodeList?Array.from(e):(0,i.asArray)(e);let r=new AbortController;if(!n?.aborted){n?.addEventListener(`abort`,()=>r.abort(),{once:!0,signal:r.signal});for(let[n,i]of Object.entries(t))for(let t of e)t.addEventListener(n,i,{signal:r.signal})}return{remove(){r.abort()}}}function Jr(...e){return{remove(){for(let t of e)t.remove()}}}function Yr(e){return{37:`left`,38:`up`,39:`right`,40:`down`,13:`enter`}[e?.keyCode]}function Xr(e){let t=Yr(e);return{hor:{left:-1,right:1}[t]||0,ver:{up:-1,down:1}[t]||0,enter:t===`enter`}}var Zr={class:`dito-calendar`,role:`dialog`,"aria-label":`Choose date`},Qr={class:`dito-calendar-popup`},$r={class:`dito-calendar-inner`},ei={class:`dito-calendar-header`},ti={class:`dito-calendar-body`},ni=[`aria-label`],ri={class:`dito-calendar-weekdays`,role:`row`},ii=[`aria-label`],ai=[`tabindex`,`aria-label`,`aria-selected`,`aria-disabled`,`onClick`],oi={class:`dito-calendar-footer`},si=[`aria-label`,`title`],ci={class:`dito-calendar-header`},li={class:`dito-calendar-body`},ui={class:`dito-calendar-months`},di=[`aria-label`,`aria-pressed`,`onClick`],fi={class:`dito-calendar-header`},pi={class:`dito-calendar-body`},mi={class:`dito-calendar-years`},hi=[`aria-label`,`aria-pressed`,`onClick`];function gi(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,Zr,[(0,t.createElementVNode)(`div`,Qr,[(0,t.createElementVNode)(`div`,$r,[a.currentMode===`day`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`div`,ei,[(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-prev dito-calendar-step-year`,type:`button`,"aria-label":`Previous year`,onClick:n[0]||=e=>o.stepYear(-1)}),(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-prev dito-calendar-step-month`,type:`button`,"aria-label":`Previous month`,onClick:n[1]||=e=>o.stepMonth(-1)}),(0,t.createElementVNode)(`span`,null,[(0,t.createElementVNode)(`button`,{class:`dito-calendar-select-year`,type:`button`,"aria-label":`Switch to year selection`,onClick:n[2]||=e=>o.setMode(`year`)},(0,t.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1),(0,t.createElementVNode)(`button`,{class:`dito-calendar-select-month`,type:`button`,"aria-label":`Switch to month selection`,onClick:n[3]||=e=>o.setMode(`month`)},(0,t.toDisplayString)(o.dateToString(a.currentValue,{month:!0})),1)]),(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-next dito-calendar-step-month`,type:`button`,"aria-label":`Next month`,onClick:n[4]||=e=>o.stepMonth(1)}),(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-next dito-calendar-step-year`,type:`button`,"aria-label":`Next year`,onClick:n[5]||=e=>o.stepYear(1)})]),(0,t.createElementVNode)(`div`,ti,[(0,t.createElementVNode)(`div`,{class:`dito-calendar-dates`,role:`grid`,"aria-label":o.monthLabel,onKeydown:n[6]||=(...e)=>o.onDatesKeyDown&&o.onDatesKeyDown(...e)},[(0,t.createElementVNode)(`div`,ri,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.weekdayNames,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{role:`columnheader`,"aria-label":e.long},(0,t.toDisplayString)(e.short),9,ii))),256))]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.weeks,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-calendar__week`,key:+e[0].date,role:`row`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:(0,t.normalizeClass)([`dito-calendar__item`,e.state&&`dito-calendar-item-${e.state}`]),key:+e.date,ref_for:!0,ref:e.isCursor?`cursorItem`:void 0,type:`button`,role:`gridcell`,tabindex:e.isCursor?0:-1,"aria-label":o.dateToString(e.date),"aria-selected":e.state===`active`?`true`:`false`,"aria-disabled":e.isDisabled?`true`:null,onClick:t=>o.selectDay(e.date)},(0,t.toDisplayString)(e.date.getDate()),11,ai))),128))]))),128))],40,ni)]),(0,t.createElementVNode)(`div`,oi,[(0,t.createElementVNode)(`button`,{class:`dito-calendar-select-now`,type:`button`,"aria-label":`Select today (${o.dateToString(new Date)})`,title:o.dateToString(new Date),onClick:n[7]||=e=>o.selectDate(new Date)},null,8,si)])],64)):a.currentMode===`month`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,ci,[(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-prev`,type:`button`,"aria-label":`Previous year`,onClick:n[8]||=e=>o.stepYear(-1)}),(0,t.createElementVNode)(`span`,null,[(0,t.createElementVNode)(`button`,{class:`dito-calendar-select-year`,type:`button`,"aria-label":`Switch to year selection`,onClick:n[9]||=e=>o.setMode(`year`)},(0,t.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1)]),(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-next`,type:`button`,"aria-label":`Next year`,onClick:n[10]||=e=>o.stepYear(1)})]),(0,t.createElementVNode)(`div`,li,[(0,t.createElementVNode)(`div`,ui,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.monthNames,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:(0,t.normalizeClass)([`dito-calendar__item`,o.getMonthClass(n)]),ref_for:!0,ref:o.isCurrentMonth(n)?`cursorItem`:void 0,type:`button`,"aria-label":e.long,"aria-pressed":o.isActiveMonth(n)?`true`:`false`,onClick:e=>o.selectMonth(n)},(0,t.toDisplayString)(e.short),11,di))),256))])])],64)):a.currentMode===`year`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:2},[(0,t.createElementVNode)(`div`,fi,[(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-prev`,type:`button`,"aria-label":`Previous decade`,onClick:n[11]||=e=>o.stepDecade(-1)}),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(o.decadeToString(a.currentValue)),1),(0,t.createElementVNode)(`button`,{class:`dito-calendar-step-next`,type:`button`,"aria-label":`Next decade`,onClick:n[12]||=e=>o.stepDecade(1)})]),(0,t.createElementVNode)(`div`,pi,[(0,t.createElementVNode)(`div`,mi,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.yearRange,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:(0,t.normalizeClass)([`dito-calendar__item`,o.getYearClass(e)]),ref_for:!0,ref:o.isCurrentYear(e)?`cursorItem`:void 0,type:`button`,"aria-label":String(e),"aria-pressed":o.isActiveYear(e)?`true`:`false`,onClick:t=>o.selectYear(e)},(0,t.toDisplayString)(e),11,hi))),256))])])],64)):(0,t.createCommentVNode)(``,!0)])])])}function _i(){return q(new Date,{hour:0,minute:0,second:0,millisecond:0})}var vi=366,yi={emits:[`update:modelValue`,`select`],props:{modelValue:{type:Date,default:null},locale:{type:String,default:`en-US`},disabledDate:{type:Function,default:()=>!1},mode:{type:String,default:`day`}},data(){let{weekdayNames:e,monthNames:t}=xi(this.locale);return{weekdayNames:e,monthNames:t,currentValue:this.modelValue||_i(),currentMode:this.mode}},computed:{dateRange(){let{currentValue:e}=this,t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n,1-new Date(t,n).getDay()),i=(e,t)=>!!t&&e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear(),a=new Date,o=[];for(let t=0;t<42;t++){let s=new Date(r.getFullYear(),r.getMonth(),r.getDate()+t),c=this.disabledDate(s),l=s.getMonth()===n?i(s,this.modelValue)?`active`:i(s,a)?`today`:c?`disabled`:i(s,e)?`current`:null:c?`disabled`:`gray`;o.push({date:s,state:l,isDisabled:c,isCursor:i(s,e)})}return o},monthLabel(){return this.dateToString(this.currentValue,{year:!0,month:!0})},weeks(){let e=[];for(let t=0;t<this.dateRange.length;t+=7)e.push(this.dateRange.slice(t,t+7));return e},yearRange(){let e=this.getFirstYearOfDecade(this.currentValue.getFullYear());return Array.from({length:10},(t,n)=>e+n)}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e||_i())},mode(e){this.currentMode=e}},methods:{isActiveMonth(e){return!!this.modelValue&&e===this.modelValue.getMonth()&&this.currentValue.getFullYear()===this.modelValue.getFullYear()},isCurrentMonth(e){return e===this.currentValue.getMonth()},isActiveYear(e){return!!this.modelValue&&e===this.modelValue.getFullYear()},isCurrentYear(e){return e===this.currentValue.getFullYear()},getMonthClass(e){return{"dito-calendar-item-active":this.isActiveMonth(e),"dito-calendar-item-current":this.isCurrentMonth(e)}},getYearClass(e){return{"dito-calendar-item-active":this.isActiveYear(e),"dito-calendar-item-current":this.isCurrentYear(e)}},setDate(e,t=!1){let n=q(this.currentValue,e);this.currentValue=n,t&&this.commitDate(n)},commitDate(e){return!this.disabledDate(e)&&(this.currentValue=e,this.$emit(`update:modelValue`,e),!0)},stepDecade(e){this.currentValue=Vr(this.currentValue,`year`,e*10)},setMode(e){this.currentMode=e,this.focusCursorItemIfFocused()},stepMonth(e){this.currentValue=Vr(this.currentValue,`month`,e)},stepYear(e){this.currentValue=Vr(this.currentValue,`year`,e)},selectDate(e){this.commitDate(e)&&this.$emit(`select`)},selectDay(e){this.selectDate(q(this.currentValue,{year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}))},selectMonth(e){this.setMode(`day`),this.setDate({month:e,day:1},!0)},selectYear(e){this.setMode(`month`),this.setDate({year:e},!0)},dateToString(e,{year:t,month:n,day:r}={year:!0,month:!0,day:!0}){return e.toLocaleString(this.locale,{year:t&&`numeric`,month:n&&`long`,day:r&&`numeric`})},decadeToString(e){let t=this.getFirstYearOfDecade(e.getFullYear());return`${t} – ${t+9}`},getFirstYearOfDecade(e){return+`${e.toString().slice(0,-1)}0`},navigate({step:e,enter:t,mode:n=this.currentMode,update:r=!1}){if(e){if(![`day`,`month`,`year`].includes(n))return!1;let t=this.currentValue,i=0;do t=Vr(t,n,e);while(r&&this.disabledDate(t)&&++i<vi);return r?this.commitDate(t):(this.currentValue=t,!0)}if(t){switch(this.currentMode){case`day`:this.selectDate(this.currentValue);break;case`month`:this.setMode(`day`);break;case`year`:this.setMode(`month`)}return!0}return!1},handleKey(e,t){let{ver:n,enter:r}=Xr(e);return n?!!t&&this.navigate({step:n,mode:t.name,update:!0}):this.navigate({enter:r})},focusCursorItemIfFocused(){this.$el?.contains(document.activeElement)&&this.$nextTick(()=>(0,i.asArray)(this.$refs.cursorItem)[0]?.focus())},onDatesKeyDown(e){let{key:t,shiftKey:n}=e,{currentValue:r}=this,i=r.getDate(),a={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[t];if(a)this.setDate({day:i+a});else if(t===`PageUp`||t===`PageDown`){let e=t===`PageUp`?-1:1;n?this.stepYear(e):this.stepMonth(e)}else if(t===`Home`)this.setDate({day:1});else if(t===`End`)this.setDate({month:r.getMonth()+1,day:0});else return;e.preventDefault(),this.focusCursorItemIfFocused()}}},bi={};function xi(e){let t=bi[e];if(!t){let n=[];for(let t=0;t<7;t++){let r=new Date(0,0,t);n.push({long:r.toLocaleString(e,{weekday:`long`}),short:r.toLocaleString(e,{weekday:`short`})})}let r=[];for(let t=1;t<=12;t++){let n=new Date(0,t,0);r.push({long:n.toLocaleString(e,{month:`long`}),short:n.toLocaleString(e,{month:`short`})})}t=bi[e]={weekdayNames:n,monthNames:r}}return t}var Si=G(yi,[[`render`,gi]]);function Ci(e){let t=(0,i.isString)(e.target)?e.$refs[e.target]:e.target;return t?.$el??t}function wi(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-trigger-container`,onKeydown:n[5]||=(...e)=>o.onKeyDown&&o.onKeyDown(...e)},[r.alwaysShow?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,t.renderSlot)(e.$slots,`trigger`)],2)):r.trigger===`click`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onClick:n[0]||=(...e)=>o.onClick&&o.onClick(...e)},[(0,t.renderSlot)(e.$slots,`trigger`)],2)):r.trigger===`hover`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onMouseenter:n[1]||=e=>o.onHover(!0),onMouseleave:n[2]||=e=>o.onHover(!1)},[(0,t.renderSlot)(e.$slots,`trigger`)],34)):r.trigger===`focus`||r.trigger===`always`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:3,class:(0,t.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,t.renderSlot)(e.$slots,`trigger`)],2)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(t.Transition,{name:r.transition?`dito-${r.transition}`:void 0,css:!!r.transition},{default:(0,t.withCtx)(()=>[r.trigger===`hover`?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,t.normalizeStyle)(o.popupStyle),onMouseenter:n[3]||=e=>o.onHover(!0),onMouseleave:n[4]||=e=>o.onHover(!1)},[a.showPopup?(0,t.renderSlot)(e.$slots,`popup`,{},void 0,void 0,0):(0,t.createCommentVNode)(``,!0)],38)),[[t.vShow,a.showPopup]]):(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,t.normalizeStyle)(o.popupStyle)},[a.showPopup?(0,t.renderSlot)(e.$slots,`popup`,{},void 0,void 0,0):(0,t.createCommentVNode)(``,!0)],6)),[[t.vShow,a.showPopup]])]),_:3},8,[`name`,`css`])],32)}function Ti(e){return!!e.matches?.(`input, textarea, select, button`)}function Ei(e){return!!e.matches?.(`input, textarea, select`)}var Di=G({emits:[`update:show`],props:{trigger:{type:String,default:`click`},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom`},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:null},customClass:{type:String,default:null},zIndex:{type:Number,default:0},keepInView:{type:Boolean,default:!0},hideWhenClickOutside:{type:Boolean,default:!0},matchTargetWidth:{type:Boolean,default:!0},alwaysShow:{type:Boolean,default:!1},cover:{type:Boolean,default:!1},hideDelay:{type:Number,default:0}},data(){return{showPopup:this.show,focusEvents:null,closeEvents:null,popupEvents:null,mouseLeaveTimer:null,targetResizeObserver:null}},computed:{triggerClass(){return{"dito-trigger-disabled":this.disabled}},popupClass(){let e={[`dito-popup-${(0,i.hyphenate)(this.placement)}`]:!0};return this.customClass&&(e[this.customClass]=!0),e},popupStyle(){return this.zIndex?`z-index: ${this.zIndex}`:``}},watch:{show(e){this.showPopup=e||this.alwaysShow},showPopup(e,t){e^t&&(!e&&this.trigger===`focus`&&this.isPopupFocused()&&this.focusTriggerInput(),this.$emit(`update:show`,e),this.$nextTick(()=>this.onShowPopup(e)))},target(){this.$refs.trigger&&(this.addTargetEvents(),this.targetResizeObserver&&(this.unobserveTargetSize(),this.observeTargetSize()))},placement(){this.$nextTick(()=>this.updatePosition())}},mounted(){this.addTargetEvents(),this.showPopup?this.onShowPopup(!0):this.alwaysShow&&(this.showPopup=!0)},created(){this.showPopup=this.show,this.isFocusingTriggerInput=!1},unmounted(){this.focusEvents?.remove(),this.removeCloseEvents(),this.popupEvents?.remove(),this.unobserveTargetSize(),clearTimeout(this.mouseLeaveTimer)},methods:{open(){this.disabled||(this.showPopup=!0)},close(){this.alwaysShow||(this.showPopup=!1)},toggle(){this.showPopup?this.close():this.open()},getTargetElement(){return Ci(this)??this.$refs.trigger},isPopupFocused(){return!!this.$refs.popup?.contains(document.activeElement)},containsElement(e){return!!e&&(this.$el.contains(e)||this.getTargetElement().contains(e))},getTriggerInput(){return this.getTargetElement()?.querySelector(`input, textarea`)??null},focusTriggerInput(){this.isFocusingTriggerInput=!0;try{this.getTriggerInput()?.focus()}finally{this.isFocusingTriggerInput=!1}},addTargetEvents(){this.focusEvents?.remove(),this.focusEvents=this.trigger===`focus`?this.addFocusEvents(this.getTargetElement()):null},addCloseEvents(){if(this.hideWhenClickOutside&&!this.alwaysShow&&!this.closeEvents){let{trigger:e,popup:t}=this.$refs;this.closeEvents=qr(window,{mouseup:n=>{this.showPopup&&!t.contains(n.target)&&!e.contains(n.target)&&!this.getTargetElement().contains(n.target)&&(this.showPopup=!1)},blur:()=>{this.showPopup=!1}})}},removeCloseEvents(){this.closeEvents?.remove(),this.closeEvents=null},onKeyDown(e){e.key===`Escape`&&this.showPopup&&!this.alwaysShow&&(e.stopPropagation(),this.close())},observeTargetSize(){this.targetResizeObserver||(this.targetResizeObserver=new ResizeObserver(()=>this.updatePosition()),this.targetResizeObserver.observe(this.getTargetElement()))},unobserveTargetSize(){this.targetResizeObserver?.disconnect(),this.targetResizeObserver=null},updatePosition(){let{trigger:e,popup:t}=this.$refs;if(!t||!this.showPopup||t.offsetWidth===0)return;let n=this.getTargetElement();if(this.matchTargetWidth){let r=this.target===`popup`?e:t.firstElementChild;r&&(r.style.width=getComputedStyle(n).width)}let r=n.getBoundingClientRect(),i=r.left+window.scrollX,a=r.top+window.scrollY,o=r.width,s=r.height,c=t.offsetWidth,l=t.offsetHeight,[u,d]=this.placement.split(`-`)||[];if(this.keepInView){let e=window.innerWidth,t=window.innerHeight,n=a,r=t-a-s,f=i,p=e-i-o,m=(e,t,n)=>e<n&&t>e;u===`top`?m(n,r,l)&&(u=`bottom`):u===`bottom`?m(r,n,l)&&(u=`top`):u===`left`?m(f,p,c)&&(u=`right`):u===`right`&&m(p,f,c)&&(u=`left`),d===`top`?m(t-a,a+s,l)&&(d=`bottom`):d===`bottom`?m(a+s,t-a,l)&&(d=`top`):d===`left`?m(e-i,i+o,c)&&(d=`right`):d===`right`&&m(i+o,e-i,c)&&(d=`left`)}let f=0,p=0;switch(u){case`top`:p-=l;break;case`left`:f-=c;break;case`right`:f+=o;break;case`bottom`:p+=s}switch(d){case`right`:f-=c-o;break;case`bottom`:p-=l-s}if(this.cover&&(u===`top`?p+=s:u===`bottom`&&(p-=s)),n!==e){let t=e.getBoundingClientRect();f+=i-t.left,p+=a-t.top}t.style.left=`${f}px`,t.style.top=`${p}px`},addFocusEvents(e){let t=e.querySelectorAll(`input, textarea`),n=null,r=null,i=e=>{let t=n;n=null,r.remove(),r=null,setTimeout(()=>{t.removeAttribute(`readonly`),!Ti(e.target)&&this.isPopupFocused()&&t.focus()},0)},a=e=>{this.containsElement(e.relatedTarget)||this.close()};return e.addEventListener(`blur`,a,!0),Jr(qr(t,{focus:()=>{this.isFocusingTriggerInput||this.open()}}),qr(e,{mousedown:e=>{let{target:t}=e,a=!!this.$refs.popup?.contains(t),o=a?Ei(t):Ti(t);if(o||(e.preventDefault(),e.stopPropagation()),!n&&!(a&&o)){let e=this.getTriggerInput();e&&!e.hasAttribute(`readonly`)&&(e.setAttribute(`readonly`,`true`),n=e,r=qr(window,{mouseup:i}))}}}),{remove(){e.removeEventListener(`blur`,a,!0),r?.remove(),r=null,n?.removeAttribute(`readonly`),n=null}})},onShowPopup(e){e===this.showPopup&&this.$refs.popup&&(e?(this.trigger===`focus`&&(this.popupEvents?.remove(),this.popupEvents=this.addFocusEvents(this.$refs.popup)),this.addCloseEvents(),this.observeTargetSize()):(this.popupEvents?.remove(),this.popupEvents=null,this.removeCloseEvents(),this.unobserveTargetSize()))},onClick(){this.toggle()},onHover(e){this.disabled||(clearTimeout(this.mouseLeaveTimer),e?this.showPopup=!0:this.hideDelay?this.mouseLeaveTimer=setTimeout(()=>{this.showPopup=!1},this.hideDelay):this.showPopup=!1)}}},[[`render`,wi]]),Oi=[`id`,`type`,`name`,`title`,`disabled`,`readonly`,`autofocus`,`placeholder`,`autocomplete`,`aria-label`,`size`];function ki(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-input`,o.classes]),onMousedown:n[2]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)},[(0,t.renderSlot)(e.$slots,`prefix`),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:r.id,ref:`input`,"onUpdate:modelValue":n[0]||=e=>a.currentValue=e,type:r.type,name:r.name,title:r.title,disabled:r.disabled,readonly:r.readonly,autofocus:r.autofocus,placeholder:r.placeholder,autocomplete:r.autocomplete,"aria-label":r.title,size:o.size},o.attributes,{onMousedown:n[1]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)}),null,16,Oi),[[t.vModelDynamic,a.currentValue]]),(0,t.renderSlot)(e.$slots,`suffix`)],34)}var Ai=G({emits:[`update:modelValue`],inheritAttrs:!1,props:{modelValue:{type:[String,Number],default:null},type:{type:String,default:`text`},id:{type:String,default:null},name:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},focused:{type:Boolean,default:!1},placeholder:{type:String,default:null},autocomplete:{type:String,default:`off`}},data(){return{currentValue:this.modelValue}},computed:{classes(){return[this.$attrs.class,{"dito-input--focus":this.focused}]},attributes(){let{class:e,size:t,...n}=this.$attrs;return n},input(){return this.$refs.input},size(){let{size:e,min:t,max:n}=this.$attrs,r=e=>e==null?0:`${e}`.length;return e||Math.max(r(t),r(n))||void 0}},watch:{modelValue(e,t){e!==t&&(this.currentValue=e)},currentValue(e){e!==this.modelValue&&this.$emit(`update:modelValue`,e)}},methods:{focus(){this.input.focus()},blur(){this.input.blur()},onMouseDown(e){e.target===this.input?e.stopPropagation():!this.disabled&&!this.readonly&&(this.focus(),e.preventDefault())}}},[[`render`,ki]]);function ji(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`i`,{class:(0,t.normalizeClass)([`dito-icon`,o.classes])},null,2)}var Mi=G({props:{name:{type:String,required:!0},disabled:{type:Boolean,default:!1}},computed:{classes(){let e=`dito-icon`;return{[`${e}--${this.name}`]:!0,[`${e}--disabled`]:this.disabled}}}},[[`render`,ji]]);function Ni(e,{start:t,end:n}){e?.setSelectionRange&&(e.focus(),e.setSelectionRange(t,n))}function Pi(e){return e&&`selectionStart`in e?{start:e.selectionStart,end:e.selectionEnd}:null}var Fi=[`hour`,`minute`,`second`,`millisecond`];function Ii(e){return Fi.includes(e)}function Li(e,t){let n=[];for(let r=0;r<e;r++)t(r)||n.push(r);return n}function Ri(e,t,n){return e.length===0?null:n>0?e.find(e=>e>t)??e[0]:e.findLast(e=>e<t)??e.at(-1)}function zi(e,t){return e.includes(t)?t:Ri(e,t,1)}function Bi(e,{disabledHour:t,disabledMinute:n,disabledSecond:r}){return t(e.getHours())||n(e.getMinutes())||r(e.getSeconds())}function J(e){return/^\d$/.test(e)}function Vi(e,t,n){if(e.metaKey||e.ctrlKey&&!e.altKey)return;let r=t.selectionStart;if(r!==t.selectionEnd)return;let{value:i}=t,a=r;e.key.length===1?J(e.key)&&a<i.length?(i[a]===`:`&&J(i[a-1])&&J(i[a-2])&&a++,J(i[a])&&(J(i[a+1])||J(i[a-1]))&&(t.value=i.slice(0,a)+i.slice(a+1),t.setSelectionRange(a,a))):i.length===n?e.preventDefault():i.length>n&&(t.value=i.slice(0,n),t.setSelectionRange(r,r),e.preventDefault()):e.key===`Backspace`&&(a===1||[` `,`:`].includes(i[a-2]))&&(a===i.length||i[a]===`:`?(a--,t.value=i.slice(0,a)+((i[a-1]??``)+`00`)+i.slice(a+1),t.setSelectionRange(a,a)):J(i[a])&&!J(i[a+1])&&(t.value=i.slice(0,a)+`0`+i.slice(a),t.setSelectionRange(a,a)))}var Hi=[`aria-label`,`aria-expanded`,`disabled`];function Ui(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoIcon`),c=(0,t.resolveComponent)(`DitoInput`),l=(0,t.resolveComponent)(`DitoTrigger`);return(0,t.openBlock)(),(0,t.createBlock)(l,(0,t.mergeProps)({class:`dito-picker-input`,ref:`trigger`,trigger:`focus`},{show:r.show,transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target},{"onUpdate:show":o.onUpdateShow}),{trigger:(0,t.withCtx)(()=>[e.$slots.trigger?(0,t.renderSlot)(e.$slots,`trigger`,{},void 0,void 0,0):((0,t.openBlock)(),(0,t.createBlock)(c,(0,t.mergeProps)({key:1,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[2]||=e=>o.currentText=e,type:`text`,class:r.inputClass},{placeholder:r.placeholder,disabled:r.disabled,focused:o.isFocused,...r.inputAttributes},{onFocus:o.onInputFocus,onBlur:n[3]||=e=>a.isInputFocused=!1,onClick:o.onInputClick,onKeydown:o.onInputKeyDown,onKeyup:o.updateCaretPart}),{prefix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`prefix`)]),suffix:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`dito-picker-input__toggle`,type:`button`,"aria-label":r.toggleLabel,"aria-haspopup":`dialog`,"aria-expanded":a.isPopupShown?`true`:`false`,disabled:r.disabled,onMousedown:n[0]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`]),onClick:n[1]||=(...e)=>o.onToggleClick&&o.onToggleClick(...e)},[(0,t.createVNode)(s,{name:r.icon,disabled:r.disabled},null,8,[`name`,`disabled`])],40,Hi),(0,t.renderSlot)(e.$slots,`suffix`)]),_:3},16,[`modelValue`,`class`,`onFocus`,`onClick`,`onKeydown`,`onKeyup`]))]),popup:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`popup`,{value:a.currentValue,setValue:o.setValue,close:o.close})]),_:3},16,[`onUpdate:show`])}var Wi=G({components:{DitoTrigger:Di,DitoInput:Ai,DitoIcon:Mi},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`,`caretPartChange`],props:{modelValue:{type:Date,default:null},formatOptions:{type:Object,required:!0},icon:{type:String,required:!0},toggleLabel:{type:String,required:!0},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},target:{type:[String,HTMLElement],default:`trigger`},inputClass:{type:String,default:null},inputAttributes:{type:Object,default:()=>({})},isValueDisabled:{type:Function,default:()=>!1},handlePanelKey:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,isPopupShown:this.show,isInputFocused:!1,caretPartName:null}},computed:{isFocused(){return this.isInputFocused||this.isPopupShown},currentText:{get(){return(0,i.format)(this.currentValue,this.formatOptions)||``},set(e){let t=Ur(e,this.formatOptions);if(t){let e=this.getInputElement(),n=Pi(e);this.setValue(t)&&n&&this.$nextTick(()=>Ni(e,n))}}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},isFocused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{getInputElement(){return this.$refs.input?.input??null},setValue(e){return e&&this.isValueDisabled(e)?!1:(+e!=+this.currentValue&&(this.currentValue=e,+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))),!0)},open(){this.$refs.trigger.open()},close(){this.$refs.trigger.close()},focus(){this.$refs.input?.focus()},blur(){this.$refs.input?.blur()},getCaretPart(){let e=Pi(this.getInputElement())?.start;return e==null?null:Wr(this.currentText,e,this.formatOptions)},updateCaretPart(){let e=this.getCaretPart()?.name??null;e!==this.caretPartName&&(this.caretPartName=e,this.$emit(`caretPartChange`,e))},onUpdateShow(e){this.isPopupShown=e,this.$emit(`update:show`,e)},onInputFocus(){this.isInputFocused=!0,this.updateCaretPart()},onInputClick(){this.updateCaretPart(),this.open()},onToggleClick(){this.isPopupShown?this.close():(this.open(),this.focus())},onInputKeyDown(e){let{ver:t,enter:n}=Xr(e),r=this.getCaretPart();if(t||n){if(e.preventDefault(),!this.isPopupShown)t&&this.open();else if(this.handlePanelKey(e,r)&&r){let e=this.getInputElement();this.$nextTick(()=>{let t=Wr(this.currentText,r.start,this.formatOptions);t&&Ni(e,t)})}}else Ii(r?.name)&&Vi(e,this.getInputElement(),this.currentText.length)}}},[[`render`,Ui]]);function Gi(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoCalendar`),c=(0,t.resolveComponent)(`DitoPickerInput`);return(0,t.openBlock)(),(0,t.createBlock)(c,(0,t.mergeProps)({class:`dito-date-picker`,ref:`pickerInput`},{modelValue:r.modelValue,show:r.show,transition:r.transition,placement:r.placement,target:r.target,disabled:r.disabled},{placeholder:r.placeholder,formatOptions:o.formatOptions,icon:`calendar`,toggleLabel:`Choose date`,inputClass:`dito-date-picker-input`,inputAttributes:e.$attrs,isValueDisabled:r.disabledDate,handlePanelKey:o.handlePanelKey,"onUpdate:modelValue":n[0]||=t=>e.$emit(`update:modelValue`,t),"onUpdate:show":n[1]||=t=>e.$emit(`update:show`,t),onChange:n[2]||=t=>e.$emit(`change`,t),onFocus:n[3]||=t=>e.$emit(`focus`),onBlur:n[4]||=t=>e.$emit(`blur`)}),(0,t.createSlots)({prefix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`prefix`)]),suffix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`suffix`)]),popup:(0,t.withCtx)(({value:e,setValue:n,close:i})=>[(0,t.createVNode)(s,(0,t.mergeProps)({class:`dito-date-picker-popup`,ref:`calendar`,modelValue:e},{locale:r.locale,disabledDate:r.disabledDate},{"onUpdate:modelValue":n,onSelect:i}),null,16,[`modelValue`,`onUpdate:modelValue`,`onSelect`])]),_:2},[e.$slots.trigger?{name:`trigger`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`trigger`)]),key:`0`}:void 0]),1040,[`placeholder`,`formatOptions`,`inputAttributes`,`isValueDisabled`,`handlePanelKey`])}var Ki=G({components:{DitoPickerInput:Wi,DitoCalendar:Si},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({date:i.defaultFormats.date,time:!1})},disabledDate:{type:Function,default:()=>!1}},computed:{formatOptions(){return{locale:this.locale,...this.format}}},methods:{handlePanelKey(e,t){return this.$refs.calendar?.handleKey(e,t)??!1},focus(){this.$refs.pickerInput.focus()},blur(){this.$refs.pickerInput.blur()}}},[[`render`,Gi]]),qi={class:`dito-time-picker-popup`,role:`dialog`,"aria-label":`Choose time`},Ji=[`aria-label`],Yi=[`aria-label`,`aria-selected`,`onClick`];function Xi(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,qi,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.columns,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-time-picker-panel`,key:e.name},[(0,t.createElementVNode)(`ul`,{ref_for:!0,ref:t=>o.setListElement(e.name,t),class:(0,t.normalizeClass)(`dito-time-picker-${e.name}`),role:`listbox`,"aria-label":e.label},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.values,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:n,ref_for:!0,ref:t=>o.setOptionElement(e.name,n,t),role:`option`,"aria-label":o.leftPad(n),"aria-selected":n===e.value,class:(0,t.normalizeClass)({selected:n===e.value}),onClick:t=>o.setTime({[e.name]:n})},(0,t.toDisplayString)(o.leftPad(n)),11,Yi))),128))],10,Ji)]))),128))])}var Zi=G({emits:[`update:modelValue`,`select`],props:{modelValue:{type:Date,default:null},disabledHour:{type:Function,default:()=>!1},disabledMinute:{type:Function,default:()=>!1},disabledSecond:{type:Function,default:()=>!1}},computed:{currentDate(){return this.modelValue||q(new Date,{hour:0,minute:0,second:0,millisecond:0})},enabledValues(){return{hour:Li(24,this.disabledHour),minute:Li(60,this.disabledMinute),second:Li(60,this.disabledSecond)}},columns(){let{currentDate:e,enabledValues:t}=this;return[{name:`hour`,label:`Hour`,value:e.getHours(),values:t.hour},{name:`minute`,label:`Minute`,value:e.getMinutes(),values:t.minute},{name:`second`,label:`Second`,value:e.getSeconds(),values:t.second}]}},watch:{modelValue(e,t){+e!=+t&&this.scrollToSelectedOptions({smooth:!0})}},created(){this.listElements={},this.optionElements={hour:{},minute:{},second:{}}},mounted(){this.scrollToSelectedOptions({smooth:!1})},methods:{leftPad(e){return(`0`+e).slice(-2)},setListElement(e,t){this.listElements[e]=t},setOptionElement(e,t,n){n?this.optionElements[e][t]=n:delete this.optionElements[e][t]},setTime(e){let t={millisecond:0};for(let{name:n,value:r,values:i}of this.columns)if(t[n]=zi(i,e[n]??r),t[n]===null)return;this.$emit(`update:modelValue`,q(this.currentDate,t))},handleKey(e,t){let{ver:n,enter:r}=Xr(e);if(r)return this.$emit(`select`),!0;let i=n&&this.columns.find(({name:e})=>e===t?.name);if(i){let e=Ri(i.values,i.value,n);return e!==null&&this.setTime({[i.name]:e}),!0}return!1},scrollToSelectedOptions({smooth:e}){this.$nextTick(()=>{for(let{name:t,value:n}of this.columns){let r=this.listElements[t],i=this.optionElements[t][n];if(r&&i){let t=Math.round(i.offsetTop-(r.clientHeight-i.offsetHeight)/2),n=Math.abs(r.scrollTop-t);r.scrollTo({top:t,behavior:e&&n<100?`smooth`:`auto`})}}})}}},[[`render`,Xi]]);function Qi(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoCalendar`),c=(0,t.resolveComponent)(`DitoTimePanel`),l=(0,t.resolveComponent)(`DitoPickerInput`);return(0,t.openBlock)(),(0,t.createBlock)(l,(0,t.mergeProps)({class:`dito-date-time-picker`,ref:`pickerInput`},{modelValue:r.modelValue,transition:r.transition,disabled:r.disabled,placeholder:r.placeholder,formatOptions:o.formatOptions},{placement:a.activePanel===`time`?`bottom-right`:`bottom-left`,icon:`calendar`,toggleLabel:`Choose date and time`,inputClass:`dito-date-time-picker__input`,inputAttributes:e.$attrs,handlePanelKey:o.handlePanelKey,"onUpdate:modelValue":n[0]||=t=>e.$emit(`update:modelValue`,t),onChange:n[1]||=t=>e.$emit(`change`,t),onFocus:n[2]||=t=>e.$emit(`focus`),onBlur:n[3]||=t=>e.$emit(`blur`),onCaretPartChange:o.onCaretPartChange}),{prefix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`prefix`)]),suffix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`suffix`)]),popup:(0,t.withCtx)(({value:e,setValue:n,close:i})=>[a.activePanel===`date`?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,class:`dito-date-picker-popup`,ref:`calendar`,modelValue:e,locale:r.locale,"onUpdate:modelValue":n,onSelect:i},null,8,[`modelValue`,`locale`,`onUpdate:modelValue`,`onSelect`])):((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,ref:`timePanel`,modelValue:e,"onUpdate:modelValue":n,onSelect:i},null,8,[`modelValue`,`onUpdate:modelValue`,`onSelect`]))]),_:3},16,[`placement`,`inputAttributes`,`handlePanelKey`,`onCaretPartChange`])}var $i=G({components:{DitoPickerInput:Wi,DitoCalendar:Si,DitoTimePanel:Zi},emits:[`update:modelValue`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},locale:{type:String,default:`en-US`},format:{type:Object,default:null}},data(){return{activePanel:`date`}},computed:{formatOptions(){let e=(0,i.assignDeeply)({locale:this.locale,time:i.defaultFormats.time,date:i.defaultFormats.date},{date:{month:`short`}},this.format);if((0,i.isPlainObject)(e.date)){let{format:t}=e.date;e.date.format=(e,n,r)=>n===`literal`&&/\bat\b/.test(e)?`, `:t?.(e,n,r)??e}return e}},methods:{getPanelForPart(e){return Ii(e)?`time`:`date`},onCaretPartChange(e){let t=this.getPanelForPart(e);t!==this.activePanel&&(this.activePanel=t,this.$refs.pickerInput.open())},handlePanelKey(e,t){if(this.getPanelForPart(t?.name)!==this.activePanel)return!1;let{calendar:n,timePanel:r}=this.$refs;return(this.activePanel===`time`?r:n)?.handleKey(e,t)??!1},focus(){this.$refs.pickerInput.focus()},blur(){this.$refs.pickerInput.blur()}}},[[`render`,Qi]]),ea=[`aria-disabled`,`onClick`];function ta(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`),c=(0,t.resolveComponent)(`DitoTrigger`);return(0,t.openBlock)(),(0,t.createBlock)(c,{class:(0,t.normalizeClass)([`dito-menu-button`,{"dito-menu-button--open":a.isOpen,"dito-menu-button--offset":r.offset}]),show:a.isOpen,"onUpdate:show":n[2]||=e=>a.isOpen=e,trigger:`click`,placement:r.placement,disabled:r.disabled,matchTargetWidth:!1,cover:r.cover,transition:null},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({ref:`button`,"aria-haspopup":`menu`,"aria-expanded":a.isOpen?`true`:`false`,disabled:r.disabled},e.$attrs,{onKeydown:o.onButtonKeyDown,onKeyup:o.onKeyUp}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`aria-expanded`,`disabled`,`onKeydown`,`onKeyup`])]),popup:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`ul`,{class:`dito-menu-button__menu`,role:`menu`,onKeydown:n[0]||=(...e)=>o.onMenuKeyDown&&o.onMenuKeyDown(...e),onKeyup:n[1]||=(...e)=>o.onKeyUp&&o.onKeyUp(...e)},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.items,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:e.value,role:`none`},[(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`dito-menu-button__item`,{"dito-menu-button__item--disabled":e.disabled}]),ref_for:!0,ref:t=>o.setItemElement(e,t),type:`button`,role:`menuitem`,tabindex:`-1`,"aria-disabled":e.disabled?`true`:null,onClick:t=>o.selectItem(e)},(0,t.toDisplayString)(e.label),11,ea)]))),128))],32)]),_:3},8,[`show`,`placement`,`disabled`,`cover`,`class`])}var na=G({components:{DitoTrigger:Di,DitoButton:K},inheritAttrs:!1,emits:[`select`],props:{items:{type:Array,required:!0},placement:{type:String,default:`bottom`},cover:{type:Boolean,default:!0},offset:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},data(){return{isOpen:!1}},created(){this.itemElements=new Map},methods:{setItemElement(e,t){t?this.itemElements.set(e,t):this.itemElements.delete(e)},getFocusedItemIndex(){return this.items.findIndex(e=>this.itemElements.get(e)===document.activeElement)},focusItemAt(e){this.itemElements.get(this.items[e])?.focus()},async open(e){this.isOpen=!0,await this.$nextTick(),this.focusItemAt(e)},close(){this.isOpen=!1,this.focusButton()},focusButton(){this.$refs.button.$el.focus()},selectItem(e){e.disabled||(this.close(),this.$emit(`select`,e))},onButtonKeyDown(e){let{key:t}=e;t===`Enter`||t===` `||t===`ArrowDown`?(e.preventDefault(),this.open(0)):t===`ArrowUp`&&(e.preventDefault(),this.open(this.items.length-1))},onMenuKeyDown(e){let{key:t}=e,n=this.items.length,r=this.getFocusedItemIndex();if(t===`Escape`)this.focusButton();else if(t===`Enter`||t===` `){e.preventDefault();let t=this.items[r];t&&this.selectItem(t)}else if(t===`Tab`)this.isOpen=!1;else{let i={ArrowDown:(r+1)%n,ArrowUp:(r-1+n)%n,Home:0,End:n-1}[t];i!==void 0&&(e.preventDefault(),this.focusItemAt(i))}},onKeyUp(e){e.key===` `&&e.preventDefault()}}},[[`render`,ta]]),ra={class:`dito-pagination`,"aria-label":`Pagination`},ia={key:0,class:`dito-pagination-total`},aa={key:1,class:`dito-buttons dito-buttons--round`},oa={key:0};function sa(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`);return(0,t.openBlock)(),(0,t.createElementBlock)(`nav`,ra,[r.showTotal?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ia,[r.total>0?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)(o.first)+` – `+(0,t.toDisplayString)(o.last)+` / `+(0,t.toDisplayString)(r.total),1)],64)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),o.numPages>1?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,aa,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.buttons,e=>((0,t.openBlock)(),(0,t.createBlock)(s,{key:e.type||e.index,class:(0,t.normalizeClass)(o.getButtonClasses(e)),disabled:e.disabled,"aria-label":o.getButtonLabel(e),"aria-current":e.active?`page`:null,onClick:t=>o.onClickButton(e)},{default:(0,t.withCtx)(()=>[e.text?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,oa,(0,t.toDisplayString)(e.text),1)):(0,t.createCommentVNode)(``,!0)]),_:2},1032,[`class`,`disabled`,`aria-label`,`aria-current`,`onClick`]))),128))])):(0,t.createCommentVNode)(``,!0)])}var ca=G({components:{DitoButton:K},emits:[`update:page`],props:{total:{type:Number,default:0},page:{type:Number,default:1},pageSize:{type:Number,default:10},showTotal:{type:Boolean,default:!0}},data(){return{showPrev:!0,showNext:!0,currentPage:this.page}},computed:{first(){return(this.currentPage-1)*this.pageSize+1},last(){return Math.min(this.first+this.pageSize-1,this.total)},numPages(){return Math.ceil(this.total/this.pageSize)},buttons(){let{showPrev:e,showNext:t,currentPage:n,numPages:r}=this,i=e+t+1,a=1,o;r<=i?o=r:n<=e+1?o=i:n>=r-t?(o=r,a=r-i+1):(a=n-e,o=n+t);let s=[];s.push({index:n-1,type:`prev`,disabled:n<=1}),a>=2&&s.push({index:1,text:1}),a>2&&s.push({index:Math.max(1,n-10),type:`ellipsis-prev`});for(let e=a;e<=o;e++)s.push({index:e,text:e,active:e===n});return o<r-1&&s.push({index:Math.min(r,n+10),type:`ellipsis-next`}),o<=r-1&&s.push({index:r,text:r}),s.push({index:n+1,type:`next`,disabled:n>=r}),s}},watch:{page(e){this.currentPage=e},pageSize(){let e=Math.max(1,this.numPages);this.currentPage>e&&(this.currentPage=e)},currentPage(e,t){e!==t&&this.$emit(`update:page`,e)}},created(){this.currentPage=this.page},methods:{getButtonClasses(e){let t=`dito-button`;return{[`${t}--${e.type}`]:e.type,[`${t}--active`]:e.active}},getButtonLabel(e){return e.type===`prev`?`Previous page`:e.type===`next`?`Next page`:e.text?`Page ${e.text}`:null},onClickButton(e){e.index&&!e.disabled&&e.index!==this.currentPage&&(this.currentPage=e.index)}}},[[`render`,sa]]),la={class:`dito-switch__pane`},ua=[`id`,`aria-checked`,`name`,`disabled`],da={key:0,class:`dito-switch__label`};function fa(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-switch`,o.classes]),style:(0,t.normalizeStyle)(o.styles)},[(0,t.createElementVNode)(`div`,la,[(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:r.id,ref:`input`},o.attributes,{"onUpdate:modelValue":n[0]||=e=>a.checked=e,role:`switch`,type:`checkbox`,"aria-checked":a.checked,name:r.name,disabled:r.disabled}),null,16,ua),[[t.vModelCheckbox,a.checked]]),n[1]||=(0,t.createElementVNode)(`div`,{class:`dito-switch__button`},null,-1),r.labels?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,da,[a.checked?(0,t.renderSlot)(e.$slots,`checked`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(r.labels.checked||`on`),1)],void 0,0):(0,t.renderSlot)(e.$slots,`unchecked`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(r.labels.unchecked||`off`),1)],void 0,1)])):(0,t.createCommentVNode)(``,!0)])],6)}var pa=G({emits:[`update:modelValue`,`change`],inheritAttrs:!1,props:{modelValue:{type:Boolean,default:!1},id:{type:String,default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},labels:{type:[Object,Boolean],default:!1}},data(){return{checked:this.modelValue}},computed:{classes(){let e=`dito-switch`;return[this.$attrs.class,{[`${e}--checked`]:this.checked,[`${e}--disabled`]:this.disabled}]},styles(){let{labels:{checked:e,unchecked:t}={}}=this,n=Math.max(e?.length??0,t?.length??0);return{"--switch-width":n?`${n*1.5}rem`:null}},attributes(){let{class:e,...t}=this.$attrs;return t}},watch:{modelValue(e){this.checked=e},checked(e){e!==this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))}},methods:{focus(){this.$refs.input.focus()}}},[[`render`,fa]]);function ma(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoTimePanel`),c=(0,t.resolveComponent)(`DitoPickerInput`);return(0,t.openBlock)(),(0,t.createBlock)(c,(0,t.mergeProps)({class:`dito-time-picker`,ref:`pickerInput`},{modelValue:r.modelValue,show:r.show,transition:r.transition,placement:r.placement,target:r.target,disabled:r.disabled},{placeholder:r.placeholder,formatOptions:o.formatOptions,icon:`clock`,toggleLabel:`Choose time`,inputClass:`dito-time-picker-input`,inputAttributes:e.$attrs,isValueDisabled:o.isValueDisabled,handlePanelKey:o.handlePanelKey,"onUpdate:modelValue":n[0]||=t=>e.$emit(`update:modelValue`,t),"onUpdate:show":n[1]||=t=>e.$emit(`update:show`,t),onChange:n[2]||=t=>e.$emit(`change`,t),onFocus:n[3]||=t=>e.$emit(`focus`),onBlur:n[4]||=t=>e.$emit(`blur`)}),(0,t.createSlots)({prefix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`prefix`)]),suffix:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`suffix`)]),popup:(0,t.withCtx)(({value:e,setValue:n,close:i})=>[(0,t.createVNode)(s,(0,t.mergeProps)({ref:`timePanel`,modelValue:e},{disabledHour:r.disabledHour,disabledMinute:r.disabledMinute,disabledSecond:r.disabledSecond},{"onUpdate:modelValue":n,onSelect:i}),null,16,[`modelValue`,`onUpdate:modelValue`,`onSelect`])]),_:2},[e.$slots.trigger?{name:`trigger`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`trigger`)]),key:`0`}:void 0]),1040,[`placeholder`,`formatOptions`,`inputAttributes`,`isValueDisabled`,`handlePanelKey`])}var ha=G({components:{DitoPickerInput:Wi,DitoTimePanel:Zi},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({time:i.defaultFormats.time,date:!1})},disabledHour:{type:Function,default:()=>!1},disabledMinute:{type:Function,default:()=>!1},disabledSecond:{type:Function,default:()=>!1}},computed:{formatOptions(){return{locale:this.locale,...this.format}}},methods:{isValueDisabled(e){let{disabledHour:t,disabledMinute:n,disabledSecond:r}=this;return Bi(e,{disabledHour:t,disabledMinute:n,disabledSecond:r})},handlePanelKey(e,t){return this.$refs.timePanel?.handleKey(e,t)??!1},focus(){this.$refs.pickerInput.focus()},blur(){this.$refs.pickerInput.blur()}}},[[`render`,ma]]);function ga({enabled:e},{slots:n}){return e?(0,t.h)(t.Transition,ba,n):n.default()}ga.props={enabled:{type:Boolean,default:!0}};var _a=ga,Y=(e,t)=>Object.assign(e.style,t),va=e=>setTimeout(e,0),ya=e=>getComputedStyle(e).height,ba={name:`dito-height`,onAfterEnter(e){va(()=>Y(e,{height:null}))},onEnter(e){let{width:t}=getComputedStyle(e);Y(e,{width:t,position:`absolute`,visibility:`hidden`,height:`auto`}),va(()=>{let{height:t}=getComputedStyle(e);Y(e,{width:null,position:null,visibility:null,height:0}),ya(e),va(()=>Y(e,{height:t}))})},onLeave(e){let{height:t}=getComputedStyle(e);Y(e,{height:t}),ya(e),va(()=>Y(e,{height:0}))}},xa={created(){this.domAbortController=new AbortController},unmounted(){this.domAbortController.abort()},methods:{domOn(e,t,n){return qr(e,(0,i.isObject)(t)?t:{[t]:n},{signal:this.domAbortController.signal})}}},Sa=class{currentPromiseOrLoader=null;currentLoadPromise=null;lastFinishedLoad=(0,t.shallowRef)({promiseOrLoader:null,value:void 0,error:null});constructor(e,{createContext:n,onLoadStart:r=null}){this.dataSchema=(0,i.isObject)(e)?e:{data:e},this.createContext=n,this.onLoadStart=r,this.valueOrPromiseOrLoader=(0,t.computed)(()=>this.getValueOrPromiseOrLoader()),this.valueOrUndefinedWhileLoading=(0,t.computed)(()=>this.getValueOrStartLoad())}get value(){return this.valueOrUndefinedWhileLoading.value}get isLoading(){if(this.value!==void 0)return!1;let e=this.valueOrPromiseOrLoader.value;return Ca(e)&&this.lastFinishedLoad.value.promiseOrLoader!==e}async waitForValue(){for(;this.isLoading;)await this.currentLoadPromise;return this.value}get lastLoadError(){let{promiseOrLoader:e,error:t}=this.lastFinishedLoad.value;return e===this.valueOrPromiseOrLoader.value?t:null}getValueOrPromiseOrLoader(){let{data:e,dataPath:t}=this.dataSchema;if(e!==void 0)return(0,i.isFunction)(e)?e(this.createContext()):e;if(t){let e=this.createContext();return(0,i.getValueAtDataPath)(e.rootItem,(0,i.normalizeDataPath)(`${e.dataPath}/${t}`),()=>void 0)}}getValueOrStartLoad(){let e=this.valueOrPromiseOrLoader.value;if(!Ca(e))return e;let{promiseOrLoader:t,value:n}=this.lastFinishedLoad.value;if(t===e)return n;this.currentPromiseOrLoader!==e&&this.startLoad(e)}startLoad(e){this.currentPromiseOrLoader=e;let t=this.createContext(),n=(t,n=null)=>{this.currentPromiseOrLoader===e&&(this.lastFinishedLoad.value={promiseOrLoader:e,value:t,error:n})},r=Promise.resolve().then(()=>(0,i.isFunction)(e)?e(t):e).then(e=>n(e)).catch(e=>{console.error(e),n(void 0,e)});this.currentLoadPromise=r,this.onLoadStart?.(r)}};function Ca(e){return(0,i.isFunction)(e)||(0,i.isPromise)(e)}var wa=class{componentRecords=new Fa;pendingLoads=new Set;processedDataSnapshot=(0,t.shallowRef)(null);derivedValueDataPaths=null;cleanChangesDerivedValueDataPaths=new Set;computedValueWriteCounts=null;constructor({component:e,getSchema:n,getData:r,getSourceSchema:i=null}){this.component=e,this.getSchema=n,this.getData=r,this.getSourceSchema=i,this.rootScope=(0,t.effectScope)(!0),this.rootScope.run(()=>{(0,t.watch)([n,r],([e,t])=>this.initializeData(e,t),ka),this.dataEntries=(0,t.computed)(()=>this.getDataEntries()),(0,t.watch)(()=>this.dataEntries.value.recordedEntries,e=>this.updateComponentRecords(e),ka),(0,t.watch)(()=>this.dataEntries.value.entriesWithMissingValues,e=>this.setDefaultValues(e),ka),i&&(0,t.watch)(r,()=>this.takeProcessedDataSnapshot().catch(console.error),Aa)})}get dataPath(){return this.component.dataPath??``}get componentPath(){return this.component.componentPath??``}get rootData(){return this.component.rootData??this.getData()}get isDirty(){let e=this.processedDataSnapshot.value,t=this.getData();if(!t||e?.data!==t)return!1;let n=this.getProcessedDataForDirtyCheck(),r=this.derivedValueDataPaths?Ta(e.processedData,n,this.derivedValueDataPaths):e.processedData;return!(0,i.equals)(n,r)}stop(){this.rootScope.stop(),this.componentRecords.clear(),this.pendingLoads.clear()}get hasPendingLoads(){return this.pendingLoads.size>0}async waitUntilSettled({timeout:e=Na}={}){let n=null,r=e==null?null:new Promise(t=>{n=setTimeout(()=>t(!0),e)}),i=(async()=>{for(;this.hasPendingLoads;)await Promise.all(this.pendingLoads),await(0,t.nextTick)();return!1})();try{await(r?Promise.race([i,r]):i)&&console.warn(`The data model didn't settle within ${e}ms, as ${this.pendingLoads.size} loads of data schemas or options are still pending. Continuing without them.`)}finally{clearTimeout(n)}}async takeProcessedDataSnapshot(){let e=this.getData(),n=e?new Set:null;if(this.derivedValueDataPaths=n,this.processedDataSnapshot.value=e?{data:e,processedData:(0,i.clone)(this.getProcessedDataForDirtyCheck())}:null,!e)return;await(0,t.nextTick)(),await this.waitUntilSettled({timeout:null});let r=this.derivedValueDataPaths!==n,a=!this.rootScope.active;if(r||a)return;this.derivedValueDataPaths=null;let o=this.processedDataSnapshot.value;o?.data===this.getData()&&(this.processedDataSnapshot.value={data:e,processedData:Ta(o.processedData,this.getProcessedDataForDirtyCheck(),n)})}getProcessedDataForDirtyCheck(){let e=this.getSchema(),t=this.getData();return t&&!Jt(e)?pn(e,this.getSourceSchema(),t,this.dataPath,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,schemaOnly:!0,target:`clipboard`,shouldCallProcess:!1}):null}async applyCleanChanges(e){let n=this.getData(),r=this.processedDataSnapshot.value?.data===n,a=r?(0,i.clone)(this.getProcessedDataForDirtyCheck()):null;if(e(),r){let e=(0,i.clone)(this.getProcessedDataForDirtyCheck()),r=new Set;this.cleanChangesDerivedValueDataPaths.add(r);try{await(0,t.nextTick)(),await this.waitUntilSettled({timeout:null})}finally{this.cleanChangesDerivedValueDataPaths.delete(r)}let o=this.processedDataSnapshot.value;o?.data===n&&this.rootScope.active&&(this.processedDataSnapshot.value={data:n,processedData:Ta(Ea(o.processedData,a,e),this.getProcessedDataForDirtyCheck(),r)})}}recordDerivedValueDataPath(e){this.derivedValueDataPaths?.add(e);for(let t of this.cleanChangesDerivedValueDataPaths)t.add(e)}trackPendingLoad(e){this.pendingLoads.add(e),e.finally(()=>this.pendingLoads.delete(e))}initializeData(e,t){t&&!Jt(e)&&ln(e,t,this.component,{dataPath:this.dataPath,rootData:this.rootData,shouldSkipSourcesWithResource:!0,shouldSetDefaultsOfComponentsWithCompute:!1})}getDataEntries(){let e=this.getSchema(),t=this.getData(),n=new Fa,r=[];return t&&!Jt(e)&&I(e,t,{dataPath:this.dataPath,componentPath:this.componentPath,shouldProcess:e=>this.shouldRenderEntry(e),shouldSkipSourcesWithResource:!0,before:e=>{(Ia(e.schema)||e.schema.options)&&n.set(e,e),this.shouldSetDefaultValue(e)&&r.push(e)},options:{component:this.component,rootData:this.rootData}}),{recordedEntries:n,entriesWithMissingValues:r}}shouldRenderEntry(e){if(e.schema.if===void 0)return!0;try{return N(`if`,{type:Boolean,schema:e.schema,context:this.createEntryContext(e),default:!0})}catch(e){return console.error(e),!0}}shouldSetDefaultValue(e){let{schema:t,data:n,name:r}=e;return cn(t,n,r,()=>this.createEntryContext(e),{shouldSetDefaultsOfComponentsWithCompute:!1})}setDefaultValues(e){for(let t of e)if(this.shouldSetDefaultValue(t)){let{schema:e,data:n,name:r}=t;tn(e,n,r,()=>this.createEntryContext(t))}}updateComponentRecords(e){let t=this.componentRecords;this.componentRecords=new Fa;for(let n of e.values()){let e=t.get(n)??Pa(n);t.delete(n),e.entry.schema!==n.schema&&(e.computedValueScope?.stop(),e.computedValueScope=null),e.entry=n,e.dataPath.value=n.dataPath,this.componentRecords.set(n,e),Ia(n.schema)&&(e.computedValueScope??=this.createComputedValueScope(e))}for(let{computedValueScope:e}of t.values())e?.stop()}getComponentRecord(e){let t=this.componentRecords.get(e);return t||(t=Pa(e),this.componentRecords.set(e,t)),t}createComputedValueScope(e){let{schema:n}=e.entry,r=this.rootScope.run(()=>(0,t.effectScope)());return r.run(()=>{let r=(0,t.computed)(()=>this.isRecordCurrent(e,n));if(n.compute&&(0,t.watch)(()=>r.value?this.getComputedValueResult(e):null,t=>{t&&this.writeComputedValue(e.entry,t.value)},Aa),on(n)){let i=this.createDataSchemaResolver(n,e);(0,t.watch)(()=>r.value&&!i.isLoading?{value:i.value}:null,t=>{t&&this.writeComputedValue(e.entry,t.value)},Aa)}}),r}hasComputedValueEntry(e){let t=this.dataEntries.value.recordedEntries.get(e);return!!t&&Ia(t.schema)}isRecordCurrent(e,t){return this.dataEntries.value.recordedEntries.get(e.entry)?.schema===t}getComputedValueResult(e){let{entry:t}=e,{schema:n,data:r,name:i}=t;try{return{value:un(n,r,i,()=>e.dataPath.value,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,getOptions:n.options?()=>this.getLoadedOptions(t):null})}}catch(e){if(e===ja)return null;throw e}}getLoadedOptions(e){let t=this.getOptionsResolver(e);if(t.isLoading)throw ja;return t.value}getOptions(e){return this.getOptionsResolver(e).value}getOptionsResolver(e){let t=this.getComponentRecord(e),{options:n}=e.schema;return(!t.optionsResolver||t.optionsSchema!==n)&&(t.optionsSchema=n,t.optionsResolver=this.createDataSchemaResolver(n,t)),t.optionsResolver}createDataSchemaResolver(e,t){return new Sa(e,{createContext:()=>this.createEntryContext(t.entry),onLoadStart:e=>this.trackPendingLoad(e)})}writeComputedValue(e,t){let{data:n,name:r}=e,a=this.getValueWithNestedDefaultValues(e,t);if(!(0,i.equals)(a,n[r])){let t=this.getRelativeDataPath(e);if(this.isWriteLoop(t))return;this.recordDerivedValueDataPath(t),n[r]=a}}getValueWithNestedDefaultValues(e,n){let{data:r,name:a}=e;if(!(0,i.isPlainObject)(n)&&!(0,i.isArray)(n)||(0,t.toRaw)(n)===(0,t.toRaw)(r[a]))return n;let o=new Set;if(this.processNestedEntries(e,n,e=>{this.shouldSetDefaultValue(e)&&o.add(e.data)}),o.size===0)return n;let s=Da(n,o);return this.processNestedEntries(e,s,e=>{this.shouldSetDefaultValue(e)&&tn(e.schema,e.data,e.name,()=>this.createEntryContext(e))}),s}processNestedEntries(e,t,n){let{schema:r,data:i,name:a,dataPath:o}=e,s={...i,[a]:t};I({components:{[a]:r}},s,{dataPath:C(r)?Ae(o):o,shouldProcess:e=>this.shouldRenderEntry(e),shouldSkipSourcesWithResource:!0,before:e=>{e.data!==s&&n(e)},options:{component:this.component,rootData:this.rootData}})}isWriteLoop(e){this.computedValueWriteCounts||(this.computedValueWriteCounts=new Map,queueMicrotask(()=>{this.computedValueWriteCounts=null}));let t=(this.computedValueWriteCounts.get(e)??0)+1;return this.computedValueWriteCounts.set(e,t),t===Ma+1&&console.error(Error(`The computed value at '${e}' keeps changing, as its sources disagree on it. It isn't written anymore in this update.`)),t>Ma}getRelativeDataPath({schema:e,name:t,dataPath:n}){return Oe(C(e)?n:b(n,t),this.dataPath)}createEntryContext({schema:e,data:t,name:n,dataPath:r}){return D.createForSchema(this.component,{schema:e,name:n,data:t,dataPath:r,rootData:this.rootData})}};function Ta(e,t,n){if(n.size===0)return e;let r=(0,i.clone)(e);for(let e of n){let n=(0,i.parseDataPath)(e),a=n.slice(0,-1),o=n.at(-1),s=(0,i.getValueAtDataPath)(r,a,()=>null);if(s&&typeof s==`object`){let n=(0,i.getValueAtDataPath)(t,e,()=>Oa);n===Oa?delete s[o]:s[o]=(0,i.clone)(n)}}return r}function Ea(e,t,n){if((0,i.equals)(t,n))return e;if(!((0,i.isPlainObject)(t)&&(0,i.isPlainObject)(n)&&(0,i.isPlainObject)(e)||(0,i.isArray)(t)&&(0,i.isArray)(n)&&(0,i.isArray)(e)&&t.length===n.length&&n.length===e.length))return(0,i.clone)(n);let r=(0,i.isArray)(e)?[...e]:{...e};for(let i of new Set([...Object.keys(t),...Object.keys(n)]))i in n?r[i]=Ea(e[i],t[i],n[i]):delete r[i];return r}function Da(e,t,n=new Set){if(!(0,i.isPlainObject)(e)&&!(0,i.isArray)(e)||n.has(e))return e;n.add(e);let r=()=>(0,i.isArray)(e)?[...e]:{...e},a=t.has(e)?r():null;for(let[i,o]of Object.entries(e)){let e=Da(o,t,n);e!==o&&(a??=r(),a[i]=e)}return n.delete(e),a??e}var Oa=Symbol(`notFound`),ka={immediate:!0,flush:`pre`},Aa={immediate:!0,flush:`post`},ja=Symbol(`optionsNotLoaded`),Ma=10,Na=3e4;function Pa(e){return{entry:e,dataPath:(0,t.shallowRef)(e.dataPath),computedValueScope:null,optionsResolver:null,optionsSchema:null}}var Fa=class{valuesByData=new Map;get({data:e,name:n}){return this.valuesByData.get((0,t.toRaw)(e))?.get(n)}set({data:e,name:n},r){let i=(0,t.toRaw)(e),a=this.valuesByData.get(i);a||(a=new Map,this.valuesByData.set(i,a)),a.set(n,r)}delete({data:e,name:n}){let r=(0,t.toRaw)(e),i=this.valuesByData.get(r);i?.delete(n)&&i.size===0&&this.valuesByData.delete(r)}clear(){this.valuesByData.clear()}*values(){for(let e of this.valuesByData.values())yield*e.values()}};function Ia(e){return!!e.compute||on(e)}var La=[`aria-label`];function Ra(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButtons`),c=(0,t.resolveComponent)(`DitoSchema`),l=(0,t.resolveComponent)(`UseFocusTrap`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-dialog`,ref:`dialog`,role:`dialog`,"aria-label":e.settings.label||`Dialog`,"aria-modal":`true`,style:(0,t.normalizeStyle)({"--width":e.settings.width?`${e.settings.width}px`:null}),onMouseup:n[2]||=(0,t.withModifiers)((...t)=>e.onMouseUp&&e.onMouseUp(...t),[`self`]),onKeydown:n[3]||=(...t)=>e.onKeyDown&&e.onKeyDown(...t)},[(0,t.createVNode)(l,{class:`dito-dialog__focus-trap`,options:e.focusTrapOptions},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`form`,{class:`dito-dialog__form dito-scroll-parent`,onSubmit:n[0]||=(0,t.withModifiers)((...t)=>e.submit&&e.submit(...t),[`prevent`]),onKeydown:n[1]||=(0,t.withKeys)((...t)=>e.onEnter&&e.onEnter(...t),[`enter`])},[(0,t.withDirectives)((0,t.createElementVNode)(`button`,null,null,512),[[t.vShow,!1]]),(0,t.createVNode)(c,{schema:e.schema,data:e.dialogData,padding:`root`,scrollable:``,generateLabels:``},{buttons:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{class:`dito-buttons--large`,buttons:e.buttonSchemas,data:e.dialogData},null,8,[`buttons`,`data`])]),_:1},8,[`schema`,`data`])],32)]),_:1},8,[`options`])],44,La)}var za=G(W.component(`DitoDialog`,{components:{UseFocusTrap:s.UseFocusTrap},emits:[`remove`],provide(){return{$dialogComponent:()=>this}},props:{components:{type:Object,required:!0},buttons:{type:Object,required:!0},promise:{type:Object,required:!0},data:{type:Object,default:()=>({})},settings:{type:Object,default:()=>({width:480,clickToClose:!1})}},data(){let e=(0,i.clone)(this.data);for(let t in this.components)t in e||(e[t]=null);return{dialogData:e}},computed:{dialogComponent(){return this},schema(){return{type:`dialog`,components:this.components}},buttonSchemas(){return Object.fromEntries(Object.entries(Yt(this.buttons)).map(([e,t])=>(e===`cancel`&&!t.events&&(t={...t,events:{click:()=>this.cancel()}}),[e,t])))},focusTrapOptions(){return{immediate:!0,fallbackFocus:()=>this.$refs.dialog,escapeDeactivates:!1}},hasButtons(){return Object.keys(this.buttonSchemas).length>0},hasCancel(){return!!this.buttonSchemas.cancel}},created(){this.ownDataModel=(0,t.markRaw)(new wa({component:this,getSchema:()=>this.schema,getData:()=>this.dialogData}))},beforeUnmount(){this.ownDataModel.stop()},methods:{remove(){this.$emit(`remove`)},resolve(e){this.promise.resolve(e),this.remove()},reject(e){this.promise.reject(e),this.remove()},onEnter(e){e.target instanceof HTMLInputElement&&this.submit()},async submit(){await this.waitUntilDataModelSettled(),this.resolve(this.dialogData)},cancel(){this.resolve(void 0)},close(){this.cancel()},onMouseUp(){this.settings.clickToClose&&this.close()},onKeyDown(e){e.key===`Escape`&&!e.defaultPrevented&&(this.hasCancel||!this.hasButtons)&&(e.preventDefault(),this.cancel())}}}),[[`render`,Ra]]),Ba=class{#e=(0,t.shallowRef)(0);constructor(e=null){this.parent=e}get isLoading(){return this.#e.value>0}get root(){return this.parent?.root??this}begin(){this.#e.value++;let e=this.parent?.begin(),t=!1;return()=>{t||(t=!0,this.#e.value--,e?.())}}async track(e){let t=this.begin();try{return await e()}finally{t()}}},Va=class{#e;#t=null;constructor(e){this.#e=e}get isOn(){return!!this.#t}set(e){e?this.#t??=this.#e.begin():(this.#t?.(),this.#t=null)}},Ha=class{#e=new Set;#t=(0,t.shallowRef)(!1);#n=0;get isDraggingFiles(){return this.#t.value}get hasTargets(){return this.#e.size>0}add(e){return this.#e.add(e),()=>{this.#e.delete(e)}}isInTarget(e){for(let t of this.#e)if(t.contains(e))return!0;return!1}getDocumentEventHandlers(){return{dragenter:e=>this.#r(e),dragleave:e=>this.#i(e),dragover:e=>this.#a(e),drop:e=>this.#o(e)}}#r(e){Ua(e)&&(this.#n++,this.#n===1&&this.hasTargets&&(this.#t.value=!0))}#i(e){Ua(e)&&this.#n>0&&(this.#n--,this.#n===0&&(this.#t.value=!1))}#a(e){Ua(e)&&(this.isInTarget(e.target)?e.dataTransfer.dropEffect=`copy`:(e.preventDefault(),e.dataTransfer.dropEffect=`none`))}#o(e){Ua(e)&&(this.#n=0,this.#t.value=!1)}};function Ua(e){return!!e.dataTransfer?.types?.includes(`Files`)}var Wa=[`data-agent-browser`,`data-agent-platform`,`data-agent-version`],Ga={key:0,class:`dito-drag-overlay`};function Ka(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoDialog`),c=(0,t.resolveComponent)(`DitoNavigation`),l=(0,t.resolveComponent)(`DitoHeader`),u=(0,t.resolveComponent)(`DitoRouterView`),d=(0,t.resolveComponent)(`DitoAccount`),f=(0,t.resolveComponent)(`DitoSidebar`),p=(0,t.resolveComponent)(`DitoNotifications`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-root`,"data-agent-browser":e.appState.agent.browser,"data-agent-platform":e.appState.agent.platform,"data-agent-version":e.appState.agent.versionNumber},[(0,t.createVNode)(t.Transition,{name:`dito-drag`},{default:(0,t.withCtx)(()=>[e.fileDropTargets.isDraggingFiles?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ga)):(0,t.createCommentVNode)(``,!0)]),_:1}),(0,t.createVNode)(t.TransitionGroup,{name:`dito-dialog`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.dialogs,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(s,{key:r,components:n.components,buttons:n.buttons,promise:n.promise,data:n.data,settings:n.settings,onRemove:t=>e.removeDialog(r)},null,8,[`components`,`buttons`,`promise`,`data`,`settings`,`onRemove`]))),128))]),_:1}),(0,t.createVNode)(c),(0,t.createElementVNode)(`main`,{class:(0,t.normalizeClass)([`dito-page dito-scroll-parent`,e.appState.pageClass])},[(0,t.createVNode)(l,{spinner:e.options.spinner,isLoading:e.isLoading},null,8,[`spinner`,`isLoading`]),(0,t.createVNode)(u,{routeLevel:0})],2),(0,t.createVNode)(f,null,{default:(0,t.withCtx)(()=>[e.user?((0,t.openBlock)(),(0,t.createBlock)(d,{key:0})):e.hasSessionStarted?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,class:`dito-login`,type:`button`,onClick:n[0]||=t=>e.session.login()},[...n[1]||=[(0,t.createElementVNode)(`span`,null,`Login`,-1)]])):(0,t.createCommentVNode)(``,!0)]),_:1}),(0,t.createVNode)(p,{ref:`notifications`},null,512)],8,Wa)}var qa=W.component(`DitoRoot`,{mixins:[xa],components:{DitoDialog:za},inject:[`viewRegistry`],provide(){return{$loadingTracker:()=>this.loadingTracker,$fileDropTargets:()=>this.fileDropTargets}},props:{options:{type:Object,default:()=>({})}},data(){return{dialogs:{},loadingTracker:(0,t.markRaw)(new Ba),registeredLoadingEnds:(0,t.markRaw)([]),fileDropTargets:(0,t.markRaw)(new Ha),hasSessionStarted:!1,detachSessionUserInterface:null}},computed:{notifications(){return this.isMounted&&this.$refs.notifications},isLoading(){return this.loadingTracker.isLoading}},created(){this.appState.title=document.title||`Dito.js Admin`,this.appState.routeComponents=[],this.detachSessionUserInterface=this.session.attachUserInterface({requestLoginData:()=>this.showLoginDialog(),notify:e=>this.notify(e)})},unmounted(){this.detachSessionUserInterface()},async mounted(){this.domOn(document,this.fileDropTargets.getDocumentEventHandlers()),(0,a.delegate)(this.$el,{target:`.dito-info`,theme:`info`,animation:`shift-away-subtle`,interactive:!0,delay:250,zIndex:1,appendTo:e=>e.closest(`.dito-pane`),onShow:e=>e.setContent(e.reference.dataset.info)}),this.domOn(window,{beforeunload:e=>{this.hasUnsavedChanges()&&(e.preventDefault(),e.returnValue=``)}});try{await this.session.start()}catch(e){console.error(e)}this.hasSessionStarted=!0},methods:{registerLoading(e){(0,i.deprecate)("DitoRoot.registerLoading() is deprecated, use `loadingTracker.begin()` or `loadingTracker.track()` instead."),e?this.registeredLoadingEnds.push(this.loadingTracker.begin()):this.registeredLoadingEnds.pop()?.()},notify(e){this.notifications.notify(e)},closeNotifications(){this.notifications.destroyAll()},hasUnsavedChanges(){return this.appState.routeComponents.some(e=>e.hasUnsavedChanges)},async showDialog({components:e,buttons:t,data:n,settings:r}){let i=[];if(await B(this.api,{type:`dialog`,components:e},i,0),i.length>0)throw Error(`Dialogs do not support components that produce routes`);return new Promise((i,a)=>{let o=`dialog-${++Ja}`;this.dialogs[o]={components:e,buttons:t,data:n,settings:r,promise:{resolve:i,reject:a}}})},removeDialog(e){delete this.dialogs[e]},showLoginDialog(){let{additionalComponents:e}=this.options.login||{};return this.showDialog({components:{username:{type:`text`,autofocus:!0},password:{type:`password`},...e},buttons:{login:{type:`submit`,text:`Login`},cancel:{type:`button`,text:`Cancel`}}})}}}),Ja=0,Ya=G(qa,[[`render`,Ka]]),Xa={class:`dito-menu`},Za={class:`dito-menu__item`},Qa=[`href`,`aria-current`,`onClick`];function $a(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`RouterLink`),c=(0,t.resolveComponent)(`DitoMenu`,!0);return(0,t.openBlock)(),(0,t.createElementBlock)(`ul`,Xa,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,Za,[e.shouldShowItem(n)?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(s,{to:e.getItemRoute(n),custom:``},{default:(0,t.withCtx)(({href:r,navigate:i})=>[(0,t.createElementVNode)(`a`,{class:(0,t.normalizeClass)([`dito-menu__link`,{"dito-menu__link--active":e.isActiveItem(n)}]),href:r,"aria-current":e.isActiveItem(n)?`page`:null,onClick:i},(0,t.toDisplayString)(e.getLabel(n)),11,Qa)]),_:2},1032,[`to`]),n.items?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,class:`dito-menu__sub`,items:n.items,path:e.getItemPath(n)},null,8,[`items`,`path`])):(0,t.createCommentVNode)(``,!0)],64)):(0,t.createCommentVNode)(``,!0)]))),256))])}var eo=G(W.component(`DitoMenu`,{props:{items:{type:[Object,Array],default:()=>[]},path:{type:String,default:``}},methods:{shouldShowItem(e){return this.shouldRenderSchema(e)&&(!e.items||Object.values(e.items).some(this.shouldRenderSchema))},getItemPath(e){return`${this.path}/${e.path}`},getItemRoute(e){return{path:Ut(e,this.getItemPath(e)),force:!0}},isActiveItem(e){let t=this.getItemPath(e);return U(this.$route.path,t)||e.items&&Object.values(e.items).some(this.isActiveItem)}}}),[[`render`,$a]]),to={class:`dito-trail`,"aria-label":`Breadcrumb`},no=[`aria-current`,`href`,`onClick`];function ro(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`RouterLink`);return(0,t.openBlock)(),(0,t.createElementBlock)(`nav`,to,[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.trail,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,null,[(0,t.createVNode)(s,{to:e.getComponentRoute(n),custom:``},{default:(0,t.withCtx)(({href:r,navigate:i})=>[(0,t.createElementVNode)(`a`,{class:(0,t.normalizeClass)([`dito-trail__link`,{"dito-trail__link--active":e.isCurrentComponent(n)}]),"aria-current":e.isCurrentComponent(n)?`page`:null,href:r,onClick:i},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`dito-trail__text`,{"dito-trail__text--dirty":n.isDirty}])},(0,t.toDisplayString)(n.breadcrumb),3)],10,no)]),_:2},1032,[`to`])]))),256))]),(0,t.renderSlot)(e.$slots,`default`)])}var io=G(W.component(`DitoTrail`,{computed:{trail(){return this.appState.routeComponents.filter(e=>!e.isLeavingRoute)}},methods:{getComponentRoute(e){return{path:Ut(e.schema,e.path),force:!0}},isCurrentComponent(e){return e.path===this.$route.path}}}),[[`render`,ro]]),ao=[`aria-busy`];function oo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoSpinner`),c=(0,t.resolveComponent)(`DitoTrail`);return(0,t.openBlock)(),(0,t.createElementBlock)(`nav`,{class:`dito-header`,"aria-busy":e.isLoading},[(0,t.createVNode)(c,null,{default:(0,t.withCtx)(()=>[e.isLoading?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,size:e.spinner?.size,color:e.spinner?.color},null,8,[`size`,`color`])):(0,t.createCommentVNode)(``,!0)]),_:1}),n[0]||=(0,t.createElementVNode)(`div`,{class:`dito-header__teleport`},null,-1),(0,t.renderSlot)(e.$slots,`default`)],8,ao)}var so=G(W.component(`DitoHeader`,{props:{spinner:{type:Object,default:null},isLoading:{type:Boolean,default:!1}}}),[[`render`,oo]]),co={class:`dito-navigation dito-scroll-parent`,"aria-label":`Main navigation`};function lo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`RouterLink`),c=(0,t.resolveComponent)(`DitoMenu`);return(0,t.openBlock)(),(0,t.createElementBlock)(`nav`,co,[(0,t.createElementVNode)(`h1`,null,[(0,t.createVNode)(s,{class:`dito-link`,to:`/`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.appState.title),1)]),_:1})]),(0,t.createVNode)(c,{class:`dito-scroll`,items:e.views},null,8,[`items`])])}var uo=G(W.component(`DitoNavigation`,{}),[[`render`,lo]]),fo={class:`dito-notifications`,"aria-live":`polite`},po={class:`dito-notifications__inner`};function mo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`VueNotifications`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,fo,[n[0]||=(0,t.createElementVNode)(`div`,{class:`dito-header`},[(0,t.createElementVNode)(`span`)],-1),(0,t.createElementVNode)(`div`,po,[(0,t.createVNode)(s,{classes:`dito-notification`,dangerouslySetInnerHtml:!0,position:``,width:``})])])}function ho(e){return(0,i.isString)(e)&&/<[a-z][a-z0-9-]*(\s[^>]*)?\/?>/i.test(e)}var go=G(W.component(`DitoNotifications`,{methods:{notify({type:e=`info`,title:t,text:n,html:r,error:a,duration:o}={}){t||={warning:`Warning`,error:`Error`,info:`Information`,success:`Success`}[e]||`Notification`;let s=r!=null,c=(0,i.asArray)(s?r:n).filter(e=>e!=null&&e!==!1);!s&&c.some(ho)&&console.warn("notify(): `text` is escaped and seems to contain HTML markup. Use the `html` option for formatted text, and escape all values that it includes.");let l=`<p>${(s?c:c.map(e=>(0,i.escapeHtml)(e))).join(`</p> <p>`)}</p>`.replace(/\n|\r\n|\r/g,`<br>`),u={warning:`warn`,error:`error`,info:`log`,success:`log`}[e]||`error`;console[u](s?(0,i.stripHtml)(l):c.join(`
2
+ `),...e===`error`&&a?[a]:[]);let{notifications:d=!0}=this.api;if(d){let{durationFactor:n=20}=d;o??=(40+l.length+t.length)*n,this.$notify({type:e,title:(0,i.escapeHtml)(t),text:l,duration:o===0?-1:o})}},destroyAll(){this.$notify({clean:!0})}}}),[[`render`,mo]]),_o={class:`dito-sidebar dito-scroll-parent`},vo={class:`dito-header`};function yo(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`aside`,_o,[(0,t.createElementVNode)(`nav`,vo,[(0,t.renderSlot)(e.$slots,`default`)]),n[0]||=(0,t.createElementVNode)(`div`,{class:`dito-sidebar__teleport dito-scroll`},null,-1)])}var bo=G(W.component(`DitoSidebar`,{}),[[`render`,yo]]),xo={class:`dito-account`};function So(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoMenuButton`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,xo,[(0,t.createVNode)(s,{class:`dito-account__button`,items:e.items,placement:`bottom-left`,offset:``,onSelect:e.onSelectMenuItem},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.user.username),1)]),_:1},8,[`items`,`onSelect`])])}var Co=G(W.component(`DitoAccount`,{components:{DitoMenuButton:na},data(){return{items:[{value:`settings`,label:`Settings`},{value:`logout`,label:`Logout`}]}},methods:{onSelectMenuItem({value:e}){switch(e){case`logout`:this.session.logout();break;case`settings`:console.info(`TODO: Implement Settings`)}}}}),[[`render`,So]]);function wo(e,n,r,i,a,o){return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-spinner`,role:`status`,"aria-label":`Loading`,style:(0,t.normalizeStyle)({"--color":e.color,"--size":e.size,"--margin":e.margin})},[...n[0]||=[(0,t.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse1`},null,-1),(0,t.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse2`},null,-1),(0,t.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse3`},null,-1)]],4)),[[t.vShow,e.loading]])}var To=G(W.component(`DitoSpinner`,{props:{loading:{type:Boolean,default:!0},color:{type:String,default:null},size:{type:String,default:null},margin:{type:String,default:null}}}),[[`render`,wo]]);function Eo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoSpinner`),c=(0,t.resolveComponent)(`DitoIcon`);return e.item.type===`text`?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.item.as||`div`),{key:0},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.item.text),1)]),_:1})):e.item.type===`html`?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.item.as||`div`),{key:1,innerHTML:e.item.html},null,8,[`innerHTML`])):e.item.type===`spinner`?((0,t.openBlock)(),(0,t.createBlock)(s,{key:2,size:e.item.size,color:e.item.color},null,8,[`size`,`color`])):e.item.type===`icon`?((0,t.openBlock)(),(0,t.createBlock)(c,{key:3,name:e.item.name,disabled:e.item.disabled},null,8,[`name`,`disabled`])):e.item.type===`component`?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.item.component),(0,t.normalizeProps)((0,t.mergeProps)({key:4},e.item.props)),null,16)):(0,t.createCommentVNode)(``,!0)}var Do=G(W.component(`DitoAffix`,{components:{DitoSpinner:To,DitoIcon:Mi},props:{item:{type:Object,required:!0},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext}}}),[[`render`,Eo]]),Oo=[`disabled`],ko=[`data-info`];function Ao(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoAffix`);return e.hasContent?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-affixes`,e.classes])},[(0,t.renderSlot)(e.$slots,`prepend`),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.visibleItems,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(s,{class:(0,t.normalizeClass)([`dito-affix`,e.getItemClasses(n)]),key:r,style:(0,t.normalizeStyle)(n.style),item:n,parentContext:e.parentContext},null,8,[`class`,`style`,`item`,`parentContext`]))),128)),e.shouldShowClearButton?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,class:`dito-affixes__clear`,type:`button`,title:`Clear`,disabled:e.disabled,onClick:n[0]||=(0,t.withModifiers)(t=>e.$emit(`clear`),[`stop`]),onMousedown:n[1]||=(0,t.withModifiers)(()=>{},[`stop`])},null,40,Oo)):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(e.$slots,`append`),e.inlineInfo?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":e.inlineInfo},null,8,ko)):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)}var jo=G(W.component(`DitoAffixes`,{components:{DitoAffix:Do},emits:[`clear`],props:{items:{type:[String,Object,Array],default:null},mode:{type:String,default:null},position:{type:String,default:null},absolute:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},hasValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},inlineInfo:{type:String,default:null},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext},processedItems(){return(0,i.asArray)(this.items).filter(Boolean).map(e=>(0,i.isString)(e)?{type:`text`,text:e}:e.type?e:e.text==null?e.html==null?e:{type:`html`,...e}:{type:`text`,...e})},visibleItems(){return this.processedItems.filter(e=>P(e,this.context))},classes(){let e=`dito-affixes`;return{[`${e}--${this.position}`]:this.position,[`${e}--${this.mode}`]:this.mode,[`${e}--absolute`]:this.absolute}},shouldShowClearButton(){return this.clearable&&this.hasValue},hasContent(){return this.visibleItems.length>0||this.shouldShowClearButton||this.inlineInfo||Nr(this.$slots.prepend)||Nr(this.$slots.append)}},methods:{getItemClasses(e){let t=`dito-affix`;return[{[`${t}--${e.type}`]:e.type,[`${t}--ellipsis`]:this.mode===`ellipsis`&&[`text`,`html`].includes(e.type)},e.class]}}}),[[`render`,Ao]]),Mo={key:1,class:`dito-label__inner`},No=[`for`,`innerHTML`],Po=[`data-info`];function Fo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoAffixes`);return e.text||e.collapsible?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.collapsible?`button`:`div`),(0,t.mergeProps)({key:0,class:`dito-label`,type:e.collapsible?`button`:null},e.attributes),{default:(0,t.withCtx)(()=>[e.collapsible?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-chevron`,{"dito-chevron--open":!e.collapsed}])},null,2)):(0,t.createCommentVNode)(``,!0),e.text||e.prefixes.length>0||e.suffixes.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Mo,[(0,t.createVNode)(s,{items:e.prefixes,position:`prefix`,parentContext:e.context},null,8,[`items`,`parentContext`]),e.text?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:e.htmlFor,innerHTML:e.text},null,8,No)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(s,{items:e.suffixes,mode:`ellipsis`,position:`suffix`,parentContext:e.context},null,8,[`items`,`parentContext`]),e.info?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":e.info},null,8,Po)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]),_:1},16,[`type`])):(0,t.createCommentVNode)(``,!0)}var Io=G(W.component(`DitoLabel`,{components:{DitoAffixes:jo},emits:[`open`],props:{label:{type:[String,Object],default:null},htmlFor:{type:String,default:null},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},info:{type:String,default:null}},computed:{text(){let{label:e}=this;return(0,i.isObject)(e)?e?.text:e},prefixes(){return(0,i.asArray)(this.label?.prefix)},suffixes(){return(0,i.asArray)(this.label?.suffix)},attributes(){return this.collapsible?{onClick:this.onClick,"aria-expanded":!this.collapsed}:{}}},methods:{onClick(){this.$emit(`open`,this.collapsed)}}}),[[`render`,Fo]]),Lo={key:0,class:`dito-schema-header`};function Ro(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoPanels`),c=(0,t.resolveComponent)(`DitoLabel`),l=(0,t.resolveComponent)(`DitoTabs`),u=(0,t.resolveComponent)(`DitoClipboard`),d=(0,t.resolveComponent)(`DitoPane`),f=(0,t.resolveComponent)(`TransitionHeight`);return(0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.renderSlot)(e.$slots,`prepend`),(0,t.createElementVNode)(`div`,(0,t.mergeProps)({class:[`dito-schema`,{"dito-scroll-parent":e.scrollable,"dito-schema--open":e.opened}]},e.$attrs),[e.isPopulated&&e.panelEntries.length>0?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:0,to:`.dito-sidebar__teleport`},[e.active?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,panels:e.panelEntries,data:e.data,meta:e.meta,store:e.store,disabled:e.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),e.hasHeader?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:1,to:`.dito-header__teleport`,disabled:!e.isTopLevelSchema},[e.active?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Lo,[e.hasLabel?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:e.label,info:e.info,collapsible:e.collapsible,collapsed:!e.opened,onOpen:e.onOpen},null,8,[`label`,`info`,`collapsible`,`collapsed`,`onOpen`])):(0,t.createCommentVNode)(``,!0),e.tabs?((0,t.openBlock)(),(0,t.createBlock)(t.Transition,{key:1,name:`dito-fade`},{default:(0,t.withCtx)(()=>[e.opened?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,modelValue:e.selectedTab,tabs:e.renderedTabs,"onUpdate:modelValue":e.selectTab},null,8,[`modelValue`,`tabs`,`onUpdate:modelValue`])):(0,t.createCommentVNode)(``,!0)]),_:1})):(0,t.createCommentVNode)(``,!0),e.clipboard?((0,t.openBlock)(),(0,t.createBlock)(u,{key:2,clipboard:e.clipboard,schema:e.schema,hasData:e.hasData,getData:e.getDataForClipboard,onPaste:e.setData},null,8,[`clipboard`,`schema`,`hasData`,`getData`,`onPaste`])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(e.$slots,`edit-buttons`)])):(0,t.createCommentVNode)(``,!0)],8,[`disabled`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{enabled:e.inlined},{default:(0,t.withCtx)(()=>[e.opened?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-schema-content`,{"dito-scroll":e.scrollable}]),ref:`content`},[e.hasTabs?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(e.tabs,(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(d,{key:r,class:`dito-pane__tab`,ref_for:!0,ref:`tabs`,tab:r,schema:n,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,padding:e.padding,single:e.single&&!e.inlined&&!e.hasMainPane,disabled:e.disabled,compact:e.compact,generateLabels:e.generateLabels},null,8,[`tab`,`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`])),[[t.vShow,e.isTabSelected(r)]])),128)):(0,t.createCommentVNode)(``,!0),e.hasMainPane?((0,t.openBlock)(),(0,t.createBlock)(d,{key:1,class:`dito-pane__main`,ref:`components`,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,padding:e.padding,single:e.single&&!e.inlined&&!e.hasTabs,disabled:e.disabled,compact:e.compact,generateLabels:e.generateLabels},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`])):(0,t.createCommentVNode)(``,!0),!e.inlined&&e.isPopulated?(0,t.renderSlot)(e.$slots,`buttons`,{},void 0,void 0,2):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)]),_:3},8,[`enabled`]),e.inlined&&!e.hasHeader?(0,t.renderSlot)(e.$slots,`edit-buttons`,{},void 0,void 0,2):(0,t.createCommentVNode)(``,!0)],16),(0,t.renderSlot)(e.$slots,`append`)],64)}var zo=W.component(`DitoSchema`,{mixins:[L],components:{TransitionHeight:_a},inheritAttrs:!1,provide(){return{$schemaComponent:()=>this,...!this.inlined&&{$accumulatedBasis:()=>1}}},inject:[`$schemaParentComponent`],props:{schema:{type:Object,required:!0},dataSchema:{type:Object,default:e=>e.schema},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},label:{type:[String,Object],default:null},info:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},active:{type:Boolean,default:!0},inlined:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},hasOwnData:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1}},data(){let{data:e}=this.schema;return{...e&&(0,i.isFunction)(e)?e(new D(this,{nested:!1})):e,selectedTab:null,shouldFollowDefaultTab:!0,componentsRegistry:{},unnestedComponentsRegistry:{},panesRegistry:{},panelsRegistry:{},scrollPositions:{}}},computed:{nested(){return!1},schemaComponent(){return this},parentSchemaComponent(){return this.hasOwnData?null:this.parentComponent.schemaComponent},panelEntries(){return Zt(this.schema.panels,this.dataPath,this.componentPath,this.tabComponent?.panelTab??null)},tabs(){return M(this.schema.tabs)},renderedTabs(){return this.tabs&&this.data?Object.fromEntries(Object.entries(this.tabs).filter(([,e])=>this.shouldRenderSchema(e))):this.tabs},defaultTab(){let e=null;if(this.renderedTabs){let t=Object.values(this.renderedTabs);for(let{name:n,defaultTab:r}of t){if((0,i.isFunction)(r)?r(this.context):r)return n;e??=n}}return e},routeTab(){return this.$route.hash?.slice(1)||null},clipboard(){return this.schema?.clipboard??null},hasHeader(){return this.hasLabel||this.hasTabs||!!this.clipboard},processedData(){return this.processData({target:`server`,schemaOnly:!0})},formLabel(){return this.getLabel(j(this.sourceSchema,this.data,this.context))},isDirty(){return this.someComponent(e=>e.isDirty)},isTouched(){return this.someComponent(e=>e.isTouched)},isValid(){return this.everyComponent(e=>e.isValid)},isValidated(){return this.everyComponent(e=>e.isValidated)},hasErrors(){return this.someComponent(e=>e.hasErrors)},hasData(){return!!this.data},hasLabel(){return!!this.label||this.collapsible},hasTabs(){return!!this.tabs},isTopLevelSchema(){return!at(this.schema)&&!this.inlined},hasTopLevelTabs(){return this.hasTabs&&this.isTopLevelSchema},hasMainPane(){let{components:e}=this.schema;return!!e&&Object.keys(e).length>0},opened:Un(`opened`,{default(){return!this.collapsed}}),components(){return Object.values(this.componentsRegistry)},unnestedComponents(){return Object.values(this.unnestedComponentsRegistry)},panes(){return Object.values(this.panesRegistry)},panels(){return Object.values(this.panelsRegistry)},componentsByDataPath(){return this._listEntriesByDataPath(this.componentsRegistry)},panesByDataPath(){return this._listEntriesByDataPath(this.panesRegistry)},panelsByDataPath(){return this._listEntriesByDataPath(this.panelsRegistry)},wide:R(`wide`,{type:Boolean,default:!1})},watch:{schema:{immediate:!0,handler(e){Jt(e)||this.setupSchema()}},routeTab:{immediate:!0,flush:`post`,handler(e){this.hasTopLevelTabs&&e!==this.selectedTab&&this.selectTab(e)}},hasData(e){e&&this.shouldFollowDefaultTab&&this.selectDefaultTab()},selectedTab(e,t){if(this.scrollable){let{content:n}=this.$refs;this.scrollPositions[t]=n.scrollTop,this.$nextTick(()=>{n.scrollTop=this.scrollPositions[e]??0})}if(this.hasTopLevelTabs){let t=!e||e in this.renderedTabs?e:this.defaultTab;this.$router.replace({query:this.$route.query,hash:t?`#${t}`:null})}}},created(){this._register(!0),this.scrollable&&this.wide&&(this.appState.pageClass=`dito-page--wide`)},mounted(){this.routeTab?this.selectTab(this.routeTab):this.selectDefaultTab()},unmounted(){this.emitEvent(`destroy`),this._register(!1),this.scrollable&&this.wide&&(this.appState.pageClass=null)},methods:{setupSchema(){this.setupSchemaFields(),this.delegate(`change`,this.parentSchemaComponent),this.emitEvent(`initialize`)},getComponentsByDataPath(e){return this._getEntriesByDataPath(this.componentsByDataPath,e)},getComponentByDataPath(e){return this.getComponentsByDataPath(e)[0]||null},getComponentsByName(e){return this._getEntriesByName(this.componentsByDataPath,e)},getComponentByName(e){return this.getComponentsByName(e)[0]||null},getComponents(e){return this._getEntries(this.componentsByDataPath,e)},getComponent(e){return this.getComponents(e)[0]||null},getPanelsByDataPath(e){return this._getEntriesByDataPath(this.panelsByDataPath,e)},getPanelByDataPath(e){return this.getPanelsByDataPath(e)[0]||null},getPanels(e){return this._getEntries(this.panelsByDataPath,e)},getPanel(e){return this.getPanels(e)[0]||null},someComponent(e){return this.isPopulated&&this.components.some(e)},everyComponent(e){return this.isPopulated&&this.components.every(e)},selectTab(e){this.selectedTab=e,this.shouldFollowDefaultTab=!1},selectDefaultTab(){this.selectedTab=this.defaultTab,this.shouldFollowDefaultTab=!this.hasData},isTabSelected(e){return this.selectedTab===e},onOpen(e){this.emitEvent(`open`,{context:{open:e}}),this.opened=e},onChange(){this.emitEvent(`change`)},resetValidation(){for(let e of this.components)e.resetValidation()},clearErrors(){for(let e of this.components)e.clearErrors()},focus(){return this.opened=!0,this.parentSchemaComponent?.focus()},validateAll(e,t=!0){let n=this.hasData?zn(this.schema,this.data,{dataPath:this.dataPath,component:this,rootData:this.rootData}):null,r=e?Bn(n,e):n;return t&&(r?this._showValidationErrorsByFullDataPath(r,!0,!0).catch(console.error):this.clearErrors()),!r},verifyAll(e){return this.validateAll(e,!1)},async showValidationErrors(e,t,n=!0){let r=Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,i.normalizeDataPath)(this.hasOwnData?b(this.dataPath,e):e),t]));return this._showValidationErrorsByFullDataPath(r,t,n)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let{opened:r}=this;r||(this.opened=!0,await this.$nextTick());let a=[],o=e=>{let n=t?.(e)??!0;return n&&a.push(...e),n},s=async t=>{for(let r of t){let t=`${r.componentPath}/`;a.some(e=>e.componentPath.startsWith(t))||await r.navigateToComponent?.(e,o,{shouldRevealInlinedOnly:n||a.length>0})}},c=this.getComponentsByDataPath(e);c.length>0&&o(c);let l=(0,i.parseDataPath)(e),u=(0,i.parseDataPath)(this.dataPath).length;for(;l.length>u+1;)l.pop(),await s(this.getComponentsByDataPath(l));await s(this.unnestedComponents);let d=a.length>0;return d||(this.opened=r),d},async _showValidationErrorsByFullDataPath(e,t,n){this.clearErrors();let r=[],a=n;for(let[a,o]of Object.entries(e)){let s=null,c=[],l=await this.navigateToComponent(a,e=>{for(let t of e)t.isForm?s=t:c.push(t);return!0});if(Bo(c).forEach((e,r)=>{e.showValidationErrors(o,n&&t&&!s&&r===0)}),s){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e===s.dataPath||e.startsWith(`${s.dataPath}/`)));return s.showValidationErrors(r,n&&t)}if(!l){let e=(0,i.labelize)((0,i.parseDataPath)(a).pop());for(let t of o){let n=e?`The field ${e}`:`The ${this.formLabel}`;r.push(`${n} ${t.message}`)}}n=!1}return a&&!n&&this.notifyErrors(r.join(`
3
+ `)),!n},notifyErrors(e){this.notify({type:`error`,title:`Validation Errors`,text:e||`Please correct the highlighted errors.`})},resetData(){Object.assign(this.data,ln(this.dataSchema,{},this)),this.clearErrors()},setData(e){for(let t in e)if(t in this.data&&!(0,i.equals)(this.data[t],e[t])){this.data[t]=e[t];for(let e of this.getComponentsByName(t))e.markDirty()}return this.data},filterData(e){let t={},n={};for(let[r,a]of Object.entries(e))((0,i.isArray)(a)||(0,i.isObject)(a))&&this.getComponentsByName(r).some(e=>e.providesData)?n[r]=a:t[r]=a;return{localData:t,foreignData:n}},getDataForClipboard(){return this.processData({target:`clipboard`,schemaOnly:!0})},processData({target:e=`clipboard`,schemaOnly:t=!0}={}){return pn(this.dataSchema,this.sourceSchema,this.data,this.dataPath,{rootData:this.rootData,component:this,schemaOnly:t,target:e})},_register(e){this.$schemaParentComponent()?._registerSchemaComponent(this,e)},_registerComponent(e,t,n){this._registerEntry(this.componentsRegistry,e,t,n),this.parentSchemaComponent?._registerComponent(e,t,n)},_registerUnnestedComponent(e,t,n){this._registerEntry(this.unnestedComponentsRegistry,e,t,n)},_registerPane(e,t,n){this._registerEntry(this.panesRegistry,e,t,n)},_registerPanel(e,t,n){this._registerEntry(this.panelsRegistry,e,t,n)},_registerEntry(e,t,n,r){n?e[r]=t:e[r]===t&&delete e[r]},_listEntriesByDataPath(e){return Object.values(e).reduce((e,t)=>{let{dataPath:n}=t;return(e[n]||=[]).push(t),e},{})},_getEntries(e,t){return(0,i.normalizeDataPath)(t).startsWith(this.dataPath)?this._getEntriesByDataPath(e,t):this._getEntriesByName(e,t)},_getEntriesByDataPath(e,t){return Bo(e[(0,i.normalizeDataPath)(t)]||[])},_getEntriesByName(e,t){return Bo(e[b(this.dataPath,t)]||[])}}});function Bo(e){return e.length>1?[...e].sort(Vo):e}function Vo(e,t){let n=e.$el,r=t.$el;return!n||!r||n===r?0:n.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Ho=G(zo,[[`render`,Ro]]);function Uo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoEditButtons`),c=(0,t.resolveComponent)(`DitoSchema`);return(0,t.openBlock)(),(0,t.createBlock)(c,{class:`dito-schema-inlined`,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,label:e.isCompact?null:e.label,info:e.info,padding:e.padding??`inlined`,inlined:!0,disabled:e.disabled,compact:e.isCompact,collapsed:e.collapsed,collapsible:e.collapsible,generateLabels:!e.isCompact},{"edit-buttons":(0,t.withCtx)(()=>[e.deletable||e.draggable||e.editable||e.insertIndex!=null?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,schema:e.sourceSchema,formSchema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,disabled:e.disabled,deletable:e.deletable,draggable:e.draggable,editable:e.editable,editPath:e.editPath,creatable:e.insertIndex!=null,createPath:e.createPath,insertIndex:e.insertIndex,onDelete:n[0]||=t=>e.$emit(`delete`),onMove:n[1]||=t=>e.$emit(`move`,t)},null,8,[`schema`,`formSchema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`creatable`,`createPath`,`insertIndex`])):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`compact`,`collapsed`,`collapsible`,`generateLabels`])}var Wo=G(W.component(`DitoSchemaInlined`,{emits:[`delete`,`move`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},label:{type:[String,Object],default:null},info:{type:String,default:null},padding:{type:String,default:null},disabled:{type:Boolean,required:!0},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null}},computed:{isCompact(){return ut(this.schema)},hasLabel(){return!this.isCompact&&!!this.label}}}),[[`render`,Uo]]),Go=[`id`,`role`,`aria-labelledby`],Ko={key:0,class:`dito-pane__break`},qo={key:2,class:`dito-pane__break`};function Jo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoContainer`),c=(0,t.resolveDirective)(`resize`);return e.isPopulated&&e.componentSchemas.length>0?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-pane`,e.classes]),id:e.tabPanelId,role:e.tab?`tabpanel`:null,"aria-labelledby":e.tabId},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.componentSchemas,({schema:n,dataPath:r,nestedDataPath:i,nested:a,store:o},c)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[[`before`,`both`].includes(n.break)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ko)):(0,t.createCommentVNode)(``,!0),e.shouldRenderComponentByIndex[c]?((0,t.openBlock)(),(0,t.createBlock)(s,{ref_for:!0,ref:`containers`,key:i,"data-index":c,schema:n,dataPath:r,data:e.data,meta:e.meta,store:o,single:e.isSingleComponent,nested:a,disabled:e.disabled,compact:e.compact,generateLabels:e.generateLabels,verticalLabels:e.isInLabeledRow(c)},null,8,[`data-index`,`schema`,`dataPath`,`data`,`meta`,`store`,`single`,`nested`,`disabled`,`compact`,`generateLabels`,`verticalLabels`])):(0,t.createCommentVNode)(``,!0),[`after`,`both`].includes(n.break)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,qo)):(0,t.createCommentVNode)(``,!0)],64))),256))],10,Go)),[[c,e.onResizePane]]):(0,t.createCommentVNode)(``,!0)}var Yo=G(W.component(`DitoPane`,{mixins:[L],provide(){return{$tabComponent:()=>this.tabComponent}},props:{schema:{type:Object,required:!0},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},tab:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1}},data(){return{positions:[]}},computed:{nested(){return!1},classes(){let e=`dito-pane`;return{[`${e}--single`]:this.isSingleComponent,[`${e}--padding-${this.padding}`]:!!this.padding}},tabComponent(){return this.tab?this:this.$tabComponent()},panelTab(){let{tab:e,schemaComponent:t}=this;return e?{tabName:e,isTabSelected:()=>t.isTabSelected(e)}:null},componentPath(){let{componentPath:e}=this.parentComponent;return this.tab?b(e,this.tab):e},tabId(){let{componentPath:e}=this.schemaComponent;return this.tab?`${e}-tab-${this.tab}`:null},tabPanelId(){let{componentPath:e}=this.schemaComponent;return this.tab?`${e}-tabpanel-${this.tab}`:null},componentSchemas(){let e=this.sourceSchema?.wrapPrimitives;return Object.entries(this.schema?.components||{}).map(([t,n])=>{n={...n,name:t};let r=C(n),i=b(this.dataPath,t),a=r&&!e?i:this.dataPath;return{schema:n,dataPath:a,nestedDataPath:i,nested:r,store:this.getChildStore(t),hasLabel:ft(n,this.generateLabels)}})},isSingleComponent(){return this.single&&this.componentSchemas.length===1},shouldRenderComponentByIndex(){return this.componentSchemas.map(({schema:e,nested:t,dataPath:n})=>this.shouldRenderComponent(e,t,n))},renderedPositions(){return this.positions.map((e,t)=>this.shouldRenderComponentByIndex[t]?e:null)},verticalLabelsByIndices(){let e=this.renderedPositions,t=t=>e[t]&&(t===e.length-1||n(t).top>e[t].top),n=t=>{for(let n=t+1;n<e.length;n++)if(e[n])return e[n];return 0},r=[],i=[];for(let n=0;n<e.length;n++)i.push(n),t(n)&&(r.push(i),i=[]);i.length>0&&r.push(i);let a=[];for(let t of r){let n=!1;for(let r of t)if(e[r]?.height>2&&this.componentSchemas[r].hasLabel){n=!0;break}for(let e of t)a[e]=n}return a}},watch:{"componentSchemas.length"(e){this.positions.length=e}},created(){this._unregister=Wn(this,(e,t)=>this.schemaComponent._registerPane(this,e,t))},unmounted(){this._unregister()},methods:{shouldRenderComponent(e,t,n){return P(e,D.createForSchema(this,{schema:e,name:e.name,nested:t,data:this.data,dataPath:n,rootData:this.rootData}))},focus(){if(this.tab)return this.$router.push({hash:`#${this.tab}`})},onResizePane(){this.$nextTick(()=>{for(let e of this.$refs.containers??[]){let t=e.$el,n=+t.dataset.index,r=t.getBoundingClientRect(),i=getComputedStyle(t),a=parseFloat(i.padding),o=parseFloat(i.fontSize),s=r.height-2*a;this.positions[n]=s<=0?null:{top:r.y,height:s/o}}})},isInLabeledRow(e){return!!this.verticalLabelsByIndices[e]}}}),[[`render`,Jo]]);function Xo(e){let t=(0,i.isString)(e)&&e.match(/^\s*([+-]?\d+)\s*\/\s*([+-]?\d+)\s*$/);if(t){let[,e,n]=t;return parseFloat(e)/parseFloat(n)}return parseFloat(e)}function Zo(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoPanels`),c=(0,t.resolveComponent)(`DitoLabel`),l=(0,t.resolveComponent)(`DitoErrors`);return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-container`,e.containerClasses]),style:(0,t.normalizeStyle)(e.containerStyles)},[e.isMounted&&e.panelEntries.length>0?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:0,to:`.dito-sidebar__teleport`},[(0,t.createVNode)(s,{panels:e.panelEntries,data:e.data,meta:e.meta,store:e.store,disabled:e.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])])):(0,t.createCommentVNode)(``,!0),e.shouldRenderLabel?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,class:(0,t.normalizeClass)(e.labelClasses),htmlFor:e.labelHtmlFor,label:e.label,info:e.info},null,8,[`class`,`htmlFor`,`label`,`info`])):(0,t.createCommentVNode)(``,!0),e.hasLabel&&e.isLabel?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.typeComponent),{key:2,class:(0,t.normalizeClass)([`dito-component`,e.componentClasses]),ref:`component`,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,width:e.width,label:e.label,single:e.single,nested:e.nested,errorsElementId:e.errorsElementId,onErrors:e.onErrors,"onUpdate:component":n[0]||=t=>e.component=t},null,40,[`class`,`schema`,`dataPath`,`data`,`meta`,`store`,`width`,`label`,`single`,`nested`,`errorsElementId`,`onErrors`])),(0,t.createVNode)(l,{id:e.errorsElementId,errors:e.errors},null,8,[`id`,`errors`])],6)),[[t.vShow,e.componentVisible]])}var Qo=G(W.component(`DitoContainer`,{mixins:[yn,L],provide(){return{$accumulatedBasis:()=>this.combinedBasis}},inject:{$accumulatedBasis:{default:()=>()=>1}},props:{schema:{type:Object,required:!0},dataPath:{type:String,default:``},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},disabled:{type:Boolean,required:!0},compact:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},verticalLabels:{type:Boolean,default:!1}},data(){return{errors:null,component:null}},computed:{context(){return new D(this.component??this,{nested:this.nested})},name(){return this.schema.name},componentPath(){return b(this.parentComponent.componentPath,this.name)},type(){return this.schema.type},typeComponent(){return qe(this.type)},isLabel(){return this.type===`label`},hasLabel(){return ft(this.schema,this.generateLabels)},label(){return this.hasLabel?this.getLabel(this.schema):null},shouldRenderLabel(){return this.hasLabel&&!this.typeComponent?.rendersOwnLabel?.(this.context)},errorsElementId(){return`${this.componentPath}-errors`},labelHtmlFor(){return this.nested?this.componentPath:null},info:R(`info`,{type:String,default:null}),width:R(`width`,{type:[String,Number],default(){return this.typeComponent?.defaultWidth},get(e){return e===void 0?1:(0,i.isString)(e)?e.match(/^\s*[<>]?\s*(.*)$/)[1]:e}}),widthOperator:R(`width`,{type:String,get(e){return(0,i.isString)(e)&&e.match(/^\s*([<>]?)/)[1]||null}}),componentVisible:R(`visible`,{type:Boolean,default(){return this.typeComponent?.defaultVisible}}),componentDisabled:R(`disabled`,{type:Boolean,default:!1,get(e){return e||this.disabled}}),flexGrow(){return this.widthOperator===`>`||this.width===`fill`},flexShrink(){return this.widthOperator===`<`},flexBasis(){let e=this.width;return[null,`auto`,`fill`].includes(e)?`auto`:/%$/.test(e)?parseFloat(e)/100:/[a-z]/.test(e)?e:Xo(e)},combinedBasis(){let e=this.$accumulatedBasis(),{flexBasis:t}=this;return(0,i.isNumber)(e)&&(0,i.isNumber)(t)?e*t:null},containerClasses(){let{class:e}=this.schema,t=`dito-container`;return{[`${t}--disabled`]:this.componentDisabled,[`${t}--has-errors`]:!!this.errors,[`${t}--single`]:this.single,[`${t}--compact`]:this.compact,[`${t}--label-vertical`]:this.verticalLabels,[`${t}--omit-spacing`]:pt(this.schema),...(0,i.isString)(e)?{[e]:!0}:e}},containerStyles(){let{flexBasis:e,combinedBasis:t}=this;return{"--grow":+!!this.flexGrow,"--shrink":+!!this.flexShrink,"--basis":(0,i.isNumber)(e)?`${e*100}%`:e,"--basis-mobile":(0,i.isNumber)(t)&&t<=.25?`${e*200}%`:null}},componentClasses(){return{"dito-component--single":this.single,...this.getLayoutClasses(`dito-component`)}},labelClasses(){return{"dito-label--visible":this.isLabel,...this.getLayoutClasses(`dito-label`)}},panelEntries(){return Qt(this.api,this.schema,this.dataPath,this.nested?this.componentPath:this.parentComponent.componentPath,this.componentPath,this.$refs.component,this.tabComponent?.panelTab??null)}},methods:{getLayoutClasses(e){return{[`${e}--fill`]:this.width===`fill`||this.flexBasis!==`auto`,[`${e}--grow`]:this.flexGrow,[`${e}--shrink`]:this.flexShrink}},onErrors(e){this.errors=e}}}),[[`render`,Zo]]),$o={class:`dito-tabs`,role:`tablist`},es=[`id`,`aria-selected`,`aria-controls`,`tabindex`,`onClick`,`onKeydown`];function ts(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,$o,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.tabs,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`a`,{class:(0,t.normalizeClass)([`dito-tabs__link`,{"dito-tabs__link--active":e.modelValue===r}]),id:e.getTabId(r),key:r,role:`tab`,"aria-selected":e.modelValue===r,"aria-controls":e.getTabPanelId(r),tabindex:e.modelValue===r?0:-1,onClick:t=>e.$emit(`update:modelValue`,r),onKeydown:t=>e.onKeyDown(t,r)},(0,t.toDisplayString)(e.getLabel(n,r)),43,es))),128))])}var ns=G(W.component(`DitoTabs`,{emits:[`update:modelValue`],props:{tabs:{type:Object,default:null},modelValue:{type:String,default:null}},methods:{getTabId(e){return`${this.schemaComponent.componentPath}-tab-${e}`},getTabPanelId(e){return`${this.schemaComponent.componentPath}-tabpanel-${e}`},onKeyDown(e,t){let n=Object.keys(this.tabs),r=n.indexOf(t);if(e.key===`Enter`||e.key===` `){e.preventDefault(),this.$emit(`update:modelValue`,t);return}let i={ArrowLeft:(r-1+n.length)%n.length,ArrowRight:(r+1)%n.length,Home:0,End:n.length-1}[e.key];i!==void 0&&(e.preventDefault(),document.getElementById(this.getTabId(n[i]))?.focus())}}}),[[`render`,ts]]),rs={provide(){return{$schemaParentComponent:()=>this}},data(){return{schemaComponents:[]}},computed:{mainSchemaComponent(){return this.schemaComponents[0]}},methods:{_registerSchemaComponent(e,t){let{schemaComponents:n}=this;if(t)n.push(e);else{let t=n.indexOf(e);t>=0&&n.splice(t,1)}}}},is={mixins:[rs],computed:{errors(){return this.schemaComponents.flatMap(({errors:e})=>e||[])},isTouched(){return this.schemaComponents.some(e=>e.isTouched)},isDirty(){return this.schemaComponents.some(e=>e.isDirty)},isValid(){return this.schemaComponents.every(e=>e.isValid)},isValidated(){return this.schemaComponents.every(e=>e.isValidated)}},methods:{validateAll(e,t=!0){return this.schemaComponents.every(n=>n.validateAll(e,t))},verifyAll(e){return this.schemaComponents.every(t=>t.verifyAll(e))},resetValidation(){this.schemaComponents.forEach(e=>e.resetValidation())},clearErrors(){this.schemaComponents.forEach(e=>e.clearErrors())},async showValidationErrors(e,t,n=!0){for(let r of this.schemaComponents)await r.showValidationErrors(e,t,n)&&(n=!1);return!n}}};function as(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButtons`),c=(0,t.resolveComponent)(`DitoSchema`);return e.shouldRenderSchema(e.panelSchema)?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.panelTag),{key:0,class:`dito-panel`,role:`region`,"aria-label":e.getLabel(e.schema),onSubmit:n[0]||=(0,t.withModifiers)(()=>{},[`prevent`])},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{class:`dito-panel__schema`,schema:e.panelSchema,dataSchema:e.panelDataSchema,dataPath:e.panelDataPath,data:e.panelData,meta:e.meta,store:e.store,padding:`nested`,disabled:e.disabled,hasOwnData:e.hasOwnData,generateLabels:``},{prepend:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`h2`,{class:(0,t.normalizeClass)([`dito-panel__header`,{"dito-panel__header--sticky":e.sticky}])},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.getLabel(e.schema)),1),(0,t.createVNode)(s,{class:`dito-buttons--small`,buttons:e.panelButtonSchemas,buttonsName:`panelButtons`,dataPath:e.panelDataPath,data:e.panelData,meta:e.meta,store:e.store,disabled:e.disabled},null,8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])],2)]),buttons:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{buttons:e.buttonSchemas,dataPath:e.panelDataPath,data:e.panelData,meta:e.meta,store:e.store,disabled:e.disabled},null,8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataSchema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`hasOwnData`])]),_:1},40,[`aria-label`])),[[t.vShow,e.visible&&(!e.isTabSelected||e.isTabSelected())]]):(0,t.createCommentVNode)(``,!0)}var os=G(W.component(`DitoPanel`,{mixins:[L,is],provide(){return{$panelComponent:()=>this}},props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0},isTabSelected:{type:Function,default:null},panelComponentPath:{type:String,required:!0}},data(){return{ownData:null}},computed:{nested(){return!0},context(){return new D(this,{nested:!1,data:this.panelData,dataPath:this.panelDataPath})},panelComponent(){return this},componentPath(){return this.panelComponentPath},buttonSchemas(){return Yt(this.schema.buttons)},panelButtonSchemas(){return Yt(this.schema.panelButtons)},hasOwnData(){return!!this.ownData},panelData(){return this.ownData||this.data},panelSchema(){if(this.hasOwnData)return this.schema;{let{data:e,...t}=this.schema;return t}},panelTag(){return this.hasOwnData?`form`:`div`},panelDataSchema(){return this.hasOwnData?this.schema:this.schemaComponent.schema},panelDataPath(){return this.hasOwnData?this.dataPath:this.schemaComponent.dataPath},visible:R(`visible`,{type:Boolean,default:!0}),sticky:R(`sticky`,{type:Boolean,default:!1})},created(){this._unregister=Wn(this,(e,t)=>this.schemaComponent._registerPanel(this,e,t));let{data:e}=this.schema;e&&(this.ownData=(0,i.isFunction)(e)?e(this.context):e)},unmounted(){this._unregister()}}),[[`render`,as]]),ss={key:0,class:`dito-panels`};function cs(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoPanel`);return e.panels.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ss,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.panels,({schema:n,dataPath:r,componentPath:i,tabName:a,isTabSelected:o})=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.shouldRenderSchema(n)?((0,t.openBlock)(),(0,t.createBlock)(s,{key:e.getPanelKey(r,a),schema:n,dataPath:r,panelComponentPath:i,data:e.data,meta:e.meta,store:e.getChildStore(n.name),disabled:n.disabled??e.disabled,isTabSelected:o},null,8,[`schema`,`dataPath`,`panelComponentPath`,`data`,`meta`,`store`,`disabled`,`isTabSelected`])):(0,t.createCommentVNode)(``,!0)],64))),256))])):(0,t.createCommentVNode)(``,!0)}var ls=G(W.component(`DitoPanels`,{mixins:[L],props:{panels:{type:Array,default:null},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0}},computed:{nested(){return!1}},methods:{getPanelKey(e,t){return t?`${t}_${e}`:e}}}),[[`render`,cs]]),us={key:0,class:`dito-buttons`},ds={key:0,class:`dito-container dito-buttons__container`};function fs(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoContainer`),c=(0,t.resolveComponent)(`DitoVnode`);return e.buttonSchemas||e.hasSlotContent(e.$slots.default)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,us,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.buttonSchemas,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.shouldRenderSchema(n)?((0,t.openBlock)(),(0,t.createBlock)(s,{class:`dito-buttons__container`,key:r,schema:n,dataPath:r,data:e.data,meta:e.meta,nested:e.nested,store:e.getChildStore(n.name),disabled:e.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`nested`,`store`,`disabled`])):(0,t.createCommentVNode)(``,!0)],64))),256)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.$slots.default?.(),n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.hasVNodeContent(n)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ds,[(0,t.createVNode)(c,{vnode:n},null,8,[`vnode`])])):(0,t.createCommentVNode)(``,!0)],64))),256))])):(0,t.createCommentVNode)(``,!0)}var ps=G(W.component(`DitoButtons`,{mixins:[L],provide:{$tabComponent:()=>null},props:{buttons:{type:Object,default:null},dataPath:{type:String,default:``},data:{type:[Object,Array],default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},buttonsName:{type:String,default:`buttons`}},computed:{componentPath(){return b(this.continueParentComponentPath(),`$${this.buttonsName}`)},buttonSchemas(){let{dataPath:e,buttons:t}=this;return t?Object.values(t).reduce((t,n)=>(t[b(e,n.name)]=n,t),{}):null}},methods:{hasSlotContent:Nr,hasVNodeContent:Mr}}),[[`render`,fs]]);function ms(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`);return(0,t.openBlock)(),(0,t.createBlock)(s,{as:`a`,role:`button`,verb:e.verbs.drag,disabled:e.disabled,tabindex:e.disabled?-1:0,"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,onKeydown:[n[0]||=(0,t.withKeys)((0,t.withModifiers)(t=>e.move(-1),[`alt`,`prevent`]),[`up`]),n[1]||=(0,t.withKeys)((0,t.withModifiers)(t=>e.move(1),[`alt`,`prevent`]),[`down`])]},null,8,[`verb`,`disabled`,`tabindex`])}var hs=G(W.component(`DitoDragHandle`,{components:{DitoButton:K},emits:[`move`],props:{disabled:{type:Boolean,default:!1}},methods:{async move(e){this.disabled||(this.$emit(`move`,e),await this.$nextTick(),this.$el.focus())}}}),[[`render`,ms]]);function gs(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoDragHandle`),c=(0,t.resolveComponent)(`DitoButton`),l=(0,t.resolveComponent)(`DitoCreateButton`),u=(0,t.resolveComponent)(`DitoButtons`);return(0,t.openBlock)(),(0,t.createBlock)(u,{class:(0,t.normalizeClass)([`dito-edit-buttons`,{"dito-buttons--round":e.round}]),buttons:e.buttons,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,nested:e.nested,disabled:e.disabled,onClick:n[2]||=(0,t.withModifiers)(()=>{},[`stop`])},{default:(0,t.withCtx)(()=>[e.draggable?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,disabled:e.isDraggableDisabled,onMove:n[0]||=t=>e.$emit(`move`,t)},null,8,[`disabled`])):(0,t.createCommentVNode)(``,!0),e.editable?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,as:`RouterLink`,to:e.editRoute,verb:e.verbs.edit,disabled:e.isEditableDisabled},null,8,[`to`,`verb`,`disabled`])):(0,t.createCommentVNode)(``,!0),e.creatable?((0,t.openBlock)(),(0,t.createBlock)(l,{key:2,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,nested:e.nested,path:e.createPath,verb:e.verbs.create,text:e.insertIndex==null?e.createButtonText:null,disabled:e.isCreatableDisabled,insertIndex:e.insertIndex},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`path`,`verb`,`text`,`disabled`,`insertIndex`])):(0,t.createCommentVNode)(``,!0),e.deletable?((0,t.openBlock)(),(0,t.createBlock)(c,{key:3,verb:e.verbs.delete,disabled:e.isDeletableDisabled,onClick:n[1]||=t=>e.$emit(`delete`)},null,8,[`verb`,`disabled`])):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`class`,`buttons`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`])}var _s=G(W.component(`DitoEditButtons`,{mixins:[L],components:{DitoButton:K,DitoDragHandle:hs},emits:[`delete`,`move`],props:{buttons:{type:Object,default:null},schema:{type:Object,required:!0},formSchema:{type:Object,default:null},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!1},disabled:{type:Boolean,required:!0},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},editQuery:{type:Object,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null},round:{type:Boolean,default:!0}},computed:{formLabel(){return this.getLabel(this.schema.form)},editRoute(){let{editPath:e,editQuery:t}=this;return e?{path:e,query:t??void 0}:{}},isDraggableDisabled(){return this.disabled||!this.hasFormOption(`draggable`)},isDeletableDisabled(){return this.disabled||!this.hasFormOption(`deletable`)},isEditableDisabled(){return this.disabled||!this.editPath||!this.hasFormOption(`editable`)},isCreatableDisabled(){return this.disabled||!this.createPath||!this.hasFormOption(`creatable`)},createButtonText(){return this.schema.creatable?.label||this.formLabel&&`${(0,i.capitalize)(this.verbs.create)} ${this.formLabel}`||null}},methods:{hasFormOption(e){return!this.formSchema||this.getSchemaValue(e,{schema:this.formSchema,type:Boolean,default:!0})}}}),[[`render`,gs]]),vs={class:`dito-create-button`};function ys(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`),c=(0,t.resolveComponent)(`DitoMenuButton`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,vs,[e.creatableForm?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,type:e.isInlined?`button`:`submit`,verb:e.verb,subject:e.formLabel,text:e.text,disabled:e.disabled,onClick:n[0]||=t=>e.createItem(e.creatableForm)},null,8,[`type`,`verb`,`subject`,`text`,`disabled`])):e.hasCreatableForms?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,items:e.menuItems,placement:`bottom-right`,disabled:e.disabled,verb:e.verb,text:e.text,onSelect:e.onSelectMenuItem},null,8,[`items`,`disabled`,`verb`,`text`,`onSelect`])):(0,t.createCommentVNode)(``,!0)])}var bs=G(W.component(`DitoCreateButton`,{mixins:[L],components:{DitoButton:K,DitoMenuButton:na},props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!1},path:{type:String,required:!0},verb:{type:String,required:!0},text:{type:String,default:null},disabled:{type:Boolean,required:!0},insertIndex:{type:Number,default:null}},computed:{creatableForms(){return $t(this.schema,this.context)},hasCreatableForms(){return Object.keys(this.creatableForms).length>0},creatableForm(){let e=this.creatableForms;return Object.keys(e).length===1&&e.default||null},menuItems(){return Object.entries(this.creatableForms).filter(([,e])=>this.shouldShowSchema(e)).map(([e,t])=>({value:e,label:this.getLabel(t),disabled:this.shouldDisableSchema(t)}))},formLabel(){let e=this.creatableForm;return e?this.getSchemaValue(`label`,{schema:e,type:String}):null},isInlined(){return dt(this.schema)}},methods:{createItem(e,t=null){if(this.shouldDisableSchema(e))throw Error(`Not allowed to create item for given form`);if(this.isInlined)this.sourceComponent.createItem(e,t,this.insertIndex);else{let{creatable:e}=this.schema,n={...t&&{type:t},...e?.query?.(this.context)};this.$router.push({path:`${this.path}/create`,query:n})}},onSelectMenuItem({value:e}){this.createItem(this.creatableForms[e],e)}}}),[[`render`,ys]]),xs=(0,t.reactive)({data:null}),Ss=0;function Cs(e){if(!xs.data)return null;let{$schema:t,...n}=xs.data;return t===e?n:null}function ws(e){return!!Cs(e)}async function Ts(e,t){let n=t?{$schema:e,...t}:null;Ss++,xs.data=n;try{let e=JSON.stringify(n,null,2);await navigator.clipboard?.writeText?.(e)}catch(e){console.error(e,e.name,e.message)}}async function Es(){let e=++Ss,t=await navigator.clipboard?.readText?.();t&&e===Ss&&(xs.data=JSON.parse(t))}var Ds={key:0,class:`dito-clipboard dito-buttons dito-buttons--round`};function Os(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`);return e.clipboard?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ds,[(0,t.createVNode)(s,{class:`dito-button--copy`,title:`Copy Data`,disabled:!e.hasData,onClick:e.onCopy},null,8,[`disabled`,`onClick`]),(0,t.createVNode)(s,{class:`dito-button--paste`,title:`Paste Data`,disabled:!e.isPasteEnabled,onClick:e.onPaste},null,8,[`disabled`,`onClick`])])):(0,t.createCommentVNode)(``,!0)}var ks=G(W.component(`DitoClipboard`,{mixins:[xa],components:{DitoButton:K},emits:[`paste`],props:{clipboard:{type:[Boolean,Object],required:!0},schema:{type:Object,required:!0},hasData:{type:Boolean,required:!0},getData:{type:Function,required:!0}},computed:{clipboardOptions(){return(0,i.isObject)(this.clipboard)?this.clipboard:{}},copyData(){let{copy:e}=this.clipboardOptions;return e?t=>e.call(this,new D(this,{clipboardData:t})):e=>(0,i.clone)(e)},pasteData(){let{paste:e}=this.clipboardOptions;return e?t=>e.call(this,new D(this,{clipboardData:t})):e=>e},isPasteEnabled(){return ws(this.schema.name)}},mounted(){this.updateClipboardData(),this.domOn(document,{copy:this.updateClipboardData}),this.domOn(window,{focus:this.updateClipboardData})},methods:{updateClipboardData(){this.appState.agent.chrome&&Es().catch(()=>{})},async onCopy(){try{let e=this.getData();await Ts(this.schema.name,e&&this.copyData(e))}catch(e){this.notifyClipboardError(e)}},async onPaste(){try{await Es()}catch(e){if(e.name===`SyntaxError`){this.notifyClipboardError(e,[`The data in the clipboard appears to be malformed:`,e.message]);return}console.error(e,e.name,e.message)}try{let e=Cs(this.schema.name),t=e&&this.pasteData(e);t&&this.$emit(`paste`,t)}catch(e){this.notifyClipboardError(e)}},notifyClipboardError(e,t=e.message){this.notify({type:`error`,error:e,title:`Clipboard Error`,text:t})}}}),[[`render`,Os]]);function As({routeLevel:e}){return(0,t.h)(n.RouterView,null,{default:({Component:n,route:r})=>n?(0,t.h)(n,{key:r.matched[e]?.path}):null})}As.props={routeLevel:{type:Number,required:!0}};var js=W.component(`DitoRouterView`,As),Ms=[`innerHTML`];function Ns(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`p`,{class:`dito-confirm-message`,innerHTML:e.value},null,8,Ms)}var Ps=G({},[[`render`,Ns]]),Fs=`<b>Note</b>: the parent still needs to be saved in order to persist this change.`;async function Is(e,{message:t,verb:n}){return await e.showDialog({components:{message:{type:`component`,component:Ps,label:!1}},buttons:{cancel:{},confirm:{type:`submit`,text:(0,i.labelize)(n)}},data:{message:t},settings:{label:_t(t)}})!==void 0}async function Ls(e,{label:t,isTransient:n,remove:r}){let{verbs:i}=e,[a,o]=n?[i.remove,i.removed]:[i.delete,i.deleted];await Is(e,{message:`Do you really want to ${a} ${t}?`,verb:a})&&await r()!==!1&&e.notify({type:n?`info`:`success`,title:`Successfully Removed`,html:[`${t} was ${o}.`,n&&`<b>Note</b>: the parent still needs to be saved in order to persist this change.`]})}var Rs={mixins:[is],provide(){return{$routeComponent:()=>this}},data(){return{routeRecord:null,hasPreventedLeavingInvalidData:!1,discardConfirmation:null,store:{},loadCache:{}}},computed:{routeComponent(){return this},routeLevel(){let e=0,t=this;for(;t=t.parentRouteComponent;)e++;return e},matchedRouteRecord(){return this.$route.matched[this.routeLevel]},isLeavingRoute(){return this.matchedRouteRecord?.path!==this.routeRecord?.path},isLastRoute(){let{matched:e}=this.$route;return this.routeRecord===e[e.length-1]},isLastUnnestedRoute(){let{matched:e}=this.$route;for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n.meta.nested)return this.routeRecord===n}return!1},isNestedRoute(){return this.meta.nested},isForm(){return!1},isView(){return!1},meta(){return this.routeRecord?.meta},path(){return this.getRoutePath(this.routeRecord?.path)},label(){return this.getLabel(this.schema)},breadcrumb(){let{breadcrumb:e}=this.schema||{};return e||`${this.breadcrumbPrefix} ${this.label}`},breadcrumbPrefix(){return``},param(){return this.$route.params[this.meta?.param]||null},isMutating(){return!1},hasUnsavedChanges(){return this.isDirty}},watch:{matchedRouteRecord:{immediate:!0,flush:`sync`,handler(e){e&&(!this.routeRecord||e.path===this.routeRecord.path)&&(this.routeRecord=(0,t.markRaw)(e))}}},beforeRouteUpdate(e,t){return!this||this.beforeRouteChange(e,t)},beforeRouteLeave(e,t){return!this||this.beforeRouteChange(e,t)},created(){this.appState.routeComponents[this.routeLevel]=this},unmounted(){let{routeComponents:e}=this.appState;e[this.routeLevel]===this&&(e.length=this.routeLevel)},methods:{async beforeRouteChange(e,t){let n=!0;return U(t.path,this.path)&&!U(e.path,this.path)&&(this.isMutating?(n=this.hasPreventedLeavingInvalidData||this.validateAll(),this.hasPreventedLeavingInvalidData=!n):this.hasUnsavedChanges&&(this.discardConfirmation??=Is(this,{message:`You have unsaved changes. Do you really want to ${this.verbs.cancel}?`,verb:`discard`}).finally(()=>{this.discardConfirmation=null}),n=await this.discardConfirmation)),n},getRoutePath(e){let{path:t}=this.$route;return e?t.split(`/`).slice(0,e.split(`/`).length).join(`/`):t},getChildPath(e){return`${this.path}/${e}`}}},zs=[`data-resource`];function Bs(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoRouterView`),c=(0,t.resolveComponent)(`DitoSchema`);return e.user&&e.shouldRenderSchema(e.viewSchema)?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[e.isLastRoute?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`dito-view dito-scroll-parent`,"data-resource":e.sourceSchema.path},[((0,t.openBlock)(),(0,t.createBlock)(c,{key:e.name,schema:e.viewSchema,data:e.data,meta:e.meta,store:e.getChildStore(e.name),padding:`root`,disabled:e.isLoading,scrollable:``,single:``},null,8,[`schema`,`data`,`meta`,`store`,`disabled`]))],8,zs)):((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,routeLevel:e.routeLevel+1},null,8,[`routeLevel`]))],64)):(0,t.createCommentVNode)(``,!0)}var Vs=G(W.component(`DitoView`,{mixins:[Rs],provide(){return{$sourceComponent:()=>this.mainComponent?.sourceComponent||null,$resourceComponent:()=>this.mainComponent?.resourceComponent||null,$loadingTracker:()=>this.loadingTracker}},data(){let e=new Ba(this.$loadingTracker());return{loadingTracker:(0,t.markRaw)(e),setLoadingSwitch:(0,t.markRaw)(new Va(e)),data:{}}},computed:{schema(){return this.meta.schema??{}},name(){return this.schema.name},isView(){return!0},isLoading(){return this.loadingTracker.isLoading},isSingleComponentView(){return lt(this.schema)},mainComponent(){return this.mainSchemaComponent?.getComponentByDataPath(this.name)},viewSchema(){let{component:e,...t}=this.schema;return this.isSingleComponentView?{...t,components:{[t.name]:{name:t.name,label:!1,...e}}}:t},providesData(){return $e(this.viewSchema,cr)}},created(){this.ownDataModel=(0,t.markRaw)(new wa({component:this,getSchema:()=>this.viewSchema,getData:()=>this.data}))},mounted(){this.shouldRenderSchema(this.viewSchema)||this.$router.replace({path:`/`})},beforeUnmount(){this.ownDataModel.stop(),this.setLoadingSwitch.set(!1)},methods:{setLoading(e){(0,i.deprecate)("DitoView.setLoading() is deprecated, use `loadingTracker.begin()` or `loadingTracker.track()` instead."),this.setLoadingSwitch.set(e)},setData(e){return this.data=e,this.data},getChildPath(e){return this.isSingleComponentView?this.path:`${this.path}/${e}`}}}),[[`render`,Bs]]);function Hs(e,t,{index:n=null,isTransient:r}){return r&&n!==null?String(n):hn(e,t)}function Us(e,t,n,{isTransient:r}){let i=r?n:t?.findIndex(t=>hn(e,t)===n);return i!=null&&i!==-1?i:null}function Ws(e,t,{index:n=null,extended:r=!1,asObject:a=!1,evaluateItemLabel:o,getFormLabel:s}){let{itemLabel:c}=e;if(!t||!r&&c===!1)return null;let l,u,d;if((0,i.isFunction)(c)){let e=o();(0,i.isObject)(e)?{text:l,prefix:u,suffix:d}=e:l=e,r=!1}else if((0,i.isString)(c)&&!(c in t))l=c;else{let{columns:n}=e,r=t[(0,i.isString)(c)&&c||T(e)&&n&&Object.keys(n)[0]||`name`];l=(0,i.isString)(r)?(0,i.escapeHtml)(r):(0,i.isNumber)(r)?r:null}let f=!!l;if(l??=(r=!0,T(e)&&n!==null?`${n+1}`:``),r){let e=s();e&&(l=`${e} ${f?`'${l}'`:l}`)}return a?l||u||d?{text:l,prefix:u,suffix:d}:null:l}var Gs={methods:{getItemFormSchema:j,getItemUid:vn,getItemId(e,t,n=null){return Hs(e,t,{index:n,isTransient:this.isTransient})},getItemDataPath(e,t){let{dataPath:n}=this;return e!==this.schema&&(n=b(n,e.name)),t!=null&&(n=b(n,t)),n},findItemIdIndex(e,t,n){return Us(e,t,n,{isTransient:this.isTransient})},getItemLabel(e,t,{index:n=null,extended:r=!1,asObject:i=!1}={}){let a,o=()=>a??=this.getItemDataPath(e,n),s,c=()=>s??=this.getLabel(j(e,t,this.context));return Ws(e,t,{index:n,extended:r,asObject:i,getFormLabel:c,evaluateItemLabel:()=>e.itemLabel.call(this,new D(this,{nested:!1,data:t,value:t,index:n,get dataPath(){return o()},get formLabel(){return c()}}))})}}},Ks={mixins:[Gs],provide(){return{$resourceComponent:()=>this,$verbs:()=>this.verbs,$isPopulated:()=>this.hasData}},data(){let e=new Ba(this.$loadingTracker());return{loadedData:null,loadAbortController:null,loadingTracker:(0,t.markRaw)(e),setLoadingSwitch:(0,t.markRaw)(new Va(e))}},computed:{isInsideForm(){return!this.isForm&&!!this.formComponent},resourceComponent(){return this},isLoading(){return this.loadingTracker.isLoading},resource(){return this.getResource()},providesData(){return!!this.resource},linksToView(){return!1},isTransient(){let e=this.formComponent;return!this.providesData&&!this.linksToView||e&&(e.isTransient||e.isCreating)},shouldLoad(){return!this.isTransient&&!this.isLoading},hasData(){return!!this.loadedData},verbs(){return this.getVerbs()},paginationRange(){let{paginate:e}=this.sourceSchema;if(this.isListSource&&e){let{page:t=0}=this.query||{},n=t*e;return[n,n+e-1]}return null},queryParams(){let e=this.paginationRange,{page:t,...n}=this.query||{};return{...n,...e&&{range:e.join(`,`)}}}},created(){(this.providesData||this.isCreating)&&this.setupData()},unmounted(){this.loadAbortController?.abort(),this.setLoadingSwitch.set(!1)},methods:{setLoading(e){(0,i.deprecate)("setLoading() is deprecated, use `loadingTracker.begin()` or `loadingTracker.track()` instead."),this.setLoadingSwitch.set(e)},getResource({method:e=`get`,child:t}={}){let n=this.sourceSchema?.resource;return H(n,{type:`collection`,method:e,parent:this.parentResourceComponent?.getResource({method:e,child:n})??null,child:t})},getVerbs(){let e=this.$verbs();return this.isTransient?{...e,create:`add`,created:`added`,save:`apply`,saved:`applied`,delete:`remove`,deleted:`removed`}:e},clearData(){this.loadedData=null},setData(e){return this.loadedData=e,this.loadedData},setupData(){this.ensureData()},ensureData(){this.shouldLoad&&(this.hasData?this.reloadData():this.loadData(!0))},reloadData(){this.loadData(!1)},loadData(e){this.isTransient||(e&&this.clearData(),this.requestData())},createData(e,t){return ln(e,t?{type:t}:{},this)},requestData(){let e=this.queryParams;return this.handleRequest({method:`get`,query:e,isDataLoad:!0},async(e,t)=>{if(e){if(t){let{data:e}=t;if(e?.type===`FilterValidation`&&this.onFilterErrors?.(e.errors))return!0;if(this.isUnauthorizedError(t)&&this.isInsideForm)return this.addUnauthorizedError(),!0}}else this.isForm&&this.isDirty||this.setData(t.data),await this.emitSchemaEvent(`load`)}).catch(e=>{let t=e instanceof AggregateError?e.errors:[e];for(let e of t)this.notifyRequestError(e)})},isValidationError(e){return e?.status===400},isUnauthorizedError(e){return e?.status===401},addUnauthorizedError(){let e=`You don't have permission to load this data.`;this.errors?.includes(e)||this.addError(e)},async handleRequest({method:e,resource:t=this.getResource({method:e}),query:n,data:r,isDataLoad:i=!1},a){let o=new AbortController;i&&(this.loadAbortController?.abort(),this.loadAbortController=o);let s=this.loadingTracker.begin();e=t.method||e;let c=null,l=null;try{c=await this.sendRequest({method:e,resource:t,query:n,data:r,signal:o.signal})}catch(e){l=e}finally{this.loadAbortController===o&&(this.loadAbortController=null),s()}if(!(o.signal.aborted||l?.name===`AbortError`)){if(l){let{response:e}=l;await a(l,e)||this.notifyRequestError(l)}else await a(null,c)}},notifyRequestError(e){let t=e?.response?.data,n=(0,i.isString)(t?.type)?(0,i.labelize)(t.type):`Error`,r=t?.message??e;this.notify({type:`error`,error:e,title:n,text:r})},getPayloadData(e,t){return[`post`,`put`,`patch`].includes(t)&&(e.getSchemaValue([`resource`,`data`])||e.processedItem)},async submit(e){let{resource:t}=e.schema;if(t=H(t,{parent:this.getResource({method:t?.method,child:t})}),t){let{method:n}=t,r=this.getPayloadData(e,n);return this.submitResource(e,t,n,r)}return!1},async submitResource(e,t,n,r,{setData:a=!1,onSuccess:o,onError:s,notifySuccess:c=()=>this.notify({type:`success`,title:`Request Successful`,text:`Request was successfully sent.`}),notifyError:l=e=>this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to send request${e?`:`:``}`,e?.message||e]})}={}){let u=!1;return await this.handleRequest({method:n,resource:t,data:r},async(t,n)=>{let r=n?.data;if(t){let a=this.isValidationError(n)&&r.errors;if(a)await this.showValidationErrors(a,!0);else{let n=(0,i.isObject)(r)?r:t;s?.(n),await this.emitButtonEvent(e,`error`,{notify:l,error:n})}return!0}if(a&&r){let{foreignData:e}=this.mainSchemaComponent.filterData(this.data),t=(0,i.assignDeeply)({},e,r);O(this.data,t),this.setData(t)}o?.(),await this.emitButtonEvent(e,`success`,{notify:c}),u=!0}),u},async emitButtonEvent(e,t,{notify:n,error:r}){let i=new D(e,{nested:!1,data:this.data,itemLabel:this.itemLabel,error:r}),a=await e.emitEvent(t,{context:i});return n&&a===void 0&&!i.wasNotified&&n(r),a}}};function qs(e){return new URL(`file:${e}`).pathname}var Js=[`data-resource`],Ys={type:`submit`,disabled:``};function Xs(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoRouterView`),c=(0,t.resolveComponent)(`DitoButtons`),l=(0,t.resolveComponent)(`DitoSchema`),u=(0,t.resolveComponent)(`DitoFormInner`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-form dito-scroll-parent`,{"dito-form-nested":e.isNestedRoute}]),"data-resource":e.sourceSchema.path},[!e.isLastUnnestedRoute&&!e.isNestedRoute?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,routeLevel:e.routeLevel+1},null,8,[`routeLevel`])),[[t.vShow,!e.isActiveRoute]]):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createVNode)(u,{nested:e.isNestedRoute,label:e.itemLabelText},{default:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`button`,Ys,null,512),[[t.vShow,!1]]),(0,t.createVNode)(l,{schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,padding:e.isNestedRoute?`nested`:`root`,active:e.isActiveRoute,disabled:e.isLoading,scrollable:!e.isNestedRoute,generateLabels:``},{buttons:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{class:(0,t.normalizeClass)([`dito-buttons--round dito-buttons--large dito-buttons--main`,{"dito-buttons--sticky":!e.isNestedRoute}]),buttons:e.buttonSchemas,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,disabled:e.isLoading},null,8,[`class`,`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`active`,`disabled`,`scrollable`])]),_:1},8,[`nested`,`label`]),[[t.vShow,e.isActiveRoute]])],10,Js)}var Zs=G(W.component(`DitoForm`,{mixins:[Rs,Ks],data(){return{createdData:null,clonedData:void 0}},computed:{isForm(){return!0},verbs(){let e=this.getVerbs(),{isCreating:t,providesData:n}=this;return{...e,submit:t?e.create:e.save,submitted:t?e.created:e.saved,cancel:n?e.cancel:e.close,cancelled:n?e.cancelled:e.closed}},schema(){return this.getItemFormSchema(this.sourceSchema,this.data||(this.creationType?{type:this.creationType}:null),this.context)},buttonSchemas(){return Yt((0,i.assignDeeply)({cancel:{type:`button`,events:{click:()=>this.cancel()}},submit:!this.isMutating&&{type:`submit`,closeForm:!0,events:{click:({component:e})=>e.submit()}}},this.schema.buttons))},isActiveRoute(){return this.isLastRoute||this.isLastUnnestedRoute},isTransient(){return!this.providesData},isCreating(){return this.param===`create`},isDirty(){return!this.isMutating&&this.dataModel.isDirty},isMutating(){return!!this.sourceSchema.mutate},selectedTab(){return this.mainSchemaComponent?.selectedTab||null},creationType(){return this.$route.query.type},itemId(){return this.isCreating?null:this.param??null},method(){return this.isCreating?`post`:`patch`},breadcrumbPrefix(){return(0,i.capitalize)(this.isCreating?this.verbs.create:this.verbs.edit)},data(){return this.createdData||this.loadedData||this.inheritedData||null},dataPath(){return this.getDataPathFrom(this.dataComponent)},componentPath(){let{parentRouteComponent:e}=this;return this.isTransient&&e?mn(e.isView?e.viewSchema:e.schema,e.data,this.getDataPathFrom(e),{componentPath:e.componentPath,component:this,rootData:this.rootData}):``},sourceLocation(){let e=this.isLeavingRoute?null:this.parentRouteComponent.data;if(!e)return null;let t=(0,i.parseDataPath)(this.getDataPathFrom(this.parentRouteComponent)),n=this.routeRecord.path.split(`/`),r=n.slice(n.length-t.length),a=t[t.length-1];w(this.sourceSchema)&&a===`create`&&t.length--;let o=null;for(let n=0,i=t.length;n<i&&e;n++){let a=t[n];o=/^:id/.test(r[n])?a===`create`?null:this.findItemIdIndex(this.sourceSchema,e,a):a,n<i-1&&(e=e[o])}return e?{data:e,key:o}:null},sourceData(){return this.sourceLocation?.data??null},sourceKey(){return this.sourceLocation?.key??null},sourceItem(){return this.sourceData&&this.sourceKey!==null?this.sourceData[this.sourceKey]:void 0},inheritedData(){return this.isTransient?this.isMutating?this.sourceItem:this.clonedData:void 0},hasData(){return!!this.data},itemLabel(){return this.getItemLabel(this.sourceSchema,this.data,{extended:!0})},itemLabelText(){return _t(this.itemLabel)}},watch:{$route:{flush:`post`,handler(e,t){let n=this.meta?.param;n&&this.providesData&&t.params[n]!==`create`&&e.params[n]!==t.params[n]&&this.loadData(!0)}},sourceItem:{immediate:!0,handler(e){if(this.isTransient){if(!this.isMutating){let t=(0,i.clone)(e);O(e,t),this.clonedData=t}e===null&&!this.isCreating&&w(this.sourceSchema)&&this.$router.push({path:`${this.path}/create`})}}},isCreating(e){e&&this.setupData()}},created(){this.ownDataModel=(0,t.markRaw)(new wa({component:this,getSchema:()=>this.schema,getData:()=>this.data,getSourceSchema:()=>this.sourceSchema}))},beforeUnmount(){this.ownDataModel.stop()},methods:{emitSchemaEvent(e,t){return this.mainSchemaComponent?.emitEvent(e,t)},getDataPathFrom(e){return this.api.denormalizePath(this.path.slice((e.isView?0:e.path.length)+1))},getResource(e){let t=Ks.methods.getResource.call(this,e);return lr(this.itemId,t)||t},setupData(){this.isCreating?this.createdData||=this.createData(this.schema,this.creationType):this.ensureData()},getParentSourceComponent(){return this.parentRouteComponent?.mainSchemaComponent?.components.find(e=>e.sourceComponent===e&&e.providesData&&U(this.path,e.path))??null},setSourceData(e){if(this.sourceData&&this.sourceKey!==null){let{mainSchemaComponent:t}=this,{localData:n}=t.filterData(e);return O(this.data,n),this.sourceData[this.sourceKey]=n,t.onChange(),!0}return!1},addSourceData(e){return w(this.sourceSchema)?this.setSourceData(e):!!this.sourceData?.push(e)},clearData(){this.setData(null)},setData(e){return this.isTransient?(this.setSourceData(e),this.sourceItem):(this.createdData=null,this.loadedData=e,this.data)},applyCleanChanges(e){return this.dataModel.applyCleanChanges(e)},async cancel(){return this.close()},async close(){return this.navigate(this.parentRouteComponent.path)},getSubmitVerb(e=!0){return this.isCreating?e?`create`:`created`:e?`submit`:`submitted`},async submit(e,{validate:t=!0,closeForm:n=!1}={}){if(await this.waitUntilDataModelSettled(),t&&!this.validateAll())return!1;let r=e=>this.verbs[this.getSubmitVerb(e)],a=(e,t=null)=>{let n=r(!0),{itemLabel:a}=this;this.notify({type:`error`,error:e,title:`Request Error`,html:t?[`Unable to ${n} ${a}:`,(0,i.escapeHtml)(t)]:`Unable to ${n} ${a}.`})},o={onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}})},{method:s}=this,c=this.getResource({method:s}),l=H(e.schema.resource,{parent:c});c=l||c,s=c?.method||s;let u=this.getPayloadData(e,s),d;if(!l&&this.isTransient?d=await this.submitTransient(e,c,s,u,{...o,notifySuccess:()=>{let e=r(!1),{itemLabel:t}=this;this.notify({type:`info`,title:this.isCreating?`Item ${(0,i.capitalize)(e)}`:`Change ${(0,i.capitalize)(e)}`,html:[this.isCreating?`${t} was ${e}.`:`Changes to ${t} were ${e}.`,Fs]})},notifyError:e=>a(e)}):(d=await this.submitResource(e,c,s,u,{...o,setData:!0,notifySuccess:()=>{let e=r(!1);this.notify({type:`success`,title:`Successfully ${(0,i.capitalize)(e)}`,html:`${this.itemLabel} was ${e}.`})},notifyError:e=>a(e,e?.message||e)}),d&&this.getParentSourceComponent()?.reloadData()),d){if(this.resetValidation(),this.dataModel.takeProcessedDataSnapshot().catch(console.error),n||e.closeForm)this.close();else if(this.isCreating){let e=this.getItemId(this.schema,this.data);this.$router.replace({path:qs(`${this.path}/../${e}`),hash:this.$route.hash})}}return d},async submitTransient(e,t,n,r,{onSuccess:i,onError:a,notifySuccess:o,notifyError:s}){let c=this.isCreating?this.addSourceData(r):this.setSourceData(r);if(c)i?.(),await this.emitButtonEvent(e,`success`,{notify:o});else{let t=`Could not submit transient item`;a?.(t),await this.emitButtonEvent(e,`error`,{notify:s,error:t})}return c}}}),[[`render`,Xs]]),Qs={key:0},$s=[`aria-label`];function ec(e,n,r,i,a,o){return e.nested?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qs,[(0,t.renderSlot)(e.$slots,`default`)])):((0,t.openBlock)(),(0,t.createElementBlock)(`form`,{key:1,class:`dito-scroll-parent`,"aria-label":e.label,onSubmit:n[0]||=(0,t.withModifiers)(()=>{},[`prevent`])},[(0,t.renderSlot)(e.$slots,`default`)],40,$s))}var tc=G(W.component(`DitoFormInner`,{props:{nested:{type:Boolean,default:!1},label:{type:String,default:null}}}),[[`render`,ec]]),nc=W.component(`DitoFormNested`,{extends:Zs}),rc=[`id`];function ic(e,n,r,i,a,o){return e.errors?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`dito-errors`,id:e.id,role:`alert`},[(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.errors,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,null,(0,t.toDisplayString)(e),1))),256))])],8,rc)):(0,t.createCommentVNode)(``,!0)}var ac=G(W.component(`DitoErrors`,{props:{id:{type:String,default:null},errors:{type:Array,default:null}}}),[[`render`,ic]]),oc={class:`dito-scopes`};function sc(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,oc,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.scopes,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(s,{key:r,class:(0,t.normalizeClass)({"dito-button--selected":n.name===e.query.scope}),"aria-pressed":n.name===e.query.scope,title:n.hint||e.getLabel(n),onClick:t=>e.selectScope(n)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.getLabel(n)),1)]),_:2},1032,[`class`,`aria-pressed`,`title`,`onClick`]))),128))])}var cc=G(W.component(`DitoScopes`,{components:{DitoButton:K},props:{query:{type:Object,required:!0},scopes:{type:Object,required:!0}},methods:{selectScope(e){this.sourceComponent.listQuery.update({scope:e.name},{resetPage:!0})}}}),[[`render`,sc]]);function lc(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`Pagination`);return(0,t.openBlock)(),(0,t.createBlock)(s,{page:e.page,"onUpdate:page":n[0]||=t=>e.page=t,pageSize:e.limit,total:e.total},null,8,[`page`,`pageSize`,`total`])}var uc=G(W.component(`DitoPagination`,{components:{Pagination:ca},props:{query:{type:Object,required:!0},limit:{type:Number,required:!0},total:{type:Number,required:!0}},computed:{page:{get(){return(+this.query.page||0)+1},set(e){this.sourceComponent.listQuery.update({page:e-1})}}}}),[[`render`,lc]]),dc={data(){return{isDragging:!1}},methods:{getDraggableOptions(e=window.dito.settings?.forceDragFallback??!1){let t=`dito-draggable`;return{animation:150,handle:`.dito-button--drag`,dragClass:`${t}__drag`,chosenClass:`${t}__chosen`,ghostClass:`${t}__ghost`,fallbackClass:`${t}__fallback`,forceFallback:e,onStart:this.onStartDrag,onEnd:this.onEndDrag}},onStartDrag(){this.isDragging=!0},onEndDrag({oldIndex:e,newIndex:t}){this.isDragging=!1,e!==t&&this.onChange()}}};function fc(e,t,n){let r=e.indexOf(t),i=r+n;return r>=0&&n!==0&&i>=0&&i<e.length?e.toSpliced(r,1).toSpliced(i,0,t):null}var pc=[`id`],mc={key:0,class:`dito-tree-header`},hc=[`aria-label`,`aria-expanded`],gc=[`innerHTML`],_c={key:1,class:`dito-tree-info`},vc={key:1,class:`dito-tree-leaf`},yc=[`innerHTML`],bc={key:1,class:`dito-properties`};function xc(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoEditButtons`),c=(0,t.resolveComponent)(`DitoLabel`),l=(0,t.resolveComponent)(`DitoTableCell`),u=(0,t.resolveComponent)(`DitoTreeItem`,!0),d=(0,t.resolveComponent)(`DitoDraggable`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-tree-item`,{"dito-tree-item--dragging":e.isDragging,"dito-tree-item--active":e.active}]),id:e.componentPath,style:(0,t.normalizeStyle)(e.level>0&&{"--level":e.level})},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mc,[e.numEntries?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`dito-tree-branch`,role:`button`,tabindex:`0`,"aria-label":e.ariaLabel,"aria-expanded":e.opened,onClick:n[0]||=(0,t.withModifiers)(t=>e.opened=!e.opened,[`stop`]),onKeydown:n[1]||=(0,t.withKeys)((0,t.withModifiers)(t=>e.opened=!e.opened,[`prevent`]),[`enter`,`space`])},[e.numEntries?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-chevron`,{"dito-chevron--open":e.opened}])},null,2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:e.label},null,8,gc),e.details?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_c,(0,t.toDisplayString)(e.details),1)):(0,t.createCommentVNode)(``,!0)],40,hc)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vc,[(0,t.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:e.label},null,8,yc)])),e.hasEditButtons?((0,t.openBlock)(),(0,t.createBlock)(s,{key:2,class:`dito-buttons--small`,round:!1,schema:e.schema,formSchema:e.getItemFormSchema(e.schema,e.data,e.context),dataPath:e.dataPath,data:e.data,meta:e.nestedMeta,store:e.store,disabled:e.disabled,draggable:e.draggable,editable:e.editable,deletable:e.deletable,editPath:e.editPath,editQuery:e.$route.query,onDelete:n[2]||=t=>e.$emit(`delete`),onMove:n[3]||=t=>e.$emit(`move`,t)},null,8,[`schema`,`formSchema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`draggable`,`editable`,`deletable`,`editPath`,`editQuery`])):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),e.properties?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`table`,bc,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.properties,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,null,[(0,t.createElementVNode)(`td`,null,[n.label===!1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:e.getLabel(n)},null,8,[`label`]))]),(0,t.createVNode)(l,{cell:n,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.nestedMeta,store:e.store,disabled:e.disabled},null,8,[`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])]))),256))],512)),[[t.vShow,e.opened]]):(0,t.createCommentVNode)(``,!0),e.childrenSchema?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(d,{key:2,options:e.getDraggableOptions(!0),draggable:e.childrenDraggable,modelValue:e.childrenList,"onUpdate:modelValue":e.changeChildren},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.childrenItems,(r,i)=>((0,t.openBlock)(),(0,t.createBlock)(u,{key:e.getItemUid(e.childrenSchema,r.data),schema:e.childrenSchema,dataPath:e.getItemDataPath(e.childrenSchema,i),data:r.data,path:r.path,open:r.open,active:r.active,draggable:e.childrenDraggable,label:e.getItemLabel(e.childrenSchema,r.data,{index:i}),level:e.level+1,onDelete:t=>e.deleteChild(r.data),onMove:t=>e.moveChild(r.data,t),onChangeChildren:n[4]||=t=>e.$emit(`changeChildren`,t)},null,8,[`schema`,`dataPath`,`data`,`path`,`open`,`active`,`draggable`,`label`,`level`,`onDelete`,`onMove`]))),128))]),_:1},8,[`options`,`draggable`,`modelValue`,`onUpdate:modelValue`])),[[t.vShow,e.opened]]):(0,t.createCommentVNode)(``,!0)],14,pc)}var Sc=G(W.component(`DitoTreeItem`,{mixins:[Gs,dc],components:{DitoEditButtons:_s},emits:[`delete`,`move`,`changeChildren`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Array,Object],default:null},path:{type:String,default:``},open:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},label:{type:String,default:null},level:{type:Number,default:0}},data(){return{opened:this.open||this.schema.open}},computed:{componentPath(){let{componentPath:e,dataPath:t}=this.sourceComponent,n=Oe(this.dataPath,t);return n?b(e,n):e},meta(){return this.sourceComponent.meta},store(){return this.sourceComponent.store},disabled(){return this.sourceComponent.disabled},nestedMeta(){return{...this.meta,schema:this.schema}},properties(){return M(this.schema.properties)},childrenSchema(){return this.schema.children},childrenList(){let e=this.childrenSchema?.name;return e&&this.data[e]},childrenDraggable(){return this.childrenList?.length>1&&this.getSchemaValue(`draggable`,{type:Boolean,default:!1,schema:this.childrenSchema})},numChildren(){return this.childrenList?.length||0},numProperties(){return this.properties?.length||0},numEntries(){return this.numProperties+this.numChildren},childrenItems(){let{childrenSchema:e,childrenList:t}=this;if(e&&t){let{editPath:n}=this.sourceComponent,r=!this.path&&e.open;return t.map((t,i)=>{let a=e.path&&`${this.path}/${e.path}/${i}`;return{data:t,path:a,open:r||!!a&&n!==a&&U(n,a),active:n===a}})}return[]},ariaLabel(){return this.label?_t(this.label):null},details(){let{numChildren:e}=this;return e&&`${e} ${e===1?`item`:`items`}`},hasEditButtons(){return this.draggable||this.editable||this.deletable},editPath(){return this.editable&&this.path?`${this.sourceComponent.path}${this.path}`:null},editable:R(`editable`,{type:Boolean,default:!1,get(e){return e&&k(this.schema)}}),deletable:R(`deletable`,{type:Boolean,default:!1})},watch:{open(e){e&&(this.opened=!0)}},methods:{changeChildren(e){this.$emit(`changeChildren`,{data:this.data,childrenSchema:this.childrenSchema,path:this.path,children:e})},moveChild(e,t){let n=fc(this.childrenList,e,t);n&&this.changeChildren(n)},async deleteChild(e){await Ls(this,{label:this.getItemLabel(this.childrenSchema,e,{index:this.childrenList.indexOf(e),extended:!0}),isTransient:!0,remove:()=>{let t=this.childrenList.filter(t=>t!==e);if(t.length===this.childrenList.length)return!1;this.changeChildren(t)}})},onEndDrag(){this.isDragging=!1}}}),[[`render`,xc]]),Cc={class:`dito-table-head`},wc=[`aria-sort`],Tc={key:1},Ec={key:0};function Dc(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoButton`);return(0,t.openBlock)(),(0,t.createElementBlock)(`thead`,Cc,[(0,t.createElementVNode)(`tr`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.columns,r=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.shouldRenderSchema(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:0,scope:`col`,class:(0,t.normalizeClass)(e.getColumnClass(r)),"aria-sort":r.sortable?e.getSortState(r):null},[r.sortable?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,class:(0,t.normalizeClass)(e.getSortClass(r)),onClick:t=>e.sortByColumn(r)},{default:(0,t.withCtx)(()=>[n[0]||=(0,t.createElementVNode)(`div`,{class:`dito-button__order-arrows`},null,-1),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.getLabel(r)),1)]),_:2},1032,[`class`,`onClick`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Tc,(0,t.toDisplayString)(e.getLabel(r)),1))],10,wc)):(0,t.createCommentVNode)(``,!0)],64))),256)),e.hasEditButtons?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,Ec,[...n[1]||=[(0,t.createElementVNode)(`span`,null,null,-1)]])):(0,t.createCommentVNode)(``,!0)])])}var Oc=G(W.component(`DitoTableHead`,{components:{DitoButton:K},props:{query:{type:Object,required:!0},columns:{type:Object,required:!0},hasEditButtons:{type:Boolean,required:!0}},computed:{sort(){let e=(this.query.order||``).split(/\s+/);return{name:e[0],order:e[1]}}},methods:{getColumnClass(e){return`dito-column--${(0,i.hyphenate)(e.name)}`},getSortClass(e){return this.sort.name===e.name?`dito-button--selected dito-button--order-${this.sort.order}`:null},getSortState(e){return{asc:`ascending`,desc:`descending`}[this.sort.name===e.name&&this.sort.order]||`none`},sortByColumn(e){let t=this.sort.name===e.name&&this.sort.order===`asc`?`desc`:`asc`;this.sourceComponent.listQuery.update({order:`${e.name} ${t}`},{resetPage:!0})}}}),[[`render`,Dc]]),kc=[`innerHTML`];function Ac(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`td`,{class:(0,t.normalizeClass)(e.cell.class),style:(0,t.normalizeStyle)(e.cell.style)},[e.cell.component?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.cell.component),{key:0,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,nested:e.nested,disabled:e.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,innerHTML:e.renderCell(e.data)},null,8,kc))],6)}var jc=G(W.component(`DitoTableCell`,{mixins:[L],props:{cell:{type:Object,required:!0},schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},methods:{renderCell(e){let{name:t,render:n}=this.cell,r=e[t];return n?n.call(this,new D(this,{name:t,value:r,data:e,dataPath:b(this.dataPath,t)})):(0,i.escapeHtml)(r)}}}),[[`render`,Ac]]),Mc={class:`dito-upload-file`},Nc={class:`dito-thumbnail__inner`},Pc=[`src`],Fc={key:1,class:`dito-thumbnail__type`};function Ic(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,Mc,[e.thumbnail?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`dito-thumbnail`,`dito-thumbnail--${e.thumbnail}`])},[(0,t.createElementVNode)(`div`,Nc,[e.source?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:0,src:e.source,crossorigin:`anonymous`},null,8,Pc)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fc,[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.type),1)]))])],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.file.name),1)])}var Lc=W.component(`DitoUploadFile`,{props:{file:{type:Object,required:!0},upload:{type:Object,default:null},thumbnail:{type:String,default:null},thumbnailUrl:{type:String,default:null}},data(){return{uploadUrl:null}},computed:{type(){return Rc[this.file.type]||this.file.name.split(`.`).pop().toUpperCase()},source(){return this.uploadUrl||this.thumbnailUrl}},watch:{"upload.file":{immediate:!0,handler(e){if(this.thumbnail&&e?.type.startsWith(`image/`)){let t=new FileReader;t.onload=()=>{this.uploadUrl=t.result},t.readAsDataURL(e)}else this.uploadUrl=null}}}}),Rc={"text/plain":`TXT`,"text/html":`HTML`,"text/css":`CSS`,"text/javascript":`JS`,"image/jpeg":`JPG`,"image/png":`PNG`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"video/mp4":`MP4`,"audio/mpeg":`MP3`,"application/json":`JSON`,"application/xml":`XML`,"application/pdf":`PDF`,"application/zip":`ZIP`},zc=G(Lc,[[`render`,Ic]]);function Bc(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`UseSortable`);return(0,t.openBlock)(),(0,t.createBlock)(s,{class:(0,t.normalizeClass)([`dito-draggable`,{"dito-draggable--dragging":e.isDragging}]),as:e.as,modelValue:e.modelValue,options:e.sortableOptions,"onUpdate:modelValue":n[0]||=t=>e.$emit(`update:modelValue`,t)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`class`,`as`,`modelValue`,`options`])}var Vc=G(W.component(`DitoDraggable`,{mixins:[xa],components:{UseSortable:c.UseSortable},emits:[`update:modelValue`],props:{modelValue:{type:Array,required:!0},as:{type:String,default:`div`},options:{type:Object,required:!0},draggable:{type:Boolean,default:!0}},data(){return{isDragging:!1}},watch:{draggable(e){this.getSortable()?.option(`disabled`,!e)}},created(){this.sortableOptions={...this.options,disabled:!this.draggable,onStart:this.onStart,onEnd:this.onEnd},this.dragEndHandlers=null},methods:{getSortable(){return this.$el instanceof HTMLElement?l.default.get(this.$el):null},onStart(e){this.options.onStart?.(e),this.isDragging=!0,this.removeDragEndHandlers()},onEnd(e){this.options.onEnd?.(e),this.removeDragEndHandlers(),this.dragEndHandlers=this.domOn(document,{mousedown:this.onMouseAfterDragEnd,mousemove:this.onMouseAfterDragEnd,mouseleave:this.onMouseAfterDragEnd})},onMouseAfterDragEnd(){this.isDragging=!1,this.removeDragEndHandlers()},removeDragEndHandlers(){this.dragEndHandlers?.remove(),this.dragEndHandlers=null}}}),[[`render`,Bc]]);function Hc({vnode:e}){return e}Hc.props={vnode:{type:Object,required:!0}};var Uc=W.component(`DitoVnode`,Hc),Wc=we({DitoAccount:()=>Co,DitoAffix:()=>Do,DitoAffixes:()=>jo,DitoButtons:()=>ps,DitoClipboard:()=>ks,DitoContainer:()=>Qo,DitoCreateButton:()=>bs,DitoDialog:()=>za,DitoDraggable:()=>Vc,DitoEditButtons:()=>_s,DitoErrors:()=>ac,DitoForm:()=>Zs,DitoFormInner:()=>tc,DitoFormNested:()=>nc,DitoHeader:()=>so,DitoLabel:()=>Io,DitoMenu:()=>eo,DitoNavigation:()=>uo,DitoNotifications:()=>go,DitoPagination:()=>uc,DitoPane:()=>Yo,DitoPanel:()=>os,DitoPanels:()=>ls,DitoRoot:()=>Ya,DitoRouterView:()=>js,DitoSchema:()=>Ho,DitoSchemaInlined:()=>Wo,DitoScopes:()=>cc,DitoSidebar:()=>bo,DitoSpinner:()=>To,DitoTableCell:()=>jc,DitoTableHead:()=>Oc,DitoTabs:()=>ns,DitoTrail:()=>io,DitoTreeItem:()=>Sc,DitoUploadFile:()=>zc,DitoVNode:()=>Uc,DitoView:()=>Vs}),X={extends:W,mixins:[Gn],nativeField:!1,textField:!1,defaultValue:null,defaultNested:!0,defaultVisible:!0,defaultMultiple:!1,generateLabel:!0,rendersOwnLabel:null,excludeValue:!1,ignoreMissingValue:null,treatNullAsMissing:null,omitSpacing:!1,getTypeValidations:null,component:W.component,get:qe,register(e,t={}){e=(0,i.asArray)(e),Gc(t)&&console.warn(`Type '${e[0]}': The \`getValidations()\` method isn't supported anymore, use the static \`getTypeValidations(schema, context)\` option instead.`);let n=this.component(`DitoType${(0,i.camelize)(e[0],!0)}`,t);for(let t of e)Ke(t,n);return n}};function Gc(e){return[e,...e.mixins??[]].some(({methods:e})=>!!e?.getValidations)}var Kc=[`data-info`];function qc(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoAffixes`),c=(0,t.resolveComponent)(`DitoButton`);return(0,t.openBlock)(),(0,t.createBlock)(c,(0,t.mergeProps)({id:e.componentPath,ref:`element`,type:e.type,verb:e.verb,text:e.text,title:e.text,"aria-busy":e.isRunning},e.attributes),{prefix:(0,t.withCtx)(()=>[e.prefixes.length>0?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,items:e.prefixes,position:`prefix`,disabled:e.disabled,parentContext:e.context},null,8,[`items`,`disabled`,`parentContext`])):(0,t.createCommentVNode)(``,!0)]),suffix:(0,t.withCtx)(()=>[e.suffixes.length>0?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,items:e.suffixes,position:`suffix`,disabled:e.disabled,parentContext:e.context},null,8,[`items`,`disabled`,`parentContext`])):(0,t.createCommentVNode)(``,!0),!e.label&&e.info?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":e.info},null,8,Kc)):(0,t.createCommentVNode)(``,!0)]),_:1},16,[`id`,`type`,`verb`,`text`,`title`,`aria-busy`])}var Jc=G(X.register([`button`,`submit`],{components:{DitoAffixes:jo,DitoButton:K},defaultValue:()=>void 0,excludeValue:!0,defaultWidth:`auto`,generateLabel:!1,data(){return{isRunning:!1}},computed:{verb(){return this.verbs[this.name]},text:R(`text`,{type:String}),prefixes(){return(0,i.asArray)(this.schema.prefix)},suffixes(){return(0,i.asArray)(this.schema.suffix)},closeForm:R(`closeForm`,{type:Boolean,default:!1})},methods:{getEvents(){let{onFocus:e,onBlur:t,onClick:n}=this;return{onFocus:e,onBlur:t,onClick:n}},async submit(e){return this.resourceComponent?.submit(this,e)},async onClick(){if(!this.isRunning){this.isRunning=!0;try{await this.emitEvent(`click`,{parent:this.schemaComponent})===void 0&&cr(this.schema)&&await this.submit()}catch(e){if(await this.emitEvent(`error`,{context:{error:e}})===void 0){if(e instanceof AggregateError)for(let t of e.errors)this.notify({type:`error`,text:t});else this.notify({type:`error`,text:e})}}finally{this.isRunning=!1}}}}}),[[`render`,qc]]),Yc={class:`dito-checkbox`},Xc=[`id`];function Zc(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,Yc,[(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:e.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=t=>e.value=t,type:`checkbox`},e.attributes),null,16,Xc),[[t.vModelCheckbox,e.value]])])}var Qc=G(X.register(`checkbox`,{nativeField:!0}),[[`render`,Zc]]),$c={computed:{multiple(){return sn(this.schema)},selectedValue:{get(){let e=e=>{let t=this.relate?this.getValueForOption(e):e;return this.hasOptions?this.getOptionForValue(t)?t:null:e};return this.multiple&&(0,i.isArray)(this.value)?this.value.map(e).filter(e=>e!==null):e(this.value)},set(e){let t=e=>{if(!this.relate)return e;let t=this.getOptionForValue(e)??this.getRelatedObject(e);return this.shouldSetTemporaryId(t)&&Ve(t,`id`),t};this.value=this.multiple&&(0,i.isArray)(e)?e.map(t):t(e)}},shouldReplaceValueWithSelectedValue(){return this.hasOptions&&!this.areOptionsFiltered&&(this.selectedValue===null&&this.value!==null||Ue(this.value))},selectedOption(){return this.getOptionForValue(this.selectedValue)},optionsResolver(){return this.dataModel.getOptionsResolver({schema:this.schema,data:this.data,name:this.name,dataPath:this.dataPath,componentPath:this.componentPath})},isLoadingOptions(){return this.optionsResolver.isLoading},options(){let e=this.optionsResolver.value??[];if(!(0,i.isArray)(e))throw Error(`Invalid options data, should be array: ${e}`);return this.groupBy?this.groupOptions(e):e},activeOptions(){return this.options},areOptionsFiltered(){return this.activeOptions!==this.options},hasOptions(){return this.activeOptions.length>0},relate:R(`relate`,{type:Boolean,default:!1,callback:!1}),groupBy:R(`groupBy`,{type:String,default:null}),optionLabel:R(`options.label`,{type:[String,Function],default:null,get(e){return e||this.getOptionKey(`label`)||null}}),optionValue:R(`options.value`,{type:[String,Function],default:null,get(e){return e||this.relate&&`id`||this.getOptionKey(`value`)||null}}),optionEquals:R(`options.equals`,{type:Function,default:null}),searchFilter:R(`search`,{type:[Object,Function],default:null,get(e){if(e){let{filter:t,debounce:n}=(0,i.isFunction)(e)?{filter:e}:e;return n?(0,i.debounceAsync)(t,n):t}}}),editable:R(`editable`,{type:Boolean,default:!1,get(e){return e&&Vt(this.schema,this.context)}}),groupByLabel(){return this.groupBy?`label`:null},groupByOptions(){return this.groupBy?`options`:null}},watch:{shouldReplaceValueWithSelectedValue:{handler(e){e&&this.replaceValueWithSelectedValue()},immediate:!0},value(){this.shouldReplaceValueWithSelectedValue&&this.replaceValueWithSelectedValue()},"optionsResolver.lastLoadError"(e,t){t&&this.removeError(el(t)),e&&this.addError(el(e))}},methods:{getOptionKey(e){let[t]=this.activeOptions,n=this.groupBy?t?.[this.groupByOptions]?.[0]:t;return(0,i.isObject)(n)&&e in n?e:null},replaceValueWithSelectedValue(){let{selectedValue:e}=this;this.dataModel.applyCleanChanges(()=>{this.selectedValue=e}).catch(console.error)},groupOptions(e){let t={};return e.reduce((e,n)=>{let r=n[this.groupBy],i=t[r];return i||(i=t[r]={[this.groupByLabel]:r,[this.groupByOptions]:[]},e.push(i)),i[this.groupByOptions].push(n),e},[])},shouldSetTemporaryId(e){return this.relate&&(0,i.isObject)(e)&&e.id==null},getOptionForValue(e){return this.optionValue?this.findOptionForValue(e):e},findOptionForValue(e){let t=(n,r)=>{for(let i of n)if(r){let e=t(i.options,null);if(e)return e}else if(this.optionEquals?this.optionEquals(new D(this,{value:e,option:i})):e===this.getValueForOption(i))return i},{groupBy:n}=this;return t(this.activeOptions,n)??(this.areOptionsFiltered?t(this.options,n):void 0)},getRelatedObject(e){return(0,i.asArray)(this.value).find(t=>this.getValueForOption(t)===e)},getValueForOption(e){if(this.shouldSetTemporaryId(e))return(0,t.toRaw)(e);let{optionValue:n}=this;return(0,i.isString)(n)?e?.[n]??null:(0,i.isFunction)(n)?n(new D(this,{option:e})):e},getLabelForOption(e){let{optionLabel:t}=this;return(0,i.isString)(t)?e?.[t]:(0,i.isFunction)(t)?t(new D(this,{option:e})):(0,i.labelize)(`${e}`)}},processValue({schema:e,value:t,dataPath:n},r){if(e.relate){let a=e.options?.dataPath,o=a?(0,i.normalizeDataPath)(`${n}/${a}`):null;r.addRelation(n,o,e),o&&r.setSourceRelated(o);let s=e=>e&&{id:e.id};t=sn(e)&&(0,i.isArray)(t)?t.map(s):s(t)}return t}};function el(e){return e.message||e}var tl={class:`dito-option-list__fieldset`},nl={class:`dito-option-list__legend`},rl={class:`dito-option-list__option`},il={class:`dito-option-list__option`};function al(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`ul`,{class:(0,t.normalizeClass)([`dito-option-list`,e.layoutClass])},[e.isGrouped?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(e.options,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{class:`dito-option-list__group`,key:n.label},[(0,t.createElementVNode)(`fieldset`,tl,[(0,t.createElementVNode)(`legend`,nl,(0,t.toDisplayString)(n.label),1),(0,t.createElementVNode)(`ul`,{class:(0,t.normalizeClass)([`dito-option-list__options`,e.layoutClass])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(n.options,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,rl,[(0,t.renderSlot)(e.$slots,`option`,{option:n,isFirstOption:n===e.firstOption})]))),256))],2)])]))),128)):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(e.options,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,il,[(0,t.renderSlot)(e.$slots,`option`,{option:n,isFirstOption:n===e.firstOption})]))),256))],2)}var ol=G(W.component(`DitoOptionList`,{props:{options:{type:Array,required:!0},isGrouped:{type:Boolean,default:!1},layout:{type:String,default:null}},computed:{layoutClass(){return`dito-layout--${this.layout||`vertical`}`},firstOption(){let[e]=this.options;return this.isGrouped?e?.options[0]:e}}}),[[`render`,al]]);function sl(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoEditButtons`);return(0,t.openBlock)(),(0,t.createBlock)(s,{class:`dito-options-edit-buttons`,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,disabled:!1,editable:``,editPath:e.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editPath`])}var cl=G(W.component(`DitoOptionsEditButtons`,{components:{DitoEditButtons:_s},props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},parentContext:{type:Object,required:!0},optionValue:{type:null,default:null}},computed:{editPath(){let{schema:e,optionValue:t,parentContext:n}=this;return t==null?null:Wt(e,t,n)}}}),[[`render`,sl]]),ll={class:`dito-checkbox`},ul=[`value`];function dl(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoOptionsEditButtons`),c=(0,t.resolveComponent)(`DitoOptionList`);return(0,t.openBlock)(),(0,t.createBlock)(c,{class:`dito-checkboxes`,id:e.componentPath,role:`group`,"aria-label":e.label,options:e.options,isGrouped:!!e.groupBy,layout:e.schema.layout},{option:(0,t.withCtx)(({option:r,isFirstOption:i})=>[(0,t.createElementVNode)(`label`,null,[(0,t.createElementVNode)(`div`,ll,[(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({ref:i?`element`:void 0,"onUpdate:modelValue":n[0]||=t=>e.checkedValues=t,type:`checkbox`,value:e.getValueForOption(r)},e.attributes),null,16,ul),[[t.vModelCheckbox,e.checkedValues]]),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.getLabelForOption(r)),1)])]),e.editable?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,parentContext:e.context,optionValue:e.getValueForOption(r)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`parentContext`,`optionValue`])):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`id`,`aria-label`,`options`,`isGrouped`,`layout`])}var fl=G(X.register(`checkboxes`,{mixins:[$c],components:{DitoOptionList:ol,DitoOptionsEditButtons:cl},nativeField:!0,defaultValue:({schema:e})=>sn(e)?[]:null,defaultWidth:`auto`,defaultMultiple:!0,computed:{checkedValues:{get(){let{selectedValue:e}=this;return this.multiple?(e||[]).filter(e=>e!=null):e==null?[]:[e]},set(e){this.selectedValue=this.multiple?e:e.at(-1)??null}}}}),[[`render`,dl]]);function pl({isEditing:e,emitChange:t}){let n=!1;return{markEdited(){n=!0},emitIfDone(){n&&!e()&&(n=!1,t())},reset(){n=!1}}}function ml(e,{element:t,onResize:n}){if(e.button!==0)return;let r=e.currentTarget,{pointerId:i,clientY:a}=e,o=_l(t),s=new AbortController,{signal:c}=s,l=e=>{e.pointerId===i&&n(Math.max(o+e.clientY-a,0))},u=e=>{e.pointerId===i&&s.abort()};r.setPointerCapture(i),r.addEventListener(`pointermove`,l,{signal:c}),r.addEventListener(`pointerup`,e=>{l(e),u(e)},{signal:c}),r.addEventListener(`pointercancel`,u,{signal:c}),r.addEventListener(`lostpointercapture`,u,{signal:c})}var hl={ArrowUp:-1,ArrowDown:1};function gl(e,{element:t,onResize:n}){let r=hl[e.key];if(r){e.preventDefault();let i=parseFloat(getComputedStyle(t).fontSize),a=e.shiftKey?10*i:i;n(Math.max(_l(t)+r*a,0))}}function _l(e){return parseFloat(getComputedStyle(e).height)}function vl(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-resize`,tabindex:`0`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize`,onPointerdown:n[0]||=(0,t.withModifiers)((...t)=>e.onPointerDown&&e.onPointerDown(...t),[`stop`,`prevent`]),onKeydown:n[1]||=(...t)=>e.onKeyDown&&e.onKeyDown(...t)},null,32)}var yl=G(W.component(`DitoResizeHandle`,{emits:[`resize`],props:{getElement:{type:Function,required:!0}},methods:{onPointerDown(e){ml(e,this.getResizeOptions())},onKeyDown(e){gl(e,this.getResizeOptions())},getResizeOptions(){return{element:this.getElement(),onResize:e=>this.$emit(`resize`,e)}}}}),[[`render`,vl]]),bl=[`id`],xl={class:`dito-code__editor`,ref:`editor`};function Sl(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoResizeHandle`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-code`,id:e.componentPath,style:(0,t.normalizeStyle)(e.style)},[(0,t.createElementVNode)(`div`,xl,null,512),e.resizable?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,getElement:()=>e.$el,onResize:n[0]||=t=>e.height=`${t}px`},null,8,[`getElement`])):(0,t.createCommentVNode)(``,!0)],12,bl)}var Cl=G(X.register(`code`,{components:{DitoResizeHandle:yl},data(){return{height:null}},computed:{lines:R(`lines`,{type:Number,default:3}),language:R(`language`,{type:String,default:`javascript`}),indentSize:R(`indentSize`,{type:Number,default:2}),resizable:R(`resizable`,{type:Boolean,default:!1}),style(){return this.height?{height:this.height}:{"--lines":this.lines}}},mounted(){let e=new u.default(this.$refs.editor,{language:this.language,indentSize:this.indentSize,lineNumbers:!1}),t=!1,n=!1,r=pl({isEditing:()=>this.focused,emitChange:()=>this.onChange()}),i=()=>this.onFocus(),a=()=>{this.onBlur(),r.emitIfDone()},o=this.$refs.editor.querySelector(`textarea`);o.addEventListener(`focus`,i),o.addEventListener(`blur`,a);let s=t=>{t!==e.code&&(n=!0,e.updateCode(t))},c=e=>{e!==this.value&&(t=!0,this.value=e,r.markEdited(),this.onInput(),r.emitIfDone())};e.onUpdate(e=>{n?n=!1:c(e)}),this.$watch(`value`,e=>{t?t=!1:s(e||``)}),this.$watch(`language`,t=>{e.updateLanguage(t)}),this.$watch(()=>this.readonly||this.disabled,t=>t?e.enableReadonlyMode():e.disableReadonlyMode(),{immediate:!0}),s(this.value||``)},methods:{focusElement(){this.$el.querySelector(`textarea`)?.focus()},blurElement(){this.$el.querySelector(`textarea`)?.blur()}}}),[[`render`,Sl]]);function wl(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoAffixes`);return(0,t.openBlock)(),(0,t.createBlock)(s,{items:e.items,position:e.position,mode:`input`,absolute:e.absolute,clearable:e.clearable,hasValue:e.hasValue,disabled:e.disabled,inlineInfo:e.inlineInfo,parentContext:e.parentContext,onClear:n[0]||=t=>e.$emit(`clear`)},(0,t.createSlots)({_:2},[e.$slots.append?{name:`append`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`append`)]),key:`0`}:void 0]),1032,[`items`,`position`,`absolute`,`clearable`,`hasValue`,`disabled`,`inlineInfo`,`parentContext`])}var Z=G(W.component(`DitoInputAffixes`,{components:{DitoAffixes:jo},emits:[`clear`],props:{position:{type:String,required:!0,validator:e=>[`prefix`,`suffix`].includes(e)},items:{type:[String,Object,Array],default:null},absolute:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},hasValue:{type:Boolean,default:!1},inlineInfo:{type:String,default:null},parentContext:{type:Object,required:!0}}}),[[`render`,wl]]);function Q({schema:e,disabled:t,clearable:n,value:r,label:i,info:a,context:o}){return{prefix:{items:e.prefix??null,disabled:t,clearable:!1,hasValue:!1,inlineInfo:null,parentContext:o},suffix:{items:e.suffix??null,disabled:t,clearable:!!n,hasValue:r!=null,inlineInfo:!i&&a||null,parentContext:o}}}var Tl={key:0,class:`dito-color__preview`};function El(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInputAffixes`),c=(0,t.resolveComponent)(`DitoInput`),l=(0,t.resolveComponent)(`SketchPicker`),u=(0,t.resolveComponent)(`DitoTrigger`);return(0,t.openBlock)(),(0,t.createBlock)(u,{class:`dito-color`,show:e.showPopup,"onUpdate:show":n[2]||=t=>e.showPopup=t,trigger:`focus`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(c,(0,t.mergeProps)({id:e.componentPath,ref:`element`,modelValue:e.hexValue,"onUpdate:modelValue":n[0]||=t=>e.hexValue=t,type:`input`,size:`8`,focused:e.showPopup},e.attributes),{prefix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`prefix`},e.inputAffixesProps.prefix),null,16)]),suffix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`suffix`},e.inputAffixesProps.suffix,{onClear:e.clear}),{append:(0,t.withCtx)(()=>[e.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Tl,[(0,t.createElementVNode)(`div`,{style:(0,t.normalizeStyle)({background:`#${e.hexValue||`00000000`}`})},null,4)])):(0,t.createCommentVNode)(``,!0)]),_:1},16,[`onClear`])]),_:1},16,[`id`,`modelValue`,`focused`])]),popup:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{class:`dito-color__picker`,tinyColor:e.colorValue,"onUpdate:tinyColor":n[1]||=t=>e.colorValue=t,disableAlpha:!e.alpha,disableFields:!e.inputs,presetColors:e.presets},null,8,[`tinyColor`,`disableAlpha`,`disableFields`,`presetColors`])]),_:1},8,[`show`])}var Dl=X.register(`color`,{components:{DitoTrigger:Di,DitoInput:Ai,DitoInputAffixes:Z,SketchPicker:d.SketchPicker},data(){return{showPopup:!1,convertedValue:null}},computed:{inputAffixesProps(){return Q(this)},canUpdateValue(){return!this.focused||this.readonly},colorValue:{get(){return(0,d.tinycolor)(this.convertedValue||this.value||`#000000`)},set(e){this.convertedValue=null;let{value:t}=this;(!t||e.toHex8String()!==(0,d.tinycolor)(t).toHex8String())&&(this.setEditedValue(kl(e,this.colorFormat)),this.onInput())}},hexValue:{get(){let e=(0,d.tinycolor)(this.value);return e.isValid()?e.toString(e.getAlpha()<1?`hex8`:`hex6`).slice(1).toLowerCase():null},set(e){if((0,d.tinycolor)(e).isValid()){let t=Ol(e,this.colorFormat);this.canUpdateValue?this.setEditedValue(t):this.convertedValue=t}}},colorFormat:R(`format`,{type:String,default:`hex`}),alpha:R(`alpha`,{type:Boolean,default:!1}),inputs:R(`inputs`,{type:Boolean,default:!0}),presets:R(`presets`,{type:Array,default:[`#ffffff`,`#c3c3c3`,`#7f7f7f`,`#000000`,`#880015`,`#ed1c24`,`#ff7f27`,`#fff200`,`#22b14c`,`#00a2e8`,`#3f48cc`,`#a349a4`,`#b97a57`,`#ffaec9`,`#ffc90e`,`#00000000`]})},watch:{canUpdateValue(e){e&&this.convertedValue!==null&&(this.setEditedValue(this.convertedValue),this.convertedValue=null)},showPopup(e){e||this.changeOnceEdited.emitIfDone()}},created(){this.changeOnceEdited=pl({isEditing:()=>this.focused||this.showPopup,emitChange:()=>this.onChange()})},methods:{getEvents(){let{onFocus:e,onBlur:t,onInput:n}=this;return{onFocus:e,onBlur:t,onInput:n,onChange:()=>{}}},onBlur(){Gn.methods.onBlur.call(this),this.changeOnceEdited.emitIfDone()},clear(){this.convertedValue=null,this.changeOnceEdited.reset(),Gn.methods.clear.call(this)},setEditedValue(e){this.value=e,this.changeOnceEdited.markEdited(),this.changeOnceEdited.emitIfDone()}}});function Ol(e,t){return kl((0,d.tinycolor)(e),t)}function kl(e,t){switch(t){case`rgb`:return e.toRgb();case`prgb`:return e.toPercentageRgb();case`name`:return e.toName();case`hsl`:return e.toHsl();case`hsv`:return e.toHsv();case`hex3`:return`#${e.toHex(!0)}`;case`hex4`:return`#${e.toHex8(!0)}`;case`hex8`:return`#${e.toHex8()}`;default:return e.getAlpha()<1?`#${e.toHex8()}`:`#${e.toHex()}`}}var Al=G(Dl,[[`render`,El]]);function jl(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.schema.component),(0,t.normalizeProps)((0,t.guardReactiveProps)(e.$props)),null,16)}var Ml=G(X.register(`component`,{defaultValue:()=>void 0,ignoreMissingValue:({schema:e})=>!(`default`in e),async processSchema(e,t){await Xn(t)}}),[[`render`,jl]]),Nl=[`id`,`name`,`value`,`disabled`];function Pl(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`input`,{class:`dito-text dito-input`,id:e.componentPath,ref:`element`,name:e.name,type:`text`,value:e.value,disabled:e.disabled,readonly:!0},null,8,Nl)}var Fl=G(X.register([`computed`,`data`,`hidden`],{defaultValue:()=>void 0,defaultVisible:!1,valueFromDataSchema:!0}),[[`render`,Pl]]),Il={class:`dito-date`};function Ll(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInputAffixes`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,Il,[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.getComponent(e.type)),(0,t.mergeProps)({id:e.componentPath,ref:`element`,modelValue:e.dateValue,"onUpdate:modelValue":n[0]||=t=>e.dateValue=t,locale:e.locale,format:e.formats},e.attributes),{prefix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`prefix`},e.inputAffixesProps.prefix,{absolute:``}),null,16)]),suffix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`suffix`},e.inputAffixesProps.suffix,{absolute:``,onClear:e.clear}),null,16,[`onClear`])]),_:1},16,[`id`,`modelValue`,`locale`,`format`]))])}var Rl=G(X.register([`date`,`datetime`,`time`],{components:{DitoInputAffixes:Z},nativeField:!0,textField:!0,computed:{inputAffixesProps(){return Q(this)},dateValue:{get(){let{value:e}=this;return e&&((0,i.parsePlainDate)(e)??new Date(e))},set(e){this.value=e}},formats:R(`formats`,{type:Object,default:null,get(e){let{date:t,time:n}=(0,i.assignDeeply)({},this.api.formats,e);return{date:[`date`,`datetime`].includes(this.type)?t:null,time:[`time`,`datetime`].includes(this.type)?n:null}}})},methods:{getComponent(e){return{date:Ki,time:ha,datetime:$i}[e]}},processValue({schema:e,value:t}){return(0,i.isDate)(t)?e.type===`date`?(0,i.formatPlainDate)(t):t.toISOString():t}}),[[`render`,Ll]]),zl=[`innerHTML`],Bl=[`innerHTML`];function Vl(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoSchemaInlined`);return e.isInlined?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,label:e.inlinedLabel,schema:e.formSchema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,disabled:e.disabled,collapsed:e.collapsed,collapsible:e.collapsible,deletable:e.deletable,draggable:e.draggable,editable:e.editable,editPath:e.editPath,createPath:e.createPath,insertIndex:e.insertIndex,onDelete:n[0]||=t=>e.$emit(`delete`),onMove:n[1]||=t=>e.$emit(`move`,t)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`draggable`,`editable`,`editPath`,`createPath`,`insertIndex`])):e.schema.component?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.schema.component),{key:1,dataPath:e.dataPath,data:e.data,nested:!1},null,8,[`dataPath`,`data`])):e.sourceComponent.render?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,innerHTML:e.renderedItem},null,8,zl)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:3,innerHTML:e.itemLabel},null,8,Bl))}var Hl=G(W.component(`DitoSourceItem`,{emits:[`delete`,`move`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},index:{type:Number,default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null}},computed:{isInlined(){return dt(this.schema)},formSchema(){return j(this.schema,this.data,this.sourceComponent.context)},inlinedLabel(){return T(this.schema)||this.collapsible?this.sourceComponent.getItemLabel(this.schema,this.data,{index:this.index,asObject:!0}):null},itemLabel(){return this.sourceComponent.getItemLabel(this.schema,this.data,{index:this.index})},renderedItem(){let{sourceComponent:e}=this;return e.render(new D(e,{data:this.data,value:this.data,index:this.index,dataPath:this.dataPath}))}}}),[[`render`,Vl]]),Ul=class{constructor({router:e,getRoute:t,getSourceStore:n,getDefaultQuery:r}){this.router=e,this.getRoute=t,this.getSourceStore=n,this.getDefaultQuery=r,this.pendingNavigation=null}get query(){return this.withDefaults(this.getSourceStore().query)}update(e,{resetPage:t=!1}={}){let{query:n}=this,r=Wl({...n,...e});if(Gl(r,n))return Promise.resolve();t&&r.page!=null&&(r.page=0);let i=this.router.push({query:r,hash:this.getRoute().hash}),a={query:r,promise:i};this.pendingNavigation=a;let o=()=>{this.pendingNavigation===a&&(this.pendingNavigation=null)};return i.then(o,o),i}whenNavigated(){let e=this.pendingNavigation;if(!e||this.isRouteQuery(e.query))return null;let t=()=>this.isRouteQuery(e.query);return e.promise.then(t,t)}isRouteQuery(e){return Gl(e,this.getRoute().query)}syncWithRoute(){let e=this.getRoute(),t=this.withDefaults({...this.getSourceStore().query,...e.query});this.getSourceStore().query=t,Gl(t,e.query)||this.router.replace({query:t,hash:e.hash}).catch(console.error)}setFromRoute(e){let t=this.withDefaults(e),n=!Gl(t,this.query);return this.getSourceStore().query=t,n}withDefaults(e){return Wl({...this.getDefaultQuery(),...e})}};function Wl(e){return(0,i.pickBy)(e,e=>e!=null)}function Gl(e,t){let n=e=>{let t=new URLSearchParams(ur(e));return t.sort(),t.toString()};return n(e)===n(t)}var Kl=class e{#e=new Map;static getFromStore(n){return n.$itemStores??=(0,t.markRaw)(new e),n.$itemStores}getStore(e){let n=this.#e.get(e);return n||(n=(0,t.reactive)({}),this.#e.set(e,n)),n}removeStore(e){this.#e.delete(e)}},$={mixins:[Gs,Ks,rs],defaultValue:e=>T(e.schema)?[]:null,excludeValue:e=>!!e.schema.resource,provide(){return{$sourceComponent:()=>this}},data(){return{wrappedPrimitives:null,listQuery:(0,t.markRaw)(new Ul({router:this.$router,getRoute:()=>this.$route,getSourceStore:()=>this.store,getDefaultQuery:()=>this.defaultQuery})),itemStores:Kl.getFromStore(this.store)}},computed:{sourceComponent(){return this},isObjectSource(){return w(this.type)},isListSource(){return T(this.type)},hasData(){return!!this.value},shouldRender(){return this.sourceDepth<this.maxDepth},isReady(){return this.shouldRender&&(this.hasData||!this.providesData)},isInView(){return!!this.viewComponent},wrapPrimitives(){return this.schema.wrapPrimitives},valueListData(){let{value:e}=this;return this.isObjectSource?e==null?[]:[e]:(this.isListResults(e)?e.results:e)||[]},primitiveValues(){return this.wrapPrimitives?[...this.valueListData]:null},listData:{get(){return this.wrapPrimitives?this.wrappedPrimitives||[]:this.valueListData},set(e){this.wrapPrimitives?this.wrappedPrimitives=e:this.value=this.isObjectSource?e?.length>0?e[0]:null:_n(this.sourceSchema,e,this.paginationRange)}},objectData:{get(){return this.listData[0]||null},set(e){this.listData=e?[e]:[]}},sourceSchema(){return this.schema},sourceDepth(){return this.$route.matched.reduce((e,t)=>e+ +(t.meta.schema===this.sourceSchema),0)},path(){return this.routeComponent.getChildPath(this.schema.path)},defaultQuery(){return{scope:this.defaultScope?.name,page:this.schema.page,order:this.defaultOrder}},query:{get(){return this.listQuery.query},set(e){this.listQuery.update(e)}},total:Un(`total`),columns(){return M(this.schema.columns)},scopes(){return M(this.schema.scopes)},defaultScope(){let e=null;if(this.scopes)for(let t of Object.values(this.scopes)){if(t.defaultScope)return t;e||=t}return e},defaultOrder(){if(this.columns)for(let e of Object.values(this.columns)){let{defaultSort:t}=e;if(t){let n=(0,i.isString)(t)?t:`asc`;return`${e.name} ${n}`}}return null},nestedMeta(){return{...this.meta,schema:this.schema}},forms(){return Object.values(A(this.schema,this.context))},view(){return Bt(this.schema,this.context)},linksToView(){return!!this.view},buttonSchemas(){return Yt(this.schema.buttons)},isCompact(){return this.forms.every(ut)},isInlined(){return dt(this.schema)},paginate:R(`paginate`,{type:Number}),render:R(`render`,{type:Function,default:null}),hasItems(){return this.isListSource||!!this.value},creatable:R(`creatable`,{type:Boolean,default:!1,get(e){return e&&k(this.schema)?!this.isObjectSource||!this.value:!1}}),editable:R(`editable`,{type:Boolean,default:!1,get(e){return e&&!this.isInlined&&this.hasItems}}),deletable:R(`deletable`,{type:Boolean,default:!1,get(e){return e&&this.hasItems}}),draggable:R(`draggable`,{type:Boolean,default:!1,get(e){return this.isListSource&&e}}),collapsible:R(`collapsible`,{type:Boolean,default:!1,get(e){return e&&this.isInlined}}),collapsed:R(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}}),maxDepth:R(`maxDepth`,{type:Number,default:1}),createPath(){return this.creatable?Ht(this.schema,this.context)||this.path:null}},watch:{$route:{flush:`post`,handler(e,t){this.providesData&&t.path===e.path&&t.hash===e.hash&&this.listQuery.setFromRoute(e.query)&&this.loadData(!1)}},value:{immediate:!0,handler(e){this.isListResults(e)&&this.unwrapListData(e)}},primitiveValues:{immediate:!0,handler(e){if(e&&!(0,i.equals)(e,this.unwrapPrimitives())){let{wrapPrimitives:t}=this;this.wrappedPrimitives=e.map(e=>({[t]:e}))}}},wrappedPrimitives:{deep:!0,handler(){let e=this.unwrapPrimitives();e&&!(0,i.equals)(e,this.primitiveValues)&&(this.value=e)}}},methods:{setupData(){this.listQuery.syncWithRoute(),this.ensureData()},requestData(){let e=this.listQuery.whenNavigated();return e?e.then(e=>{if(!e&&!this.$.isUnmounted)return this.requestData()}):Ks.methods.requestData.call(this)},clearData(){this.total=0,this.setLoadedValue(null)},setData(e){if(this.isListSource&&(0,i.isArray)(e))this.setLoadedListItems(e);else if(!e||this.isObjectSource&&(0,i.isObject)(e))this.setLoadedValue(e);else if(!this.unwrapListData(e)&&(0,i.isObject)(e)&&this.isInView)return this.viewComponent.setData(e);return this.value},getItemStore(e){return this.itemStores.getStore(this.getItemUid(this.schema,e))},isListResults(e){return this.isListSource&&(0,i.isObject)(e)&&(0,i.isNumber)(e.total)&&(0,i.isArray)(e.results)},unwrapPrimitives(){let{wrapPrimitives:e,wrappedPrimitives:t}=this;return e&&t?t.map(t=>t[e]):null},unwrapListData(e){if(this.isListResults(e))return this.total=e.total,this.setLoadedListItems(e.results),this.value},setLoadedListItems(e){this.setLoadedValue(_n(this.sourceSchema,e,this.paginationRange))},setLoadedValue(e){this.dataModel.applyCleanChanges(()=>{this.value=e}).catch(console.error)},createItem(e,t,n=null){let r=this.createData(e,t);if(this.isObjectSource)this.objectData=r;else{let{listData:e}=this;n==null?e.push(r):e.splice(n,0,r),this.listData=e}return this.collapsible&&this.$nextTick(()=>this.openSchemaComponent(n??-1)),this.onChange(),r},removeItem(e,t){let n=!1;if(this.isObjectSource)this.objectData=null,n=!0;else{let{listData:e}=this;t>=0&&(e.splice(t,1),this.listData=e,n=!0)}n&&(this.itemStores.removeStore(this.getItemUid(this.schema,e)),this.isTransient?this.onChange():this.emitChangeEvent())},async deleteItem(e,t){if(!e)return;let n=this.getItemLabel(this.schema,e,{index:t,extended:!0}),r=()=>this.isObjectSource?this.objectData===e?null:-1:this.listData.indexOf(e),i=()=>{let t=r(),n=t!==-1;return n&&this.removeItem(e,t),n};await Ls(this,{label:n,isTransient:this.isTransient,remove:async()=>{if(this.isTransient)return i();let t=r();if(t===-1)return!1;let n=`delete`,a=lr(this.getItemId(this.schema,e,t),this.getResource({method:n}));if(!a)return!1;let o=!1;return await this.handleRequest({method:n,resource:a},e=>{e||(i(),o=!0),this.reloadData()}),o}})},getSchemaComponent(e){let{listData:t,schemaComponents:n}=this,r=n.at(e);if(t?.length){let i=t.at(e);return i==null?null:r?.data===i?r:n.find(e=>e.data===i)}return r},openSchemaComponent(e){let t=this.getSchemaComponent(e);t&&(t.opened=!0)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let r=e.startsWith(this.dataPath)?this.isListSource?(0,i.parseDataPath)(e.slice(this.dataPath.length+1))[0]??null:0:null;return r!==null&&(0,i.isNumber)(+r)&&await this.getSchemaComponent(+r)?.navigateToComponent(e,t,{shouldRevealInlinedOnly:n})?!0:!n&&this.navigateToRouteComponent(e,t)},navigateToRouteComponent(e,t){return new Promise((n,r)=>{let a=()=>{let e=this.$route.matched.length-1,r=this.appState.routeComponents[e];n(t?.([r])??!0)},o=(0,i.parseDataPath)(e);for(;o.length>0;){let e=this.routeComponent.getChildPath(this.api.normalizePath((0,i.normalizeDataPath)(o))),{matched:t}=this.$router.resolve(e);if(t.length&&t[0].name!==`catch-all`){this.$route.path===e?a():this.$router.push({path:e}).catch(r).then(()=>{this.$nextTick(a)});return}o.pop()}n(!1)})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){nr(e,t,n);let c=dt(t);if(c&&t.resource)throw Error(`Nested ${this.isListSource?`lists`:this.isObjectSource?`objects`:`schema`} cannot load data from their own resources`);let l=`id${i+1}`,u={api:e,schema:t},d={...u,flatten:o,nested:a,param:l},f=await rr(e,t,i);if(s&&await s(f,i+1),k(t)&&!c){let e=i===0?``:t.path,n={path:Jl(e,T(t)?l:null),component:W.component(a?`DitoFormNested`:`DitoForm`),meta:d};w(t)&&r.push({...n,path:Jl(e,l)}),e&&T(t)&&r.push({path:e,redirect:`.`,meta:u});let[s,c]=f.reduce((e,t)=>(e[+!t.meta.flatten].push(t),e),[[],[]]);if(c.length&&(n.children=c),r.push(n),s.length)for(let e of s)r.push({...e.redirect?e:n,path:`${n.path}/${e.path}`,meta:{...e.meta,flatten:o}})}},processValue({schema:e,value:t,dataPath:n},r){return r.addSource(n,e),k(e)?t:ql(t)}};function ql(e){return(0,i.isArray)(e)?e.map(e=>(0,i.isObject)(e)?{...e}:e):(0,i.isObject)(e)?{...e}:e}function Jl(e,t){return t?e?`${e}/:${t}`:`:${t}`:e}var Yl={text(e){let t=[{label:`contains`,value:`contains`},{label:`equals`,value:`equals`},{label:`starts with`,value:`starts-with`},{label:`ends with`,value:`ends-with`}];return{operator:e.operators?{type:`select`,width:`2/5`,options:(0,i.isArray)(e.operators)?t.filter(t=>e.operators.includes(t.value)):t,clearable:!0}:null,text:{type:`text`,width:e.operators?`3/5`:`fill`,clearable:!0}}},"date-range"(){let e={type:`datetime`,width:`1/2`,formats:{date:{day:`2-digit`,month:`2-digit`,year:`numeric`}},clearable:!0};return{from:e,to:e}}};function Xl(e,t,n,r){let{sticky:i,...a}=t,o={type:`panel`,label:`Filters`,name:`$filters`,disabled:!1,sticky:i,data(){return iu(o,r.value)},components:tu(a),buttons:Zl(!1),panelButtons:Zl(!0),events:{change(){this.applyFilters()}},computed:{filters(){return ru(this.schema,this.data)},hasFilters(){return this.filters.length>0}},methods:{applyFilters(){r.value={...r.value,filter:this.filters,page:void 0}},clearFilters(){this.resetData(),this.applyFilters()}}};return tr(e,o),o}function Zl(e){return{clear:{type:`button`,text:e?null:`Clear`,disabled:({schemaComponent:e})=>!e.hasFilters,events:{click({schemaComponent:e}){e.clearFilters()}}},submit:{type:`submit`,text:e?null:`Filter`,visible:!e,events:{click({schemaComponent:e}){e.applyFilters()}}}}}function Ql(e){return`$${e}`}function $l(e){let t={};for(let[n,r]of Object.entries(e)){let[e,...a]=(0,i.parseDataPath)((0,i.normalizeDataPath)(n)),o=[!e||e.startsWith(`$`)?e:Ql(e),...a].join(`/`);t[o]=[...t[o]??[],...r]}return t}function eu(e){return e.startsWith(`$`)?e.slice(1):null}function tu(e){let t={};for(let n of Object.values(M(e)||{})){let{filter:e,width:r,...a}=n,o=e?Yl[e]?.(n):n.components;if(o){a.type=`form`,a.components={};for(let[e,t]of Object.entries(o))if(t){let n=t.label||(0,i.labelize)(t.name||e);a.components[e]={...t,label:!1,placeholder:n}}t[Ql(n.name)]={label:a.label??(0,i.labelize)(n.name),type:`object`,width:r,default:()=>({}),form:a,inlined:!0}}else throw Error(`Invalid filter '${n.name}': Unknown filter type '${e}'.`)}return t}function nu(e,t){return e.components[t]?.form?.components}function ru(e,t){let n=[];for(let r in t){let i=t[r];if(i){let t=Object.keys(nu(e,r)).map(e=>i[e]??null);t.some(e=>e!==null)&&n.push(`${eu(r)}:${t.map(JSON.stringify).join(`,`)}`)}}return n}function iu(e,t){let n={};if(t)for(let e of(0,i.asArray)(t.filter)){let t=(0,i.isString)(e)?e.match(/^(\w+):(.*)$/):null;if(!t){console.warn(`Ignoring malformed filter: '${e}'`);continue}let[,r,a]=t;try{n[r]=(0,i.asArray)(JSON.parse(`[${a}]`))}catch{}}let r={};for(let t in e.components){let i={},a=n[eu(t)];if(a){let n=nu(e,t);if(n){let e=0;for(let t in n)i[t]=a[e++]}}r[t]=i}return r}var au=[`id`,`aria-label`],ou={key:0,class:`dito-list__header`},su={key:1,class:`dito-spacer`},cu=[`id`],lu={key:1},uu={key:2,class:`dito-table__buttons`},du={key:1},fu=[`colspan`];function pu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoScopes`),c=(0,t.resolveComponent)(`DitoPagination`),l=(0,t.resolveComponent)(`DitoTableHead`),u=(0,t.resolveComponent)(`DitoTableCell`),d=(0,t.resolveComponent)(`DitoSourceItem`),f=(0,t.resolveComponent)(`DitoEditButtons`),p=(0,t.resolveComponent)(`DitoDraggable`);return e.isReady?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`dito-list`,id:e.componentPath,role:`region`,"aria-label":e.label||e.labelize(e.schema.name)},[e.scopes||e.hasPagination?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ou,[e.scopes?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,query:e.query,scopes:e.scopes},null,8,[`query`,`scopes`])):e.hasPagination?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,su)):(0,t.createCommentVNode)(``,!0),e.hasPagination?((0,t.openBlock)(),(0,t.createBlock)(c,{key:2,query:e.query,limit:e.paginate,total:e.total||0},null,8,[`query`,`limit`,`total`])):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`table`,{class:(0,t.normalizeClass)([`dito-table`,{"dito-table--separators":e.isInlined,"dito-table--larger-padding":e.hasEditButtons&&!e.isInlined,"dito-table--alternate-colors":!e.isInlined,"dito-table--even-count":e.hasEvenCount}])},[e.columns?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,query:e.query,columns:e.columns,hasEditButtons:e.hasEditButtons},null,8,[`query`,`columns`,`hasEditButtons`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(p,{as:`tbody`,options:e.getDraggableOptions(),draggable:e.draggable,modelValue:e.listData,"onUpdate:modelValue":n[0]||=t=>e.listData=t},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.listData,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{id:e.getComponentPath(r),key:e.getItemUid(e.schema,n)},[e.columns?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(e.columns,i=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.shouldRenderSchema(i)?((0,t.openBlock)(),(0,t.createBlock)(u,{key:i.name,class:(0,t.normalizeClass)(e.getCellClass(i)),cell:i,schema:e.schema,dataPath:e.getDataPath(r),data:n,meta:e.nestedMeta,store:e.store,nested:!1,disabled:e.disabled||e.isLoading},null,8,[`class`,`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])):(0,t.createCommentVNode)(``,!0)],64))),256)):((0,t.openBlock)(),(0,t.createElementBlock)(`td`,lu,[(0,t.createVNode)(d,{schema:e.schema,dataPath:e.getDataPath(r),data:n,index:r,meta:e.nestedMeta,store:e.getItemStore(n),disabled:e.disabled||e.isLoading,collapsed:e.collapsed,collapsible:e.collapsible,deletable:e.deletable,draggable:e.draggable&&e.listData.length>1,editable:e.editable,editPath:e.getEditPath(n,r),createPath:e.createPath,insertIndex:e.creatable&&e.draggable?r:null,onDelete:t=>e.deleteItem(n,r),onMove:t=>e.moveItem(n,t)},null,8,[`schema`,`dataPath`,`data`,`index`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`draggable`,`editable`,`editPath`,`createPath`,`insertIndex`,`onDelete`,`onMove`])])),e.hasCellEditButtons?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,uu,[(0,t.createVNode)(f,{nested:``,schema:e.schema,formSchema:e.getItemFormSchema(e.schema,n,e.context),dataPath:e.getDataPath(r),data:n,meta:e.nestedMeta,store:e.getItemStore(n),disabled:e.disabled||e.isLoading,deletable:e.deletable,draggable:e.draggable,editable:e.editable,editPath:e.getEditPath(n,r),onDelete:t=>e.deleteItem(n,r),onMove:t=>e.moveItem(n,t)},null,8,[`schema`,`formSchema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`onDelete`,`onMove`])])):(0,t.createCommentVNode)(``,!0)],8,cu))),128))]),_:1},8,[`options`,`draggable`,`modelValue`]),e.hasListButtons&&!e.single?((0,t.openBlock)(),(0,t.createElementBlock)(`tfoot`,du,[(0,t.createElementVNode)(`tr`,null,[(0,t.createElementVNode)(`td`,{class:`dito-table__buttons`,colspan:e.numColumns},[(0,t.createVNode)(f,(0,t.mergeProps)(e.listButtonsAttributes,{data:e.data}),null,16,[`data`])],8,fu)])])):(0,t.createCommentVNode)(``,!0)],2),e.hasListButtons&&e.single?((0,t.openBlock)(),(0,t.createBlock)(f,(0,t.mergeProps)({key:1,class:`dito-buttons--large dito-buttons--main dito-buttons--sticky`},e.listButtonsAttributes,{data:e.listData}),null,16,[`data`])):(0,t.createCommentVNode)(``,!0)],8,au)):(0,t.createCommentVNode)(``,!0)}var mu=G(X.register(`list`,{mixins:[$,dc],components:{DitoSourceItem:Hl},getSourceType(e){return e},getPanelSchema(e,n,r,i){let{filters:a}=n;if(a)return Xl(e,a,r,(0,t.computed)({get(){return i.query},set({page:e,...t}){i.listQuery.update(t,{resetPage:!0})}}))},computed:{hasPagination(){return!!this.paginate},hasListButtons(){return!!(this.buttonSchemas||this.creatable)},listButtonsAttributes(){return{buttons:this.buttonSchemas,schema:this.schema,dataPath:this.dataPath,meta:this.meta,store:this.store,nested:this.nested,disabled:this.disabled||this.isLoading,creatable:this.creatable,createPath:this.createPath}},hasEditButtons(){let{listData:e}=this;return e.length>0&&(this.editable||this.deletable||this.draggable)},hasCellEditButtons(){return!this.isInlined&&this.hasEditButtons},hasEvenCount(){return!(this.listData.length%2)},numColumns(){return(this.columns?Object.keys(this.columns).length:1)+ +!!this.hasCellEditButtons}},methods:{getDataPath(e){return b(this.dataPath,e)},getComponentPath(e){return b(this.componentPath,e)},getEditPath(e,t){if(this.editable){let n=this.getItemId(this.schema,e,t);return Wt(this.schema,n,this.context)||`${this.path}/${n}`}return null},moveItem(e,t){let n=fc(this.listData,e,t);n&&(this.listData=n,this.onChange())},getCellClass(e){return`dito-cell--${(0,i.hyphenate)(e.name)}`},onFilterErrors(e){let t=b(this.dataPath,`$filters`),n=this.schemaComponent.getPanelByDataPath(t);if(n)return n.showValidationErrors($l(e),!0),!0}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Xn(t),Zn(t.columns),$.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,pu]]);function hu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoLabel`);return(0,t.openBlock)(),(0,t.createBlock)(s,{class:`dito-label-component`,label:e.value},null,8,[`label`])}var gu=G(X.register(`label`,{excludeValue:!0,generateLabel:!1}),[[`render`,hu]]),_u=[`id`],vu={key:0,class:`dito-buttons dito-buttons--toolbar`},yu={class:`dito-buttons__group`};function bu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoIcon`),c=(0,t.resolveComponent)(`DitoButton`),l=(0,t.resolveComponent)(`EditorContent`),u=(0,t.resolveComponent)(`DitoResizeHandle`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`dito-markup`,id:e.componentPath},[e.groupedButtons.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vu,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.groupedButtons,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,yu,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,({id:e,label:n,icon:r,isActive:i,onClick:a})=>((0,t.openBlock)(),(0,t.createBlock)(c,{key:e,class:(0,t.normalizeClass)({"dito-button--active":i}),"aria-label":n,"aria-pressed":i,onClick:a},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{name:r},null,8,[`name`])]),_:2},1032,[`class`,`aria-label`,`aria-pressed`,`onClick`]))),128))]))),256))])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(l,{class:`dito-markup-editor`,ref:`editor`,editor:e.editor,style:(0,t.normalizeStyle)(e.styles)},null,8,[`editor`,`style`]),e.resizable?((0,t.openBlock)(),(0,t.createBlock)(u,{key:1,getElement:()=>e.$refs.editor.$el,onResize:n[0]||=t=>e.height=`${t}px`},null,8,[`getElement`])):(0,t.createCommentVNode)(``,!0)],8,_u)}var xu=X.register(`markup`,{components:{EditorContent:f.EditorContent,DitoButton:K,DitoIcon:Mi,DitoResizeHandle:yl},data(){return{editor:null,height:null}},computed:{lines(){return this.schema.lines||10},hardBreak(){return!!this.schema.hardBreak},styles(){return{height:this.height||`calc(${this.lines}em * var(--line-height))`}},markButtons(){return this.getButtons(`marks`,{bold:!0,italic:!0,underline:!0,strike:!0,small:!0,code:!0,subscript:!0,superscript:!0,link:{onClick:e=>this.onClickLink(e)}})},basicNodeButtons(){return this.getButtons(`nodes`,{paragraph:{command:`setParagraph`},heading:{attribute:`level`,values:[1,2,3,4,5,6]}})},advancedNodeButtons(){return this.getButtons(`nodes`,{bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0})},toolButtons(){return this.getButtons(`tools`,{undo:!0,redo:!0,footnotes:{command:`addFootnote`}})},groupedButtons(){return[this.markButtons,this.basicNodeButtons,this.advancedNodeButtons,this.toolButtons].filter(e=>e.length>0)},parseOptions(){return{preserveWhitespace:{collapse:!1,preserve:!0,"preserve-all":`full`}[this.whitespace]}},editorOptions(){return{editable:!this.readonly&&!this.disabled,autofocus:this.autofocus,enableInputRules:this.enableRules.input,enablePasteRules:this.enableRules.paste,parseOptions:this.parseOptions,editorProps:this.hardBreak?{handlePaste:(e,t,n)=>{let r=[];n.content.forEach((t,n,i)=>{i>0&&t.type.name===`paragraph`&&r.push(e.state.schema.nodes.hardBreak.create()),t.type.name===`paragraph`?t.content.forEach(e=>r.push(e)):r.push(t)});let i=e.state.schema.nodes.paragraph.create(null,p.Fragment.from(r));return e.dispatch(e.state.tr.replaceSelection(new p.Slice(p.Fragment.from(i),0,0))),!0}}:{}}},resizable:R(`resizable`,{type:Boolean,default:!1}),whitespace:R(`whitespace`,{type:String,default:`collapse`}),enableRules:R(`enableRules`,{type:[Object,Boolean],default:!1,get(e){return(0,i.isObject)(e)?e:{input:!!e,paste:!!e}}})},watch:{readonly:`updateEditorOptions`,disabled:`updateEditorOptions`,autofocus:`updateEditorOptions`,enableRules:`updateEditorOptions`},created(){let e=!1,t=pl({isEditing:()=>this.focused,emitChange:()=>this.onChange()}),n=()=>this.onFocus(),r=()=>{s(),this.onBlur(),t.emitIfDone()},a=()=>{o(),this.onInput()},o=(0,i.debounce)(()=>s(),100);this.writePendingValue=()=>{o.cancel()&&s()};let s=()=>{let n=this.editor.getHTML(),r=this.hardBreak?n.replace(/^<p>(.*?)<\/p>$/s,`$1`):n;r!==this.value&&(t.markEdited(),e=!0,this.value=r),t.emitIfDone()};this.$watch(`value`,t=>{if(e)e=!1;else{let e=this.hardBreak?`<p>${t??``}</p>`:t??``;this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:this.parseOptions})}}),this.editor=new f.Editor({...this.editorOptions,onFocus:n,onBlur:r,onUpdate:a,extensions:this.getExtensions(),content:this.value||``})},beforeUnmount(){this.writePendingValue()},unmounted(){this.editor.destroy()},methods:{updateEditorOptions(){this.editor.setOptions(this.editorOptions)},async onClickLink(e){let t=await this.showDialog({components:{href:{type:`url`,label:`Link`,autofocus:!0},title:{type:`text`,label:`Title`}},buttons:{cancel:{},apply:{type:`submit`},remove:{events:{click({dialogComponent:e}){e.resolve(null)}}}},data:(0,f.getMarkAttributes)(this.editor.state,`link`)});if(t){let{href:n,title:r}=t;if(n)try{new URL(n)}catch{n=`https://${n}`}e.commands.setLink({href:n,title:r})}else t===null&&e.commands.unsetLink()},getExtensions(){let{marks:e={},nodes:t={},tools:n={}}=this.schema;return[n.footnotes?m.Document.extend({content:`block+ footnotes?`}):m.Document,h.Text,le.Paragraph,e.bold&&g.Bold,e.italic&&v.Italic,e.underline&&ie.Underline,e.strike&&te.Strike,e.small&&Su,e.code&&_.Code,e.subscript&&ne.Subscript,e.superscript&&re.Superscript,e.link&&Cu,t.blockquote&&ae.Blockquote,t.codeBlock&&oe.CodeBlock,t.heading&&ce.Heading.configure({levels:t.heading}),t.horizontalRule&&ue.HorizontalRule,(t.orderedList||t.bulletList)&&pe.ListItem,t.bulletList&&fe.BulletList,t.orderedList&&de.OrderedList,...n.footnotes?[me.Footnotes,me.Footnote,me.FootnoteReference]:[],n.history&&he.History,se.HardBreak.extend({addKeyboardShortcuts:()=>{let e=()=>this.editor.commands.setHardBreak();return{"Mod-Enter":e,"Shift-Enter":e,...this.hardBreak?{Enter:e}:null}}})].filter(e=>!!e)},getButtons(e,t){let n=[],{commands:r}=this.editor,a=({name:e,id:t=e,label:a=this.labelize(t),icon:o,command:s,attributes:c,onClick:l})=>{n.push({id:t,label:a,icon:o,isActive:this.editor.isActive(e,c),onClick:()=>{s??=e in r?e:`toggle${(0,i.camelize)(e,!0)}`,s in r&&(l?l(this.editor,c):(e=>this.editor.chain()[s](e).focus().run())(c))}})},o=this.schema[e];if(o)for(let[e,n]of Object.entries(t)){let t=o[[`undo`,`redo`].includes(e)?`history`:e],r=(0,i.hyphenate)(e);if(t){if(n===!0)a({name:e,icon:r});else if((0,i.isObject)(n)){let{command:o,attribute:s,values:c,onClick:l}=n;if(s){if((0,i.isArray)(c)&&(0,i.isArray)(t))for(let n of c)t.includes(n)&&a({name:e,id:`${e}-${n}`,icon:`${r}-${n}`,command:o,attributes:{[s]:n},onClick:l})}else a({name:e,icon:r,command:o,onClick:l})}}}return n},focusElement(){this.editor.commands.focus()},blurElement(){this.editor.commands.blur()}}}),Su=f.Mark.create({name:`small`,parseHTML(){return[{tag:`small`}]},renderHTML(){return[`small`,0]},addCommands(){return{setSmall:e=>({commands:t})=>t.setMark(this.name,e),toggleSmall:e=>({commands:t})=>t.toggleMark(this.name,e),unsetSmall:()=>({commands:e})=>e.unsetMark(this.name)}}}),Cu=ee.Link.extend({inclusive:!1,addAttributes(){return{href:{default:null},title:{default:null}}},parseHTML(){return[{tag:`a`,getAttrs:e=>({href:e.getAttribute(`href`),title:e.getAttribute(`title`)})}]},renderHTML({HTMLAttributes:e}){return[`a`,e,0]}}),wu=G(xu,[[`render`,bu]]),Tu={class:`dito-multiselect`},Eu={class:`dito-multiselect__inner`},Du=[`title`],Ou=[`onKeydown`,`onMousedown`];function ku(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInputAffixes`),c=(0,t.resolveComponent)(`VueMultiselect`),l=(0,t.resolveComponent)(`DitoOptionsEditButtons`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,Tu,[(0,t.createElementVNode)(`div`,Eu,[(0,t.createVNode)(s,(0,t.mergeProps)({position:`prefix`},e.inputAffixesProps.prefix,{absolute:``}),null,16),(0,t.createVNode)(c,(0,t.mergeProps)({id:e.componentPath,ref:`element`,modelValue:e.selectedOptions,"onUpdate:modelValue":n[1]||=t=>e.selectedOptions=t,"aria-label":e.label,class:e.multiselectClasses,showLabels:!1,placeholder:e.placeholder,tagPlaceholder:`Press enter to add new tag`,options:e.populate&&e.activeOptions||[],customLabel:e.getLabelForOption,trackBy:e.optionValue,groupLabel:e.groupByLabel,groupValues:e.groupByOptions,multiple:e.multiple,taggable:e.taggable,searchable:e.searchable,internalSearch:!e.searchFilter,preserveSearch:!!e.searchFilter,clearOnSelect:!e.searchFilter,closeOnSelect:!e.stayOpen,loading:e.isLoadingOptions||e.isLoadingSearchedOptions},e.attributes,{onOpen:e.onOpen,onClose:e.onClose,onTag:e.onAddTag,onSearchChange:e.onSearchChange}),{tag:(0,t.withCtx)(({option:r,remove:i})=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`multiselect__tag dito-multiselect__tag`,{"dito-multiselect__tag--unavailable":e.isUnavailableOption(r)}]),title:e.isUnavailableOption(r)?`Not among the options`:null,onMousedown:n[0]||=(0,t.withModifiers)(()=>{},[`prevent`])},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.getLabelForOption(r)),1),(0,t.createElementVNode)(`i`,{class:`multiselect__tag-icon`,tabindex:`0`,onKeydown:(0,t.withKeys)((0,t.withModifiers)(e=>i(r),[`prevent`]),[`enter`]),onMousedown:(0,t.withModifiers)(e=>i(r),[`prevent`])},null,40,Ou)],42,Du)]),_:1},16,[`id`,`modelValue`,`aria-label`,`class`,`placeholder`,`options`,`customLabel`,`trackBy`,`groupLabel`,`groupValues`,`multiple`,`taggable`,`searchable`,`internalSearch`,`preserveSearch`,`clearOnSelect`,`closeOnSelect`,`loading`,`onOpen`,`onClose`,`onTag`,`onSearchChange`]),(0,t.createVNode)(s,(0,t.mergeProps)({position:`suffix`},e.inputAffixesProps.suffix,{absolute:``,onClear:e.clear}),null,16,[`onClear`])]),e.editable?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,parentContext:e.context,optionValue:e.selectedValue},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`parentContext`,`optionValue`])):(0,t.createCommentVNode)(``,!0)])}var Au=G(X.register(`multiselect`,{mixins:[$c],components:{DitoInputAffixes:Z,DitoOptionsEditButtons:cl,VueMultiselect:ge.default},data(){return{searchedOptions:null,isLoadingSearchedOptions:!1,currentSearchTerm:null,addedTagOptions:[],populate:!1}},computed:{inputAffixesProps(){return Q(this)},selectedOptions:{get(){return this.multiple?(0,i.isArray)(this.value)&&(this.hasOptions||this.taggable&&!this.isLoadingOptions)?this.value.map(e=>{let t=this.relate?this.getValueForOption(e):e;return this.getOptionForValue(t)||this.getFallbackOption(e)}):[]:this.selectedOption},set(e){this.selectedValue=this.multiple?(e||[]).map(e=>this.getValueForOption(e)):this.getValueForOption(e),this.onChange()}},options(){let e=$c.computed.options.call(this),t=this.groupBy?[]:this.addedTagOptions.filter(t=>!this.isOptionAmong(t,e));return t.length>0?[...e,...t]:e},activeOptions(){return this.searchedOptions||this.options},multiple:R(`multiple`,{type:Boolean,default:!1}),searchable:R(`searchable`,{type:Boolean,default:!1}),taggable:R(`taggable`,{type:Boolean,default:!1}),stayOpen:R(`stayOpen`,{type:Boolean,default:!1}),multiselectClasses(){let e=`multiselect`;return{[`${e}--multiple`]:this.multiple,[`${e}--loading`]:this.isLoadingOptions||this.isLoadingSearchedOptions,[`${e}--highlight`]:this.showHighlight}},placeholder(){let{placeholder:e,searchable:t,taggable:n}=this.schema;(0,i.isBoolean)(e)&&(e=e?void 0:null);let{label:r}=this;return e===void 0?t&&n?r?`Search or add a ${r}`:`Search or add`:t?r?`Select or search ${r}`:`Select or search`:void 0:e},showHighlight(){return this.isMounted&&this.$refs.element.pointerDirty}},mounted(){this.autofocus&&this.focus()},methods:{createTagOption(e){let{optionLabel:t,optionValue:n}=this;return t&&n?{[t]:e,[n]:e}:e},isOptionAmong(e,t){let n=this.getValueForOption(e);return t.some(e=>this.getValueForOption(e)===n)},isUnavailableOption(e){return!this.taggable&&(this.optionValue?!this.getOptionForValue(this.getValueForOption(e)):!this.options.includes(e))},getFallbackOption(e){let{optionValue:t,optionLabel:n}=this;return(0,i.isObject)(e)||!(0,i.isString)(t)?e:{[t]:e,...(0,i.isString)(n)&&{[n]:`${e}`}}},focusElement(){this.$refs.element.activate()},blurElement(){this.$refs.element.deactivate()},onOpen(){this.populate=!0},onClose(){this.focused&&this.onBlur()},onBlur(){this.$refs.element.isOpen||Gn.methods.onBlur.call(this)},onAddTag(e){if(this.taggable){let t=this.createTagOption(e);this.addedTagOptions.push(t),this.selectedOptions=this.multiple?[...this.selectedOptions,t]:t}},async loadSearchedOptions(e){try{return await this.optionsResolver.waitForValue(),await this.searchFilter(new D(this,{searchTerm:e}))}catch(e){return this.addError(e.message||e),null}},async onSearchChange(e){if(this.searchFilter){if(this.currentSearchTerm=e,e){this.searchedOptions=[];let t=setTimeout(()=>{this.isLoadingSearchedOptions=!0},0),n=await this.loadSearchedOptions(e);clearTimeout(t),e===this.currentSearchTerm&&(this.searchedOptions=n,this.isLoadingSearchedOptions=!1)}else this.searchedOptions=null,this.isLoadingSearchedOptions=!1}}}}),[[`render`,ku]]),ju={getTypeValidations(e,t){let n=e.type===`integer`,r=n=>N(n,{type:Number,schema:e,context:t}),i=(e,t)=>n&&e!=null?t(e):e,a=N(`range`,{type:Array,schema:e,context:t}),o=i(r(`min`)??a?.[0],Math.floor),s=i(r(`max`)??a?.[1],Math.ceil),c=i(r(`step`),Math.ceil),l=r(`decimals`),u={};if(o!=null&&s!=null?u.range=[o,s]:(o!=null&&(u.min=o),s!=null&&(u.max=s)),l!=null)u.decimals=l;else if(c){let e=(`${c}`.split(`.`)[1]||``).length;e>0?u.decimals=e:u.integer=!0}return n&&(u.integer=!0),u},computed:{inputValue:{get(){return this.value===null?``:this.value},set(e){this.value=e===``?null:this.isInteger?Number(e):parseFloat(e)}},isInteger(){return!1},stepValue(){return this.step==null&&!this.isInteger?`any`:this.step},decimals:R(`decimals`,{type:Number}),step:R(`step`,{type:Number,get(e){return this.isInteger&&e!=null?Math.ceil(e):e}}),min:R(`min`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[0]:e,this.isInteger&&e!=null?Math.floor(e):e}}),max:R(`max`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[1]:e,this.isInteger&&e!=null?Math.ceil(e):e}}),range:R(`range`,{type:Array,get(){let{min:e,max:t}=this;return e!=null&&t!=null?[e,t]:void 0},set(e){(0,i.isArray)(e)&&([this.min,this.max]=e)}})}};function Mu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInputAffixes`),c=(0,t.resolveComponent)(`DitoInput`);return(0,t.openBlock)(),(0,t.createBlock)(c,(0,t.mergeProps)({class:`dito-number`,id:e.componentPath,ref:`element`,modelValue:e.inputValue,"onUpdate:modelValue":n[0]||=t=>e.inputValue=t,type:`number`},e.attributes,{min:e.min,max:e.max,step:e.stepValue}),{prefix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`prefix`},e.inputAffixesProps.prefix),null,16)]),suffix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`suffix`},e.inputAffixesProps.suffix,{onClear:e.clear}),null,16,[`onClear`])]),_:1},16,[`id`,`modelValue`,`min`,`max`,`step`])}var Nu=G(X.register([`number`,`integer`],{mixins:[ju],components:{DitoInput:Ai,DitoInputAffixes:Z},nativeField:!0,textField:!0,computed:{inputAffixesProps(){return Q(this)},isInteger(){return this.type===`integer`}}}),[[`render`,Mu]]),Pu=[`id`],Fu={key:0,class:`dito-object-content`};function Iu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoSourceItem`),c=(0,t.resolveComponent)(`DitoEditButtons`);return e.isReady?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`dito-object`,id:e.componentPath},[e.objectData?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fu,[(0,t.createVNode)(s,{schema:e.schema,dataPath:e.dataPath,data:e.objectData,meta:e.nestedMeta,store:e.store,disabled:e.disabled||e.isLoading,collapsed:e.collapsed,collapsible:e.collapsible,deletable:e.deletable,onDelete:n[0]||=t=>e.deleteItem(e.objectData)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`])])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(c,{buttons:e.buttonSchemas,schema:e.schema,dataPath:e.dataPath,data:e.objectData,meta:e.meta,store:e.store,disabled:e.disabled||e.isLoading,creatable:e.creatable,createPath:e.createPath,editable:e.editable,editPath:e.path,deletable:!e.isInlined&&e.deletable,onDelete:n[1]||=t=>e.deleteItem(e.objectData)},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`creatable`,`createPath`,`editable`,`editPath`,`deletable`])],8,Pu)):(0,t.createCommentVNode)(``,!0)}var Lu=G(X.register(`object`,{mixins:[$],components:{DitoSourceItem:Hl},getSourceType(e){return e},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Xn(t),$.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,Iu]]),Ru=X.register(`panel`,{defaultNested:!1,generateLabel:!1,omitSpacing:!0,getPanelSchema(e,t){return t},async processSchema(e,t,n,r,i){await B(e,t,r,i)},render(){return null}}),zu=[`id`,`value`,`max`];function Bu(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`progress`,(0,t.mergeProps)({class:`dito-progress`,id:e.componentPath,ref:`element`,value:e.progressValue,max:e.progressMax},e.attributes),null,16,zu)}var Vu=G(X.register(`progress`,{mixins:[ju],computed:{progressValue(){let{value:e,range:t,step:n}=this;return e===null?e=``:(t&&(e-=t[0]),n&&(e=Math.round(e/n)*n)),e},progressMax(){let{range:e}=this;return e?e[1]-e[0]:null}}}),[[`render`,Bu]]),Hu=[`value`];function Uu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoOptionsEditButtons`),c=(0,t.resolveComponent)(`DitoOptionList`);return(0,t.openBlock)(),(0,t.createBlock)(c,{class:`dito-radio-buttons`,id:e.componentPath,role:`radiogroup`,"aria-label":e.label,options:e.options,isGrouped:!!e.groupBy,layout:e.schema.layout},{option:(0,t.withCtx)(({option:r,isFirstOption:i})=>[(0,t.createElementVNode)(`label`,null,[(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({class:`dito-radio-button`,ref:i?`element`:void 0,"onUpdate:modelValue":n[0]||=t=>e.selectedValue=t,type:`radio`,value:e.getValueForOption(r)},e.attributes),null,16,Hu),[[t.vModelRadio,e.selectedValue]]),(0,t.createTextVNode)((0,t.toDisplayString)(e.getLabelForOption(r)),1)]),e.editable?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,parentContext:e.context,optionValue:e.getValueForOption(r)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`parentContext`,`optionValue`])):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`id`,`aria-label`,`options`,`isGrouped`,`layout`])}var Wu=G(X.register(`radio`,{mixins:[$c],components:{DitoOptionList:ol,DitoOptionsEditButtons:cl},nativeField:!0,defaultWidth:`auto`}),[[`render`,Uu]]);function Gu(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoSchemaInlined`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-section`,{"dito-section--labelled":e.hasLabel}])},[(0,t.createVNode)(s,{class:`dito-section__schema`,schema:e.getItemFormSchema(e.schema,e.item,e.context),dataPath:e.dataPath,data:e.item,meta:e.meta,store:e.store,label:e.label,info:e.info,padding:e.hasLabel?`nested`:`inlined`,disabled:e.disabled,collapsed:e.collapsed,collapsible:e.collapsible},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`collapsed`,`collapsible`])],2)}var Ku=G(X.register(`section`,{mixins:[rs],defaultValue:({schema:e})=>e.nested?{}:void 0,ignoreMissingValue:({schema:e})=>!e.nested&&!(`default`in e),treatNullAsMissing:({schema:e})=>!!e.nested,defaultNested:!1,generateLabel:!1,rendersOwnLabel:e=>!ut(j(e.schema,e.nested?e.value:e.item,e)),computed:{item(){return this.nested?this.value:this.data},hasLabel(){return!!this.schema.label},collapsible:R(`collapsible`,{type:Boolean,default:!1}),collapsed:R(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}})},methods:{getItemFormSchema:j,async navigateToComponent(e,t,n){let{mainSchemaComponent:r}=this,a=this.dataPath?`${this.dataPath}/`:``,o=(0,i.normalizeDataPath)(e),s=o.startsWith(a)?(0,i.parseDataPath)(o.slice(a.length))[0]:null;return!!r&&tt(r.schema,s)&&r.navigateToComponent(e,t,n)}},async processSchema(e,t,n,r,i){await B(e,t,r,i)}}),[[`render`,Gu]]),qu={class:`dito-select`},Ju={class:`dito-select__inner`},Yu=[`id`],Xu=[`value`],Zu=[`label`],Qu=[`value`],$u=[`value`],ed=[`value`];function td(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInputAffixes`),c=(0,t.resolveComponent)(`DitoOptionsEditButtons`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,qu,[(0,t.createElementVNode)(`div`,Ju,[(0,t.createVNode)(s,(0,t.mergeProps)({position:`prefix`},e.inputAffixesProps.prefix,{absolute:``}),null,16),(0,t.withDirectives)((0,t.createElementVNode)(`select`,(0,t.mergeProps)({id:e.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=t=>e.selectedValue=t},e.attributes,{onMousedown:n[1]||=t=>e.populate=!0,onFocus:n[2]||=t=>e.populate=!0}),[e.populate?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[e.shouldShowUnavailableValue?((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:0,value:e.selectedValue,disabled:``},(0,t.toDisplayString)(e.getLabelForOption(e.selectedValue))+` (unavailable)`,9,Xu)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.options,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.groupBy?((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,{key:0,label:n[e.groupByLabel]},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(n[e.groupByOptions],n=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{value:e.getValueForOption(n)},(0,t.toDisplayString)(e.getLabelForOption(n)),9,Qu))),256))],8,Zu)):((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:1,value:e.getValueForOption(n)},(0,t.toDisplayString)(e.getLabelForOption(n)),9,$u))],64))),256))],64)):e.selectedOption?((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:1,value:e.selectedValue},(0,t.toDisplayString)(e.getLabelForOption(e.selectedOption)),9,ed)):(0,t.createCommentVNode)(``,!0)],16,Yu),[[t.vModelSelect,e.selectedValue]]),(0,t.createVNode)(s,(0,t.mergeProps)({position:`suffix`},e.inputAffixesProps.suffix,{absolute:``,onClear:e.clear}),null,16,[`onClear`])]),e.editable?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,schema:e.schema,dataPath:e.dataPath,data:e.data,meta:e.meta,store:e.store,parentContext:e.context,optionValue:e.selectedValue},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`parentContext`,`optionValue`])):(0,t.createCommentVNode)(``,!0)])}var nd=G(X.register(`select`,{mixins:[$c],components:{DitoInputAffixes:Z,DitoOptionsEditButtons:cl},nativeField:!0,data(){return{populate:!0}},computed:{inputAffixesProps(){return Q(this)},shouldShowUnavailableValue(){let{selectedValue:e}=this;return e!=null&&typeof e!=`object`&&this.hasOptions&&!this.findOptionForValue(e)}}}),[[`render`,td]]),rd={class:`dito-slider`},id=[`id`,`min`,`max`,`step`];function ad(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInput`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,rd,[(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({class:`dito-range`,id:e.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=t=>e.inputValue=t,type:`range`},e.attributes,{min:e.min,max:e.max,step:e.stepValue}),null,16,id),[[t.vModelText,e.inputValue]]),e.input?((0,t.openBlock)(),(0,t.createBlock)(s,(0,t.mergeProps)({key:0,class:`dito-number`,modelValue:e.inputValue,"onUpdate:modelValue":n[1]||=t=>e.inputValue=t,type:`number`},e.attributes,{name:null,"aria-label":e.numberInputLabel,min:e.min,max:e.max,step:e.stepValue}),null,16,[`modelValue`,`aria-label`,`min`,`max`,`step`])):(0,t.createCommentVNode)(``,!0)])}var od=G(X.register(`slider`,{mixins:[ju],components:{DitoInput:Ai},nativeField:!0,computed:{input:R(`input`,{type:Boolean,default:!0}),numberInputLabel(){return`${this.label||this.labelize(this.name)} Value`}}}),[[`render`,ad]]);function sd(e,t,n,r,i,a){return null}var cd=G(X.register(`spacer`,{defaultValue:()=>void 0,excludeValue:!0,generateLabel:!1}),[[`render`,sd]]);function ld(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoSwitch`);return(0,t.openBlock)(),(0,t.createBlock)(s,(0,t.mergeProps)({class:`dito-switch`,id:e.componentPath,ref:`element`,modelValue:e.value,"onUpdate:modelValue":n[0]||=t=>e.value=t,labels:e.labels},e.attributes),null,16,[`id`,`modelValue`,`labels`])}var ud=G(X.register(`switch`,{defaultValue:!1,defaultWidth:`auto`,components:{DitoSwitch:pa},computed:{labels(){return this.schema.labels}}}),[[`render`,ld]]),dd={computed:{trim:R(`trim`,{type:Boolean,default:!1})},processValue(e){let{schema:t,value:n}=e;return t.trim&&n!=null&&(0,i.isString)(n)&&(n=n.trim()),n===``&&(n=en(t,e)),n}};function fd(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoInputAffixes`),c=(0,t.resolveComponent)(`DitoInput`);return(0,t.openBlock)(),(0,t.createBlock)(c,(0,t.mergeProps)({class:`dito-text`,id:e.componentPath,ref:`element`,modelValue:e.inputValue,"onUpdate:modelValue":n[0]||=t=>e.inputValue=t,type:e.inputType},e.attributes),{prefix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`prefix`},e.inputAffixesProps.prefix),null,16)]),suffix:(0,t.withCtx)(()=>[(0,t.createVNode)(s,(0,t.mergeProps)({position:`suffix`},e.inputAffixesProps.suffix,{onClear:e.clear}),null,16,[`onClear`])]),_:1},16,[`id`,`modelValue`,`type`])}var pd=`****************`,md=G(X.register([`text`,`email`,`url`,`hostname`,`domain`,`tel`,`password`,`creditcard`],{mixins:[dd],components:{DitoInput:Ai,DitoInputAffixes:Z},nativeField:!0,textField:!0,ignoreMissingValue:({schema:e})=>e.type===`password`,getTypeValidations(e){let t={email:`email`,url:`url`,hostname:`hostname`,domain:`domain`,password:`password`,creditcard:`creditcard`}[e.type];return t?{[t]:!0}:{}},computed:{inputAffixesProps(){return Q(this)},inputType(){return{creditcard:`text`,hostname:`text`,domain:`text`}[this.type]||this.type},inputValue:{get(){return this.type===`password`&&this.value===void 0&&!this.focused?pd:this.value},set(e){this.value=e}}}}),[[`render`,fd]]),hd=[`id`,`rows`];function gd(e,n,r,i,a,o){return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`textarea`,(0,t.mergeProps)({class:`dito-textarea dito-input`,id:e.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=t=>e.value=t},e.attributes,{rows:e.lines,class:{"dito-textarea--resizable":e.resizable}}),null,16,hd)),[[t.vModelText,e.value]])}var _d=G(X.register(`textarea`,{mixins:[dd],nativeField:!0,textField:!0,computed:{lines(){return this.schema.lines||4},resizable:R(`resizable`,{type:Boolean,default:!1})}}),[[`render`,gd]]),vd={class:`dito-tree-list`},yd={class:`dito-tree-panel`},bd={key:1,class:`dito-tree-form-container`};function xd(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`DitoScopes`),c=(0,t.resolveComponent)(`DitoTreeItem`),l=(0,t.resolveComponent)(`DitoRouterView`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,vd,[e.scopes?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,query:e.query,scopes:e.scopes},null,8,[`query`,`scopes`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,yd,[e.treeData?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,schema:e.treeSchema,dataPath:e.treeDataPath,data:e.treeData,draggable:e.draggable,open:!0,onChangeChildren:e.changeChildren},null,8,[`schema`,`dataPath`,`data`,`draggable`,`onChangeChildren`])):(0,t.createCommentVNode)(``,!0),e.editPath&&e.hasEditableForms?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bd,[(0,t.createVNode)(l,{routeLevel:e.routeComponent.routeLevel+1},null,8,[`routeLevel`])])):(0,t.createCommentVNode)(``,!0)])])}var Sd=G(X.register([`tree-list`,`tree-object`],{mixins:[$],getSourceType(e){return e===`tree-object`?`object`:`list`},computed:{path(){return this.formComponent?.path},editPath(){let e=this.$route.path.slice(this.path?.length);return U(e,`/${this.schema.path}`)?e:``},treeData(){return this.isListSource?{[this.name]:this.value}:this.value},treeDataPath(){return this.isListSource?Ae(this.dataPath):this.dataPath},treeSchema(){return this.isListSource?{children:{name:this.name,...this.schema}}:this.schema},hasEditableForms(){let e=t=>k(t)&&(this.getSchemaValue(`editable`,{type:Boolean,default:!1,schema:t})||t.children&&e(t.children));return e(this.schema)}},methods:{changeChildren({data:e,childrenSchema:t,path:n,children:r}){let i=e[t.name];_n(t,r),e===this.treeData&&this.isListSource?this.value=r:e[t.name]=r,this.followEditedChild({childrenPath:t.path&&`${n}/${t.path}`,previousChildren:i,children:r}),this.onChange()},followEditedChild({childrenPath:e,previousChildren:t,children:n}){let r=`${e}/`,{editPath:i}=this;if(e&&i.startsWith(r)){let[e,...a]=i.slice(r.length).split(`/`),o=n.indexOf(t?.[e]);if(o!==+e){let e=o>=0?[`${this.path}${r}${o}`,...a].join(`/`):this.path;this.$router.push({path:e,query:this.$route.query})}}}},async processSchema(e,t,n,r,i,a=!0,o=!1,s=null){await Promise.all([Zn(t.properties),$.processSchema(e,t,n,r,i,a,o,(n,r)=>{let{children:i}=t;if(i)return i.type=`tree-list`,this.processSchema(e,i,i.name,n,r,a,!0,s)})])},getFormSchemasForProcessing(e,t){let{children:n}=e;return A(e,t,n?e=>({...e,components:{...e.components,[n.name]:n}}):null)}}),[[`render`,xd]]),Cd=[``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function wd(e,{base:t=10}={}){let n=Ed(t),r=Math.abs(e),i=Math.min(r>=1?Math.floor(Math.log(r)/Math.log(n)):0,Cd.length-1),a=Dd(r,n,i);a>=n&&i<Cd.length-1&&(a=Dd(r,n,++i));let o=Cd[i],s=o?t===10?`${o}B`:`${o.toUpperCase()}iB`:`B`;return`${e<0?`-`:``}${a} ${s}`}function Td(e,{base:t=10}={}){let[,n,r]=String(e).match(/^([\d.,]*)\s*(\D*)$/)||[],i=parseFloat(n?.replace(`,`,`.`));if(!isFinite(i))throw Error(`Can't interpret file size: ${e}`);let a=Ed(/^[kmgtpezy]ib?$/i.test(r)?2:t),o=r.replace(/^bits?$/,`b`).match(/^([KMGTPEZY]?)b$/);if(o){let e=Cd.indexOf(o[1].replace(`K`,`k`));return Math.round(i*a**e/8)}let s=Cd.findIndex(e=>e.toLowerCase()===r.toLowerCase().replace(/^(bytes?|b)$/,``).replace(/^(\w)(i?b|i)$/,`$1`));if(s>=0)return Math.round(i*a**s);throw Error(`Invalid file size unit: ${r}`)}function Ed(e){return e===10?1e3:1024}function Dd(e,t,n){let r=n>0?100:1;return Math.round(e/t**n*r)/r}var Od={class:`dito-table dito-table--separators dito-table--background`},kd=[`innerHTML`],Ad={key:1},jd=[`download`,`href`,`onClick`],Md={key:2},Nd={class:`dito-upload__size`},Pd={class:`dito-upload__status`},Fd={class:`dito-table__buttons`},Id={class:`dito-buttons dito-buttons--round`},Ld={key:0},Rd={colspan:4},zd={class:`dito-upload__footer`},Bd=[`value`],Vd={class:`dito-buttons dito-buttons--round`};function Hd(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`VueUpload`),c=(0,t.resolveComponent)(`DitoUploadFile`),l=(0,t.resolveComponent)(`DitoButton`),u=(0,t.resolveComponent)(`DitoDragHandle`),d=(0,t.resolveComponent)(`DitoDraggable`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`dito-upload`,{"dito-upload--drop-target":e.isDropTarget}]),ref:`dropTarget`},[(0,t.createVNode)(s,{class:`dito-upload__input`,ref:`upload`,modelValue:e.uploads,"onUpdate:modelValue":n[0]||=t=>e.uploads=t,inputId:e.dataPath,name:e.dataPath,disabled:e.disabled,postAction:e.uploadPath,headers:e.uploadOptions?.headers,extensions:e.extensions,accept:e.accept,multiple:e.multiple,size:e.maxSize,drop:!0,dropDirectory:!0,onInputFilter:e.onInputFilter,onInputFile:e.onInputFile},null,8,[`modelValue`,`inputId`,`name`,`disabled`,`postAction`,`headers`,`extensions`,`accept`,`multiple`,`size`,`onInputFilter`,`onInputFile`]),(0,t.createElementVNode)(`table`,Od,[n[4]||=(0,t.createElementVNode)(`thead`,{class:`dito-table-head`},[(0,t.createElementVNode)(`tr`,null,[(0,t.createElementVNode)(`th`,{scope:`col`},[(0,t.createElementVNode)(`span`,null,`File`)]),(0,t.createElementVNode)(`th`,{scope:`col`},[(0,t.createElementVNode)(`span`,null,`Size`)]),(0,t.createElementVNode)(`th`,{scope:`col`},[(0,t.createElementVNode)(`span`,null,`Status`)]),(0,t.createElementVNode)(`th`,{scope:`col`},[(0,t.createElementVNode)(`span`)])])],-1),(0,t.createVNode)(d,{modelValue:e.files,"onUpdate:modelValue":n[1]||=t=>e.files=t,as:`tbody`,options:e.getDraggableOptions(),draggable:e.draggable},{default:(0,t.withCtx)(()=>[e.multiple||!e.isUploadActive?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(e.files,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:n.key??n.id??n.name},[e.render?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:0,innerHTML:e.renderFile(n,r)},null,8,kd)):e.downloadUrls[r]?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,Ad,[(0,t.createElementVNode)(`a`,{download:n.name,href:e.downloadUrls[r],target:`_blank`,onClick:(0,t.withModifiers)(t=>e.onClickDownload(n,r),[`prevent`])},[(0,t.createVNode)(c,{file:n,upload:e.getUpload(n),thumbnail:e.thumbnails,thumbnailUrl:e.thumbnailUrls[r]},null,8,[`file`,`upload`,`thumbnail`,`thumbnailUrl`])],8,jd)])):((0,t.openBlock)(),(0,t.createElementBlock)(`td`,Md,[(0,t.createVNode)(c,{file:n,upload:e.getUpload(n),thumbnail:e.thumbnails,thumbnailUrl:e.thumbnailUrls[r]},null,8,[`file`,`upload`,`thumbnail`,`thumbnailUrl`])])),(0,t.createElementVNode)(`td`,Nd,(0,t.toDisplayString)(e.formatFileSize(n.size)),1),(0,t.createElementVNode)(`td`,Pd,[n.upload?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[n.upload.success?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`Uploaded`)],64)):e.getUpload(n)?.error?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)(`Error: `+(0,t.toDisplayString)(e.getUpload(n).error),1)],64)):e.getUpload(n)?.active?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:2},[(0,t.createTextVNode)(`Uploading...`)],64)):(0,t.createCommentVNode)(``,!0)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)(`Stored`)],64))]),(0,t.createElementVNode)(`td`,Fd,[(0,t.createElementVNode)(`div`,Id,[e.multiple?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,class:`dito-button--upload`,title:e.uploadTitle,onClick:e.onClickUpload},null,8,[`title`,`onClick`])),e.draggable?((0,t.openBlock)(),(0,t.createBlock)(u,{key:1,disabled:e.disabled,onMove:t=>e.moveFile(n,t)},null,8,[`disabled`,`onMove`])):(0,t.createCommentVNode)(``,!0),e.deletable?((0,t.openBlock)(),(0,t.createBlock)(l,{key:2,verb:e.verbs.delete,disabled:e.disabled,onClick:t=>e.deleteFile(n)},null,8,[`verb`,`disabled`,`onClick`])):(0,t.createCommentVNode)(``,!0)])])]))),128)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`modelValue`,`options`,`draggable`]),e.multiple||e.isUploadActive||!e.hasFiles?((0,t.openBlock)(),(0,t.createElementBlock)(`tfoot`,Ld,[(0,t.createElementVNode)(`tr`,null,[(0,t.createElementVNode)(`td`,Rd,[(0,t.createElementVNode)(`div`,zd,[e.isUploadActive?((0,t.openBlock)(),(0,t.createElementBlock)(`progress`,{key:0,class:`dito-progress`,value:e.uploadProgress,max:`100`},null,8,Bd)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Vd,[e.isUploadActive?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,onClick:n[2]||=(0,t.withModifiers)(t=>e.upload.active=!1,[`prevent`])},{default:(0,t.withCtx)(()=>[...n[3]||=[(0,t.createTextVNode)(`Cancel`,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0),e.multiple||!e.hasFiles?((0,t.openBlock)(),(0,t.createBlock)(l,{key:1,class:`dito-button--upload`,title:e.uploadTitle,onClick:e.onClickUpload},null,8,[`title`,`onClick`])):(0,t.createCommentVNode)(``,!0)])])])])])):(0,t.createCommentVNode)(``,!0)])],2)}var Ud=X.register(`upload`,{mixins:[dc],components:{VueUpload:_e.default,DitoButton:K,DitoDragHandle:hs},inject:[`$fileDropTargets`],data(){return{uploads:[],removeDropTarget:null}},computed:{fileDropTargets(){return this.$fileDropTargets()},isDropTarget(){return this.fileDropTargets.isDraggingFiles&&!this.disabled},upload(){return this.$refs.upload},uploadTitle(){return this.multiple?`Upload Files`:`Upload File`},files:{get(){return Wd(this.value)},set(e){this.value=this.multiple?e:e[0]??null}},downloadUrls(){return this.files.map((e,t)=>{let n=this.getDownloadUrl(e,t);return n?mr(this.api,n):null})},thumbnailUrls(){return this.files.map((e,t)=>this.getThumbnailUrl(e,t))},multiple:R(`multiple`,{type:Boolean,default:!1,callback:!1}),extensions:R(`extensions`,{type:[Array,String,RegExp]}),accept:R(`accept`,{type:Array,get(e){return(0,i.isArray)(e)?e.join(`,`):e}}),maxSize:R(`maxSize`,{type:[String,Number],get(e){return e?Td(e):void 0}}),draggable:R(`draggable`,{type:Boolean,default:!1,get(e){return e&&this.files.length>1}}),deletable:R(`deletable`,{type:Boolean,default:!1}),render:R(`render`,{type:Function,default:null}),thumbnails:R(`thumbnails`,{type:[Boolean,String],default(e){return e??!!this.schema.thumbnailUrl},get(e){return e===!0?`medium`:e||null}}),hasFiles(){return this.files.length>0},uploadsById(){return new Map(this.uploads.map(e=>[e.id,e]))},hasUploads(){return this.uploads.length>0},isUploadReady(){return this.hasUploads&&!(this.upload.active||this.upload.uploaded)},isUploadActive(){return this.hasUploads&&this.upload.active},uploadProgress(){return this.uploads.reduce((e,t)=>e+ +t.progress,0)/this.uploads.length},uploadPath(){return this.dataComponent?.resource?this.getResourceUrl({type:`upload`,method:`post`,path:this.api.normalizePath(this.dataPath)}):null},uploadOptions(){return this.uploadPath?gr(this.api,this.uploadPath):null}},watch:{disabled:`updateDropTarget`,isUploadReady(e){e&&this.$nextTick(()=>{this.upload.active=!0})}},mounted(){this.updateDropTarget()},unmounted(){this.removeDropTarget?.()},methods:{formatFileSize:wd,updateDropTarget(){this.removeDropTarget?.(),this.removeDropTarget=this.disabled?null:this.fileDropTargets.add(this.$refs.dropTarget)},getFileContext(e,t){return this.multiple?new D(this,{value:e,data:this.files,index:t,dataPath:b(this.dataPath,t)}):this.context},renderFile(e,t){return this.render(this.getFileContext(e,t))},getUpload(e){return e.upload?this.uploadsById.get(e.upload.id)??null:null},getDownloadUrl(e,t){return e.url?e.url:!e.upload||e.upload.success?this.getSchemaValue(`downloadUrl`,{type:String,default:null,context:this.getFileContext(e,t)}):null},getThumbnailUrl(e,t){return!e.upload||e.upload.success?this.getSchemaValue(`thumbnailUrl`,{type:String,default:null,context:this.getFileContext(e,t)})||(e.type.startsWith(`image/`)?e.url:null):null},async deleteFile(e){e&&await Ls(this,{label:(0,i.escapeHtml)(e.name),isTransient:!0,remove:()=>{let t=this.files.indexOf(e);if(t<0)return!1;this.multiple?this.value.splice(t,1):this.value=null,e.upload&&this.upload.remove(e.upload.id),this.onChange()}})},moveFile(e,t){let n=fc(this.files,e,t);n&&(this.files=n,this.onChange())},getFileIndex(e){return this.multiple&&this.value?this.value.findIndex(t=>t.id===e.id):-1},addFile(e){this.multiple?this.value?this.value.push(e):this.value=[e]:this.value=e},replaceFile(e,t){if(this.multiple){let n=this.getFileIndex(e);n>=0&&(t?this.value[n]=t:this.value.splice(n,1))}else this.value=t},removeFile(e){this.replaceFile(e,null)},onInputFile(e,t){if(e&&!t){let{id:t,name:n,size:r}=e;this.addFile({id:t,name:n,size:r,upload:{id:t,success:!1}})}if(e&&t){let{success:t,error:n}=e;if(t){this.onChange();let t=e.response[0];t?(t.upload={id:e.id,success:!0},this.replaceFile(e,t)):this.removeFile(e)}else if(n){this.removeFile(e);let t={abort:`Upload aborted`,denied:`Upload denied`,extension:`Unsupported file-type: ${e.name}`,network:`Network error encountered during upload`,server:`Server error occurred during upload`,size:`File is too large: ${wd(e.size)}`,timeout:`Timeout occurred during upload`}[n]||`Unknown File Upload Error: '${n}'`;this.notify({type:`error`,error:n,title:`File Upload Error`,text:t})}}},onInputFilter(e){let t=e?.xhr;this.uploadOptions?.withCredentials&&t&&!t.withCredentials&&(t.withCredentials=!0)},async onClickDownload(e,t){try{let n=await hr(this.api,this.downloadUrls[t]),r=URL.createObjectURL(n);try{this.download({filename:e.name,url:r})}finally{setTimeout(()=>URL.revokeObjectURL(r),1e3)}}catch(t){this.notify({type:`error`,error:t,title:`File Download Error`,text:`Unable to download ${e.name}: ${t.message}`})}},onClickUpload(e){this.upload.$el.querySelector(`input`).dispatchEvent(new e.constructor(e.type,e))}},processValue({schema:e,value:t}){let n=Wd(t).map(({upload:e,...t})=>!e||e.success?t:null).filter(e=>e);return e.multiple?n:n[0]||null}});function Wd(e){return e?(0,i.asArray)(e):[]}var Gd=G(Ud,[[`render`,Hd]]),Kd=we({DitoDitoTypeComponent:()=>Ml,DitoTypeButton:()=>Jc,DitoTypeCheckbox:()=>Qc,DitoTypeCheckboxes:()=>fl,DitoTypeCode:()=>Cl,DitoTypeColor:()=>Al,DitoTypeComputed:()=>Fl,DitoTypeDate:()=>Rl,DitoTypeLabel:()=>gu,DitoTypeList:()=>mu,DitoTypeMarkup:()=>wu,DitoTypeMultiselect:()=>Au,DitoTypeNumber:()=>Nu,DitoTypeObject:()=>Lu,DitoTypePanel:()=>Ru,DitoTypeProgress:()=>Vu,DitoTypeRadio:()=>Wu,DitoTypeSection:()=>Ku,DitoTypeSelect:()=>nd,DitoTypeSlider:()=>od,DitoTypeSpacer:()=>cd,DitoTypeSwitch:()=>ud,DitoTypeText:()=>md,DitoTypeTextarea:()=>_d,DitoTypeTreeList:()=>Sd,DitoTypeUpload:()=>Gd}),qd={mounted(e,t){Jd(e,t.value,t.arg)},unmounted(e,t){Yd(e,t.value,t.arg)}};function Jd(e,t,n){Qd.getObserver(n).observe(e,t)}function Yd(e,t,n){Qd.getObserver(n).unobserve(e,t)}var Xd=typeof ResizeObserver<`u`,Zd={},Qd=class e{constructor(e,t){this.key=e,this.options=t,this.observer=Xd?new ResizeObserver(e=>this.handle(e)):null,this.handlersByNode=new WeakMap,this.nodeCount=0}observe(e,t){let n=this.handlersByNode.get(e);n||(n=new Set,this.handlersByNode.set(e,n),this.observer?.observe(e,this.options),this.nodeCount++),n.add(t)}unobserve(e,t){let n=this.handlersByNode.get(e);n?.delete(t)&&n.size===0&&(this.handlersByNode.delete(e),this.observer?.unobserve(e),--this.nodeCount===0&&delete Zd[this.key])}handle(e){for(let t of e){let e=this.handlersByNode.get(t.target);if(e){let n={target:t.target,contentRect:t.contentRect,borderBoxSize:(0,i.asArray)(t.borderBoxSize),contentBoxSize:(0,i.asArray)(t.contentBoxSize),devicePixelContentBoxSize:(0,i.asArray)(t.devicePixelContentBoxSize)};for(let t of e)t(n)}}}static getObserver({box:t=`content-box`}={}){let n={box:t},r=JSON.stringify(n);return Zd[r]||=new e(r,n),Zd[r]}},$d=class{hasRole(...e){if(this.roles){for(let t of e)if(this.roles.includes(t))return!0}return!1}},ef=class{#e;#t;#n;#r=null;constructor({api:e,viewRegistry:t,redirectAfterLogin:n=null}){this.#e=e,this.#t=t,this.#n=n}get user(){return y.user}attachUserInterface({requestLoginData:e,notify:t}){let n={requestLoginData:e,notify:t};return this.#r=n,()=>{this.#r===n&&(this.#r=null)}}async start(){await this.fetchUser()?await this.#a():await this.login()}async login(){let e=await this.#r?.requestLoginData();if(!e)return null;let t;try{t=(await this.#o(this.#e.users.login,e)).data.user}catch(e){return this.#s(e),this.login()}return this.#n?location.replace(this.#n):(this.#i(t),await this.#a()),t}async logout(){try{(await this.#o(this.#e.users.logout)).data.success&&this.#i(null)}catch(e){console.error(e)}}async fetchUser(){let e=null;try{e=(await this.#o(this.#e.users.session)).data.user||null}catch(e){this.#s(e)}return this.#i(e),e}async ensureUser(){await this.fetchUser()||await this.login()}#i(e){(!e||e.id!==y.user?.id)&&(y.loadCache={}),y.user=e&&Object.setPrototypeOf(e,$d.prototype),e||this.#t.clear()}async#a(){await this.#t.resolve()||await this.login()}#o(e,t=null){let n=this.#e.getApiUrl({url:this.#e.resources.any(e)});return this.#e.request({method:e.method,url:n,data:t})}#s(e){let t=e.response?.data?.error||e;this.#r?this.#r.notify({type:`error`,error:t,title:`Authentication Error`,text:t}):console.error(t)}},tf=class{#e;#t;#n;#r;#i=(0,t.shallowRef)({});#a=(0,t.shallowRef)(null);constructor({api:e,router:t,unresolvedViews:n,viewComponent:r}){this.#e=e,this.#t=t,this.#n=n,this.#r=r}get views(){return this.#i.value}get hasRoutes(){return!!this.#a.value}async resolve(){let e;try{e=await Jn(this.#n)}catch(e){return console.error(e),!1}let t=await(0,i.mapConcurrently)(Object.entries(e),([e,t])=>er(this.#r,this.#e,t,e));this.#i.value=e;let{fullPath:n}=this.#t.currentRoute.value;return this.#a.value?.(),this.#a.value=nf(this.#t,[{name:`root`,path:`/`,components:{}},...t.flat()]),this.#t.replace(n),!0}clear(){return this.#i.value={},this.#t.push(`/`)}};function nf(e,t){let n=t.map(t=>e.addRoute(t));return()=>{for(let e of n)e()}}var rf=[`create`,`created`,`save`,`saved`,`apply`,`applied`,`submit`,`submitted`,`delete`,`deleted`,`remove`,`removed`,`clear`,`cleared`,`edit`,`edited`,`close`,`closed`,`cancel`,`cancelled`,`drag`,`dragged`,`login`,`logged in`].reduce((e,t)=>(e[t]=t,e),{}),af=class{constructor(e,{dito:a=globalThis.dito??{},api:o,views:s={},...c}={}){this.el=e,this.api=o=(0,i.assignDeeply)({base:`/`},a.api,o),this.options=c,o.locale||=`en-US`,o.formats=(0,i.assignDeeply)({},i.defaultFormats,o.formats),o.request||=e=>fr(o,e),o.getApiUrl||=e=>Sr(o,e),o.isApiUrl||=e=>yr(o,e),o.normalizePath||=o.normalizePaths?i.hyphenate:e=>e,o.denormalizePath||=o.normalizePaths?i.camelize:e=>e,o.defaults||={};let l=H(o.users,{type:`collection`})||{};l.login=H(l.login||`login`,{method:`post`,parent:l}),l.logout=H(l.logout||`logout`,{method:`post`,parent:l}),l.session=H(l.session||`session`,{method:`get`,parent:l}),o.users=l,o.resources={any(e){let t=this[e?.type]||this.default;return e&&t.call(this,e)},default(e){let t=this.any(e.parent);return t?`${t}/${e.path}`:e.path},collection(e){return this.default(e)},member(e){return`${this.default(e)}/${e.id}`},upload(e){return`${this.collection(e.parent)}/upload/${e.path}`},...o.resources},o.headers={"Content-Type":`application/json`,...o.headers},(0,i.isString)(e)&&(e=document.querySelector(e));let u=(0,n.createRouter)({routes:[{name:`catch-all`,path:`/:_(.*)`,components:{}}],history:(0,n.createWebHistory)(a.base),linkActiveClass:``,linkExactActiveClass:``}),d=new tf({api:o,router:u,unresolvedViews:s,viewComponent:Vs}),f=new ef({api:o,viewRegistry:d,redirectAfterLogin:c.login?.redirectAfterLogin}),p=this.app=(0,t.createApp)({components:{DitoRoot:Ya,VueNotifications:r.default,...Wc,...Kd},provide:{api:o,session:f,viewRegistry:d,$verbs:()=>rf,$views:()=>d.views,$isPopulated:()=>!0,$parentComponent:()=>null,$schemaComponent:()=>null,$schemaParentComponent:()=>null,$routeComponent:()=>null,$dataComponent:()=>null,$sourceComponent:()=>null,$resourceComponent:()=>null,$dialogComponent:()=>null,$dataModel:()=>null,$panelComponent:()=>null,$tabComponent:()=>null,$loadingTracker:()=>null},render:()=>(0,t.h)(Ya,{ref:`root`,class:a.settings?.rootClass,options:c})});p.config.errorHandler=console.error,p.use(r.default,{componentName:`VueNotifications`,name:`notify`}),p.directive(`resize`,qd),p.use(u),e.classList.add(`dito-app`),p.mount(e)}register(e,t){return X.register(e,t)}},of=af;e.DitoAdmin=af,e.default=of});