CoreFiles by mySites.guru
codemirror-search.min.js2 lines, 21,698 bytes, from Joomla_6.2.0-Stable-Full_Package.zip
Raw History Compare with 6.1.4
md5
1147f59d31065a71053998d3384213ba
sha1
5ab36a5cda409f0258853a3367d50ba5429e77b2
sha256
b3c34c1be3b264596e21a82b078646f06b897ecdb88309fd15a54a0b3d5db16f
import{getPanel as Y,getDialog as ye,showDialog as Se,EditorView as y,showPanel as Me,ViewPlugin as Z,Decoration as f,runScopeHandlers as ve}from"@codemirror/view";import{codePointAt as Ce,fromCodePoint as be,codePointSize as ke,EditorState as Le,EditorSelection as m,StateEffect as O,StateField as We,Facet as ee,combineConfig as te,Prec as Ae,CharCategory as p,RangeSetBuilder as Ee,findClusterBreak as re}from"@codemirror/state";function g(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];typeof i=="string"?r.setAttribute(n,i):i!=null&&(r[n]=i)}e++}for(;e<arguments.length;e++)ne(r,arguments[e]);return r}function ne(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)ne(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}const ie=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class S{constructor(e,t,n=0,i=e.length,s,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?o=>s(ie(o)):ie,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ce(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=be(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ke(e);let i=this.normalize(t);if(i.length)for(let s=0,l=n,o=!0;;s++){let c=i.charCodeAt(s),a=this.match(c,l,o,this.bufferPos+this.bufferStart,s==i.length-1);if(a)return this.value=a,this;if(s==i.length-1)break;o&&s<t.length&&t.charCodeAt(s)==c?l++:o=!1}}}match(e,t,n,i,s){let l=null;for(let o=0;o<this.matches.length;){let c=this.matches[o],a=!1;this.query.charCodeAt(c.index)==e&&(c.index==this.query.length-1?l={from:c.from,to:i,precise:s&&c.precise}:(c.index++,a=!0)),a?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:t,to:i,precise:n&&s}:this.matches.push({from:t,index:1,precise:n})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(S.prototype[Symbol.iterator]=function(){return this});const se={from:-1,to:-1,match:/.*/.exec(""),precise:!0},$="gm"+(/x/.unicode==null?"":"u");class Q{constructor(e,t,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=se,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new le(e,t,n,i,s);this.re=new RegExp(t,$+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let l=e.lineAt(i);this.curLineStart=l.from,this.matchPos=D(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=D(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const _=new WeakMap;class k{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=_.get(e);if(!i||i.from>=n||i.to<=t){let o=new k(t,e.sliceString(t,n));return _.set(e,o),o}if(i.from==t&&i.to==n)return i;let{text:s,from:l}=i;return l>t&&(s=e.sliceString(t,l)+s,l=t),i.to<n&&(s+=e.sliceString(i.to,n)),_.set(e,new k(l,s)),new k(t,s.slice(t-l,n-l))}}class le{constructor(e,t,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=se,this.matchPos=D(e,i),this.re=new RegExp(t,$+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=k.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,i=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,precise:!0,match:t},this.matchPos=D(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=k.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Q.prototype[Symbol.iterator]=le.prototype[Symbol.iterator]=function(){return this});function Fe(r){try{return new RegExp(r,$),!0}catch{return!1}}function D(r,e){if(e>=r.length)return e;let t=r.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}const oe=r=>{let e=ye(r,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:t}=r,n=String(t.doc.lineAt(r.state.selection.main.head).number),{close:i,result:s}=Se(r,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return s.then(l=>{let o=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!o){r.dispatch({effects:i});return}let c=t.doc.lineAt(t.selection.main.head),[,a,h,u,F]=o,xe=u?+u.slice(1):0,L=h?+h:c.number;if(h&&F){let I=L/100;a&&(I=I*(a=="-"?-1:1)+c.number/t.doc.lines),L=Math.round(t.doc.lines*I)}else h&&a&&(L=L*(a=="-"?-1:1)+c.number);let J=t.doc.line(Math.max(1,Math.min(t.doc.lines,L))),X=m.cursor(J.from+Math.max(0,Math.min(xe,J.length)));r.dispatch({effects:[i,y.scrollIntoView(X.from,{y:"center"})],selection:X})}),!0},De={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ce=ee.define({combine(r){return te(r,De,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Re(r){let e=[Ie,Te];return r&&e.push(ce.of(r)),e}const qe=f.mark({class:"cm-selectionMatch"}),we=f.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ae(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=p.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=p.Word)}function Pe(r,e,t,n){return r(e.sliceDoc(t,t+1))==p.Word&&r(e.sliceDoc(n-1,n))==p.Word}const Te=Z.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.selectionSet||r.docChanged||r.viewportChanged)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=r.state.facet(ce),{state:t}=r,n=t.selection;if(n.ranges.length>1)return f.none;let i=n.main,s,l=null;if(i.empty){if(!e.highlightWordAroundCursor)return f.none;let c=t.wordAt(i.head);if(!c)return f.none;l=t.charCategorizer(i.head),s=t.sliceDoc(c.from,c.to)}else{let c=i.to-i.from;if(c<e.minSelectionLength||c>200)return f.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),l=t.charCategorizer(i.head),!(ae(l,t,i.from,i.to)&&Pe(l,t,i.from,i.to)))return f.none}else if(s=t.sliceDoc(i.from,i.to),!s)return f.none}let o=[];for(let c of r.visibleRanges){let a=new S(t.doc,s,c.from,c.to);for(;!a.next().done;){let{from:h,to:u}=a.value;if((!l||ae(l,t,h,u))&&(i.empty&&h<=i.from&&u>=i.to?o.push(we.range(h,u)):(h>=i.to||u<=i.from)&&o.push(qe.range(h,u)),o.length>e.maxMatches))return f.none}}return f.set(o)}},{decorations:r=>r.decorations}),Ie=y.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Oe=({state:r,dispatch:e})=>{let{selection:t}=r,n=m.create(t.ranges.map(i=>r.wordAt(i.head)||m.cursor(i.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function $e(r,e){let{main:t,ranges:n}=r.selection,i=r.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let l=!1,o=new S(r.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new S(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),l=!0}else{if(l&&n.some(c=>c.from==o.value.from))continue;if(s){let c=r.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const he=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return Oe({state:r,dispatch:e});let n=r.sliceDoc(t[0].from,t[0].to);if(r.selection.ranges.some(s=>r.sliceDoc(s.from,s.to)!=n))return!1;let i=$e(r,n);return i?(e(r.update({selection:r.selection.addRange(m.range(i.from,i.to),!1),effects:y.scrollIntoView(i.to)})),!0):!1},M=ee.define({combine(r){return te(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ye(e),scrollToMatch:e=>y.scrollIntoView(e)})}});function Qe(r){return r?[M.of(r),U]:U}class N{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Fe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
`:n=="r"?"\r":n=="t"?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new He(this):new ze(this)}getCursor(e,t=0,n){let i=e.doc?e:Le.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?C(this,i,t,n):v(this,i,t,n)}}class ue{constructor(e){this.spec=e}}function _e(r,e,t){return(n,i,s,l)=>{if(t&&!t(n,i,s,l))return!1;let o=n>=l&&i<=l+s.length?s.slice(n-l,i-l):e.doc.sliceString(n,i);return r(o,e,n,i)}}function v(r,e,t,n){let i;return r.wholeWord&&(i=Ne(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(i=_e(r.test,e,i)),new S(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:s=>s.toLowerCase(),i)}function Ne(r,e){return(t,n,i,s)=>((s>t||s+i.length<n)&&(s=Math.max(0,t-2),i=r.sliceString(s,Math.min(r.length,n+2))),(e(R(i,t-s))!=p.Word||e(q(i,t-s))!=p.Word)&&(e(q(i,n-s))!=p.Word||e(R(i,n-s))!=p.Word))}class ze extends ue{constructor(e){super(e)}nextMatch(e,t,n){let i=v(this.spec,e,n,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=v(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==n?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),l=v(this.spec,e,s,i),o=null;for(;!l.nextOverlapping().done;)o=l.value;if(o)return o;if(s==t)return null;i-=1e4}}prevMatch(e,t,n){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=n)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=v(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=v(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function Be(r,e,t){return(n,i,s)=>(!t||t(n,i,s))&&r(s[0],e,n,i)}function C(r,e,t,n){let i;return r.wholeWord&&(i=Ve(e.charCategorizer(e.selection.main.head))),r.test&&(i=Be(r.test,e,i)),new Q(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:i},t,n)}function R(r,e){return r.slice(re(r,e,!1),e)}function q(r,e){return r.slice(e,re(r,e))}function Ve(r){return(e,t,n)=>!n[0].length||(r(R(n.input,n.index))!=p.Word||r(q(n.input,n.index))!=p.Word)&&(r(q(n.input,n.index+n[0].length))!=p.Word||r(R(n.input,n.index+n[0].length))!=p.Word)}class He extends ue{nextMatch(e,t,n){let i=C(this.spec,e,n,e.doc.length).next();return i.done&&(i=C(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),l=C(this.spec,e,s,n),o=null;for(;!l.next().done;)o=l.value;if(o&&(s==t||o.from>s+10))return o;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+n.slice(i)}return t})}matchAll(e,t){let n=C(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=C(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const b=O.define(),z=O.define(),x=We.define({create(r){return new B(w(r).create(),null)},update(r,e){for(let t of e.effects)t.is(b)?r=new B(t.value.create(),r.panel):t.is(z)&&(r=new B(r.query,t.value?H:null));return r},provide:r=>Me.from(r,e=>e.panel)});function Ke(r){let e=r.field(x,!1);return e?e.query.spec:w(r)}function je(r){var e;return((e=r.field(x,!1))===null||e===void 0?void 0:e.panel)!=null}class B{constructor(e,t){this.query=e,this.panel=t}}const Ge=f.mark({class:"cm-searchMatch"}),Ue=f.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Je=Z.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(x))}update(r){let e=r.state.field(x);(e!=r.startState.field(x)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return f.none;let{view:t}=this,n=new Ee;for(let i=0,s=t.visibleRanges,l=s.length;i<l;i++){let{from:o,to:c}=s[i];for(;i<l-1&&c>s[i+1].from-500;)c=s[++i].to;r.highlight(t.state,o,c,(a,h)=>{let u=t.state.selection.ranges.some(F=>F.from==a&&F.to==h);n.add(a,h,u?Ue:Ge)})}return n.finish()}},{decorations:r=>r.decorations});function W(r){return e=>{let t=e.state.field(x,!1);return t&&t.query.spec.valid?r(e,t):K(e)}}const A=W((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=m.single(n.from,n.to),s=r.state.facet(M);return r.dispatch({selection:i,effects:[G(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),me(r),!0}),E=W((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(!i)return!1;let s=m.single(i.from,i.to),l=r.state.facet(M);return r.dispatch({selection:s,effects:[G(r,i),l.scrollToMatch(s.main,r)],userEvent:"select.search"}),me(r),!0}),fe=W((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:m.create(t.map(n=>m.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),de=({state:r,dispatch:e})=>{let t=r.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:i}=t.main,s=[],l=0;for(let o=new S(r.doc,r.sliceDoc(n,i));!o.next().done;){if(s.length>1e3)return!1;o.value.from==n&&(l=s.length),s.push(m.range(o.value.from,o.value.to))}return e(r.update({selection:m.create(s,l),userEvent:"select.search.matches"})),!0},V=W((r,{query:e})=>{let{state:t}=r,{from:n,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let l=s,o=[],c,a,h=[];l.precise?l.from==n&&l.to==i&&(a=t.toText(e.getReplacement(l)),o.push({from:l.from,to:l.to,insert:a}),l=e.nextMatch(t,l.from,l.to),h.push(y.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))):l=e.nextMatch(t,l.from,l.to);let u=r.state.changes(o);return l&&(c=m.single(l.from,l.to).map(u),h.push(G(r,l)),h.push(t.facet(M).scrollToMatch(c.main,r))),r.dispatch({changes:u,selection:c,effects:h,userEvent:"input.replace"}),!0}),pe=W((r,{query:e})=>{if(r.state.readOnly)return!1;let t=[];for(let i of e.matchAll(r.state,1e9)){let{from:s,to:l,precise:o}=i;o&&t.push({from:s,to:l,insert:e.getReplacement(i)})}if(!t.length)return!1;let n=r.state.phrase("replaced $ matches",t.length)+".";return r.dispatch({changes:t,effects:y.announce.of(n),userEvent:"input.replace.all"}),!0});function H(r){return r.state.facet(M).createPanel(r)}function w(r,e){var t,n,i,s,l;let o=r.selection.main,c=o.empty||o.to>o.from+100?"":r.sliceDoc(o.from,o.to);if(e&&!c)return e;let a=r.facet(M);return new N({search:((t=e?.literal)!==null&&t!==void 0?t:a.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:a.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:a.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:a.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:a.wholeWord})}function ge(r){let e=Y(r,H);return e&&e.dom.querySelector("[main-field]")}function me(r){let e=ge(r);e&&e==r.root.activeElement&&e.select()}const K=r=>{let e=r.state.field(x,!1);if(e&&e.panel){let t=ge(r);if(t&&t!=r.root.activeElement){let n=w(r.state,e.query.spec);n.valid&&r.dispatch({effects:b.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[z.of(!0),e?b.of(w(r.state,e.query.spec)):O.appendConfig.of(U)]});return!0},j=r=>{let e=r.state.field(x,!1);if(!e||!e.panel)return!1;let t=Y(r,H);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:z.of(!1)}),!0},Xe=[{key:"Mod-f",run:K,scope:"editor search-panel"},{key:"F3",run:A,shift:E,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:A,shift:E,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:j,scope:"editor search-panel"},{key:"Mod-Shift-l",run:de},{key:"Mod-Alt-g",run:oe},{key:"Mod-d",run:he,preventDefault:!0}];class Ye{constructor(e){this.view=e;let t=this.query=e.state.field(x).query.spec;this.commit=this.commit.bind(this),this.searchField=g("input",{value:t.search,placeholder:d(e,"Find"),"aria-label":d(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=g("input",{value:t.replace,placeholder:d(e,"Replace"),"aria-label":d(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=g("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=g("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=g("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(i,s,l){return g("button",{class:"cm-button",name:i,onclick:s,type:"button"},l)}this.dom=g("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>A(e),[d(e,"next")]),n("prev",()=>E(e),[d(e,"previous")]),n("select",()=>fe(e),[d(e,"all")]),g("label",null,[this.caseField,d(e,"match case")]),g("label",null,[this.reField,d(e,"regexp")]),g("label",null,[this.wordField,d(e,"by word")]),...e.state.readOnly?[]:[g("br"),this.replaceField,n("replace",()=>V(e),[d(e,"replace")]),n("replaceAll",()=>pe(e),[d(e,"replace all")])],g("button",{name:"close",onclick:()=>j(e),"aria-label":d(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new N({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:b.of(e)}))}keydown(e){ve(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?E:A)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),V(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(b)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(M).top}}function d(r,e){return r.state.phrase(e)}const P=30,T=/[\s\.,:;?!]/;function G(r,{from:e,to:t}){let n=r.state.doc.lineAt(e),i=r.state.doc.lineAt(t).to,s=Math.max(n.from,e-P),l=Math.min(i,t+P),o=r.state.sliceDoc(s,l);if(s!=n.from){for(let c=0;c<P;c++)if(!T.test(o[c+1])&&T.test(o[c])){o=o.slice(c);break}}if(l!=i){for(let c=o.length-1;c>o.length-P;c--)if(!T.test(o[c-1])&&T.test(o[c])){o=o.slice(0,c);break}}return y.announce.of(`${r.state.phrase("current match")}. ${o} ${r.state.phrase("on line")} ${n.number}.`)}const Ze=y.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),U=[x,Ae.low(Je),Ze];export{Q as RegExpCursor,S as SearchCursor,N as SearchQuery,j as closeSearchPanel,A as findNext,E as findPrevious,Ke as getSearchQuery,oe as gotoLine,Re as highlightSelectionMatches,K as openSearchPanel,pe as replaceAll,V as replaceNext,Qe as search,Xe as searchKeymap,je as searchPanelOpen,fe as selectMatches,he as selectNextOccurrence,de as selectSelectionMatches,b as setSearchQuery};

The same content is in 7 releases, Joomla 6.2.0-beta3 to 6.3.0-alpha1. See them all, or every version of this file.