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

The same content is in 23 releases, Joomla 6.1.0-beta1 to 6.2.0-beta2. See them all, or every version of this file.