@structured-field/widget-editor 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/structured-widget-editor.css +1 -1
- package/dist/structured-widget-editor.esm.js +7 -0
- package/dist/structured-widget-editor.esm.js.map +1 -1
- package/dist/structured-widget-editor.iife.js +2 -2
- package/dist/structured-widget-editor.js +1 -1
- package/dist/structured-widget-editor.js.map +1 -1
- package/package.json +1 -1
- package/src/SchemaForm.vue +2 -0
- package/src/editors/RelationEditor.vue +5 -0
- package/src/scss/components/editors.scss +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @structured-field/widget-editor – IIFE bundle with embedded CSS */
|
|
2
|
-
(function(){var s=document.createElement("style");s.textContent=".structured-field-editor{width:100%;border-radius:4px;font-size:.8125rem}.structured-field-editor *,.structured-field-editor *::before,.structured-field-editor *::after{box-sizing:border-box}.structured-field-editor .sf-label{display:block;font-weight:600;margin-bottom:4px;text-transform:capitalize;color:var(--body-quiet-color, #666);font-size:.8125rem}.structured-field-editor .sf-label.required::after{content:\" *\";color:var(--error-fg, #ba2121)}.structured-field-editor .sf-input{display:block;width:100%;padding:6px 8px;border:1px solid var(--border-color, #ccc);border-radius:4px;background:var(--body-bg, #fff);color:var(--body-fg, #333);font-size:.8125rem;font-family:inherit;transition:border-color .15s}.structured-field-editor .sf-input:focus{outline:none;border-color:var(--primary, #79aec8);box-shadow:0 0 0 2px rgba(121,174,200,.2)}.structured-field-editor .sf-textarea{resize:vertical;min-height:60px}.structured-field-editor .sf-select{appearance:none;cursor:pointer;padding-right:28px;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='12' height='12'%3E%3Cpath fill='%23888' d='M12 15L5 8h14z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 8px center;background-size:12px 12px}.structured-field-editor .sf-checkbox{margin-right:6px;accent-color:var(--primary, #79aec8)}.structured-field-editor .sf-checkbox-label{display:flex;align-items:center;font-weight:normal;cursor:pointer;padding:6px 0}.structured-field-editor .sf-btn{display:inline-flex;align-items:center;gap:4px;padding:4px 12px;background:var(--object-tools-bg, #888);color:var(--object-tools-fg, #fff);font-weight:400;font-size:.6875rem;text-transform:uppercase;letter-spacing:.5px;border-radius:15px;border:none;cursor:pointer;transition:background-color .15s}.structured-field-editor .sf-btn:hover{background-color:var(--object-tools-hover-bg, #666)}.structured-field-editor .sf-btn i{font-size:.6rem}.structured-field-editor .sf-btn-sm{padding:2px 8px;font-size:.625rem}.structured-field-editor .sf-btn-add{background:var(--object-tools-bg, #888);color:var(--object-tools-fg, #fff)}.structured-field-editor .sf-btn-danger{background:var(--delete-button-bg, #ba2121);color:var(--delete-button-fg, #fff)}.structured-field-editor .sf-btn-danger:hover{background:#a41515}.structured-field-editor .sf-error{color:var(--error-fg, #ba2121);font-size:.75rem;margin-top:2px}.structured-field-editor .errors .sf-input{border-color:var(--error-fg, #ba2121)}.structured-field-editor .errorlist{margin:4px 0 0 0;padding:0;list-style:none;color:var(--error-fg, #ba2121);font-size:.75rem}.structured-field-editor .errorlist li{padding:2px 0}.form-row{overflow:visible !important}.structured-field-editor .sf-field{margin-bottom:12px}.structured-field-editor .sf-field-boolean{margin-bottom:8px}.structured-field-editor .sf-object:not(.sf-object-root){border:1px solid var(--border-color, #ccc);border-radius:4px;padding:12px;margin-bottom:12px;background:var(--body-bg, #fff)}.structured-field-editor .sf-object:not(.sf-object-root).sf-object-collapsed{padding:0}.structured-field-editor .sf-object-title{display:flex;align-items:center;gap:6px;font-weight:600;font-size:.8125rem;color:var(--body-fg, #333);text-transform:capitalize;padding:0 4px}.structured-field-editor .sf-object-title-text{flex-shrink:0}.structured-field-editor .sf-object-summary{font-weight:400;font-size:.75rem;color:var(--body-quiet-color, #888);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px}.structured-field-editor .sf-collapse-btn{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;padding:0;border:none;background:rgba(0,0,0,0);cursor:pointer;color:var(--body-quiet-color, #888);border-radius:3px;flex-shrink:0}.structured-field-editor .sf-collapse-btn:hover{background:var(--darkened-bg, #f0f0f0);color:var(--body-fg, #333)}.structured-field-editor .sf-object-fields{display:flex;flex-direction:column}.structured-field-editor .sf-array{margin-bottom:12px}.structured-field-editor .sf-array-header{display:flex;align-items:center;gap:8px;margin-bottom:8px}.structured-field-editor .sf-array-header .sf-label{margin-bottom:0}.structured-field-editor .sf-array-collapse-toggle{margin-left:auto;display:inline-flex;align-items:center;cursor:pointer;color:var(--body-quiet-color, #aaa);line-height:0}.structured-field-editor .sf-array-collapse-toggle:hover{color:var(--body-fg, #333)}.structured-field-editor .sf-array-count{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;background:var(--darkened-bg, #f0f0f0);border-radius:10px;font-size:.6875rem;font-weight:600;color:var(--body-quiet-color, #666)}.structured-field-editor .sf-array-items{display:flex;flex-direction:column;gap:8px}.structured-field-editor .sf-array-item{border:1px solid var(--border-color, #ccc);border-radius:4px;background:var(--darkened-bg, #f8f8f8);overflow:hidden}.structured-field-editor .sf-array-item[draggable=true]{cursor:grab}.structured-field-editor .sf-array-item.sf-dragging{opacity:.4}.structured-field-editor .sf-array-item.sf-drag-over{outline:2px solid var(--primary-color, #3b82f6);outline-offset:-2px}.structured-field-editor .sf-array-item-header{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;background:var(--darkened-bg, #f0f0f0);border-bottom:1px solid var(--border-color, #ccc)}.structured-field-editor .sf-array-item-left{display:flex;align-items:center;gap:6px}.structured-field-editor .sf-drag-handle{display:inline-flex;align-items:center;color:var(--body-quiet-color, #aaa);cursor:grab;padding:0 2px;line-height:0}.structured-field-editor .sf-drag-handle:active{cursor:grabbing}.structured-field-editor .sf-drag-handle:hover{color:var(--body-fg, #555)}.structured-field-editor .sf-array-item-index{font-size:.6875rem;font-weight:600;color:var(--body-quiet-color, #666)}.structured-field-editor .sf-array-item-actions{display:flex;gap:4px}.structured-field-editor .sf-array-item-body{padding:10px}.structured-field-editor .sf-array-item-body>.sf-object.sf-object-root,.structured-field-editor .sf-array-item-body>.sf-object:not(.sf-object-root){border:none;padding:0;margin:0;background:rgba(0,0,0,0)}.structured-field-editor .sf-nullable{margin-bottom:12px}.structured-field-editor .sf-nullable-header{display:flex;align-items:center;gap:8px;margin-bottom:4px}.structured-field-editor .sf-nullable-header .sf-label{margin-bottom:0}.structured-field-editor .sf-nullable-body{padding-left:0}.structured-field-editor .sf-nullable-body:not(:empty){border:1px solid var(--border-color, #ccc);border-radius:4px;padding:12px;margin-top:4px;background:var(--body-bg, #fff)}.structured-field-editor .sf-union{margin-bottom:12px}.structured-field-editor .sf-union-body{border:1px solid var(--border-color, #ccc);border-radius:4px;padding:12px;margin-top:8px;background:var(--body-bg, #fff)}.structured-field-editor .sf-union-body>.sf-object{border:none;padding:0;margin:0;background:rgba(0,0,0,0)}.structured-field-editor .sf-relation{position:relative}.structured-field-editor .sf-relation-wrapper{display:flex;flex-direction:column;gap:6px}.structured-field-editor .sf-relation-selected{display:flex;flex-wrap:wrap;gap:6px}.structured-field-editor .sf-relation-selected:empty{display:none}.structured-field-editor .sf-relation-tag{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;background:var(--darkened-bg, #f0f0f0);border:1px solid var(--border-color, #ccc);border-radius:4px;font-size:.8125rem;color:var(--body-fg, #333);max-width:100%}.structured-field-editor .sf-relation-tag-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.structured-field-editor .sf-relation-tag-remove{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;padding:0;border:none;border-radius:50%;background:rgba(0,0,0,0);color:var(--body-quiet-color, #666);cursor:pointer;font-size:.6875rem;flex-shrink:0;transition:color .15s,background .15s}.structured-field-editor .sf-relation-tag-remove:hover{color:var(--error-fg, #ba2121);background:rgba(186,33,33,.1)}.structured-field-editor .sf-relation-search{position:relative}.structured-field-editor .sf-relation-input{padding-left:28px;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:8px center;background-size:14px}.structured-field-editor .sf-relation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:1000;max-height:240px;overflow-y:auto;background:var(--body-bg, #fff);border:1px solid var(--border-color, #ccc);border-top:none;border-radius:0 0 4px 4px;box-shadow:0 4px 12px rgba(0,0,0,.1)}.structured-field-editor .sf-relation-dropdown-item{padding:8px 12px;cursor:pointer;font-size:.8125rem;color:var(--body-fg, #333);transition:background .1s;border-bottom:1px solid var(--hairline-color, #eee)}.structured-field-editor .sf-relation-dropdown-item:last-child{border-bottom:none}.structured-field-editor .sf-relation-dropdown-item:hover,.structured-field-editor .sf-relation-dropdown-item.highlighted{background:var(--selected-bg, #e4e4e4)}.structured-field-editor .sf-relation-dropdown-empty{padding:12px;text-align:center;color:var(--body-quiet-color, #999);font-size:.8125rem;font-style:italic}.structured-field-editor .sf-relation-dropdown-more{padding:8px 12px;text-align:center;cursor:pointer;font-size:.75rem;color:var(--link-fg, #417690);font-weight:600;border-top:1px solid var(--hairline-color, #eee);transition:background .1s}.structured-field-editor .sf-relation-dropdown-more:hover{background:var(--darkened-bg, #f0f0f0)}";document.head.appendChild(s)})();
|
|
2
|
+
(function(){var s=document.createElement("style");s.textContent=".structured-field-editor{width:100%;border-radius:4px;font-size:.8125rem}.structured-field-editor *,.structured-field-editor *::before,.structured-field-editor *::after{box-sizing:border-box}.structured-field-editor .sf-label{display:block;font-weight:600;margin-bottom:4px;text-transform:capitalize;color:var(--body-quiet-color, #666);font-size:.8125rem}.structured-field-editor .sf-label.required::after{content:\" *\";color:var(--error-fg, #ba2121)}.structured-field-editor .sf-input{display:block;width:100%;padding:6px 8px;border:1px solid var(--border-color, #ccc);border-radius:4px;background:var(--body-bg, #fff);color:var(--body-fg, #333);font-size:.8125rem;font-family:inherit;transition:border-color .15s}.structured-field-editor .sf-input:focus{outline:none;border-color:var(--primary, #79aec8);box-shadow:0 0 0 2px rgba(121,174,200,.2)}.structured-field-editor .sf-textarea{resize:vertical;min-height:60px}.structured-field-editor .sf-select{appearance:none;cursor:pointer;padding-right:28px;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='12' height='12'%3E%3Cpath fill='%23888' d='M12 15L5 8h14z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 8px center;background-size:12px 12px}.structured-field-editor .sf-checkbox{margin-right:6px;accent-color:var(--primary, #79aec8)}.structured-field-editor .sf-checkbox-label{display:flex;align-items:center;font-weight:normal;cursor:pointer;padding:6px 0}.structured-field-editor .sf-btn{display:inline-flex;align-items:center;gap:4px;padding:4px 12px;background:var(--object-tools-bg, #888);color:var(--object-tools-fg, #fff);font-weight:400;font-size:.6875rem;text-transform:uppercase;letter-spacing:.5px;border-radius:15px;border:none;cursor:pointer;transition:background-color .15s}.structured-field-editor .sf-btn:hover{background-color:var(--object-tools-hover-bg, #666)}.structured-field-editor .sf-btn i{font-size:.6rem}.structured-field-editor .sf-btn-sm{padding:2px 8px;font-size:.625rem}.structured-field-editor .sf-btn-add{background:var(--object-tools-bg, #888);color:var(--object-tools-fg, #fff)}.structured-field-editor .sf-btn-danger{background:var(--delete-button-bg, #ba2121);color:var(--delete-button-fg, #fff)}.structured-field-editor .sf-btn-danger:hover{background:#a41515}.structured-field-editor .sf-error{color:var(--error-fg, #ba2121);font-size:.75rem;margin-top:2px}.structured-field-editor .errors .sf-input{border-color:var(--error-fg, #ba2121)}.structured-field-editor .errorlist{margin:4px 0 0 0;padding:0;list-style:none;color:var(--error-fg, #ba2121);font-size:.75rem}.structured-field-editor .errorlist li{padding:2px 0}.form-row{overflow:visible !important}.structured-field-editor .sf-field{margin-bottom:12px}.structured-field-editor .sf-field-boolean{margin-bottom:8px}.structured-field-editor .sf-object:not(.sf-object-root){border:1px solid var(--border-color, #ccc);border-radius:4px;padding:12px;margin-bottom:12px;background:var(--body-bg, #fff)}.structured-field-editor .sf-object:not(.sf-object-root).sf-object-collapsed{padding:0}.structured-field-editor .sf-object-title{display:flex;align-items:center;gap:6px;font-weight:600;font-size:.8125rem;color:var(--body-fg, #333);text-transform:capitalize;padding:0 4px}.structured-field-editor .sf-object-title-text{flex-shrink:0}.structured-field-editor .sf-object-summary{font-weight:400;font-size:.75rem;color:var(--body-quiet-color, #888);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px}.structured-field-editor .sf-collapse-btn{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;padding:0;border:none;background:rgba(0,0,0,0);cursor:pointer;color:var(--body-quiet-color, #888);border-radius:3px;flex-shrink:0}.structured-field-editor .sf-collapse-btn:hover{background:var(--darkened-bg, #f0f0f0);color:var(--body-fg, #333)}.structured-field-editor .sf-object-fields{display:flex;flex-direction:column}.structured-field-editor .sf-array{margin-bottom:12px}.structured-field-editor .sf-array-header{display:flex;align-items:center;gap:8px;margin-bottom:8px}.structured-field-editor .sf-array-header .sf-label{margin-bottom:0}.structured-field-editor .sf-array-collapse-toggle{margin-left:auto;display:inline-flex;align-items:center;cursor:pointer;color:var(--body-quiet-color, #aaa);line-height:0}.structured-field-editor .sf-array-collapse-toggle:hover{color:var(--body-fg, #333)}.structured-field-editor .sf-array-count{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;background:var(--darkened-bg, #f0f0f0);border-radius:10px;font-size:.6875rem;font-weight:600;color:var(--body-quiet-color, #666)}.structured-field-editor .sf-array-items{display:flex;flex-direction:column;gap:8px}.structured-field-editor .sf-array-item{border:1px solid var(--border-color, #ccc);border-radius:4px;background:var(--darkened-bg, #f8f8f8);overflow:visible;position:relative}.structured-field-editor .sf-array-item[draggable=true]{cursor:grab}.structured-field-editor .sf-array-item.sf-dragging{opacity:.4}.structured-field-editor .sf-array-item.sf-drag-over{outline:2px solid var(--primary-color, #3b82f6);outline-offset:-2px}.structured-field-editor .sf-array-item-header{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;background:var(--darkened-bg, #f0f0f0);border-bottom:1px solid var(--border-color, #ccc);border-radius:4px 4px 0 0}.structured-field-editor .sf-array-item-left{display:flex;align-items:center;gap:6px}.structured-field-editor .sf-drag-handle{display:inline-flex;align-items:center;color:var(--body-quiet-color, #aaa);cursor:grab;padding:0 2px;line-height:0}.structured-field-editor .sf-drag-handle:active{cursor:grabbing}.structured-field-editor .sf-drag-handle:hover{color:var(--body-fg, #555)}.structured-field-editor .sf-array-item-index{font-size:.6875rem;font-weight:600;color:var(--body-quiet-color, #666)}.structured-field-editor .sf-array-item-actions{display:flex;gap:4px}.structured-field-editor .sf-array-item-body{padding:10px}.structured-field-editor .sf-array-item-body>.sf-object.sf-object-root,.structured-field-editor .sf-array-item-body>.sf-object:not(.sf-object-root){border:none;padding:0;margin:0;background:rgba(0,0,0,0)}.structured-field-editor .sf-nullable{margin-bottom:12px}.structured-field-editor .sf-nullable-header{display:flex;align-items:center;gap:8px;margin-bottom:4px}.structured-field-editor .sf-nullable-header .sf-label{margin-bottom:0}.structured-field-editor .sf-nullable-body{padding-left:0}.structured-field-editor .sf-nullable-body:not(:empty){border:1px solid var(--border-color, #ccc);border-radius:4px;padding:12px;margin-top:4px;background:var(--body-bg, #fff)}.structured-field-editor .sf-union{margin-bottom:12px}.structured-field-editor .sf-union-body{border:1px solid var(--border-color, #ccc);border-radius:4px;padding:12px;margin-top:8px;background:var(--body-bg, #fff)}.structured-field-editor .sf-union-body>.sf-object{border:none;padding:0;margin:0;background:rgba(0,0,0,0)}.structured-field-editor .sf-relation{position:relative}.structured-field-editor .sf-relation-wrapper{display:flex;flex-direction:column;gap:6px}.structured-field-editor .sf-relation-selected{display:flex;flex-wrap:wrap;gap:6px}.structured-field-editor .sf-relation-selected:empty{display:none}.structured-field-editor .sf-relation-tag{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;background:var(--darkened-bg, #f0f0f0);border:1px solid var(--border-color, #ccc);border-radius:4px;font-size:.8125rem;color:var(--body-fg, #333);max-width:100%}.structured-field-editor .sf-relation-tag-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.structured-field-editor .sf-relation-tag-remove{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;padding:0;border:none;border-radius:50%;background:rgba(0,0,0,0);color:var(--body-quiet-color, #666);cursor:pointer;font-size:.6875rem;flex-shrink:0;transition:color .15s,background .15s}.structured-field-editor .sf-relation-tag-remove:hover{color:var(--error-fg, #ba2121);background:rgba(186,33,33,.1)}.structured-field-editor .sf-relation-search{position:relative}.structured-field-editor .sf-relation-input{padding-left:28px;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:8px center;background-size:14px}.structured-field-editor .sf-relation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:1000;max-height:240px;overflow-y:auto;background:var(--body-bg, #fff);border:1px solid var(--border-color, #ccc);border-top:none;border-radius:0 0 4px 4px;box-shadow:0 4px 12px rgba(0,0,0,.1)}.structured-field-editor .sf-relation-dropdown-item{padding:8px 12px;cursor:pointer;font-size:.8125rem;color:var(--body-fg, #333);transition:background .1s;border-bottom:1px solid var(--hairline-color, #eee)}.structured-field-editor .sf-relation-dropdown-item:last-child{border-bottom:none}.structured-field-editor .sf-relation-dropdown-item:hover,.structured-field-editor .sf-relation-dropdown-item.highlighted{background:var(--selected-bg, #e4e4e4)}.structured-field-editor .sf-relation-dropdown-empty{padding:12px;text-align:center;color:var(--body-quiet-color, #999);font-size:.8125rem;font-style:italic}.structured-field-editor .sf-relation-dropdown-more{padding:8px 12px;text-align:center;cursor:pointer;font-size:.75rem;color:var(--link-fg, #417690);font-weight:600;border-top:1px solid var(--hairline-color, #eee);transition:background .1s}.structured-field-editor .sf-relation-dropdown-more:hover{background:var(--darkened-bg, #f0f0f0)}";document.head.appendChild(s)})();
|
|
3
3
|
var StructuredWidgetEditor=function(e){"use strict";var t={name:"StringEditor",props:{schema:{type:Object,required:!0},modelValue:{default:""},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},isLong(){return this.schema.maxLength>255||"textarea"===this.schema.format},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):""}};
|
|
4
4
|
/**
|
|
5
5
|
* @vue/shared v3.5.30
|
|
@@ -21,5 +21,5 @@ let ee,te;class ne{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,
|
|
|
21
21
|
* @vue/runtime-dom v3.5.30
|
|
22
22
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
23
23
|
* @license MIT
|
|
24
|
-
**/let Os;const Vs="undefined"!=typeof window&&window.trustedTypes;if(Vs)try{Os=Vs.createPolicy("vue",{createHTML:e=>e})}catch(e){}const js=Os?e=>Os.createHTML(e):e=>e,Ps="undefined"!=typeof document?document:null,Is=Ps&&Ps.createElement("template"),Rs={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s="svg"===t?Ps.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?Ps.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?Ps.createElement(e,{is:n}):Ps.createElement(e);return"select"===e&&r&&null!=r.multiple&&s.setAttribute("multiple",r.multiple),s},createText:e=>Ps.createTextNode(e),createComment:e=>Ps.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ps.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),s!==o&&(s=s.nextSibling););else{Is.innerHTML=js("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);const s=Is.content;if("svg"===r||"mathml"===r){const e=s.firstChild;for(;e.firstChild;)s.appendChild(e.firstChild);s.removeChild(e)}t.insertBefore(s,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},$s=Symbol("_vtc");const Ds=Symbol("_vod"),Ts=Symbol("_vsh"),Ms={name:"show",beforeMount(e,{value:t},{transition:n}){e[Ds]="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):Ns(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Ns(e,!0),r.enter(e)):r.leave(e,()=>{Ns(e,!1)}):Ns(e,t))},beforeUnmount(e,{value:t}){Ns(e,t)}};function Ns(e,t){e.style.display=t?e[Ds]:"none",e[Ts]=!t}const Fs=Symbol(""),qs=/(?:^|;)\s*display\s*:/;const Us=/\s*!important$/;function Ls(e,t,n){if(p(n))n.forEach(n=>Ls(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=function(e,t){const n=Ws[t];if(n)return n;let r=V(t);if("filter"!==r&&r in e)return Ws[t]=r;r=I(r);for(let n=0;n<zs.length;n++){const s=zs[n]+r;if(s in e)return Ws[t]=s}return t}(e,t);Us.test(n)?e.setProperty(P(r),n.replace(Us,""),"important"):e[r]=n}}const zs=["Webkit","Moz","ms"],Ws={};const Bs="http://www.w3.org/1999/xlink";function Hs(e,t,n,r,s,o=K(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(Bs,t.slice(6,t.length)):e.setAttributeNS(Bs,t,n):null==n||o&&!Z(n)?e.removeAttribute(t):e.setAttribute(t,o?"":_(n)?String(n):n)}function Ks(e,t,n,r,s){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?js(n):n));const o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){const r="OPTION"===o?e.getAttribute("value")||"":e.value,s=null==n?"checkbox"===e.type?"on":"":String(n);return r===s&&"_value"in e||(e.value=s),null==n&&e.removeAttribute(t),void(e._value=n)}let i=!1;if(""===n||null==n){const r=typeof e[t];"boolean"===r?n=Z(n):null==n&&"string"===r?(n="",i=!0):"number"===r&&(n=0,i=!0)}try{e[t]=n}catch(e){}i&&e.removeAttribute(s||t)}function Zs(e,t,n,r){e.addEventListener(t,n,r)}const Js=Symbol("_vei");function Qs(e,t,n,r,s=null){const o=e[Js]||(e[Js]={}),i=o[t];if(r&&i)i.value=r;else{const[n,l]=function(e){let t;if(Gs.test(e)){let n;for(t={};n=e.match(Gs);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}const n=":"===e[2]?e.slice(3):P(e.slice(2));return[n,t]}(t);if(r){const i=o[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();Rt(function(e,t){if(p(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=eo(),n}(r,s);Zs(e,n,i,l)}else i&&(!function(e,t,n,r){e.removeEventListener(t,n,r)}(e,n,i,l),o[t]=void 0)}}const Gs=/(?:Once|Passive|Capture)$/;let Xs=0;const Ys=Promise.resolve(),eo=()=>Xs||(Ys.then(()=>Xs=0),Xs=Date.now());const to=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const no={};const ro="undefined"!=typeof HTMLElement?HTMLElement:class{};class so extends ro{constructor(e,t={},n=_o){super(),this._def=e,this._props=t,this._createApp=n,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&n!==_o?this._root=this.shadowRoot:!1!==e.shadowRoot?(this.attachShadow(c({},e.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;this.shadowRoot||this._resolved||this._parseSlots(),this._connected=!0;let e=this;for(;e=e&&(e.assignedSlot||e.parentNode||e.host);)if(e instanceof so){this._parent=e;break}this._instance||(this._resolved?this._mount(this._def):e&&e._pendingResolve?this._pendingResolve=e._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(e=this._parent){e&&(this._instance.parent=e._instance,this._inheritParentContext(e))}_inheritParentContext(e=this._parent){e&&this._app&&Object.setPrototypeOf(this._app._context.provides,e._instance.provides)}disconnectedCallback(){this._connected=!1,Lt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(e){for(const t of e)this._setAttr(t.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let e=0;e<this.attributes.length;e++)this._setAttr(this.attributes[e].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const e=(e,t=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:n,styles:r}=e;let s;if(n&&!p(n))for(const e in n){const t=n[e];(t===Number||t&&t.type===Number)&&(e in this._props&&(this._props[e]=N(this._props[e])),(s||(s=Object.create(null)))[V(e)]=!0)}this._numberProps=s,this._resolveProps(e),this.shadowRoot&&this._applyStyles(r),this._mount(e)},t=this._def.__asyncLoader;t?this._pendingResolve=t().then(t=>{t.configureApp=this._def.configureApp,e(this._def=t,!0)}):e(this._def)}_mount(e){this._app=this._createApp(e),this._inheritParentContext(),e.configureApp&&e.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const t=this._instance&&this._instance.exposed;if(t)for(const e in t)d(this,e)||Object.defineProperty(this,e,{get:()=>kt(t[e])})}_resolveProps(e){const{props:t}=e,n=p(t)?t:Object.keys(t||{});for(const e of Object.keys(this))"_"!==e[0]&&n.includes(e)&&this._setProp(e,this[e]);for(const e of n.map(V))Object.defineProperty(this,e,{get(){return this._getProp(e)},set(t){this._setProp(e,t,!0,!this._patching)}})}_setAttr(e){if(e.startsWith("data-v-"))return;const t=this.hasAttribute(e);let n=t?this.getAttribute(e):no;const r=V(e);t&&this._numberProps&&this._numberProps[r]&&(n=N(n)),this._setProp(r,n,!1,!0)}_getProp(e){return this._props[e]}_setProp(e,t,n=!0,r=!1){if(t!==this._props[e]&&(this._dirty=!0,t===no?delete this._props[e]:(this._props[e]=t,"key"===e&&this._app&&(this._app._ceVNode.key=t)),r&&this._instance&&this._update(),n)){const n=this._ob;n&&(this._processMutations(n.takeRecords()),n.disconnect()),!0===t?this.setAttribute(P(e),""):"string"==typeof t||"number"==typeof t?this.setAttribute(P(e),t+""):t||this.removeAttribute(P(e)),n&&n.observe(this,{attributes:!0})}}_update(){const e=this._createVNode();this._app&&(e.appContext=this._app._context),vo(e,this._root)}_createVNode(){const e={};this.shadowRoot||(e.onVnodeMounted=e.onVnodeUpdated=this._renderSlots.bind(this));const t=ns(this._def,c(e,this._props));return this._instance||(t.ce=e=>{this._instance=e,e.ce=this,e.isCE=!0;const t=(e,t)=>{this.dispatchEvent(new CustomEvent(e,E(t[0])?c({detail:t},t[0]):{detail:t}))};e.emit=(e,...n)=>{t(e,n),P(e)!==e&&t(P(e),n)},this._setParent()}),t}_applyStyles(e,t,n){if(!e)return;if(t){if(t===this._def||this._styleChildren.has(t))return;this._styleChildren.add(t)}const r=this._nonce,s=this.shadowRoot,o=n?this._getStyleAnchor(n)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(s);let i=null;for(let l=e.length-1;l>=0;l--){const a=document.createElement("style");r&&a.setAttribute("nonce",r),a.textContent=e[l],s.insertBefore(a,i||o),i=a,0===l&&(n||this._styleAnchors.set(this._def,a),t&&this._styleAnchors.set(t,a))}}_getStyleAnchor(e){if(!e)return null;const t=this._styleAnchors.get(e);return t&&t.parentNode===this.shadowRoot?t:(t&&this._styleAnchors.delete(e),null)}_getRootStyleInsertionAnchor(e){for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];if(!(n instanceof HTMLStyleElement))return n}return null}_parseSlots(){const e=this._slots={};let t;for(;t=this.firstChild;){const n=1===t.nodeType&&t.getAttribute("slot")||"default";(e[n]||(e[n]=[])).push(t),this.removeChild(t)}}_renderSlots(){const e=this._getSlots(),t=this._instance.type.__scopeId;for(let n=0;n<e.length;n++){const r=e[n],s=r.getAttribute("name")||"default",o=this._slots[s],i=r.parentNode;if(o)for(const e of o){if(t&&1===e.nodeType){const n=t+"-s",r=document.createTreeWalker(e,1);let s;for(e.setAttribute(n,"");s=r.nextNode();)s.setAttribute(n,"")}i.insertBefore(e,r)}else for(;r.firstChild;)i.insertBefore(r.firstChild,r);i.removeChild(r)}}_getSlots(){const e=[this];this._teleportTargets&&e.push(...this._teleportTargets);const t=new Set;for(const n of e){const e=n.querySelectorAll("slot");for(let n=0;n<e.length;n++)t.add(e[n])}return Array.from(t)}_injectChildStyle(e,t){this._applyStyles(e.styles,e,t)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return!1!==this._def.shadowRoot}_removeChildStyle(e){}}const oo=e=>{const t=e.props["onUpdate:modelValue"]||!1;return p(t)?e=>D(t,e):t};function io(e){e.target.composing=!0}function lo(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ao=Symbol("_assign");function co(e,t,n){return t&&(e=e.trim()),n&&(e=M(e)),e}const uo={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[ao]=oo(s);const o=r||s.props&&"number"===s.props.type;Zs(e,t?"change":"input",t=>{t.target.composing||e[ao](co(e.value,n,o))}),(n||o)&&Zs(e,"change",()=>{e.value=co(e.value,n,o)}),t||(Zs(e,"compositionstart",io),Zs(e,"compositionend",lo),Zs(e,"change",lo))},mounted(e,{value:t}){e.value=null==t?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[ao]=oo(i),e.composing)return;const l=null==t?"":t;if((!o&&"number"!==e.type||/^0\d/.test(e.value)?e.value:M(e.value))!==l){if(document.activeElement===e&&"range"!==e.type){if(r&&t===n)return;if(s&&e.value.trim()===l)return}e.value=l}}},ho=["ctrl","shift","alt","meta"],po={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>ho.some(n=>e[`${n}Key`]&&!t.includes(n))},fo=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(n,...r)=>{for(let e=0;e<t.length;e++){const r=po[t[e]];if(r&&r(n,t))return}return e(n,...r)})},mo=c({patchProp:(e,t,n,r,s,o)=>{const i="svg"===s;"class"===t?function(e,t,n){const r=e[$s];r&&(t=(t?[t,...r]:[...r]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,r,i):"style"===t?function(e,t,n){const r=e.style,s=v(n);let o=!1;if(n&&!s){if(t)if(v(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&Ls(r,t,"")}else for(const e in t)null==n[e]&&Ls(r,e,"");for(const e in n)"display"===e&&(o=!0),Ls(r,e,n[e])}else if(s){if(t!==n){const e=r[Fs];e&&(n+=";"+e),r.cssText=n,o=qs.test(n)}}else t&&e.removeAttribute("style");Ds in e&&(e[Ds]=o?r.display:"",e[Ts]&&(r.display="none"))}(e,n,r):l(t)?a(t)||Qs(e,t,0,r,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,r){if(r)return"innerHTML"===t||"textContent"===t||!!(t in e&&to(t)&&y(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(to(t)&&v(n))return!1;return t in e}(e,t,r,i))?(Ks(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||Hs(e,t,r,i,0,"value"!==t)):e._isVueCE&&(function(e,t){const n=e._def.props;if(!n)return!1;const r=V(t);return Array.isArray(n)?n.some(e=>V(e)===r):Object.keys(n).some(e=>V(e)===r)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!v(r)))?Ks(e,V(t),r,0,t):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),Hs(e,t,r,i))}},Rs);let go;function yo(){return go||(go=Pr(mo))}const vo=(...e)=>{yo().render(...e)},_o=(...e)=>{const t=yo().createApp(...e),{mount:n}=t;return t.mount=e=>{const r=function(e){if(v(e)){return document.querySelector(e)}return e}(e);if(!r)return;const s=t._component;y(s)||s.render||s.template||(s.template=r.innerHTML),1===r.nodeType&&(r.textContent="");const o=n(r,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};const bo=["value","placeholder"],So=["value","placeholder"],xo={key:2,class:"errorlist"};t.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field",{errors:o.fieldErrors.length}])},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),o.isLong?(Br(),Jr("textarea",{key:0,class:"sf-input sf-textarea",rows:"3",value:n.modelValue,placeholder:n.schema.placeholder||"",onInput:t[0]||(t[0]=t=>e.$emit("update:modelValue",t.target.value))},null,40,bo)):(Br(),Jr("input",{key:1,type:"text",class:"sf-input",value:null!=n.modelValue?String(n.modelValue):"",placeholder:n.schema.placeholder||"",onInput:t[1]||(t[1]=t=>e.$emit("update:modelValue",t.target.value))},null,40,So)),o.fieldErrors.length?(Br(),Jr("ul",xo,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},t.__file="src/editors/StringEditor.vue";var ko={name:"NumberEditor",props:{schema:{type:Object,required:!0},modelValue:{default:0},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",onInput(e){const t=e.target.value;""===t?this.$emit("update:modelValue",0):this.$emit("update:modelValue","integer"===this.schema.type?parseInt(t,10):parseFloat(t))}}};const Eo=["step","min","max","value"],Co={key:0,class:"errorlist"};ko.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field",{errors:o.fieldErrors.length}])},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("input",{type:"number",class:"sf-input",step:"integer"===n.schema.type?"1":"any",min:null!=n.schema.minimum?String(n.schema.minimum):void 0,max:null!=n.schema.maximum?String(n.schema.maximum):void 0,value:null!=n.modelValue?n.modelValue:"",onInput:t[0]||(t[0]=(...e)=>o.onInput&&o.onInput(...e))},null,40,Eo),o.fieldErrors.length?(Br(),Jr("ul",Co,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},ko.__file="src/editors/NumberEditor.vue";var wo={name:"BooleanEditor",props:{schema:{type:Object,required:!0},modelValue:{default:!1},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):""}};const Ao={class:"sf-checkbox-label"},Oo=["checked"],Vo={key:0,class:"errorlist"};wo.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field sf-field-boolean",{errors:o.fieldErrors.length}])},[ts("label",Ao,[ts("input",{type:"checkbox",class:"sf-checkbox",checked:!!n.modelValue,onChange:t[0]||(t[0]=t=>e.$emit("update:modelValue",t.target.checked))},null,40,Oo),ss(" "+G(o.title),1)]),o.fieldErrors.length?(Br(),Jr("ul",Vo,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},wo.__file="src/editors/BooleanEditor.vue";var jo={name:"SelectEditor",props:{schema:{type:Object,required:!0},modelValue:{default:""},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):""}};const Po=["value"],Io=["value"],Ro={key:0,class:"errorlist"};jo.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field",{errors:o.fieldErrors.length}])},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("select",{class:"sf-input sf-select",value:null!=n.modelValue?String(n.modelValue):"",onChange:t[0]||(t[0]=t=>e.$emit("update:modelValue",t.target.value))},[(Br(!0),Jr(Fr,null,Nn(n.schema.enum||[],e=>(Br(),Jr("option",{key:e,value:String(e)},G(e),9,Io))),128))],40,Po),o.fieldErrors.length?(Br(),Jr("ul",Ro,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},jo.__file="src/editors/SelectEditor.vue";var $o={name:"HiddenEditor",props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{resolvedValue(){return"const"in this.schema?this.schema.const:this.schema.enum&&1===this.schema.enum.length?this.schema.enum[0]:this.modelValue}},mounted(){this.resolvedValue!==this.modelValue&&this.$emit("update:modelValue",this.resolvedValue)},methods:{getValue(){return this.resolvedValue}}};const Do={style:{display:"none"}};$o.render=function(e,t,n,r,s,o){return Br(),Jr("div",Do)},$o.__file="src/editors/HiddenEditor.vue";var To={name:"SfIcon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:14}}};const Mo=["width","height"],No={key:4,points:"6 9 12 15 18 9"},Fo={key:5,points:"18 15 12 9 6 15"};function qo(e,t){if(null==e||"object"!=typeof e)return!1;if(!(t in e))return!1;const n=e[t];return null!=n&&""!==n}function Uo(e,t){if(!t||"object"!=typeof t)return!0;if("const"in t)return e===t.const;if(Array.isArray(t.enum))return t.enum.includes(e);if(t.type){const n=t.type;if("string"===n&&"string"!=typeof e)return!1;if("number"===n&&"number"!=typeof e)return!1;if("integer"===n&&("number"!=typeof e||!Number.isInteger(e)))return!1;if("boolean"===n&&"boolean"!=typeof e)return!1;if("null"===n&&null!==e)return!1;if("array"===n&&!Array.isArray(e))return!1;if("object"===n&&(null==e||"object"!=typeof e||Array.isArray(e)))return!1}if("number"==typeof e){if("number"==typeof t.minimum&&e<t.minimum)return!1;if("number"==typeof t.maximum&&e>t.maximum)return!1;if("number"==typeof t.exclusiveMinimum&&e<=t.exclusiveMinimum)return!1;if("number"==typeof t.exclusiveMaximum&&e>=t.exclusiveMaximum)return!1;if("number"==typeof t.multipleOf&&t.multipleOf>0){const n=e/t.multipleOf;if(Math.abs(n-Math.round(n))>1e-9)return!1}}if("string"==typeof e){if("number"==typeof t.minLength&&e.length<t.minLength)return!1;if("number"==typeof t.maxLength&&e.length>t.maxLength)return!1;if("string"==typeof t.pattern)try{if(!new RegExp(t.pattern).test(e))return!1}catch(e){return!1}}return!t.not||!Lo(e,t.not)}function Lo(e,t){if(!t||"object"!=typeof t)return!0;if(Array.isArray(t.required))for(const n of t.required)if(!qo(e,n))return!1;if(t.properties&&"object"==typeof t.properties)for(const[n,r]of Object.entries(t.properties))if(null!=e&&n in e&&!Uo(e[n],r))return!1;if(t.not&&Lo(e,t.not))return!1;if(Array.isArray(t.allOf)&&!t.allOf.every(t=>Lo(e,t)))return!1;if(Array.isArray(t.anyOf)&&!t.anyOf.some(t=>Lo(e,t)))return!1;if(Array.isArray(t.oneOf)){if(1!==t.oneOf.filter(t=>Lo(e,t)).length)return!1}return!0}function zo(e,t,n){if(!t||"object"!=typeof t)return e;if(t.properties){const r=[];for(const[n,s]of Object.entries(t.properties)){const t=e.properties&&e.properties[n];r.push([n,t?{...t,...s}:s])}e.properties=function(e,t,n){const r=Object.keys(e),s=t?r.indexOf(t):-1;if(-1===s){const t={...e};for(const[e,r]of n)t[e]=r;return t}const o={};for(let t=0;t<r.length;t++){const i=r[t];if(o[i]=e[i],t===s)for(const[t,r]of n)t in e||(o[t]=r)}for(const[t,r]of n)t in e&&(o[t]=r);return o}(e.properties||{},n,r)}if(Array.isArray(t.required)){const n=new Set(e.required||[]);for(const e of t.required)n.add(e);e.required=Array.from(n)}return t.allOf&&(e.allOf=[...e.allOf||[],...t.allOf]),t.if&&(e.allOf=[...e.allOf||[],{if:t.if,then:t.then,else:t.else}]),t.dependentSchemas&&(e.dependentSchemas={...e.dependentSchemas||{},...t.dependentSchemas}),t.dependentRequired&&(e.dependentRequired={...e.dependentRequired||{},...t.dependentRequired}),e}function Wo(e,t,n){const r="function"==typeof n?n:e=>e;if(!e||"object"!=typeof e)return e;if("object"!==e.type&&!e.properties)return e;let s={...e,properties:{...e.properties||{}},required:Array.isArray(e.required)?[...e.required]:[]};const o=t&&"object"==typeof t?t:{},i=e=>{if(!e||"object"!=typeof e)return null;const t=e.properties&&Object.keys(e.properties);return t&&t.length?t[0]:Array.isArray(e.required)&&e.required.length?e.required[0]:null},l=[];if(s.if&&l.push({if:s.if,then:s.then,else:s.else,anchor:i(s.if)}),Array.isArray(s.allOf))for(const e of s.allOf)e&&"object"==typeof e&&e.if?l.push({if:e.if,then:e.then,else:e.else,anchor:i(e.if)}):e&&"object"==typeof e&&(e.properties||e.required)&&zo(s,e);for(let e=0;e<8;e++){let e=!1;const t=JSON.stringify({p:s.properties,r:s.required});for(const e of l){const t=Lo(o,e.if)?e.then:e.else;t&&zo(s,r(t),e.anchor)}if(s.dependentSchemas)for(const[e,t]of Object.entries(s.dependentSchemas))qo(o,e)&&zo(s,r(t),e);if(s.dependentRequired)for(const[e,t]of Object.entries(s.dependentRequired))if(qo(o,e)&&Array.isArray(t)){const e=new Set(s.required||[]);for(const n of t)e.add(n);s.required=Array.from(e)}if(JSON.stringify({p:s.properties,r:s.required})!==t&&(e=!0),!e)break}return s}function Bo(e){return!(!e||"object"!=typeof e)&&(!!(e.if||e.dependentSchemas||e.dependentRequired)||!!Array.isArray(e.allOf)&&e.allOf.some(e=>e&&"object"==typeof e&&(e.if||e.dependentSchemas)))}To.render=function(e,t,n,r,s,o){return Br(),Jr("svg",{class:"sf-icon",width:n.size,height:n.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},["plus"===n.name?(Br(),Jr(Fr,{key:0},[t[0]||(t[0]=ts("line",{x1:"12",y1:"5",x2:"12",y2:"19"},null,-1)),t[1]||(t[1]=ts("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1))],64)):"times"===n.name?(Br(),Jr(Fr,{key:1},[t[2]||(t[2]=ts("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),t[3]||(t[3]=ts("line",{x1:"6",y1:"18",x2:"18",y2:"6"},null,-1))],64)):"arrow-up"===n.name?(Br(),Jr(Fr,{key:2},[t[4]||(t[4]=ts("line",{x1:"12",y1:"19",x2:"12",y2:"5"},null,-1)),t[5]||(t[5]=ts("polyline",{points:"5 12 12 5 19 12"},null,-1))],64)):"arrow-down"===n.name?(Br(),Jr(Fr,{key:3},[t[6]||(t[6]=ts("line",{x1:"12",y1:"5",x2:"12",y2:"19"},null,-1)),t[7]||(t[7]=ts("polyline",{points:"19 12 12 19 5 12"},null,-1))],64)):"chevron-down"===n.name?(Br(),Jr("polyline",No)):"chevron-up"===n.name?(Br(),Jr("polyline",Fo)):"grip"===n.name?(Br(),Jr(Fr,{key:6},[t[8]||(t[8]=os('<circle cx="9" cy="7" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="7" r="1" fill="currentColor" stroke="none"></circle><circle cx="9" cy="12" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="12" r="1" fill="currentColor" stroke="none"></circle><circle cx="9" cy="17" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="17" r="1" fill="currentColor" stroke="none"></circle>',6))],64)):is("v-if",!0)],8,Mo)},To.__file="src/editors/SfIcon.vue";var Ho={name:"ObjectEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi,this.$options.components.SfIcon=To},props:{schema:{type:Object,required:!0},modelValue:{default:()=>({})},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],data:()=>({collapsed:!1}),computed:{isRoot(){return 0===this.path.length},title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},effectiveSchema(){return Bo(this.schema)?Wo(this.schema,this.modelValue||{},this.form?.resolveSchema):this.schema},summary(){const e=this.modelValue||{},t=[];for(const n of Object.keys(this.effectiveSchema.properties||{})){if(t.length>=3)break;const r=e[n];null!=r&&""!==r&&"object"!=typeof r&&t.push(String(r))}return t.join(" · ")}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",collapse(){this.collapsed=!0},expand(){this.collapsed=!1},onChildChange(e,t){const n={...this.modelValue||{},[e]:t};this.$emit("update:modelValue",this.pruneInactive(n))},pruneInactive(e){if(!Bo(this.schema))return e;const t=Wo(this.schema,e,this.form?.resolveSchema),n=new Set(Object.keys(t.properties||{}));let r=!1;const s={};for(const t of Object.keys(e))n.has(t)?s[t]=e[t]:r=!0;return r?s:e}}};const Ko={key:0,class:"sf-object sf-object-root"},Zo={class:"sf-object-fields"},Jo={class:"sf-object-title"},Qo=["aria-label"],Go={class:"sf-object-title-text"},Xo={key:0,class:"sf-object-summary"},Yo={class:"sf-object-fields"};function ei(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(ei);const t={};for(const n of Object.keys(e))t[n]=ei(e[n]);return t}function ti(e){if("default"in e)return ei(e.default);if("object"===e.type){const t={};for(const[n,r]of Object.entries(e.properties||{}))"default"in r?t[n]=ei(r.default):"string"===r.type?t[n]="":"integer"===r.type||"number"===r.type?t[n]=0:"boolean"===r.type?t[n]=!1:"array"===r.type&&(t[n]=[]);return t}return"array"===e.type?[]:"string"===e.type?"":"integer"===e.type||"number"===e.type?0:"boolean"!==e.type&&("relation"===e.type&&e.multiple?[]:null)}Ho.render=function(e,t,n,r,s,o){const i=$n("SchemaEditor"),l=$n("SfIcon");return o.isRoot?(Br(),Jr("div",Ko,[ts("div",Zo,[(Br(!0),Jr(Fr,null,Nn(o.effectiveSchema.properties||{},(e,t)=>(Br(),Qr(i,{key:t,schema:n.form.resolveSchema(e),"model-value":(n.modelValue||{})[t],path:[...n.path,t],form:n.form,"onUpdate:modelValue":e=>o.onChildChange(t,e)},null,8,["schema","model-value","path","form","onUpdate:modelValue"]))),128))])])):(Br(),Jr("fieldset",{key:1,class:H(["sf-object",{"sf-object-collapsed":s.collapsed}])},[ts("legend",Jo,[ts("button",{type:"button",class:"sf-collapse-btn","aria-label":s.collapsed?"Expand":"Collapse",onClick:t[0]||(t[0]=e=>s.collapsed=!s.collapsed)},[ns(l,{name:s.collapsed?"chevron-down":"chevron-up",size:12},null,8,["name"])],8,Qo),ts("span",Go,G(o.title),1),s.collapsed&&o.summary?(Br(),Jr("span",Xo,G(o.summary),1)):is("v-if",!0)]),Xt(ts("div",Yo,[(Br(!0),Jr(Fr,null,Nn(o.effectiveSchema.properties||{},(e,t)=>(Br(),Qr(i,{key:t,schema:n.form.resolveSchema(e),"model-value":(n.modelValue||{})[t],path:[...n.path,t],form:n.form,"onUpdate:modelValue":e=>o.onChildChange(t,e)},null,8,["schema","model-value","path","form","onUpdate:modelValue"]))),128))],512),[[Ms,!s.collapsed]])],2))},Ho.__file="src/editors/ObjectEditor.vue";let ni=0;var ri={name:"ArrayEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi,this.$options.components.SfIcon=To},props:{schema:{type:Object,required:!0},modelValue:{default:()=>[]},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],data(){return{items:(Array.isArray(this.modelValue)?this.modelValue:[]).map(e=>({_key:ni++,value:e})),dragSourceIndex:null,dragOverIndex:null,allCollapsed:!1}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},itemSchema(){return this.form.resolveSchema(this.schema.items||{})},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",addItem(){const e=ti(this.itemSchema);this.items.push({_key:ni++,value:e}),this.emitValue()},removeItem(e){this.items.splice(e,1),this.emitValue()},moveItem(e,t){const n=e+t;if(n<0||n>=this.items.length)return;const r=this.items[e];this.items.splice(e,1,this.items[n]),this.items.splice(n,1,r),this.emitValue()},onItemChange(e,t){this.items[e].value=t,this.emitValue()},onDragStart(e,t){this.dragSourceIndex=e,t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",String(e))},onDragOver(e){null!==this.dragSourceIndex&&e!==this.dragSourceIndex&&(this.dragOverIndex=e)},onDragLeave(e){this.dragOverIndex===e&&(this.dragOverIndex=null)},onDrop(e){if(null===this.dragSourceIndex||this.dragSourceIndex===e)return;const t=this.items.splice(this.dragSourceIndex,1)[0];this.items.splice(e,0,t),this.dragSourceIndex=null,this.dragOverIndex=null,this.emitValue()},onDragEnd(){this.dragSourceIndex=null,this.dragOverIndex=null},toggleCollapseAll(){this.allCollapsed=!this.allCollapsed;const e=this.$refs.itemEditors;if(!e)return;const t=Array.isArray(e)?e:[e];this.allCollapsed?t.forEach(e=>e?.collapseAll?.()):t.forEach(e=>e?.expandAll?.())},emitValue(){this.$emit("update:modelValue",this.items.map(e=>e.value))}}};const si={class:"sf-array-header"},oi={class:"sf-label"},ii={class:"sf-array-count"},li=["title"],ai={class:"sf-array-items"},ci=["onDragstart","onDragover","onDragleave","onDrop"],ui={class:"sf-array-item-header"},hi={class:"sf-array-item-left"},di={class:"sf-drag-handle",title:"Drag to reorder"},pi={class:"sf-array-item-index"},fi={class:"sf-array-item-actions"},mi=["onClick"],gi=["onClick"],yi=["onClick"],vi=["onDrop"],_i={key:0,class:"errorlist"};ri.render=function(e,t,n,r,s,o){const i=$n("SfIcon"),l=$n("SchemaEditor");return Br(),Jr("div",{class:H(["sf-array",{errors:o.fieldErrors.length}])},[ts("div",si,[ts("span",oi,G(o.title),1),ts("span",ii,G(s.items.length),1),ts("button",{type:"button",class:"sf-btn sf-btn-add",onClick:t[0]||(t[0]=e=>o.addItem())},[ns(i,{name:"plus"}),t[4]||(t[4]=ss(" Add ",-1))]),s.items.length?(Br(),Jr("span",{key:0,class:"sf-array-collapse-toggle",title:s.allCollapsed?"Expand all":"Collapse all",onClick:t[1]||(t[1]=(...e)=>o.toggleCollapseAll&&o.toggleCollapseAll(...e))},[ns(i,{name:s.allCollapsed?"chevron-down":"chevron-up"},null,8,["name"])],8,li)):is("v-if",!0)]),ts("div",ai,[(Br(!0),Jr(Fr,null,Nn(s.items,(e,r)=>(Br(),Jr("div",{key:e._key,class:H(["sf-array-item",{"sf-drag-over":s.dragOverIndex===r,"sf-dragging":s.dragSourceIndex===r}]),draggable:"true",onDragstart:e=>o.onDragStart(r,e),onDragover:fo(e=>o.onDragOver(r),["prevent"]),onDragleave:e=>o.onDragLeave(r),onDrop:fo(e=>o.onDrop(r),["prevent"]),onDragend:t[3]||(t[3]=(...e)=>o.onDragEnd&&o.onDragEnd(...e))},[ts("div",ui,[ts("div",hi,[ts("span",di,[ns(i,{name:"grip"})]),ts("span",pi,"#"+G(r+1),1)]),ts("div",fi,[r>0?(Br(),Jr("button",{key:0,type:"button",class:"sf-btn sf-btn-sm",onClick:e=>o.moveItem(r,-1)},[ns(i,{name:"arrow-up"})],8,mi)):is("v-if",!0),r<s.items.length-1?(Br(),Jr("button",{key:1,type:"button",class:"sf-btn sf-btn-sm",onClick:e=>o.moveItem(r,1)},[ns(i,{name:"arrow-down"})],8,gi)):is("v-if",!0),ts("button",{type:"button",class:"sf-btn sf-btn-sm sf-btn-danger",onClick:e=>o.removeItem(r)},[ns(i,{name:"times"})],8,yi)])]),ts("div",{class:"sf-array-item-body",onDragover:t[2]||(t[2]=fo(()=>{},["prevent"])),onDrop:fo(e=>o.onDrop(r),["prevent"])},[ns(l,{ref_for:!0,ref:"itemEditors",schema:o.itemSchema,"model-value":e.value,path:[...n.path,String(r)],form:n.form,"onUpdate:modelValue":e=>o.onItemChange(r,e)},null,8,["schema","model-value","path","form","onUpdate:modelValue"])],40,vi)],42,ci))),128))]),o.fieldErrors.length?(Br(),Jr("ul",_i,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},ri.__file="src/editors/ArrayEditor.vue";var bi={name:"NullableEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi,this.$options.components.SfIcon=To},props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],data(){return{isNull:null===this.modelValue||void 0===this.modelValue}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},innerSchema(){const e={...this.schema};return delete e._nullable,e},toggleClass(){return this.isNull?"sf-btn sf-btn-sm sf-btn-add":"sf-btn sf-btn-sm sf-btn-danger"},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},watch:{modelValue(e){this.isNull=null==e}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",toggle(){this.isNull?(this.isNull=!1,this.$emit("update:modelValue",ti(this.innerSchema))):(this.isNull=!0,this.$emit("update:modelValue",null))}}};const Si={class:"sf-nullable-header"},xi={class:"sf-nullable-body"},ki={key:0,class:"errorlist"};bi.render=function(e,t,n,r,s,o){const i=$n("SfIcon"),l=$n("SchemaEditor");return Br(),Jr("div",{class:H(["sf-nullable",{errors:o.fieldErrors.length}])},[ts("div",Si,[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("button",{type:"button",class:H(o.toggleClass),onClick:t[0]||(t[0]=(...e)=>o.toggle&&o.toggle(...e))},[s.isNull?(Br(),Jr(Fr,{key:0},[ns(i,{name:"plus"}),t[2]||(t[2]=ss(" Add ",-1))],64)):(Br(),Jr(Fr,{key:1},[ns(i,{name:"times"}),t[3]||(t[3]=ss(" Remove ",-1))],64))],2)]),ts("div",xi,[s.isNull?is("v-if",!0):(Br(),Qr(l,{key:0,schema:o.innerSchema,"model-value":n.modelValue,path:n.path,form:n.form,"onUpdate:modelValue":t[1]||(t[1]=t=>e.$emit("update:modelValue",t))},null,8,["schema","model-value","path","form"]))]),o.fieldErrors.length?(Br(),Jr("ul",ki,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},bi.__file="src/editors/NullableEditor.vue";var Ei={name:"UnionEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi},props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],data(){const e=this.schema.discriminator.propertyName,t=this.schema.discriminator.mapping;return{discriminatorProp:e,mapping:t,currentType:this.modelValue?this.modelValue[e]:Object.keys(t)[0]}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},typeKeys(){return Object.keys(this.mapping)},currentSchema(){const e=this.mapping[this.currentType];return this.form.resolveSchema({$ref:e})},innerValue(){if(this.modelValue&&this.modelValue[this.discriminatorProp]===this.currentType)return this.modelValue;const e=ti(this.currentSchema);return e[this.discriminatorProp]=this.currentType,e}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",onTypeChange(e){this.currentType=e.target.value;const t=ti(this.currentSchema);t[this.discriminatorProp]=this.currentType,this.$emit("update:modelValue",t)},onInnerChange(e){e&&(e[this.discriminatorProp]=this.currentType),this.$emit("update:modelValue",e)}}};const Ci={class:"sf-union"},wi={class:"sf-field"},Ai={class:"sf-label"},Oi=["value"],Vi=["value"],ji={class:"sf-union-body"};Ei.render=function(e,t,n,r,s,o){const i=$n("SchemaEditor");return Br(),Jr("div",Ci,[ts("div",wi,[ts("label",Ai,G(o.title),1),ts("select",{class:"sf-input sf-select",value:s.currentType,onChange:t[0]||(t[0]=(...e)=>o.onTypeChange&&o.onTypeChange(...e))},[(Br(!0),Jr(Fr,null,Nn(o.typeKeys,e=>(Br(),Jr("option",{key:e,value:e},G(o.humanize(e)),9,Vi))),128))],40,Oi)]),ts("div",ji,[(Br(),Qr(i,{key:s.currentType,schema:o.currentSchema,"model-value":o.innerValue,path:n.path,form:n.form,"onUpdate:modelValue":o.onInnerChange},null,8,["schema","model-value","path","form","onUpdate:modelValue"]))])])},Ei.__file="src/editors/UnionEditor.vue";var Pi={name:"RelationEditor",components:{SfIcon:To},props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],data(){const e=!!this.schema.multiple,t=this.modelValue;let n;return n=e?Array.isArray(t)?[...t]:[]:t?[t]:[],{isMultiple:e,allowClear:this.schema.options?.select2?.allowClear??!0,placeholder:this.schema.options?.select2?.placeholder||"Search...",searchUrl:this.schema.options?.select2?.ajax?.url||"",selected:n,dropdownVisible:!1,searchResults:[],currentPage:1,hasMore:!1,loading:!1,highlightIndex:-1,searchQuery:""}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},showSearch(){return!(!this.isMultiple&&this.selected.length>0)},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]},filteredResults(){const e=new Set(this.selected.map(e=>this.itemKey(e)));return this.searchResults.filter(t=>!e.has(this.itemKey(t)))}},created(){this._doSearch=function(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}(e=>this.fetchResults(e,1),300),this._onDocClick=e=>{this.$refs.root&&!this.$refs.root.contains(e.target)&&this.closeDropdown()}},mounted(){document.addEventListener("click",this._onDocClick)},beforeUnmount(){document.removeEventListener("click",this._onDocClick)},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",getDisplayName(e){if(!e)return"";for(const t of["__str__","name","title","label"])if(e[t])return String(e[t]);return`#${e.id||"?"}`},itemKey:e=>`${e.id}-${e.model||""}`,onSearchInput(){this._doSearch(this.searchQuery)},openDropdown(){this.dropdownVisible||(this.dropdownVisible=!0,this.fetchResults(this.searchQuery,1))},closeDropdown(){this.dropdownVisible=!1,this.highlightIndex=-1},async fetchResults(e,t){if(this.searchUrl){this.loading=!0,this.currentPage=t;try{const n=new URL(this.searchUrl,window.location.origin);n.searchParams.set("_q",e||""),n.searchParams.set("page",String(t));const r=await fetch(n,{credentials:"same-origin"});if(!r.ok)return;const s=await r.json();this.searchResults=1===t?s.items||[]:this.searchResults.concat(s.items||[]),this.hasMore=s.more}finally{this.loading=!1}}},handleKeyDown(e){this.filteredResults.length&&("ArrowDown"===e.key?(e.preventDefault(),this.highlightIndex=Math.min(this.highlightIndex+1,this.filteredResults.length-1)):"ArrowUp"===e.key?(e.preventDefault(),this.highlightIndex=Math.max(this.highlightIndex-1,0)):"Enter"===e.key?(e.preventDefault(),this.highlightIndex>=0&&this.highlightIndex<this.filteredResults.length&&this.selectItem(this.filteredResults[this.highlightIndex])):"Escape"===e.key&&this.closeDropdown())},selectItem(e){this.isMultiple?this.selected.push(e):this.selected=[e],this.searchQuery="",this.highlightIndex=-1,this.closeDropdown(),this.emitValue()},removeItem(e){this.selected=this.selected.filter(t=>!(t.id===e.id&&(t.model||"")===(e.model||""))),this.emitValue()},emitValue(){this.isMultiple?this.$emit("update:modelValue",[...this.selected]):this.$emit("update:modelValue",this.selected[0]||null)}}};const Ii={class:"sf-relation-wrapper"},Ri={key:0,class:"sf-relation-selected"},$i={class:"sf-relation-tag-text"},Di=["onClick"],Ti={class:"sf-relation-search"},Mi=["placeholder"],Ni={class:"sf-relation-dropdown"},Fi={key:0,class:"sf-relation-dropdown-empty"},qi=["onClick"],Ui={key:0,class:"errorlist"};Pi.render=function(e,t,n,r,s,o){const i=$n("SfIcon");return Br(),Jr("div",{class:H(["sf-field sf-relation",{errors:o.fieldErrors.length}]),ref:"root"},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("div",Ii,[is(" Selected items "),s.selected.length?(Br(),Jr("div",Ri,[(Br(!0),Jr(Fr,null,Nn(s.selected,e=>(Br(),Jr("div",{key:o.itemKey(e),class:"sf-relation-tag"},[ts("span",$i,G(o.getDisplayName(e)),1),s.isMultiple||s.allowClear?(Br(),Jr("button",{key:0,type:"button",class:"sf-relation-tag-remove",onClick:fo(t=>o.removeItem(e),["stop"])},[ns(i,{name:"times"})],8,Di)):is("v-if",!0)]))),128))])):is("v-if",!0),is(" Search box "),Xt(ts("div",Ti,[Xt(ts("input",{ref:"searchInput",type:"text",class:"sf-input sf-relation-input",placeholder:s.placeholder,autocomplete:"off","onUpdate:modelValue":t[0]||(t[0]=e=>s.searchQuery=e),onInput:t[1]||(t[1]=(...e)=>o.onSearchInput&&o.onSearchInput(...e)),onFocus:t[2]||(t[2]=(...e)=>o.openDropdown&&o.openDropdown(...e)),onKeydown:t[3]||(t[3]=(...e)=>o.handleKeyDown&&o.handleKeyDown(...e))},null,40,Mi),[[uo,s.searchQuery]]),is(" Dropdown "),Xt(ts("div",Ni,[0!==o.filteredResults.length||s.loading?is("v-if",!0):(Br(),Jr("div",Fi," No results found ")),(Br(!0),Jr(Fr,null,Nn(o.filteredResults,(e,t)=>(Br(),Jr("div",{key:o.itemKey(e),class:H(["sf-relation-dropdown-item",{highlighted:t===s.highlightIndex}]),onClick:t=>o.selectItem(e)},G(o.getDisplayName(e)),11,qi))),128)),s.hasMore?(Br(),Jr("div",{key:1,class:"sf-relation-dropdown-more",onClick:t[4]||(t[4]=e=>o.fetchResults(s.searchQuery,s.currentPage+1))}," Load more... ")):is("v-if",!0)],512),[[Ms,s.dropdownVisible]])],512),[[Ms,o.showSearch]])]),o.fieldErrors.length?(Br(),Jr("ul",Ui,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},Pi.__file="src/editors/RelationEditor.vue";var Li={name:"WebComponentWrapper",props:{tagName:{type:String,required:!0},schema:{type:Object,required:!0},modelValue:{default:void 0},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=St(null);function r(){const t=n.value;t&&(t.schema=e.schema,t.modelValue=e.modelValue,t.path=e.path,t.form=e.form)}function s(e){const n=null!=e.detail?Array.isArray(e.detail)?e.detail[0]:e.detail:void 0;t("update:modelValue",n)}return En(()=>{r();const e=n.value;e&&(e.addEventListener("update:model-value",s),e.addEventListener("change",s))}),An(()=>{const e=n.value;e&&(e.removeEventListener("update:model-value",s),e.removeEventListener("change",s))}),nn(()=>[e.schema,e.modelValue,e.path,e.form],r,{deep:!0}),()=>function(e,t,n){try{Kr(-1);const r=arguments.length;return 2===r?b(t)&&!p(t)?Gr(t)?ns(e,null,[t]):ns(e,t):ns(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&Gr(n)&&(n=[n]),ns(e,t,n))}finally{Kr(1)}}(e.tagName,{ref:n})},__file:"src/editors/WebComponentWrapper.vue"};var zi={name:"SchemaEditor",components:{StringEditor:t,NumberEditor:ko,BooleanEditor:wo,SelectEditor:jo,HiddenEditor:$o,ObjectEditor:Ho,ArrayEditor:ri,NullableEditor:bi,UnionEditor:Ei,RelationEditor:Pi,WebComponentWrapper:Li},inject:{customEditors:{default:()=>()=>[]}},props:{schema:{type:Object,required:!0},modelValue:{default:void 0},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],methods:{collapseAll(){const e=this.$refs.editor;e?.collapse&&e.collapse(),e?.collapseAll&&e.collapseAll()},expandAll(){const e=this.$refs.editor;e?.expand&&e.expand(),e?.expandAll&&e.expandAll()}},computed:{isWebComponent(){const e=this.editorComponent;return"string"==typeof e&&e.includes("-")},editorComponent(){const e=this.schema;if(this.path.length>12)return"StringEditor";const t=this.customEditors();for(const n of t)if(n.match(e,this.path))return n.component;return"relation"===e.type?"RelationEditor":e.oneOf&&e.discriminator?"UnionEditor":"const"in e||e.enum&&1===e.enum.length&&"string"===e.type?"HiddenEditor":e._nullable?"NullableEditor":"object"===e.type&&e.properties?"ObjectEditor":"array"===e.type?"ArrayEditor":e.enum?"SelectEditor":"boolean"===e.type?"BooleanEditor":"number"===e.type||"integer"===e.type?"NumberEditor":"StringEditor"}}};zi.render=function(e,t,n,r,s,o){const i=$n("WebComponentWrapper");return o.isWebComponent?(Br(),Qr(i,{key:0,ref:"editor","tag-name":o.editorComponent,schema:n.schema,"model-value":n.modelValue,path:n.path,form:n.form,"onUpdate:modelValue":t[0]||(t[0]=t=>e.$emit("update:modelValue",t))},null,8,["tag-name","schema","model-value","path","form"])):(Br(),Qr((l=o.editorComponent,v(l)?Tn(Rn,l,!1)||l:l||Dn),{key:1,ref:"editor",schema:n.schema,"model-value":n.modelValue,path:n.path,form:n.form,"onUpdate:modelValue":t[1]||(t[1]=t=>e.$emit("update:modelValue",t))},null,8,["schema","model-value","path","form"]));var l},zi.__file="src/editors/SchemaEditor.vue";var Wi={name:"SchemaForm",components:{SchemaEditor:zi},props:{schema:{type:[Object,String],default:()=>({})},initialData:{default:void 0},errors:{type:Object,default:()=>({})},customEditors:{type:Array,default:()=>[]}},emits:["change"],expose:["getValue"],provide(){return{customEditors:()=>this.customEditors}},data(){const e="string"==typeof this.schema?JSON.parse(this.schema):this.schema;return{rootSchema:e,defs:e.$defs||e.definitions||{},currentValue:null!=this.initialData?ei(this.initialData):void 0}},computed:{resolvedSchema(){return this.resolveSchema(this.rootSchema)},formApi(){return{resolveSchema:e=>this.resolveSchema(e),getSchemaAtPath:e=>this.getSchemaAtPath(e),getEffectiveSchemaAtPath:e=>this.getEffectiveSchemaAtPath(e),getErrorsForPath:e=>this.getErrorsForPath(e)}}},watch:{schema:{handler(e){const t="string"==typeof e?JSON.parse(e):e;this.rootSchema=t,this.defs=t.$defs||t.definitions||{}},deep:!0},initialData:{handler(e){this.currentValue=null!=e?ei(e):void 0},deep:!0}},methods:{resolveSchema(e){if(!e)return{type:"string"};if(e.$ref){const t=e.$ref.replace(/^#\/\$defs\//,"").replace(/^#\/definitions\//,""),n=this.defs[t];if(!n)return{type:"string",title:t};const{$ref:r,...s}=e;return{...this.resolveSchema(n),...s}}if(e.anyOf){const t=e.anyOf.filter(e=>"null"!==e.type);if(e.anyOf.some(e=>"null"===e.type)&&1===t.length){const n=this.resolveSchema(t[0]);return{...n,_nullable:!0,title:e.title||n.title,default:"default"in e?e.default:null}}if(t.length>=1)return this.resolveSchema(t[0])}if(e.oneOf&&e.discriminator)return e;if(e.oneOf){const t=e.oneOf.filter(e=>"null"!==e.type);if(e.oneOf.some(e=>"null"===e.type)&&1===t.length){const n=this.resolveSchema(t[0]);return{...n,_nullable:!0,title:e.title||n.title,default:"default"in e?e.default:null}}if(t.length>=1)return this.resolveSchema(t[0])}return e},getSchemaAtPath(e){let t=this.resolveSchema(this.rootSchema);for(const n of e){if(!t)return null;if(t.properties&&t.properties[n])t=this.resolveSchema(t.properties[n]);else{if(!t.items)return null;t=this.resolveSchema(t.items)}}return t},getEffectiveSchemaAtPath(e){let t=this.resolveSchema(this.rootSchema),n=this.currentValue;for(const r of e){if(!t)return null;if((t.properties||t.if||t.allOf||t.dependentSchemas)&&Bo(t)&&(t=Wo(t,n||{},e=>this.resolveSchema(e))),t.properties&&void 0!==t.properties[r])t=this.resolveSchema(t.properties[r]),n=null!=n?n[r]:void 0;else{if(!t.items)return null;t=this.resolveSchema(t.items),n=Array.isArray(n)?n[r]:void 0}}return t&&Bo(t)&&(t=Wo(t,n||{})),t},onValueChange(e){this.currentValue=e,this.$emit("change",e)},getErrorsForPath(e){if(!this.errors||"object"!=typeof this.errors)return[];const t=e.join(".");return this.errors[t]||[]},getValue(){return this.currentValue}}};const Bi={class:"structured-field-editor"};Wi.render=function(e,t,n,r,s,o){const i=$n("SchemaEditor");return Br(),Jr("div",Bi,[o.resolvedSchema?(Br(),Qr(i,{key:0,schema:o.resolvedSchema,"model-value":s.currentValue,path:[],form:o.formApi,"onUpdate:modelValue":o.onValueChange},null,8,["schema","model-value","form","onUpdate:modelValue"])):is("v-if",!0)])},Wi.__file="src/SchemaForm.vue";class Hi extends HTMLElement{constructor(){super(),this._schema={},this._modelValue=void 0,this._path=[],this._form=null,this._connected=!1}get schema(){return this._schema}set schema(e){this._schema=e,this._connected&&this.update()}get modelValue(){return this._modelValue}set modelValue(e){this._modelValue=e,this._connected&&this.update()}get path(){return this._path}set path(e){this._path=e,this._connected&&this.update()}get form(){return this._form}set form(e){this._form=e,this._connected&&this.update()}connectedCallback(){this._connected=!0,this.render()}disconnectedCallback(){this._connected=!1}emitChange(e){this.dispatchEvent(new CustomEvent("change",{detail:e}))}getErrors(){return this._form?.getErrorsForPath?.(this._path)??[]}render(){}update(){}}const Ki=function(e,t,n){let r=function(e,t){return y(e)?(()=>c({name:e.name},t,{setup:e}))():e}(e,t);E(r)&&(r=c({},r,t));class s extends so{constructor(e){super(r,e,n)}}return s.def=r,s}({...Wi,shadowRoot:!1});return e.ArrayEditor=ri,e.BaseEditorElement=Hi,e.BooleanEditor=wo,e.HiddenEditor=$o,e.NullableEditor=bi,e.NumberEditor=ko,e.ObjectEditor=Ho,e.RelationEditor=Pi,e.SchemaEditor=zi,e.SchemaForm=Wi,e.SchemaFormElement=Ki,e.SelectEditor=jo,e.StringEditor=t,e.UnionEditor=Ei,e.WebComponentWrapper=Li,e.applyConditionals=Wo,e.hasConditionals=Bo,e.matchesSchema=Lo,e.registerCustomElement=function(e="schema-form"){customElements.get(e)||customElements.define(e,Ki)},e}({});
|
|
24
|
+
**/let Os;const Vs="undefined"!=typeof window&&window.trustedTypes;if(Vs)try{Os=Vs.createPolicy("vue",{createHTML:e=>e})}catch(e){}const js=Os?e=>Os.createHTML(e):e=>e,Ps="undefined"!=typeof document?document:null,Is=Ps&&Ps.createElement("template"),Rs={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s="svg"===t?Ps.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?Ps.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?Ps.createElement(e,{is:n}):Ps.createElement(e);return"select"===e&&r&&null!=r.multiple&&s.setAttribute("multiple",r.multiple),s},createText:e=>Ps.createTextNode(e),createComment:e=>Ps.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ps.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),s!==o&&(s=s.nextSibling););else{Is.innerHTML=js("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);const s=Is.content;if("svg"===r||"mathml"===r){const e=s.firstChild;for(;e.firstChild;)s.appendChild(e.firstChild);s.removeChild(e)}t.insertBefore(s,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},$s=Symbol("_vtc");const Ds=Symbol("_vod"),Ts=Symbol("_vsh"),Ms={name:"show",beforeMount(e,{value:t},{transition:n}){e[Ds]="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):Ns(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Ns(e,!0),r.enter(e)):r.leave(e,()=>{Ns(e,!1)}):Ns(e,t))},beforeUnmount(e,{value:t}){Ns(e,t)}};function Ns(e,t){e.style.display=t?e[Ds]:"none",e[Ts]=!t}const Fs=Symbol(""),qs=/(?:^|;)\s*display\s*:/;const Us=/\s*!important$/;function Ls(e,t,n){if(p(n))n.forEach(n=>Ls(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=function(e,t){const n=Ws[t];if(n)return n;let r=V(t);if("filter"!==r&&r in e)return Ws[t]=r;r=I(r);for(let n=0;n<zs.length;n++){const s=zs[n]+r;if(s in e)return Ws[t]=s}return t}(e,t);Us.test(n)?e.setProperty(P(r),n.replace(Us,""),"important"):e[r]=n}}const zs=["Webkit","Moz","ms"],Ws={};const Bs="http://www.w3.org/1999/xlink";function Hs(e,t,n,r,s,o=K(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(Bs,t.slice(6,t.length)):e.setAttributeNS(Bs,t,n):null==n||o&&!Z(n)?e.removeAttribute(t):e.setAttribute(t,o?"":_(n)?String(n):n)}function Ks(e,t,n,r,s){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?js(n):n));const o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){const r="OPTION"===o?e.getAttribute("value")||"":e.value,s=null==n?"checkbox"===e.type?"on":"":String(n);return r===s&&"_value"in e||(e.value=s),null==n&&e.removeAttribute(t),void(e._value=n)}let i=!1;if(""===n||null==n){const r=typeof e[t];"boolean"===r?n=Z(n):null==n&&"string"===r?(n="",i=!0):"number"===r&&(n=0,i=!0)}try{e[t]=n}catch(e){}i&&e.removeAttribute(s||t)}function Zs(e,t,n,r){e.addEventListener(t,n,r)}const Js=Symbol("_vei");function Qs(e,t,n,r,s=null){const o=e[Js]||(e[Js]={}),i=o[t];if(r&&i)i.value=r;else{const[n,l]=function(e){let t;if(Gs.test(e)){let n;for(t={};n=e.match(Gs);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}const n=":"===e[2]?e.slice(3):P(e.slice(2));return[n,t]}(t);if(r){const i=o[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();Rt(function(e,t){if(p(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=eo(),n}(r,s);Zs(e,n,i,l)}else i&&(!function(e,t,n,r){e.removeEventListener(t,n,r)}(e,n,i,l),o[t]=void 0)}}const Gs=/(?:Once|Passive|Capture)$/;let Xs=0;const Ys=Promise.resolve(),eo=()=>Xs||(Ys.then(()=>Xs=0),Xs=Date.now());const to=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const no={};const ro="undefined"!=typeof HTMLElement?HTMLElement:class{};class so extends ro{constructor(e,t={},n=_o){super(),this._def=e,this._props=t,this._createApp=n,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&n!==_o?this._root=this.shadowRoot:!1!==e.shadowRoot?(this.attachShadow(c({},e.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;this.shadowRoot||this._resolved||this._parseSlots(),this._connected=!0;let e=this;for(;e=e&&(e.assignedSlot||e.parentNode||e.host);)if(e instanceof so){this._parent=e;break}this._instance||(this._resolved?this._mount(this._def):e&&e._pendingResolve?this._pendingResolve=e._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(e=this._parent){e&&(this._instance.parent=e._instance,this._inheritParentContext(e))}_inheritParentContext(e=this._parent){e&&this._app&&Object.setPrototypeOf(this._app._context.provides,e._instance.provides)}disconnectedCallback(){this._connected=!1,Lt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(e){for(const t of e)this._setAttr(t.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let e=0;e<this.attributes.length;e++)this._setAttr(this.attributes[e].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const e=(e,t=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:n,styles:r}=e;let s;if(n&&!p(n))for(const e in n){const t=n[e];(t===Number||t&&t.type===Number)&&(e in this._props&&(this._props[e]=N(this._props[e])),(s||(s=Object.create(null)))[V(e)]=!0)}this._numberProps=s,this._resolveProps(e),this.shadowRoot&&this._applyStyles(r),this._mount(e)},t=this._def.__asyncLoader;t?this._pendingResolve=t().then(t=>{t.configureApp=this._def.configureApp,e(this._def=t,!0)}):e(this._def)}_mount(e){this._app=this._createApp(e),this._inheritParentContext(),e.configureApp&&e.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const t=this._instance&&this._instance.exposed;if(t)for(const e in t)d(this,e)||Object.defineProperty(this,e,{get:()=>kt(t[e])})}_resolveProps(e){const{props:t}=e,n=p(t)?t:Object.keys(t||{});for(const e of Object.keys(this))"_"!==e[0]&&n.includes(e)&&this._setProp(e,this[e]);for(const e of n.map(V))Object.defineProperty(this,e,{get(){return this._getProp(e)},set(t){this._setProp(e,t,!0,!this._patching)}})}_setAttr(e){if(e.startsWith("data-v-"))return;const t=this.hasAttribute(e);let n=t?this.getAttribute(e):no;const r=V(e);t&&this._numberProps&&this._numberProps[r]&&(n=N(n)),this._setProp(r,n,!1,!0)}_getProp(e){return this._props[e]}_setProp(e,t,n=!0,r=!1){if(t!==this._props[e]&&(this._dirty=!0,t===no?delete this._props[e]:(this._props[e]=t,"key"===e&&this._app&&(this._app._ceVNode.key=t)),r&&this._instance&&this._update(),n)){const n=this._ob;n&&(this._processMutations(n.takeRecords()),n.disconnect()),!0===t?this.setAttribute(P(e),""):"string"==typeof t||"number"==typeof t?this.setAttribute(P(e),t+""):t||this.removeAttribute(P(e)),n&&n.observe(this,{attributes:!0})}}_update(){const e=this._createVNode();this._app&&(e.appContext=this._app._context),vo(e,this._root)}_createVNode(){const e={};this.shadowRoot||(e.onVnodeMounted=e.onVnodeUpdated=this._renderSlots.bind(this));const t=ns(this._def,c(e,this._props));return this._instance||(t.ce=e=>{this._instance=e,e.ce=this,e.isCE=!0;const t=(e,t)=>{this.dispatchEvent(new CustomEvent(e,E(t[0])?c({detail:t},t[0]):{detail:t}))};e.emit=(e,...n)=>{t(e,n),P(e)!==e&&t(P(e),n)},this._setParent()}),t}_applyStyles(e,t,n){if(!e)return;if(t){if(t===this._def||this._styleChildren.has(t))return;this._styleChildren.add(t)}const r=this._nonce,s=this.shadowRoot,o=n?this._getStyleAnchor(n)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(s);let i=null;for(let l=e.length-1;l>=0;l--){const a=document.createElement("style");r&&a.setAttribute("nonce",r),a.textContent=e[l],s.insertBefore(a,i||o),i=a,0===l&&(n||this._styleAnchors.set(this._def,a),t&&this._styleAnchors.set(t,a))}}_getStyleAnchor(e){if(!e)return null;const t=this._styleAnchors.get(e);return t&&t.parentNode===this.shadowRoot?t:(t&&this._styleAnchors.delete(e),null)}_getRootStyleInsertionAnchor(e){for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];if(!(n instanceof HTMLStyleElement))return n}return null}_parseSlots(){const e=this._slots={};let t;for(;t=this.firstChild;){const n=1===t.nodeType&&t.getAttribute("slot")||"default";(e[n]||(e[n]=[])).push(t),this.removeChild(t)}}_renderSlots(){const e=this._getSlots(),t=this._instance.type.__scopeId;for(let n=0;n<e.length;n++){const r=e[n],s=r.getAttribute("name")||"default",o=this._slots[s],i=r.parentNode;if(o)for(const e of o){if(t&&1===e.nodeType){const n=t+"-s",r=document.createTreeWalker(e,1);let s;for(e.setAttribute(n,"");s=r.nextNode();)s.setAttribute(n,"")}i.insertBefore(e,r)}else for(;r.firstChild;)i.insertBefore(r.firstChild,r);i.removeChild(r)}}_getSlots(){const e=[this];this._teleportTargets&&e.push(...this._teleportTargets);const t=new Set;for(const n of e){const e=n.querySelectorAll("slot");for(let n=0;n<e.length;n++)t.add(e[n])}return Array.from(t)}_injectChildStyle(e,t){this._applyStyles(e.styles,e,t)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return!1!==this._def.shadowRoot}_removeChildStyle(e){}}const oo=e=>{const t=e.props["onUpdate:modelValue"]||!1;return p(t)?e=>D(t,e):t};function io(e){e.target.composing=!0}function lo(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ao=Symbol("_assign");function co(e,t,n){return t&&(e=e.trim()),n&&(e=M(e)),e}const uo={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[ao]=oo(s);const o=r||s.props&&"number"===s.props.type;Zs(e,t?"change":"input",t=>{t.target.composing||e[ao](co(e.value,n,o))}),(n||o)&&Zs(e,"change",()=>{e.value=co(e.value,n,o)}),t||(Zs(e,"compositionstart",io),Zs(e,"compositionend",lo),Zs(e,"change",lo))},mounted(e,{value:t}){e.value=null==t?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[ao]=oo(i),e.composing)return;const l=null==t?"":t;if((!o&&"number"!==e.type||/^0\d/.test(e.value)?e.value:M(e.value))!==l){if(document.activeElement===e&&"range"!==e.type){if(r&&t===n)return;if(s&&e.value.trim()===l)return}e.value=l}}},ho=["ctrl","shift","alt","meta"],po={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>ho.some(n=>e[`${n}Key`]&&!t.includes(n))},fo=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(n,...r)=>{for(let e=0;e<t.length;e++){const r=po[t[e]];if(r&&r(n,t))return}return e(n,...r)})},mo=c({patchProp:(e,t,n,r,s,o)=>{const i="svg"===s;"class"===t?function(e,t,n){const r=e[$s];r&&(t=(t?[t,...r]:[...r]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,r,i):"style"===t?function(e,t,n){const r=e.style,s=v(n);let o=!1;if(n&&!s){if(t)if(v(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&Ls(r,t,"")}else for(const e in t)null==n[e]&&Ls(r,e,"");for(const e in n)"display"===e&&(o=!0),Ls(r,e,n[e])}else if(s){if(t!==n){const e=r[Fs];e&&(n+=";"+e),r.cssText=n,o=qs.test(n)}}else t&&e.removeAttribute("style");Ds in e&&(e[Ds]=o?r.display:"",e[Ts]&&(r.display="none"))}(e,n,r):l(t)?a(t)||Qs(e,t,0,r,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,r){if(r)return"innerHTML"===t||"textContent"===t||!!(t in e&&to(t)&&y(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(to(t)&&v(n))return!1;return t in e}(e,t,r,i))?(Ks(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||Hs(e,t,r,i,0,"value"!==t)):e._isVueCE&&(function(e,t){const n=e._def.props;if(!n)return!1;const r=V(t);return Array.isArray(n)?n.some(e=>V(e)===r):Object.keys(n).some(e=>V(e)===r)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!v(r)))?Ks(e,V(t),r,0,t):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),Hs(e,t,r,i))}},Rs);let go;function yo(){return go||(go=Pr(mo))}const vo=(...e)=>{yo().render(...e)},_o=(...e)=>{const t=yo().createApp(...e),{mount:n}=t;return t.mount=e=>{const r=function(e){if(v(e)){return document.querySelector(e)}return e}(e);if(!r)return;const s=t._component;y(s)||s.render||s.template||(s.template=r.innerHTML),1===r.nodeType&&(r.textContent="");const o=n(r,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};const bo=["value","placeholder"],So=["value","placeholder"],xo={key:2,class:"errorlist"};t.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field",{errors:o.fieldErrors.length}])},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),o.isLong?(Br(),Jr("textarea",{key:0,class:"sf-input sf-textarea",rows:"3",value:n.modelValue,placeholder:n.schema.placeholder||"",onInput:t[0]||(t[0]=t=>e.$emit("update:modelValue",t.target.value))},null,40,bo)):(Br(),Jr("input",{key:1,type:"text",class:"sf-input",value:null!=n.modelValue?String(n.modelValue):"",placeholder:n.schema.placeholder||"",onInput:t[1]||(t[1]=t=>e.$emit("update:modelValue",t.target.value))},null,40,So)),o.fieldErrors.length?(Br(),Jr("ul",xo,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},t.__file="src/editors/StringEditor.vue";var ko={name:"NumberEditor",props:{schema:{type:Object,required:!0},modelValue:{default:0},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",onInput(e){const t=e.target.value;""===t?this.$emit("update:modelValue",0):this.$emit("update:modelValue","integer"===this.schema.type?parseInt(t,10):parseFloat(t))}}};const Eo=["step","min","max","value"],Co={key:0,class:"errorlist"};ko.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field",{errors:o.fieldErrors.length}])},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("input",{type:"number",class:"sf-input",step:"integer"===n.schema.type?"1":"any",min:null!=n.schema.minimum?String(n.schema.minimum):void 0,max:null!=n.schema.maximum?String(n.schema.maximum):void 0,value:null!=n.modelValue?n.modelValue:"",onInput:t[0]||(t[0]=(...e)=>o.onInput&&o.onInput(...e))},null,40,Eo),o.fieldErrors.length?(Br(),Jr("ul",Co,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},ko.__file="src/editors/NumberEditor.vue";var wo={name:"BooleanEditor",props:{schema:{type:Object,required:!0},modelValue:{default:!1},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):""}};const Ao={class:"sf-checkbox-label"},Oo=["checked"],Vo={key:0,class:"errorlist"};wo.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field sf-field-boolean",{errors:o.fieldErrors.length}])},[ts("label",Ao,[ts("input",{type:"checkbox",class:"sf-checkbox",checked:!!n.modelValue,onChange:t[0]||(t[0]=t=>e.$emit("update:modelValue",t.target.checked))},null,40,Oo),ss(" "+G(o.title),1)]),o.fieldErrors.length?(Br(),Jr("ul",Vo,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},wo.__file="src/editors/BooleanEditor.vue";var jo={name:"SelectEditor",props:{schema:{type:Object,required:!0},modelValue:{default:""},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):""}};const Po=["value"],Io=["value"],Ro={key:0,class:"errorlist"};jo.render=function(e,t,n,r,s,o){return Br(),Jr("div",{class:H(["sf-field",{errors:o.fieldErrors.length}])},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("select",{class:"sf-input sf-select",value:null!=n.modelValue?String(n.modelValue):"",onChange:t[0]||(t[0]=t=>e.$emit("update:modelValue",t.target.value))},[(Br(!0),Jr(Fr,null,Nn(n.schema.enum||[],e=>(Br(),Jr("option",{key:e,value:String(e)},G(e),9,Io))),128))],40,Po),o.fieldErrors.length?(Br(),Jr("ul",Ro,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},jo.__file="src/editors/SelectEditor.vue";var $o={name:"HiddenEditor",props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],computed:{resolvedValue(){return"const"in this.schema?this.schema.const:this.schema.enum&&1===this.schema.enum.length?this.schema.enum[0]:this.modelValue}},mounted(){this.resolvedValue!==this.modelValue&&this.$emit("update:modelValue",this.resolvedValue)},methods:{getValue(){return this.resolvedValue}}};const Do={style:{display:"none"}};$o.render=function(e,t,n,r,s,o){return Br(),Jr("div",Do)},$o.__file="src/editors/HiddenEditor.vue";var To={name:"SfIcon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:14}}};const Mo=["width","height"],No={key:4,points:"6 9 12 15 18 9"},Fo={key:5,points:"18 15 12 9 6 15"};function qo(e,t){if(null==e||"object"!=typeof e)return!1;if(!(t in e))return!1;const n=e[t];return null!=n&&""!==n}function Uo(e,t){if(!t||"object"!=typeof t)return!0;if("const"in t)return e===t.const;if(Array.isArray(t.enum))return t.enum.includes(e);if(t.type){const n=t.type;if("string"===n&&"string"!=typeof e)return!1;if("number"===n&&"number"!=typeof e)return!1;if("integer"===n&&("number"!=typeof e||!Number.isInteger(e)))return!1;if("boolean"===n&&"boolean"!=typeof e)return!1;if("null"===n&&null!==e)return!1;if("array"===n&&!Array.isArray(e))return!1;if("object"===n&&(null==e||"object"!=typeof e||Array.isArray(e)))return!1}if("number"==typeof e){if("number"==typeof t.minimum&&e<t.minimum)return!1;if("number"==typeof t.maximum&&e>t.maximum)return!1;if("number"==typeof t.exclusiveMinimum&&e<=t.exclusiveMinimum)return!1;if("number"==typeof t.exclusiveMaximum&&e>=t.exclusiveMaximum)return!1;if("number"==typeof t.multipleOf&&t.multipleOf>0){const n=e/t.multipleOf;if(Math.abs(n-Math.round(n))>1e-9)return!1}}if("string"==typeof e){if("number"==typeof t.minLength&&e.length<t.minLength)return!1;if("number"==typeof t.maxLength&&e.length>t.maxLength)return!1;if("string"==typeof t.pattern)try{if(!new RegExp(t.pattern).test(e))return!1}catch(e){return!1}}return!t.not||!Lo(e,t.not)}function Lo(e,t){if(!t||"object"!=typeof t)return!0;if(Array.isArray(t.required))for(const n of t.required)if(!qo(e,n))return!1;if(t.properties&&"object"==typeof t.properties)for(const[n,r]of Object.entries(t.properties))if(null!=e&&n in e&&!Uo(e[n],r))return!1;if(t.not&&Lo(e,t.not))return!1;if(Array.isArray(t.allOf)&&!t.allOf.every(t=>Lo(e,t)))return!1;if(Array.isArray(t.anyOf)&&!t.anyOf.some(t=>Lo(e,t)))return!1;if(Array.isArray(t.oneOf)){if(1!==t.oneOf.filter(t=>Lo(e,t)).length)return!1}return!0}function zo(e,t,n){if(!t||"object"!=typeof t)return e;if(t.properties){const r=[];for(const[n,s]of Object.entries(t.properties)){const t=e.properties&&e.properties[n];r.push([n,t?{...t,...s}:s])}e.properties=function(e,t,n){const r=Object.keys(e),s=t?r.indexOf(t):-1;if(-1===s){const t={...e};for(const[e,r]of n)t[e]=r;return t}const o={};for(let t=0;t<r.length;t++){const i=r[t];if(o[i]=e[i],t===s)for(const[t,r]of n)t in e||(o[t]=r)}for(const[t,r]of n)t in e&&(o[t]=r);return o}(e.properties||{},n,r)}if(Array.isArray(t.required)){const n=new Set(e.required||[]);for(const e of t.required)n.add(e);e.required=Array.from(n)}return t.allOf&&(e.allOf=[...e.allOf||[],...t.allOf]),t.if&&(e.allOf=[...e.allOf||[],{if:t.if,then:t.then,else:t.else}]),t.dependentSchemas&&(e.dependentSchemas={...e.dependentSchemas||{},...t.dependentSchemas}),t.dependentRequired&&(e.dependentRequired={...e.dependentRequired||{},...t.dependentRequired}),e}function Wo(e,t,n){const r="function"==typeof n?n:e=>e;if(!e||"object"!=typeof e)return e;if("object"!==e.type&&!e.properties)return e;let s={...e,properties:{...e.properties||{}},required:Array.isArray(e.required)?[...e.required]:[]};const o=t&&"object"==typeof t?t:{},i=e=>{if(!e||"object"!=typeof e)return null;const t=e.properties&&Object.keys(e.properties);return t&&t.length?t[0]:Array.isArray(e.required)&&e.required.length?e.required[0]:null},l=[];if(s.if&&l.push({if:s.if,then:s.then,else:s.else,anchor:i(s.if)}),Array.isArray(s.allOf))for(const e of s.allOf)e&&"object"==typeof e&&e.if?l.push({if:e.if,then:e.then,else:e.else,anchor:i(e.if)}):e&&"object"==typeof e&&(e.properties||e.required)&&zo(s,e);for(let e=0;e<8;e++){let e=!1;const t=JSON.stringify({p:s.properties,r:s.required});for(const e of l){const t=Lo(o,e.if)?e.then:e.else;t&&zo(s,r(t),e.anchor)}if(s.dependentSchemas)for(const[e,t]of Object.entries(s.dependentSchemas))qo(o,e)&&zo(s,r(t),e);if(s.dependentRequired)for(const[e,t]of Object.entries(s.dependentRequired))if(qo(o,e)&&Array.isArray(t)){const e=new Set(s.required||[]);for(const n of t)e.add(n);s.required=Array.from(e)}if(JSON.stringify({p:s.properties,r:s.required})!==t&&(e=!0),!e)break}return s}function Bo(e){return!(!e||"object"!=typeof e)&&(!!(e.if||e.dependentSchemas||e.dependentRequired)||!!Array.isArray(e.allOf)&&e.allOf.some(e=>e&&"object"==typeof e&&(e.if||e.dependentSchemas)))}To.render=function(e,t,n,r,s,o){return Br(),Jr("svg",{class:"sf-icon",width:n.size,height:n.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},["plus"===n.name?(Br(),Jr(Fr,{key:0},[t[0]||(t[0]=ts("line",{x1:"12",y1:"5",x2:"12",y2:"19"},null,-1)),t[1]||(t[1]=ts("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1))],64)):"times"===n.name?(Br(),Jr(Fr,{key:1},[t[2]||(t[2]=ts("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),t[3]||(t[3]=ts("line",{x1:"6",y1:"18",x2:"18",y2:"6"},null,-1))],64)):"arrow-up"===n.name?(Br(),Jr(Fr,{key:2},[t[4]||(t[4]=ts("line",{x1:"12",y1:"19",x2:"12",y2:"5"},null,-1)),t[5]||(t[5]=ts("polyline",{points:"5 12 12 5 19 12"},null,-1))],64)):"arrow-down"===n.name?(Br(),Jr(Fr,{key:3},[t[6]||(t[6]=ts("line",{x1:"12",y1:"5",x2:"12",y2:"19"},null,-1)),t[7]||(t[7]=ts("polyline",{points:"19 12 12 19 5 12"},null,-1))],64)):"chevron-down"===n.name?(Br(),Jr("polyline",No)):"chevron-up"===n.name?(Br(),Jr("polyline",Fo)):"grip"===n.name?(Br(),Jr(Fr,{key:6},[t[8]||(t[8]=os('<circle cx="9" cy="7" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="7" r="1" fill="currentColor" stroke="none"></circle><circle cx="9" cy="12" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="12" r="1" fill="currentColor" stroke="none"></circle><circle cx="9" cy="17" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="17" r="1" fill="currentColor" stroke="none"></circle>',6))],64)):is("v-if",!0)],8,Mo)},To.__file="src/editors/SfIcon.vue";var Ho={name:"ObjectEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi,this.$options.components.SfIcon=To},props:{schema:{type:Object,required:!0},modelValue:{default:()=>({})},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],data:()=>({collapsed:!1}),computed:{isRoot(){return 0===this.path.length},title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},effectiveSchema(){return Bo(this.schema)?Wo(this.schema,this.modelValue||{},this.form?.resolveSchema):this.schema},summary(){const e=this.modelValue||{},t=[];for(const n of Object.keys(this.effectiveSchema.properties||{})){if(t.length>=3)break;const r=e[n];null!=r&&""!==r&&"object"!=typeof r&&t.push(String(r))}return t.join(" · ")}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",collapse(){this.collapsed=!0},expand(){this.collapsed=!1},onChildChange(e,t){const n={...this.modelValue||{},[e]:t};this.$emit("update:modelValue",this.pruneInactive(n))},pruneInactive(e){if(!Bo(this.schema))return e;const t=Wo(this.schema,e,this.form?.resolveSchema),n=new Set(Object.keys(t.properties||{}));let r=!1;const s={};for(const t of Object.keys(e))n.has(t)?s[t]=e[t]:r=!0;return r?s:e}}};const Ko={key:0,class:"sf-object sf-object-root"},Zo={class:"sf-object-fields"},Jo={class:"sf-object-title"},Qo=["aria-label"],Go={class:"sf-object-title-text"},Xo={key:0,class:"sf-object-summary"},Yo={class:"sf-object-fields"};function ei(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(ei);const t={};for(const n of Object.keys(e))t[n]=ei(e[n]);return t}function ti(e){if("default"in e)return ei(e.default);if("object"===e.type){const t={};for(const[n,r]of Object.entries(e.properties||{}))"default"in r?t[n]=ei(r.default):"string"===r.type?t[n]="":"integer"===r.type||"number"===r.type?t[n]=0:"boolean"===r.type?t[n]=!1:"array"===r.type&&(t[n]=[]);return t}return"array"===e.type?[]:"string"===e.type?"":"integer"===e.type||"number"===e.type?0:"boolean"!==e.type&&("relation"===e.type&&e.multiple?[]:null)}Ho.render=function(e,t,n,r,s,o){const i=$n("SchemaEditor"),l=$n("SfIcon");return o.isRoot?(Br(),Jr("div",Ko,[ts("div",Zo,[(Br(!0),Jr(Fr,null,Nn(o.effectiveSchema.properties||{},(e,t)=>(Br(),Qr(i,{key:t,schema:n.form.resolveSchema(e),"model-value":(n.modelValue||{})[t],path:[...n.path,t],form:n.form,"onUpdate:modelValue":e=>o.onChildChange(t,e)},null,8,["schema","model-value","path","form","onUpdate:modelValue"]))),128))])])):(Br(),Jr("fieldset",{key:1,class:H(["sf-object",{"sf-object-collapsed":s.collapsed}])},[ts("legend",Jo,[ts("button",{type:"button",class:"sf-collapse-btn","aria-label":s.collapsed?"Expand":"Collapse",onClick:t[0]||(t[0]=e=>s.collapsed=!s.collapsed)},[ns(l,{name:s.collapsed?"chevron-down":"chevron-up",size:12},null,8,["name"])],8,Qo),ts("span",Go,G(o.title),1),s.collapsed&&o.summary?(Br(),Jr("span",Xo,G(o.summary),1)):is("v-if",!0)]),Xt(ts("div",Yo,[(Br(!0),Jr(Fr,null,Nn(o.effectiveSchema.properties||{},(e,t)=>(Br(),Qr(i,{key:t,schema:n.form.resolveSchema(e),"model-value":(n.modelValue||{})[t],path:[...n.path,t],form:n.form,"onUpdate:modelValue":e=>o.onChildChange(t,e)},null,8,["schema","model-value","path","form","onUpdate:modelValue"]))),128))],512),[[Ms,!s.collapsed]])],2))},Ho.__file="src/editors/ObjectEditor.vue";let ni=0;var ri={name:"ArrayEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi,this.$options.components.SfIcon=To},props:{schema:{type:Object,required:!0},modelValue:{default:()=>[]},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],data(){return{items:(Array.isArray(this.modelValue)?this.modelValue:[]).map(e=>({_key:ni++,value:e})),dragSourceIndex:null,dragOverIndex:null,allCollapsed:!1}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},itemSchema(){return this.form.resolveSchema(this.schema.items||{})},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",addItem(){const e=ti(this.itemSchema);this.items.push({_key:ni++,value:e}),this.emitValue()},removeItem(e){this.items.splice(e,1),this.emitValue()},moveItem(e,t){const n=e+t;if(n<0||n>=this.items.length)return;const r=this.items[e];this.items.splice(e,1,this.items[n]),this.items.splice(n,1,r),this.emitValue()},onItemChange(e,t){this.items[e].value=t,this.emitValue()},onDragStart(e,t){this.dragSourceIndex=e,t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",String(e))},onDragOver(e){null!==this.dragSourceIndex&&e!==this.dragSourceIndex&&(this.dragOverIndex=e)},onDragLeave(e){this.dragOverIndex===e&&(this.dragOverIndex=null)},onDrop(e){if(null===this.dragSourceIndex||this.dragSourceIndex===e)return;const t=this.items.splice(this.dragSourceIndex,1)[0];this.items.splice(e,0,t),this.dragSourceIndex=null,this.dragOverIndex=null,this.emitValue()},onDragEnd(){this.dragSourceIndex=null,this.dragOverIndex=null},toggleCollapseAll(){this.allCollapsed=!this.allCollapsed;const e=this.$refs.itemEditors;if(!e)return;const t=Array.isArray(e)?e:[e];this.allCollapsed?t.forEach(e=>e?.collapseAll?.()):t.forEach(e=>e?.expandAll?.())},emitValue(){this.$emit("update:modelValue",this.items.map(e=>e.value))}}};const si={class:"sf-array-header"},oi={class:"sf-label"},ii={class:"sf-array-count"},li=["title"],ai={class:"sf-array-items"},ci=["onDragstart","onDragover","onDragleave","onDrop"],ui={class:"sf-array-item-header"},hi={class:"sf-array-item-left"},di={class:"sf-drag-handle",title:"Drag to reorder"},pi={class:"sf-array-item-index"},fi={class:"sf-array-item-actions"},mi=["onClick"],gi=["onClick"],yi=["onClick"],vi=["onDrop"],_i={key:0,class:"errorlist"};ri.render=function(e,t,n,r,s,o){const i=$n("SfIcon"),l=$n("SchemaEditor");return Br(),Jr("div",{class:H(["sf-array",{errors:o.fieldErrors.length}])},[ts("div",si,[ts("span",oi,G(o.title),1),ts("span",ii,G(s.items.length),1),ts("button",{type:"button",class:"sf-btn sf-btn-add",onClick:t[0]||(t[0]=e=>o.addItem())},[ns(i,{name:"plus"}),t[4]||(t[4]=ss(" Add ",-1))]),s.items.length?(Br(),Jr("span",{key:0,class:"sf-array-collapse-toggle",title:s.allCollapsed?"Expand all":"Collapse all",onClick:t[1]||(t[1]=(...e)=>o.toggleCollapseAll&&o.toggleCollapseAll(...e))},[ns(i,{name:s.allCollapsed?"chevron-down":"chevron-up"},null,8,["name"])],8,li)):is("v-if",!0)]),ts("div",ai,[(Br(!0),Jr(Fr,null,Nn(s.items,(e,r)=>(Br(),Jr("div",{key:e._key,class:H(["sf-array-item",{"sf-drag-over":s.dragOverIndex===r,"sf-dragging":s.dragSourceIndex===r}]),draggable:"true",onDragstart:e=>o.onDragStart(r,e),onDragover:fo(e=>o.onDragOver(r),["prevent"]),onDragleave:e=>o.onDragLeave(r),onDrop:fo(e=>o.onDrop(r),["prevent"]),onDragend:t[3]||(t[3]=(...e)=>o.onDragEnd&&o.onDragEnd(...e))},[ts("div",ui,[ts("div",hi,[ts("span",di,[ns(i,{name:"grip"})]),ts("span",pi,"#"+G(r+1),1)]),ts("div",fi,[r>0?(Br(),Jr("button",{key:0,type:"button",class:"sf-btn sf-btn-sm",onClick:e=>o.moveItem(r,-1)},[ns(i,{name:"arrow-up"})],8,mi)):is("v-if",!0),r<s.items.length-1?(Br(),Jr("button",{key:1,type:"button",class:"sf-btn sf-btn-sm",onClick:e=>o.moveItem(r,1)},[ns(i,{name:"arrow-down"})],8,gi)):is("v-if",!0),ts("button",{type:"button",class:"sf-btn sf-btn-sm sf-btn-danger",onClick:e=>o.removeItem(r)},[ns(i,{name:"times"})],8,yi)])]),ts("div",{class:"sf-array-item-body",onDragover:t[2]||(t[2]=fo(()=>{},["prevent"])),onDrop:fo(e=>o.onDrop(r),["prevent"])},[ns(l,{ref_for:!0,ref:"itemEditors",schema:o.itemSchema,"model-value":e.value,path:[...n.path,String(r)],form:n.form,"onUpdate:modelValue":e=>o.onItemChange(r,e)},null,8,["schema","model-value","path","form","onUpdate:modelValue"])],40,vi)],42,ci))),128))]),o.fieldErrors.length?(Br(),Jr("ul",_i,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},ri.__file="src/editors/ArrayEditor.vue";var bi={name:"NullableEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi,this.$options.components.SfIcon=To},props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],data(){return{isNull:null===this.modelValue||void 0===this.modelValue}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},innerSchema(){const e={...this.schema};return delete e._nullable,e},toggleClass(){return this.isNull?"sf-btn sf-btn-sm sf-btn-add":"sf-btn sf-btn-sm sf-btn-danger"},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]}},watch:{modelValue(e){this.isNull=null==e}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",toggle(){this.isNull?(this.isNull=!1,this.$emit("update:modelValue",ti(this.innerSchema))):(this.isNull=!0,this.$emit("update:modelValue",null))}}};const Si={class:"sf-nullable-header"},xi={class:"sf-nullable-body"},ki={key:0,class:"errorlist"};bi.render=function(e,t,n,r,s,o){const i=$n("SfIcon"),l=$n("SchemaEditor");return Br(),Jr("div",{class:H(["sf-nullable",{errors:o.fieldErrors.length}])},[ts("div",Si,[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("button",{type:"button",class:H(o.toggleClass),onClick:t[0]||(t[0]=(...e)=>o.toggle&&o.toggle(...e))},[s.isNull?(Br(),Jr(Fr,{key:0},[ns(i,{name:"plus"}),t[2]||(t[2]=ss(" Add ",-1))],64)):(Br(),Jr(Fr,{key:1},[ns(i,{name:"times"}),t[3]||(t[3]=ss(" Remove ",-1))],64))],2)]),ts("div",xi,[s.isNull?is("v-if",!0):(Br(),Qr(l,{key:0,schema:o.innerSchema,"model-value":n.modelValue,path:n.path,form:n.form,"onUpdate:modelValue":t[1]||(t[1]=t=>e.$emit("update:modelValue",t))},null,8,["schema","model-value","path","form"]))]),o.fieldErrors.length?(Br(),Jr("ul",ki,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},bi.__file="src/editors/NullableEditor.vue";var Ei={name:"UnionEditor",beforeCreate(){this.$options.components||(this.$options.components={}),this.$options.components.SchemaEditor=zi},props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],data(){const e=this.schema.discriminator.propertyName,t=this.schema.discriminator.mapping;return{discriminatorProp:e,mapping:t,currentType:this.modelValue?this.modelValue[e]:Object.keys(t)[0]}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},typeKeys(){return Object.keys(this.mapping)},currentSchema(){const e=this.mapping[this.currentType];return this.form.resolveSchema({$ref:e})},innerValue(){if(this.modelValue&&this.modelValue[this.discriminatorProp]===this.currentType)return this.modelValue;const e=ti(this.currentSchema);return e[this.discriminatorProp]=this.currentType,e}},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",onTypeChange(e){this.currentType=e.target.value;const t=ti(this.currentSchema);t[this.discriminatorProp]=this.currentType,this.$emit("update:modelValue",t)},onInnerChange(e){e&&(e[this.discriminatorProp]=this.currentType),this.$emit("update:modelValue",e)}}};const Ci={class:"sf-union"},wi={class:"sf-field"},Ai={class:"sf-label"},Oi=["value"],Vi=["value"],ji={class:"sf-union-body"};Ei.render=function(e,t,n,r,s,o){const i=$n("SchemaEditor");return Br(),Jr("div",Ci,[ts("div",wi,[ts("label",Ai,G(o.title),1),ts("select",{class:"sf-input sf-select",value:s.currentType,onChange:t[0]||(t[0]=(...e)=>o.onTypeChange&&o.onTypeChange(...e))},[(Br(!0),Jr(Fr,null,Nn(o.typeKeys,e=>(Br(),Jr("option",{key:e,value:e},G(o.humanize(e)),9,Vi))),128))],40,Oi)]),ts("div",ji,[(Br(),Qr(i,{key:s.currentType,schema:o.currentSchema,"model-value":o.innerValue,path:n.path,form:n.form,"onUpdate:modelValue":o.onInnerChange},null,8,["schema","model-value","path","form","onUpdate:modelValue"]))])])},Ei.__file="src/editors/UnionEditor.vue";var Pi={name:"RelationEditor",components:{SfIcon:To},inject:{language:{from:"language",default:()=>()=>""}},props:{schema:{type:Object,required:!0},modelValue:{default:null},path:{type:Array,default:()=>[]},form:{type:Object,default:null}},emits:["update:modelValue"],data(){const e=!!this.schema.multiple,t=this.modelValue;let n;return n=e?Array.isArray(t)?[...t]:[]:t?[t]:[],{isMultiple:e,allowClear:this.schema.options?.select2?.allowClear??!0,placeholder:this.schema.options?.select2?.placeholder||"Search...",searchUrl:this.schema.options?.select2?.ajax?.url||"",selected:n,dropdownVisible:!1,searchResults:[],currentPage:1,hasMore:!1,loading:!1,highlightIndex:-1,searchQuery:""}},computed:{title(){return this.schema.title||this.humanize(this.path[this.path.length-1])||""},isRequired(){if(this.path.length<2||!this.form)return!1;const e=this.path.slice(0,-1),t=this.path[this.path.length-1],n=this.form.getSchemaAtPath(e);return n&&Array.isArray(n.required)&&n.required.includes(t)},showSearch(){return!(!this.isMultiple&&this.selected.length>0)},fieldErrors(){return this.form&&this.form.getErrorsForPath?this.form.getErrorsForPath(this.path):[]},filteredResults(){const e=new Set(this.selected.map(e=>this.itemKey(e)));return this.searchResults.filter(t=>!e.has(this.itemKey(t)))}},created(){this._doSearch=function(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}(e=>this.fetchResults(e,1),300),this._onDocClick=e=>{this.$refs.root&&!this.$refs.root.contains(e.target)&&this.closeDropdown()}},mounted(){document.addEventListener("click",this._onDocClick)},beforeUnmount(){document.removeEventListener("click",this._onDocClick)},methods:{humanize:e=>e?e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()):"",getDisplayName(e){if(!e)return"";for(const t of["__str__","name","title","label"])if(e[t])return String(e[t]);return`#${e.id||"?"}`},itemKey:e=>`${e.id}-${e.model||""}`,onSearchInput(){this._doSearch(this.searchQuery)},openDropdown(){this.dropdownVisible||(this.dropdownVisible=!0,this.fetchResults(this.searchQuery,1))},closeDropdown(){this.dropdownVisible=!1,this.highlightIndex=-1},async fetchResults(e,t){if(this.searchUrl){this.loading=!0,this.currentPage=t;try{const n=new URL(this.searchUrl,window.location.origin);n.searchParams.set("_q",e||""),n.searchParams.set("page",String(t));const r="function"==typeof this.language?this.language():this.language;r&&n.searchParams.set("_lang",r);const s=await fetch(n,{credentials:"same-origin"});if(!s.ok)return;const o=await s.json();this.searchResults=1===t?o.items||[]:this.searchResults.concat(o.items||[]),this.hasMore=o.more}finally{this.loading=!1}}},handleKeyDown(e){this.filteredResults.length&&("ArrowDown"===e.key?(e.preventDefault(),this.highlightIndex=Math.min(this.highlightIndex+1,this.filteredResults.length-1)):"ArrowUp"===e.key?(e.preventDefault(),this.highlightIndex=Math.max(this.highlightIndex-1,0)):"Enter"===e.key?(e.preventDefault(),this.highlightIndex>=0&&this.highlightIndex<this.filteredResults.length&&this.selectItem(this.filteredResults[this.highlightIndex])):"Escape"===e.key&&this.closeDropdown())},selectItem(e){this.isMultiple?this.selected.push(e):this.selected=[e],this.searchQuery="",this.highlightIndex=-1,this.closeDropdown(),this.emitValue()},removeItem(e){this.selected=this.selected.filter(t=>!(t.id===e.id&&(t.model||"")===(e.model||""))),this.emitValue()},emitValue(){this.isMultiple?this.$emit("update:modelValue",[...this.selected]):this.$emit("update:modelValue",this.selected[0]||null)}}};const Ii={class:"sf-relation-wrapper"},Ri={key:0,class:"sf-relation-selected"},$i={class:"sf-relation-tag-text"},Di=["onClick"],Ti={class:"sf-relation-search"},Mi=["placeholder"],Ni={class:"sf-relation-dropdown"},Fi={key:0,class:"sf-relation-dropdown-empty"},qi=["onClick"],Ui={key:0,class:"errorlist"};Pi.render=function(e,t,n,r,s,o){const i=$n("SfIcon");return Br(),Jr("div",{class:H(["sf-field sf-relation",{errors:o.fieldErrors.length}]),ref:"root"},[ts("label",{class:H(["sf-label",{required:o.isRequired}])},G(o.title),3),ts("div",Ii,[is(" Selected items "),s.selected.length?(Br(),Jr("div",Ri,[(Br(!0),Jr(Fr,null,Nn(s.selected,e=>(Br(),Jr("div",{key:o.itemKey(e),class:"sf-relation-tag"},[ts("span",$i,G(o.getDisplayName(e)),1),s.isMultiple||s.allowClear?(Br(),Jr("button",{key:0,type:"button",class:"sf-relation-tag-remove",onClick:fo(t=>o.removeItem(e),["stop"])},[ns(i,{name:"times"})],8,Di)):is("v-if",!0)]))),128))])):is("v-if",!0),is(" Search box "),Xt(ts("div",Ti,[Xt(ts("input",{ref:"searchInput",type:"text",class:"sf-input sf-relation-input",placeholder:s.placeholder,autocomplete:"off","onUpdate:modelValue":t[0]||(t[0]=e=>s.searchQuery=e),onInput:t[1]||(t[1]=(...e)=>o.onSearchInput&&o.onSearchInput(...e)),onFocus:t[2]||(t[2]=(...e)=>o.openDropdown&&o.openDropdown(...e)),onKeydown:t[3]||(t[3]=(...e)=>o.handleKeyDown&&o.handleKeyDown(...e))},null,40,Mi),[[uo,s.searchQuery]]),is(" Dropdown "),Xt(ts("div",Ni,[0!==o.filteredResults.length||s.loading?is("v-if",!0):(Br(),Jr("div",Fi," No results found ")),(Br(!0),Jr(Fr,null,Nn(o.filteredResults,(e,t)=>(Br(),Jr("div",{key:o.itemKey(e),class:H(["sf-relation-dropdown-item",{highlighted:t===s.highlightIndex}]),onClick:t=>o.selectItem(e)},G(o.getDisplayName(e)),11,qi))),128)),s.hasMore?(Br(),Jr("div",{key:1,class:"sf-relation-dropdown-more",onClick:t[4]||(t[4]=e=>o.fetchResults(s.searchQuery,s.currentPage+1))}," Load more... ")):is("v-if",!0)],512),[[Ms,s.dropdownVisible]])],512),[[Ms,o.showSearch]])]),o.fieldErrors.length?(Br(),Jr("ul",Ui,[(Br(!0),Jr(Fr,null,Nn(o.fieldErrors,(e,t)=>(Br(),Jr("li",{key:t},G(e),1))),128))])):is("v-if",!0)],2)},Pi.__file="src/editors/RelationEditor.vue";var Li={name:"WebComponentWrapper",props:{tagName:{type:String,required:!0},schema:{type:Object,required:!0},modelValue:{default:void 0},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=St(null);function r(){const t=n.value;t&&(t.schema=e.schema,t.modelValue=e.modelValue,t.path=e.path,t.form=e.form)}function s(e){const n=null!=e.detail?Array.isArray(e.detail)?e.detail[0]:e.detail:void 0;t("update:modelValue",n)}return En(()=>{r();const e=n.value;e&&(e.addEventListener("update:model-value",s),e.addEventListener("change",s))}),An(()=>{const e=n.value;e&&(e.removeEventListener("update:model-value",s),e.removeEventListener("change",s))}),nn(()=>[e.schema,e.modelValue,e.path,e.form],r,{deep:!0}),()=>function(e,t,n){try{Kr(-1);const r=arguments.length;return 2===r?b(t)&&!p(t)?Gr(t)?ns(e,null,[t]):ns(e,t):ns(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&Gr(n)&&(n=[n]),ns(e,t,n))}finally{Kr(1)}}(e.tagName,{ref:n})},__file:"src/editors/WebComponentWrapper.vue"};var zi={name:"SchemaEditor",components:{StringEditor:t,NumberEditor:ko,BooleanEditor:wo,SelectEditor:jo,HiddenEditor:$o,ObjectEditor:Ho,ArrayEditor:ri,NullableEditor:bi,UnionEditor:Ei,RelationEditor:Pi,WebComponentWrapper:Li},inject:{customEditors:{default:()=>()=>[]}},props:{schema:{type:Object,required:!0},modelValue:{default:void 0},path:{type:Array,default:()=>[]},form:{type:Object,required:!0}},emits:["update:modelValue"],methods:{collapseAll(){const e=this.$refs.editor;e?.collapse&&e.collapse(),e?.collapseAll&&e.collapseAll()},expandAll(){const e=this.$refs.editor;e?.expand&&e.expand(),e?.expandAll&&e.expandAll()}},computed:{isWebComponent(){const e=this.editorComponent;return"string"==typeof e&&e.includes("-")},editorComponent(){const e=this.schema;if(this.path.length>12)return"StringEditor";const t=this.customEditors();for(const n of t)if(n.match(e,this.path))return n.component;return"relation"===e.type?"RelationEditor":e.oneOf&&e.discriminator?"UnionEditor":"const"in e||e.enum&&1===e.enum.length&&"string"===e.type?"HiddenEditor":e._nullable?"NullableEditor":"object"===e.type&&e.properties?"ObjectEditor":"array"===e.type?"ArrayEditor":e.enum?"SelectEditor":"boolean"===e.type?"BooleanEditor":"number"===e.type||"integer"===e.type?"NumberEditor":"StringEditor"}}};zi.render=function(e,t,n,r,s,o){const i=$n("WebComponentWrapper");return o.isWebComponent?(Br(),Qr(i,{key:0,ref:"editor","tag-name":o.editorComponent,schema:n.schema,"model-value":n.modelValue,path:n.path,form:n.form,"onUpdate:modelValue":t[0]||(t[0]=t=>e.$emit("update:modelValue",t))},null,8,["tag-name","schema","model-value","path","form"])):(Br(),Qr((l=o.editorComponent,v(l)?Tn(Rn,l,!1)||l:l||Dn),{key:1,ref:"editor",schema:n.schema,"model-value":n.modelValue,path:n.path,form:n.form,"onUpdate:modelValue":t[1]||(t[1]=t=>e.$emit("update:modelValue",t))},null,8,["schema","model-value","path","form"]));var l},zi.__file="src/editors/SchemaEditor.vue";var Wi={name:"SchemaForm",components:{SchemaEditor:zi},props:{schema:{type:[Object,String],default:()=>({})},initialData:{default:void 0},errors:{type:Object,default:()=>({})},customEditors:{type:Array,default:()=>[]},language:{type:String,default:""}},emits:["change"],expose:["getValue"],provide(){return{customEditors:()=>this.customEditors,language:()=>this.language}},data(){const e="string"==typeof this.schema?JSON.parse(this.schema):this.schema;return{rootSchema:e,defs:e.$defs||e.definitions||{},currentValue:null!=this.initialData?ei(this.initialData):void 0}},computed:{resolvedSchema(){return this.resolveSchema(this.rootSchema)},formApi(){return{resolveSchema:e=>this.resolveSchema(e),getSchemaAtPath:e=>this.getSchemaAtPath(e),getEffectiveSchemaAtPath:e=>this.getEffectiveSchemaAtPath(e),getErrorsForPath:e=>this.getErrorsForPath(e)}}},watch:{schema:{handler(e){const t="string"==typeof e?JSON.parse(e):e;this.rootSchema=t,this.defs=t.$defs||t.definitions||{}},deep:!0},initialData:{handler(e){this.currentValue=null!=e?ei(e):void 0},deep:!0}},methods:{resolveSchema(e){if(!e)return{type:"string"};if(e.$ref){const t=e.$ref.replace(/^#\/\$defs\//,"").replace(/^#\/definitions\//,""),n=this.defs[t];if(!n)return{type:"string",title:t};const{$ref:r,...s}=e;return{...this.resolveSchema(n),...s}}if(e.anyOf){const t=e.anyOf.filter(e=>"null"!==e.type);if(e.anyOf.some(e=>"null"===e.type)&&1===t.length){const n=this.resolveSchema(t[0]);return{...n,_nullable:!0,title:e.title||n.title,default:"default"in e?e.default:null}}if(t.length>=1)return this.resolveSchema(t[0])}if(e.oneOf&&e.discriminator)return e;if(e.oneOf){const t=e.oneOf.filter(e=>"null"!==e.type);if(e.oneOf.some(e=>"null"===e.type)&&1===t.length){const n=this.resolveSchema(t[0]);return{...n,_nullable:!0,title:e.title||n.title,default:"default"in e?e.default:null}}if(t.length>=1)return this.resolveSchema(t[0])}return e},getSchemaAtPath(e){let t=this.resolveSchema(this.rootSchema);for(const n of e){if(!t)return null;if(t.properties&&t.properties[n])t=this.resolveSchema(t.properties[n]);else{if(!t.items)return null;t=this.resolveSchema(t.items)}}return t},getEffectiveSchemaAtPath(e){let t=this.resolveSchema(this.rootSchema),n=this.currentValue;for(const r of e){if(!t)return null;if((t.properties||t.if||t.allOf||t.dependentSchemas)&&Bo(t)&&(t=Wo(t,n||{},e=>this.resolveSchema(e))),t.properties&&void 0!==t.properties[r])t=this.resolveSchema(t.properties[r]),n=null!=n?n[r]:void 0;else{if(!t.items)return null;t=this.resolveSchema(t.items),n=Array.isArray(n)?n[r]:void 0}}return t&&Bo(t)&&(t=Wo(t,n||{})),t},onValueChange(e){this.currentValue=e,this.$emit("change",e)},getErrorsForPath(e){if(!this.errors||"object"!=typeof this.errors)return[];const t=e.join(".");return this.errors[t]||[]},getValue(){return this.currentValue}}};const Bi={class:"structured-field-editor"};Wi.render=function(e,t,n,r,s,o){const i=$n("SchemaEditor");return Br(),Jr("div",Bi,[o.resolvedSchema?(Br(),Qr(i,{key:0,schema:o.resolvedSchema,"model-value":s.currentValue,path:[],form:o.formApi,"onUpdate:modelValue":o.onValueChange},null,8,["schema","model-value","form","onUpdate:modelValue"])):is("v-if",!0)])},Wi.__file="src/SchemaForm.vue";class Hi extends HTMLElement{constructor(){super(),this._schema={},this._modelValue=void 0,this._path=[],this._form=null,this._connected=!1}get schema(){return this._schema}set schema(e){this._schema=e,this._connected&&this.update()}get modelValue(){return this._modelValue}set modelValue(e){this._modelValue=e,this._connected&&this.update()}get path(){return this._path}set path(e){this._path=e,this._connected&&this.update()}get form(){return this._form}set form(e){this._form=e,this._connected&&this.update()}connectedCallback(){this._connected=!0,this.render()}disconnectedCallback(){this._connected=!1}emitChange(e){this.dispatchEvent(new CustomEvent("change",{detail:e}))}getErrors(){return this._form?.getErrorsForPath?.(this._path)??[]}render(){}update(){}}const Ki=function(e,t,n){let r=function(e,t){return y(e)?(()=>c({name:e.name},t,{setup:e}))():e}(e,t);E(r)&&(r=c({},r,t));class s extends so{constructor(e){super(r,e,n)}}return s.def=r,s}({...Wi,shadowRoot:!1});return e.ArrayEditor=ri,e.BaseEditorElement=Hi,e.BooleanEditor=wo,e.HiddenEditor=$o,e.NullableEditor=bi,e.NumberEditor=ko,e.ObjectEditor=Ho,e.RelationEditor=Pi,e.SchemaEditor=zi,e.SchemaForm=Wi,e.SchemaFormElement=Ki,e.SelectEditor=jo,e.StringEditor=t,e.UnionEditor=Ei,e.WebComponentWrapper=Li,e.applyConditionals=Wo,e.hasConditionals=Bo,e.matchesSchema=Lo,e.registerCustomElement=function(e="schema-form"){customElements.get(e)||customElements.define(e,Ki)},e}({});
|
|
25
25
|
//# sourceMappingURL=structured-widget-editor.js.map
|