@vonage/vivid 5.29.0 → 5.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/definition.js +1 -2
- package/accordion-item/definition.js +1 -2
- package/action-group/definition.js +1 -2
- package/alert/definition.js +1 -2
- package/audio-player/definition.js +1 -2
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +1 -5
- package/avatar/definition.js +1 -2
- package/badge/definition.js +1 -2
- package/banner/definition.js +1 -2
- package/banner/index.cjs +1 -1
- package/banner/index.js +1 -1
- package/breadcrumb/definition.js +1 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/decorate.js +1 -1
- package/bundled/definition12.cjs +2 -1
- package/bundled/definition12.js +2 -1
- package/bundled/definition16.cjs +1 -1
- package/bundled/definition16.js +2 -5
- package/bundled/definition19.cjs +2 -2
- package/bundled/definition19.js +10 -25
- package/bundled/definition21.cjs +1 -1
- package/bundled/definition21.js +1 -1
- package/bundled/definition25.cjs +4 -4
- package/bundled/definition25.js +4 -4
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +2 -5
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -5
- package/bundled/option.cjs +1 -1
- package/bundled/option.js +1 -5
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +1 -5
- package/bundled/single-value-picker.cjs +1 -1
- package/bundled/single-value-picker.js +5 -15
- package/bundled/slottable-request.cjs +2 -2
- package/bundled/slottable-request.js +31 -34
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +1 -1
- package/bundled/time-selection-picker.template.js +1 -1
- package/bundled/vivid-element.cjs +2 -2
- package/bundled/vivid-element.js +42 -38
- package/button/definition.js +1 -2
- package/calendar/definition.js +1 -2
- package/card/definition.js +1 -2
- package/checkbox/definition.js +1 -2
- package/color-picker/definition.js +1 -2
- package/color-picker/index.cjs +1 -1
- package/color-picker/index.js +2 -4
- package/combobox/definition.js +1 -2
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -5
- package/contextual-help/definition.js +1 -2
- package/country/definition.js +1 -2
- package/country-group/definition.js +1 -2
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +1 -5
- package/custom-elements.json +4824 -4718
- package/data-grid/definition.js +1 -2
- package/data-grid/index.cjs +2 -2
- package/data-grid/index.js +16 -44
- package/date-picker/definition.js +1 -2
- package/date-range-picker/definition.js +1 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -18
- package/date-time-picker/definition.js +1 -2
- package/dial-pad/definition.js +1 -2
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +1 -5
- package/dialog/definition.js +1 -2
- package/elevation/definition.js +1 -2
- package/empty-state/definition.js +1 -2
- package/fab/definition.js +1 -2
- package/fab/index.cjs +1 -1
- package/fab/index.js +2 -5
- package/file-picker/definition.js +1 -2
- package/file-picker/index.js +1 -0
- package/flag/definition.js +1 -2
- package/form-field/definition.js +1 -2
- package/header/definition.js +1 -2
- package/kbd-key/definition.js +1 -2
- package/kbd-shortcut/definition.js +1 -2
- package/layout/definition.js +1 -2
- package/lib/rich-text-editor/rte/feature.d.ts +0 -1
- package/lib/rich-text-editor/rte/features/base.d.ts +11 -1
- package/lib/rich-text-editor/rte/features/bold.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/hard-break.d.ts +4 -0
- package/lib/rich-text-editor/rte/features/inline-image.d.ts +5 -0
- package/lib/rich-text-editor/rte/features/italic.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/link.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/list.d.ts +6 -0
- package/lib/rich-text-editor/rte/features/monospace.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/strikethrough.d.ts +5 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/underline.d.ts +5 -1
- package/lib/rich-text-editor/rte/public-interface.d.ts +1 -1
- package/lib/rich-text-editor/rte/utils/color.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/flatten-slice.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/sanitization.d.ts +2 -0
- package/listbox/definition.js +1 -2
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +3 -7
- package/locales/en-US.js +1 -2
- package/menu/definition.js +1 -2
- package/menu-item/definition.js +1 -2
- package/nav/definition.js +1 -2
- package/nav-disclosure/definition.js +1 -2
- package/nav-item/definition.js +1 -2
- package/note/definition.js +1 -2
- package/number-field/definition.js +1 -2
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/package.json +18 -18
- package/pagination/definition.js +1 -2
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +2 -13
- package/platform-switch/definition.js +1 -2
- package/platform-switch/index.cjs +1 -1
- package/platform-switch/index.js +1 -7
- package/popover/definition.js +1 -2
- package/popover/index.js +1 -0
- package/popup/definition.js +1 -2
- package/progress/definition.js +1 -2
- package/progress-ring/definition.js +1 -2
- package/radio/definition.js +1 -2
- package/radio-group/definition.js +1 -2
- package/radio-group/index.cjs +13 -2
- package/radio-group/index.js +21 -14
- package/range-slider/definition.js +1 -2
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +7 -7
- package/rich-text-editor/index.js +2123 -2047
- package/rich-text-view/definition.js +1 -2
- package/searchable-select/definition.js +1 -2
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +4 -24
- package/select/definition.js +1 -2
- package/selectable-box/definition.js +1 -2
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +2 -5
- package/shared/foundation/vivid-element/vivid-element.browser-spec.d.ts +1 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +8 -8
- package/side-drawer/definition.js +1 -2
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +2 -5
- package/simple-color-picker/definition.js +1 -2
- package/split-button/definition.js +1 -2
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +4 -10
- package/status/definition.js +1 -2
- package/styles/fonts/spezia-variable.css +33 -21
- package/switch/definition.js +1 -2
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/definition.js +1 -2
- package/tab-panel/definition.js +1 -2
- package/table/definition.js +1 -2
- package/tabs/definition.js +1 -2
- package/tag/definition.js +1 -2
- package/tag/index.cjs +1 -1
- package/tag/index.js +2 -2
- package/tag-group/definition.js +1 -2
- package/text-area/definition.js +1 -2
- package/text-field/definition.js +1 -2
- package/toggletip/definition.js +1 -2
- package/tooltip/definition.js +1 -2
- package/tree-item/definition.js +1 -2
- package/tree-view/definition.js +1 -2
- package/unbundled/decorate.cjs +1 -1
- package/unbundled/decorate.js +1 -1
- package/unbundled/definition11.cjs +1 -1
- package/unbundled/definition11.js +1 -1
- package/unbundled/definition2.cjs +4 -4
- package/unbundled/definition2.js +4 -4
- package/unbundled/definition55.cjs +1 -1
- package/unbundled/definition55.js +1 -1
- package/unbundled/definition61.cjs +21 -2
- package/unbundled/definition61.js +21 -2
- package/unbundled/definition63.cjs +191 -61
- package/unbundled/definition63.js +191 -61
- package/unbundled/definition72.cjs +1 -0
- package/unbundled/definition72.js +1 -0
- package/unbundled/definition74.cjs +2 -1
- package/unbundled/definition74.js +2 -1
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/vivid-element.cjs +54 -1
- package/unbundled/vivid-element.js +55 -2
- package/video-player/definition.js +1 -2
- package/video-player/index.cjs +18 -18
- package/video-player/index.js +629 -1219
- package/visually-hidden/definition.js +1 -2
- package/vivid.api.json +13 -13
package/bundled/option.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./vivid-element.cjs"),t=require("./decorate.cjs"),n=require("./dom.cjs"),r=require("./affix.cjs"),i=require("./host-semantics.cjs");var a=require("./component-enum.cjs").t([`accent`,`cta`],`accent`);function o(e){return n.t(e)&&(e.getAttribute(`role`)===`option`||e instanceof HTMLOptionElement||e instanceof s)}var s=class extends i.t(r.n(e.t)){defaultSelectedChanged(){this.dirtySelected||(this.selected=this.defaultSelected,this.proxy instanceof HTMLOptionElement&&(this.proxy.selected=this.defaultSelected)),this.proxy instanceof HTMLOptionElement&&(this.proxy.defaultSelected=this.defaultSelected)}disabledChanged(){this.proxy instanceof HTMLOptionElement&&(this.proxy.disabled=this.disabled)}get selectedAttribute(){return this.defaultSelected}set selectedAttribute(e){this.defaultSelected=e}selectedChanged(){this.dirtySelected||=!0,this.proxy instanceof HTMLOptionElement&&(this.proxy.selected=this.selected)}valueChanged(){
|
|
1
|
+
const e=require("./vivid-element.cjs"),t=require("./decorate.cjs"),n=require("./dom.cjs"),r=require("./affix.cjs"),i=require("./host-semantics.cjs");var a=require("./component-enum.cjs").t([`accent`,`cta`],`accent`);function o(e){return n.t(e)&&(e.getAttribute(`role`)===`option`||e instanceof HTMLOptionElement||e instanceof s)}var s=class extends i.t(r.n(e.t)){defaultSelectedChanged(){this.dirtySelected||(this.selected=this.defaultSelected,this.proxy instanceof HTMLOptionElement&&(this.proxy.selected=this.defaultSelected)),this.proxy instanceof HTMLOptionElement&&(this.proxy.defaultSelected=this.defaultSelected)}disabledChanged(){this.proxy instanceof HTMLOptionElement&&(this.proxy.disabled=this.disabled)}get selectedAttribute(){return this.defaultSelected}set selectedAttribute(e){this.defaultSelected=e}selectedChanged(){this.dirtySelected||=!0,this.proxy instanceof HTMLOptionElement&&(this.proxy.selected=this.selected)}valueChanged(){typeof this.value==`string`?this.proxy instanceof HTMLOptionElement&&(this.proxy.value=this.value):this.value=``}get label(){return this._label??this.text}set label(e){this._label=e}set text(e){this._text=e}get text(){return this._text??``}_getAccessibleName(){return this.ariaLabel||`${this.text}${this.textSecondary?` ${this.textSecondary}`:``}`}get form(){return null}get _hasMatchedText(){return!!(this.matchedText??this._vvdSearchText)}get _matchedRange(){let e=this.matchedText??this._vvdSearchText;if(e){let t=this.text.toLowerCase().indexOf(e.toLowerCase());return t===-1?{from:0,to:0}:{from:t,to:t+e.length}}return{from:0,to:0}}constructor(e,t,n,r){super(),this.defaultSelected=!1,this.dirtySelected=!1,this.value=``,this._highlighted=!1,this._displayCheckmark=!1,this._vvdSearchText=``,this._isNotMatching=!1,e&&(this.text=e),t&&(this.value=t),n&&(this.defaultSelected=n),r&&(this.selected=r),this.proxy=new Option(this.text,this.value,this.defaultSelected,this.selected),this.proxy.disabled=this.disabled}connectedCallback(){super.connectedCallback(),this.dirtySelected||=(this.selected=this.defaultSelected,!1)}};t.t([e.m({converter:{fromView:e=>{if(e===!0||e===`true`)return!0;if(e===!1||e===`false`)return!1},toView:e=>e}})],s.prototype,`checked`,void 0),t.t([e.m({attribute:`selected`,mode:`boolean`})],s.prototype,`defaultSelected`,void 0),t.t([e.m({mode:`boolean`})],s.prototype,`disabled`,void 0),t.t([e.m({attribute:`current-selected`,mode:`boolean`})],s.prototype,`selected`,void 0),t.t([e.m({attribute:`value`})],s.prototype,`value`,void 0),t.t([e.m({attribute:`label`})],s.prototype,`_label`,void 0),t.t([e.m({attribute:`text`})],s.prototype,`_text`,void 0),t.t([e.m({attribute:`text-secondary`})],s.prototype,`textSecondary`,void 0),t.t([e.A],s.prototype,`_highlighted`,void 0),t.t([e.A],s.prototype,`_displayCheckmark`,void 0),t.t([e.m({attribute:`matched-text`})],s.prototype,`matchedText`,void 0),t.t([e.A],s.prototype,`_vvdSearchText`,void 0),t.t([e.j],s.prototype,`_hasMatchedText`,null),t.t([e.A],s.prototype,`_isNotMatching`,void 0),t.t([e.j],s.prototype,`_matchedRange`,null),t.t([e.m],s.prototype,`connotation`,void 0),t.t([e.m({attribute:`tag-connotation`})],s.prototype,`tagConnotation`,void 0),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
package/bundled/option.js
CHANGED
|
@@ -27,11 +27,7 @@ var d = class extends s(o(r)) {
|
|
|
27
27
|
this.dirtySelected ||= !0, this.proxy instanceof HTMLOptionElement && (this.proxy.selected = this.selected);
|
|
28
28
|
}
|
|
29
29
|
valueChanged() {
|
|
30
|
-
|
|
31
|
-
this.value = "";
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
this.proxy instanceof HTMLOptionElement && (this.proxy.value = this.value);
|
|
30
|
+
typeof this.value == "string" ? this.proxy instanceof HTMLOptionElement && (this.proxy.value = this.value) : this.value = "";
|
|
35
31
|
}
|
|
36
32
|
get label() {
|
|
37
33
|
return this._label ?? this.text;
|
package/bundled/repeat.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./vivid-element.cjs");var t=class{constructor(e,t,n){this.index=e,this.removed=t,this.addedCount=n}adjustTo(e){let t=this.index,n=e.length;return t>n?t=n-this.addedCount:t<0&&(t=n+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}},n=class{constructor(e){this.sorted=e}},r=Object.freeze({reset:1,splice:2,optimized:3}),i=new t(0,e.F,0);i.reset=!0;var a=[i],o;(function(e){e[e.leave=0]=`leave`,e[e.update=1]=`update`,e[e.add=2]=`add`,e[e.delete=3]=`delete`})(o||={});function s(e,t,n,r,i,a){let o=a-i+1,s=n-t+1,c=Array(o),l,u;for(let e=0;e<o;++e)c[e]=Array(s),c[e][0]=e;for(let e=0;e<s;++e)c[0][e]=e;for(let n=1;n<o;++n)for(let a=1;a<s;++a)e[t+a-1]===r[i+n-1]?c[n][a]=c[n-1][a-1]:(l=c[n-1][a]+1,u=c[n][a-1]+1,c[n][a]=l<u?l:u);return c}function c(e){let t=e.length-1,n=e[0].length-1,r=e[t][n],i=[];for(;t>0||n>0;){if(t===0){i.push(o.add),n--;continue}if(n===0){i.push(o.delete),t--;continue}let a=e[t-1][n-1],s=e[t-1][n],c=e[t][n-1],l;l=s<c?s<a?s:a:c<a?c:a,l===a?(a===r?i.push(o.leave):(i.push(o.update),r=a),t--,n--):l===s?(i.push(o.delete),t--,r=s):(i.push(o.add),n--,r=c)}return i.reverse()}function l(e,t,n){for(let r=0;r<n;++r)if(e[r]!==t[r])return r;return n}function u(e,t,n){let r=e.length,i=t.length,a=0;for(;a<n&&e[--r]===t[--i];)a++;return a}function d(e,t,n,r){return t<n||r<e?-1:t===n||r===e?0:e<n?t<r?t-n:r-n:r<t?r-e:t-e}function f(n,r,i,a,d,f){let p=0,m=0,h=Math.min(i-r,f-d);if(r===0&&d===0&&(p=l(n,a,h)),i===n.length&&f===a.length&&(m=u(n,a,h-p)),r+=p,d+=p,i-=m,f-=m,i-r===0&&f-d===0)return e.F;if(r===i){let e=new t(r,[],0);for(;d<f;)e.removed.push(a[d++]);return[e]}if(d===f)return[new t(r,[],i-r)];let g=c(s(n,r,i,a,d,f)),_=[],v,y=r,b=d;for(let e=0;e<g.length;++e)switch(g[e]){case o.leave:v!==void 0&&(_.push(v),v=void 0),y++,b++;break;case o.update:v===void 0&&(v=new t(y,[],0)),v.addedCount++,y++,v.removed.push(a[b]),b++;break;case o.add:v===void 0&&(v=new t(y,[],0)),v.addedCount++,y++;break;case o.delete:v===void 0&&(v=new t(y,[],0)),v.removed.push(a[b]),b++}return v!==void 0&&_.push(v),_}function p(e,t){let n=!1,r=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.index+=r,n)continue;let o=d(e.index,e.index+e.removed.length,a.index,a.index+a.addedCount);if(o>=0){t.splice(i,1),i--,r-=a.addedCount-a.removed.length,e.addedCount+=a.addedCount-o;let s=e.removed.length+a.removed.length-o;if(!e.addedCount&&!s)n=!0;else{let t=a.removed;if(e.index<a.index){let n=e.removed.slice(0,a.index-e.index);n.push(...t),t=n}if(e.index+e.removed.length>a.index+a.addedCount){let n=e.removed.slice(a.index+a.addedCount-e.index);t.push(...n)}e.removed=t,a.index<e.index&&(e.index=a.index)}}else if(e.index<a.index){n=!0,t.splice(i,0,e),i++;let o=e.addedCount-e.removed.length;a.index+=o,r+=o}}n||t.push(e)}function m(e,t){let n=[],r=[];for(let e=0,n=t.length;e<n;e++)p(t[e],r);for(let t=0,i=r.length;t<i;++t){let i=r[t];if(i.addedCount===1&&i.removed.length===1){i.removed[0]!==e[i.index]&&n.push(i);continue}n=n.concat(f(e,i.index,i.index+i.addedCount,i.removed,0,i.removed.length))}return n}var h=Object.freeze({support:r.optimized,normalize(t,n,r){return t===void 0?r===void 0?e.F:m(n,r):a},pop(e,n,r,i){let a=e.length>0,o=r.apply(e,i);return a&&n.addSplice(new t(e.length,[o],0)),o},push(e,n,r,i){let a=r.apply(e,i);return n.addSplice(new t(e.length-i.length,[],i.length).adjustTo(e)),a},reverse(e,t,r,i){let a=r.apply(e,i);e.sorted++;let o=[];for(let t=e.length-1;t>=0;t--)o.push(t);return t.addSort(new n(o)),a},shift(e,n,r,i){let a=e.length>0,o=r.apply(e,i);return a&&n.addSplice(new t(0,[o],0)),o},sort(e,t,r,i){let a=new Map;for(let t=0,n=e.length;t<n;++t){let n=a.get(e[t])||[];a.set(e[t],[...n,t])}let o=r.apply(e,i);e.sorted++;let s=[];for(let t=0,n=e.length;t<n;++t){let n=a.get(e[t]);s.push(n[0]),a.set(e[t],n.splice(1))}return t.addSort(new n(s)),o},splice(e,n,r,i){let a=r.apply(e,i);return n.addSplice(new t(+i[0],a,i.length>2?i.length-2:0).adjustTo(e)),a},unshift(e,n,r,i){let a=r.apply(e,i);return n.addSplice(new t(0,[],i.length).adjustTo(e)),a}});Object.freeze({reset:a,setDefaultStrategy(e){h=e}});function g(e,t,n,r=!0){Reflect.defineProperty(e,t,{value:n,enumerable:!1,writable:r})}var _=class extends e.N{get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let t=this._lengthObserver;if(t===void 0){let n=this.subject;this._lengthObserver=t={length:n.length,handleChange(){this.length!==n.length&&(this.length=n.length,e.k.notify(t,`length`))}},this.subscribe(t)}return t}get sortObserver(){let t=this._sortObserver;if(t===void 0){let n=this.subject;this._sortObserver=t={sorted:n.sorted,handleChange(){this.sorted!==n.sorted&&(this.sorted=n.sorted,e.k.notify(t,`sorted`))}},this.subscribe(t)}return t}constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.sorts=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this._sortObserver=void 0,this.call=this.flush,g(e,`$fastController`,this)}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){this.splices===void 0?this.splices=[e]:this.splices.push(e),this.enqueue()}addSort(e){this.sorts===void 0?this.sorts=[e]:this.sorts.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){let e=this.splices,t=this.sorts,n=this.oldCollection;(e!==void 0||n!==void 0||t!==void 0)&&(this.needsQueue=!0,this.splices=void 0,this.sorts=void 0,this.oldCollection=void 0,t===void 0?this.notify((this._strategy??h).normalize(n,this.subject,e)):this.notify(t))}enqueue(){this.needsQueue&&(this.needsQueue=!1,e.M.enqueue(this))}},v=!1,y=Object.freeze({sorted:0,enable(){if(v)return;v=!0,e.k.setArrayObserverFactory(e=>new _(e));let t=Array.prototype;t.$fastPatch||(g(t,`$fastPatch`,1),g(t,`sorted`,0),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach(e=>{t[e.name]=function(...t){let n=this.$fastController;return n===void 0?e.apply(this,t):(n.strategy??h)[e.name](this,n,e,t)}}))}});function b(t){return e.I(t)?e.E(t):t instanceof e.D?t:e.T(()=>t)}var x=Object.freeze({positioning:!1,recycle:!0});function S(e,t,n,r){e.context.parent=r.source,e.context.parentContext=r.context,e.bind(t[n])}function C(e,t,n,r){e.context.parent=r.source,e.context.parentContext=r.context,e.context.length=t.length,e.context.index=n,e.bind(t[n])}function w(e){return e.nodeType===Node.COMMENT_NODE}var T=class extends Error{constructor(e,t){super(e),this.propertyBag=t}},E=class{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=S,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(this,e),this.templateBindingObserver=e.templateBinding.createObserver(this,e),e.options.positioning&&(this.bindView=C)}bind(t){this.location=t.targets[this.directive.targetNodeId],this.controller=t,this.items=this.itemsBindingObserver.bind(t),this.template=this.templateBindingObserver.bind(t),this.observeItems(!0),e.b(this.template)&&e.b(t)&&t.hydrationStage!==e.v.hydrated?this.hydrateViews(this.template):this.refreshAllViews(),t.onUnbind(this)}unbind(){this.itemsObserver!==null&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else if(t[0])t[0].reset?this.refreshAllViews():t[0].sorted?this.updateSortedViews(t):this.updateSplicedViews(t);else return}observeItems(t=!1){if(!this.items){this.items=e.F;return}let n=this.itemsObserver,r=this.itemsObserver=e.k.getNotifier(this.items),i=n!==r;i&&n!==null&&n.unsubscribe(this),(i||t)&&r.subscribe(this)}updateSortedViews(e){let t=this.views;for(let n=0,r=e.length;n<r;++n){let r=e[n].sorted.slice(),i=r.slice().sort();for(let e=0,n=r.length;e<n;++e){let n=r.find(t=>r[e]===i[t]);if(n!==e){let r=i.splice(n,1);i.splice(e,0,...r);let a=t[e],o=a?a.firstChild:this.location;t[n].remove(),t[n].insertBefore(o);let s=t.splice(n,1);t.splice(e,0,...s)}}}}updateSplicedViews(e){let t=this.views,n=this.bindView,r=this.items,i=this.template,a=this.controller,o=this.directive.options.recycle,s=[],c=0,l=0;for(let u=0,d=e.length;u<d;++u){let d=e[u],f=d.removed,p=0,m=d.index,h=m+d.addedCount,g=t.splice(d.index,f.length),_=l=s.length+g.length;for(;m<h;++m){let e=t[m],u=e?e.firstChild:this.location,d;o&&l>0?(p<=_&&g.length>0?(d=g[p],p++):(d=s[c],c++),l--):d=i.create(),t.splice(m,0,d),n(d,r,m,a),d.insertBefore(u)}g[p]&&s.push(...g.slice(p))}for(let e=c,t=s.length;e<t;++e)s[e].dispose();if(this.directive.options.positioning)for(let e=0,n=t.length;e<n;++e){let r=t[e].context;r.length=n,r.index=e}}refreshAllViews(t=!1){let n=this.items,r=this.template,i=this.location,a=this.bindView,o=this.controller,s=n.length,c=this.views,l=c.length;if((s===0||t||!this.directive.options.recycle)&&(e._.disposeContiguousBatch(c),l=0),l===0){this.views=c=Array(s);for(let e=0;e<s;++e){let t=r.create();a(t,n,e,o),c[e]=t,t.insertBefore(i)}}else{let e=0;for(;e<s;++e)if(e<l){let t=c[e];if(!t){let t=new XMLSerializer;throw new T(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`,{index:e,hydrationStage:this.controller.hydrationStage,itemsLength:s,viewsState:c.map(e=>e?`hydrated`:`empty`),viewTemplateString:t.serializeToString(r.create().fragment),rootNodeContent:t.serializeToString(this.location.getRootNode())})}a(t,n,e,o)}else{let t=r.create();a(t,n,e,o),c.push(t),t.insertBefore(i)}let t=c.splice(e,l-e);for(e=0,s=t.length;e<s;++e)t[e].dispose()}}unbindAllViews(){let e=this.views;for(let t=0,n=e.length;t<n;++t){let n=e[t];if(!n){let n=new XMLSerializer;throw new T(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`,{index:t,hydrationStage:this.controller.hydrationStage,viewsState:e.map(e=>e?`hydrated`:`empty`),rootNodeContent:n.serializeToString(this.location.getRootNode())})}n.unbind()}}hydrateViews(t){if(!this.items)return;this.views=Array(this.items.length);let n=this.location.previousSibling;for(;n!==null;){if(!w(n)){n=n.previousSibling;continue}let r=e.y.parseRepeatEndMarker(n.data);if(r===null){n=n.previousSibling;continue}n.data=``;let i=n.previousSibling;if(!i)throw Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": end should never be null.`);let a=i,o=0;for(;a!==null;){if(w(a)){if(e.y.isRepeatViewEndMarker(a.data))o++;else if(e.y.isRepeatViewStartMarker(a.data)){if(o)o--;else{if(e.y.parseRepeatStartMarker(a.data)!==r)throw Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": Mismatched start and end markers.`);a.data=``,n=a.previousSibling,a=a.nextSibling;let o=t.hydrate(a,i);this.views[r]=o,this.bindView(o,this.items,r,this.controller);break}}}a=a.previousSibling}if(!a)throw Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": start should never be null.`)}}},D=class{createHTML(t){return e.C.comment(t(this))}constructor(e,t,n){this.dataBinding=e,this.templateBinding=t,this.options=n,y.enable()}createBehavior(){return new E(this)}};e.x.define(D);function O(e,t,n=x){return new D(b(e),b(t),Object.assign(Object.assign({},x),n))}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
|
1
|
+
const e=require("./vivid-element.cjs");var t=class{constructor(e,t,n){this.index=e,this.removed=t,this.addedCount=n}adjustTo(e){let t=this.index,n=e.length;return t>n?t=n-this.addedCount:t<0&&(t=n+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}},n=class{constructor(e){this.sorted=e}},r=Object.freeze({reset:1,splice:2,optimized:3}),i=new t(0,e.F,0);i.reset=!0;var a=[i],o;(function(e){e[e.leave=0]=`leave`,e[e.update=1]=`update`,e[e.add=2]=`add`,e[e.delete=3]=`delete`})(o||={});function s(e,t,n,r,i,a){let o=a-i+1,s=n-t+1,c=Array(o),l,u;for(let e=0;e<o;++e)c[e]=Array(s),c[e][0]=e;for(let e=0;e<s;++e)c[0][e]=e;for(let n=1;n<o;++n)for(let a=1;a<s;++a)e[t+a-1]===r[i+n-1]?c[n][a]=c[n-1][a-1]:(l=c[n-1][a]+1,u=c[n][a-1]+1,c[n][a]=l<u?l:u);return c}function c(e){let t=e.length-1,n=e[0].length-1,r=e[t][n],i=[];for(;t>0||n>0;){if(t===0){i.push(o.add),n--;continue}if(n===0){i.push(o.delete),t--;continue}let a=e[t-1][n-1],s=e[t-1][n],c=e[t][n-1],l;l=s<c?s<a?s:a:c<a?c:a,l===a?(a===r?i.push(o.leave):(i.push(o.update),r=a),t--,n--):l===s?(i.push(o.delete),t--,r=s):(i.push(o.add),n--,r=c)}return i.reverse()}function l(e,t,n){for(let r=0;r<n;++r)if(e[r]!==t[r])return r;return n}function u(e,t,n){let r=e.length,i=t.length,a=0;for(;a<n&&e[--r]===t[--i];)a++;return a}function d(e,t,n,r){return t<n||r<e?-1:t===n||r===e?0:e<n?t<r?t-n:r-n:r<t?r-e:t-e}function f(n,r,i,a,d,f){let p=0,m=0,h=Math.min(i-r,f-d);if(r===0&&d===0&&(p=l(n,a,h)),i===n.length&&f===a.length&&(m=u(n,a,h-p)),r+=p,d+=p,i-=m,f-=m,i-r===0&&f-d===0)return e.F;if(r===i){let e=new t(r,[],0);for(;d<f;)e.removed.push(a[d++]);return[e]}if(d===f)return[new t(r,[],i-r)];let g=c(s(n,r,i,a,d,f)),_=[],v,y=r,b=d;for(let e=0;e<g.length;++e)switch(g[e]){case o.leave:v!==void 0&&(_.push(v),v=void 0),y++,b++;break;case o.update:v===void 0&&(v=new t(y,[],0)),v.addedCount++,y++,v.removed.push(a[b]),b++;break;case o.add:v===void 0&&(v=new t(y,[],0)),v.addedCount++,y++;break;case o.delete:v===void 0&&(v=new t(y,[],0)),v.removed.push(a[b]),b++}return v!==void 0&&_.push(v),_}function p(e,t){let n=!1,r=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.index+=r,n)continue;let o=d(e.index,e.index+e.removed.length,a.index,a.index+a.addedCount);if(o>=0){t.splice(i,1),i--,r-=a.addedCount-a.removed.length,e.addedCount+=a.addedCount-o;let s=e.removed.length+a.removed.length-o;if(!e.addedCount&&!s)n=!0;else{let t=a.removed;if(e.index<a.index){let n=e.removed.slice(0,a.index-e.index);n.push(...t),t=n}if(e.index+e.removed.length>a.index+a.addedCount){let n=e.removed.slice(a.index+a.addedCount-e.index);t.push(...n)}e.removed=t,a.index<e.index&&(e.index=a.index)}}else if(e.index<a.index){n=!0,t.splice(i,0,e),i++;let o=e.addedCount-e.removed.length;a.index+=o,r+=o}}n||t.push(e)}function m(e,t){let n=[],r=[];for(let e=0,n=t.length;e<n;e++)p(t[e],r);for(let t=0,i=r.length;t<i;++t){let i=r[t];i.addedCount===1&&i.removed.length===1?i.removed[0]!==e[i.index]&&n.push(i):n=n.concat(f(e,i.index,i.index+i.addedCount,i.removed,0,i.removed.length))}return n}var h=Object.freeze({support:r.optimized,normalize(t,n,r){return t===void 0?r===void 0?e.F:m(n,r):a},pop(e,n,r,i){let a=e.length>0,o=r.apply(e,i);return a&&n.addSplice(new t(e.length,[o],0)),o},push(e,n,r,i){let a=r.apply(e,i);return n.addSplice(new t(e.length-i.length,[],i.length).adjustTo(e)),a},reverse(e,t,r,i){let a=r.apply(e,i);e.sorted++;let o=[];for(let t=e.length-1;t>=0;t--)o.push(t);return t.addSort(new n(o)),a},shift(e,n,r,i){let a=e.length>0,o=r.apply(e,i);return a&&n.addSplice(new t(0,[o],0)),o},sort(e,t,r,i){let a=new Map;for(let t=0,n=e.length;t<n;++t){let n=a.get(e[t])||[];a.set(e[t],[...n,t])}let o=r.apply(e,i);e.sorted++;let s=[];for(let t=0,n=e.length;t<n;++t){let n=a.get(e[t]);s.push(n[0]),a.set(e[t],n.splice(1))}return t.addSort(new n(s)),o},splice(e,n,r,i){let a=r.apply(e,i);return n.addSplice(new t(+i[0],a,i.length>2?i.length-2:0).adjustTo(e)),a},unshift(e,n,r,i){let a=r.apply(e,i);return n.addSplice(new t(0,[],i.length).adjustTo(e)),a}});Object.freeze({reset:a,setDefaultStrategy(e){h=e}});function g(e,t,n,r=!0){Reflect.defineProperty(e,t,{value:n,enumerable:!1,writable:r})}var _=class extends e.N{get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let t=this._lengthObserver;if(t===void 0){let n=this.subject;this._lengthObserver=t={length:n.length,handleChange(){this.length!==n.length&&(this.length=n.length,e.k.notify(t,`length`))}},this.subscribe(t)}return t}get sortObserver(){let t=this._sortObserver;if(t===void 0){let n=this.subject;this._sortObserver=t={sorted:n.sorted,handleChange(){this.sorted!==n.sorted&&(this.sorted=n.sorted,e.k.notify(t,`sorted`))}},this.subscribe(t)}return t}constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.sorts=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this._sortObserver=void 0,this.call=this.flush,g(e,`$fastController`,this)}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){this.splices===void 0?this.splices=[e]:this.splices.push(e),this.enqueue()}addSort(e){this.sorts===void 0?this.sorts=[e]:this.sorts.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){let e=this.splices,t=this.sorts,n=this.oldCollection;(e!==void 0||n!==void 0||t!==void 0)&&(this.needsQueue=!0,this.splices=void 0,this.sorts=void 0,this.oldCollection=void 0,t===void 0?this.notify((this._strategy??h).normalize(n,this.subject,e)):this.notify(t))}enqueue(){this.needsQueue&&(this.needsQueue=!1,e.M.enqueue(this))}},v=!1,y=Object.freeze({sorted:0,enable(){if(v)return;v=!0,e.k.setArrayObserverFactory(e=>new _(e));let t=Array.prototype;t.$fastPatch||(g(t,`$fastPatch`,1),g(t,`sorted`,0),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach(e=>{t[e.name]=function(...t){let n=this.$fastController;return n===void 0?e.apply(this,t):(n.strategy??h)[e.name](this,n,e,t)}}))}});function b(t){return e.I(t)?e.E(t):t instanceof e.D?t:e.T(()=>t)}var x=Object.freeze({positioning:!1,recycle:!0});function S(e,t,n,r){e.context.parent=r.source,e.context.parentContext=r.context,e.bind(t[n])}function C(e,t,n,r){e.context.parent=r.source,e.context.parentContext=r.context,e.context.length=t.length,e.context.index=n,e.bind(t[n])}function w(e){return e.nodeType===Node.COMMENT_NODE}var T=class extends Error{constructor(e,t){super(e),this.propertyBag=t}},E=class{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=S,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(this,e),this.templateBindingObserver=e.templateBinding.createObserver(this,e),e.options.positioning&&(this.bindView=C)}bind(t){this.location=t.targets[this.directive.targetNodeId],this.controller=t,this.items=this.itemsBindingObserver.bind(t),this.template=this.templateBindingObserver.bind(t),this.observeItems(!0),e.b(this.template)&&e.b(t)&&t.hydrationStage!==e.v.hydrated?this.hydrateViews(this.template):this.refreshAllViews(),t.onUnbind(this)}unbind(){this.itemsObserver!==null&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else if(t[0])t[0].reset?this.refreshAllViews():t[0].sorted?this.updateSortedViews(t):this.updateSplicedViews(t);else return}observeItems(t=!1){if(!this.items){this.items=e.F;return}let n=this.itemsObserver,r=this.itemsObserver=e.k.getNotifier(this.items),i=n!==r;i&&n!==null&&n.unsubscribe(this),(i||t)&&r.subscribe(this)}updateSortedViews(e){let t=this.views;for(let n=0,r=e.length;n<r;++n){let r=e[n].sorted.slice(),i=r.slice().sort();for(let e=0,n=r.length;e<n;++e){let n=r.find(t=>r[e]===i[t]);if(n!==e){let r=i.splice(n,1);i.splice(e,0,...r);let a=t[e],o=a?a.firstChild:this.location;t[n].remove(),t[n].insertBefore(o);let s=t.splice(n,1);t.splice(e,0,...s)}}}}updateSplicedViews(e){let t=this.views,n=this.bindView,r=this.items,i=this.template,a=this.controller,o=this.directive.options.recycle,s=[],c=0,l=0;for(let u=0,d=e.length;u<d;++u){let d=e[u],f=d.removed,p=0,m=d.index,h=m+d.addedCount,g=t.splice(d.index,f.length),_=l=s.length+g.length;for(;m<h;++m){let e=t[m],u=e?e.firstChild:this.location,d;o&&l>0?(p<=_&&g.length>0?(d=g[p],p++):(d=s[c],c++),l--):d=i.create(),t.splice(m,0,d),n(d,r,m,a),d.insertBefore(u)}g[p]&&s.push(...g.slice(p))}for(let e=c,t=s.length;e<t;++e)s[e].dispose();if(this.directive.options.positioning)for(let e=0,n=t.length;e<n;++e){let r=t[e].context;r.length=n,r.index=e}}refreshAllViews(t=!1){let n=this.items,r=this.template,i=this.location,a=this.bindView,o=this.controller,s=n.length,c=this.views,l=c.length;if((s===0||t||!this.directive.options.recycle)&&(e._.disposeContiguousBatch(c),l=0),l===0){this.views=c=Array(s);for(let e=0;e<s;++e){let t=r.create();a(t,n,e,o),c[e]=t,t.insertBefore(i)}}else{let e=0;for(;e<s;++e)if(e<l){let t=c[e];if(!t){let t=new XMLSerializer;throw new T(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`,{index:e,hydrationStage:this.controller.hydrationStage,itemsLength:s,viewsState:c.map(e=>e?`hydrated`:`empty`),viewTemplateString:t.serializeToString(r.create().fragment),rootNodeContent:t.serializeToString(this.location.getRootNode())})}a(t,n,e,o)}else{let t=r.create();a(t,n,e,o),c.push(t),t.insertBefore(i)}let t=c.splice(e,l-e);for(e=0,s=t.length;e<s;++e)t[e].dispose()}}unbindAllViews(){let e=this.views;for(let t=0,n=e.length;t<n;++t){let n=e[t];if(!n){let n=new XMLSerializer;throw new T(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`,{index:t,hydrationStage:this.controller.hydrationStage,viewsState:e.map(e=>e?`hydrated`:`empty`),rootNodeContent:n.serializeToString(this.location.getRootNode())})}n.unbind()}}hydrateViews(t){if(!this.items)return;this.views=Array(this.items.length);let n=this.location.previousSibling;for(;n!==null;){if(!w(n)){n=n.previousSibling;continue}let r=e.y.parseRepeatEndMarker(n.data);if(r===null){n=n.previousSibling;continue}n.data=``;let i=n.previousSibling;if(!i)throw Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": end should never be null.`);let a=i,o=0;for(;a!==null;){if(w(a)){if(e.y.isRepeatViewEndMarker(a.data))o++;else if(e.y.isRepeatViewStartMarker(a.data)){if(o)o--;else{if(e.y.parseRepeatStartMarker(a.data)!==r)throw Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": Mismatched start and end markers.`);a.data=``,n=a.previousSibling,a=a.nextSibling;let o=t.hydrate(a,i);this.views[r]=o,this.bindView(o,this.items,r,this.controller);break}}}a=a.previousSibling}if(!a)throw Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": start should never be null.`)}}},D=class{createHTML(t){return e.C.comment(t(this))}constructor(e,t,n){this.dataBinding=e,this.templateBinding=t,this.options=n,y.enable()}createBehavior(){return new E(this)}};e.x.define(D);function O(e,t,n=x){return new D(b(e),b(t),Object.assign(Object.assign({},x),n))}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
package/bundled/repeat.js
CHANGED
|
@@ -116,11 +116,7 @@ function D(e, t) {
|
|
|
116
116
|
for (let e = 0, n = t.length; e < n; e++) E(t[e], r);
|
|
117
117
|
for (let t = 0, i = r.length; t < i; ++t) {
|
|
118
118
|
let i = r[t];
|
|
119
|
-
|
|
120
|
-
i.removed[0] !== e[i.index] && n.push(i);
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
n = n.concat(T(e, i.index, i.index + i.addedCount, i.removed, 0, i.removed.length));
|
|
119
|
+
i.addedCount === 1 && i.removed.length === 1 ? i.removed[0] !== e[i.index] && n.push(i) : n = n.concat(T(e, i.index, i.index + i.addedCount, i.removed, 0, i.removed.length));
|
|
124
120
|
}
|
|
125
121
|
return n;
|
|
126
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=e=>{class t extends e{constructor(...e){super(...e),this._isInternalValueUpdate=!1}valueChanged(e,t){
|
|
1
|
+
var e=e=>{class t extends e{constructor(...e){super(...e),this._isInternalValueUpdate=!1}valueChanged(e,t){super.valueChanged(e,t),this.value&&!this._isValidValue(this.value)?this.value=``:this._isInternalValueUpdate||this._updatePresentationValue()}_updatePresentationValue(){this._presentationValue=this.value?this._toPresentationValue(this.value):``}_updateValueDueToUserInteraction(e,t){this.value!==e&&(this._isInternalValueUpdate=!0,this.value=e,this._isInternalValueUpdate=!1,this.$emit(`input`)),t||(this._updatePresentationValue(),this.$emit(`change`))}_onTextFieldChange(){if(this._presentationValue===``)this._updateValueDueToUserInteraction(``,!1);else try{this._updateValueDueToUserInteraction(this._parsePresentationValue(this._presentationValue),!1)}catch{let e=this._presentationValue;this._updateValueDueToUserInteraction(``,!1),this._presentationValue=e;return}}_onTextFieldInput(e){if(super._onTextFieldInput(e),this._presentationValue===``)this._updateValueDueToUserInteraction(``,!0);else try{this._updateValueDueToUserInteraction(this._parsePresentationValue(this._presentationValue),!0)}catch{return}}_isPresentationValueInvalid(){if(this._presentationValue===``)return!1;try{return this._parsePresentationValue(this._presentationValue),!1}catch{return!0}}_onClearClick(){this._updateValueDueToUserInteraction(``,!1),super._onClearClick()}}return t};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
@@ -5,11 +5,7 @@ var e = (e) => {
|
|
|
5
5
|
super(...e), this._isInternalValueUpdate = !1;
|
|
6
6
|
}
|
|
7
7
|
valueChanged(e, t) {
|
|
8
|
-
|
|
9
|
-
this.value = "";
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
this._isInternalValueUpdate || this._updatePresentationValue();
|
|
8
|
+
super.valueChanged(e, t), this.value && !this._isValidValue(this.value) ? this.value = "" : this._isInternalValueUpdate || this._updatePresentationValue();
|
|
13
9
|
}
|
|
14
10
|
_updatePresentationValue() {
|
|
15
11
|
this._presentationValue = this.value ? this._toPresentationValue(this.value) : "";
|
|
@@ -18,11 +14,8 @@ var e = (e) => {
|
|
|
18
14
|
this.value !== e && (this._isInternalValueUpdate = !0, this.value = e, this._isInternalValueUpdate = !1, this.$emit("input")), t || (this._updatePresentationValue(), this.$emit("change"));
|
|
19
15
|
}
|
|
20
16
|
_onTextFieldChange() {
|
|
21
|
-
if (this._presentationValue === "")
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
17
|
+
if (this._presentationValue === "") this._updateValueDueToUserInteraction("", !1);
|
|
18
|
+
else try {
|
|
26
19
|
this._updateValueDueToUserInteraction(this._parsePresentationValue(this._presentationValue), !1);
|
|
27
20
|
} catch {
|
|
28
21
|
let e = this._presentationValue;
|
|
@@ -31,11 +24,8 @@ var e = (e) => {
|
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
26
|
_onTextFieldInput(e) {
|
|
34
|
-
if (super._onTextFieldInput(e), this._presentationValue === "")
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
27
|
+
if (super._onTextFieldInput(e), this._presentationValue === "") this._updateValueDueToUserInteraction("", !0);
|
|
28
|
+
else try {
|
|
39
29
|
this._updateValueDueToUserInteraction(this._parsePresentationValue(this._presentationValue), !0);
|
|
40
30
|
} catch {
|
|
41
31
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function e(e){this.content=e}e.prototype={constructor:e,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(t,n,r){var i=r&&r!=t?this.remove(r):this,a=i.find(t),o=i.content.slice();return a==-1?o.push(r||t,n):(o[a+1]=n,r&&(o[a]=r)),new e(o)},remove:function(t){var n=this.find(t);if(n==-1)return this;var r=this.content.slice();return r.splice(n,2),new e(r)},addToStart:function(t,n){return new e([t,n].concat(this.remove(t).content))},addToEnd:function(t,n){var r=this.remove(t).content.slice();return r.push(t,n),new e(r)},addBefore:function(t,n,r){var i=this.remove(n),a=i.content.slice(),o=i.find(t);return a.splice(o==-1?a.length:o,0,n,r),new e(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(t){return t=e.from(t),t.size?new e(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=e.from(t),t.size?new e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var n=this;t=e.from(t);for(var r=0;r<t.content.length;r+=2)n=n.remove(t.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},e.from=function(t){if(t instanceof e)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new e(n)};function t(e,n,r){for(let i=0;;i++){if(i==e.childCount||i==n.childCount)return e.childCount==n.childCount?null:r;let a=e.child(i),o=n.child(i);if(a==o){r+=a.nodeSize;continue}if(!a.sameMarkup(o))return r;if(a.isText&&a.text!=o.text){for(let e=0;a.text[e]==o.text[e];e++)r++;return r}if(a.content.size||o.content.size){let e=t(a.content,o.content,r+1);if(e!=null)return e}r+=a.nodeSize}}function n(e,t,r,i){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:r,b:i};let s=e.child(--a),c=t.child(--o),l=s.nodeSize;if(s==c){r-=l,i-=l;continue}if(!s.sameMarkup(c))return{a:r,b:i};if(s.isText&&s.text!=c.text){let e=0,t=Math.min(s.text.length,c.text.length);for(;e<t&&s.text[s.text.length-e-1]==c.text[c.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(s.content.size||c.content.size){let e=n(s.content,c.content,r-1,i-1);if(e)return e}r-=l,i-=l}}var r=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,n=0){return t(this,e,n)}findDiffEnd(e,t=this.size,r=e.size){return n(this,e,t,r)}findIndex(e){if(e==0)return a(0,e);if(e==this.size)return a(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?a(t+1,i):a(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};r.empty=new r([],0);var i={index:0,offset:0};function a(e,t){return i.index=e,i.offset=t,i}function o(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!o(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!o(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var s=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&o(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};s.none=[];var c=class extends Error{},l=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=d(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(u(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let i=n.openStart||0,a=n.openEnd||0;if(typeof i!=`number`||typeof a!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(r.fromJSON(t,n.content),i,a)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};l.empty=new l(r.empty,0,0);function u(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(u(a.content,t-i-1,n-i-1)))}function d(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=d(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function ee(e,t,n){if(n.openStart>e.depth)throw new c(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new c(`Inconsistent open depths`);return f(e,t,n,0)}function f(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=f(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return _(a,y(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return _(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=te(n,e);return _(a,v(e,i,o,t,r))}}function p(e,t){if(!t.type.compatibleContent(e.type))throw new c(`Cannot join `+t.type.name+` onto `+e.type.name)}function m(e,t,n){let r=e.node(n);return p(r,t.node(n)),r}function h(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function g(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(h(e.nodeAfter,r),a++));for(let e=a;e<o;e++)h(i.child(e),r);t&&t.depth==n&&t.textOffset&&h(t.nodeBefore,r)}function _(e,t){return e.type.checkContent(t),e.copy(t)}function v(e,t,n,i,a){let o=e.depth>a&&m(e,t,a+1),s=i.depth>a&&m(n,i,a+1),c=[];return g(null,e,a,c),o&&s&&t.index(a)==n.index(a)?(p(o,s),h(_(o,v(e,t,n,i,a+1)),c)):(o&&h(_(o,y(e,t,a+1)),c),g(t,n,a,c),s&&h(_(s,y(n,i,a+1)),c)),g(i,null,a,c),new r(c)}function y(e,t,n){let i=[];return g(null,e,n,i),e.depth>n&&h(_(m(e,t,n+1),y(e,t,n+1)),i),g(t,null,n,i),new r(i)}function te(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)i=t.node(e).copy(r.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}var b=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return s.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new S(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=x.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else x.set(t,r=new ne);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%re,i}},ne=class{constructor(){this.elts=[],this.i=0}},re=12,x=new WeakMap,S=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ie=Object.create(null),C=class e{constructor(e,t,n,i=s.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||r.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&o(this.attrs,t||e.defaultAttrs||ie)&&s.sameSet(this.marks,n||s.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return l.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new l(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return ee(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return b.resolveCached(this,e)}resolveNoCache(e){return b.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),w(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=r.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=i;e<a;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=s.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!s.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let i=r.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};C.prototype.text=void 0;var ae=class e extends C{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):w(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function w(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var T=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new oe(t,n);if(r.next==null)return e.empty;let i=E(r);r.next&&r.err(`Unexpected trailing text`);let a=pe(fe(i));return me(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let c=o.matchFragment(e,n);if(c&&(!t||c.validEnd))return r.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&i.indexOf(n)==-1){i.push(n);let e=a(n,s.concat(t));if(e)return e}}return null}return a(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
1
|
+
function e(e){this.content=e}e.prototype={constructor:e,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(t,n,r){var i=r&&r!=t?this.remove(r):this,a=i.find(t),o=i.content.slice();return a==-1?o.push(r||t,n):(o[a+1]=n,r&&(o[a]=r)),new e(o)},remove:function(t){var n=this.find(t);if(n==-1)return this;var r=this.content.slice();return r.splice(n,2),new e(r)},addToStart:function(t,n){return new e([t,n].concat(this.remove(t).content))},addToEnd:function(t,n){var r=this.remove(t).content.slice();return r.push(t,n),new e(r)},addBefore:function(t,n,r){var i=this.remove(n),a=i.content.slice(),o=i.find(t);return a.splice(o==-1?a.length:o,0,n,r),new e(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(t){return t=e.from(t),t.size?new e(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=e.from(t),t.size?new e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var n=this;t=e.from(t);for(var r=0;r<t.content.length;r+=2)n=n.remove(t.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},e.from=function(t){if(t instanceof e)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new e(n)};function t(e,n,r){for(let i=0;;i++){if(i==e.childCount||i==n.childCount)return e.childCount==n.childCount?null:r;let a=e.child(i),o=n.child(i);if(a==o)r+=a.nodeSize;else{if(!a.sameMarkup(o))return r;if(a.isText&&a.text!=o.text){for(let e=0;a.text[e]==o.text[e];e++)r++;return r}if(a.content.size||o.content.size){let e=t(a.content,o.content,r+1);if(e!=null)return e}r+=a.nodeSize}}}function n(e,t,r,i){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:r,b:i};let s=e.child(--a),c=t.child(--o),l=s.nodeSize;if(s==c)r-=l,i-=l;else{if(!s.sameMarkup(c))return{a:r,b:i};if(s.isText&&s.text!=c.text){let e=0,t=Math.min(s.text.length,c.text.length);for(;e<t&&s.text[s.text.length-e-1]==c.text[c.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(s.content.size||c.content.size){let e=n(s.content,c.content,r-1,i-1);if(e)return e}r-=l,i-=l}}}var r=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,n=0){return t(this,e,n)}findDiffEnd(e,t=this.size,r=e.size){return n(this,e,t,r)}findIndex(e){if(e==0)return a(0,e);if(e==this.size)return a(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?a(t+1,i):a(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};r.empty=new r([],0);var i={index:0,offset:0};function a(e,t){return i.index=e,i.offset=t,i}function o(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!o(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!o(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var s=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&o(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};s.none=[];var c=class extends Error{},l=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=d(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(u(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let i=n.openStart||0,a=n.openEnd||0;if(typeof i!=`number`||typeof a!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(r.fromJSON(t,n.content),i,a)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};l.empty=new l(r.empty,0,0);function u(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(u(a.content,t-i-1,n-i-1)))}function d(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=d(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function ee(e,t,n){if(n.openStart>e.depth)throw new c(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new c(`Inconsistent open depths`);return f(e,t,n,0)}function f(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=f(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return _(a,y(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return _(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=te(n,e);return _(a,v(e,i,o,t,r))}}function p(e,t){if(!t.type.compatibleContent(e.type))throw new c(`Cannot join `+t.type.name+` onto `+e.type.name)}function m(e,t,n){let r=e.node(n);return p(r,t.node(n)),r}function h(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function g(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(h(e.nodeAfter,r),a++));for(let e=a;e<o;e++)h(i.child(e),r);t&&t.depth==n&&t.textOffset&&h(t.nodeBefore,r)}function _(e,t){return e.type.checkContent(t),e.copy(t)}function v(e,t,n,i,a){let o=e.depth>a&&m(e,t,a+1),s=i.depth>a&&m(n,i,a+1),c=[];return g(null,e,a,c),o&&s&&t.index(a)==n.index(a)?(p(o,s),h(_(o,v(e,t,n,i,a+1)),c)):(o&&h(_(o,y(e,t,a+1)),c),g(t,n,a,c),s&&h(_(s,y(n,i,a+1)),c)),g(i,null,a,c),new r(c)}function y(e,t,n){let i=[];return g(null,e,n,i),e.depth>n&&h(_(m(e,t,n+1),y(e,t,n+1)),i),g(t,null,n,i),new r(i)}function te(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)i=t.node(e).copy(r.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}var b=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return s.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new S(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=x.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else x.set(t,r=new ne);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%re,i}},ne=class{constructor(){this.elts=[],this.i=0}},re=12,x=new WeakMap,S=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ie=Object.create(null),C=class e{constructor(e,t,n,i=s.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||r.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&o(this.attrs,t||e.defaultAttrs||ie)&&s.sameSet(this.marks,n||s.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return l.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new l(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return ee(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return b.resolveCached(this,e)}resolveNoCache(e){return b.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),w(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=r.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=i;e<a;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=s.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!s.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let i=r.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};C.prototype.text=void 0;var ae=class e extends C{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):w(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function w(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var T=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new oe(t,n);if(r.next==null)return e.empty;let i=E(r);r.next&&r.err(`Unexpected trailing text`);let a=pe(fe(i));return me(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let c=o.matchFragment(e,n);if(c&&(!t||c.validEnd))return r.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&i.indexOf(n)==-1){i.push(n);let e=a(n,s.concat(t));if(e)return e}}return null}return a(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
2
2
|
`)}};T.empty=new T(!0);var oe=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function E(e){let t=[];do t.push(se(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function se(e){let t=[];do t.push(ce(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ce(e){let t=de(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=le(e,t);else break;return t}function D(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function le(e,t){let n=D(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:D(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function ue(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function de(e){if(e.eat(`(`)){let t=E(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=ue(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function fe(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function O(e,t){return t-e}function k(e,t){let n=[];return r(t),n.sort(O);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function pe(e){let t=Object.create(null);return n(k(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);k(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new T(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(O);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function me(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function A(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function j(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function M(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function N(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ge(e,r,t[r]);return n}var P=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=N(e,n.attrs),this.defaultAttrs=A(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==T.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:j(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new C(this,this.computeAttrs(e),r.from(t),s.setFrom(n))}createChecked(e=null,t,n){return t=r.from(t),this.checkContent(t),new C(this,this.computeAttrs(e),t,s.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=r.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let i=this.contentMatch.matchFragment(t),a=i&&i.fillBefore(r.empty,!0);return a?new C(this,e,t.append(a),s.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){M(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:s.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function he(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var ge=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?he(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},F=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=N(e,r.attrs),this.excluded=null;let i=A(this.attrs);this.instance=i?new s(this,i):null}create(e=null){return!e&&this.instance?this.instance:new s(this,j(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){M(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},_e=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let e in t)n[e]=t[e];n.nodes=e.from(t.nodes),n.marks=e.from(t.marks||{}),this.nodes=P.compile(this.spec.nodes,this),this.marks=F.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],n=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=T.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?I(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:I(this,n.split(` `))}this.nodeFromJSON=e=>C.fromJSON(this,e),this.markFromJSON=e=>s.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof P))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ae(n,n.defaultAttrs,e,s.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function I(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ve(e){return e.tag!=null}function ye(e){return e.style!=null}var be=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ve(e))this.tags.push(e);else if(ye(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new W(this,t,!1);return n.addAll(e,s.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new W(this,t,!0);return n.addAll(e,s.none,t.from,t.to),l.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Ce(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=G(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=G(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},L={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},xe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},R={ol:!0,ul:!0},z=1,B=2,V=4;function H(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?z:0)|(t===`full`?B:0)}var U=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=s.none,this.match=i||(a&V?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(r.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&z)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=r.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(r.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!L.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},W=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=H(null,t.preserveWhitespace,0)|(n?V:0);i=r?new U(r.type,r.attrs,s.none,!0,t.topMatch||r.type.contentMatch,a):n?new U(null,null,s.none,!0,null,a):new U(e.schema.topNodeType,null,s.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&B?`full`:this.localPreserveWS||(r.options&z)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;R.hasOwnProperty(a)&&this.parser.normalizeLists&&Se(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:xe.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(L.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
-
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node){if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=s.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):K(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=H(e,i,a.options);a.options&V&&a.content.length==0&&(o|=V);let c=s.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):K(t.type,e))||(c=t.addToSet(c),!1)),this.nodes.push(new U(e,t,c,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=z);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Se(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&R.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Ce(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function G(e){let t={};for(let n in e)t[n]=e[n];return t}function K(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var we=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=J(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=X(J(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&X(J(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return X(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=q(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return q(e.marks)}};function q(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function J(e){return e.document||window.document}var Y=new WeakMap;function Te(e){let t=Y.get(e);return t===void 0&&Y.set(e,t=Ee(e)),t}function Ee(e){let t=null;function n(e){if(e&&typeof e==`object`){if(Array.isArray(e)){if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t])}else for(let t in e)n(e[t])}}return n(e),t}function X(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Te(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}{let{dom:t,contentDOM:i}=X(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var De=Symbol(`rte-internal-impl`),Oe=e=>e.sort((e,t)=>{let n=e.priority-t.priority;return n===0?e.featureName===t.featureName?0:e.featureName>t.featureName?1:-1:n}).map(e=>e.value),Z={highest:-20,high:-10,default:0,low:10,lowest:20},ke=class{},Ae=class{contribution(e,t){return{featureName:this.name,priority:t??Z.default,value:e}}getStyles(){return[]}getSchema(e,t){return[]}getTextblockAttrs(){return[]}getTextblockMarks(){return[]}getPlugins(e){return[]}getToolbarItems(e){return[]}getInputRules(e){return[]}getFeatures(){return[this]}getPublicInterface(e){}},Q=new WeakMap,$=e=>Q.get(e),je=e=>{class t extends ke{constructor(...t){super(),Q.set(this,new e(...t))}}return t},Me=Symbol.for(`slottable-request-remove`);function Ne(e,t,n,r){let i=new CustomEvent(`slottable-request`,{bubbles:!1,composed:!1,detail:{name:t,slotName:n,data:r}});Object.defineProperties(i,{name:{value:t,enumerable:!0},slotName:{value:n,enumerable:!0},data:{value:r,enumerable:!0}}),e.dispatchEvent(i)}Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return l}});
|
|
4
|
+
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node){if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=s.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):K(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=H(e,i,a.options);a.options&V&&a.content.length==0&&(o|=V);let c=s.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):K(t.type,e))||(c=t.addToSet(c),!1)),this.nodes.push(new U(e,t,c,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=z);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Se(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&R.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Ce(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function G(e){let t={};for(let n in e)t[n]=e[n];return t}function K(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var we=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=J(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name])a++;else{if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=X(J(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&X(J(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return X(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=q(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return q(e.marks)}};function q(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function J(e){return e.document||window.document}var Y=new WeakMap;function Te(e){let t=Y.get(e);return t===void 0&&Y.set(e,t=Ee(e)),t}function Ee(e){let t=null;function n(e){if(e&&typeof e==`object`){if(Array.isArray(e)){if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t])}else for(let t in e)n(e[t])}}return n(e),t}function X(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Te(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}{let{dom:t,contentDOM:i}=X(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var De=Symbol(`rte-internal-impl`),Oe=e=>e.sort((e,t)=>{let n=e.priority-t.priority;return n===0?e.featureName===t.featureName?0:e.featureName>t.featureName?1:-1:n}).map(e=>e.value),Z={highest:-20,high:-10,default:0,low:10,lowest:20},ke=class{},Ae=class{contribution(e,t){return{featureName:this.name,priority:t??Z.default,value:e}}getStyles(){return[]}getSchema(e,t){return[]}getTextblockAttrs(){return[]}getTextblockMarks(){return[]}getPlugins(e){return[]}getToolbarItems(e){return[]}getInputRules(e){return[]}getFeatures(){return[this]}getPublicInterface(e){}},Q=new WeakMap,$=e=>Q.get(e),je=e=>{class t extends ke{constructor(...t){super(),Q.set(this,new e(...t))}}return t},Me=Symbol.for(`slottable-request-remove`);function Ne(e,t,n,r){let i=new CustomEvent(`slottable-request`,{bubbles:!1,composed:!1,detail:{name:t,slotName:n,data:r}});Object.defineProperties(i,{name:{value:t,enumerable:!0},slotName:{value:n,enumerable:!0},data:{value:r,enumerable:!0}}),e.dispatchEvent(i)}Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return l}});
|
|
@@ -69,20 +69,19 @@ function t(e, n, r) {
|
|
|
69
69
|
for (let i = 0;; i++) {
|
|
70
70
|
if (i == e.childCount || i == n.childCount) return e.childCount == n.childCount ? null : r;
|
|
71
71
|
let a = e.child(i), o = n.child(i);
|
|
72
|
-
if (a == o)
|
|
72
|
+
if (a == o) r += a.nodeSize;
|
|
73
|
+
else {
|
|
74
|
+
if (!a.sameMarkup(o)) return r;
|
|
75
|
+
if (a.isText && a.text != o.text) {
|
|
76
|
+
for (let e = 0; a.text[e] == o.text[e]; e++) r++;
|
|
77
|
+
return r;
|
|
78
|
+
}
|
|
79
|
+
if (a.content.size || o.content.size) {
|
|
80
|
+
let e = t(a.content, o.content, r + 1);
|
|
81
|
+
if (e != null) return e;
|
|
82
|
+
}
|
|
73
83
|
r += a.nodeSize;
|
|
74
|
-
continue;
|
|
75
84
|
}
|
|
76
|
-
if (!a.sameMarkup(o)) return r;
|
|
77
|
-
if (a.isText && a.text != o.text) {
|
|
78
|
-
for (let e = 0; a.text[e] == o.text[e]; e++) r++;
|
|
79
|
-
return r;
|
|
80
|
-
}
|
|
81
|
-
if (a.content.size || o.content.size) {
|
|
82
|
-
let e = t(a.content, o.content, r + 1);
|
|
83
|
-
if (e != null) return e;
|
|
84
|
-
}
|
|
85
|
-
r += a.nodeSize;
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
function n(e, t, r, i) {
|
|
@@ -92,27 +91,26 @@ function n(e, t, r, i) {
|
|
|
92
91
|
b: i
|
|
93
92
|
};
|
|
94
93
|
let s = e.child(--a), c = t.child(--o), l = s.nodeSize;
|
|
95
|
-
if (s == c)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
if (!s.sameMarkup(c)) return {
|
|
100
|
-
a: r,
|
|
101
|
-
b: i
|
|
102
|
-
};
|
|
103
|
-
if (s.isText && s.text != c.text) {
|
|
104
|
-
let e = 0, t = Math.min(s.text.length, c.text.length);
|
|
105
|
-
for (; e < t && s.text[s.text.length - e - 1] == c.text[c.text.length - e - 1];) e++, r--, i--;
|
|
106
|
-
return {
|
|
94
|
+
if (s == c) r -= l, i -= l;
|
|
95
|
+
else {
|
|
96
|
+
if (!s.sameMarkup(c)) return {
|
|
107
97
|
a: r,
|
|
108
98
|
b: i
|
|
109
99
|
};
|
|
100
|
+
if (s.isText && s.text != c.text) {
|
|
101
|
+
let e = 0, t = Math.min(s.text.length, c.text.length);
|
|
102
|
+
for (; e < t && s.text[s.text.length - e - 1] == c.text[c.text.length - e - 1];) e++, r--, i--;
|
|
103
|
+
return {
|
|
104
|
+
a: r,
|
|
105
|
+
b: i
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (s.content.size || c.content.size) {
|
|
109
|
+
let e = n(s.content, c.content, r - 1, i - 1);
|
|
110
|
+
if (e) return e;
|
|
111
|
+
}
|
|
112
|
+
r -= l, i -= l;
|
|
110
113
|
}
|
|
111
|
-
if (s.content.size || c.content.size) {
|
|
112
|
-
let e = n(s.content, c.content, r - 1, i - 1);
|
|
113
|
-
if (e) return e;
|
|
114
|
-
}
|
|
115
|
-
r -= l, i -= l;
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
var r = class e {
|
|
@@ -1721,12 +1719,11 @@ var we = class e {
|
|
|
1721
1719
|
let n = 0, a = 0;
|
|
1722
1720
|
for (; n < i.length && a < e.marks.length;) {
|
|
1723
1721
|
let t = e.marks[a];
|
|
1724
|
-
if (!this.marks[t.type.name])
|
|
1725
|
-
|
|
1726
|
-
|
|
1722
|
+
if (!this.marks[t.type.name]) a++;
|
|
1723
|
+
else {
|
|
1724
|
+
if (!t.eq(i[n][0]) || t.type.spec.spanning === !1) break;
|
|
1725
|
+
n++, a++;
|
|
1727
1726
|
}
|
|
1728
|
-
if (!t.eq(i[n][0]) || t.type.spec.spanning === !1) break;
|
|
1729
|
-
n++, a++;
|
|
1730
1727
|
}
|
|
1731
1728
|
for (; n < i.length;) r = i.pop()[1];
|
|
1732
1729
|
for (; a < e.marks.length;) {
|
package/bundled/text-field.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return`.label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}:host{display:inline-block}.base{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_text-field-border-radius:8px;--_text-field-pill-border-radius:24px;grid-template-columns:min-content 1fr max-content;align-items:center;gap:4px;width:100%;display:inline-grid}.base.size-condensed{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_text-field-border-radius:4px}.base{user-select:none}.base:not(.disabled){--_low-ink-color:var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color:var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){font:var(--vvd-typography-base);grid-area:1/1/auto/4;box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.label-wrapper{grid-area:1/1/auto/4}.char-count+.label-wrapper{grid-column:1/3}.fieldset{background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;align-items:center;padding-block:0;transition:color .2s,background-color .2s;display:flex;position:relative}.fieldset:after{border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:"";pointer-events:none;inline-size:100%;transition:box-shadow .2s;display:block;position:absolute}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){font:inherit;text-align:inherit;outline:#0000;box-sizing:border-box!important;border-radius:inherit!important;width:100%!important;margin:initial!important;appearance:none!important;block-size:100%!important;color:inherit!important;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;background-color:#0000!important;border:0!important}.control:not(slot,:focus),.control::slotted(input:not(:focus)){text-overflow:ellipsis!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control::slotted(input:autofill),.control:not(slot):autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);line-height:1;position:absolute;inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .wrapper:focus-within:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;z-index:1;border-radius:inherit;content:"";pointer-events:none;display:block;position:absolute;inset:0}}:host([internal-part]) .fieldset{font:var(--vvd-typography-heading-4);background-color:#0000;line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}`}});
|
|
1
|
+
Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return`.label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}:host{display:inline-block}.base{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_text-field-border-radius:8px;--_text-field-pill-border-radius:24px;grid-template-columns:min-content 1fr max-content;align-items:center;gap:4px;width:100%;display:inline-grid}.base.size-condensed{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_text-field-border-radius:4px}.base{user-select:none}.base:not(.disabled){--_low-ink-color:var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color:var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){font:var(--vvd-typography-base);grid-area:1/1/auto/4;box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.label-wrapper{grid-area:1/1/auto/4}.char-count+.label-wrapper{grid-column:1/3}.fieldset{background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);max-inline-size:var(--text-field-input-inline-size,auto);grid-column:1/4;align-items:center;padding-block:0;transition:color .2s,background-color .2s;display:flex;position:relative}.fieldset:after{border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:"";pointer-events:none;inline-size:100%;transition:box-shadow .2s;display:block;position:absolute}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){font:inherit;text-align:inherit;outline:#0000;box-sizing:border-box!important;border-radius:inherit!important;width:100%!important;margin:initial!important;appearance:none!important;block-size:100%!important;color:inherit!important;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;background-color:#0000!important;border:0!important}.control:not(slot,:focus),.control::slotted(input:not(:focus)){text-overflow:ellipsis!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control::slotted(input:autofill),.control:not(slot):autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);line-height:1;position:absolute;inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .wrapper:focus-within:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;z-index:1;border-radius:inherit;content:"";pointer-events:none;display:block;position:absolute;inset:0}}:host([internal-part]) .fieldset{font:var(--vvd-typography-heading-4);background-color:#0000;line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}`}});
|
package/bundled/text-field.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/lib/text-field/text-field.scss?inline
|
|
2
|
-
var e = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}:host{display:inline-block}.base{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_text-field-border-radius:8px;--_text-field-pill-border-radius:24px;grid-template-columns:min-content 1fr max-content;align-items:center;gap:4px;width:100%;display:inline-grid}.base.size-condensed{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_text-field-border-radius:4px}.base{user-select:none}.base:not(.disabled){--_low-ink-color:var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color:var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){font:var(--vvd-typography-base);grid-area:1/1/auto/4;box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.label-wrapper{grid-area:1/1/auto/4}.char-count+.label-wrapper{grid-column:1/3}.fieldset{background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;align-items:center;padding-block:0;transition:color .2s,background-color .2s;display:flex;position:relative}.fieldset:after{border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";pointer-events:none;inline-size:100%;transition:box-shadow .2s;display:block;position:absolute}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){font:inherit;text-align:inherit;outline:#0000;box-sizing:border-box!important;border-radius:inherit!important;width:100%!important;margin:initial!important;appearance:none!important;block-size:100%!important;color:inherit!important;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;background-color:#0000!important;border:0!important}.control:not(slot,:focus),.control::slotted(input:not(:focus)){text-overflow:ellipsis!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control::slotted(input:autofill),.control:not(slot):autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);line-height:1;position:absolute;inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .wrapper:focus-within:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}}:host([internal-part]) .fieldset{font:var(--vvd-typography-heading-4);background-color:#0000;line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}";
|
|
2
|
+
var e = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}:host{display:inline-block}.base{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_text-field-border-radius:8px;--_text-field-pill-border-radius:24px;grid-template-columns:min-content 1fr max-content;align-items:center;gap:4px;width:100%;display:inline-grid}.base.size-condensed{--_text-field-gutter-start:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-gutter-end:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_text-field-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);--_text-field-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_text-field-border-radius:4px}.base{user-select:none}.base:not(.disabled){--_low-ink-color:var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color:var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){font:var(--vvd-typography-base);grid-area:1/1/auto/4;box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.label-wrapper{grid-area:1/1/auto/4}.char-count+.label-wrapper{grid-column:1/3}.fieldset{background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);max-inline-size:var(--text-field-input-inline-size,auto);grid-column:1/4;align-items:center;padding-block:0;transition:color .2s,background-color .2s;display:flex;position:relative}.fieldset:after{border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";pointer-events:none;inline-size:100%;transition:box-shadow .2s;display:block;position:absolute}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){font:inherit;text-align:inherit;outline:#0000;box-sizing:border-box!important;border-radius:inherit!important;width:100%!important;margin:initial!important;appearance:none!important;block-size:100%!important;color:inherit!important;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;background-color:#0000!important;border:0!important}.control:not(slot,:focus),.control::slotted(input:not(:focus)){text-overflow:ellipsis!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control::slotted(input:autofill),.control:not(slot):autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);line-height:1;position:absolute;inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .wrapper:focus-within:after{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}}:host([internal-part]) .fieldset{font:var(--vvd-typography-heading-4);background-color:#0000;line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./localized.cjs"),t=require("./vivid-element.cjs"),n=require("./repeat.cjs"),r=require("./ref.cjs"),i=require("./when.cjs"),a=require("./decorate.cjs"),o=require("./class-names.cjs"),s=require("./picker-field.template.cjs"),c=require("./scrollIntoView.cjs"),l=require("./trapped-focus.cjs"),u=require("./single-value-picker.cjs");var d=e=>{let t=e.split(`:`);if(t.length!==3)return!1;let[n,r,i]=t;if(n.length!==2||r.length!==2||i.length!==2)return!1;let a=parseInt(n,10),o=parseInt(r,10),s=parseInt(i,10);return!(isNaN(a)||isNaN(o)||isNaN(s)||a<0||a>23||o<0||o>59||s<0||s>59)},f=e=>Number.parseInt(e,10),p=e=>e.toString().padStart(2,`0`),m=e=>{let[t,n,r]=e.split(`:`),i=f(t);return{hourStr:t,hours:i,minuteStr:n,minutes:f(n),secondStr:r,seconds:f(r),meridiem:i<12?`AM`:`PM`}},h=(e,t)=>e>t?1:e<t?-1:0,g=e=>e%12||12,_=(e,t)=>e===`AM`&&t<12||e===`PM`&&t>=12,v=(e,t,n)=>{let r=[],i=e?m(e).hours:0,a=t?m(t).hours:23;for(let e=i;e<=a;e++)n
|
|
1
|
+
const e=require("./localized.cjs"),t=require("./vivid-element.cjs"),n=require("./repeat.cjs"),r=require("./ref.cjs"),i=require("./when.cjs"),a=require("./decorate.cjs"),o=require("./class-names.cjs"),s=require("./picker-field.template.cjs"),c=require("./scrollIntoView.cjs"),l=require("./trapped-focus.cjs"),u=require("./single-value-picker.cjs");var d=e=>{let t=e.split(`:`);if(t.length!==3)return!1;let[n,r,i]=t;if(n.length!==2||r.length!==2||i.length!==2)return!1;let a=parseInt(n,10),o=parseInt(r,10),s=parseInt(i,10);return!(isNaN(a)||isNaN(o)||isNaN(s)||a<0||a>23||o<0||o>59||s<0||s>59)},f=e=>Number.parseInt(e,10),p=e=>e.toString().padStart(2,`0`),m=e=>{let[t,n,r]=e.split(`:`),i=f(t);return{hourStr:t,hours:i,minuteStr:n,minutes:f(n),secondStr:r,seconds:f(r),meridiem:i<12?`AM`:`PM`}},h=(e,t)=>e>t?1:e<t?-1:0,g=e=>e%12||12,_=(e,t)=>e===`AM`&&t<12||e===`PM`&&t>=12,v=(e,t,n)=>{let r=[],i=e?m(e).hours:0,a=t?m(t).hours:23;for(let e=i;e<=a;e++)(!n||_(n,e))&&r.push({value:p(e),label:p(n?g(e):e)});return r},y=(e,t,n,r)=>{let i=[],a=0,o=59;if(n){let{hourStr:e,minutes:r}=m(n);t&&m(t).hourStr===e&&(a=r)}if(r){let{hourStr:e,minutes:n}=m(r);t&&m(t).hourStr===e&&(o=n)}for(let t=a;t<=o;t+=Math.max(1,e??1)){let e=p(t);i.push({value:e,label:e})}return i},b=(e,t,n,r)=>{let i=[],a=0,o=59;if(n){let e=m(n);t&&(m(t).hourStr===e.hourStr&&m(t).minuteStr)===e.minuteStr&&(a=e.seconds)}if(r){let e=m(r);t&&(m(t).hourStr===e.hourStr&&m(t).minuteStr)===e.minuteStr&&(o=e.seconds)}for(let t=a;t<=o;t+=Math.max(1,e)){let e=p(t);i.push({value:e,label:e})}return i},x=(e,t)=>{let n=[];return e&&m(e).meridiem===`PM`||n.push({value:`AM`,label:`AM`}),t&&m(t).meridiem===`AM`||n.push({value:`PM`,label:`PM`}),n},S={id:`hours`,getLabel:e=>e.locale.timePicker.hoursLabel,getOptions:e=>v(e.min,e.max,e.clock===`12h`?T.getSelectedOptionValue(e)??T.getOptions(e)[0].value:void 0),getSelectedOptionValue:e=>e.value?m(e.value).hourStr:void 0,updatedValue:(e,t)=>{if(e.value){let{minuteStr:n,secondStr:r}=m(e.value);return`${t}:${n}:${r}`}return`${t}:00:00`}},C={id:`minutes`,getLabel:e=>e.locale.timePicker.minutesLabel,getOptions:e=>y(e.minutesStep,e.value,e.min,e.max),getSelectedOptionValue:e=>e.value?m(e.value).minuteStr:void 0,updatedValue:(e,t)=>{if(e.value){let{hourStr:n,secondStr:r}=m(e.value);return`${n}:${t}:${r}`}return`00:${t}:00`}},w={id:`seconds`,getLabel:e=>e.locale.timePicker.secondsLabel,getOptions:e=>b(e.secondsStep,e.value,e.min,e.max),getSelectedOptionValue:e=>e.value?m(e.value).secondStr:void 0,updatedValue:(e,t)=>{if(e.value){let{hourStr:n,minuteStr:r}=m(e.value);return`${n}:${r}:${t}`}return`00:00:${t}`}},T={id:`meridies`,getLabel:e=>e.locale.timePicker.meridiesLabel,getOptions:e=>x(e.min,e.max),getSelectedOptionValue:e=>e.value?m(e.value).meridiem:void 0,updatedValue:(e,t)=>{if(e.value){let{hours:n,minuteStr:r,secondStr:i}=m(e.value),a=n;return t===`AM`&&n>=12?a-=12:t===`PM`&&n<12&&(a+=12),`${p(a)}:${r}:${i}`}return t===`AM`?`00:00:00`:`12:00:00`}},E=e=>e.secondsStep!==void 0,D=e=>e.clock===`12h`,O=(e,t,n)=>{M(e,t.updatedValue(e,n)),A(e,t.id,n,`start`);let r=(e.shadowRoot.querySelector(`#${t.id}`)?.closest(`.picker-wrapper`)?.nextElementSibling)?.querySelector(`.picker`);r?r.focus():e.$emit(`last-column-selected`,void 0,{bubbles:!1})},k=(e,t,n)=>{let r=t.getOptions(e),i=t.getSelectedOptionValue(e),a={ArrowUp:-1,ArrowDown:1}[n.key];if(a){n.preventDefault();let o=r.findIndex(e=>e.value===i),s=r[((o===-1?0:o+a)+r.length)%r.length].value;M(e,t.updatedValue(e,s)),A(e,t.id,s,`nearest`),e._clearFocusedClasses()}return!0},A=(e,t,n,r)=>{let i=e.shadowRoot.querySelector(`#${t}-${n}`);i&&c.t(i,i.parentElement,r)},j=(e,t)=>{if(t.key===`Tab`){let n=e.shadowRoot.querySelectorAll(`.picker`),r=t.shiftKey?n[0]:n[n.length-1];e.shadowRoot.activeElement!==r&&l.n(t),e._applyFocusedClass()}return!0},M=(e,t)=>{e.$emit(`change`,t,{bubbles:!1,composed:!1})},N=e=>t.p`<div class="picker-wrapper">
|
|
2
2
|
<ul
|
|
3
3
|
id="${e.id}"
|
|
4
4
|
class="picker"
|
|
@@ -30,7 +30,7 @@ var x = (e) => {
|
|
|
30
30
|
};
|
|
31
31
|
}, T = (e, t) => e > t ? 1 : e < t ? -1 : 0, E = (e) => e % 12 || 12, D = (e, t) => e === "AM" && t < 12 || e === "PM" && t >= 12, O = (e, t, n) => {
|
|
32
32
|
let r = [], i = e ? w(e).hours : 0, a = t ? w(t).hours : 23;
|
|
33
|
-
for (let e = i; e <= a; e++) n
|
|
33
|
+
for (let e = i; e <= a; e++) (!n || D(n, e)) && r.push({
|
|
34
34
|
value: C(e),
|
|
35
35
|
label: C(n ? E(e) : e)
|
|
36
36
|
});
|