/usr/share/grafana/public/app/plugins/datasource/loki/dist
/*! For license information please see module.js.LICENSE.txt */ /* [create-plugin] version: 5.22.0 */ define(["module","@grafana/data","@grafana/runtime","react","@emotion/css","lodash","@grafana/ui","rxjs","rxjs/operators","redux","react-dom","react-redux","prismjs"],((e,t,r,n,i,a,o,s,l,c,u,d,p)=>(()=>{var f,h,g={110:(e,t,r)=>{"use strict";const n=r(7715);e.exports=(e,t,r)=>n(e,t,"<",r)},122:e=>{"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},130:(e,t,r)=>{"use strict";const n=r(2839);e.exports=(e,t)=>{try{return new n(e,t).range||"*"}catch(e){return null}}},200:e=>{"use strict";e.exports=d},277:e=>{e.exports=function(e){return function(t){return e(t)}}},284:(e,t,r)=>{"use strict";const n=r(2839);e.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))},362:(e,t,r)=>{"use strict";const n=r(4708),i=r(4256),{safeRe:a,t:o}=r(5750);e.exports=(e,t)=>{if(e instanceof n)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?a[o.COERCERTLFULL]:a[o.COERCERTL];let i;for(;(i=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),n.lastIndex=i.index+i[1].length+i[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?a[o.COERCEFULL]:a[o.COERCE]);if(null===r)return null;const s=r[2],l=r[3]||"0",c=r[4]||"0",u=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return i(`${s}.${l}.${c}${u}${d}`,t)}},582:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},601:(e,t,r)=>{"use strict";r.d(t,{AW:()=>o,Ay:()=>l,RQ:()=>i,dZ:()=>n,fV:()=>a,vB:()=>s});const n=[{label:"avg",insertText:"avg",documentation:"Calculate the average over dimensions"},{label:"bottomk",insertText:"bottomk",documentation:"Smallest k elements by sample value"},{label:"count",insertText:"count",documentation:"Count number of elements in the vector"},{label:"max",insertText:"max",documentation:"Select maximum over dimensions"},{label:"min",insertText:"min",documentation:"Select minimum over dimensions"},{label:"stddev",insertText:"stddev",documentation:"Calculate population standard deviation over dimensions"},{label:"stdvar",insertText:"stdvar",documentation:"Calculate population standard variance over dimensions"},{label:"sum",insertText:"sum",documentation:"Calculate sum over dimensions"},{label:"topk",insertText:"topk",documentation:"Largest k elements by sample value"}],i=[{insertText:"avg_over_time",label:"avg_over_time",detail:"avg_over_time(range-vector)",documentation:"The average of all values in the specified interval."},{insertText:"bytes_over_time",label:"bytes_over_time",detail:"bytes_over_time(range-vector)",documentation:"Counts the amount of bytes used by each log stream for a given range"},{insertText:"bytes_rate",label:"bytes_rate",detail:"bytes_rate(range-vector)",documentation:"Calculates the number of bytes per second for each stream."},{insertText:"first_over_time",label:"first_over_time",detail:"first_over_time(range-vector)",documentation:"The first of all values in the specified interval. Only available in Loki 2.3+."},{insertText:"last_over_time",label:"last_over_time",detail:"last_over_time(range-vector)",documentation:"The last of all values in the specified interval. Only available in Loki 2.3+."},{insertText:"sum_over_time",label:"sum_over_time",detail:"sum_over_time(range-vector)",documentation:"The sum of all values in the specified interval."},{insertText:"count_over_time",label:"count_over_time",detail:"count_over_time(range-vector)",documentation:"The count of all values in the specified interval."},{insertText:"max_over_time",label:"max_over_time",detail:"max_over_time(range-vector)",documentation:"The maximum of all values in the specified interval."},{insertText:"min_over_time",label:"min_over_time",detail:"min_over_time(range-vector)",documentation:"The minimum of all values in the specified interval."},{insertText:"quantile_over_time",label:"quantile_over_time",detail:"quantile_over_time(scalar, range-vector)",documentation:"The φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval."},{insertText:"rate",label:"rate",detail:"rate(v range-vector)",documentation:"Calculates the number of entries per second."},{insertText:"stddev_over_time",label:"stddev_over_time",detail:"stddev_over_time(range-vector)",documentation:"The population standard deviation of the values in the specified interval."},{insertText:"stdvar_over_time",label:"stdvar_over_time",detail:"stdvar_over_time(range-vector)",documentation:"The population standard variance of the values in the specified interval."}],a=[{insertText:"vector",label:"vector",detail:"vector(scalar)",documentation:"Returns the scalar as a vector with no labels."}],o=[...n,...i,...a],s={comment:{pattern:/#.*/},"context-aggregation":{pattern:/((without|by)\s*)\([^)]*\)/,lookbehind:!0,inside:{"label-key":{pattern:/[^(),\s][^,)]*[^),\s]*/,alias:"attr-name"},punctuation:/[()]/}},"context-labels":{pattern:/\{[^}]*(?=}?)/,greedy:!0,inside:{comment:{pattern:/#.*/},"label-key":{pattern:/[a-zA-Z_]\w*(?=\s*(=|!=|=~|!~))/,alias:"attr-name",greedy:!0},"label-value":{pattern:/"(?:\\.|[^\\"])*"/,greedy:!0,alias:"attr-value"},punctuation:/[{]/}},"context-pipe":{pattern:/\s\|[^=~]\s?\w*/i,inside:{"pipe-operator":{pattern:/\|/i,alias:"operator"},"pipe-operations":{pattern:new RegExp(`${[{label:"json",insertText:"json",documentation:"Extracting labels from the log line using json parser."},{label:"regexp",insertText:'regexp ""',documentation:"Extracting labels from the log line using regexp parser.",move:-1},{label:"logfmt",insertText:"logfmt",documentation:"Extracting labels from the log line using logfmt parser."},{label:"pattern",insertText:"pattern",documentation:"Extracting labels from the log line using pattern parser. Only available in Loki 2.3+."},{label:"unpack",insertText:"unpack",detail:"unpack identifier",documentation:'Parses a JSON log line, unpacking all embedded labels in the pack stage. A special property "_entry" will also be used to replace the original log line. Only available in Loki 2.2+.'},{label:"unwrap",insertText:"unwrap",detail:"unwrap identifier",documentation:"Take labels and use the values as sample data for metric aggregations."},{label:"label_format",insertText:"label_format",documentation:"Use to rename, modify or add labels. For example, | label_format foo=bar ."},{label:"line_format",insertText:"line_format",documentation:'Rewrites log line content. For example, | line_format "{{.query}} {{.duration}}" .'}].map((e=>e.label)).join("|")}`,"i"),alias:"keyword"}}},function:new RegExp(`\\b(?:${o.map((e=>e.label)).join("|")})(?=\\s*\\()`,"i"),"context-range":[{pattern:/\[[^\]]*(?=\])/,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}},{pattern:/(offset\s+)\w+/,lookbehind:!0,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}}],quote:{pattern:/"(?:\\.|[^\\"])*"/,alias:"string",greedy:!0},backticks:{pattern:/`(?:\\.|[^\\`])*`/,alias:"string",greedy:!0},number:/\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,operator:/\s?(\|[=~]?|!=?|<(?:=>?|<|>)?|>[>=]?)\s?/i,punctuation:/[{}(),.]/},l=s},709:(e,t,r)=>{"use strict";const n=r(5750),i=r(2074),a=r(4708),o=r(1427),s=r(4256),l=r(9881),c=r(8854),u=r(2479),d=r(4952),p=r(1034),f=r(9406),h=r(5229),g=r(6513),m=r(3440),b=r(7618),v=r(5699),y=r(7565),O=r(3559),E=r(1173),x=r(9308),S=r(2083),w=r(1409),T=r(6031),R=r(3833),P=r(4624),I=r(4991),A=r(362),L=r(9264),C=r(2839),_=r(3238),N=r(3327),D=r(6988),k=r(2366),$=r(7453),j=r(130),F=r(7715),M=r(7379),B=r(110),Q=r(284),U=r(8285),V=r(2008);e.exports={parse:s,valid:l,clean:c,inc:u,diff:d,major:p,minor:f,patch:h,prerelease:g,compare:m,rcompare:b,compareLoose:v,compareBuild:y,sort:O,rsort:E,gt:x,lt:S,eq:w,neq:T,gte:R,lte:P,cmp:I,coerce:A,Comparator:L,Range:C,satisfies:_,toComparators:N,maxSatisfying:D,minSatisfying:k,minVersion:$,validRange:j,outside:F,gtr:M,ltr:B,intersects:Q,simplifyRange:U,subset:V,SemVer:a,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},1025:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={WHITESPACE:"whitespace",WORD:"word",STRING:"string",RESERVED:"reserved",RESERVED_TOP_LEVEL:"reserved-top-level",RESERVED_TOP_LEVEL_NO_INDENT:"reserved-top-level-no-indent",RESERVED_NEWLINE:"reserved-newline",OPERATOR:"operator",OPEN_PAREN:"open-paren",CLOSE_PAREN:"close-paren",LINE_COMMENT:"line-comment",BLOCK_COMMENT:"block-comment",NUMBER:"number",PLACEHOLDER:"placeholder"},e.exports=t.default},1034:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t)=>new n(e,t).major},1064:e=>{"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},1144:(e,t,r)=>{var n=r(3662),i=1/0;e.exports=function(e){return e?(e=n(e))===i||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1173:(e,t,r)=>{"use strict";const n=r(7565);e.exports=(e,t)=>e.sort(((e,r)=>n(r,e,t)))},1269:e=>{"use strict";e.exports=s},1272:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},1282:(e,t,r)=>{var n=r(1428);e.exports=function(e,t){return n(t,(function(t){return e[t]}))}},1283:(e,t,r)=>{var n=r(9555),i=r(7134),a=r(8951),o=r(5729),s=r(1624),l=Math.max;e.exports=function(e,t,r,c){e=i(e)?e:s(e),r=r&&!c?o(r):0;var u=e.length;return r<0&&(r=l(u+r,0)),a(e)?r<=u&&e.indexOf(t,r)>-1:!!u&&n(e,t,r)>-1}},1303:function(e){e.exports=function(){var e=[],t=[],r={},n={},i={};function a(e){return"string"==typeof e?new RegExp("^"+e+"$","i"):e}function o(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t){return e.replace(/\$(\d{1,2})/g,(function(e,r){return t[r]||""}))}function l(e,t){return e.replace(t[0],(function(r,n){var i=s(t[1],arguments);return o(""===r?e[n-1]:r,i)}))}function c(e,t,n){if(!e.length||r.hasOwnProperty(e))return t;for(var i=n.length;i--;){var a=n[i];if(a[0].test(t))return l(t,a)}return t}function u(e,t,r){return function(n){var i=n.toLowerCase();return t.hasOwnProperty(i)?o(n,i):e.hasOwnProperty(i)?o(n,e[i]):c(i,n,r)}}function d(e,t,r,n){return function(n){var i=n.toLowerCase();return!!t.hasOwnProperty(i)||!e.hasOwnProperty(i)&&c(i,i,r)===i}}function p(e,t,r){return(r?t+" ":"")+(1===t?p.singular(e):p.plural(e))}return p.plural=u(i,n,e),p.isPlural=d(i,n,e),p.singular=u(n,i,t),p.isSingular=d(n,i,t),p.addPluralRule=function(t,r){e.push([a(t),r])},p.addSingularRule=function(e,r){t.push([a(e),r])},p.addUncountableRule=function(e){"string"!=typeof e?(p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")):r[e.toLowerCase()]=!0},p.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,n[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach((function(e){return p.addIrregularRule(e[0],e[1])})),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach((function(e){return p.addPluralRule(e[0],e[1])})),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach((function(e){return p.addSingularRule(e[0],e[1])})),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}()},1308:t=>{"use strict";t.exports=e},1409:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>0===n(e,t,r)},1427:e=>{"use strict";const t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;const n=t.test(e),i=t.test(r);return n&&i&&(e=+e,r=+r),e===r?0:n&&!i?-1:i&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},1428:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}},1432:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(9157)),i=a(r(3202));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s,l=["ACCESSIBLE","ACTION","AGAINST","AGGREGATE","ALGORITHM","ALL","ALTER","ANALYSE","ANALYZE","AS","ASC","AUTOCOMMIT","AUTO_INCREMENT","BACKUP","BEGIN","BETWEEN","BINLOG","BOTH","CASCADE","CASE","CHANGE","CHANGED","CHARACTER SET","CHARSET","CHECK","CHECKSUM","COLLATE","COLLATION","COLUMN","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPRESSED","CONCURRENT","CONSTRAINT","CONTAINS","CONVERT","CREATE","CROSS","CURRENT_TIMESTAMP","DATABASE","DATABASES","DAY","DAY_HOUR","DAY_MINUTE","DAY_SECOND","DEFAULT","DEFINER","DELAYED","DELETE","DESC","DESCRIBE","DETERMINISTIC","DISTINCT","DISTINCTROW","DIV","DO","DROP","DUMPFILE","DUPLICATE","DYNAMIC","ELSE","ENCLOSED","END","ENGINE","ENGINES","ENGINE_TYPE","ESCAPE","ESCAPED","EVENTS","EXEC","EXECUTE","EXISTS","EXPLAIN","EXTENDED","FAST","FETCH","FIELDS","FILE","FIRST","FIXED","FLUSH","FOR","FORCE","FOREIGN","FULL","FULLTEXT","FUNCTION","GLOBAL","GRANT","GRANTS","GROUP_CONCAT","HEAP","HIGH_PRIORITY","HOSTS","HOUR","HOUR_MINUTE","HOUR_SECOND","IDENTIFIED","IF","IFNULL","IGNORE","IN","INDEX","INDEXES","INFILE","INSERT","INSERT_ID","INSERT_METHOD","INTERVAL","INTO","INVOKER","IS","ISOLATION","KEY","KEYS","KILL","LAST_INSERT_ID","LEADING","LEVEL","LIKE","LINEAR","LINES","LOAD","LOCAL","LOCK","LOCKS","LOGS","LOW_PRIORITY","MARIA","MASTER","MASTER_CONNECT_RETRY","MASTER_HOST","MASTER_LOG_FILE","MATCH","MAX_CONNECTIONS_PER_HOUR","MAX_QUERIES_PER_HOUR","MAX_ROWS","MAX_UPDATES_PER_HOUR","MAX_USER_CONNECTIONS","MEDIUM","MERGE","MINUTE","MINUTE_SECOND","MIN_ROWS","MODE","MODIFY","MONTH","MRG_MYISAM","MYISAM","NAMES","NATURAL","NOT","NOW()","NULL","OFFSET","ON DELETE","ON UPDATE","ON","ONLY","OPEN","OPTIMIZE","OPTION","OPTIONALLY","OUTFILE","PACK_KEYS","PAGE","PARTIAL","PARTITION","PARTITIONS","PASSWORD","PRIMARY","PRIVILEGES","PROCEDURE","PROCESS","PROCESSLIST","PURGE","QUICK","RAID0","RAID_CHUNKS","RAID_CHUNKSIZE","RAID_TYPE","RANGE","READ","READ_ONLY","READ_WRITE","REFERENCES","REGEXP","RELOAD","RENAME","REPAIR","REPEATABLE","REPLACE","REPLICATION","RESET","RESTORE","RESTRICT","RETURN","RETURNS","REVOKE","RLIKE","ROLLBACK","ROW","ROWS","ROW_FORMAT","SECOND","SECURITY","SEPARATOR","SERIALIZABLE","SESSION","SHARE","SHOW","SHUTDOWN","SLAVE","SONAME","SOUNDS","SQL","SQL_AUTO_IS_NULL","SQL_BIG_RESULT","SQL_BIG_SELECTS","SQL_BIG_TABLES","SQL_BUFFER_RESULT","SQL_CACHE","SQL_CALC_FOUND_ROWS","SQL_LOG_BIN","SQL_LOG_OFF","SQL_LOG_UPDATE","SQL_LOW_PRIORITY_UPDATES","SQL_MAX_JOIN_SIZE","SQL_NO_CACHE","SQL_QUOTE_SHOW_CREATE","SQL_SAFE_UPDATES","SQL_SELECT_LIMIT","SQL_SLAVE_SKIP_COUNTER","SQL_SMALL_RESULT","SQL_WARNINGS","START","STARTING","STATUS","STOP","STORAGE","STRAIGHT_JOIN","STRING","STRIPED","SUPER","TABLE","TABLES","TEMPORARY","TERMINATED","THEN","TO","TRAILING","TRANSACTIONAL","TRUE","TRUNCATE","TYPE","TYPES","UNCOMMITTED","UNIQUE","UNLOCK","UNSIGNED","USAGE","USE","USING","VARIABLES","VIEW","WHEN","WITH","WORK","WRITE","YEAR_MONTH"],c=["ADD","AFTER","ALTER COLUMN","ALTER TABLE","DELETE FROM","EXCEPT","FETCH FIRST","FROM","GROUP BY","GO","HAVING","INSERT INTO","INSERT","LIMIT","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UPDATE","VALUES","WHERE"],u=["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],d=["AND","CROSS APPLY","CROSS JOIN","ELSE","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","XOR"],p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=t}var t,r,a;return t=e,(r=[{key:"format",value:function(e){return s||(s=new i.default({reservedWords:l,reservedTopLevelWords:c,reservedNewlineWords:d,reservedTopLevelWordsNoIndent:u,stringTypes:['""',"N''","''","``","[]"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["@",":"],lineCommentTypes:["#","--"]})),new n.default(this.cfg,s).format(e)}}])&&o(t.prototype,r),a&&o(t,a),e}();t.default=p,e.exports=t.default},1459:e=>{var t=Math.floor;e.exports=function(e,r){var n="";if(!e||r<1||r>9007199254740991)return n;do{r%2&&(n+=e),(r=t(r/2))&&(e+=e)}while(r);return n}},1624:(e,t,r)=>{var n=r(1282),i=r(3790);e.exports=function(e){return null==e?[]:n(e,i(e))}},1849:(e,t,r)=>{"use strict";r.d(t,{B:()=>i,a:()=>s});var n=r(2029);function i(e,t,r,n){if(!e)return!1;const i=a(t,n);if(!i.length)return!1;let s=i;if(e!==t){const t=a(e,n);s=i.flatMap((e=>t.filter((t=>e.text===t.text))||e))}return s.map((t=>function(e,t,r){if(1===t.length){const t=r.node.from===r.node.to,n=t&&r.node.parent?r.node.parent:r.node,i=t?e.substring(n.from,n.to):r.text;return{startLineNumber:1,startColumn:n.from+1,endLineNumber:1,endColumn:n.to+1,error:i}}let n=0,i=0;for(let e=0;e<t.length;e++){if(i=n+t[e].length,!(r.node.from>i))return{startLineNumber:e+1,startColumn:r.node.from-n+1,endLineNumber:e+1,endColumn:r.node.to-n+1,error:r.text};n+=t[e].length+1}return null}(e,r,t))).filter(o)}function a(e,t){const r=[];return t.parse(e).iterate({enter:t=>{if(t.type.id===n.Ql){const n=t.node;r.push({node:n,text:e.substring(n.from,n.to)})}}}),r}function o(e){return null!==e}const s={__interval:{text:"1s",value:"1s"},__rate_interval:{text:"1s",value:"1s"},__auto:{text:"1s",value:"1s"},__interval_ms:{text:"1000",value:1e3},__range_ms:{text:"1000",value:1e3},__range_s:{text:"1",value:1},__range:{text:"1s",value:"1s"}}},1866:(e,t,r)=>{var n=r(9048),i=r(9834);e.exports=function(e){if(!i(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1886:(e,t,r)=>{"use strict";r.d(t,{T:()=>i,f:()=>n});r(5959),r(7781);var n=(e=>(e.Code="code",e.Builder="builder",e))(n||{});const i="Binary operations"},1977:(e,t,r)=>{e=r.nmd(e);var n=r(6392),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i&&n.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s},2007:e=>{"use strict";e.exports=o},2008:(e,t,r)=>{"use strict";const n=r(2839),i=r(9264),{ANY:a}=i,o=r(3238),s=r(3440),l=[new i(">=0.0.0-0")],c=[new i(">=0.0.0")],u=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===a){if(1===t.length&&t[0].semver===a)return!0;e=r.includePrerelease?l:c}if(1===t.length&&t[0].semver===a){if(r.includePrerelease)return!0;t=c}const n=new Set;let i,u,f,h,g,m,b;for(const t of e)">"===t.operator||">="===t.operator?i=d(i,t,r):"<"===t.operator||"<="===t.operator?u=p(u,t,r):n.add(t.semver);if(n.size>1)return null;if(i&&u){if(f=s(i.semver,u.semver,r),f>0)return null;if(0===f&&(">="!==i.operator||"<="!==u.operator))return null}for(const e of n){if(i&&!o(e,String(i),r))return null;if(u&&!o(e,String(u),r))return null;for(const n of t)if(!o(e,String(n),r))return!1;return!0}let v=!(!u||r.includePrerelease||!u.semver.prerelease.length)&&u.semver,y=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;v&&1===v.prerelease.length&&"<"===u.operator&&0===v.prerelease[0]&&(v=!1);for(const e of t){if(b=b||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,i)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(h=d(i,e,r),h===e&&h!==i)return!1}else if(">="===i.operator&&!o(i.semver,String(e),r))return!1;if(u)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if(g=p(u,e,r),g===e&&g!==u)return!1}else if("<="===u.operator&&!o(u.semver,String(e),r))return!1;if(!e.operator&&(u||i)&&0!==f)return!1}return!(i&&m&&!u&&0!==f)&&(!(u&&b&&!i&&0!==f)&&(!y&&!v))},d=(e,t,r)=>{if(!e)return t;const n=s(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;const n=s(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=u(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},2029:(e,t,r)=>{"use strict";r.d(t,{AA:()=>u,If:()=>c,Ql:()=>n,R1:()=>p,SY:()=>o,qk:()=>s,rq:()=>d,xz:()=>a,z9:()=>i});const n=0;function i(e){return e.firstChild?i(e.firstChild):e}function a(e,t){var r;return{text:u(e,t),from:t.from,to:t.to,parentType:null===(r=t.parent)||void 0===r?void 0:r.name}}const o=/\$(\w+)|\[\[([\s\S]+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g;function s(e){return e.replace(o,((e,t,r,n,i,a,o)=>{const s=n||o;let l=t,c="0";return r&&(l=r,c="1"),i&&(l=i,c="2"),`__V_${c}__`+l+"__V__"+(s?"__F__"+s+"__F__":"")}))}const l=[(e,t)=>`$${e}`,(e,t)=>`[[${e}${t?`:${t}`:""}]]`,(e,t)=>`\${${e}${t?`:${t}`:""}}`];function c(e){return e.replace(/__V_(\d)__(.+?)__V__(?:__F__(\w+)__F__)?/g,((e,t,r,n)=>l[parseInt(t,10)](r,n)))}function u(e,t){return t?c(e.substring(t.from,t.to)):""}function d(e,t,r,n){const i=[parseFloat(u(t,r))];return e.comparison&&i.push(n),{id:e.id,params:i}}function p(e,t,r){if(t.type.id===r||t.name===r)return[u(e,t)];const n=[];let i=0,a=t.childAfter(i);for(;a;)n.push(...p(e,a,r)),i=a.to,a=t.childAfter(i);return n}},2062:(e,t,r)=>{var n=r(4363),i=r(5240);e.exports=function(e,t){var r=i(e,t);return n(r)?r:void 0}},2074:e=>{"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},2083:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>n(e,t,r)<0},2366:(e,t,r)=>{"use strict";const n=r(4708),i=r(2839);e.exports=(e,t,r)=>{let a=null,o=null,s=null;try{s=new i(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(a&&1!==o.compare(e)||(a=e,o=new n(a,r)))})),a}},2479:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t,r,i,a)=>{"string"==typeof r&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch(e){return null}}},2489:(e,t,r)=>{var n=r(9965)["__core-js_shared__"];e.exports=n},2520:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(9901)),i=a(r(8906));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s="top-level",l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.indent=t||" ",this.indentTypes=[]}var t,r,a;return t=e,(r=[{key:"getIndent",value:function(){return(0,n.default)(this.indent,this.indentTypes.length)}},{key:"increaseTopLevel",value:function(){this.indentTypes.push(s)}},{key:"increaseBlockLevel",value:function(){this.indentTypes.push("block-level")}},{key:"decreaseTopLevel",value:function(){(0,i.default)(this.indentTypes)===s&&this.indentTypes.pop()}},{key:"decreaseBlockLevel",value:function(){for(;this.indentTypes.length>0&&this.indentTypes.pop()===s;);}},{key:"resetIndentation",value:function(){this.indentTypes=[]}}])&&o(t.prototype,r),a&&o(t,a),e}();t.default=l,e.exports=t.default},2609:(e,t,r)=>{var n=r(9965).Symbol;e.exports=n},2784:e=>{e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},2833:(e,t,r)=>{var n=r(2062)(r(9965),"Set");e.exports=n},2839:(e,t,r)=>{"use strict";const n=/\s+/g;class i{constructor(e,t){if(t=o(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(n," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!b(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&g)|(this.options.loose&&m))+":"+e,r=a.get(t);if(r)return r;const n=this.options.loose,i=n?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];e=e.replace(i,L(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(u[d.COMPARATORTRIM],p),l("comparator trim",e),e=e.replace(u[d.TILDETRIM],f),l("tilde trim",e),e=e.replace(u[d.CARETTRIM],h),l("caret trim",e);let o=e.split(" ").map((e=>O(e,this.options))).join(" ").split(/\s+/).map((e=>A(e,this.options)));n&&(o=o.filter((e=>(l("loose invalid filter",e,this.options),!!e.match(u[d.COMPARATORLOOSE]))))),l("range list",o);const c=new Map,v=o.map((e=>new s(e,this.options)));for(const e of v){if(b(e))return[e];c.set(e.value,e)}c.size>1&&c.has("")&&c.delete("");const y=[...c.values()];return a.set(t,y),y}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some((r=>y(r,t)&&e.set.some((e=>y(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(C(this.set[t],e,this.options))return!0;return!1}}e.exports=i;const a=new(r(122)),o=r(9547),s=r(9264),l=r(1064),c=r(4708),{safeRe:u,t:d,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(5750),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:m}=r(2074),b=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,y=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},O=(e,t)=>(e=e.replace(u[d.BUILD],""),l("comp",e,t),e=w(e,t),l("caret",e),e=x(e,t),l("tildes",e),e=R(e,t),l("xrange",e),e=I(e,t),l("stars",e),e),E=e=>!e||"x"===e.toLowerCase()||"*"===e,x=(e,t)=>e.trim().split(/\s+/).map((e=>S(e,t))).join(" "),S=(e,t)=>{const r=t.loose?u[d.TILDELOOSE]:u[d.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return l("tilde",e,t,r,n,i,a),E(r)?o="":E(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:E(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(l("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,l("tilde return",o),o}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>T(e,t))).join(" "),T=(e,t)=>{l("caret",e,t);const r=t.loose?u[d.CARETLOOSE]:u[d.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return l("caret",e,t,r,i,a,o),E(r)?s="":E(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:E(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(l("replaceCaret pr",o),s="0"===r?"0"===i?`>=${r}.${i}.${a}-${o} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${o} <${+r+1}.0.0-0`):(l("no pr"),s="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),l("caret return",s),s}))},R=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map((e=>P(e,t))).join(" ")),P=(e,t)=>{e=e.trim();const r=t.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{l("xRange",e,r,n,i,a,o,s);const c=E(i),u=c||E(a),d=u||E(o),p=d;return"="===n&&p&&(n=""),s=t.includePrerelease?"-0":"",c?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&p?(u&&(a=0),o=0,">"===n?(n=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===n&&(n="<",u?i=+i+1:a=+a+1),"<"===n&&(s="-0"),r=`${n+i}.${a}.${o}${s}`):u?r=`>=${i}.0.0${s} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),l("xRange return",r),r}))},I=(e,t)=>(l("replaceStars",e,t),e.trim().replace(u[d.STAR],"")),A=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),L=e=>(t,r,n,i,a,o,s,l,c,u,d,p)=>`${r=E(n)?"":E(i)?`>=${n}.0.0${e?"-0":""}`:E(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=E(c)?"":E(u)?`<${+c+1}.0.0-0`:E(d)?`<${c}.${+u+1}.0-0`:p?`<=${c}.${u}.${d}-${p}`:e?`<${c}.${u}.${+d+1}-0`:`<=${l}`}`.trim(),C=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==s.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},2899:(e,t,r)=>{var n=r(2609),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=o.call(e);return n&&(t?e[s]=r:delete e[s]),i}},2954:(e,t,r)=>{"use strict";r.d(t,{af:()=>P,VR:()=>I,G3:()=>$,jC:()=>M,fu:()=>y,yD:()=>O,iZ:()=>k,UF:()=>A,OS:()=>L,hh:()=>w,sn:()=>S,EP:()=>T});var n=r(3241),i=r(1303),a=r.n(i),o=r(7895),s=r(601),l=r(9728),c=r(5959),u=r(2007);function d(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){d(a,n,i,o,s,"next",e)}function s(e){d(a,n,i,o,s,"throw",e)}o(void 0)}))}}const f=({onChange:e,index:t,operationId:r,value:n,query:i,datasource:a,queryModeller:o})=>{const[s,d]=(0,c.useState)({});return(0,l.jsx)(u.Select,{inputId:L(r,t),autoFocus:""===n,openMenuOnFocus:!0,onOpenMenu:()=>p((function*(){d({isLoading:!0});const e=yield function(e,t,r){return p((function*(){let n=e.labels;const i=r.renderLabels(n);return(yield t.languageProvider.fetchLabels({streamSelector:i})).map((e=>({label:e,value:e})))}))()}(i,a,o);d({options:e,isLoading:void 0})}))(),isLoading:s.isLoading,allowCustomValue:!0,noOptionsMessage:"No labels found",loadingMessage:"Loading labels",options:s.options,value:h(n),onChange:r=>e(t,r.value)})};const h=e=>({label:null==e?void 0:e.toString(),value:e});var g=r(8116);function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){m(e,t,r[t])}))}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function y(e,t){const r=[{name:"Range",type:"string",options:["$__auto"],description:'Use the default value "$__auto". Change the "step" value in the query options to change the bucket size.'}],n=["$__auto"];let i;return e===g.EF.QuantileOverTime&&(n.push("0.95"),r.push({name:"Quantile",type:"number"})),t&&(r.push({name:"By label",type:"string",restParam:!0,optional:!0}),i=C(`__${e}_by`)),{id:e,name:D(e),params:r,defaultParams:n,toggleable:!0,alternativesKey:"range function",category:g.Ln.RangeFunctions,orderRank:g.h5.RangeVectorFunction,renderer:x,addOperationHandler:P,paramChangedHandler:i,explainHandler:(e,t)=>{var r,n;let i=null!==(n=null===(r=s.AW.find((t=>t.insertText===e.id)))||void 0===r?void 0:r.documentation)&&void 0!==n?n:"";return"$__auto"===e.params[0]?`${i} \`$__auto\` is a variable that will be replaced with the [value of step](https://grafana.com/docs/grafana/next/datasources/loki/query-editor/#options) for range queries and with the value of the selected time range (calculated to - from) for instant queries.`:`${i} The [range vector](https://grafana.com/docs/loki/latest/logql/metric_queries/#range-vector-aggregation) is set to \`${e.params[0]}\`.`}}}function O(e){const t=y(e,!0),r=t.params.slice(0,-1);return[t,{id:`__${e}_by`,name:`${D(e)} by`,params:[...r,{name:"Label",type:"string",restParam:!0,optional:!0,editor:f}],defaultParams:[...t.defaultParams,""],toggleable:!0,alternativesKey:"range function with grouping",category:g.Ln.RangeFunctions,renderer:E(e,"by"),paramChangedHandler:N(e),explainHandler:_(e,"by"),addOperationHandler:P,hideFromList:!0},{id:`__${e}_without`,name:`${D(e)} without`,params:[...r,{name:"Label",type:"string",restParam:!0,optional:!0,editor:f}],defaultParams:[...t.defaultParams,""],alternativesKey:"range function with grouping",category:g.Ln.RangeFunctions,renderer:E(e,"without"),paramChangedHandler:N(e),explainHandler:_(e,"without"),addOperationHandler:P,hideFromList:!0}]}function E(e,t){return function(r,n,i){const a=n.params.findIndex((e=>e.restParam)),o=r.params.slice(0,a),s=r.params.slice(a);return 2===o.length&&e===g.EF.QuantileOverTime?`${e}(${o[1]}, ${i} [${o[0]}]) ${t} (${s.join(", ")})`:`${e}(${i} [${o[0]}]) ${t} (${s.join(", ")})`}}function x(e,t,r){var n;const i=null!==(n=e.params)&&void 0!==n?n:[];var a;const o=null!==(a=i[0])&&void 0!==a?a:"$__auto";if(2===i.length&&e.id===g.EF.QuantileOverTime){const t=i[1];return`${e.id}(${t}, ${r} [${o}])`}var s;return`${e.id}(${r} [${null!==(s=i[0])&&void 0!==s?s:"$__auto"}])`}function S(e,t,r){return["<","<=",">",">="].includes(String(e.params[1]))?`${r} | ${e.params[0]} ${e.params[1]} ${e.params[2]}`:`${r} | ${e.params[0]} ${e.params[1]} \`${e.params[2]}\``}function w(e,t){if(!e)return!1;const r=e.params[1].toString().startsWith("!");return t.filter((t=>t.id===g.EF.LabelFilter&&t.params[0]===e.params[0]&&t.params[2]===e.params[2])).some((e=>!(!r||!1!==e.params[1].toString().startsWith("!"))||!(!1!==r||!e.params[1].toString().startsWith("!"))))}function T(e,t,r){switch(e.id){case g.EF.Logfmt:const[t=!1,n=!1,...i]=e.params;return`${r} | logfmt${t?" --strict":""}${n?" --keep-empty":""} ${i.filter((e=>e)).join(", ")}`.trim();case g.EF.Json:return`${r} | json ${e.params.filter((e=>e)).join(", ")}`.trim();case g.EF.Drop:return`${r} | drop ${e.params.filter((e=>e)).join(", ")}`.trim();case g.EF.Keep:return`${r} | keep ${e.params.filter((e=>e)).join(", ")}`.trim();default:return`${r} | ${e.id}`}}function R(e,t,r){const n=e.findIndex((e=>{const n=t.getOperationDefinition(e.id);return!!n&&r(n)}));return-1===n?e.length:n}function P(e,t,r){const n={id:e.id,params:e.defaultParams},i=[...t.operations],a=i.find((e=>{const t=r.getOperationDefinition(e.id);return!!t&&function(e){return e.category===g.Ln.RangeFunctions}(t)}));switch(e.category){case g.Ln.Aggregations:case g.Ln.Functions:if(!a){const e=R(i,r,(e=>e.category===g.Ln.Functions));i.splice(e,0,{id:g.EF.Rate,params:["$__auto"]})}i.push(n);break;case g.Ln.RangeFunctions:if(a){const e=i.indexOf(a);i[e]=n;break}default:const t=R(i,r,(t=>{var r,n;return(null!==(r=e.orderRank)&&void 0!==r?r:100)<(null!==(n=t.orderRank)&&void 0!==n?n:100)}));i.splice(t,0,n)}return v(b({},t),{operations:i})}function I(e,t){var r;return v(b({},t),{binaryQueries:[...null!==(r=t.binaryQueries)&&void 0!==r?r:[],{operator:"/",query:t}]})}function A(e,t){return function(r,n,i){const a=r.params.some((e=>"string"==typeof e&&e.includes("`"))),s=a?'"':"`";let l;return l=a?r.params.map((e=>"string"==typeof e?(0,o.Qn)(e):e)):r.params,t?`${i} ${e} ${s}(?i)${l.join(`${s} or ${s}(?i)`)}${s}`:`${i} ${e} ${s}${l.join(`${s} or ${s}`)}${s}`}}function L(e,t){return`operations.${e}.param.${t}`}function C(e){return function(t,r,n){return r.params.length===n.params.length?v(b({},r),{id:e}):r}}function _(e,t){return function(r){const n=r.params.map((e=>`\`${e}\``)).join(" and "),i=a()("label",r.params.length);switch(t){case"by":return`Calculates ${e} over dimensions while preserving ${i} ${n}.`;case"without":return`Calculates ${e} over the dimensions ${n}. All other labels are preserved.`;default:return`Calculates ${e} over the dimensions.`}}}function N(e){return function(t,r,n){return r.params.length<n.params.length?v(b({},r),{id:e}):r}}function D(e){return(0,n.capitalize)(e.replace(/_/g," "))}function k(e,t){const r={id:e.id,params:e.defaultParams};return v(b({},t),{operations:[...t.operations,r]})}function $(e,t={}){var r;return[b({id:e,name:D(e),params:[{name:"By label",type:"string",restParam:!0,optional:!0}],defaultParams:[],toggleable:!0,alternativesKey:"plain aggregations",category:g.Ln.Aggregations,renderer:F,paramChangedHandler:C(`__${e}_by`),explainHandler:_(e,""),addOperationHandler:k},t),b({id:`__${e}_by`,name:`${D(e)} by`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:f}],defaultParams:[""],alternativesKey:"aggregations by",category:g.Ln.Aggregations,renderer:(r=e,function(e,t,n){return`${r} by(${e.params.join(", ")}) (${n})`}),paramChangedHandler:N(e),explainHandler:_(e,"by"),addOperationHandler:k,hideFromList:!0},t),b({id:`__${e}_without`,name:`${D(e)} without`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:f}],defaultParams:[""],alternativesKey:"aggregations by",category:g.Ln.Aggregations,renderer:j(e),paramChangedHandler:N(e),explainHandler:_(e,"without"),addOperationHandler:k,hideFromList:!0},t)]}function j(e){return function(t,r,n){return`${e} without(${t.params.join(", ")}) (${n})`}}function F(e,t,r){const n=function(e,t){var r;return(null!==(r=e.params)&&void 0!==r?r:[]).map(((e,r)=>"string"===t.params[r].type?'"'+e+'"':e))}(e,t),i=e.id+"(";return r&&n.push(r),i+n.join(", ")+")"}function M(e,t,r={}){const n=$(e,r);return n[0].params.unshift(...t.params),n[1].params.unshift(...t.params),n[2].params.unshift(...t.params),n[0].defaultParams=t.defaultParams,n[1].defaultParams=[...t.defaultParams,""],n[2].defaultParams=[...t.defaultParams,""],n[1].renderer=B(e),n[2].renderer=B(e),n}function B(e){return function(t,r,n){const i=r.params.findIndex((e=>e.restParam)),a=t.params.slice(0,i),o=t.params.slice(i);return`${e} by(${o.join(", ")}) (${a.map(((e,t)=>"string"===r.params[t].type?`"${e}"`:e)).join(", ")}, ${n})`}}},3059:e=>{"use strict";e.exports=l},3070:(e,t,r)=>{var n=r(9048),i=r(9466);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},3158:(e,t,r)=>{var n=r(9764);e.exports=function(e){return null==e?"":n(e)}},3202:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(r(7969)),i=o(r(8472)),a=o(r(1025));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.WHITESPACE_REGEX=/^([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+)/,this.NUMBER_REGEX=/^((\x2D[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?[0-9]+(\.[0-9]+)?|0x[0-9A-Fa-f]+|0b[01]+)\b/,this.OPERATOR_REGEX=/^(!=|<>|==|<=|>=|!<|!>|\|\||::|\x2D>>|\x2D>|~~\*|~~|!~~\*|!~~|~\*|!~\*|!~|:=|(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/,this.BLOCK_COMMENT_REGEX=/^(\/\*(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?(?:\*\/|$))/,this.LINE_COMMENT_REGEX=this.createLineCommentRegex(t.lineCommentTypes),this.RESERVED_TOP_LEVEL_REGEX=this.createReservedWordRegex(t.reservedTopLevelWords),this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX=this.createReservedWordRegex(t.reservedTopLevelWordsNoIndent),this.RESERVED_NEWLINE_REGEX=this.createReservedWordRegex(t.reservedNewlineWords),this.RESERVED_PLAIN_REGEX=this.createReservedWordRegex(t.reservedWords),this.WORD_REGEX=this.createWordRegex(t.specialWordChars),this.STRING_REGEX=this.createStringRegex(t.stringTypes),this.OPEN_PAREN_REGEX=this.createParenRegex(t.openParens),this.CLOSE_PAREN_REGEX=this.createParenRegex(t.closeParens),this.INDEXED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(t.indexedPlaceholderTypes,"[0-9]*"),this.IDENT_NAMED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(t.namedPlaceholderTypes,"[a-zA-Z0-9._$]+"),this.STRING_NAMED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(t.namedPlaceholderTypes,this.createStringPattern(t.stringTypes))}var t,r,o;return t=e,r=[{key:"createLineCommentRegex",value:function(e){return new RegExp("^((?:".concat(e.map((function(e){return(0,i.default)(e)})).join("|"),").*?(?:\r\n|\r|\n|$))"),"u")}},{key:"createReservedWordRegex",value:function(e){var t=e.join("|").replace(/ /g,"\\s+");return new RegExp("^(".concat(t,")\\b"),"iu")}},{key:"createWordRegex",value:function(){return new RegExp("^([\\p{Alphabetic}\\p{Mark}\\p{Decimal_Number}\\p{Connector_Punctuation}\\p{Join_Control}".concat((arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(""),"]+)"),"u")}},{key:"createStringRegex",value:function(e){return new RegExp("^("+this.createStringPattern(e)+")","u")}},{key:"createStringPattern",value:function(e){var t={"``":"((`[^`]*($|`))+)","[]":"((\\[[^\\]]*($|\\]))(\\][^\\]]*($|\\]))*)",'""':'(("[^"\\\\]*(?:\\\\.[^"\\\\]*)*("|$))+)',"''":"(('[^'\\\\]*(?:\\\\.[^'\\\\]*)*('|$))+)","N''":"((N'[^N'\\\\]*(?:\\\\.[^N'\\\\]*)*('|$))+)"};return e.map((function(e){return t[e]})).join("|")}},{key:"createParenRegex",value:function(e){var t=this;return new RegExp("^("+e.map((function(e){return t.escapeParen(e)})).join("|")+")","iu")}},{key:"escapeParen",value:function(e){return 1===e.length?(0,i.default)(e):"\\b"+e+"\\b"}},{key:"createPlaceholderRegex",value:function(e,t){if((0,n.default)(e))return!1;var r=e.map(i.default).join("|");return new RegExp("^((?:".concat(r,")(?:").concat(t,"))"),"u")}},{key:"tokenize",value:function(e){if(!e)return[];for(var t,r=[];e.length;)t=this.getNextToken(e,t),e=e.substring(t.value.length),r.push(t);return r}},{key:"getNextToken",value:function(e,t){return this.getWhitespaceToken(e)||this.getCommentToken(e)||this.getStringToken(e)||this.getOpenParenToken(e)||this.getCloseParenToken(e)||this.getPlaceholderToken(e)||this.getNumberToken(e)||this.getReservedWordToken(e,t)||this.getWordToken(e)||this.getOperatorToken(e)}},{key:"getWhitespaceToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.WHITESPACE,regex:this.WHITESPACE_REGEX})}},{key:"getCommentToken",value:function(e){return this.getLineCommentToken(e)||this.getBlockCommentToken(e)}},{key:"getLineCommentToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.LINE_COMMENT,regex:this.LINE_COMMENT_REGEX})}},{key:"getBlockCommentToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.BLOCK_COMMENT,regex:this.BLOCK_COMMENT_REGEX})}},{key:"getStringToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.STRING,regex:this.STRING_REGEX})}},{key:"getOpenParenToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.OPEN_PAREN,regex:this.OPEN_PAREN_REGEX})}},{key:"getCloseParenToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.CLOSE_PAREN,regex:this.CLOSE_PAREN_REGEX})}},{key:"getPlaceholderToken",value:function(e){return this.getIdentNamedPlaceholderToken(e)||this.getStringNamedPlaceholderToken(e)||this.getIndexedPlaceholderToken(e)}},{key:"getIdentNamedPlaceholderToken",value:function(e){return this.getPlaceholderTokenWithKey({input:e,regex:this.IDENT_NAMED_PLACEHOLDER_REGEX,parseKey:function(e){return e.slice(1)}})}},{key:"getStringNamedPlaceholderToken",value:function(e){var t=this;return this.getPlaceholderTokenWithKey({input:e,regex:this.STRING_NAMED_PLACEHOLDER_REGEX,parseKey:function(e){return t.getEscapedPlaceholderKey({key:e.slice(2,-1),quoteChar:e.slice(-1)})}})}},{key:"getIndexedPlaceholderToken",value:function(e){return this.getPlaceholderTokenWithKey({input:e,regex:this.INDEXED_PLACEHOLDER_REGEX,parseKey:function(e){return e.slice(1)}})}},{key:"getPlaceholderTokenWithKey",value:function(e){var t=e.input,r=e.regex,n=e.parseKey,i=this.getTokenOnFirstMatch({input:t,regex:r,type:a.default.PLACEHOLDER});return i&&(i.key=n(i.value)),i}},{key:"getEscapedPlaceholderKey",value:function(e){var t=e.key,r=e.quoteChar;return t.replace(new RegExp((0,i.default)("\\"+r),"gu"),r)}},{key:"getNumberToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.NUMBER,regex:this.NUMBER_REGEX})}},{key:"getOperatorToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.OPERATOR,regex:this.OPERATOR_REGEX})}},{key:"getReservedWordToken",value:function(e,t){if(!t||!t.value||"."!==t.value)return this.getTopLevelReservedToken(e)||this.getNewlineReservedToken(e)||this.getTopLevelReservedTokenNoIndent(e)||this.getPlainReservedToken(e)}},{key:"getTopLevelReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.RESERVED_TOP_LEVEL,regex:this.RESERVED_TOP_LEVEL_REGEX})}},{key:"getNewlineReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.RESERVED_NEWLINE,regex:this.RESERVED_NEWLINE_REGEX})}},{key:"getTopLevelReservedTokenNoIndent",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.RESERVED_TOP_LEVEL_NO_INDENT,regex:this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX})}},{key:"getPlainReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.RESERVED,regex:this.RESERVED_PLAIN_REGEX})}},{key:"getWordToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:a.default.WORD,regex:this.WORD_REGEX})}},{key:"getTokenOnFirstMatch",value:function(e){var t=e.input,r=e.type,n=e.regex,i=t.match(n);if(i)return{type:r,value:i[1]}}}],r&&s(t.prototype,r),o&&s(t,o),e}();t.default=l,e.exports=t.default},3238:(e,t,r)=>{"use strict";const n=r(2839);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},3241:e=>{"use strict";e.exports=a},3248:(e,t,r)=>{var n,i=r(2489),a=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!a&&a in e}},3302:(e,t,r)=>{"use strict";r.d(t,{Ch:()=>d,FN:()=>f,Gk:()=>O,Lv:()=>w,OS:()=>_,aH:()=>y,cH:()=>R,cQ:()=>C,i6:()=>A,je:()=>p,lN:()=>P,lq:()=>D,o9:()=>S,tE:()=>b,yB:()=>T,yI:()=>x});var n=r(3241),i=r(5508),a=r(7895),o=r(6227),s=r(3471),l=r(3354),c=r(9107);function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class d{static fromNode(e){return new d(e.from,e.to,e.type)}contains(e){return this.from<=e.from&&this.to>=e.to}getExpression(e){return e.substring(this.from,this.to)}constructor(e,t,r){u(this,"from",void 0),u(this,"to",void 0),u(this,"type",void 0),this.from=e,this.to=t,this.type=r}}function p(e,t,r,n){return m(e,t,r,n).length>0}function f(e,t,r,n){const a=m(e,t,r,n);for(const t of a){var o;e=(null===(o=t.parent)||void 0===o?void 0:o.type.id)===i.bY?h(e,t):g(e,t)}return e}function h(e,t){var r;const n=null===(r=t.parent)||void 0===r?void 0:r.parent;return n&&n.type.id===i.t3?(e.substring(0,n.from)+e.substring(n.to)).trim():e}function g(e,t){let r=t;do{r=r.parent}while(r&&r.type.id!==i.MD);const n=t.getChild(i.gw);if(!r||!n)return e;const a=e.substring(n.from,n.to),o=e.substring(0,r.from),c=e.substring(r.to),u=(0,l.u_)(e.substring(r.from,r.to));return u.query.labels=u.query.labels.filter((e=>e.label!==a)),o+s.y.renderQuery(u.query)+c}function m(e,t,r,n){const o=i.K3.parse(e),s=[];return o.iterate({enter:({type:e,node:t})=>{e.id===i.g$&&s.push(t)}}),s.filter((o=>{const s=o.getChild(i.gw),c=null==s?void 0:s.nextSibling,u=o.getChild(i.Qf);if(!s||!c||!u)return!1;if(e.substring(s.from,s.to)!==t)return!1;const d=e.substring(u.from,u.to);if((0,l.w4)(d)!==(0,a.qv)(n))return!1;return e.substring(c.from,c.to)===r}))}function b(e,t,r,n,a){if(!t)throw new Error("Need label to add to query.");const s=T(e);if(!s.length)return e;const l=R(e),u=P(e),d=function(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({node:e})=>{e.type.id===i.MD&&r.push(...k(e,i.g$))}}),r}(e),p=(0,o.TQ)(e,[i.J_]);if(!a){const r=function(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({node:e})=>{e.type.id===i.MD&&r.push(...k(e,i.gw))}}),r}(e);r.map((t=>t.getExpression(e))).includes(t)&&(a=c.HD.Indexed)}const f=s.every((e=>d.some((t=>t.from>=e.from&&t.to<=e.to)))),h=A(t,n,r);if(a===c.HD.Parsed||a===c.HD.StructuredMetadata){const t=v(e,[...s,...u,...l,...p]);return C(e,t,h)}if(a===c.HD.Indexed)return L(e,s,h);if(0===l.length||!1===f)return L(e,s,h);{const t=v(e,[...l,...u,...p]);return C(e,t,h)}}function v(e,t){const r=(n=(0,o.TQ)(e,[i.GN])).filter((e=>n.every((t=>!1===e.contains(t)||e===t))));var n;const a=[...t];return r.map((e=>D(a.filter((t=>e.contains(t))))))}function y(e,t){const r=I(e);if(r.length)return E(e,r,t);{const r=T(e);return r.length?E(e,r,t):e}}function O(e,t){const r=I(e);if(r.length)return E(e,r,`drop ${t.join(", ")}`);{const r=T(e);return r.length?E(e,r,`drop ${t.join(", ")}`):e}}function E(e,t,r){let n="",i=0;for(let a=0;a<t.length;a++){const o=t[a],s=a===t.length-1;n+=e.substring(i,o.to)+` | ${r}`+(s?e.substring(o.to):""),i=o.to}return n}function x(e){const t=R(e);if(!t.length)return e;return C(e,t,A("__error__","","="))}function S(e,t){const r=function(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({type:e,node:t})=>{if(e.id===i.UK)return r.push(d.fromNode(t)),!1;if(e.id===i.xo){const e=[],a=t.getChild(i.MD);a&&e.push(d.fromNode(a));const o=t.getChild(i.AL);o&&e.push(d.fromNode(o));const s=t.getChild(i.HV);s&&e.push(d.fromNode(s));const l=(0,n.sortBy)(e,(e=>e.to));return r.push(new d(l[0].from,l[l.length-1].to)),!1}}}),r}(e);return function(e,t,r){let n="",i=0;for(let a=0;a<t.length;a++){const o=t[a],s=a===t.length-1,l=e.substring(i,o.to),c=s?e.substring(o.to):"";n+=l+` | label_format ${r.renameTo}=${r.originalLabel}`+c,i=o.to}return n}(e,r,t)}function w(e){const t=function(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({type:e,from:t,to:n})=>{if(e.id===i.uk)return r.push(new d(t,n,e)),!1}}),r}(e);if(!t.length)return e;let r="",n=0;for(let i of t)r+=e.substring(n,i.from),n=i.to;return r+=e.substring(n),r}function T(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({type:e,node:t})=>{if(e.id===i.MD)return r.push(d.fromNode(t)),!1}}),r}function R(e){const t=i.K3.parse(e),r=[],n=[i.iT,i.eF,i.Zj,i.Tz];return t.iterate({enter:({type:e,node:t})=>{if(n.includes(e.id))return r.push(d.fromNode(t)),!1}}),r}function P(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({type:e,node:t})=>{if(e.id===i.bY)return r.push(d.fromNode(t)),!1}}),r}function I(e){const t=i.K3.parse(e),r=[];return t.iterate({enter:({type:e,node:t})=>{if(e.id===i.CX)return r.push(d.fromNode(t)),!1}}),r}function A(e,t,r){return{label:e,op:r,value:t}}function L(e,t,r){let n="",i=0;for(let a=0;a<t.length;a++){const o=t[a],c=a===t.length-1,u=e.substring(i,o.from),d=c?e.substring(o.to):"",p=(0,l.u_)(e.substring(o.from,o.to));N(p.query.labels,r)||p.query.labels.push(r);n+=u+s.y.renderQuery(p.query)+d,i=o.to}return n}function C(e,t,r){let n="",i=0;for(let o=0;o<t.length;o++){const s=t[o],l=o===t.length-1,c=e.substring(i,s.to),u=l?e.substring(s.to):"";let d="";d=Number.isNaN(Number(r.value))||"<"!==r.op&&">"!==r.op?` | ${r.label}${r.op}\`${(0,a.qv)(r.value)}\``:` | ${r.label}${r.op}${Number(r.value)}`,n+=c+d+u,i=s.to}return n}function _(e,t="",r="|="){const n=T(e);if(!n.length)return e;const i=n[0].to;return e.slice(0,i)+` ${r} \`${t}\``+e.slice(i)}function N(e,t){return e.find((e=>e.label===t.label&&e.value===t.value))}function D(e){return e.length?e.reduce(((e,t)=>e.to>t.to?e:t)):new d(0,0)}function k(e,t){if(e.type.id===t)return[d.fromNode(e)];const r=[];let n=0,i=e.childAfter(n);for(;i;)r.push(...k(i,t)),n=i.to,i=e.childAfter(n);return r}},3323:e=>{e.exports=function(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;return-1}},3327:(e,t,r)=>{"use strict";const n=r(2839);e.exports=(e,t)=>new n(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},3354:(e,t,r)=>{"use strict";r.d(t,{u_:()=>l,w4:()=>d});var n=r(5508),i=r(8635),a=r(3496),o=r(2029),s=r(8116);function l(e){const t=(0,o.qk)(e),r=n.K3.parse(t).topNode,i={query:{labels:[],operations:[]},errors:[]};try{c(t,r,i)}catch(e){console.error(e),e instanceof Error&&i.errors.push({text:e.message})}return function(e){if(0===e.labels.length&&0===e.operations.length)return!0;return!1}(i.query)&&(i.errors=[]),i}function c(e,t,r){const i=r.query;switch(t.type.id){case n.g$:{i.labels.push(function(e,t){const r=t.getChild(n.gw),i=(0,o.AA)(e,r),a=(0,o.AA)(e,null==r?void 0:r.nextSibling);let s=(0,o.AA)(e,t.getChild(n.Qf));return s=s.substring(1,s.length-1),{label:i,op:a,value:s}}(e,t));const a=t.getChild(o.Ql);a&&r.errors.push((0,o.xz)(e,a));break}case n.PN:{const{operation:a,error:l}=function(e,t){var r;const i=(0,o.AA)(e,t.getChild(n.dJ)),a=d((0,o.AA)(e,t.getChild(n.Qf))),l=null===(r=t.getChild(n.w7))||void 0===r?void 0:r.getChild(n.Ip);if(l)return{operation:{id:s.EF.LineFilterIpMatches,params:[i,a]}};const c=[a];let u=t.getChild(n.ih);for(;u;)c.push(d((0,o.AA)(e,u.getChild(n.Qf)))),u=u.getChild(n.ih);return{operation:{id:{"|=":s.EF.LineContains,"!=":s.EF.LineContainsNot,"|~":s.EF.LineMatchesRegex,"!~":s.EF.LineMatchesRegexNot}[i],params:c}}}(e,t);a&&i.operations.push(a),l&&r.errors.push(f(e,t,l));break}case n.iT:i.operations.push(function(e,t){const r=t.firstChild,i=(0,o.AA)(e,r),s=d((0,o.AA)(e,t.getChild(n.Qf)));let l=s?[s]:[];const c=(0,a.mD)(i);c&&!(0,a.VI)(c,l)&&(l=(null==c?void 0:c.defaultParams)||[]);return{id:i,params:l}}(e,t));break;case n.bY:{const{operation:a,error:l}=function(e,t){if(t.getChild(n.Or)||t.getChild(n.KD)||t.getChild("Comma"))return{error:'Label filter with comma, "and", "or" not supported in query builder'};if(t.firstChild.type.id===n.GA){const r=t.firstChild,i=null==r?void 0:r.getChild(n.gw),a=null==i?void 0:i.nextSibling,l=null==r?void 0:r.getChild(n.Qf),c=d((0,o.AA)(e,l));return{operation:{id:s.EF.LabelFilterIpMatches,params:[(0,o.AA)(e,i),(0,o.AA)(e,a),c]}}}const r=s.EF.LabelFilter;if(t.firstChild.type.id===n.Jq){const n=t.firstChild.firstChild.firstChild,i=n.nextSibling,a=i.nextSibling,s=d((0,o.AA)(e,a));return{operation:{id:r,params:[(0,o.AA)(e,n),(0,o.AA)(e,i),s]}}}const i=t.firstChild,a=i.firstChild,l=a.nextSibling,c=l.nextSibling,u=[(0,o.AA)(e,a),(0,o.AA)(e,l),d((0,o.AA)(e,c))];if("__error__="===u.join(""))return{operation:{id:s.EF.LabelFilterNoErrors,params:[]}};return{operation:{id:r,params:u}}}(e,t);a&&i.operations.push(a),l&&r.errors.push(f(e,t,l));break}case n.eF:i.operations.push(function(e,t){const r=t.getChild(n.LM),i=(0,o.AA)(e,r),a=[...(0,o.R1)(e,t,n.Gn)];return{id:i,params:a}}(e,t));break;case n.Zj:case n.Tz:{const{operation:a,error:l}=function(e,t){const r=[],i=[];let a;const l=t.from;t.toTree().iterate({enter:t=>{t.type.id===n.ov?r.push(e.substring(t.from+l,t.to+l)):t.type.id===n.Gn?i.push(e.substring(t.from+l,t.to+l)):t.type.id===o.Ql&&(a=`Unexpected string "${e.substring(t.from+l,t.to+l)}"`)}});const c={id:s.EF.Logfmt,params:[r.includes("--strict"),r.includes("--keep-empty"),...i]};return{operation:c,error:a}}(e,t);a&&i.operations.push(a),l&&r.errors.push(f(e,t,l));break}case n.pH:i.operations.push(function(e,t){const r=s.EF.LineFormat,i=d((0,o.AA)(e,t.getChild(n.Qf)));return{id:r,params:[i]}}(e,t));break;case n.e_:i.operations.push(function(e,t){const r=s.EF.LabelFormat,i=t.getChild(n.gw),a=i.nextSibling.nextSibling;return{id:r,params:[(0,o.AA)(e,a),d((0,o.AA)(e,i))]}}(e,t));break;case n.HV:{const{operation:a,error:l}=function(e,t,r){const i=t.getChild(n.HV),a=t.getChild(n.bY),l=t.getChild(n.sK);i&&c(e,i,r);a&&c(e,a,r);if(l){var u;if((null===(u=l.nextSibling)||void 0===u?void 0:u.type.id)===n.yW){const t=l.nextSibling,r=t.nextSibling;return{operation:{id:s.EF.Unwrap,params:[(0,o.AA)(e,r),(0,o.AA)(e,t)]}}}return{operation:{id:s.EF.Unwrap,params:[(0,o.AA)(e,null==l?void 0:l.nextSibling),""]}}}return{}}(e,t,r);a&&i.operations.push(a),l&&r.errors.push(f(e,t,l));break}case n.Zg:i.operations.push({id:s.EF.Decolorize,params:[]});break;case n.h1:i.operations.push(function(e,t,r){const i=t.getChild(n.lo),a=(0,o.AA)(e,i),s=t.getChild(n.wN),l=t.getChild(n.xo),u=null!=s?[(0,o.AA)(e,s)]:[],d=null==l?void 0:l.getChild(n.Q6),p=d?(0,o.AA)(e,d):null,f=t.getChild(n.aU);p&&u.unshift(p.substring(1,p.length-1));f&&u.push(...(0,o.R1)(e,f,n.gw));const h={id:a,params:u};l&&c(e,l,r);return h}(e,t,r));break;case n.Rh:i.operations.push(function(e,t,r){var i;const a=t.getChild(n.ZQ);let s=(0,o.AA)(e,a);const l=t.getChild(n.aU),u=[],d=t.getChild(n.wN),p=null===(i=t.getChild(o.Ql))||void 0===i?void 0:i.getChild(n.gw);d?u.push(Number((0,o.AA)(e,d))):p&&u.push((0,o.AA)(e,p));if(l){l.getChild(n.By)&&s&&(s=`__${s}_by`);l.getChild(n.xB)&&(s=`__${s}_without`),u.push(...(0,o.R1)(e,l,n.gw))}const f=t.getChild(n.Yw),h={id:s,params:u};if(f){var g,m;if((null===(g=f.firstChild)||void 0===g?void 0:g.type.id)===n.MK)r.errors.push({text:"Query parsing is ambiguous.",from:f.firstChild.from,to:null===(m=f.firstChild)||void 0===m?void 0:m.to});c(e,f,r)}return h}(e,t,r));break;case n.MK:!function(e,t,r){const i=r.query,a=t.firstChild,s=(0,o.AA)(e,a.nextSibling),l=function(e,t){if(!t)return;const r=t.getChild(n.wT),i=t.getChild(n.x);if(!r&&i)return{isBool:!0,isMatcher:!1};var a;if(!r)return;return{isMatcher:!0,isBool:!!i,matches:(0,o.AA)(e,null===(a=r.getChild(n.x$))||void 0===a?void 0:a.getChild(n.qJ)),matchType:r.getChild(n.On)?"on":"ignoring"}}(e,t.getChild(n.o5)),d=t.lastChild,f=u[s],h=p(a,"MetricExpr.LiteralExpr.Number"),g=p(d,"MetricExpr.LiteralExpr.Number"),m=d.getChild(n.MK);h||c(e,a,r);if(g)i.operations.push((0,o.rq)(f,e,d,!!(null==l?void 0:l.isBool)));else if(m){const t=(0,o.z9)(d);(null==t?void 0:t.type.id)===n.wN&&i.operations.push((0,o.rq)(f,e,t,!!(null==l?void 0:l.isBool))),c(e,d,r)}else{i.binaryQueries=i.binaryQueries||[];const t={operator:s,query:{labels:[],operations:[]}};(null==l?void 0:l.isMatcher)&&(t.vectorMatchesType=l.matchType,t.vectorMatches=l.matches),i.binaryQueries.push(t),c(e,d,{query:t.query,errors:r.errors})}}(e,t,r);break;case o.Ql:if(function(e){var t;return(null==e||null===(t=e.parent)||void 0===t?void 0:t.type.id)===n.Q6}(t))break;r.errors.push((0,o.xz)(e,t));break;case n.i8:i.operations.push(function(e,t){const r=[];let i=t.getChild(n.LQ);for(;i;){const t=(0,o.AA)(e,i.getChild(n.yj));t&&r.push(t),i=null==i?void 0:i.getChild(n.LQ)}return r.reverse(),{id:s.EF.Drop,params:r}}(e,t));break;case n.UP:i.operations.push(function(e,t){const r=[];let i=t.getChild(n.J3);for(;i;){const t=(0,o.AA)(e,i.getChild(n.UM));t&&r.push(t),i=null==i?void 0:i.getChild(n.J3)}return r.reverse(),{id:s.EF.Keep,params:r}}(e,t));break;default:{let n=t.firstChild;for(;n;)c(e,n,r),n=n.nextSibling}}}const u=i.C.reduce(((e,t)=>(e[t.sign]={id:t.id,comparison:t.comparison},e)),{});function d(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):e.replace(/`/g,"")}function p(e,t){let r=e;const n=t.split(".");for(const e of n)if(r=r.getChild(e),!r)return null;return r}function f(e,t,r){const n=(0,o.xz)(e,t);return n.text=`${r}: ${n.text}`,n}},3440:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},3471:(e,t,r)=>{"use strict";r.d(t,{y:()=>u});var n=r(7781),i=r(1886),a=Object.defineProperty,o=(e,t,r)=>((e,t,r)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class s{constructor(e,t){o(this,"operationsRegistry"),o(this,"categories",[]),o(this,"innerQueryPlaceholder"),this.operationsRegistry=new n.Registry((()=>e)),this.innerQueryPlaceholder=t||"<query>"}setOperationCategories(e){this.categories=e}getOperationsForCategory(e){return this.operationsRegistry.list().filter((t=>t.category===e&&!t.hideFromList))}getAlternativeOperations(e){return this.operationsRegistry.list().filter((t=>t.alternativesKey&&t.alternativesKey===e))}getCategories(){return this.categories}getOperationDefinition(e){return this.operationsRegistry.getIfExists(e)}hasBinaryOp(e){return void 0!==e.operations.find((e=>{const t=this.getOperationDefinition(e.id);return(null==t?void 0:t.category)===i.T}))}}var l=r(3496),c=r(8116);const u=new class extends s{renderOperations(e,t){for(const r of t){if(r.disabled)continue;const t=this.operationsRegistry.getIfExists(r.id);t?e=t.renderer(r,t,e):console.error(`Could not find operation ${r.id} in the registry`)}return e}renderBinaryQueries(e,t){if(t)for(const r of t)e=`${this.renderBinaryQuery(e,r)}`;return e}renderBinaryQuery(e,t){let r=e+` ${t.operator} `;return t.vectorMatches&&(r+=`${t.vectorMatchesType}(${t.vectorMatches}) `),r+this.renderQuery(t.query,!0)}renderLabels(e){if(0===e.length)return"{}";let t="{";for(const r of e)"{"!==t&&(t+=", "),t+=`${r.label}${r.op}"${r.value}"`;return t+"}"}renderQuery(e,t){var r;let n=this.renderLabels(e.labels);return n=this.renderOperations(n,e.operations),!t&&this.hasBinaryOp(e)&&Boolean(null===(r=e.binaryQueries)||void 0===r?void 0:r.length)&&(n=`(${n})`),n=this.renderBinaryQueries(n,e.binaryQueries),n}getQueryPatterns(){return[{name:"Parse log lines with logfmt parser",type:c.IQ.Log,operations:[{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]}]},{name:"Parse log lines with JSON parser",type:c.IQ.Log,operations:[{id:c.EF.Json,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]}]},{name:"Filter log line and parse with logfmt parser",type:c.IQ.Log,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]}]},{name:"Filter log lines and parse with json parser",type:c.IQ.Log,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Json,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]}]},{name:"Parse log line with logfmt parser and use label filter",type:c.IQ.Log,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.LabelFilter,params:["label","=","value"]}]},{name:"Parse log lines with nested json",type:c.IQ.Log,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Json,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.LineFormat,params:["{{.message}}"]},{id:c.EF.Json,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]}]},{name:"Reformat log lines",type:c.IQ.Log,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.LineFormat,params:["{{.message}}"]}]},{name:"Rename lvl label to level",type:c.IQ.Log,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.LabelFormat,params:["lvl","level"]}]},{name:"Query on value inside a log line",type:c.IQ.Metric,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.Unwrap,params:[""]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.SumOverTime,params:["$__auto"]},{id:c.EF.Sum,params:[]}]},{name:"Total requests per label of streams",type:c.IQ.Metric,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.CountOverTime,params:["$__auto"]},{id:c.EF.Sum,params:[]}]},{name:"Total requests per parsed label or label of streams",type:c.IQ.Metric,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.CountOverTime,params:["$__auto"]},{id:c.EF.Sum,params:[]}]},{name:"Bytes used by a log stream",type:c.IQ.Metric,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.BytesOverTime,params:["$__auto"]}]},{name:"Count of log lines per stream",type:c.IQ.Metric,operations:[{id:c.EF.LineContains,params:[""]},{id:c.EF.CountOverTime,params:["$__auto"]}]},{name:"Top N results by label or parsed label",type:c.IQ.Metric,operations:[{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.CountOverTime,params:["$__auto"]},{id:c.EF.Sum,params:[]},{id:c.EF.TopK,params:[10]}]},{name:"Extracted quantile",type:c.IQ.Metric,operations:[{id:c.EF.Logfmt,params:[]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.Unwrap,params:["latency"]},{id:c.EF.LabelFilterNoErrors,params:[]},{id:c.EF.QuantileOverTime,params:["$__auto",.5]},{id:c.EF.Sum,params:[]}]}]}constructor(){super(l.sp,"<expr>"),this.setOperationCategories([c.Ln.Aggregations,c.Ln.RangeFunctions,c.Ln.Formats,c.Ln.BinaryOps,c.Ln.LabelFilters,c.Ln.LineFilters])}}},3496:(e,t,r)=>{"use strict";r.d(t,{VI:()=>b,y6:()=>g,mD:()=>m,sp:()=>h});var n=r(8635),i=r(9728),a=r(5959),o=r(7781),s=r(2007),l=r(4701),c=r(2954);function u(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function d(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){u(a,n,i,o,s,"next",e)}function s(e){u(a,n,i,o,s,"throw",e)}o(void 0)}))}}function p({onChange:e,index:t,operationId:r,value:n,query:u,datasource:p,timeRange:f,queryModeller:h}){const[g,m]=(0,a.useState)({});return(0,i.jsx)(s.Select,{inputId:(0,c.OS)(r,t),onOpenMenu:()=>d((function*(){m({isLoading:!0});const e=yield function(e,t,r){return d((function*(e,t,r,n=(0,o.getDefaultTimeRange)()){const i=r.renderQuery(e);if(!("getDataSamples"in t)||"function"!=typeof t.getDataSamples)return[];const a=yield t.getDataSamples({expr:i,refId:"unwrap_samples"},n,{convertMetricQueryToLogQuery:!0});return(0,l.aN)(a[0]).map((e=>({label:e,value:e})))})).apply(this,arguments)}(u,p,h,f);m({options:e,isLoading:void 0})}))(),isLoading:g.isLoading,allowCustomValue:!0,noOptionsMessage:"No labels found",loadingMessage:"Loading labels",options:g.options,value:n?(0,o.toOption)(n.toString()):null,onChange:r=>{r.value&&e(t,r.value)}})}var f=r(8116);const h=[...[f.EF.Sum,f.EF.Min,f.EF.Max,f.EF.Avg,f.EF.Stddev,f.EF.Stdvar,f.EF.Count].flatMap((e=>(0,c.G3)(e,{addOperationHandler:c.af,orderRank:f.h5.Last}))),...[f.EF.TopK,f.EF.BottomK].flatMap((e=>(0,c.jC)(e,{params:[{name:"K-value",type:"number"}],defaultParams:[5]},{addOperationHandler:c.af,orderRank:f.h5.Last}))),(0,c.fu)(f.EF.Rate),(0,c.fu)(f.EF.RateCounter),(0,c.fu)(f.EF.CountOverTime),(0,c.fu)(f.EF.SumOverTime),(0,c.fu)(f.EF.BytesRate),(0,c.fu)(f.EF.BytesOverTime),(0,c.fu)(f.EF.AbsentOverTime),...(0,c.yD)(f.EF.AvgOverTime),...(0,c.yD)(f.EF.MaxOverTime),...(0,c.yD)(f.EF.MinOverTime),...(0,c.yD)(f.EF.FirstOverTime),...(0,c.yD)(f.EF.LastOverTime),...(0,c.yD)(f.EF.StdvarOverTime),...(0,c.yD)(f.EF.StddevOverTime),...(0,c.yD)(f.EF.QuantileOverTime),{id:f.EF.Json,name:"Json",params:[{name:"Expression",type:"string",restParam:!0,optional:!0,minWidth:18,placeholder:'server="servers[0]"',description:"Using expressions with your json parser will extract only the specified json fields to labels. You can specify one or more expressions in this way. All expressions must be quoted."}],defaultParams:[],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.Parsers,renderer:c.EP,addOperationHandler:c.af,explainHandler:()=>"This will extract keys and values from a [json](https://grafana.com/docs/loki/latest/logql/log_queries/#json) formatted log line as labels. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation."},{id:f.EF.Logfmt,name:"Logfmt",params:[{name:"Strict",type:"boolean",optional:!0,description:"With strict parsing enabled, the logfmt parser immediately stops scanning the log line and returns early with an error when it encounters any poorly formatted key/value pair."},{name:"Keep empty",type:"boolean",optional:!0,description:"The logfmt parser retains standalone keys (keys without a value) as labels with its value set to empty string. "},{name:"Expression",type:"string",optional:!0,restParam:!0,minWidth:18,placeholder:"field_name",description:"Using expressions with your logfmt parser will extract and rename (if provided) only the specified fields to labels. You can specify one or more expressions in this way."}],defaultParams:[!1,!1],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.Parsers,renderer:c.EP,addOperationHandler:c.af,explainHandler:()=>"This will extract all keys and values from a [logfmt](https://grafana.com/docs/loki/latest/logql/log_queries/#logfmt) formatted log line as labels. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation."},{id:f.EF.Regexp,name:"Regexp",params:[{name:"String",type:"string",hideName:!0,placeholder:"<re>",description:"The regexp expression that matches the structure of a log line.",minWidth:20}],defaultParams:[""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.Parsers,renderer:(e,t,r)=>`${r} | regexp \`${e.params[0]}\``,addOperationHandler:c.af,explainHandler:()=>'The [regexp parser](https://grafana.com/docs/loki/latest/logql/log_queries/#regular-expression) takes a single parameter | regexp "<re>" which is the regular expression using the Golang RE2 syntax. The regular expression must contain a least one named sub-match (e.g (?P<name>re)), each sub-match will extract a different label. The expression matches the structure of a log line. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation.'},{id:f.EF.Pattern,name:"Pattern",params:[{name:"String",type:"string",hideName:!0,placeholder:"<pattern-expression>",description:"The expression that matches the structure of a log line.",minWidth:20}],defaultParams:[""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.Parsers,renderer:(e,t,r)=>`${r} | pattern \`${e.params[0]}\``,addOperationHandler:c.af,explainHandler:()=>"The [pattern parser](https://grafana.com/docs/loki/latest/logql/log_queries/#pattern) allows the explicit extraction of fields from log lines by defining a pattern expression (| pattern `<pattern-expression>`). The expression matches the structure of a log line. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation."},{id:f.EF.Unpack,name:"Unpack",params:[],defaultParams:[],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.Parsers,renderer:c.EP,addOperationHandler:c.af,explainHandler:()=>"This will extract all keys and values from a JSON log line, [unpacking](https://grafana.com/docs/loki/latest/logql/log_queries/#unpack) all embedded labels in the pack stage. The extracted labels can be used in label filter expressions and used as values for a range aggregation via the unwrap operation."},{id:f.EF.LineFormat,name:"Line format",params:[{name:"String",type:"string",hideName:!0,placeholder:"{{.status_code}}",description:"A line template that can refer to stream labels and extracted labels.",minWidth:20}],defaultParams:[""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.PipeOperations,renderer:(e,t,r)=>`${r} | line_format \`${e.params[0]}\``,addOperationHandler:c.af,explainHandler:()=>"This will replace log line using a specified template. The template can refer to stream labels and extracted labels.\n\nExample: `{{.status_code}} - {{.message}}`\n\n[Read the docs](https://grafana.com/docs/loki/latest/logql/log_queries/#line-format-expression) for more.\n "},{id:f.EF.LabelFormat,name:"Label format",params:[{name:"Label",type:"string"},{name:"Rename to",type:"string"}],defaultParams:["",""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.PipeOperations,renderer:(e,t,r)=>`${r} | label_format ${e.params[1]}=${e.params[0]}`,addOperationHandler:c.af,explainHandler:()=>'This will change name of label to desired new label. In the example below, label "error_level" will be renamed to "level".\n\nExample: ``error_level=`level` ``\n\n[Read the docs](https://grafana.com/docs/loki/latest/logql/log_queries/#labels-format-expression) for more.\n '},{id:f.EF.LineContains,name:"Line contains",params:[{name:"",type:"string",hideName:!0,restParam:!0,placeholder:"Text to find",description:"Find log lines that contains this text",minWidth:20,runQueryOnEnter:!0}],defaultParams:[""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(0,c.UF)("|="),addOperationHandler:c.af,explainHandler:e=>{var t;return`Return log lines that contain string \`${null===(t=e.params)||void 0===t?void 0:t.join("`, or `")}\`.`}},{id:f.EF.LineContainsNot,name:"Line does not contain",params:[{name:"",type:"string",hideName:!0,restParam:!0,placeholder:"Text to exclude",description:"Find log lines that does not contain this text",minWidth:26,runQueryOnEnter:!0}],defaultParams:[""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(0,c.UF)("!="),addOperationHandler:c.af,explainHandler:e=>{var t;return`Return log lines that does not contain string \`${null===(t=e.params)||void 0===t?void 0:t.join("`, or `")}\`.`}},{id:f.EF.LineContainsCaseInsensitive,name:"Line contains case insensitive",params:[{name:"",type:"string",hideName:!0,restParam:!0,placeholder:"Text to find",description:"Find log lines that contains this text",minWidth:33,runQueryOnEnter:!0}],defaultParams:[""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(0,c.UF)("|~",!0),addOperationHandler:c.af,explainHandler:e=>{var t;return`Return log lines that match regex \`(?i)${null===(t=e.params)||void 0===t?void 0:t.join("`, or `(?i)")}\`.`}},{id:f.EF.LineContainsNotCaseInsensitive,name:"Line does not contain case insensitive",params:[{name:"",type:"string",hideName:!0,restParam:!0,placeholder:"Text to exclude",description:"Find log lines that does not contain this text",minWidth:40,runQueryOnEnter:!0}],defaultParams:[""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(0,c.UF)("!~",!0),addOperationHandler:c.af,explainHandler:e=>{var t;return`Return log lines that does not match regex \`(?i)${null===(t=e.params)||void 0===t?void 0:t.join("`, or `(?i)")}\`.`}},{id:f.EF.LineMatchesRegex,name:"Line contains regex match",params:[{name:"",type:"string",hideName:!0,restParam:!0,placeholder:"Pattern to match",description:"Find log lines that match this regex pattern",minWidth:30,runQueryOnEnter:!0}],defaultParams:[""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(0,c.UF)("|~"),addOperationHandler:c.af,explainHandler:e=>{var t;return`Return log lines that match a \`RE2\` regex pattern. \`${null===(t=e.params)||void 0===t?void 0:t.join("`, or `")}\`.`}},{id:f.EF.LineMatchesRegexNot,name:"Line does not match regex",params:[{name:"",type:"string",hideName:!0,restParam:!0,placeholder:"Pattern to exclude",description:"Find log lines that does not match this regex pattern",minWidth:30,runQueryOnEnter:!0}],defaultParams:[""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(0,c.UF)("!~"),addOperationHandler:c.af,explainHandler:e=>{var t;return`Return log lines that doesn't match a \`RE2\` regex pattern. \`${null===(t=e.params)||void 0===t?void 0:t.join("`, or `")}\`.`}},{id:f.EF.LineFilterIpMatches,name:"IP line filter expression",params:[{name:"Operator",type:"string",minWidth:16,options:[f.NS.contains,f.NS.doesNotContain]},{name:"Pattern",type:"string",placeholder:"<pattern>",minWidth:16,runQueryOnEnter:!0}],defaultParams:["|=",""],toggleable:!0,alternativesKey:"line filter",category:f.Ln.LineFilters,orderRank:f.h5.LineFilters,renderer:(e,t,r)=>`${r} ${e.params[0]} ip(\`${e.params[1]}\`)`,addOperationHandler:c.af,explainHandler:e=>`Return log lines using IP matching of \`${e.params[1]}\``},{id:f.EF.LabelFilter,name:"Label filter expression",params:[{name:"Label",type:"string",minWidth:14},{name:"Operator",type:"string",minWidth:14,options:[f.NS.equals,f.NS.doesNotEqual,f.NS.matchesRegex,f.NS.doesNotMatchRegex,f.NS.greaterThan,f.NS.lessThan,f.NS.greaterThanOrEqual,f.NS.lessThanOrEqual]},{name:"Value",type:"string",minWidth:14}],defaultParams:["","=",""],toggleable:!0,alternativesKey:"label filter",category:f.Ln.LabelFilters,orderRank:f.h5.PipeOperations,renderer:c.sn,addOperationHandler:c.af,explainHandler:()=>"Label expression filter allows filtering using original and extracted labels."},{id:f.EF.LabelFilterIpMatches,name:"IP label filter expression",params:[{name:"Label",type:"string",minWidth:14},{name:"Operator",type:"string",minWidth:14,options:[f.NS.equals,f.NS.doesNotEqual]},{name:"Value",type:"string",minWidth:14}],defaultParams:["","=",""],toggleable:!0,alternativesKey:"label filter",category:f.Ln.LabelFilters,orderRank:f.h5.PipeOperations,renderer:(e,t,r)=>`${r} | ${e.params[0]} ${e.params[1]} ip(\`${e.params[2]}\`)`,addOperationHandler:c.af,explainHandler:e=>`Return log lines using IP matching of \`${e.params[2]}\` for \`${e.params[0]}\` label`},{id:f.EF.LabelFilterNoErrors,name:"No pipeline errors",params:[],defaultParams:[],toggleable:!0,alternativesKey:"label filter",category:f.Ln.LabelFilters,orderRank:f.h5.NoErrors,renderer:(e,t,r)=>`${r} | __error__=\`\``,addOperationHandler:c.af,explainHandler:()=>"Filter out all formatting and parsing errors."},{id:f.EF.Unwrap,name:"Unwrap",params:[{name:"Identifier",type:"string",hideName:!0,minWidth:16,placeholder:"Label key",editor:p},{name:"Conversion function",hideName:!0,type:"string",options:["duration","duration_seconds","bytes"],optional:!0}],defaultParams:["",""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.Unwrap,renderer:(e,t,r)=>`${r} | unwrap ${e.params[1]?`${e.params[1]}(${e.params[0]})`:e.params[0]}`,addOperationHandler:c.af,explainHandler:e=>{let t=String(e.params[0]).length>0?e.params[0]:"<label>";return`Use the extracted label \`${t}\` as sample values instead of log lines for the subsequent range aggregation.${e.params[1]?` Conversion function \`${e.params[1]}\` wrapping \`${t}\` will attempt to convert this label from a specific format (e.g. 3k, 500ms).`:""}`}},{id:f.EF.Decolorize,name:"Decolorize",params:[],defaultParams:[],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.PipeOperations,renderer:(e,t,r)=>`${r} | decolorize`,addOperationHandler:c.af,explainHandler:()=>"This will remove ANSI color codes from log lines."},{id:f.EF.Drop,name:"Drop",params:[{name:"Label",type:"string",restParam:!0,optional:!0,minWidth:18,placeholder:'job="grafana"',description:"Specify labels or expressions to drop."}],defaultParams:[""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.PipeOperations,renderer:c.EP,addOperationHandler:c.af,explainHandler:()=>"The drop expression will drop the given labels in the pipeline."},{id:f.EF.Keep,name:"Keep",params:[{name:"Label",type:"string",restParam:!0,optional:!0,minWidth:18,placeholder:'job="grafana"',description:"Specify labels or expressions to keep."}],defaultParams:[""],toggleable:!0,alternativesKey:"format",category:f.Ln.Formats,orderRank:f.h5.PipeOperations,renderer:c.EP,addOperationHandler:c.af,explainHandler:()=>"The keep expression will keep only the specified labels in the pipeline and drop all the other labels."},...n.I,{id:f.EF.NestedQuery,name:"Binary operation with query",params:[],defaultParams:[],toggleable:!0,category:f.Ln.BinaryOps,renderer:(e,t,r)=>r,addOperationHandler:c.VR}];function g(e){var t;const r=h.find((t=>t.id===e));return((null==r||null===(t=r.explainHandler)||void 0===t?void 0:t.call(r,{id:"",params:["<value>"]}))||"").replace(/\[(.*)\]\(.*\)/g,"$1")}function m(e){return h.find((t=>t.id===e))}function b(e,t){return!(t.length<e.params.filter((e=>!e.optional)).length)}},3559:(e,t,r)=>{"use strict";const n=r(7565);e.exports=(e,t)=>e.sort(((e,r)=>n(e,r,t)))},3632:(e,t,r)=>{var n=r(6424),i=r(7134),a=r(6665),o=r(9834);e.exports=function(e,t,r){if(!o(r))return!1;var s=typeof t;return!!("number"==s?i(r)&&a(t,r.length):"string"==s&&t in r)&&n(r[t],e)}},3662:(e,t,r)=>{var n=r(7248),i=r(9834),a=r(7386),o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||l.test(e)?c(e.slice(2),r?2:8):o.test(e)?NaN:+e}},3761:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},3790:(e,t,r)=>{var n=r(6791),i=r(6504),a=r(7134);e.exports=function(e){return a(e)?n(e):i(e)}},3833:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>n(e,t,r)>=0},4256:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},4264:(e,t,r)=>{e=r.nmd(e);var n=r(9965),i=r(9375),a=t&&!t.nodeType&&t,o=a&&e&&!e.nodeType&&e,s=o&&o.exports===a?n.Buffer:void 0,l=(s?s.isBuffer:void 0)||i;e.exports=l},4363:(e,t,r)=>{var n=r(1866),i=r(3248),a=r(9834),o=r(3761),s=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,u=l.toString,d=c.hasOwnProperty,p=RegExp("^"+u.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!a(e)||i(e))&&(n(e)?p:s).test(o(e))}},4377:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(9157)),i=a(r(3202));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s,l=["ABS","ACTIVATE","ALIAS","ALL","ALLOCATE","ALLOW","ALTER","ANY","ARE","ARRAY","AS","ASC","ASENSITIVE","ASSOCIATE","ASUTIME","ASYMMETRIC","AT","ATOMIC","ATTRIBUTES","AUDIT","AUTHORIZATION","AUX","AUXILIARY","AVG","BEFORE","BEGIN","BETWEEN","BIGINT","BINARY","BLOB","BOOLEAN","BOTH","BUFFERPOOL","BY","CACHE","CALL","CALLED","CAPTURE","CARDINALITY","CASCADED","CASE","CAST","CCSID","CEIL","CEILING","CHAR","CHARACTER","CHARACTER_LENGTH","CHAR_LENGTH","CHECK","CLOB","CLONE","CLOSE","CLUSTER","COALESCE","COLLATE","COLLECT","COLLECTION","COLLID","COLUMN","COMMENT","COMMIT","CONCAT","CONDITION","CONNECT","CONNECTION","CONSTRAINT","CONTAINS","CONTINUE","CONVERT","CORR","CORRESPONDING","COUNT","COUNT_BIG","COVAR_POP","COVAR_SAMP","CREATE","CROSS","CUBE","CUME_DIST","CURRENT","CURRENT_DATE","CURRENT_DEFAULT_TRANSFORM_GROUP","CURRENT_LC_CTYPE","CURRENT_PATH","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SERVER","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_TRANSFORM_GROUP_FOR_TYPE","CURRENT_USER","CURSOR","CYCLE","DATA","DATABASE","DATAPARTITIONNAME","DATAPARTITIONNUM","DATE","DAY","DAYS","DB2GENERAL","DB2GENRL","DB2SQL","DBINFO","DBPARTITIONNAME","DBPARTITIONNUM","DEALLOCATE","DEC","DECIMAL","DECLARE","DEFAULT","DEFAULTS","DEFINITION","DELETE","DENSERANK","DENSE_RANK","DEREF","DESCRIBE","DESCRIPTOR","DETERMINISTIC","DIAGNOSTICS","DISABLE","DISALLOW","DISCONNECT","DISTINCT","DO","DOCUMENT","DOUBLE","DROP","DSSIZE","DYNAMIC","EACH","EDITPROC","ELEMENT","ELSE","ELSEIF","ENABLE","ENCODING","ENCRYPTION","END","END-EXEC","ENDING","ERASE","ESCAPE","EVERY","EXCEPTION","EXCLUDING","EXCLUSIVE","EXEC","EXECUTE","EXISTS","EXIT","EXP","EXPLAIN","EXTENDED","EXTERNAL","EXTRACT","FALSE","FENCED","FETCH","FIELDPROC","FILE","FILTER","FINAL","FIRST","FLOAT","FLOOR","FOR","FOREIGN","FREE","FULL","FUNCTION","FUSION","GENERAL","GENERATED","GET","GLOBAL","GOTO","GRANT","GRAPHIC","GROUP","GROUPING","HANDLER","HASH","HASHED_VALUE","HINT","HOLD","HOUR","HOURS","IDENTITY","IF","IMMEDIATE","IN","INCLUDING","INCLUSIVE","INCREMENT","INDEX","INDICATOR","INDICATORS","INF","INFINITY","INHERIT","INNER","INOUT","INSENSITIVE","INSERT","INT","INTEGER","INTEGRITY","INTERSECTION","INTERVAL","INTO","IS","ISOBID","ISOLATION","ITERATE","JAR","JAVA","KEEP","KEY","LABEL","LANGUAGE","LARGE","LATERAL","LC_CTYPE","LEADING","LEAVE","LEFT","LIKE","LINKTYPE","LN","LOCAL","LOCALDATE","LOCALE","LOCALTIME","LOCALTIMESTAMP","LOCATOR","LOCATORS","LOCK","LOCKMAX","LOCKSIZE","LONG","LOOP","LOWER","MAINTAINED","MATCH","MATERIALIZED","MAX","MAXVALUE","MEMBER","MERGE","METHOD","MICROSECOND","MICROSECONDS","MIN","MINUTE","MINUTES","MINVALUE","MOD","MODE","MODIFIES","MODULE","MONTH","MONTHS","MULTISET","NAN","NATIONAL","NATURAL","NCHAR","NCLOB","NEW","NEW_TABLE","NEXTVAL","NO","NOCACHE","NOCYCLE","NODENAME","NODENUMBER","NOMAXVALUE","NOMINVALUE","NONE","NOORDER","NORMALIZE","NORMALIZED","NOT","NULL","NULLIF","NULLS","NUMERIC","NUMPARTS","OBID","OCTET_LENGTH","OF","OFFSET","OLD","OLD_TABLE","ON","ONLY","OPEN","OPTIMIZATION","OPTIMIZE","OPTION","ORDER","OUT","OUTER","OVER","OVERLAPS","OVERLAY","OVERRIDING","PACKAGE","PADDED","PAGESIZE","PARAMETER","PART","PARTITION","PARTITIONED","PARTITIONING","PARTITIONS","PASSWORD","PATH","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","PIECESIZE","PLAN","POSITION","POWER","PRECISION","PREPARE","PREVVAL","PRIMARY","PRIQTY","PRIVILEGES","PROCEDURE","PROGRAM","PSID","PUBLIC","QUERY","QUERYNO","RANGE","RANK","READ","READS","REAL","RECOVERY","RECURSIVE","REF","REFERENCES","REFERENCING","REFRESH","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","RELEASE","RENAME","REPEAT","RESET","RESIGNAL","RESTART","RESTRICT","RESULT","RESULT_SET_LOCATOR","RETURN","RETURNS","REVOKE","RIGHT","ROLE","ROLLBACK","ROLLUP","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_UP","ROUND_UP","ROUTINE","ROW","ROWNUMBER","ROWS","ROWSET","ROW_NUMBER","RRN","RUN","SAVEPOINT","SCHEMA","SCOPE","SCRATCHPAD","SCROLL","SEARCH","SECOND","SECONDS","SECQTY","SECURITY","SENSITIVE","SEQUENCE","SESSION","SESSION_USER","SIGNAL","SIMILAR","SIMPLE","SMALLINT","SNAN","SOME","SOURCE","SPECIFIC","SPECIFICTYPE","SQL","SQLEXCEPTION","SQLID","SQLSTATE","SQLWARNING","SQRT","STACKED","STANDARD","START","STARTING","STATEMENT","STATIC","STATMENT","STAY","STDDEV_POP","STDDEV_SAMP","STOGROUP","STORES","STYLE","SUBMULTISET","SUBSTRING","SUM","SUMMARY","SYMMETRIC","SYNONYM","SYSFUN","SYSIBM","SYSPROC","SYSTEM","SYSTEM_USER","TABLE","TABLESAMPLE","TABLESPACE","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRANSACTION","TRANSLATE","TRANSLATION","TREAT","TRIGGER","TRIM","TRUE","TRUNCATE","TYPE","UESCAPE","UNDO","UNIQUE","UNKNOWN","UNNEST","UNTIL","UPPER","USAGE","USER","USING","VALIDPROC","VALUE","VARCHAR","VARIABLE","VARIANT","VARYING","VAR_POP","VAR_SAMP","VCAT","VERSION","VIEW","VOLATILE","VOLUMES","WHEN","WHENEVER","WHILE","WIDTH_BUCKET","WINDOW","WITH","WITHIN","WITHOUT","WLM","WRITE","XMLELEMENT","XMLEXISTS","XMLNAMESPACES","YEAR","YEARS"],c=["ADD","AFTER","ALTER COLUMN","ALTER TABLE","DELETE FROM","EXCEPT","FETCH FIRST","FROM","GROUP BY","GO","HAVING","INSERT INTO","INTERSECT","LIMIT","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UPDATE","VALUES","WHERE"],u=["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],d=["AND","CROSS JOIN","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN"],p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=t}var t,r,a;return t=e,(r=[{key:"format",value:function(e){return s||(s=new i.default({reservedWords:l,reservedTopLevelWords:c,reservedNewlineWords:d,reservedTopLevelWordsNoIndent:u,stringTypes:['""',"''","``","[]"],openParens:["("],closeParens:[")"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:[":"],lineCommentTypes:["--"],specialWordChars:["#","@"]})),new n.default(this.cfg,s).format(e)}}])&&o(t.prototype,r),a&&o(t,a),e}();t.default=p,e.exports=t.default},4624:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>n(e,t,r)<=0},4701:(e,t,r)=>{"use strict";r.d(t,{Ac:()=>l,nE:()=>s,db:()=>p,fV:()=>u,sz:()=>f,YB:()=>c,aN:()=>d,BY:()=>h});var n=r(7781),i=r(7895);const a=/(?:^|\s)([\w\(\)\[\]\{\}]+)=(""|(?:".*?[^\\]"|[^"\s]\S*))/;var o=r(9107);function s(e){var t,r;return(null!==(r=null===(t=e.fields.find((e=>"labels"===e.name)))||void 0===t?void 0:t.values)&&void 0!==r?r:[]).some((e=>void 0!==e.__error__))}function l(e){var t,r;return(null!==(r=null===(t=e.fields.find((e=>"labels"===e.name)))||void 0===t?void 0:t.values)&&void 0!==r?r:[]).some((e=>void 0!==e.level))}function c(e){const t=e.fields.find((e=>e.type===n.FieldType.string));if(null==t)return{hasJSON:!1,hasLogfmt:!1,hasPack:!1};const r=t.values;let i=!1,o=!1,s=!1;return r.forEach((e=>{(function(e){let t;try{t=JSON.parse(e)}catch(e){}return"object"==typeof t})(e)&&(i=!0,s=function(e){let t;try{return t=JSON.parse(e),t.hasOwnProperty("_entry")}catch(e){return!1}}(e)),function(e){return a.test(e)}(e)&&(o=!0)})),{hasLogfmt:o,hasJSON:i,hasPack:s}}function u(e,t=o.HD.Indexed){var r,n,a,s,l;const c=null!==(l=null==e||null===(n=e.fields)||void 0===n||null===(r=n.find((e=>"labels"===e.name)))||void 0===r?void 0:r.values)&&void 0!==l?l:[];var u;const d=null!==(u=null==e||null===(s=e.fields)||void 0===s||null===(a=s.find((e=>"labelTypes"===e.name)))||void 0===a?void 0:a.values)&&void 0!==u?u:[];if(!(null==c?void 0:c.length))return[];if(!(null==d?void 0:d.length)){if(t===o.HD.Indexed){const{keys:e}=(0,i.P7)(c);return e}return[]}let p=new Set;for(let e=0;e<c.length;e++){const r=c[e],n=d[e],i=Object.keys(r).filter((e=>n[e]===t));p=new Set([...p,...i])}return Array.from(p)}function d(e){var t,r,a;const o=null!==(a=null==e||null===(r=e.fields)||void 0===r||null===(t=r.find((e=>"labels"===e.name)))||void 0===t?void 0:t.values)&&void 0!==a?a:[];if(!(null==o?void 0:o.length))return[];return Object.keys(o[0]).filter((e=>{const t=o[0][e];return!!t&&(!isNaN(Number(t))||(0,n.isValidGoDuration)(t)||(0,i.tY)(t))})).filter((e=>o.every((t=>t[e]))))}function p(e){const t=e.fields.find((e=>"labels"===e.name&&e.type===n.FieldType.other));if(null==t)return!1;return t.values.some((e=>e.__error__))}function f(e){const t=e.fields.find((e=>"labels"===e.name&&e.type===n.FieldType.other));if(null==t)return null;const r=t.values.slice(0,2);let i=null;for(let e of r){const t=Object.keys(e).find((e=>"level"===e||"detected_level"===e||"lvl"===e||e.includes("level")));if(t){i=t;break}}return i}function h(e){var t,r,n;const i=e.errors?(null!==(r=e.errors[0].message)&&void 0!==r?r:"").toLowerCase():null!==(n=null===(t=e.error)||void 0===t?void 0:t.message)&&void 0!==n?n:"";if(i.includes("timeout"))return!0;if(e.data.length>0&&e.data[0].fields.length>0)return!1;throw new Error(i)}},4708:(e,t,r)=>{"use strict";const n=r(1064),{MAX_LENGTH:i,MAX_SAFE_INTEGER:a}=r(2074),{safeRe:o,t:s}=r(5750),l=r(9547),{compareIdentifiers:c}=r(1427);class u{constructor(e,t){if(t=l(t),e instanceof u){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[s.LOOSE]:o[s.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<a)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof u)){if("string"==typeof e&&e===this.version)return 0;e=new u(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof u||(e=new u(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof u||(e=new u(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],i=e.prerelease[t];if(n("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return c(r,i)}while(++t)}compareBuild(e){e instanceof u||(e=new u(e,this.options));let t=0;do{const r=this.build[t],i=e.build[t];if(n("build compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return c(r,i)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?o[s.PRERELEASELOOSE]:o[s.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===c(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=u},4899:e=>{var t="undefined"!=typeof Element,r="function"==typeof Map,n="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(e,o){if(e===o)return!0;if(e&&o&&"object"==typeof e&&"object"==typeof o){if(e.constructor!==o.constructor)return!1;var s,l,c,u;if(Array.isArray(e)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(!a(e[l],o[l]))return!1;return!0}if(r&&e instanceof Map&&o instanceof Map){if(e.size!==o.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!o.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!a(l.value[1],o.get(l.value[0])))return!1;return!0}if(n&&e instanceof Set&&o instanceof Set){if(e.size!==o.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!o.has(l.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(o)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(e[l]!==o[l])return!1;return!0}if(e.constructor===RegExp)return e.source===o.source&&e.flags===o.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===o.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===o.toString();if((s=(c=Object.keys(e)).length)!==Object.keys(o).length)return!1;for(l=s;0!=l--;)if(!Object.prototype.hasOwnProperty.call(o,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=s;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!a(e[c[l]],o[c[l]]))return!1;return!0}return e!=e&&o!=o}e.exports=function(e,t){try{return a(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},4913:e=>{var t=Array.isArray;e.exports=t},4952:(e,t,r)=>{"use strict";const n=r(4256);e.exports=(e,t)=>{const r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(0===a)return null;const o=a>0,s=o?r:i,l=o?i:r,c=!!s.prerelease.length;if(!!l.prerelease.length&&!c){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(s))return l.minor&&!l.patch?"minor":"patch"}const u=c?"pre":"";return r.major!==i.major?u+"major":r.minor!==i.minor?u+"minor":r.patch!==i.patch?u+"patch":"prerelease"}},4991:(e,t,r)=>{"use strict";const n=r(1409),i=r(6031),a=r(9308),o=r(3833),s=r(2083),l=r(4624);e.exports=(e,t,r,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,c);case"!=":return i(e,r,c);case">":return a(e,r,c);case">=":return o(e,r,c);case"<":return s(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}}},5087:(e,t,r)=>{var n=r(9653),i=r(277),a=r(1977),o=a&&a.isTypedArray,s=o?i(o):n;e.exports=s},5196:(e,t,r)=>{var n=r(3070),i=r(9466),a=Object.prototype,o=a.hasOwnProperty,s=a.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return i(e)&&o.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},5229:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t)=>new n(e,t).patch},5240:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},5455:(e,t,r)=>{var n=r(2062)(r(9965),"Map");e.exports=n},5508:(e,t,r)=>{"use strict";r.d(t,{KD:()=>ge,MK:()=>ht,o5:()=>gt,x:()=>ue,By:()=>fe,yW:()=>ut,Zg:()=>pe,yj:()=>et,LQ:()=>Je,i8:()=>Ze,dw:()=>We,GN:()=>ye,dJ:()=>Le,w7:()=>Ne,aU:()=>dt,qJ:()=>vt,x$:()=>bt,gw:()=>we,Ip:()=>De,GA:()=>qe,LM:()=>se,eF:()=>Me,UM:()=>nt,J3:()=>rt,UP:()=>tt,Gn:()=>Qe,I4:()=>Be,bY:()=>Ve,J_:()=>Ye,e_:()=>Ke,iT:()=>Fe,uk:()=>be,PN:()=>Ae,CX:()=>Ie,pH:()=>He,Nl:()=>Xe,UK:()=>Oe,K0:()=>ve,xo:()=>st,c$:()=>le,Tz:()=>Ue,Zj:()=>$e,g$:()=>Se,sq:()=>xe,Yw:()=>it,wN:()=>ze,On:()=>de,wT:()=>mt,Or:()=>me,ih:()=>ke,ov:()=>je,Sg:()=>Ce,q5:()=>_e,AL:()=>Re,t3:()=>Pe,Q6:()=>lt,h1:()=>at,lo:()=>ot,MD:()=>Ee,Qf:()=>Te,Jq:()=>Ge,sK:()=>ce,HV:()=>ct,Rh:()=>pt,ZQ:()=>ft,xB:()=>he,K3:()=>oe});const n=1024;let i=0;class a{constructor(e,t){this.from=e,this.to=t}}class o{constructor(e={}){this.id=i++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=c.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}o.closedBy=new o({deserialize:e=>e.split(" ")}),o.openedBy=new o({deserialize:e=>e.split(" ")}),o.group=new o({deserialize:e=>e.split(" ")}),o.isolate=new o({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),o.contextHash=new o({perNode:!0}),o.lookAhead=new o({perNode:!0}),o.mounted=new o({perNode:!0});class s{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[o.mounted.id]}}const l=Object.create(null);class c{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):l,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new c(e.name||"",t,e.id,r);if(e.props)for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(o.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(o.group),n=-1;n<(r?r.length:0);n++){let i=t[n<0?e.name:r[n]];if(i)return i}}}}c.none=new c("",Object.create(null),0,8);class u{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let t of e){let e=t(r);e&&(n||(n=Object.assign({},r.props)),n[e[0].id]=e[1])}t.push(n?new c(r.name,n,r.id,r.flags):r)}return new u(t)}}const d=new WeakMap,p=new WeakMap;var f;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(f||(f={}));class h{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=s.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let r=e.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new P(this.topNode,e)}cursorAt(e,t=0,r=0){let n=d.get(this)||this.topNode,i=new P(n);return i.moveTo(e,t),d.set(this,i._tree),i}get topNode(){return new O(this,0,0,null)}resolve(e,t=0){let r=v(d.get(this)||this.topNode,e,t,!1);return d.set(this,r),r}resolveInner(e,t=0){let r=v(p.get(this)||this.topNode,e,t,!0);return p.set(this,r),r}resolveStack(e,t=0){return function(e,t,r){let n=e.resolveInner(t,r),i=null;for(let e=n instanceof O?n:n.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||(i=[n])).push(a.resolve(t,r)),e=a}else{let a=s.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new O(a.tree,a.overlay[0].from+e.from,-1,e);(i||(i=[n])).push(v(o,t,r,!1))}}return i?T(i):n}(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e,a=e.mode||0,o=(a&f.IncludeAnonymous)>0;for(let e=this.cursor(a|f.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=n&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;a=!0}for(;a&&r&&(o||!e.type.isAnonymous)&&r(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:C(c.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,r)=>new h(this.type,e,t,r,this.propValues)),e.makeTree||((e,t,r)=>new h(c.none,e,t,r)))}static build(e){return function(e){var t;let{buffer:r,nodeSet:i,maxBufferLength:a=n,reused:s=[],minRepeatType:l=i.types.length}=e,c=Array.isArray(r)?new g(r,r.length):r,u=i.types,d=0,p=0;function f(e,t,r,n,o,h){let{id:g,start:S,end:w,size:T}=c,R=p,P=d;for(;T<0;){if(c.next(),-1==T){let t=s[g];return r.push(t),void n.push(S-e)}if(-3==T)return void(d=g);if(-4==T)return void(p=g);throw new RangeError(`Unrecognized record size: ${T}`)}let I,A,L=u[g],_=S-e;if(w-S<=a&&(A=E(c.pos-t,o))){let t=new Uint16Array(A.size-A.skip),r=c.pos-A.size,n=t.length;for(;c.pos>r;)n=x(A.start,t,n);I=new m(t,w-A.start,i),_=A.start-e}else{let e=c.pos-T;c.next();let t=[],r=[],n=g>=l?g:-1,i=0,o=w;for(;c.pos>e;)n>=0&&c.id==n&&c.size>=0?(c.end<=o-a&&(y(t,r,S,i,c.end,o,n,R,P),i=t.length,o=c.end),c.next()):h>2500?b(S,e,t,r):f(S,e,t,r,n,h+1);if(n>=0&&i>0&&i<t.length&&y(t,r,S,i,S,o,n,R,P),t.reverse(),r.reverse(),n>-1&&i>0){let e=v(L,P);I=C(L,t,r,0,t.length,0,w-S,e,e)}else I=O(L,t,r,w-S,R-w,P)}r.push(I),n.push(_)}function b(e,t,r,n){let o=[],s=0,l=-1;for(;c.pos>t;){let{id:e,start:t,end:r,size:n}=c;if(n>4)c.next();else{if(l>-1&&t<l)break;l<0&&(l=r-a),o.push(e,t,r),s++,c.next()}}if(s){let t=new Uint16Array(4*s),a=o[o.length-2];for(let e=o.length-3,r=0;e>=0;e-=3)t[r++]=o[e],t[r++]=o[e+1]-a,t[r++]=o[e+2]-a,t[r++]=r;r.push(new m(t,o[2]-a,i)),n.push(a-e)}}function v(e,t){return(r,n,i)=>{let a,s,l=0,c=r.length-1;if(c>=0&&(a=r[c])instanceof h){if(!c&&a.type==e&&a.length==i)return a;(s=a.prop(o.lookAhead))&&(l=n[c]+a.length+s)}return O(e,r,n,i,l,t)}}function y(e,t,r,n,a,o,s,l,c){let u=[],d=[];for(;e.length>n;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(O(i.types[s],u,d,o-a,l-o,c)),t.push(a-r)}function O(e,t,r,n,i,a,s){if(a){let e=[o.contextHash,a];s=s?[e].concat(s):[e]}if(i>25){let e=[o.lookAhead,i];s=s?[e].concat(s):[e]}return new h(e,t,r,n,s)}function E(e,t){let r=c.fork(),n=0,i=0,o=0,s=r.end-a,u={size:0,start:0,skip:0};e:for(let a=r.pos-e;r.pos>a;){let e=r.size;if(r.id==t&&e>=0){u.size=n,u.start=i,u.skip=o,o+=4,n+=4,r.next();continue}let c=r.pos-e;if(e<0||c<a||r.start<s)break;let d=r.id>=l?4:0,p=r.start;for(r.next();r.pos>c;){if(r.size<0){if(-3!=r.size)break e;d+=4}else r.id>=l&&(d+=4);r.next()}i=p,n+=e,o+=d}return(t<0||n==e)&&(u.size=n,u.start=i,u.skip=o),u.size>4?u:void 0}function x(e,t,r){let{id:n,start:i,end:a,size:o}=c;if(c.next(),o>=0&&n<l){let s=r;if(o>4){let n=c.pos-(o-4);for(;c.pos>n;)r=x(e,t,r)}t[--r]=s,t[--r]=a-e,t[--r]=i-e,t[--r]=n}else-3==o?d=n:-4==o&&(p=n);return r}let S=[],w=[];for(;c.pos>0;)f(e.start||0,e.bufferStart||0,S,w,-1,0);let T=null!==(t=e.length)&&void 0!==t?t:S.length?w[0]+S[0].length:0;return new h(u[e.topID],S.reverse(),w.reverse(),T)}(e)}}h.empty=new h(c.none,[],[],0);class g{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new g(this.buffer,this.index)}}class m{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return c.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let a=[];for(;e<r;)a.push(this.childString(e)),e=this.buffer[e+3];return i+"("+a.join(",")+")"}findChild(e,t,r,n,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(b(i,n,a[s+1],a[s+2])&&(o=s,r>0));s=a[s+3]);return o}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),a=0;for(let o=e,s=0;o<t;){i[s++]=n[o++],i[s++]=n[o++]-r;let t=i[s++]=n[o++]-r;i[s++]=n[o++]-e,a=Math.max(a,t)}return new m(i,a,this.set)}}function b(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function v(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof O&&e.index<0?null:e.parent;if(!t)return e;e=t}let a=n?0:f.IgnoreOverlays;if(n)for(let n=e,o=n.parent;o;n=o,o=n.parent)n instanceof O&&n.index<0&&(null===(i=o.enter(t,r,a))||void 0===i?void 0:i.from)!=n.from&&(e=o);for(;;){let n=e.enter(t,r,a);if(!n)return e;e=n}}class y{cursor(e=0){return new P(this,e)}getChild(e,t=null,r=null){let n=E(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return E(this,e,t,r)}resolve(e,t=0){return v(this,e,t,!1)}resolveInner(e,t=0){return v(this,e,t,!0)}matchContext(e){return x(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(r=t,t=e.prevSibling):t=e}return r}get node(){return this}get next(){return this.parent}}class O extends y{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,i=0){for(let a=this;;){for(let{children:o,positions:l}=a._tree,c=t>0?o.length:-1;e!=c;e+=t){let c=o[e],u=l[e]+a.from;if(b(n,r,u,u+c.length))if(c instanceof m){if(i&f.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,t,r-u,n);if(o>-1)return new w(new S(a,c,e,u),null,o)}else if(i&f.IncludeAnonymous||!c.type.isAnonymous||I(c)){let o;if(!(i&f.IgnoreMounts)&&(o=s.get(c))&&!o.overlay)return new O(o.tree,u,e,a);let l=new O(c,u,e,a);return i&f.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?c.children.length-1:0,t,r,n)}}if(i&f.IncludeAnonymous||!a.type.isAnonymous)return null;if(e=a.index>=0?a.index+t:t<0?-1:a._parent._tree.children.length,a=a._parent,!a)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&f.IgnoreOverlays)&&(n=s.get(this._tree))&&n.overlay){let r=e-this.from;for(let{from:e,to:i}of n.overlay)if((t>0?e<=r:e<r)&&(t<0?i>=r:i>r))return new O(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function E(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(null!=r)for(let e=!1;!e;)if(e=i.type.is(r),!i.nextSibling())return a;for(;;){if(null!=n&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return null==n?a:[]}}function x(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class S{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class w extends y{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new w(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&f.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new w(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new w(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new w(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let a=r.buffer[this.index+1];e.push(r.slice(n,i,a)),t.push(0)}return new h(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function T(e){if(!e.length)return null;let t=0,r=e[0];for(let n=1;n<e.length;n++){let i=e[n];(i.from>r.from||i.to<r.to)&&(r=i,t=n)}let n=r instanceof O&&r.index<0?null:r.parent,i=e.slice();return n?i[t]=n:i.splice(t,1),new R(i,r)}class R{constructor(e,t){this.heads=e,this.node=t}get next(){return T(this.heads)}}class P{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof O)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof O?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?!(r&f.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&f.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&f.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;({index:t,_parent:r}=r))if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&f.IncludeAnonymous||e instanceof m||!e.type.isAnonymous||I(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==n){if(n==this.index)return a;t=a,r=i+1;break e}n=this.stack[--i]}for(let e=r;e<this.stack.length;e++)t=new w(this.buffer,t,this.stack[e]);return this.bufferNode=new w(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return x(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return x(this._tree,e,n);let a=r[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[n]&&e[n]!=a.name)return!1;n--}}return!0}}function I(e){return e.children.some((e=>e instanceof m||!e.type.isAnonymous||I(e)))}const A=new WeakMap;function L(e,t){if(!e.isAnonymous||t instanceof m||t.type!=e)return 1;let r=A.get(t);if(null==r){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof h)){r=1;break}r+=L(e,n)}A.set(t,r)}return r}function C(e,t,r,n,i,a,o,s,l){let c=0;for(let r=n;r<i;r++)c+=L(e,t[r]);let u=Math.ceil(1.5*c/8),d=[],p=[];return function t(r,n,i,o,s){for(let c=i;c<o;){let i=c,f=n[c],h=L(e,r[c]);for(c++;c<o;c++){let t=L(e,r[c]);if(h+t>=u)break;h+=t}if(c==i+1){if(h>u){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+s);continue}d.push(r[i])}else{let t=n[c-1]+r[c-1].length-f;d.push(C(e,r,n,i,c,f,t,null,l))}p.push(f+s-a)}}(t,r,n,i,0),(s||l)(d,p,o)}class _{startParse(e,t,r){return"string"==typeof e&&(e=new N(e)),r=r?r.length?r.map((e=>new a(e.from,e.to))):[new a(0,0)]:[new a(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class N{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new o({perNode:!0});class D{constructor(e,t,r,n,i,a,o,s,l,c=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=n,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=l,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let n=e.parser.context;return new D(e,[],t,r,r,0,[],0,n?new k(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,n=65535&e,{parser:i}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let o=i.dynamicPrecedence(n);if(o&&(this.score+=o),0==r)return this.pushState(i.getGoto(this.state,n,!0),this.reducePos),n<i.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,a?8:4,!0),void this.reduceContext(n,this.reducePos);let s=this.stack.length-3*(r-1)-(262144&e?6:0),l=s?this.stack[s-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[n])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let u=s?this.stack[s-1]:0,d=this.bufferBase+this.buffer.length-u;if(n<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,l,e,d+4,!0)}if(262144&e)this.state=this.stack[s];else{let e=this.stack[s-3];this.state=i.getGoto(e,n,!0)}for(;this.stack.length>s;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,t,r,n=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,n=this.buffer.length;if(0==n&&e.parent&&(n=e.bufferBase-e.parent.bufferBase,e=e.parent),n>0&&0==e.buffer[n-4]&&e.buffer[n-1]>-1){if(t==r)return;if(e.buffer[n-2]>=t)return void(e.buffer[n-2]=r)}}if(i&&this.pos!=r){let i=this.buffer.length;if(i>0&&0!=this.buffer[i-4]){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>r;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>r;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,n>4&&(n-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=r,this.buffer[i+3]=n}else this.buffer.push(e,t,r,n)}shift(e,t,r,n){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,n,4);else{let i=e,{parser:a}=this.p;(n>this.pos||t<=a.maxNode)&&(this.pos=n,a.stateFlag(i,1)||(this.reducePos=n)),this.pushState(i,r),this.shiftContext(t,r),t<=a.maxNode&&this.buffer.push(t,r,n,4)}}apply(e,t,r,n){65536&e?this.reduce(e):this.shift(e,t,r,n)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new D(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new $(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==r)return!1;if(!(65536&r))return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let n,i=0;i<t.length;i+=2)(n=t[i+1])!=this.state&&this.p.parser.hasAction(n,e)&&r.push(t[i],n);if(this.stack.length<120)for(let e=0;r.length<8&&e<t.length;e+=2){let n=t[e+1];r.some(((e,t)=>1&t&&e==n))||r.push(t[e],n)}t=r}let r=[];for(let e=0;e<t.length&&r.length<4;e+=2){let n=t[e+1];if(n==this.state)continue;let i=this.split();i.pushState(n,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,r.push(i)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let r=t>>19,n=65535&t,i=this.stack.length-3*r;if(i<0||e.getGoto(this.stack[i],n,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(n,i)=>{if(!t.includes(n))return t.push(n),e.allActions(n,(t=>{if(393216&t);else if(65536&t){let r=(t>>19)-i;if(r>1){let n=65535&t,i=this.stack.length-3*r;if(i>=0&&e.getGoto(this.stack[i],n,!1)>=0)return r<<19|65536|n}}else{let e=r(t,i+1);if(null!=e)return e}}))};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new k(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class k{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class ${constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,r=e>>19;0==r?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(r-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class j{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new j(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new j(this.stack,this.pos,this.index)}}function F(e,t=Uint16Array){if("string"!=typeof e)return e;let r=null;for(let n=0,i=0;n<e.length;){let a=0;for(;;){let t=e.charCodeAt(n++),r=!1;if(126==t){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,r=!0),a+=i,r)break;a*=46}r?r[i++]=a:r=new t(a)}return r}class M{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const B=new M;class Q{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=B,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,n=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!n)return null;let e=this.ranges[--n];i-=r.from-e.to,r=e}for(;t<0?i>r.to:i>=r.to;){if(n==this.ranges.length-1)return null;let e=this.ranges[++n];i+=e.from-r.to,r=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,r,n=this.chunkOff+e;if(n>=0&&n<this.chunk.length)t=this.pos+e,r=this.chunk.charCodeAt(n);else{let n=this.resolveOffset(e,1);if(null==n)return-1;if(t=n,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,n=this.range;for(;n.to<=t;)n=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-t)),r=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),r}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(null==r||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=B,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return r}}class U{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;V(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}U.prototype.contextual=U.prototype.fallback=U.prototype.extend=!1;U.prototype.fallback=U.prototype.extend=!1;function V(e,t,r,n,i,a){let o=0,s=1<<n,{dialect:l}=r.p.parser;e:for(;s&e[o];){let r=e[o+1];for(let n=o+3;n<r;n+=2)if((e[n+1]&s)>0){let r=e[n];if(l.allows(r)&&(-1==t.token.value||t.token.value==r||G(r,t.token.value,i,a))){t.acceptToken(r);break}}let n=t.next,c=0,u=e[o+2];if(!(t.next<0&&u>c&&65535==e[r+3*u-3])){for(;c<u;){let i=c+u>>1,a=r+i+(i<<1),s=e[a],l=e[a+1]||65536;if(n<s)u=i;else{if(!(n>=l)){o=e[a+2],t.advance();continue e}c=i+1}}break}o=e[r+3*u-1]}}function q(e,t,r){for(let n,i=t;65535!=(n=e[i]);i++)if(n==r)return i-t;return-1}function G(e,t,r,n){let i=q(r,n,t);return i<0||q(r,n,e)<i}const W="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let X=null;function z(e,t,r){let n=e.cursor(f.IncludeAnonymous);for(n.moveTo(t);;)if(!(r<0?n.childBefore(t):n.childAfter(t)))for(;;){if((r<0?n.to<t:n.from>t)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:e.length}}class H{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?z(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?z(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],n=this.index[t];if(n==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[n],a=this.start[t]+r.positions[n];if(a>e)return this.nextStart=a,null;if(i instanceof h){if(a==e){if(a<this.safeFrom)return null;let e=a+i.length;if(e<=this.safeTo){let t=i.prop(o.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}}class Y{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new M))}getActions(e){let t=0,r=null,{parser:n}=e.p,{tokenizers:i}=n,a=n.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let n=0;n<i.length;n++){if(!(1<<n&a))continue;let l=i[n],c=this.tokens[n];if((!r||l.fallback)&&((l.contextual||c.start!=e.pos||c.mask!=a||c.context!=o)&&(this.updateCachedToken(c,l,e),c.mask=a,c.context=o),c.lookAhead>c.end+25&&(s=Math.max(c.lookAhead,s)),0!=c.value)){let n=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(r=c,t>n))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),r||e.pos!=this.stream.end||(r=new M,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new M,{pos:r,p:n}=e;return t.start=r,t.end=Math.min(r+1,n.stream.end),t.value=r==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,r){let n=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(n,e),r),e.value>-1){let{parser:t}=r.p;for(let n=0;n<t.specialized.length;n++)if(t.specialized[n]==e.value){let i=t.specializers[n](this.stream.read(e.start,e.end),r);if(i>=0&&r.p.parser.dialect.allows(i>>1)){1&i?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,r,n){for(let t=0;t<n;t+=3)if(this.actions[t]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=r,n}addActions(e,t,r,n){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(65535==o[s]){if(1!=o[s+1]){0==n&&2==o[s+1]&&(n=this.putAction(te(o,s+2),t,r,n));break}s=te(o,s+2)}o[s]==t&&(n=this.putAction(te(o,s+1),t,r,n))}return n}}class K{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Q(t,n),this.tokens=new Y(e,this.stream),this.topTerm=e.top[1];let{from:i}=n[0];this.stacks=[D.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>4*e.bufferLength?new H(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,r=this.stacks,n=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==r.length){let[e]=r;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<r.length;a++){let o=r[a];for(;;){if(this.tokens.mainToken=null,o.pos>n)i.push(o);else{if(this.advanceStack(o,i,r))continue;{e||(e=[],t=[]),e.push(o);let r=this.tokens.getMainToken(o);t.push(r.value,r.end)}}break}}if(!i.length){let t=e&&function(e){let t=null;for(let r of e){let e=r.p.stoppedAt;(r.pos==r.p.stream.end||null!=e&&r.pos>e)&&r.p.parser.stateFlag(r.state,2)&&(!t||t.score<r.score)&&(t=r)}return t}(e);if(t)return this.stackToTree(t);if(this.parser.strict)throw new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&e){let r=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,i);if(r)return this.stackToTree(r.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort(((e,t)=>t.score-e.score));i.length>e;)i.pop();i.some((e=>e.reducePos>n))&&this.recovering--}else if(i.length>1){e:for(let e=0;e<i.length-1;e++){let t=i[e];for(let r=e+1;r<i.length;r++){let n=i[r];if(t.sameState(n)||t.buffer.length>500&&n.buffer.length>500){if(!((t.score-n.score||t.buffer.length-n.buffer.length)>0)){i.splice(e--,1);continue e}i.splice(r--,1)}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let e=1;e<i.length;e++)i[e].pos<this.minStackPos&&(this.minStackPos=i[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let n=e.pos,{parser:i}=this;W&&this.stackID(e);if(null!=this.stoppedAt&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,r=t?e.curContext.hash:0;for(let a=this.fragments.nodeAt(n);a;){let n=this.parser.nodeSet.types[a.type.id]==a.type?i.getGoto(e.state,a.type.id):-1;if(n>-1&&a.length&&(!t||(a.prop(o.contextHash)||0)==r))return e.useNode(a,n),!0;if(!(a instanceof h)||0==a.children.length||a.positions[0]>0)break;let s=a.children[0];if(!(s instanceof h&&0==a.positions[0]))break;a=s}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let i=0;i<s.length;){let a=s[i++],o=s[i++],l=s[i++],c=i==s.length||!r,u=c?e:e.split(),d=this.tokens.mainToken;if(u.apply(a,o,d?d.start:u.pos,l),c)return!0;u.pos>n?t.push(u):r.push(u)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return Z(e,t),!0}}runRecovery(e,t,r){let n=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],l=t[1+(a<<1)],c=W?this.stackID(o)+" -> ":"";if(o.deadEnd){if(i)continue;if(i=!0,o.restart(),this.advanceFully(o,r))continue}let u=o.split(),d=c;for(let e=0;u.forceReduce()&&e<10;e++){if(this.advanceFully(u,r))break;W&&(d=this.stackID(u)+" -> ")}for(let e of o.recoverByInsert(s))this.advanceFully(e,r);this.stream.end>o.pos?(l==o.pos&&(l++,s=0),o.recoverByDelete(s,l),Z(o,r)):(!n||n.score<o.score)&&(n=o)}return n}stackToTree(e){return e.close(),h.build({buffer:j.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(X||(X=new WeakMap)).get(e);return t||X.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Z(e,t){for(let r=0;r<t.length;r++){let n=t[r];if(n.pos==e.pos&&n.sameState(e))return void(t[r].score<e.score&&(t[r]=e))}t.push(e)}class J{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||0==this.disabled[e]}}class ee extends _{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let r=Object.keys(e.topRules).map((t=>e.topRules[t][1])),i=[];for(let e=0;e<t.length;e++)i.push([]);function a(e,t,r){i[e].push([t,t.deserialize(String(r))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=o[e]);for(let r=1;r<t.length;){let n=t[r++];if(n>=0)a(n,e,t[r++]);else{let i=t[r+-n];for(let o=-n;o>0;o--)a(t[r++],e,i);r++}}}this.nodeSet=new u(t.map(((t,n)=>c.define({name:n>=this.minRepeatTerm?void 0:t,id:n,props:i[n],top:r.indexOf(n)>-1,error:0==n,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=n;let s=F(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(re),this.states=F(e.states,Uint32Array),this.data=F(e.stateData),this.goto=F(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map((e=>"number"==typeof e?new U(s,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let n=new K(this,e,t,r);for(let i of this.wrappers)n=i(n,e,t,r);return n}getGoto(e,t,r=!1){let n=this.goto;if(t>=n[0])return-1;for(let i=n[t+1];;){let t=n[i++],a=1&t,o=n[i++];if(a&&r)return o;for(let r=i+(t>>1);i<r;i++)if(n[i]==e)return o;if(a)return-1}}hasAction(e,t){let r=this.data;for(let n=0;n<2;n++)for(let i,a=this.stateSlot(e,n?2:1);;a+=3){if(65535==(i=r[a])){if(1!=r[a+1]){if(2==r[a+1])return te(r,a+2);break}i=r[a=te(r,a+2)]}if(i==t||0==i)return te(r,a+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let r=this.stateSlot(e,4),n=r?t(r):void 0;for(let r=this.stateSlot(e,1);null==n;r+=3){if(65535==this.data[r]){if(1!=this.data[r+1])break;r=te(this.data,r+2)}n=t(te(this.data,r+1))}return n}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(65535==this.data[r]){if(1!=this.data[r+1])break;r=te(this.data,r+2)}if(!(1&this.data[r+2])){let e=this.data[r+1];t.some(((t,r)=>1&r&&t==e))||t.push(this.data[r],e)}}return t}configure(e){let t=Object.assign(Object.create(ee.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let r=e.tokenizers.find((e=>e.from==t));return r?r.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((r,n)=>{let i=e.specializers.find((e=>e.from==r.external));if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return t.specializers[n]=re(a),a}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map((()=>!1));if(e)for(let n of e.split(" ")){let e=t.indexOf(n);e>=0&&(r[e]=!0)}let n=null;for(let e=0;e<t.length;e++)if(!r[e])for(let r,i=this.dialects[t[e]];65535!=(r=this.data[i++]);)(n||(n=new Uint8Array(this.maxTerm+1)))[r]=1;return new J(e,r,n)}static deserialize(e){return new ee(e)}}function te(e,t){return e[t]|e[t+1]<<16}function re(e){if(e.external){let t=e.extend?1:0;return(r,n)=>e.external(r,n)<<1|t}return e.get}const ne={json:1,logfmt:2,unpack:3,pattern:4,regexp:5,label_format:7,line_format:8,label_replace:9,vector:10,offset:11,bool:12,on:13,ignoring:14,group_left:15,group_right:16,unwrap:6,decolorize:17,drop:18,keep:19},ie={by:20,without:21,and:22,or:23,unless:24,sum:25,avg:26,count:27,max:28,min:29,stddev:30,stdvar:31,bottomk:32,topk:33,sort:34,sort_desc:35},ae={__proto__:null,ip:295,count_over_time:301,rate:303,rate_counter:305,bytes_over_time:307,bytes_rate:309,avg_over_time:311,sum_over_time:313,min_over_time:315,max_over_time:317,stddev_over_time:319,stdvar_over_time:321,quantile_over_time:323,first_over_time:325,last_over_time:327,absent_over_time:329,bytes:335,duration:337,duration_seconds:339},oe=ee.deserialize({version:14,states:"EtOYQPOOO#cQPO'#DUOOQO'#ER'#ERO#hQPO'#ERO$}QPO'#DTOYQPO'#DTOOQO'#Ed'#EdO%[QPO'#EcOOQO'#FP'#FPO%aQPO'#FOQ%lQPOOO&mQPO'#F]O&rQPO'#F^OOQO'#Eb'#EbOOQO'#DS'#DSOOQO'#Ee'#EeOOQO'#Ef'#EfOOQO'#Eg'#EgOOQO'#Eh'#EhOOQO'#Ei'#EiOOQO'#Ej'#EjOOQO'#Ek'#EkOOQO'#El'#ElOOQO'#Em'#EmOOQO'#En'#EnOOQO'#Eo'#EoOOQO'#Ep'#EpOOQO'#Eq'#EqOOQO'#Er'#ErOOQO'#Es'#EsO&wQPO'#DWOOQO'#DV'#DVO'VQPO,59pOOQO,5:m,5:mOOQO'#Dc'#DcO'_QPO'#DbO'gQPO'#DaO)lQPO'#D`O*{QPO'#D`OOQO'#D_'#D_O+sQPO,59oO-}QPO,59oO.UQPO,5:|O.]QPO,5:}O.hQPO'#E|O0sQPO,5;jO0zQPO,5;jO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lOYQPO,5;wO3cQPO,5;xO3hQPO,59rO#cQPO,59qOOQO1G/[1G/[OOQO'#Dh'#DhO3mQPO,59|O5^QPO,59|OOQO'#Di'#DiO5cQPO,59{OOQO,59{,59{O5kQPO'#DWO6YQPO'#DlO8PQPO'#DoO9sQPO'#DoOOQO'#Do'#DoOOQO'#Dv'#DvOOQO'#Dt'#DtO+kQPO'#DtO9xQPO,59zO;iQPO'#EVO;nQPO'#EWOOQO'#EZ'#EZO;sQPO'#E[O;xQPO'#E_OOQO,59z,59zOOQO,59y,59yOOQO1G/Z1G/ZOOQO1G0h1G0hO;}QPO'#EtO.`QPO'#EtO<XQPO1G0iO<^QPO1G0iO<cQPO,5;hO=oQPO1G1UO=vQPO1G1UO=}QPO1G1UO>UQPO'#FSO@dQPO'#FRO@nQPO'#FROYQPO1G1WOYQPO1G1WOYQPO1G1WOYQPO1G1WOYQPO1G1WOYQPO1G1WO@xQPO1G1cOAPQPO1G1dOOQO1G/^1G/^OOQO1G/]1G/]O5cQPO1G/hOAUQPO1G/hOAZQPO'#DjOBzQPO'#DjOOQO1G/g1G/gOCbQPO,59rOCPQPO,5:cOOQO'#Dm'#DmOClQPO,5:WOEcQPO'#DrOOQO'#Dq'#DqOGVQPO,5:_OHvQPO,5:[OOQO,5:Z,5:ZOJgQPO,5:`O+kQPO,5:`O+kQPO,5:`OOQO,5:q,5:qOJuQPO'#EYOOQO'#EX'#EXOJzQPO,5:rOLkQPO'#E^OOQO'#E^'#E^OOQO'#E]'#E]ONbQPO,5:vO!!RQPO'#EaOOQO'#Ea'#EaOOQO'#E`'#E`O!#xQPO,5:yO!%iQPO'#D`O;}QPO,5;`O!%pQPO'#EuO!%uQPO,5;`O!%}QPO,5;`O!&[QPO,5;`O!&iQPO,5;`O!&nQPO7+&TO.`QPO7+&TOOQO'#E}'#E}O!(OQPO1G1SOOQO1G1S1G1SOYQPO7+&pO!(WQPO7+&pO!)hQPO7+&pO!)oQPO7+&pO!)vQQO'#FTOOQO,5;n,5;nO!,UQPO,5;mO!,]QPO,5;mO!-nQPO7+&rO!-uQPO7+&rOOQO7+&r7+&rO!.SQPO7+&rO!.ZQPO7+&rO!/`QPO7+&rO!/pQPO7+&}OOQO7+'O7+'OOOQO7+%S7+%SO!/uQPO7+%SO5cQPO,5:UO!/zQPO,5:UO!0PQPO1G/{OOQO1G/}1G/}OOQO1G0U1G0UOOQO1G0W1G0WOOQO,5:X,5:XO!0UQPO1G/yO!1uQPO,5:^O!1zQPO,5:]OOQO1G/z1G/zO!2PQPO1G/zO!3pQPO,5:tO;nQPO,5:sO;sQPO,5:wO;xQPO,5:zO!3xQPO,5;cO!%uQPO1G0zO!4WQPO1G0zO!4`QPO,5;aO+kQPO,5;cO!4eQPO1G0zO!4oQPO'#EvO!4tQPO1G0zO!4eQPO1G0zO!4|QPO1G0zO!5ZQPO1G0zO!%xQPO1G0zOOQO1G0z1G0zOOQO<<Io<<IoO!5fQPO<<IoO!5kQPO,5;iOOQO7+&n7+&nO!5pQPO<<J[OOQO<<J[<<J[OYQPO<<J[OOQO'#FV'#FVO!5wQPO,5;oOOQO'#FU'#FUOOQO,5;o,5;oOOQO1G1X1G1XO!6PQPO1G1XO!8YQPO<<JiOOQO<<Hn<<HnOOQO1G/p1G/pO!8_QPO1G/pO!8dQPO7+%gOOQO1G/x1G/xOOQO1G/w1G/wOOQO1G0`1G0`OOQO1G0_1G0_OOQO1G0c1G0cOOQO1G0f1G0fOOQO'#Ex'#ExOOQO1G0}1G0}O!8iQPO1G0}OOQO'#Ey'#EyOOQO'#Ez'#EzOOQO'#E{'#E{OOQO7+&f7+&fOOQO1G0{1G0{O!8nQPO1G0}O!9SQPO7+&fOOQO,5;b,5;bO!9[QPO7+&fO!%xQPO7+&fO!9fQPO7+&fO!9qQPOAN?ZOOQO1G1T1G1TO!;RQPOAN?vO!<cQPOAN?vO!<jQQO1G1ZOOQO1G1Z1G1ZOOQO7+&s7+&sO!<rQPOAN@TOOQO7+%[7+%[O!<wQPO<<IRO!<|QPO7+&iO!=RQPO<<JQO!=ZQPO<<JQO!=cQPO'#EwO!=hQPO<<JQOOQOG24uG24uOOQOG25bG25bOOQO1G1[1G1[OOQO7+&u7+&uO!=pQPOG25oOOQOAN>mAN>mO!=uQPO<<JTOOQOAN?lAN?lO!=zQPOAN?lO!>SQPOLD+ZOOQOAN?oAN?oOOQO,5:r,5:rO!>XQPO!$'NuO!>^QPO!)9DaO!>cQPO!.K9{OOQO!4//g!4//gO;nQPO'#EWO!>hQPO'#D`O!?`QPO,59oO!@fQPO'#DTOYQPO1G1WOYQPO1G1WOYQPO1G1WOYQPO1G1WOYQPO1G1WOYQPO1G1WO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO1PQPO,5;lO!AqQPO7+&rO!AxQPO7+&rO!BVQPO7+&rO!C_QPO7+&rO!CfQPO7+&rO!B^QPO'#FQ",stateData:"!Cs~O$TOStOS~OXZOY[OiWOjWOkWOlWOmWOnWOoWOpWOqWOrWOsWO!vQO!wRO!xRO$UPO$YTO$[_O$]`O$^aO$_bO$`cO$adO$beO$cfO$dgO$ehO$fiO$gjO$hkO$ilO$jmO~O{nO~O!vqO~O!OrO!QrO!WrO!XrO!YrO!ZrOfwXgwXhwX!lwX!nwX!owX!pwX!qwX!wwX!xwX#{wX#|wX#}wX$OwX~O!_vO$RwX$ZwX~P#mO$Y{O~Od|Oe|O$Y}O~Of!QOg!POh!QO!O!UO!l!UO!n!UO!o!UO!p!UO!q!UO!w!RO!x!RO#{!SO#|!SO#}!SO$O!TO~O$Y!VO~O$Y!WO~O|!XO!O!XO!P!XO!Q!XO~O$V!YO$W!ZO~O}!]O$X!_O~Og!`Of!TXh!TX!O!TX!Q!TX!W!TX!X!TX!Y!TX!Z!TX!_!TX!l!TX!n!TX!o!TX!p!TX!q!TX!w!TX!x!TX#{!TX#|!TX#}!TX$O!TX$R!TX$Z!TX$k!TX$V!TX~O!OrO!QrO!WrO!XrO!YrO!ZrO~Of!SXg!SXh!SX!_!SX!l!SX!n!SX!o!SX!p!SX!q!SX!w!SX!x!SX#{!SX#|!SX#}!SX$O!SX$R!SX$Z!SX$k!SX$V!SX~P)WOP!dOQ!cOR!fOS!eOT!eOV!lOW!kOa!mOb!nOc!oO{!bO$Y!iO~O!_vOfwagwahwa!lwa!nwa!owa!pwa!qwa!wwa!xwa#{wa#|wa#}wa$Owa$Rwa$Zwa~P)WOfvXgvXhvX!OvX!lvX!nvX!ovX!pvX!qvX!wvX!xvX#{vX#|vX#}vX$OvX~O$Z!rO~P,|O$Z!sO~P,|O!v!wO$UPO$Y!uO~O$Y!xO~OXZOY[OiWOjWOkWOlWOmWOnWOoWOpWOqWOrWOsWO!wRO!xRO$UPO$YTO$[_O$]`O$^aO$_bO$`cO$adO$beO$cfO$dgO$ehO$fiO$gjO$hkO$ilO$jmO~O!v!yO~P.mO$Y!{O~O[#OO]!|O^!|OX#uPY#uPi#uPj#uPk#uPl#uPm#uPn#uPo#uPp#uPq#uPr#uPs#uP!v#uP!w#uP!x#uP$U#uP$Y#uP$[#uP$]#uP$^#uP$_#uP$`#uP$a#uP$b#uP$c#uP$d#uP$e#uP$f#uP$g#uP$h#uP$i#uP$j#uP~O!v#WO~O}#XO~Og#ZOf!Uah!Ua!O!Ua!Q!Ua!W!Ua!X!Ua!Y!Ua!Z!Ua!_!Ua!l!Ua!n!Ua!o!Ua!p!Ua!q!Ua!w!Ua!x!Ua#{!Ua#|!Ua#}!Ua$O!Ua$R!Ua$Z!Ua$k!Ua$V!Ua~O$Y#[O~O}#]O$X!_O~O|#`O!O#`O!P!XO!Q!XO!l#aO!n#aO!o#aO!p#aO!q#aO~O{#dO!b#bOf!`Xg!`Xh!`X!O!`X!Q!`X!W!`X!X!`X!Y!`X!Z!`X!_!`X!l!`X!n!`X!o!`X!p!`X!q!`X!w!`X!x!`X#{!`X#|!`X#}!`X$O!`X$R!`X$Z!`X$k!`X$V!`X~O{#dOf!cXg!cXh!cX!O!cX!Q!cX!W!cX!X!cX!Y!cX!Z!cX!_!cX!l!cX!n!cX!o!cX!p!cX!q!cX!w!cX!x!cX#{!cX#|!cX#}!cX$O!cX$R!cX$Z!cX$k!cX$V!cX~O}#hO~Of#jOg#kO$V#jOh!Sa!O!Sa!Q!Sa!W!Sa!X!Sa!Y!Sa!Z!Sa!_!Sa!l!Sa!n!Sa!o!Sa!p!Sa!q!Sa!w!Sa!x!Sa#{!Sa#|!Sa#}!Sa$O!Sa$R!Sa$Z!Sa$k!Sa~O}#lO~O{#mO~O{#pO~O{#tO~O!_#xO$k#zO~P)WO$Z$PO~O$V$QO~O{$RO$Z$TO~Of!uXg!uXh!uX!O!uX!l!uX!n!uX!o!uX!p!uX!q!uX!w!uX!x!uX#{!uX#|!uX#}!uX$O!uX$Z!uX~O$V$UO~P<kO$Z$VO~P,|O!v$WO~P.mO$Y$YO~OX#uXY#uXi#uXj#uXk#uXl#uXm#uXn#uXo#uXp#uXq#uXr#uXs#uX!v#uX!w#uX!x#uX$U#uX$Y#uX$[#uX$]#uX$^#uX$_#uX$`#uX$a#uX$b#uX$c#uX$d#uX$e#uX$f#uX$g#uX$h#uX$i#uX$j#uX~O_$[O`$[O~P>ZO]!|O^!|O~P>ZO$V$dO~P,|O$Z$eO~O}$gO~Og$hOf!^Xh!^X!O!^X!Q!^X!W!^X!X!^X!Y!^X!Z!^X!_!^X!l!^X!n!^X!o!^X!p!^X!q!^X!w!^X!x!^X#{!^X#|!^X#}!^X$O!^X$R!^X$Z!^X$k!^X$V!^X~O$Y$iO~O!m$kO!s$lO!vQO!wRO!xRO~O}#XO$X!_O~PCPO{#dO!b$nOf!`ag!`ah!`a!O!`a!Q!`a!W!`a!X!`a!Y!`a!Z!`a!_!`a!l!`a!n!`a!o!`a!p!`a!q!`a!w!`a!x!`a#{!`a#|!`a#}!`a$O!`a$R!`a$Z!`a$k!`a$V!`a~O|$pOf!fXg!fXh!fX!O!fX!Q!fX!W!fX!X!fX!Y!fX!Z!fX!_!fX!l!fX!n!fX!o!fX!p!fX!q!fX!w!fX!x!fX#{!fX#|!fX#}!fX$O!fX$R!fX$V!fX$Z!fX$k!fX~O$V$qOf!gag!gah!ga!O!ga!Q!ga!W!ga!X!ga!Y!ga!Z!ga!_!ga!l!ga!n!ga!o!ga!p!ga!q!ga!w!ga!x!ga#{!ga#|!ga#}!ga$O!ga$R!ga$Z!ga$k!ga~O$V$qOf!dag!dah!da!O!da!Q!da!W!da!X!da!Y!da!Z!da!_!da!l!da!n!da!o!da!p!da!q!da!w!da!x!da#{!da#|!da#}!da$O!da$R!da$Z!da$k!da~Of#jOg#kO$V#jO$Z$rO~O|$tO~O$V$uOf!zag!zah!za!O!za!Q!za!W!za!X!za!Y!za!Z!za!_!za!l!za!n!za!o!za!p!za!q!za!w!za!x!za#{!za#|!za#}!za$O!za$R!za$Z!za$k!za~O|!XO!O!XO!P!XO!Q!XOf#QXg#QXh#QX!W#QX!X#QX!Y#QX!Z#QX!_#QX!l#QX!n#QX!o#QX!p#QX!q#QX!w#QX!x#QX#{#QX#|#QX#}#QX$O#QX$R#QX$V#QX$Z#QX$k#QX~O$V$vOf#Oag#Oah#Oa!O#Oa!Q#Oa!W#Oa!X#Oa!Y#Oa!Z#Oa!_#Oa!l#Oa!n#Oa!o#Oa!p#Oa!q#Oa!w#Oa!x#Oa#{#Oa#|#Oa#}#Oa$O#Oa$R#Oa$Z#Oa$k#Oa~O|!XO!O!XO!P!XO!Q!XOf#TXg#TXh#TX!W#TX!X#TX!Y#TX!Z#TX!_#TX!l#TX!n#TX!o#TX!p#TX!q#TX!w#TX!x#TX#{#TX#|#TX#}#TX$O#TX$R#TX$V#TX$Z#TX$k#TX~O$V$wOf#Rag#Rah#Ra!O#Ra!Q#Ra!W#Ra!X#Ra!Y#Ra!Z#Ra!_#Ra!l#Ra!n#Ra!o#Ra!p#Ra!q#Ra!w#Ra!x#Ra#{#Ra#|#Ra#}#Ra$O#Ra$R#Ra$Z#Ra$k#Ra~OU$xO~P*{O!m${O~O!_$|O$k#zO~OZ%OO!_#xO$Z#ha~P)WO!_#xO$Z%TO$k#zO~P)WO$Z%UO~Od|Oe|Of#Vqg#Vqh#Vq!O#Vq!l#Vq!n#Vq!o#Vq!p#Vq!q#Vq!w#Vq!x#Vq#{#Vq#|#Vq#}#Vq$O#Vq$R#Vq$Z#Vq$V#Vq~O$V%XO$Z%YO~Od|Oe|Of#rqg#rqh#rq!O#rq!l#rq!n#rq!o#rq!p#rq!q#rq!w#rq!x#rq#{#rq#|#rq#}#rq$O#rq$R#rq$Z#rq$V#rq~O$V%]O~P<kO$Z%[O~P,|O#z%^O$Z%aO~OX#uaY#uai#uaj#uak#ual#uam#uan#uao#uap#uaq#uar#uas#ua!v#ua!w#ua!x#ua$U#ua$[#ua$]#ua$^#ua$_#ua$`#ua$a#ua$b#ua$c#ua$d#ua$e#ua$f#ua$g#ua$h#ua$i#ua$j#ua~O$Y$YO~P!*OO_%cO`%cO$Y#ua~P!*OOf!QOh!QO!O!UO!l!UO!n!UO!o!UO!p!UO!q!UO!w!RO!x!RO#{#tq#|#tq#}#tq$O#tq$R#tq$Z#tq~Og#tq~P!,jOf#tqg#tqh#tq~P!,pOg!PO~P!,jO$R#tq$Z#tq~P%lOf#tqg#tqh#tq!O#tq!l#tq!n#tq!o#tq!p#tq!q#tq#{#tq#|#tq#}#tq$O#tq~O!w!RO!x!RO$R#tq$Z#tq~P!.eO}%dO~O$Z%eO~O}%gO~O$Y%hO~O$V$qOf!gig!gih!gi!O!gi!Q!gi!W!gi!X!gi!Y!gi!Z!gi!_!gi!l!gi!n!gi!o!gi!p!gi!q!gi!w!gi!x!gi#{!gi#|!gi#}!gi$O!gi$R!gi$Z!gi$k!gi~O}%iO~O{#dO~Of#jO$V#jOg!hih!hi!O!hi!Q!hi!W!hi!X!hi!Y!hi!Z!hi!_!hi!l!hi!n!hi!o!hi!p!hi!q!hi!w!hi!x!hi#{!hi#|!hi#}!hi$O!hi$R!hi$Z!hi$k!hi~O{%kO}%kO~O{%pO$m%rO$n%sO$o%tO~OZ%OO$Z#hi~O$l%vO~O!_#xO$Z#hi~P)WO!m%yO~O!_$|O$Z#hi~O!_#xO$Z%{O$k#zO~P)WO!_$|O$Z%{O$k#zO~O$Z%}O~O{&OO~O$Z&PO~P,|O$V&RO$Z&SO~O$Y$YOX#uiY#uii#uij#uik#uil#uim#uin#uio#uip#uiq#uir#uis#ui!v#ui!w#ui!x#ui$U#ui$[#ui$]#ui$^#ui$_#ui$`#ui$a#ui$b#ui$c#ui$d#ui$e#ui$f#ui$g#ui$h#ui$i#ui$j#ui~O$V&UO~O$Z&VO~O}&WO~O$Y&XO~Of#jOg#kO$V#jO!_#ki$k#ki$Z#ki~O!_$|O$Z#hq~O!_#xO$Z#hq~P)WOZ%OO!_&[O$Z#hq~Od|Oe|Of#V!Rg#V!Rh#V!R!O#V!R!l#V!R!n#V!R!o#V!R!p#V!R!q#V!R!w#V!R!x#V!R#{#V!R#|#V!R#}#V!R$O#V!R$R#V!R$Z#V!R$V#V!R~Od|Oe|Of#r!Rg#r!Rh#r!R!O#r!R!l#r!R!n#r!R!o#r!R!p#r!R!q#r!R!w#r!R!x#r!R#{#r!R#|#r!R#}#r!R$O#r!R$R#r!R$Z#r!R$V#r!R~O$Z&_O~P,|O#z%^O$Z&aO~O}&bO~O$Z&cO~O{&dO~O!_$|O$Z#hy~OZ%OO$Z#hy~OU$xO~O!_&[O$Z#hy~O$V&gO~O$Z&hO~O!_$|O$Z#h!R~O}&jO~O$V&kO~O}&lO~O$Z&mO~OP!dOQ!cOR!fOS!eOT!eOV&nOW!kOa!mOb!nOc!oO{!bO$Y!iO~O!_&oOfwagwahwa!lwa!nwa!owa!pwa!qwa!wwa!xwa#{wa#|wa#}wa$Owa$Vwa~P)WO!_&oO$VwX~P#mOf&yOh&yO!O&}O!l&}O!n&}O!o&}O!p&}O!q&}O!w&zO!x&zO#{#tq#|#tq#}#tq$O#tq$V#tq~Og#tq~P!@pOf#tqg#tqh#tq~P!@vOg&xO~P!@pOf&yOg&xOh&yO!O&}O!l&}O!n&}O!o&}O!p&}O!q&}O!w&zO!x&zO#{&{O#|&{O#}&{O$O&|O~O$V#tq~P!B^O!w&zO!x&zO$V#tq~P!.eO",goto:"1l$RPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP$S%R%j&Y&]PPPPPP&t'W'h'v(XPPPP(h(p(yP)S)XP)S)S)[)e)S)m*O*O*XPPPPPP*XP*O*bPPP)S)S*{+R)S)S+Y+])S+c+f+l,_,t-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-p-y.^.j/S/V/V/V/Y/i,_/l,_0R0w1Y1c1fPPPPP,_,_[YOT}!{$U%]Q$^#PQ$_#QS$`#R&tQ$a#SQ$b#TQ$c#UQ'O&rQ'P&sQ'Q&uQ'R&vQ'S&wR'T!Vt^O}!V!{#P#Q#R#S#T#U$U%]&r&s&t&u&v&wRyTjSOT}!V!{#P#Q#R#S#T#U$U%]S!t{$QQ#}!u]&q&r&s&t&u&v&wRpPQoP^!hv!i#j#k#x$|&oQ#Y!YS#q!n$vT#u!o$wQxSQ#y!tQ$}#|Q%R#}Q%z%QR&p&q[wS!t#|#}%Q&q]!qx#y$}%R%z&piuSx!t#y#|#}$}%Q%R%z&p&qhtSx!t#y#|#}$}%Q%R%z&p&qR!auksSux!t#y#|#}$}%Q%R%z&p&qQ!^sV#^!`#Z$hW![s!`#Z$hR$j#`Q#_!`Q$f#ZR%f$hV!pv#x&oR#c!cQ#f!cQ#g!dR$o#cU#e!c!d#cR%j$qU!jv#x&oQ#i!iQ$r#jQ$s#kR%w$|_!hv!i#j#k#x$|&o_!gv!i#j#k#x$|&ov]OT}!V!{#P#Q#R#S#T#U$U%]&r&s&t&u&v&wT$m#`#aQ#o!lR&i&nS#n!l&nR%l$uR#s!nQ#r!nR%m$vR#w!oQ#v!oR%n$wj^O#P#Q#R#S#T#U&r&s&t&u&v&wQzTQ!z}Q#V!VQ$X!{Q%Z$UR&Q%]w]OT}!V!{#P#Q#R#S#T#U$U%]&r&s&t&u&v&wwVOT}!V!{#P#Q#R#S#T#U$U%]&r&s&t&u&v&wwUOT}!V!{#P#Q#R#S#T#U$U%]&r&s&t&u&v&wQ!v{Q$O!uR%W$QS#|!t#}W$z#y#{%R%SQ%u$yQ%|%TR&Z%{Q%Q#|Q%u$zQ&]%|R&e&ZQ#{!tS$y#y%RQ%P#|Q%S#}S%x$}%QS&Y%z%|R&f&]R%q$xR%o$xQ!OXQ%V$PQ%[$VQ&^%}R&_&PR$S!xwXOT}!V!{#P#Q#R#S#T#U$U%]&r&s&t&u&v&wQ#P!PQ#Q!QQ#R!RQ#S!SQ#T!TQ#U!UQ&r&xQ&s&yQ&t&zQ&u&{Q&v&|R&w&}h!}!P!Q!R!S!T!U&x&y&z&{&|&}R$]#OQ$Z!|Q%b$[R&T%cR%_$YQ%`$YR&`&R",nodeNames:"⚠ Json Logfmt Unpack Pattern Regexp Unwrap LabelFormat LineFormat LabelReplace Vector Offset Bool On Ignoring GroupLeft GroupRight Decolorize Drop Keep By Without And Or Unless Sum Avg Count Max Min Stddev Stdvar Bottomk Topk Sort Sort_Desc LineComment LogQL Expr LogExpr Selector Matchers Matcher Identifier Eq String Neq Re Nre PipelineExpr PipelineStage LineFilters LineFilter Filter PipeExact PipeMatch PipePattern Npa FilterOp Ip OrFilter Pipe LogfmtParser LogfmtParserFlags ParserFlag LabelParser JsonExpressionParser LabelExtractionExpressionList LabelExtractionExpression LogfmtExpressionParser LabelFilter IpLabelFilter UnitFilter DurationFilter Gtr Duration Gte Lss Lte Eql BytesFilter Bytes NumberFilter LiteralExpr Number Add Sub LineFormatExpr LabelFormatExpr LabelsFormat LabelFormatMatcher DecolorizeExpr DropLabelsExpr DropLabels DropLabel KeepLabelsExpr KeepLabels KeepLabel MetricExpr RangeAggregationExpr RangeOp CountOverTime Rate RateCounter BytesOverTime BytesRate AvgOverTime SumOverTime MinOverTime MaxOverTime StddevOverTime StdvarOverTime QuantileOverTime FirstOverTime LastOverTime AbsentOverTime LogRangeExpr Range OffsetExpr UnwrapExpr ConvOp BytesConv DurationConv DurationSecondsConv Grouping Labels VectorAggregationExpr VectorOp BinOpExpr BinOpModifier OnOrIgnoringModifier GroupingLabels GroupingLabelList GroupingLabel LabelName Mul Div Mod Pow LabelReplaceExpr VectorExpr",maxTerm:169,skippedNodes:[0,36],repeatNodeCount:0,tokenData:"<n~RvX^#ipq#iqr$^rs$yst%kuv%vxy%{yz&Qz{&V{|&[|}&a}!O&f!O!P2v!P!Q3v!Q!R3{!R![7^![!]9]!^!_9q!_!`:O!`!a:e!c!}:r!}#O;Y#P#Q;_#Q#R;d#R#S:r#S#T;i#T#o:r#o#p;u#p#q;z#q#r<i#y#z#i$f$g#i#BY#BZ#i$IS$I_#i$I|$JO#i$JT$JU#i$KV$KW#i&FU&FV#i~#nY$T~X^#ipq#i#y#z#i$f$g#i#BY#BZ#i$IS$I_#i$I|$JO#i$JT$JU#i$KV$KW#i&FU&FV#i~$aR!_!`$j!`!a$o#r#s$t~$oO!O~~$tO!Z~~$yO!Q~~$|UOY$yZr$yrs%`s#O$y#O#P%e#P~$y~%eO}~~%hPO~$y~%pQt~OY%kZ~%k~%{O#}~~&QO$Y~~&VO$Z~~&[O#{~~&aO!w~~&fO$V~~&kQ!x~}!O&q!Q![(w~&tQ#_#`&z#g#h(X~&}P#X#Y'Q~'TP#X#Y'W~'ZP#d#e'^~'aP}!O'd~'gP#X#Y'j~'mP#a#b'p~'sP#d#e'v~'yP#h#i'|~(PP#m#n(S~(XO!b~~([P#h#i(_~(bP#f#g(e~(hP#]#^(k~(nP#V#W(q~(tP#h#i(S~(zZ!O!P)m!Q![(w#W#X0`#[#]*]#a#b+j#b#c.R#g#h/X#i#j.^#k#l1T#m#n1{${$|.^~)pP!Q![)s~)vV!Q![)s#[#]*]#a#b+j#b#c.R#g#h/X#i#j.^${$|.^~*bP!m~!Q![*e~*hV!O!P*}!Q![*e#a#b+j#b#c.R#g#h/X#i#j.^${$|.^~+QP!Q![+T~+WU!Q![+T#a#b+j#b#c.R#g#h/X#i#j.^${$|.^~+oQ!m~!Q![+u#g#h-Q~+xV!O!P,_!Q![+u#a#b,z#b#c.R#g#h/X#i#j.^${$|.^~,bP!Q![,e~,hU!Q![,e#a#b,z#b#c.R#g#h/X#i#j.^${$|.^~,}P#g#h-Q~-VP!m~!Q![-Y~-]T!O!P-l!Q![-Y#b#c.R#i#j.^${$|.^~-oP!Q![-r~-uS!Q![-r#b#c.R#i#j.^${$|.^~.UP#g#h.X~.^O!m~~.aP#g#h.d~.iP!m~!Q![.l~.oR!O!P.x!Q![.l#b#c.R~.{P!Q![/O~/RQ!Q![/O#b#c.R~/^P!m~!Q![/a~/dU!O!P/v!Q![/a#a#b,z#b#c.R#i#j.^${$|.^~/yP!Q![/|~0PT!Q![/|#a#b,z#b#c.R#i#j.^${$|.^~0eP!m~!Q![0h~0kW!O!P)m!Q![0h#[#]*]#a#b+j#b#c.R#g#h/X#i#j.^${$|.^~1YP!m~!Q![1]~1`X!O!P)m!Q![1]#W#X0`#[#]*]#a#b+j#b#c.R#g#h/X#i#j.^${$|.^~2QP!m~!Q![2T~2WY!O!P)m!Q![2T#W#X0`#[#]*]#a#b+j#b#c.R#g#h/X#i#j.^#k#l1T${$|.^~2yP!Q![2|~3RR!v~!Q![2|!g!h3[#X#Y3[~3_R{|3h}!O3h!Q![3n~3kP!Q![3n~3sP!v~!Q![3n~3{O#|~~4Qe!v~!O!P5c!Q![7^!d!e6x!g!h3[!i!j6}!m!n6}!o!p6}!r!s6}!v!w6}#W#X0`#X#Y3[#[#]*]#_#`7W#a#b+j#b#c.R#g#h/X#i#j.^#k#l1T#l#m8q#m#n1{${$|.^~5hR!v~!Q![5q!g!h3[#X#Y3[~5v`!v~!Q![5q!d!e6x!g!h3[!i!j6}!m!n6}!o!p6}!r!s6}!v!w6}#X#Y3[#[#]*]#_#`7W#a#b+j#b#c.R#g#h/X#i#j.^${$|.^~6}O!s~~7QQ!d!e6x#]#^7W~7ZP!d!e6x~7cd!v~!O!P5c!Q![7^!d!e6x!g!h3[!i!j6}!m!n6}!o!p6}!r!s6}!v!w6}#W#X0`#X#Y3[#[#]*]#_#`7W#a#b+j#b#c.R#g#h/X#i#j.^#k#l1T#m#n1{${$|.^~8tR!Q![8}!c!i8}#T#Z8}~9SR!v~!Q![8}!c!i8}#T#Z8}P9bT{P!Q![9]![!]9]!c!}9]#R#S9]#T#o9]~9vP!o~!_!`9y~:OO!p~~:TQ|~!_!`:Z#r#s:`~:`O!q~~:eO!P~~:jP!l~!_!`:m~:rO!n~R:yT{P#zQ!Q![:r![!]9]!c!}:r#R#S:r#T#o:r~;_O$k~~;dO$l~~;iO$O~~;lRO#S;i#S#T%`#T~;i~;zO$U~~<PR!_~!_!`<Y!`!a<_#r#s<d~<_O!W~~<dO!Y~~<iO!X~~<nO$W~",tokenizers:[0,1],topRules:{LogQL:[0,37]},specialized:[{term:43,get:(e,t)=>(e=>ne[e.toLowerCase()]||-1)(e)<<1},{term:43,get:(e,t)=>(e=>ie[e.toLowerCase()]||-1)(e)<<1|1},{term:43,get:e=>ae[e]||-1}],tokenPrec:0}),se=1,le=2,ce=6,ue=12,de=13,pe=17,fe=20,he=21,ge=22,me=23,be=36,ve=37,ye=38,Oe=39,Ee=40,xe=41,Se=42,we=43,Te=45,Re=49,Pe=50,Ie=51,Ae=52,Le=53,Ce=54,_e=55,Ne=58,De=59,ke=60,$e=62,je=64,Fe=65,Me=66,Be=67,Qe=68,Ue=69,Ve=70,qe=71,Ge=72,We=75,Xe=83,ze=84,He=87,Ye=88,Ke=90,Ze=92,Je=93,et=94,tt=95,rt=96,nt=97,it=98,at=99,ot=100,st=116,lt=117,ct=119,ut=120,dt=124,pt=126,ft=127,ht=128,gt=129,mt=130,bt=131,vt=132},5699:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t)=>n(e,t,!0)},5729:(e,t,r)=>{var n=r(1144);e.exports=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}},5735:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},5750:(e,t,r)=>{"use strict";const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:a}=r(2074),o=r(1064),s=(t=e.exports={}).re=[],l=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],d=t.t={};let p=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",a],[f,i]],g=(e,t,r)=>{const n=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=p++;o(e,i,t),d[e]=i,c[i]=t,u[i]=n,s[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(n,r?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),g("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${f}+`),g("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),g("FULL",`^${c[d.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),g("LOOSE",`^${c[d.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),g("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),g("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?`+`(?:${c[d.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",c[d.COERCE],!0),g("COERCERTLFULL",c[d.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},5948:(e,t,r)=>{var n=r(2062)(r(9965),"DataView");e.exports=n},5951:e=>{e.exports=function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}},5959:e=>{"use strict";e.exports=n},6031:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>0!==n(e,t,r)},6053:(e,t,r)=>{var n=r(5948),i=r(5455),a=r(6420),o=r(2833),s=r(8143),l=r(9048),c=r(3761),u="[object Map]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",h="[object DataView]",g=c(n),m=c(i),b=c(a),v=c(o),y=c(s),O=l;(n&&O(new n(new ArrayBuffer(1)))!=h||i&&O(new i)!=u||a&&O(a.resolve())!=d||o&&O(new o)!=p||s&&O(new s)!=f)&&(O=function(e){var t=l(e),r="[object Object]"==t?e.constructor:void 0,n=r?c(r):"";if(n)switch(n){case g:return h;case m:return u;case b:return d;case v:return p;case y:return f}return t}),e.exports=O},6089:e=>{"use strict";e.exports=i},6227:(e,t,r)=>{"use strict";r.d(t,{$F:()=>y,Bg:()=>B,Cg:()=>D,E2:()=>j,FV:()=>w,H0:()=>p,Io:()=>m,MX:()=>R,OT:()=>L,QH:()=>E,Rn:()=>N,TQ:()=>x,_i:()=>A,aw:()=>P,d_:()=>I,g5:()=>C,gy:()=>$,mW:()=>f,pS:()=>_,pk:()=>k,sI:()=>T,sc:()=>M,tO:()=>U,vV:()=>g});var n=r(3241),i=r(5508),a=r(3302),o=r(2029),s=r(9107);function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){l(e,t,r[t])}))}return e}function u(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function d(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function p(e=""){const t=[],r=E(e,[i.PN]);for(const s of r){var a,o;const r=null===(a=s.getChild(i.dJ))||void 0===a?void 0:a.getChild(i.Sg),l=null===(o=s.getChild(i.dJ))||void 0===o?void 0:o.getChild(i.q5),c=h(s);if((r||l)&&c.length)for(const r of c){const i=e.substring(r.from,r.to).trim(),a="`"===i[0],o=i.substring(1,i.length-1);if(!o)continue;let s="";s=l?a?o:o.replace(/\\\\/g,"\\"):(0,n.escapeRegExp)(o),s&&t.push(s)}}return t}function f(e){return e.replace("Expr: ","")}function h(e){const t=[];let r=e;do{const e=r.getChild(i.Qf);e&&!r.getChild(i.w7)&&t.push(e),r=r.getChild(i.ih)}while(null!=r);return t}function g(e){let t=m(e);const{instant:r,range:n}=e,i=d(e,["instant","range"]);try{T(e.expr)&&t===s.U3.Instant&&(t=s.U3.Range)}catch(e){}return u(c({},i),{queryType:t})}function m(e){const{queryType:t}=e;return t===s.U3.Range||t===s.U3.Instant||t===s.U3.Stream?t:!0===e.instant?s.U3.Instant:s.U3.Range}const b=["String","Identifier","LineComment","Number"],v=["__error__","__interval","__interval_ms","__auto"];function y(e){let t=e;return i.K3.parse(e).iterate({enter:({name:r,from:n,to:i})=>{const a=e.substring(n,i);b.includes(r)&&!v.includes(a)&&(t=t.replace(a,r))}}),t}function O(e,t){let r=!1;return i.K3.parse(e).iterate({enter:({type:e})=>{if(e.id===t)return r=!0,!1}}),r}function E(e,t){const r=[];return i.K3.parse(e).iterate({enter:e=>{(void 0===t||t.includes(e.type.id))&&r.push(e.node)}}),r}function x(e,t){const r=[];return i.K3.parse(e).iterate({enter:e=>{(void 0===t||t.includes(e.type.id))&&r.push(a.Ch.fromNode(e.node))}}),r}function S(e,t){const r=E(e,[t]);return r.length>0?r[0]:void 0}function w(e){return O(e,o.Ql)}function T(e){return e.trim().length>2&&!O(e,i.Yw)}function R(e){const t=E(e,[i.iT,i.eF,i.c$]).length;return{queryWithParser:t>0,parserCount:t}}function P(e){const t=E(e,[i.iT,i.LM,i.c$]);return t.length>0?e.substring(t[0].from,t[0].to).trim():void 0}function I(e){const t=E(e,[i.bY]);for(const n of t){var r;const t=null===(r=n.getChild(i.g$))||void 0===r?void 0:r.getChild(i.gw);if(t){if("__error__"===e.substring(t.from,t.to))return!0}}return!1}function A(e){return O(e,i.J_)}function L(e){if(T(e))return e;const t=S(e,i.MD);if(!t)return"";const r=e.substring(t.from,t.to),n=S(e,i.AL);return`${r} ${n?e.substring(n.from,n.to):""}`.trim()}function C(e,t){if(T(e))return e;const r=E(e,[i.Yw]).reverse().find((e=>e.from<=t&&e.to>=t));return r?L(e.substring(r.from,r.to)):""}function _(e){return O(e,i.bY)}function N(e){return O(e,i.PN)}function D(e){const t=E(e,[i.Q6]);for(const r of t)if(e.substring(r.from,r.to).match(/\[\$__range(_s|_ms)?/))return!0;return!1}function k(e){return(0,a.yB)(e).map((t=>e.slice(t.from,t.to)))}function $(e){return e.filter((e=>!e.hide)).filter((e=>!e.refId.includes("do-not-chunk"))).filter((e=>e.expr)).length>0}function j(e){return e.filter((e=>!e.hide)).filter((e=>e.queryType!==s.U3.Instant)).filter((e=>!e.refId.includes("do-not-shard"))).filter((e=>e.expr)).filter((e=>e.direction===s.ti.Scan&&T(e.expr)||function(e){if(T(e))return!1;e=e.trim().toLowerCase();const t=E(e,[i.MK]);if(t.length>0)return!1;const r=E(e,[i.ZQ]),n=r.filter((t=>"sum"===F(e,t))),a=r.filter((t=>"sum"!==F(e,t))),o=n.filter((e=>a.every((t=>e.from<t.from))));if(a.length>0)return o.length>0;const s=E(e,[i.lo]),l=["count_over_time","sum_over_time","bytes_over_time"];for(const t of s)if(!l.includes(F(e,t)))return o.length>0;return!0}(e.expr))).length>0}function F(e,t){return e.substring(t.from,t.to)}const M=e=>{if(e&&(e=>!!e&&"expr"in e&&void 0!==e.expr)(e))return e},B=(e,t)=>{if(0===t.length)return e;let r=t.join("|");return"-1"===r||1===t.length?(r="-1"===r?"":r,e.map((e=>u(c({},e),{expr:Q(e.expr,"=",r)})))):e.map((e=>u(c({},e),{expr:Q(e.expr,"=~",r)})))};function Q(e,t,r){const n=(0,a.tE)(e,"__stream_shard__",t,r,s.HD.Indexed);return T(e)?n:(0,a.Gk)(n,["__stream_shard__"])}const U=e=>{const t=E(e,[i.MD]);return t.length>0?e.substring(t[0].from,t[0].to):""}},6392:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},6420:(e,t,r)=>{var n=r(2062)(r(9965),"Promise");e.exports=n},6424:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},6504:(e,t,r)=>{var n=r(5735),i=r(9458),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))a.call(e,r)&&"constructor"!=r&&t.push(r);return t}},6513:(e,t,r)=>{"use strict";const n=r(4256);e.exports=(e,t)=>{const r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}},6665:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}},6791:(e,t,r)=>{var n=r(2784),i=r(5196),a=r(4913),o=r(4264),s=r(6665),l=r(5087),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=a(e),u=!r&&i(e),d=!r&&!u&&o(e),p=!r&&!u&&!d&&l(e),f=r||u||d||p,h=f?n(e.length,String):[],g=h.length;for(var m in e)!t&&!c.call(e,m)||f&&("length"==m||d&&("offset"==m||"parent"==m)||p&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||h.push(m);return h}},6988:(e,t,r)=>{"use strict";const n=r(4708),i=r(2839);e.exports=(e,t,r)=>{let a=null,o=null,s=null;try{s=new i(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(a&&-1!==o.compare(e)||(a=e,o=new n(a,r)))})),a}},7134:(e,t,r)=>{var n=r(1866),i=r(582);e.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},7222:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},7248:(e,t,r)=>{var n=r(1272),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},7379:(e,t,r)=>{"use strict";const n=r(7715);e.exports=(e,t,r)=>n(e,t,">",r)},7386:(e,t,r)=>{var n=r(9048),i=r(9466);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},7409:(e,t,r)=>{"use strict";var n=s(r(4377)),i=s(r(9445)),a=s(r(7881)),o=s(r(1432));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t.language){case"db2":return new n.default(t).format(e);case"n1ql":return new i.default(t).format(e);case"pl/sql":return new a.default(t).format(e);case"sql":case void 0:return new o.default(t).format(e);default:throw Error("Unsupported SQL dialect: ".concat(t.language))}}},7453:(e,t,r)=>{"use strict";const n=r(4708),i=r(2839),a=r(9308);e.exports=(e,t)=>{e=new i(e,t);let r=new n("0.0.0");if(e.test(r))return r;if(r=new n("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let o=null;i.forEach((e=>{const t=new n(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!a(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!a(r,o)||(r=o)}return r&&e.test(r)?r:null}},7565:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t,r)=>{const i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}},7618:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>n(t,e,r)},7694:e=>{"use strict";e.exports=c},7715:(e,t,r)=>{"use strict";const n=r(4708),i=r(9264),{ANY:a}=i,o=r(2839),s=r(3238),l=r(9308),c=r(2083),u=r(4624),d=r(3833);e.exports=(e,t,r,p)=>{let f,h,g,m,b;switch(e=new n(e,p),t=new o(t,p),r){case">":f=l,h=u,g=c,m=">",b=">=";break;case"<":f=c,h=d,g=l,m="<",b="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(e,t,p))return!1;for(let r=0;r<t.set.length;++r){const n=t.set[r];let o=null,s=null;if(n.forEach((e=>{e.semver===a&&(e=new i(">=0.0.0")),o=o||e,s=s||e,f(e.semver,o.semver,p)?o=e:g(e.semver,s.semver,p)&&(s=e)})),o.operator===m||o.operator===b)return!1;if((!s.operator||s.operator===m)&&h(e,s.semver))return!1;if(s.operator===b&&g(e,s.semver))return!1}return!0}},7781:e=>{"use strict";e.exports=t},7881:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(r(9157)),i=o(r(3202)),a=o(r(1025));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l,c=["A","ACCESSIBLE","AGENT","AGGREGATE","ALL","ALTER","ANY","ARRAY","AS","ASC","AT","ATTRIBUTE","AUTHID","AVG","BETWEEN","BFILE_BASE","BINARY_INTEGER","BINARY","BLOB_BASE","BLOCK","BODY","BOOLEAN","BOTH","BOUND","BREADTH","BULK","BY","BYTE","C","CALL","CALLING","CASCADE","CASE","CHAR_BASE","CHAR","CHARACTER","CHARSET","CHARSETFORM","CHARSETID","CHECK","CLOB_BASE","CLONE","CLOSE","CLUSTER","CLUSTERS","COALESCE","COLAUTH","COLLECT","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPILED","COMPRESS","CONNECT","CONSTANT","CONSTRUCTOR","CONTEXT","CONTINUE","CONVERT","COUNT","CRASH","CREATE","CREDENTIAL","CURRENT","CURRVAL","CURSOR","CUSTOMDATUM","DANGLING","DATA","DATE_BASE","DATE","DAY","DECIMAL","DEFAULT","DEFINE","DELETE","DEPTH","DESC","DETERMINISTIC","DIRECTORY","DISTINCT","DO","DOUBLE","DROP","DURATION","ELEMENT","ELSIF","EMPTY","END","ESCAPE","EXCEPTIONS","EXCLUSIVE","EXECUTE","EXISTS","EXIT","EXTENDS","EXTERNAL","EXTRACT","FALSE","FETCH","FINAL","FIRST","FIXED","FLOAT","FOR","FORALL","FORCE","FROM","FUNCTION","GENERAL","GOTO","GRANT","GROUP","HASH","HEAP","HIDDEN","HOUR","IDENTIFIED","IF","IMMEDIATE","IN","INCLUDING","INDEX","INDEXES","INDICATOR","INDICES","INFINITE","INSTANTIABLE","INT","INTEGER","INTERFACE","INTERVAL","INTO","INVALIDATE","IS","ISOLATION","JAVA","LANGUAGE","LARGE","LEADING","LENGTH","LEVEL","LIBRARY","LIKE","LIKE2","LIKE4","LIKEC","LIMITED","LOCAL","LOCK","LONG","MAP","MAX","MAXLEN","MEMBER","MERGE","MIN","MINUTE","MLSLABEL","MOD","MODE","MONTH","MULTISET","NAME","NAN","NATIONAL","NATIVE","NATURAL","NATURALN","NCHAR","NEW","NEXTVAL","NOCOMPRESS","NOCOPY","NOT","NOWAIT","NULL","NULLIF","NUMBER_BASE","NUMBER","OBJECT","OCICOLL","OCIDATE","OCIDATETIME","OCIDURATION","OCIINTERVAL","OCILOBLOCATOR","OCINUMBER","OCIRAW","OCIREF","OCIREFCURSOR","OCIROWID","OCISTRING","OCITYPE","OF","OLD","ON","ONLY","OPAQUE","OPEN","OPERATOR","OPTION","ORACLE","ORADATA","ORDER","ORGANIZATION","ORLANY","ORLVARY","OTHERS","OUT","OVERLAPS","OVERRIDING","PACKAGE","PARALLEL_ENABLE","PARAMETER","PARAMETERS","PARENT","PARTITION","PASCAL","PCTFREE","PIPE","PIPELINED","PLS_INTEGER","PLUGGABLE","POSITIVE","POSITIVEN","PRAGMA","PRECISION","PRIOR","PRIVATE","PROCEDURE","PUBLIC","RAISE","RANGE","RAW","READ","REAL","RECORD","REF","REFERENCE","RELEASE","RELIES_ON","REM","REMAINDER","RENAME","RESOURCE","RESULT_CACHE","RESULT","RETURN","RETURNING","REVERSE","REVOKE","ROLLBACK","ROW","ROWID","ROWNUM","ROWTYPE","SAMPLE","SAVE","SAVEPOINT","SB1","SB2","SB4","SEARCH","SECOND","SEGMENT","SELF","SEPARATE","SEQUENCE","SERIALIZABLE","SHARE","SHORT","SIZE_T","SIZE","SMALLINT","SOME","SPACE","SPARSE","SQL","SQLCODE","SQLDATA","SQLERRM","SQLNAME","SQLSTATE","STANDARD","START","STATIC","STDDEV","STORED","STRING","STRUCT","STYLE","SUBMULTISET","SUBPARTITION","SUBSTITUTABLE","SUBTYPE","SUCCESSFUL","SUM","SYNONYM","SYSDATE","TABAUTH","TABLE","TDO","THE","THEN","TIME","TIMESTAMP","TIMEZONE_ABBR","TIMEZONE_HOUR","TIMEZONE_MINUTE","TIMEZONE_REGION","TO","TRAILING","TRANSACTION","TRANSACTIONAL","TRIGGER","TRUE","TRUSTED","TYPE","UB1","UB2","UB4","UID","UNDER","UNIQUE","UNPLUG","UNSIGNED","UNTRUSTED","USE","USER","USING","VALIDATE","VALIST","VALUE","VARCHAR","VARCHAR2","VARIABLE","VARIANCE","VARRAY","VARYING","VIEW","VIEWS","VOID","WHENEVER","WHILE","WITH","WORK","WRAPPED","WRITE","YEAR","ZONE"],u=["ADD","ALTER COLUMN","ALTER TABLE","BEGIN","CONNECT BY","DECLARE","DELETE FROM","DELETE","END","EXCEPT","EXCEPTION","FETCH FIRST","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","LIMIT","LOOP","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","START WITH","UPDATE","VALUES","WHERE"],d=["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],p=["AND","CROSS APPLY","CROSS JOIN","ELSE","END","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","XOR"],f=function(e,t){if(e.type===a.default.RESERVED_TOP_LEVEL&&"SET"===e.value&&"BY"===t.value)return e.type=a.default.RESERVED,e},h=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=t}var t,r,a;return t=e,(r=[{key:"format",value:function(e){return l||(l=new i.default({reservedWords:c,reservedTopLevelWords:u,reservedNewlineWords:p,reservedTopLevelWordsNoIndent:d,stringTypes:['""',"N''","''","``"],openParens:["(","CASE","BEGIN"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:[":"],lineCommentTypes:["--"],specialWordChars:["_","$","#",".","@"]})),new n.default(this.cfg,l,f).format(e)}}])&&s(t.prototype,r),a&&s(t,a),e}();t.default=h,e.exports=t.default},7895:(e,t,r)=>{"use strict";r.d(t,{Bb:()=>p,Cs:()=>d,Ed:()=>g,N4:()=>f,P7:()=>y,Qn:()=>c,WV:()=>s,qv:()=>u,sM:()=>b,tY:()=>h,tt:()=>v});var n=r(3241),i=r(7781),a=r(9107);function o(e){return t=e/1e3,Math.floor(t/60);var t}function s(e,t){if(e&&t){const r=o(e.from.valueOf())===o(t.from.valueOf()),n=o(e.to.valueOf())===o(t.to.valueOf());return!(r&&n)}return!1}const l=/[*+?()|\\.\[\]{}^$]/g;function c(e){return e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function u(e){return e.replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}function d(e){return c(e.replace(l,"\\$&"))}function p(e,t){return f(t)?d(e):c(e)}function f(e){return!(!e||!e.includes("=~")&&!e.includes("!~"))}function h(e){const t=new RegExp(`^(?:-?\\d+(?:\\.\\d+)?)(?:${["b","kib","Kib","kb","KB","mib","Mib","mb","MB","gib","Gib","gb","GB","tib","Tib","tb","TB","pib","Pib","pb","PB","eib","Eib","eb","EB"].join("|")})$`);return!!e.match(t)}function g(e,t,r){var n;if(!t||void 0===r)return null;const i=null===(n=t.fields.find((e=>"labelTypes"===e.name)))||void 0===n?void 0:n.values[r];if(!i)return null;switch(i[e]){case"I":return a.HD.Indexed;case"S":return a.HD.StructuredMetadata;case"P":return a.HD.Parsed;default:return null}}const m={[i.AbstractLabelOperator.Equal]:"=",[i.AbstractLabelOperator.NotEqual]:"!=",[i.AbstractLabelOperator.EqualRegEx]:"=~",[i.AbstractLabelOperator.NotEqualRegEx]:"!~"},b=(0,n.invert)(m);function v(e){const t=e.labelMatchers.map((e=>{const t=m[e.operator];return t?`${e.name}${t}"${e.value}"`:""})).filter((e=>""!==e)).join(", ");return t?`{${t}}`:""}function y(e){const t={};e.forEach((e=>{Object.keys(e).forEach((r=>{t[r]||(t[r]=new Set),t[r].has(e[r])||t[r].add(e[r])}))}));const r={};return E(Object.keys(t)).forEach((e=>{r[e]=E(Array.from(t[e]))})),{values:r,keys:Object.keys(r)}}const O=1e4;function E(e){return e.slice(0,O)}},7969:(e,t,r)=>{var n=r(6504),i=r(6053),a=r(5196),o=r(4913),s=r(7134),l=r(4264),c=r(5735),u=r(5087),d=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(o(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||u(e)||a(e)))return!e.length;var t=i(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(c(e))return!n(e).length;for(var r in e)if(d.call(e,r))return!1;return!0}},8044:(e,t,r)=>{"use strict";var n=r(5959),i=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var n,a={},c=null,u=null;for(n in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,n)&&!l.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:i,type:e,key:c,ref:u,props:a,_owner:s.current}}t.Fragment=a,t.jsx=c,t.jsxs=c},8116:(e,t,r)=>{"use strict";r.d(t,{EF:()=>o,IQ:()=>i,Ln:()=>a,NS:()=>l,h5:()=>s});var n=r(1886),i=function(e){return e.Log="log",e.Metric="metric",e}({}),a=function(e){return e.Aggregations="Aggregations",e.RangeFunctions="Range functions",e.Functions="Functions",e.Formats="Formats",e.LineFilters="Line filters",e.LabelFilters="Label filters",e[e.BinaryOps=`${n.T}`]="BinaryOps",e}({}),o=function(e){return e.Json="json",e.Logfmt="logfmt",e.Regexp="regexp",e.Pattern="pattern",e.Unpack="unpack",e.LineFormat="line_format",e.LabelFormat="label_format",e.Decolorize="decolorize",e.Drop="drop",e.Keep="keep",e.Rate="rate",e.RateCounter="rate_counter",e.CountOverTime="count_over_time",e.SumOverTime="sum_over_time",e.AvgOverTime="avg_over_time",e.MaxOverTime="max_over_time",e.MinOverTime="min_over_time",e.FirstOverTime="first_over_time",e.LastOverTime="last_over_time",e.StdvarOverTime="stdvar_over_time",e.StddevOverTime="stddev_over_time",e.QuantileOverTime="quantile_over_time",e.BytesRate="bytes_rate",e.BytesOverTime="bytes_over_time",e.AbsentOverTime="absent_over_time",e.Sum="sum",e.Avg="avg",e.Min="min",e.Max="max",e.Stddev="stddev",e.Stdvar="stdvar",e.Count="count",e.TopK="topk",e.BottomK="bottomk",e.LineContains="__line_contains",e.LineContainsNot="__line_contains_not",e.LineContainsCaseInsensitive="__line_contains_case_insensitive",e.LineContainsNotCaseInsensitive="__line_contains_not_case_insensitive",e.LineMatchesRegex="__line_matches_regex",e.LineMatchesRegexNot="__line_matches_regex_not",e.LineFilterIpMatches="__line_filter_ip_matches",e.LabelFilter="__label_filter",e.LabelFilterNoErrors="__label_filter_no_errors",e.LabelFilterIpMatches="__label_filter_ip_marches",e.Unwrap="unwrap",e.SumBy="__sum_by",e.SumWithout="__sum_without",e.Addition="__addition",e.Subtraction="__subtraction",e.MultiplyBy="__multiply_by",e.DivideBy="__divide_by",e.Modulo="__modulo",e.Exponent="__exponent",e.NestedQuery="__nested_query",e.EqualTo="__equal_to",e.NotEqualTo="__not_equal_to",e.GreaterThan="__greater_than",e.LessThan="__less_than",e.GreaterOrEqual="__greater_or_equal",e.LessOrEqual="__less_or_equal",e}({}),s=function(e){return e[e.LineFilters=1]="LineFilters",e[e.Parsers=2]="Parsers",e[e.PipeOperations=3]="PipeOperations",e[e.Unwrap=4]="Unwrap",e[e.NoErrors=5]="NoErrors",e[e.RangeVectorFunction=5]="RangeVectorFunction",e[e.Last=6]="Last",e}({});const l={equals:{label:"=",value:"=",description:"Equals",isMultiValue:!1},doesNotEqual:{label:"!=",value:"!=",description:"Does not equal",isMultiValue:!1},matchesRegex:{label:"=~",value:"=~",description:"Matches regex",isMultiValue:!0},doesNotMatchRegex:{label:"!~",value:"!~",description:"Does not match regex",isMultiValue:!0},greaterThan:{label:">",value:">",description:"Greater than",isMultiValue:!1},greaterThanOrEqual:{label:">=",value:">=",description:"Greater than or equal to",isMultiValue:!1},lessThan:{label:"<",value:"<",description:"Less than",isMultiValue:!1},lessThanOrEqual:{label:"<=",value:"<=",description:"Less than or equal to",isMultiValue:!1},contains:{label:"|=",value:"|=",description:"Contains",isMultiValue:!1},doesNotContain:{label:"!=",value:"!=",description:"Does not contain",isMultiValue:!1}}},8143:(e,t,r)=>{var n=r(2062)(r(9965),"WeakMap");e.exports=n},8146:e=>{"use strict";e.exports=p},8285:(e,t,r)=>{"use strict";const n=r(3238),i=r(3440);e.exports=(e,t,r)=>{const a=[];let o=null,s=null;const l=e.sort(((e,t)=>i(e,t,r)));for(const e of l){n(e,t,r)?(s=e,o||(o=e)):(s&&a.push([o,s]),s=null,o=null)}o&&a.push([o,null]);const c=[];for(const[e,t]of a)e===t?c.push(e):t||e!==l[0]?t?e===l[0]?c.push(`<=${t}`):c.push(`${e} - ${t}`):c.push(`>=${e}`):c.push("*");const u=c.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return u.length<d.length?u:t}},8303:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},8398:e=>{"use strict";e.exports=u},8422:(e,t,r)=>{"use strict";r.d(t,{k:()=>i});const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function i(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}},8472:(e,t,r)=>{var n=r(3158),i=/[\\^$.*+?()[\]{}|]/g,a=RegExp(i.source);e.exports=function(e){return(e=n(e))&&a.test(e)?e.replace(i,"\\$&"):e}},8531:e=>{"use strict";e.exports=r},8635:(e,t,r)=>{"use strict";r.d(t,{C:()=>a,I:()=>o});var n=r(2954),i=r(8116);const a=[{id:i.EF.Addition,name:"Add scalar",sign:"+"},{id:i.EF.Subtraction,name:"Subtract scalar",sign:"-"},{id:i.EF.MultiplyBy,name:"Multiply by scalar",sign:"*"},{id:i.EF.DivideBy,name:"Divide by scalar",sign:"/"},{id:i.EF.Modulo,name:"Modulo by scalar",sign:"%"},{id:i.EF.Exponent,name:"Exponent",sign:"^"},{id:i.EF.EqualTo,name:"Equal to",sign:"==",comparison:!0},{id:i.EF.NotEqualTo,name:"Not equal to",sign:"!=",comparison:!0},{id:i.EF.GreaterThan,name:"Greater than",sign:">",comparison:!0},{id:i.EF.LessThan,name:"Less than",sign:"<",comparison:!0},{id:i.EF.GreaterOrEqual,name:"Greater or equal to",sign:">=",comparison:!0},{id:i.EF.LessOrEqual,name:"Less or equal to",sign:"<=",comparison:!0}],o=a.map((e=>{const t=[{name:"Value",type:"number"}];let r=[2];return e.comparison&&(t.push({name:"Bool",type:"boolean",description:"If checked comparison will return 0 or 1 for the value rather than filtering."}),r=[2,!1]),{id:e.id,name:e.name,params:t,defaultParams:r,toggleable:!0,alternativesKey:"binary scalar operations",category:i.Ln.BinaryOps,renderer:(a=e.sign,function(e,t,r){let n=e.params[0],i="";return 2===e.params.length&&(i=e.params[1]?" bool":""),`${r} ${a}${i} ${n}`}),addOperationHandler:n.iZ};var a}))},8854:(e,t,r)=>{"use strict";const n=r(4256);e.exports=(e,t)=>{const r=n(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},8906:e=>{e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},8951:(e,t,r)=>{var n=r(9048),i=r(4913),a=r(9466);e.exports=function(e){return"string"==typeof e||!i(e)&&a(e)&&"[object String]"==n(e)}},8967:e=>{e.exports=function(e){return e!=e}},9048:(e,t,r)=>{var n=r(2609),i=r(2899),a=r(7222),o=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(e)}},9076:(e,t,r)=>{"use strict";r.d(t,{Tp:()=>d});var n=r(709);function i(e,t="latest"){return a(e,t.replace(/\-.*/,""))}function a(e,t){const r={};for(const[n,i]of Object.entries(e))o(i)?r[n]=a(i,t):(l(i,n),r[n]=s(i,t));return r}function o(e){if("object"==typeof e){const[t]=Object.keys(e);return!(0,n.valid)(t)}return!1}function s(e,t){let r,i=Object.keys(e).sort(n.compare);if("latest"===t)return e[i[i.length-1]];for(const e of i)(0,n.gte)(t,e)&&(r=e);return r||(r=i[i.length-1]),e[r]}function l(e,t){if(!Object.keys(e).every((e=>(0,n.valid)(e))))throw new Error(`Invalid semver version: '${t}'`)}const c="8.5.0",u={RadioButton:{container:{"10.2.3":"data-testid radio-button"}},Breadcrumbs:{breadcrumb:{"9.4.0":e=>`data-testid ${e} breadcrumb`}},CanvasGridAddActions:{addPanel:{"12.1.0":"data-testid CanvasGridAddActions add-panel"},groupPanels:{"12.1.0":"data-testid CanvasGridAddActions group-panels"},ungroup:{"12.1.0":"data-testid CanvasGridAddActions ungroup"},ungroupRows:{"12.1.0":"data-testid CanvasGridAddActions ungroup-rows"},addRow:{"12.1.0":"data-testid CanvasGridAddActions add-row"},pasteRow:{"12.1.0":"data-testid CanvasGridAddActions paste-row"},addTab:{"12.1.0":"data-testid CanvasGridAddActions add-tab"},pasteTab:{"12.1.0":"data-testid CanvasGridAddActions paste-tab"},pastePanel:{"12.1.0":"data-testid CanvasGridAddActions paste-panel"}},DashboardEditPaneSplitter:{primaryBody:{"12.1.0":"data-testid DashboardEditPaneSplitter primary body"}},EditPaneHeader:{deleteButton:{"12.1.0":"data-testid EditPaneHeader delete panel"},copyDropdown:{"12.1.0":"data-testid EditPaneHeader copy dropdown"},copy:{"12.1.0":"data-testid EditPaneHeader copy"},duplicate:{"12.1.0":"data-testid EditPaneHeader duplicate"},backButton:{"12.1.0":"data-testid EditPaneHeader back"}},TimePicker:{openButton:{[c]:"data-testid TimePicker Open Button"},overlayContent:{"10.2.3":"data-testid TimePicker Overlay Content"},fromField:{"10.2.3":"data-testid Time Range from field",[c]:"Time Range from field"},toField:{"10.2.3":"data-testid Time Range to field",[c]:"Time Range to field"},applyTimeRange:{[c]:"data-testid TimePicker submit button"},copyTimeRange:{"10.4.0":"data-testid TimePicker copy button"},pasteTimeRange:{"10.4.0":"data-testid TimePicker paste button"},calendar:{label:{"10.2.3":"data-testid Time Range calendar",[c]:"Time Range calendar"},openButton:{"10.2.3":"data-testid Open time range calendar",[c]:"Open time range calendar"},closeButton:{"10.2.3":"data-testid Close time range Calendar",[c]:"Close time range Calendar"}},absoluteTimeRangeTitle:{[c]:"data-testid-absolute-time-range-narrow"}},DataSourcePermissions:{form:{"9.5.0":()=>'form[name="addPermission"]'},roleType:{"9.5.0":"Role to add new permission to"},rolePicker:{"9.5.0":"Built-in role picker"},permissionLevel:{"12.0.0":"Permission level","9.5.0":"Permission Level"}},DateTimePicker:{input:{"10.2.3":"data-testid date-time-input"}},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:{[c]:"Test Data Query scenario select container"},scenarioSelect:{[c]:"Test Data Query scenario select"},max:{[c]:"TestData max"},min:{[c]:"TestData min"},noise:{[c]:"TestData noise"},seriesCount:{[c]:"TestData series count"},spread:{[c]:"TestData spread"},startValue:{[c]:"TestData start value"},drop:{[c]:"TestData drop values"}}},DataSourceHttpSettings:{urlInput:{"10.4.0":"data-testid Datasource HTTP settings url",[c]:"Datasource HTTP settings url"}},Jaeger:{traceIDInput:{[c]:"Trace ID"}},Prometheus:{configPage:{connectionSettings:{[c]:"Data source connection URL"},manageAlerts:{"10.4.0":"prometheus-alerts-manager"},allowAsRecordingRulesTarget:{"12.1.0":"prometheus-recording-rules-target"},scrapeInterval:{"10.4.0":"data-testid scrape interval"},queryTimeout:{"10.4.0":"data-testid query timeout"},defaultEditor:{"10.4.0":"data-testid default editor"},disableMetricLookup:{"10.4.0":"disable-metric-lookup"},prometheusType:{"10.4.0":"data-testid prometheus type"},prometheusVersion:{"10.4.0":"data-testid prometheus version"},cacheLevel:{"10.4.0":"data-testid cache level"},incrementalQuerying:{"10.4.0":"prometheus-incremental-querying"},queryOverlapWindow:{"10.4.0":"data-testid query overlap window"},disableRecordingRules:{"10.4.0":"disable-recording-rules"},customQueryParameters:{"10.4.0":"data-testid custom query parameters"},httpMethod:{"10.4.0":"data-testid http method"},exemplarsAddButton:{"10.3.0":"data-testid Add exemplar config button",[c]:"Add exemplar config button"},internalLinkSwitch:{"10.3.0":"data-testid Internal link switch",[c]:"Internal link switch"},codeModeMetricNamesSuggestionLimit:{"11.1.0":"data-testid code mode metric names suggestion limit"},seriesLimit:{"12.0.2":"data-testid maximum series limit"}},queryEditor:{explain:{"10.4.0":"data-testid prometheus explain switch wrapper"},editorToggle:{"10.4.0":"data-testid QueryEditorModeToggle"},options:{"10.4.0":"data-testid prometheus options"},legend:{"10.4.0":"data-testid prometheus legend wrapper"},format:{"10.4.0":"data-testid prometheus format"},step:{"10.4.0":"data-testid prometheus-step"},type:{"10.4.0":"data-testid prometheus type"},exemplars:{"10.4.0":"data-testid prometheus-exemplars"},builder:{metricSelect:{"10.4.0":"data-testid metric select"},hints:{"10.4.0":"data-testid prometheus hints"},metricsExplorer:{"10.4.0":"data-testid metrics explorer"},queryAdvisor:{"10.4.0":"data-testid query advisor"}},code:{queryField:{"10.4.0":"data-testid prometheus query field"},metricsCountInfo:{"11.1.0":"data-testid metrics count disclaimer"},metricsBrowser:{openButton:{"10.4.0":"data-testid open metrics browser"},selectMetric:{"10.4.0":"data-testid select a metric"},seriesLimit:{"10.3.1":"data-testid series limit"},metricList:{"10.4.0":"data-testid metric list"},labelNamesFilter:{"10.4.0":"data-testid label names filter"},labelValuesFilter:{"10.4.0":"data-testid label values filter"},useQuery:{"10.4.0":"data-testid use query"},useAsRateQuery:{"10.4.0":"data-testid use as rate query"},validateSelector:{"10.4.0":"data-testid validate selector"},clear:{"10.4.0":"data-testid clear"}}}},exemplarMarker:{"10.3.0":"data-testid Exemplar marker",[c]:"Exemplar marker"},variableQueryEditor:{queryType:{"10.4.0":"data-testid query type"},labelnames:{metricRegex:{"10.4.0":"data-testid label names metric regex"}},labelValues:{labelSelect:{"10.4.0":"data-testid label values label select"}},metricNames:{metricRegex:{"10.4.0":"data-testid metric names metric regex"}},varQueryResult:{"10.4.0":"data-testid variable query result"},seriesQuery:{"10.4.0":"data-testid prometheus series query"},classicQuery:{"10.4.0":"data-testid prometheus classic query"}},annotations:{minStep:{"10.4.0":"data-testid prometheus-annotation-min-step"},title:{"10.4.0":"data-testid prometheus annotation title"},tags:{"10.4.0":"data-testid prometheus annotation tags"},text:{"10.4.0":"data-testid prometheus annotation text"},seriesValueAsTimestamp:{"10.4.0":"data-testid prometheus annotation series value as timestamp"}}}},Menu:{MenuComponent:{[c]:e=>`${e} menu`},MenuGroup:{[c]:e=>`${e} menu group`},MenuItem:{[c]:e=>`${e} menu item`},SubMenu:{container:{"10.3.0":"data-testid SubMenu container",[c]:"SubMenu container"},icon:{"10.3.0":"data-testid SubMenu icon",[c]:"SubMenu icon"}}},Panels:{Panel:{title:{[c]:e=>`data-testid Panel header ${e}`},content:{"11.1.0":"data-testid panel content"},headerContainer:{"9.5.0":"data-testid header-container"},headerItems:{"10.2.0":e=>`data-testid Panel header item ${e}`},menuItems:{"9.5.0":e=>`data-testid Panel menu item ${e}`},menu:{"9.5.0":e=>`data-testid Panel menu ${e}`},containerByTitle:{[c]:e=>`${e} panel`},headerCornerInfo:{[c]:e=>`Panel header ${e}`},status:{"10.2.0":e=>`data-testid Panel status ${e}`,[c]:e=>"Panel status"},loadingBar:{"10.0.0":()=>"Panel loading bar"},HoverWidget:{container:{"10.1.0":"data-testid hover-header-container",[c]:"hover-header-container"},dragIcon:{"10.0.0":"data-testid drag-icon"}},PanelDataErrorMessage:{"10.4.0":"data-testid Panel data error message"}},Visualization:{Graph:{container:{"9.5.0":"Graph container"},VisualizationTab:{legendSection:{[c]:"Legend section"}},Legend:{legendItemAlias:{[c]:e=>`gpl alias ${e}`},showLegendSwitch:{[c]:"gpl show legend"}},xAxis:{labels:{[c]:()=>"div.flot-x-axis > div.flot-tick-label"}}},BarGauge:{valueV2:{[c]:"data-testid Bar gauge value"}},PieChart:{svgSlice:{"10.3.0":"data testid Pie Chart Slice"}},Text:{container:{[c]:()=>".markdown-html"}},Table:{header:{[c]:"table header"},footer:{[c]:"table-footer"},body:{"10.2.0":"data-testid table body"}},TableNG:{Filters:{HeaderButton:{"12.1.0":"data-testid tableng header filter"},Container:{"12.1.0":"data-testid tablenf filter container"},SelectAll:{"12.1.0":"data-testid tableng filter select-all"}},Tooltip:{Wrapper:{"12.2.0":"data-testid tableng tooltip wrapper"},Caret:{"12.2.0":"data-testid tableng tooltip caret"}},Footer:{ReducerLabel:{"12.2.0":"data-testid tableng footer reducer-label"},Value:{"12.2.0":"data-testid tableng footer value"}}},Tooltip:{Wrapper:{"12.3.0":"data-testid viz-tooltip-wrapper"}}}},VizLegend:{seriesName:{"10.3.0":e=>`data-testid VizLegend series ${e}`}},Drawer:{General:{title:{[c]:e=>`Drawer title ${e}`},expand:{[c]:"Drawer expand"},contract:{[c]:"Drawer contract"},close:{"10.3.0":"data-testid Drawer close",[c]:"Drawer close"},rcContentWrapper:{"9.4.0":()=>".rc-drawer-content-wrapper"},subtitle:{"10.4.0":"data-testid drawer subtitle"}},DashboardSaveDrawer:{saveButton:{"11.1.0":"data-testid Save dashboard drawer button"},saveAsButton:{"11.1.0":"data-testid Save as dashboard drawer button"},saveAsTitleInput:{"11.1.0":"Save dashboard title field"}}},PanelEditor:{General:{content:{"11.1.0":"data-testid Panel editor content","8.0.0":"Panel editor content"}},OptionsPane:{content:{"11.1.0":"data-testid Panel editor option pane content",[c]:"Panel editor option pane content"},select:{[c]:"Panel editor option pane select"},fieldLabel:{[c]:e=>`${e} field property editor`},fieldInput:{"11.0.0":e=>`data-testid Panel editor option pane field input ${e}`}},DataPane:{content:{"11.1.0":"data-testid Panel editor data pane content",[c]:"Panel editor data pane content"}},applyButton:{"9.2.0":"data-testid Apply changes and go back to dashboard","9.1.0":"Apply changes and go back to dashboard","8.0.0":"panel editor apply"},toggleVizPicker:{"10.0.0":"data-testid toggle-viz-picker","8.0.0":"toggle-viz-picker"},toggleVizOptions:{"10.1.0":"data-testid toggle-viz-options",[c]:"toggle-viz-options"},toggleTableView:{"11.1.0":"data-testid toggle-table-view",[c]:"toggle-table-view"},showZoomField:{"10.2.0":"Map controls Show zoom control field property editor"},showAttributionField:{"10.2.0":"Map controls Show attribution field property editor"},showScaleField:{"10.2.0":"Map controls Show scale field property editor"},showMeasureField:{"10.2.0":"Map controls Show measure tools field property editor"},showDebugField:{"10.2.0":"Map controls Show debug field property editor"},measureButton:{"12.1.0":"data-testid panel-editor-measure-button","9.2.0":"show measure tools"},Outline:{section:{"12.0.0":"data-testid Outline section"},node:{"12.0.0":e=>`data-testid outline node ${e}`},item:{"12.0.0":e=>`data-testid outline item ${e}`}},ElementEditPane:{variableType:{"12.0.0":e=>`data-testid variable type ${e}`},addVariableButton:{"12.0.0":"data-testid add variable button"},variableNameInput:{"12.0.0":"data-testid variable name input"},variableLabelInput:{"12.0.0":"data-testid variable label input"},AutoGridLayout:{minColumnWidth:{"12.1.0":"data-testid min column width selector"},customMinColumnWidth:{"12.1.0":"data-testid custom min column width input"},clearCustomMinColumnWidth:{"12.1.0":"data-testid clear custom min column width input"},maxColumns:{"12.1.0":"data-testid max columns selector"},rowHeight:{"12.1.0":"data-testid row height selector"},customRowHeight:{"12.1.0":"data-testid custom row height input"},clearCustomRowHeight:{"12.1.0":"data-testid clear custom row height input"},fillScreen:{"12.1.0":"data-testid fill screen switch"}},TabsLayout:{titleInput:{"12.2.0":"data-testid tab title input"}}}},PanelInspector:{Data:{content:{[c]:"Panel inspector Data content"}},Stats:{content:{[c]:"Panel inspector Stats content"}},Json:{content:{"11.1.0":"data-testid Panel inspector Json content",[c]:"Panel inspector Json content"}},Query:{content:{[c]:"Panel inspector Query content"},refreshButton:{[c]:"Panel inspector Query refresh button"},jsonObjectKeys:{[c]:()=>".json-formatter-key"}}},Tab:{title:{"11.2.0":e=>`data-testid Tab ${e}`},active:{[c]:()=>'[class*="-activeTabStyle"]'}},RefreshPicker:{runButtonV2:{[c]:"data-testid RefreshPicker run button"},intervalButtonV2:{[c]:"data-testid RefreshPicker interval button"}},QueryTab:{content:{[c]:"Query editor tab content"},queryInspectorButton:{[c]:"Query inspector button"},queryHistoryButton:{"10.2.0":"data-testid query-history-button",[c]:"query-history-button"},addQuery:{"10.2.0":"data-testid query-tab-add-query",[c]:"Query editor add query button"},addQueryFromLibrary:{"11.5.0":"data-testid query-tab-add-query-from-library"},queryGroupTopSection:{"11.2.0":"data-testid query group top section"},addExpression:{"11.2.0":"data-testid query-tab-add-expression"}},QueryHistory:{queryText:{"9.0.0":"Query text"}},QueryEditorRows:{rows:{[c]:"Query editor row"}},QueryEditorRow:{actionButton:{"10.4.0":e=>`data-testid ${e}`},title:{[c]:e=>`Query editor row title ${e}`},container:{[c]:e=>`Query editor row ${e}`}},AlertTab:{content:{"10.2.3":"data-testid Alert editor tab content",[c]:"Alert editor tab content"}},AlertRules:{groupToggle:{"11.0.0":"data-testid group-collapse-toggle"},toggle:{"11.0.0":"data-testid collapse-toggle"},expandedContent:{"11.0.0":"data-testid expanded-content"},previewButton:{"11.1.0":"data-testid alert-rule preview-button"},ruleNameField:{"11.1.0":"data-testid alert-rule name-field"},newFolderButton:{"11.1.0":"data-testid alert-rule new-folder-button"},newFolderNameField:{"11.1.0":"data-testid alert-rule name-folder-name-field"},newFolderNameCreateButton:{"11.1.0":"data-testid alert-rule name-folder-name-create-button"},newEvaluationGroupButton:{"11.1.0":"data-testid alert-rule new-evaluation-group-button"},newEvaluationGroupName:{"11.1.0":"data-testid alert-rule new-evaluation-group-name"},newEvaluationGroupInterval:{"11.1.0":"data-testid alert-rule new-evaluation-group-interval"},newEvaluationGroupCreate:{"11.1.0":"data-testid alert-rule new-evaluation-group-create-button"},step:{"11.5.0":e=>`data-testid alert-rule step-${e}`},stepAdvancedModeSwitch:{"11.5.0":e=>`data-testid advanced-mode-switch step-${e}`}},Alert:{alertV2:{[c]:e=>`data-testid Alert ${e}`}},TransformTab:{content:{"10.1.0":"data-testid Transform editor tab content",[c]:"Transform editor tab content"},newTransform:{"10.1.0":e=>`data-testid New transform ${e}`},transformationEditor:{"10.1.0":e=>`data-testid Transformation editor ${e}`},transformationEditorDebugger:{"10.1.0":e=>`data-testid Transformation editor debugger ${e}`}},Transforms:{card:{"10.1.0":e=>`data-testid New transform ${e}`},disableTransformationButton:{"10.4.0":"data-testid Disable transformation button"},Reduce:{modeLabel:{"10.2.3":"data-testid Transform mode label",[c]:"Transform mode label"},calculationsLabel:{"10.2.3":"data-testid Transform calculations label",[c]:"Transform calculations label"}},SpatialOperations:{actionLabel:{"9.1.2":"root Action field property editor"},locationLabel:{"10.2.0":"root Location Mode field property editor"},location:{autoOption:{"9.1.2":"Auto location option"},coords:{option:{"9.1.2":"Coords location option"},latitudeFieldLabel:{"9.1.2":"root Latitude field field property editor"},longitudeFieldLabel:{"9.1.2":"root Longitude field field property editor"}},geohash:{option:{"9.1.2":"Geohash location option"},geohashFieldLabel:{"9.1.2":"root Geohash field field property editor"}},lookup:{option:{"9.1.2":"Lookup location option"},lookupFieldLabel:{"9.1.2":"root Lookup field field property editor"},gazetteerFieldLabel:{"9.1.2":"root Gazetteer field property editor"}}}},searchInput:{"10.2.3":"data-testid search transformations",[c]:"search transformations"},noTransformationsMessage:{"10.2.3":"data-testid no transformations message"},addTransformationButton:{"10.1.0":"data-testid add transformation button",[c]:"add transformation button"},removeAllTransformationsButton:{"10.4.0":"data-testid remove all transformations button"}},NavBar:{Configuration:{button:{"9.5.0":"Configuration"}},Toggle:{button:{"10.2.3":"data-testid Toggle menu",[c]:"Toggle menu"}},Reporting:{button:{"9.5.0":"Reporting"}}},NavMenu:{Menu:{"10.2.3":"data-testid navigation mega-menu"},item:{"9.5.0":"data-testid Nav menu item"}},NavToolbar:{container:{"9.4.0":"data-testid Nav toolbar"},commandPaletteTrigger:{"11.5.0":"data-testid Command palette trigger"},shareDashboard:{"11.1.0":"data-testid Share dashboard"},markAsFavorite:{"11.1.0":"data-testid Mark as favorite"},editDashboard:{editButton:{"11.1.0":"data-testid Edit dashboard button"},saveButton:{"11.1.0":"data-testid Save dashboard button"},exitButton:{"11.1.0":"data-testid Exit edit mode button"},settingsButton:{"11.1.0":"data-testid Dashboard settings"},addRowButton:{"11.1.0":"data-testid Add row button"},addLibraryPanelButton:{"11.1.0":"data-testid Add a panel from the panel library button"},addVisualizationButton:{"11.1.0":"data-testid Add new visualization menu item"},pastePanelButton:{"11.1.0":"data-testid Paste panel button"},discardChangesButton:{"11.1.0":"data-testid Discard changes button"},discardLibraryPanelButton:{"11.1.0":"data-testid Discard library panel button"},unlinkLibraryPanelButton:{"11.1.0":"data-testid Unlink library panel button"},saveLibraryPanelButton:{"11.1.0":"data-testid Save library panel button"},backToDashboardButton:{"11.1.0":"data-testid Back to dashboard button"}}},PageToolbar:{container:{[c]:()=>".page-toolbar"},item:{[c]:e=>`${e}`},itemButton:{"9.5.0":e=>`data-testid ${e}`}},QueryEditorToolbarItem:{button:{[c]:e=>`QueryEditor toolbar item button ${e}`}},BackButton:{backArrow:{"10.3.0":"data-testid Go Back",[c]:"Go Back"}},OptionsGroup:{group:{"11.1.0":e=>e?`data-testid Options group ${e}`:"data-testid Options group",[c]:e=>e?`Options group ${e}`:"Options group"},toggle:{"11.1.0":e=>e?`data-testid Options group ${e} toggle`:"data-testid Options group toggle",[c]:e=>e?`Options group ${e} toggle`:"Options group toggle"}},PluginVisualization:{item:{[c]:e=>`Plugin visualization item ${e}`},current:{[c]:()=>'[class*="-currentVisualizationItem"]'}},Select:{menu:{"11.5.0":"data-testid Select menu",[c]:"Select options menu"},option:{"11.1.0":"data-testid Select option",[c]:"Select option"},toggleAllOptions:{"11.3.0":"data-testid toggle all options"},input:{[c]:()=>'input[id*="time-options-input"]'},singleValue:{[c]:()=>'div[class*="-singleValue"]'}},FieldConfigEditor:{content:{[c]:"Field config editor content"}},OverridesConfigEditor:{content:{[c]:"Field overrides editor content"}},FolderPicker:{containerV2:{[c]:"data-testid Folder picker select container"},input:{"10.4.0":"data-testid folder-picker-input"}},ReadonlyFolderPicker:{container:{[c]:"data-testid Readonly folder picker select container"}},DataSourcePicker:{container:{"10.0.0":"data-testid Data source picker select container","8.0.0":"Data source picker select container"},inputV2:{"10.1.0":"data-testid Select a data source",[c]:"Select a data source"},dataSourceList:{"10.4.0":"data-testid Data source list dropdown"},advancedModal:{dataSourceList:{"10.4.0":"data-testid Data source list"},builtInDataSourceList:{"10.4.0":"data-testid Built in data source list"}}},TimeZonePicker:{containerV2:{[c]:"data-testid Time zone picker select container"},changeTimeSettingsButton:{"11.0.0":"data-testid Time zone picker Change time settings button"}},WeekStartPicker:{containerV2:{[c]:"data-testid Choose starting day of the week"},placeholder:{[c]:"Choose starting day of the week"}},TraceViewer:{spanBar:{"9.0.0":"data-testid SpanBar--wrapper"}},QueryField:{container:{"10.3.0":"data-testid Query field",[c]:"Query field"}},QueryBuilder:{queryPatterns:{"10.3.0":"data-testid Query patterns",[c]:"Query patterns"},labelSelect:{"10.3.0":"data-testid Select label",[c]:"Select label"},inputSelect:{"11.1.0":"data-testid Select label-input"},valueSelect:{"10.3.0":"data-testid Select value",[c]:"Select value"},matchOperatorSelect:{"10.3.0":"data-testid Select match operator",[c]:"Select match operator"}},ValuePicker:{button:{"10.3.0":e=>`data-testid Value picker button ${e}`},select:{"10.3.0":e=>`data-testid Value picker select ${e}`}},Search:{sectionV2:{[c]:"data-testid Search section"},itemsV2:{[c]:"data-testid Search items"},cards:{[c]:"data-testid Search cards"},collapseFolder:{[c]:e=>`data-testid Collapse folder ${e}`},expandFolder:{[c]:e=>`data-testid Expand folder ${e}`},dashboardItem:{[c]:e=>`data-testid Dashboard search item ${e}`},dashboardCard:{[c]:e=>`data-testid Search card ${e}`},folderHeader:{"9.3.0":e=>`data-testid Folder header ${e}`},folderContent:{"9.3.0":e=>`data-testid Folder content ${e}`},dashboardItems:{[c]:"data-testid Dashboard search item"}},DashboardLinks:{container:{[c]:"data-testid Dashboard link container"},dropDown:{[c]:"data-testid Dashboard link dropdown"},link:{[c]:"data-testid Dashboard link"}},LoadingIndicator:{icon:{"10.4.0":"data-testid Loading indicator",[c]:"Loading indicator"}},CallToActionCard:{buttonV2:{[c]:e=>`data-testid Call to action button ${e}`}},DataLinksContextMenu:{singleLink:{"10.3.0":"data-testid Data link",[c]:"Data link"}},DataLinksActionsTooltip:{tooltipWrapper:{"12.1.0":"data-testid Data links actions tooltip wrapper"}},CodeEditor:{container:{"10.2.3":"data-testid Code editor container",[c]:"Code editor container"}},ReactMonacoEditor:{editorLazy:{"11.1.0":"data-testid ReactMonacoEditor editorLazy"}},DashboardImportPage:{textarea:{[c]:"data-testid-import-dashboard-textarea"},submit:{[c]:"data-testid-load-dashboard"}},ImportDashboardForm:{name:{[c]:"data-testid-import-dashboard-title"},submit:{[c]:"data-testid-import-dashboard-submit"}},PanelAlertTabContent:{content:{"10.2.3":"data-testid Unified alert editor tab content",[c]:"Unified alert editor tab content"}},VisualizationPreview:{card:{[c]:e=>`data-testid suggestion-${e}`}},ColorSwatch:{name:{[c]:"data-testid-colorswatch"}},DashboardRow:{title:{[c]:e=>`data-testid dashboard-row-title-${e}`},wrapper:{"12.1.0":e=>`data-testid dashboard-row-wrapper-for-${e}`}},UserProfile:{profileSaveButton:{[c]:"data-testid-user-profile-save"},preferencesSaveButton:{[c]:"data-testid-shared-prefs-save"},orgsTable:{[c]:"data-testid-user-orgs-table"},sessionsTable:{[c]:"data-testid-user-sessions-table"},extensionPointTabs:{"10.2.3":"data-testid-extension-point-tabs"},extensionPointTab:{"10.2.3":e=>`data-testid-extension-point-tab-${e}`}},FileUpload:{inputField:{"9.0.0":"data-testid-file-upload-input-field"},fileNameSpan:{"9.0.0":"data-testid-file-upload-file-name"}},DebugOverlay:{wrapper:{"9.2.0":"debug-overlay"}},OrgRolePicker:{input:{"9.5.0":"Role"}},AnalyticsToolbarButton:{button:{"9.5.0":"Dashboard insights"}},Variables:{variableOption:{"9.5.0":"data-testid variable-option"},variableLinkWrapper:{"11.1.1":"data-testid variable-link-wrapper"}},Annotations:{annotationsTypeInput:{"11.1.0":"data-testid annotations-type-input",[c]:"annotations-type-input"},annotationsChoosePanelInput:{"11.1.0":"data-testid choose-panels-input",[c]:"choose-panels-input"},editor:{testButton:{"11.0.0":"data-testid annotations-test-button"},resultContainer:{"11.0.0":"data-testid annotations-query-result-container"}}},Tooltip:{container:{"10.2.0":"data-testid tooltip"}},ReturnToPrevious:{buttonGroup:{"11.0.0":"data-testid dismissable button group"},backButton:{"11.0.0":"data-testid back"},dismissButton:{"11.0.0":"data-testid dismiss"}},SQLQueryEditor:{selectColumn:{"11.0.0":"data-testid select-column"},selectColumnInput:{"11.0.0":"data-testid select-column-input"},selectFunctionParameter:{"11.0.0":e=>`data-testid select-function-parameter-${e}`},selectAggregation:{"11.0.0":"data-testid select-aggregation"},selectAggregationInput:{"11.0.0":"data-testid select-aggregation-input"},selectAlias:{"11.0.0":"data-testid select-alias"},selectAliasInput:{"11.0.0":"data-testid select-alias-input"},selectInputParameter:{"11.0.0":"data-testid select-input-parameter"},filterConjunction:{"11.0.0":"data-testid filter-conjunction"},filterField:{"11.0.0":"data-testid filter-field"},filterOperator:{"11.0.0":"data-testid filter-operator"},headerTableSelector:{"11.0.0":"data-testid header-table-selector"},headerFilterSwitch:{"11.0.0":"data-testid header-filter-switch"},headerGroupSwitch:{"11.0.0":"data-testid header-group-switch"},headerOrderSwitch:{"11.0.0":"data-testid header-order-switch"},headerPreviewSwitch:{"11.0.0":"data-testid header-preview-switch"}},EntityNotFound:{container:{"11.2.0":"data-testid entity-not-found"}},Portal:{container:{"11.5.0":"data-testid portal-container"}},ExportImage:{formatOptions:{container:{"12.1.0":"data-testid export-image-format-options"},png:{"12.1.0":"data-testid export-image-format-png"},jpg:{"12.1.0":"data-testid export-image-format-jpg"}},rendererAlert:{container:{"12.1.0":"data-testid export-image-renderer-alert"},title:{"12.1.0":"data-testid export-image-renderer-alert-title"},description:{"12.1.0":"data-testid export-image-renderer-alert-description"}},buttons:{generate:{"12.1.0":"data-testid export-image-generate-button"},download:{"12.1.0":"data-testid export-image-download-button"},cancel:{"12.1.0":"data-testid export-image-cancel-button"}},preview:{container:{"12.1.0":"data-testid export-image-preview-container"},loading:{"12.1.0":"data-testid export-image-preview-loading"},image:{"12.1.0":"data-testid export-image-preview"},error:{container:{"12.1.0":"data-testid export-image-error"},title:{"12.1.0":"data-testid export-image-error-title"},message:{"12.1.0":"data-testid export-image-error-message"}}}}},d={pages:i({Alerting:{AddAlertRule:{url:{"10.1.0":"/alerting/new/alerting",[c]:"/alerting/new"}},EditAlertRule:{url:{[c]:e=>`alerting/${e}/edit`}}},Login:{url:{[c]:"/login"},username:{"10.2.3":"data-testid Username input field",[c]:"Username input field"},password:{"10.2.3":"data-testid Password input field",[c]:"Password input field"},submit:{"10.2.3":"data-testid Login button",[c]:"Login button"},skip:{"10.2.3":"data-testid Skip change password button"}},PasswordlessLogin:{url:{[c]:"/login/passwordless/authenticate"},email:{"10.2.3":"data-testid Email input field",[c]:"Email input field"},submit:{"10.2.3":"data-testid PasswordlessLogin button",[c]:"PasswordlessLogin button"}},Home:{url:{[c]:"/"}},DataSource:{name:{"10.3.0":"data-testid Data source settings page name input field",[c]:"Data source settings page name input field"},delete:{[c]:"Data source settings page Delete button"},readOnly:{"10.3.0":"data-testid Data source settings page read only message",[c]:"Data source settings page read only message"},saveAndTest:{"10.0.0":"data-testid Data source settings page Save and Test button",[c]:"Data source settings page Save and Test button"},alert:{"10.3.0":"data-testid Data source settings page Alert",[c]:"Data source settings page Alert"}},DataSources:{url:{[c]:"/datasources"},dataSources:{[c]:e=>`Data source list item ${e}`}},EditDataSource:{url:{"9.5.0":e=>`/datasources/edit/${e}`},settings:{"9.5.0":"Datasource settings page basic settings"}},AddDataSource:{url:{[c]:"/datasources/new"},dataSourcePluginsV2:{"9.3.1":e=>`Add new data source ${e}`,[c]:e=>`Data source plugin item ${e}`}},ConfirmModal:{delete:{"10.0.0":"data-testid Confirm Modal Danger Button",[c]:"Confirm Modal Danger Button"},input:{"12.2.0":"data-testid Confirm Modal Input"}},SecretsManagement:{SecretForm:{"12.2.0":"data-testid Secret Form"}},AddDashboard:{url:{[c]:"/dashboard/new"},itemButton:{"9.5.0":e=>`data-testid ${e}`},addNewPanel:{"11.1.0":"data-testid Add new panel","8.0.0":"Add new panel",[c]:"Add new panel"},itemButtonAddViz:{[c]:"Add new visualization menu item"},addNewRow:{"11.1.0":"data-testid Add new row",[c]:"Add new row"},addNewPanelLibrary:{"11.1.0":"data-testid Add new panel from panel library",[c]:"Add new panel from panel library"},Settings:{Annotations:{List:{url:{[c]:"/dashboard/new?orgId=1&editview=annotations"}},Edit:{url:{[c]:e=>`/dashboard/new?editview=annotations&editIndex=${e}`}}},Variables:{List:{url:{"11.3.0":"/dashboard/new?orgId=1&editview=variables",[c]:"/dashboard/new?orgId=1&editview=templating"}},Edit:{url:{"11.3.0":e=>`/dashboard/new?orgId=1&editview=variables&editIndex=${e}`,[c]:e=>`/dashboard/new?orgId=1&editview=templating&editIndex=${e}`}}}}},ImportDashboard:{url:{[c]:"/dashboard/import"}},Dashboard:{url:{[c]:e=>`/d/${e}`},DashNav:{nav:{[c]:"Dashboard navigation"},navV2:{[c]:"data-testid Dashboard navigation"},publicDashboardTag:{"9.1.0":"data-testid public dashboard tag"},shareButton:{"10.4.0":"data-testid share-button"},scrollContainer:{"11.1.0":"data-testid Dashboard canvas scroll container"},newShareButton:{container:{"11.1.0":"data-testid new share button"},shareLink:{"11.1.0":"data-testid new share link-button"},arrowMenu:{"11.1.0":"data-testid new share button arrow menu"},menu:{container:{"11.1.0":"data-testid new share button menu"},shareInternally:{"11.1.0":"data-testid new share button share internally"},shareExternally:{"11.1.1":"data-testid new share button share externally"},shareSnapshot:{"11.2.0":"data-testid new share button share snapshot"}}},NewExportButton:{container:{"11.2.0":"data-testid new export button"},arrowMenu:{"11.2.0":"data-testid new export button arrow menu"},Menu:{container:{"11.2.0":"data-testid new export button menu"},exportAsJson:{"11.2.0":"data-testid new export button export as json"},exportAsImage:{"12.1.0":"data-testid new export button export as image"}}},playlistControls:{prev:{"11.0.0":"data-testid playlist previous dashboard button"},stop:{"11.0.0":"data-testid playlist stop dashboard button"},next:{"11.0.0":"data-testid playlist next dashboard button"}}},Controls:{"11.1.0":"data-testid dashboard controls"},SubMenu:{submenu:{[c]:"Dashboard submenu"},submenuItem:{[c]:"data-testid template variable"},submenuItemLabels:{[c]:e=>`data-testid Dashboard template variables submenu Label ${e}`},submenuItemValueDropDownValueLinkTexts:{[c]:e=>`data-testid Dashboard template variables Variable Value DropDown value link text ${e}`},submenuItemValueDropDownDropDown:{[c]:"Variable options"},submenuItemValueDropDownOptionTexts:{[c]:e=>`data-testid Dashboard template variables Variable Value DropDown option text ${e}`},Annotations:{annotationsWrapper:{"10.0.0":"data-testid annotation-wrapper"},annotationLabel:{"10.0.0":e=>`data-testid Dashboard annotations submenu Label ${e}`},annotationToggle:{"10.0.0":e=>`data-testid Dashboard annotations submenu Toggle ${e}`}}},Settings:{Actions:{close:{"9.5.0":"data-testid dashboard-settings-close"}},General:{deleteDashBoard:{"11.1.0":"data-testid Dashboard settings page delete dashboard button"},sectionItems:{[c]:e=>`Dashboard settings section item ${e}`},saveDashBoard:{[c]:"Dashboard settings aside actions Save button"},saveAsDashBoard:{[c]:"Dashboard settings aside actions Save As button"},title:{"11.2.0":"General"}},Annotations:{Edit:{urlParams:{[c]:e=>`editview=annotations&editIndex=${e}`}},List:{url:{[c]:e=>`/d/${e}?editview=annotations`},addAnnotationCTAV2:{[c]:"data-testid Call to action button Add annotation query"},annotations:{"10.4.0":"data-testid list-annotations"}},Settings:{name:{"11.1.0":"data-testid Annotations settings name input",[c]:"Annotations settings name input"}},NewAnnotation:{panelFilterSelect:{"10.0.0":"data-testid annotations-panel-filter"},showInLabel:{"11.1.0":"data-testid show-in-label"},previewInDashboard:{"10.0.0":"data-testid annotations-preview"},delete:{"10.4.0":"data-testid annotations-delete"},apply:{"10.4.0":"data-testid annotations-apply"},enable:{"10.4.0":"data-testid annotation-enable"},hide:{"10.4.0":"data-testid annotation-hide"}}},Variables:{List:{url:{"11.3.0":e=>`/d/${e}?editview=variables`,[c]:e=>`/d/${e}?editview=templating`},addVariableCTAV2:{[c]:"data-testid Call to action button Add variable"},newButton:{[c]:"Variable editor New variable button"},table:{[c]:"Variable editor Table"},tableRowNameFields:{[c]:e=>`Variable editor Table Name field ${e}`},tableRowDefinitionFields:{"10.1.0":e=>`Variable editor Table Definition field ${e}`},tableRowArrowUpButtons:{[c]:e=>`Variable editor Table ArrowUp button ${e}`},tableRowArrowDownButtons:{[c]:e=>`Variable editor Table ArrowDown button ${e}`},tableRowDuplicateButtons:{[c]:e=>`Variable editor Table Duplicate button ${e}`},tableRowRemoveButtons:{[c]:e=>`Variable editor Table Remove button ${e}`}},Edit:{urlParams:{"11.3.0":e=>`editview=variables&editIndex=${e}`,[c]:e=>`editview=templating&editIndex=${e}`},General:{headerLink:{[c]:"Variable editor Header link"},modeLabelNew:{[c]:"Variable editor Header mode New"},modeLabelEdit:{[c]:"Variable editor Header mode Edit"},generalNameInput:{[c]:"Variable editor Form Name field"},generalNameInputV2:{[c]:"data-testid Variable editor Form Name field"},generalTypeSelect:{[c]:"Variable editor Form Type select"},generalTypeSelectV2:{[c]:"data-testid Variable editor Form Type select"},generalLabelInput:{[c]:"Variable editor Form Label field"},generalLabelInputV2:{[c]:"data-testid Variable editor Form Label field"},generalHideSelect:{[c]:"Variable editor Form Hide select"},generalHideSelectV2:{[c]:"data-testid Variable editor Form Hide select"},selectionOptionsAllowCustomValueSwitch:{[c]:"data-testid Variable editor Form Allow Custom Value switch"},selectionOptionsMultiSwitch:{"10.4.0":"data-testid Variable editor Form Multi switch",[c]:"Variable editor Form Multi switch"},selectionOptionsIncludeAllSwitch:{"10.4.0":"data-testid Variable editor Form IncludeAll switch",[c]:"Variable editor Form IncludeAll switch"},selectionOptionsCustomAllInput:{"10.4.0":"data-testid Variable editor Form IncludeAll field",[c]:"Variable editor Form IncludeAll field"},previewOfValuesOption:{"10.4.0":"data-testid Variable editor Preview of Values option",[c]:"Variable editor Preview of Values option"},submitButton:{"10.4.0":"data-testid Variable editor Run Query button",[c]:"Variable editor Submit button"},applyButton:{"9.3.0":"data-testid Variable editor Apply button"}},QueryVariable:{closeButton:{[c]:"data-testid Query Variable editor close button"},editor:{[c]:"data-testid Query Variable editor"},previewButton:{[c]:"data-testid Query Variable editor preview button"},queryOptionsDataSourceSelect:{"10.4.0":"data-testid Select a data source","10.0.0":"data-testid Data source picker select container",[c]:"Data source picker select container"},queryOptionsOpenButton:{[c]:"data-testid Query Variable editor open button"},queryOptionsRefreshSelect:{[c]:"Variable editor Form Query Refresh select"},queryOptionsRefreshSelectV2:{[c]:"data-testid Variable editor Form Query Refresh select"},queryOptionsRegExInput:{[c]:"Variable editor Form Query RegEx field"},queryOptionsRegExInputV2:{[c]:"data-testid Variable editor Form Query RegEx field"},queryOptionsSortSelect:{[c]:"Variable editor Form Query Sort select"},queryOptionsSortSelectV2:{[c]:"data-testid Variable editor Form Query Sort select"},queryOptionsQueryInput:{"10.4.0":"data-testid Variable editor Form Default Variable Query Editor textarea"},queryOptionsStaticOptionsToggle:{[c]:"Variable editor Form Query Static Options toggle"},queryOptionsStaticOptionsOrderDropdown:{[c]:"Variable editor Form Query Static Options Order dropdown"},valueGroupsTagsEnabledSwitch:{[c]:"Variable editor Form Query UseTags switch"},valueGroupsTagsTagsQueryInput:{[c]:"Variable editor Form Query TagsQuery field"},valueGroupsTagsTagsValuesQueryInput:{[c]:"Variable editor Form Query TagsValuesQuery field"}},ConstantVariable:{constantOptionsQueryInput:{[c]:"Variable editor Form Constant Query field"},constantOptionsQueryInputV2:{[c]:"data-testid Variable editor Form Constant Query field"}},DatasourceVariable:{datasourceSelect:{[c]:"data-testid datasource variable datasource type"},nameFilter:{[c]:"data-testid datasource variable datasource name filter"}},TextBoxVariable:{textBoxOptionsQueryInput:{[c]:"Variable editor Form TextBox Query field"},textBoxOptionsQueryInputV2:{[c]:"data-testid Variable editor Form TextBox Query field"}},CustomVariable:{customValueInput:{[c]:"data-testid custom-variable-input"},optionsOpenButton:{[c]:"data-testid custom-variable-options-open-button"},closeButton:{[c]:"data-testid custom-variable-close-button"}},IntervalVariable:{intervalsValueInput:{[c]:"data-testid interval variable intervals input"},autoEnabledCheckbox:{"10.4.0":"data-testid interval variable auto value checkbox"},stepCountIntervalSelect:{"10.4.0":"data-testid interval variable step count input"},minIntervalInput:{"10.4.0":"data-testid interval variable mininum interval input"}},GroupByVariable:{dataSourceSelect:{"10.4.0":"data-testid Select a data source"},infoText:{"10.4.0":"data-testid group by variable info text"},modeToggle:{"10.4.0":"data-testid group by variable mode toggle"}},AdHocFiltersVariable:{datasourceSelect:{"10.4.0":"data-testid Select a data source"},infoText:{"10.4.0":"data-testid ad-hoc filters variable info text"},modeToggle:{"11.0.0":"data-testid ad-hoc filters variable mode toggle"}},SwitchVariable:{valuePairTypeSelect:{"12.3.0":"data-testid switch variable value pair type select"},enabledValueInput:{"12.3.0":"data-testid switch variable enabled value input"},disabledValueInput:{"12.3.0":"data-testid switch variable disabled value input"}},StaticOptionsEditor:{addButton:{[c]:"data-testid Variable editor Form Static Options Add button"},labelInput:{[c]:"data-testid Variable editor Form Static Options Label input"},valueInput:{[c]:"data-testid Variable editor Form Static Options Value input"},moveButton:{[c]:"data-testid Variable editor Form Static Options Move button"},deleteButton:{[c]:"data-testid Variable editor Form Static Options Delete button"},row:{[c]:"data-testid Variable editor Form Static Options Row"}}}}},Annotations:{marker:{"10.0.0":"data-testid annotation-marker"}},Rows:{Repeated:{ConfigSection:{warningMessage:{"10.2.0":"data-testid Repeated rows warning message"}}}}},Dashboards:{url:{[c]:"/dashboards"},dashboards:{"10.2.0":e=>`Dashboard search item ${e}`},toggleView:{[c]:"data-testid radio-button"}},SaveDashboardAsModal:{newName:{"10.2.0":"Save dashboard title field"},save:{"10.2.0":"Save dashboard button"}},SaveDashboardModal:{save:{"10.2.0":"Dashboard settings Save Dashboard Modal Save button"},saveVariables:{"10.2.0":"Dashboard settings Save Dashboard Modal Save variables checkbox"},saveTimerange:{"10.2.0":"Dashboard settings Save Dashboard Modal Save timerange checkbox"},saveRefresh:{"11.1.0":"Dashboard settings Save Dashboard Modal Save refresh checkbox"},variablesWarningAlert:{"12.2.0":"Dashboard settings Save Dashboard Modal Save variables Variables With Errors Warning Alert"}},SharePanelModal:{linkToRenderedImage:{[c]:"Link to rendered image"}},ShareDashboardModal:{PublicDashboard:{WillBePublicCheckbox:{"9.1.0":"data-testid public dashboard will be public checkbox"},LimitedDSCheckbox:{"9.1.0":"data-testid public dashboard limited datasources checkbox"},CostIncreaseCheckbox:{"9.1.0":"data-testid public dashboard cost may increase checkbox"},PauseSwitch:{"9.5.0":"data-testid public dashboard pause switch"},EnableAnnotationsSwitch:{"9.3.0":"data-testid public dashboard on off switch for annotations"},CreateButton:{"9.5.0":"data-testid public dashboard create button"},DeleteButton:{"9.3.0":"data-testid public dashboard delete button"},CopyUrlInput:{"9.1.0":"data-testid public dashboard copy url input"},CopyUrlButton:{"9.1.0":"data-testid public dashboard copy url button"},SettingsDropdown:{"10.1.0":"data-testid public dashboard settings dropdown"},TemplateVariablesWarningAlert:{"9.1.0":"data-testid public dashboard disabled template variables alert"},UnsupportedDataSourcesWarningAlert:{"9.5.0":"data-testid public dashboard unsupported data sources alert"},NoUpsertPermissionsWarningAlert:{"9.5.0":"data-testid public dashboard no upsert permissions alert"},EnableTimeRangeSwitch:{"9.4.0":"data-testid public dashboard on off switch for time range"},EmailSharingConfiguration:{Container:{"9.5.0":"data-testid email sharing config container"},ShareType:{"9.5.0":"data-testid public dashboard share type"},EmailSharingInput:{"9.5.0":"data-testid public dashboard email sharing input"},EmailSharingInviteButton:{"9.5.0":"data-testid public dashboard email sharing invite button"},EmailSharingList:{"9.5.0":"data-testid public dashboard email sharing list"},DeleteEmail:{"9.5.0":"data-testid public dashboard delete email button"},ReshareLink:{"9.5.0":"data-testid public dashboard reshare link button"}}},SnapshotScene:{url:{"11.1.0":e=>`/dashboard/snapshot/${e}`},PublishSnapshot:{"11.1.0":"data-testid publish snapshot button"},CopyUrlButton:{"11.1.0":"data-testid snapshot copy url button"},CopyUrlInput:{"11.1.0":"data-testid snapshot copy url input"}}},ShareDashboardDrawer:{ShareInternally:{container:{"11.3.0":"data-testid share internally drawer container"},lockTimeRangeSwitch:{"11.3.0":"data-testid share internally lock time range switch"},shortenUrlSwitch:{"11.3.0":"data-testid share internally shorten url switch"},copyUrlButton:{"11.3.0":"data-testid share internally copy url button"},SharePanel:{preview:{"11.5.0":"data-testid share panel internally image generation preview"},widthInput:{"11.5.0":"data-testid share panel internally width input"},heightInput:{"11.5.0":"data-testid share panel internally height input"},scaleFactorInput:{"11.5.0":"data-testid share panel internally scale factor input"},generateImageButton:{"11.5.0":"data-testid share panel internally generate image button"},downloadImageButton:{"11.5.0":"data-testid share panel internally download image button"}}},ShareExternally:{container:{"11.3.0":"data-testid share externally drawer container"},publicAlert:{"11.3.0":"data-testid public share alert"},emailSharingAlert:{"11.3.0":"data-testid email share alert"},shareTypeSelect:{"11.3.0":"data-testid share externally share type select"},Creation:{PublicShare:{createButton:{"11.3.0":"data-testid public share dashboard create button"},cancelButton:{"11.3.0":"data-testid public share dashboard cancel button"}},EmailShare:{createButton:{"11.3.0":"data-testid email share dashboard create button"},cancelButton:{"11.3.0":"data-testid email share dashboard cancel button"}},willBePublicCheckbox:{"11.3.0":"data-testid share dashboard will be public checkbox"}},Configuration:{enableTimeRangeSwitch:{"11.3.0":"data-testid share externally enable time range switch"},enableAnnotationsSwitch:{"11.3.0":"data-testid share externally enable annotations switch"},copyUrlButton:{"11.3.0":"data-testid share externally copy url button"},revokeAccessButton:{"11.3.0":"data-testid share externally revoke access button"},toggleAccessButton:{"11.3.0":"data-testid share externally pause or resume access button"}}},ShareSnapshot:{url:{"11.3.0":e=>`/dashboard/snapshot/${e}`},container:{"11.3.0":"data-testid share snapshot drawer container"},publishSnapshot:{"11.3.0":"data-testid share snapshot publish button"},copyUrlButton:{"11.3.0":"data-testid share snapshot copy url button"}}},ExportDashboardDrawer:{ExportAsJson:{container:{"11.3.0":"data-testid export as json drawer container"},codeEditor:{"11.3.0":"data-testid export as json code editor"},exportExternallyToggle:{"11.3.0":"data-testid export as json externally switch"},saveToFileButton:{"11.3.0":"data-testid export as json save to file button"},copyToClipboardButton:{"11.3.0":"data-testid export as json copy to clipboard button"},cancelButton:{"11.3.0":"data-testid export as json cancel button"}}},PublicDashboard:{page:{"9.5.0":"public-dashboard-page"},NotAvailable:{container:{"9.5.0":"public-dashboard-not-available"},title:{"9.5.0":"public-dashboard-title"},pausedDescription:{"9.5.0":"public-dashboard-paused-description"}},footer:{"11.0.0":"public-dashboard-footer"}},PublicDashboardScene:{loadingPage:{"11.0.0":"public-dashboard-scene-loading-page"},page:{"11.0.0":"public-dashboard-scene-page"},controls:{"11.0.0":"public-dashboard-controls"}},RequestViewAccess:{form:{"9.5.0":"request-view-access-form"},recipientInput:{"9.5.0":"request-view-access-recipient-input"},submitButton:{"9.5.0":"request-view-access-submit-button"}},PublicDashboardConfirmAccess:{submitButton:{"10.2.0":"data-testid confirm-access-submit-button"}},Explore:{url:{[c]:"/explore"},General:{container:{[c]:"data-testid Explore"},graph:{[c]:"Explore Graph"},table:{[c]:"Explore Table"},scrollView:{"9.0.0":"data-testid explorer scroll view"},addFromQueryLibrary:{"11.5.0":"data-testid explore add from query library button"}},QueryHistory:{container:{"11.1.0":"data-testid QueryHistory"}}},SoloPanel:{url:{[c]:e=>`/d-solo/${e}`}},PluginsList:{page:{[c]:"Plugins list page"},list:{[c]:"Plugins list"},listItem:{[c]:"Plugins list item"},signatureErrorNotice:{"10.3.0":"data-testid Unsigned plugins notice",[c]:"Unsigned plugins notice"}},PluginPage:{page:{[c]:"Plugin page"},signatureInfo:{"10.3.0":"data-testid Plugin signature info",[c]:"Plugin signature info"},disabledInfo:{"10.3.0":"data-testid Plugin disabled info",[c]:"Plugin disabled info"}},PlaylistForm:{name:{[c]:"Playlist name"},interval:{[c]:"Playlist interval"},itemDelete:{"10.2.0":"data-testid playlist-form-delete-item"}},BrowseDashboards:{table:{body:{"10.2.0":"data-testid browse-dashboards-table"},row:{"10.2.0":e=>`data-testid browse dashboards row ${e}`},checkbox:{"10.0.0":e=>`data-testid ${e} checkbox`}},NewFolderForm:{form:{"10.2.0":"data-testid new folder form"},nameInput:{"10.2.0":"data-testid new-folder-name-input"},createButton:{"10.2.0":"data-testid new-folder-create-button"}}},SearchDashboards:{table:{"10.2.0":"Search results table"}},Search:{url:{"9.3.0":"/?search=openn"},FolderView:{url:{"9.3.0":"/?search=open&layout=folders"}}},PublicDashboards:{ListItem:{linkButton:{"9.3.0":"public-dashboard-link-button"},configButton:{"9.3.0":"public-dashboard-configuration-button"},trashcanButton:{"9.3.0":"public-dashboard-remove-button"},pauseSwitch:{"10.1.0":"data-testid public dashboard pause switch"}}},UserListPage:{tabs:{allUsers:{"10.0.0":"data-testid all-users-tab"},orgUsers:{"10.0.0":"data-testid org-users-tab"},anonUserDevices:{"10.2.3":"data-testid anon-user-devices-tab"},publicDashboardsUsers:{"10.0.0":"data-testid public-dashboards-users-tab"},users:{"10.0.0":"data-testid users-tab"}},org:{url:{"10.2.0":"/admin/users","9.5.0":"/org/users"}},admin:{url:{"9.5.0":"/admin/users"}},publicDashboards:{container:{"11.1.0":"data-testid public-dashboards-users-list"}},UserListAdminPage:{container:{"10.0.0":"data-testid user-list-admin-page"}},UsersListPage:{container:{"10.0.0":"data-testid users-list-page"}},UserAnonListPage:{container:{"10.4.0":"data-testid user-anon-list-page"}},UsersListPublicDashboardsPage:{container:{"10.0.0":"data-testid users-list-public-dashboards-page"},DashboardsListModal:{listItem:{"10.0.0":e=>`data-testid dashboards-list-item-${e}`}}}},ProfilePage:{url:{"10.2.0":"/profile"}},Plugin:{url:{[c]:e=>`/plugins/${e}`}},MigrateToCloud:{url:{"11.2.0":"/admin/migrate-to-cloud"}}}),components:i(u)}},9107:(e,t,r)=>{"use strict";r.d(t,{HD:()=>o,ti:()=>a,U3:()=>n,ie:()=>s,Q$:()=>i});var n=function(e){return e.Instant="instant",e.Range="range",e.Stream="stream",e}({}),i=function(e){return e.DataSample="dataSample",e.InfiniteScroll="infiniteScroll",e.LogsSample="logsSample",e.LogsVolume="logsVolume",e}({}),a=function(e){return e.Backward="backward",e.Forward="forward",e.Scan="scan",e}({}),o=function(e){return e.Indexed="I",e.StructuredMetadata="S",e.Parsed="P",e}({}),s=function(e){return e[e.LabelNames=0]="LabelNames",e[e.LabelValues=1]="LabelValues",e}({})},9137:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(1025))&&n.__esModule?n:{default:n};function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.level=0}var t,r,n;return t=e,(r=[{key:"beginIfPossible",value:function(e,t){0===this.level&&this.isInlineBlock(e,t)?this.level=1:this.level>0?this.level++:this.level=0}},{key:"end",value:function(){this.level--}},{key:"isActive",value:function(){return this.level>0}},{key:"isInlineBlock",value:function(e,t){for(var r=0,n=0,a=t;a<e.length;a++){var o=e[a];if((r+=o.value.length)>50)return!1;if(o.type===i.default.OPEN_PAREN)n++;else if(o.type===i.default.CLOSE_PAREN&&0==--n)return!0;if(this.isForbiddenToken(o))return!1}return!1}},{key:"isForbiddenToken",value:function(e){var t=e.type,r=e.value;return t===i.default.RESERVED_TOP_LEVEL||t===i.default.RESERVED_NEWLINE||t===i.default.COMMENT||t===i.default.BLOCK_COMMENT||";"===r}}])&&a(t.prototype,r),n&&a(t,n),e}();t.default=o,e.exports=t.default},9157:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=l(r(1283)),i=l(r(1025)),a=l(r(2520)),o=l(r(9137)),s=l(r(9429));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var u=function(e){return e.replace(/[\t ]+$/,"")},d=function(){function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=t||{},this.indentation=new a.default(this.cfg.indent),this.inlineBlock=new o.default,this.params=new s.default(this.cfg.params),this.tokenizer=r,this.tokenOverride=n,this.previousReservedWord={},this.tokens=[],this.index=0}var t,r,l;return t=e,r=[{key:"format",value:function(e){return this.tokens=this.tokenizer.tokenize(e),this.getFormattedQueryFromTokens().trim()}},{key:"getFormattedQueryFromTokens",value:function(){var e=this,t="";return this.tokens.forEach((function(r,n){e.index=n,e.tokenOverride&&(r=e.tokenOverride(r,e.previousReservedWord)||r),r.type===i.default.WHITESPACE||(r.type===i.default.LINE_COMMENT?t=e.formatLineComment(r,t):r.type===i.default.BLOCK_COMMENT?t=e.formatBlockComment(r,t):r.type===i.default.RESERVED_TOP_LEVEL?(t=e.formatTopLevelReservedWord(r,t),e.previousReservedWord=r):r.type===i.default.RESERVED_TOP_LEVEL_NO_INDENT?(t=e.formatTopLevelReservedWordNoIndent(r,t),e.previousReservedWord=r):r.type===i.default.RESERVED_NEWLINE?(t=e.formatNewlineReservedWord(r,t),e.previousReservedWord=r):r.type===i.default.RESERVED?(t=e.formatWithSpaces(r,t),e.previousReservedWord=r):t=r.type===i.default.OPEN_PAREN?e.formatOpeningParentheses(r,t):r.type===i.default.CLOSE_PAREN?e.formatClosingParentheses(r,t):r.type===i.default.PLACEHOLDER?e.formatPlaceholder(r,t):","===r.value?e.formatComma(r,t):":"===r.value?e.formatWithSpaceAfter(r,t):"."===r.value?e.formatWithoutSpaces(r,t):";"===r.value?e.formatQuerySeparator(r,t):e.formatWithSpaces(r,t))})),t}},{key:"formatLineComment",value:function(e,t){return this.addNewline(t+e.value)}},{key:"formatBlockComment",value:function(e,t){return this.addNewline(this.addNewline(t)+this.indentComment(e.value))}},{key:"indentComment",value:function(e){return e.replace(/\n[\t ]*/g,"\n"+this.indentation.getIndent()+" ")}},{key:"formatTopLevelReservedWordNoIndent",value:function(e,t){return this.indentation.decreaseTopLevel(),t=this.addNewline(t)+this.equalizeWhitespace(this.formatReservedWord(e.value)),this.addNewline(t)}},{key:"formatTopLevelReservedWord",value:function(e,t){return this.indentation.decreaseTopLevel(),t=this.addNewline(t),this.indentation.increaseTopLevel(),t+=this.equalizeWhitespace(this.formatReservedWord(e.value)),this.addNewline(t)}},{key:"formatNewlineReservedWord",value:function(e,t){return this.addNewline(t)+this.equalizeWhitespace(this.formatReservedWord(e.value))+" "}},{key:"equalizeWhitespace",value:function(e){return e.replace(/[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g," ")}},{key:"formatOpeningParentheses",value:function(e,t){var r=[i.default.WHITESPACE,i.default.OPEN_PAREN,i.default.LINE_COMMENT];return(0,n.default)(r,this.previousToken().type)||(t=u(t)),t+=this.cfg.uppercase?e.value.toUpperCase():e.value,this.inlineBlock.beginIfPossible(this.tokens,this.index),this.inlineBlock.isActive()||(this.indentation.increaseBlockLevel(),t=this.addNewline(t)),t}},{key:"formatClosingParentheses",value:function(e,t){return e.value=this.cfg.uppercase?e.value.toUpperCase():e.value,this.inlineBlock.isActive()?(this.inlineBlock.end(),this.formatWithSpaceAfter(e,t)):(this.indentation.decreaseBlockLevel(),this.formatWithSpaces(e,this.addNewline(t)))}},{key:"formatPlaceholder",value:function(e,t){return t+this.params.get(e)+" "}},{key:"formatComma",value:function(e,t){return t=u(t)+e.value+" ",this.inlineBlock.isActive()||/^LIMIT$/i.test(this.previousReservedWord.value)?t:this.addNewline(t)}},{key:"formatWithSpaceAfter",value:function(e,t){return u(t)+e.value+" "}},{key:"formatWithoutSpaces",value:function(e,t){return u(t)+e.value}},{key:"formatWithSpaces",value:function(e,t){return t+("reserved"===e.type?this.formatReservedWord(e.value):e.value)+" "}},{key:"formatReservedWord",value:function(e){return this.cfg.uppercase?e.toUpperCase():e}},{key:"formatQuerySeparator",value:function(e,t){return this.indentation.resetIndentation(),u(t)+e.value+"\n".repeat(this.cfg.linesBetweenQueries||1)}},{key:"addNewline",value:function(e){return(e=u(e)).endsWith("\n")||(e+="\n"),e+this.indentation.getIndent()}},{key:"previousToken",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.tokens[this.index-e]||{}}}],r&&c(t.prototype,r),l&&c(t,l),e}();t.default=d,e.exports=t.default},9264:(e,t,r)=>{"use strict";const n=Symbol("SemVer ANY");class i{static get ANY(){return n}constructor(e,t){if(t=a(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),c("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(e){const t=this.options.loose?o[s.COMPARATORLOOSE]:o[s.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new u(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(c("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):(!(t=a(t)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}e.exports=i;const a=r(9547),{safeRe:o,t:s}=r(5750),l=r(4991),c=r(1064),u=r(4708),d=r(2839)},9308:(e,t,r)=>{"use strict";const n=r(3440);e.exports=(e,t,r)=>n(e,t,r)>0},9375:e=>{e.exports=function(){return!1}},9406:(e,t,r)=>{"use strict";const n=r(4708);e.exports=(e,t)=>new n(e,t).minor},9429:(e,t)=>{"use strict";function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.params=t,this.index=0}var t,n,i;return t=e,(n=[{key:"get",value:function(e){var t=e.key,r=e.value;return this.params?t?this.params[t]:this.params[this.index++]:r}}])&&r(t.prototype,n),i&&r(t,i),e}();t.default=n,e.exports=t.default},9445:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(9157)),i=a(r(3202));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s,l=["ALL","ALTER","ANALYZE","AND","ANY","ARRAY","AS","ASC","BEGIN","BETWEEN","BINARY","BOOLEAN","BREAK","BUCKET","BUILD","BY","CALL","CASE","CAST","CLUSTER","COLLATE","COLLECTION","COMMIT","CONNECT","CONTINUE","CORRELATE","COVER","CREATE","DATABASE","DATASET","DATASTORE","DECLARE","DECREMENT","DELETE","DERIVED","DESC","DESCRIBE","DISTINCT","DO","DROP","EACH","ELEMENT","ELSE","END","EVERY","EXCEPT","EXCLUDE","EXECUTE","EXISTS","EXPLAIN","FALSE","FETCH","FIRST","FLATTEN","FOR","FORCE","FROM","FUNCTION","GRANT","GROUP","GSI","HAVING","IF","IGNORE","ILIKE","IN","INCLUDE","INCREMENT","INDEX","INFER","INLINE","INNER","INSERT","INTERSECT","INTO","IS","JOIN","KEY","KEYS","KEYSPACE","KNOWN","LAST","LEFT","LET","LETTING","LIKE","LIMIT","LSM","MAP","MAPPING","MATCHED","MATERIALIZED","MERGE","MISSING","NAMESPACE","NEST","NOT","NULL","NUMBER","OBJECT","OFFSET","ON","OPTION","OR","ORDER","OUTER","OVER","PARSE","PARTITION","PASSWORD","PATH","POOL","PREPARE","PRIMARY","PRIVATE","PRIVILEGE","PROCEDURE","PUBLIC","RAW","REALM","REDUCE","RENAME","RETURN","RETURNING","REVOKE","RIGHT","ROLE","ROLLBACK","SATISFIES","SCHEMA","SELECT","SELF","SEMI","SET","SHOW","SOME","START","STATISTICS","STRING","SYSTEM","THEN","TO","TRANSACTION","TRIGGER","TRUE","TRUNCATE","UNDER","UNION","UNIQUE","UNKNOWN","UNNEST","UNSET","UPDATE","UPSERT","USE","USER","USING","VALIDATE","VALUE","VALUED","VALUES","VIA","VIEW","WHEN","WHERE","WHILE","WITH","WITHIN","WORK","XOR"],c=["DELETE FROM","EXCEPT ALL","EXCEPT","EXPLAIN DELETE FROM","EXPLAIN UPDATE","EXPLAIN UPSERT","FROM","GROUP BY","HAVING","INFER","INSERT INTO","LET","LIMIT","MERGE","NEST","ORDER BY","PREPARE","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UNNEST","UPDATE","UPSERT","USE KEYS","VALUES","WHERE"],u=["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],d=["AND","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","XOR"],p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=t}var t,r,a;return t=e,(r=[{key:"format",value:function(e){return s||(s=new i.default({reservedWords:l,reservedTopLevelWords:c,reservedNewlineWords:d,reservedTopLevelWordsNoIndent:u,stringTypes:['""',"''","``"],openParens:["(","[","{"],closeParens:[")","]","}"],namedPlaceholderTypes:["$"],lineCommentTypes:["#","--"]})),new n.default(this.cfg,s).format(e)}}])&&o(t.prototype,r),a&&o(t,a),e}();t.default=p,e.exports=t.default},9458:(e,t,r)=>{var n=r(8303)(Object.keys,Object);e.exports=n},9466:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},9547:e=>{"use strict";const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},9555:(e,t,r)=>{var n=r(3323),i=r(8967),a=r(5951);e.exports=function(e,t,r){return t==t?a(e,t,r):n(e,i,r)}},9653:(e,t,r)=>{var n=r(9048),i=r(582),a=r(9466),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&i(e.length)&&!!o[n(e)]}},9728:(e,t,r)=>{"use strict";e.exports=r(8044)},9764:(e,t,r)=>{var n=r(2609),i=r(1428),a=r(4913),o=r(7386),s=n?n.prototype:void 0,l=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(a(t))return i(t,e)+"";if(o(t))return l?l.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},9834:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},9881:(e,t,r)=>{"use strict";const n=r(4256);e.exports=(e,t)=>{const r=n(e,t);return r?r.version:null}},9901:(e,t,r)=>{var n=r(1459),i=r(3632),a=r(5729),o=r(3158);e.exports=function(e,t,r){return t=(r?i(e,t,r):void 0===t)?1:a(t),n(o(e),t)}},9965:(e,t,r)=>{var n=r(6392),i="object"==typeof self&&self&&self.Object===Object&&self,a=n||i||Function("return this")();e.exports=a},9992:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});const n={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let i;const a=new Uint8Array(16);var o=r(8422);const s=function(e,t,r){if(n.randomUUID&&!t&&!e)return n.randomUUID();const s=(e=e||{}).random??e.rng?.()??function(){if(!i){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");i=crypto.getRandomValues.bind(crypto)}return i(a)}();if(s.length<16)throw new Error("Random bytes length must be >= 16");if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=s[e];return t}return(0,o.k)(s)}}},m={};function b(e){var t=m[e];if(void 0!==t)return t.exports;var r=m[e]={id:e,loaded:!1,exports:{}};return g[e].call(r.exports,r,r.exports,b),r.loaded=!0,r.exports}b.m=g,b.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return b.d(t,{a:t}),t},b.d=(e,t)=>{for(var r in t)b.o(t,r)&&!b.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},b.f={},b.e=e=>Promise.all(Object.keys(b.f).reduce(((t,r)=>(b.f[r](e,t),t)),[])),b.u=e=>"loki-query-field.js",b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f={},h="loki:",b.l=(e,t,r,n)=>{if(f[e])f[e].push(t);else{var i,a;if(void 0!==r)for(var o=document.getElementsByTagName("script"),s=0;s<o.length;s++){var l=o[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==h+r){i=l;break}}i||(a=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,b.nc&&i.setAttribute("nonce",b.nc),i.setAttribute("data-webpack",h+r),i.src=e),f[e]=[t];var c=(t,r)=>{i.onerror=i.onload=null,clearTimeout(u);var n=f[e];if(delete f[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach((e=>e(r))),t)return t(r)},u=setTimeout(c.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=c.bind(null,i.onerror),i.onload=c.bind(null,i.onload),a&&document.head.appendChild(i)}},b.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),b.p="public/plugins/loki/",(()=>{var e={231:0};b.f.j=(t,r)=>{var n=b.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise(((r,i)=>n=e[t]=[r,i]));r.push(n[2]=i);var a=b.p+b.u(t),o=new Error;b.l(a,(r=>{if(b.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",o.name="ChunkLoadError",o.type=i,o.request=a,n[1](o)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,o,s]=r,l=0;if(a.some((t=>0!==e[t]))){for(n in o)b.o(o,n)&&(b.m[n]=o[n]);if(s)s(b)}for(t&&t(r);l<a.length;l++)i=a[l],b.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=globalThis.webpackChunkloki=globalThis.webpackChunkloki||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var v={};return(()=>{"use strict";b.r(v),b.d(v,{plugin:()=>og});var e=b(1308),t=b.n(e);b.p=t()&&t().uri?t().uri.slice(0,t().uri.lastIndexOf("/")+1):"public/plugins/loki/";var r=b(7781),n=b(8531),i=b(9728),a=b(6089),o=b(3241),s=b(5959),l=b.n(s),c=b(2007),u=b(7895);function d(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const f=['{job="default/prometheus"}'],h=["job","app","k8s_app"],g=[{title:"Log pipeline",expression:'{job="mysql"} |= "metrics" | logfmt | duration > 10s',label:'This query targets the MySQL job, keeps logs that contain the substring "metrics", and then parses and filters the logs further.'},{title:"Count over time",expression:'count_over_time({job="mysql"}[5m])',label:"This query counts all the log lines within the last five minutes for the MySQL job."},{title:"Rate",expression:'rate(({job="mysql"} |= "error" != "timeout")[10s])',label:"This query gets the per-second rate of all non-timeout errors within the last ten seconds for the MySQL job."},{title:"Aggregate, count, and group",expression:'sum(count_over_time({job="mysql"}[5m])) by (level)',label:"Get the count of logs during the last five minutes, grouping by level."}];class m extends s.PureComponent{componentDidMount(){this.scheduleUserLabelChecking(),(0,n.reportInteraction)("grafana_loki_cheatsheet_opened",{})}componentWillUnmount(){clearTimeout(this.userLabelTimer)}scheduleUserLabelChecking(){this.userLabelTimer=setTimeout(this.checkUserLabels,1e3)}renderExpression(e){const{onClickExample:t,theme:r}=this.props,a=O(r);return(0,i.jsx)("button",{type:"button",className:a.cheatSheetExample,onClick:()=>(t({refId:"A",expr:e}),void(0,n.reportInteraction)("grafana_loki_cheatsheet_example_clicked",{})),children:(0,i.jsx)("code",{children:e})},e)}render(){const{userExamples:e}=this.state,{theme:t}=this.props,r=e.length>0,n=O(t);return(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{children:"Loki Cheat Sheet"}),(0,i.jsxs)("div",{className:n.cheatSheetItem,children:[(0,i.jsx)("div",{className:n.cheatSheetItemTitle,children:"See your logs"}),"Start by selecting a log stream from the Label browser, or alternatively you can write a stream selector into the query field.",r?(0,i.jsxs)("div",{children:["Here are some example streams from your logs:",e.map((e=>this.renderExpression(e)))]}):(0,i.jsxs)("div",{children:["Here is an example of a log stream:",this.renderExpression(f[0])]})]}),(0,i.jsxs)("div",{className:n.cheatSheetItem,children:[(0,i.jsx)("div",{className:n.cheatSheetItemTitle,children:"Combine stream selectors"}),this.renderExpression('{app="cassandra",namespace="prod"}'),"Returns all log lines from streams that have both labels."]}),(0,i.jsxs)("div",{className:n.cheatSheetItem,children:[(0,i.jsx)("div",{className:n.cheatSheetItemTitle,children:"Filtering for search terms."}),this.renderExpression('{app="cassandra"} |~ "(duration|latency)s*(=|is|of)s*[d.]+"'),this.renderExpression('{app="cassandra"} |= "exact match"'),this.renderExpression('{app="cassandra"} != "do not match"'),(0,i.jsx)(c.TextLink,{href:"https://grafana.com/docs/loki/latest/logql/#log-pipeline",external:!0,children:"LogQL"})," ","supports exact and regular expression filters."]}),g.map((e=>(0,i.jsxs)("div",{className:n.cheatSheetItem,children:[(0,i.jsx)("div",{className:n.cheatSheetItemTitle,children:e.title}),this.renderExpression(e.expression),e.label]},e.expression)))]})}constructor(...e){var t;super(...e),p(t=this,"state",{userExamples:[]}),p(t,"checkUserLabels",(()=>{return(e=function*(){var e;const r=null===(e=t.props.datasource)||void 0===e?void 0:e.languageProvider;if(r.started){const e=r.getLabelKeys()||[],n=h.find((t=>e.includes(t)));if(n){const e=yield r.fetchLabelValues(n),i=(0,o.shuffle)(e).slice(0,5).map((e=>`{${n}="${(0,u.Qn)(e)}"}`));t.setState({userExamples:i})}}else t.scheduleUserLabelChecking()},function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){d(a,n,i,o,s,"next",e)}function s(e){d(a,n,i,o,s,"throw",e)}o(void 0)}))})();var e}))}}const y=(0,c.withTheme2)(m),O=e=>({cheatSheetItem:(0,a.css)({margin:e.spacing(3,0)}),cheatSheetItemTitle:(0,a.css)({fontSize:e.typography.h3.fontSize}),cheatSheetExample:(0,a.css)({margin:e.spacing(.5,0),textAlign:"left",border:"none",background:"transparent",display:"block"})});function E(e){var t=(0,s.useRef)();return(0,s.useEffect)((function(){t.current=e})),t.current}var x=b(9076),S=b(1886);const w=({children:e})=>{const t=(0,c.useStyles2)(T);return s.createElement("div",{className:t.root},e)},T=e=>({root:(0,a.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:e.spacing(3),minHeight:e.spacing(4)})}),R=({children:e,wrap:t=!0,...r})=>{var n,i;return s.createElement(c.Stack,{wrap:t?"wrap":void 0,direction:null!=(n=r.direction)?n:"row",gap:null!=(i=r.gap)?i:2,...r},e)};let P;P="undefined"!=typeof window?window:"undefined"!=typeof self?self:b.g;let I=null,A=null;const L=P.clearTimeout,C=P.setTimeout,_=P.cancelAnimationFrame||P.mozCancelAnimationFrame||P.webkitCancelAnimationFrame,N=P.requestAnimationFrame||P.mozRequestAnimationFrame||P.webkitRequestAnimationFrame;null==_||null==N?(I=L,A=function(e){return C(e,20)}):(I=function([e,t]){_(e),L(t)},A=function(e){const t=N((function(){L(r),e()})),r=C((function(){_(t),e()}),20);return[t,r]});s.Component;b(7409);var D=b(1269),k=b(3059);function $({label:e,...t}){const r=e.replace(" ","-"),n=(0,s.useRef)((0,o.uniqueId)(`switch-${r}`)),i=(0,c.useStyles2)(j);return s.createElement(R,{gap:1},s.createElement("label",{htmlFor:n.current,className:i.switchLabel},e),s.createElement(c.Switch,{...t,id:n.current}))}const j=e=>({switchLabel:(0,a.css)({color:e.colors.text.secondary,cursor:"pointer",fontSize:e.typography.bodySmall.fontSize,"&:hover":{color:e.colors.text.primary}})}),F=({grow:e,shrink:t})=>s.createElement("div",{style:{display:"block",flexGrow:e,flexShrink:t}}),M=[{label:"Builder",value:S.f.Builder},{label:"Code",value:S.f.Code}];function B({mode:e,onChange:t}){return s.createElement("div",{"data-testid":"QueryEditorModeToggle"},s.createElement(c.RadioButtonGroup,{options:M,size:"sm",value:e,onChange:t}))}const Q=({children:e})=>s.createElement(R,{gap:.5,direction:"column"},e);function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},U.apply(null,arguments)}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(e,t){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},q(e,t)}function G(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,q(e,t)}var W=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function X(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(n=e[r],i=t[r],!(n===i||W(n)&&W(i)))return!1;var n,i;return!0}const z=function(e,t){var r;void 0===t&&(t=X);var n,i=[],a=!1;return function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return a&&r===this&&t(o,i)||(n=e.apply(this,o),a=!0,r=this,i=o),n}};var H="object"==typeof performance&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()};function Y(e){cancelAnimationFrame(e.id)}function K(e,t){var r=H();var n={id:requestAnimationFrame((function i(){H()-r>=t?e.call(null):n.id=requestAnimationFrame(i)}))};return n}var Z=-1;function J(e){if(void 0===e&&(e=!1),-1===Z||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Z=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Z}var ee=null;function te(e){if(void 0===e&&(e=!1),null===ee||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?ee="positive-descending":(t.scrollLeft=1,ee=0===t.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(t),ee}return ee}var re=function(e,t){return e};function ne(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,l=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=function(e){function t(t){var n;return(n=e.call(this,t)||this)._instanceProps=c(n.props,V(n)),n._outerRef=void 0,n._resetIsScrollingTimeoutId=null,n.state={instance:V(n),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"==typeof n.props.initialScrollOffset?n.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},n._callOnItemsRendered=void 0,n._callOnItemsRendered=z((function(e,t,r,i){return n.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:r,visibleStopIndex:i})})),n._callOnScroll=void 0,n._callOnScroll=z((function(e,t,r){return n.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:r})})),n._getItemStyle=void 0,n._getItemStyle=function(e){var t,a=n.props,o=a.direction,s=a.itemSize,l=a.layout,c=n._getItemStyleCache(u&&s,u&&l,u&&o);if(c.hasOwnProperty(e))t=c[e];else{var d=r(n.props,e,n._instanceProps),p=i(n.props,e,n._instanceProps),f="horizontal"===o||"horizontal"===l,h="rtl"===o,g=f?d:0;c[e]=t={position:"absolute",left:h?void 0:g,right:h?g:void 0,top:f?0:d,height:f?"100%":p,width:f?p:"100%"}}return t},n._getItemStyleCache=void 0,n._getItemStyleCache=z((function(e,t,r){return{}})),n._onScrollHorizontal=function(e){var t=e.currentTarget,r=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;n.setState((function(e){if(e.scrollOffset===i)return null;var t=n.props.direction,o=i;if("rtl"===t)switch(te()){case"negative":o=-i;break;case"positive-descending":o=a-r-i}return o=Math.max(0,Math.min(o,a-r)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?"forward":"backward",scrollOffset:o,scrollUpdateWasRequested:!1}}),n._resetIsScrollingDebounced)},n._onScrollVertical=function(e){var t=e.currentTarget,r=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;n.setState((function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-r));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!1}}),n._resetIsScrollingDebounced)},n._outerRefSetter=function(e){var t=n.props.outerRef;n._outerRef=e,"function"==typeof t?t(e):null!=t&&"object"==typeof t&&t.hasOwnProperty("current")&&(t.current=e)},n._resetIsScrollingDebounced=function(){null!==n._resetIsScrollingTimeoutId&&Y(n._resetIsScrollingTimeoutId),n._resetIsScrollingTimeoutId=K(n._resetIsScrolling,150)},n._resetIsScrolling=function(){n._resetIsScrollingTimeoutId=null,n.setState({isScrolling:!1},(function(){n._getItemStyleCache(-1,null)}))},n}G(t,e),t.getDerivedStateFromProps=function(e,t){return ie(e,t),d(e),null};var p=t.prototype;return p.scrollTo=function(e){e=Math.max(0,e),this.setState((function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}}),this._resetIsScrollingDebounced)},p.scrollToItem=function(e,t){void 0===t&&(t="auto");var r=this.props,n=r.itemCount,i=r.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,n-1));var s=0;if(this._outerRef){var l=this._outerRef;s="vertical"===i?l.scrollWidth>l.clientWidth?J():0:l.scrollHeight>l.clientHeight?J():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},p.componentDidMount=function(){var e=this.props,t=e.direction,r=e.initialScrollOffset,n=e.layout;if("number"==typeof r&&null!=this._outerRef){var i=this._outerRef;"horizontal"===t||"horizontal"===n?i.scrollLeft=r:i.scrollTop=r}this._callPropsCallbacks()},p.componentDidUpdate=function(){var e=this.props,t=e.direction,r=e.layout,n=this.state,i=n.scrollOffset;if(n.scrollUpdateWasRequested&&null!=this._outerRef){var a=this._outerRef;if("horizontal"===t||"horizontal"===r)if("rtl"===t)switch(te()){case"negative":a.scrollLeft=-i;break;case"positive-ascending":a.scrollLeft=i;break;default:var o=a.clientWidth,s=a.scrollWidth;a.scrollLeft=s-o-i}else a.scrollLeft=i;else a.scrollTop=i}this._callPropsCallbacks()},p.componentWillUnmount=function(){null!==this._resetIsScrollingTimeoutId&&Y(this._resetIsScrollingTimeoutId)},p.render=function(){var e=this.props,t=e.children,r=e.className,i=e.direction,a=e.height,o=e.innerRef,l=e.innerElementType,c=e.innerTagName,u=e.itemCount,d=e.itemData,p=e.itemKey,f=void 0===p?re:p,h=e.layout,g=e.outerElementType,m=e.outerTagName,b=e.style,v=e.useIsScrolling,y=e.width,O=this.state.isScrolling,E="horizontal"===i||"horizontal"===h,x=E?this._onScrollHorizontal:this._onScrollVertical,S=this._getRangeToRender(),w=S[0],T=S[1],R=[];if(u>0)for(var P=w;P<=T;P++)R.push((0,s.createElement)(t,{data:d,key:f(P,d),index:P,isScrolling:v?O:void 0,style:this._getItemStyle(P)}));var I=n(this.props,this._instanceProps);return(0,s.createElement)(g||m||"div",{className:r,onScroll:x,ref:this._outerRefSetter,style:U({position:"relative",height:a,width:y,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:i},b)},(0,s.createElement)(l||c||"div",{children:R,ref:o,style:{height:E?"100%":I,pointerEvents:O?"none":void 0,width:E?I:"100%"}}))},p._callPropsCallbacks=function(){if("function"==typeof this.props.onItemsRendered&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],r=e[1],n=e[2],i=e[3];this._callOnItemsRendered(t,r,n,i)}if("function"==typeof this.props.onScroll){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,l=a.scrollUpdateWasRequested;this._callOnScroll(o,s,l)}},p._getRangeToRender=function(){var e=this.props,t=e.itemCount,r=e.overscanCount,n=this.state,i=n.isScrolling,a=n.scrollDirection,s=n.scrollOffset;if(0===t)return[0,0,0,0];var c=o(this.props,s,this._instanceProps),u=l(this.props,c,s,this._instanceProps),d=i&&"backward"!==a?1:Math.max(1,r),p=i&&"forward"!==a?1:Math.max(1,r);return[Math.max(0,c-d),Math.max(0,Math.min(t-1,u+p)),c,u]},t}(s.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ie=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},ae=ne({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,r,n,i,a){var o=e.direction,s=e.height,l=e.itemCount,c=e.itemSize,u=e.layout,d=e.width,p="horizontal"===o||"horizontal"===u?d:s,f=Math.max(0,l*c-p),h=Math.min(f,t*c),g=Math.max(0,t*c-p+c+a);switch("smart"===r&&(r=n>=g-p&&n<=h+p?"auto":"center"),r){case"start":return h;case"end":return g;case"center":var m=Math.round(g+(h-g)/2);return m<Math.ceil(p/2)?0:m>f+Math.floor(p/2)?f:m;default:return n>=g&&n<=h?n:n<g?g:h}},getStartIndexForOffset:function(e,t){var r=e.itemCount,n=e.itemSize;return Math.max(0,Math.min(r-1,Math.floor(t/n)))},getStopIndexForStartIndex:function(e,t,r){var n=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,l=e.width,c=t*o,u="horizontal"===n||"horizontal"===s?l:i,d=Math.ceil((u+r-c)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function oe(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function se(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){oe(a,n,i,o,s,"next",e)}function s(e){oe(a,n,i,o,s,"throw",e)}o(void 0)}))}}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){le(e,t,r[t])}))}return e}function ue(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const de=1e3,pe=1e4,fe=4,he="{}",ge=new Intl.Collator("en",{sensitivity:"accent"});function me(e){const t=[];for(const r of e)if(r.selected&&r.values&&r.values.length>0){const e=r.values.filter((e=>e.selected)).map((e=>e.name)).sort(ge.compare);e.length>1?t.push(`${r.name}=~"${e.map(u.Cs).join("|")}"`):1===e.length&&t.push(`${r.name}="${(0,u.Qn)(e[0])}"`)}return["{",t.join(","),"}"].join("")}class be extends s.Component{updateLabelState(e,t,r="",n){this.setState((n=>{const i=n.labels.map((r=>r.name===e?ce({},r,t):r)),a=r?"":n.error;return{labels:i,status:r,error:a,validationStatus:""}}),n)}componentDidMount(){const{languageProvider:e,autoSelect:t=fe,lastUsedLabels:r,timeRange:n}=this.props;if(e){const i=r;e.start(n).then((()=>{let r=e.getLabelKeys();if(r.length>de){const e=`Too many labels found (showing only 1000 of ${r.length})`;r=r.slice(0,de),this.setState({error:e})}const n=r.map(((e,r,n)=>({name:e,selected:n.length<=t&&0===i.length||i.includes(e),loading:!1})));this.setState({labels:n},(()=>{this.state.labels.forEach((e=>{e.selected&&this.fetchValues(e.name,he)}))}))}))}}doFacettingForLabel(e){const t=this.state.labels.find((t=>t.name===e));if(!t)return;const r=this.state.labels.filter((e=>e.selected)).map((e=>e.name));this.props.storeLastUsedLabels(r),t.selected?t.values||this.fetchValues(e,me(this.state.labels)):this.doFacetting()}fetchValues(e,t){return se((function*(){const{languageProvider:r,timeRange:n}=this.props;this.updateLabelState(e,{loading:!0},`Fetching values for ${e}`);try{let i=yield r.fetchLabelValues(e,{timeRange:n});if(t!==me(this.state.labels))return void this.updateLabelState(e,{loading:!1},"");if(i.length>pe){const t=`Too many values for ${e} (showing only 10000 of ${i.length})`;i=i.slice(0,pe),this.setState({error:t})}const a=i.map((e=>({name:e})));this.updateLabelState(e,{values:a,loading:!1})}catch(e){console.error(e)}})).call(this)}fetchSeries(e,t){return se((function*(){const{languageProvider:r,timeRange:n}=this.props;t&&this.updateLabelState(t,{loading:!0},`Loading labels for ${e}`);try{const i=yield r.fetchSeriesLabels(e,{timeRange:n});if(e!==me(this.state.labels))return void(t&&this.updateLabelState(t,{loading:!1}));if(0===Object.keys(i).length)return void this.setState({error:`Empty results, no matching label for ${e}`});const a=function(e,t,r){return e.map((e=>{const n=t[e.name];if(n){let t;if(e.name===r&&e.values)t=e.values;else{var i;const r=new Set((null===(i=e.values)||void 0===i?void 0:i.filter((e=>e.selected)).map((e=>e.name)))||[]);t=n.slice().sort(ge.compare).map((e=>({name:e,selected:r.has(e)})))}return ue(ce({},e),{loading:!1,values:t,facets:t.length})}return ue(ce({},e),{loading:!1,hidden:!n,values:void 0,facets:0})}))}(this.state.labels,i,t);this.setState({labels:a,error:""}),t&&this.updateLabelState(t,{loading:!1})}catch(e){console.error(e)}})).call(this)}validateSelector(e){return se((function*(){const{languageProvider:t,timeRange:r}=this.props;this.setState({validationStatus:`Validating selector ${e}`,error:""});const n=yield t.fetchSeries(e,{timeRange:r});this.setState({validationStatus:`Selector is valid (${n.length} streams found)`})})).call(this)}render(){const{theme:e}=this.props,{labels:t,searchTerm:r,status:n,error:s,validationStatus:l}=this.state;if(0===t.length)return(0,i.jsx)(c.LoadingPlaceholder,{text:"Loading labels..."});const u=(e=>({wrapper:(0,a.css)({backgroundColor:e.colors.background.secondary,width:"100%"}),wrapperPadding:(0,a.css)({padding:e.spacing(2)}),list:(0,a.css)({marginTop:e.spacing(1),display:"flex",flexWrap:"wrap",maxHeight:"200px",overflow:"auto"}),section:(0,a.css)({"& + &":{margin:e.spacing(2,0)},position:"relative"}),footerSectionStyles:(0,a.css)({padding:e.spacing(1),backgroundColor:e.colors.background.primary,position:"sticky",bottom:e.spacing(-3),left:0}),selector:(0,a.css)({fontFamily:e.typography.fontFamilyMonospace,marginBottom:e.spacing(1),width:"100%"}),status:(0,a.css)({marginBottom:e.spacing(1),color:e.colors.text.secondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",[e.transitions.handleMotion("no-preference","reduce")]:{transition:"opacity 100ms linear"},opacity:0,fontSize:e.typography.bodySmall.fontSize,height:`calc(${e.typography.bodySmall.fontSize} + 10px)`}),statusShowing:(0,a.css)({opacity:1}),error:(0,a.css)({color:e.colors.error.main}),valueList:(0,a.css)({marginRight:e.spacing(1),resize:"horizontal"}),valueListWrapper:(0,a.css)({borderLeft:`1px solid ${e.colors.border.medium}`,margin:e.spacing(1,0),padding:e.spacing(1,0,1,1)}),valueListArea:(0,a.css)({display:"flex",flexWrap:"wrap",marginTop:e.spacing(1)}),valueTitle:(0,a.css)({marginLeft:e.spacing(-.5),marginBottom:e.spacing(1)}),validationStatus:(0,a.css)({padding:e.spacing(.5),marginBottom:e.spacing(1),color:e.colors.text.maxContrast,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"})}))(e),d=me(this.state.labels),p=d===he;let f=t.filter((e=>e.selected&&e.values));return f=r?f.map((e=>{const t=e.values.filter((e=>{if(e.selected)return e.highlightParts=void 0,!0;const t=(0,c.fuzzyMatch)(e.name.toLowerCase(),r.toLowerCase());return!!t.found&&(e.highlightParts=t.ranges,e.order=t.distance,!0)}));return ue(ce({},e),{values:(0,o.sortBy)(t,(e=>e.selected?-1/0:e.order))})})):this.state.labels.filter((e=>e.selected&&e.values)).map((e=>ue(ce({},e),{values:(null==e?void 0:e.values)?e.values.map((e=>ue(ce({},e),{highlightParts:void 0}))):[]}))),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:u.wrapper,children:[(0,i.jsxs)("div",{className:(0,a.cx)(u.section,u.wrapperPadding),children:[(0,i.jsx)(c.Label,{description:"Which labels would you like to consider for your search?",children:"1. Select labels to search in"}),(0,i.jsx)("div",{className:u.list,children:t.map((e=>(0,i.jsx)(c.BrowserLabel,{name:e.name,loading:e.loading,active:e.selected,hidden:e.hidden,facets:e.facets,onClick:this.onClickLabel},e.name)))})]}),(0,i.jsxs)("div",{className:(0,a.cx)(u.section,u.wrapperPadding),children:[(0,i.jsx)(c.Label,{description:"Choose the label values that you would like to use for the query. Use the search field to find values across selected labels.",children:"2. Find values for the selected labels"}),(0,i.jsx)("div",{children:(0,i.jsx)(c.Input,{onChange:this.onChangeSearch,"aria-label":"Filter expression for values",value:r,placeholder:"Enter a label value"})}),(0,i.jsx)("div",{className:u.valueListArea,children:f.map((e=>{var t,n;return(0,i.jsxs)("div",{role:"list",className:u.valueListWrapper,children:[(0,i.jsx)("div",{className:u.valueTitle,"aria-label":`Values for ${e.name}`,children:(0,i.jsx)(c.BrowserLabel,{name:e.name,loading:e.loading,active:e.selected,hidden:e.hidden,facets:e.facets||(null===(t=e.values)||void 0===t?void 0:t.length),onClick:this.onClickLabel})}),(0,i.jsx)(ae,{height:200,itemCount:(null===(n=e.values)||void 0===n?void 0:n.length)||0,itemSize:28,itemKey:t=>{var r,n;return null!==(n=null===(r=e.values)||void 0===r?void 0:r[t].name)&&void 0!==n?n:t},width:200,className:u.valueList,children:({index:t,style:n})=>{var a;const o=null===(a=e.values)||void 0===a?void 0:a[t];return o?(0,i.jsx)("div",{style:n,children:(0,i.jsx)(c.BrowserLabel,{name:e.name,value:null==o?void 0:o.name,active:null==o?void 0:o.selected,highlightParts:null==o?void 0:o.highlightParts,onClick:this.onClickValue,searchTerm:r})}):null}})]},e.name)}))})]})]}),(0,i.jsxs)("div",{className:u.footerSectionStyles,children:[(0,i.jsx)(c.Label,{children:"3. Resulting selector"}),(0,i.jsx)("pre",{"aria-label":"selector",className:u.selector,children:d}),l&&(0,i.jsx)("div",{className:u.validationStatus,children:l}),(0,i.jsx)("div",{className:(0,a.cx)(u.status,(n||s)&&u.statusShowing),children:(0,i.jsx)("span",{className:s?u.error:"",children:s||n})}),(0,i.jsxs)(c.Stack,{gap:1,children:[(0,i.jsx)(c.Button,{"aria-label":"Use selector as logs button",disabled:p,onClick:this.onClickRunLogsQuery,children:"Show logs"}),(0,i.jsx)(c.Button,{"aria-label":"Use selector as metrics button",variant:"secondary",disabled:p,onClick:this.onClickRunMetricsQuery,children:"Show logs rate"}),(0,i.jsx)(c.Button,{"aria-label":"Validate submit button",variant:"secondary",disabled:p,onClick:this.onClickValidate,children:"Validate selector"}),(0,i.jsx)(c.Button,{"aria-label":"Selector clear button",variant:"secondary",onClick:this.onClickClear,children:"Clear"})]})]})]})}constructor(...e){super(...e),le(this,"state",{labels:[],searchTerm:"",status:"Ready",error:"",validationStatus:""}),le(this,"onChangeSearch",(e=>{this.setState({searchTerm:e.target.value})})),le(this,"onClickRunLogsQuery",(()=>{(0,n.reportInteraction)("grafana_loki_label_browser_closed",{app:this.props.app,closeType:"showLogsButton"});const e=me(this.state.labels);this.props.onChange(e)})),le(this,"onClickRunMetricsQuery",(()=>{(0,n.reportInteraction)("grafana_loki_label_browser_closed",{app:this.props.app,closeType:"showLogsRateButton"});const e=`rate(${me(this.state.labels)}[$__auto])`;this.props.onChange(e)})),le(this,"onClickClear",(()=>{this.setState((e=>({labels:e.labels.map((e=>ue(ce({},e),{values:void 0,selected:!1,loading:!1,hidden:!1,facets:void 0}))),searchTerm:"",status:"",error:"",validationStatus:""}))),this.props.deleteLastUsedLabels()})),le(this,"onClickLabel",((e,t,r)=>{const n=this.state.labels.find((t=>t.name===e));if(!n)return;const i=!n.selected;let a={selected:i};if(n.values&&!i){const e=n.values.map((e=>ue(ce({},e),{selected:!1})));a=ue(ce({},a),{facets:0,values:e})}this.setState({searchTerm:""}),this.updateLabelState(e,a,"",(()=>this.doFacettingForLabel(e)))})),le(this,"onClickValue",((e,t,r)=>{const n=this.state.labels.find((t=>t.name===e));if(!n||!n.values)return;this.setState({searchTerm:""});const i=n.values.map((e=>ue(ce({},e),{selected:e.name===t?!e.selected:e.selected})));this.updateLabelState(e,{values:i},"",(()=>this.doFacetting(e)))})),le(this,"onClickValidate",(()=>{const e=me(this.state.labels);this.validateSelector(e)})),le(this,"doFacetting",(e=>{const t=me(this.state.labels);if(t===he){const e=this.state.labels.map((e=>ue(ce({},e),{facets:0,values:void 0,hidden:!1})));this.setState({labels:e},(()=>{this.state.labels.forEach((e=>e.selected&&this.fetchValues(e.name,t)))}))}else this.fetchSeries(t,e)}))}}const ve=(0,c.withTheme2)(be);function ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oe(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Ee=e=>{const{isOpen:t,onClose:a,datasource:o,app:l,timeRange:u}=e,[d,p]=(0,s.useState)(!1),[f,h]=(0,s.useState)(!1),g=(0,c.useStyles2)(xe);(0,s.useEffect)((()=>{t&&o.languageProvider.fetchLabels({timeRange:u}).then((e=>{p(!0),h(e.length>0)}))}),[o,t,u]);const m=t=>{const{query:r,onChange:n,onRunQuery:i}=e,a=Oe(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){ye(e,t,r[t])}))}return e}({},r),{expr:t});n(a),i()},b=e=>{m(e),a()};return(0,i.jsxs)(c.Modal,{isOpen:t,title:"Label browser",onDismiss:()=>{(0,n.reportInteraction)("grafana_loki_label_browser_closed",{app:l,closeType:"modalClose"}),a()},className:g.modal,children:[!d&&(0,i.jsx)(c.LoadingPlaceholder,{text:"Loading labels..."}),d&&!f&&(0,i.jsx)("p",{children:"No labels found."}),d&&f&&(0,i.jsx)(r.LocalStorageValueProvider,{storageKey:"grafana.datasources.loki.browser.labels",defaultValue:[],children:(e,t,r)=>(0,i.jsx)(ve,{languageProvider:o.languageProvider,onChange:b,lastUsedLabels:e,storeLastUsedLabels:t,deleteLastUsedLabels:r,app:l,timeRange:u})})]})},xe=e=>({modal:(0,a.css)({width:"85vw",[e.breakpoints.down("md")]:{width:"100%"}})});var Se=b(7694),we=Symbol.for("immer-nothing"),Te=Symbol.for("immer-draftable"),Re=Symbol.for("immer-state");function Pe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ie=Object.getPrototypeOf;function Ae(e){return!!e&&!!e[Re]}function Le(e){return!!e&&(_e(e)||Array.isArray(e)||!!e[Te]||!!e.constructor?.[Te]||je(e)||Fe(e))}var Ce=Object.prototype.constructor.toString();function _e(e){if(!e||"object"!=typeof e)return!1;const t=Ie(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===Ce}function Ne(e,t){0===De(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function De(e){const t=e[Re];return t?t.type_:Array.isArray(e)?1:je(e)?2:Fe(e)?3:0}function ke(e,t){return 2===De(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $e(e,t,r){const n=De(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function je(e){return e instanceof Map}function Fe(e){return e instanceof Set}function Me(e){return e.copy_||e.base_}function Be(e,t){if(je(e))return new Map(e);if(Fe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=_e(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[Re];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const i=r[n],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Ie(e),t)}{const t=Ie(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function Qe(e,t=!1){return Ve(e)||Ae(e)||!Le(e)||(De(e)>1&&Object.defineProperties(e,{set:{value:Ue},add:{value:Ue},clear:{value:Ue},delete:{value:Ue}}),Object.freeze(e),t&&Object.values(e).forEach((e=>Qe(e,!0)))),e}function Ue(){Pe(2)}function Ve(e){return Object.isFrozen(e)}var qe,Ge={};function We(e){const t=Ge[e];return t||Pe(0),t}function Xe(){return qe}function ze(e,t){t&&(We("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function He(e){Ye(e),e.drafts_.forEach(Ze),e.drafts_=null}function Ye(e){e===qe&&(qe=e.parent_)}function Ke(e){return qe={drafts_:[],parent_:qe,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ze(e){const t=e[Re];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Je(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[Re].modified_&&(He(t),Pe(4)),Le(e)&&(e=et(t,e),t.parent_||rt(t,e)),t.patches_&&We("Patches").generateReplacementPatches_(r[Re].base_,e,t.patches_,t.inversePatches_)):e=et(t,r,[]),He(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==we?e:void 0}function et(e,t,r){if(Ve(t))return t;const n=t[Re];if(!n)return Ne(t,((i,a)=>tt(e,n,t,i,a,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return rt(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let i=t,a=!1;3===n.type_&&(i=new Set(t),t.clear(),a=!0),Ne(i,((i,o)=>tt(e,n,t,i,o,r,a))),rt(e,t,!1),r&&e.patches_&&We("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function tt(e,t,r,n,i,a,o){if(Ae(i)){const o=et(e,i,a&&t&&3!==t.type_&&!ke(t.assigned_,n)?a.concat(n):void 0);if($e(r,n,o),!Ae(o))return;e.canAutoFreeze_=!1}else o&&r.add(i);if(Le(i)&&!Ve(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;et(e,i),t&&t.scope_.parent_||"symbol"==typeof n||!(je(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))||rt(e,i)}}function rt(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Qe(t,r)}var nt={get(e,t){if(t===Re)return e;const r=Me(e);if(!ke(r,t))return function(e,t,r){const n=ot(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!Le(n)?n:n===at(e.base_,t)?(lt(e),e.copy_[t]=ct(n,e)):n},has:(e,t)=>t in Me(e),ownKeys:e=>Reflect.ownKeys(Me(e)),set(e,t,r){const n=ot(Me(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=at(Me(e),t),o=n?.[Re];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((i=r)===(a=n)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==r||ke(e.base_,t)))return!0;lt(e),st(e)}var i,a;return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==at(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,lt(e),st(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=Me(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){Pe(11)},getPrototypeOf:e=>Ie(e.base_),setPrototypeOf(){Pe(12)}},it={};function at(e,t){const r=e[Re];return(r?Me(r):e)[t]}function ot(e,t){if(!(t in e))return;let r=Ie(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Ie(r)}}function st(e){e.modified_||(e.modified_=!0,e.parent_&&st(e.parent_))}function lt(e){e.copy_||(e.copy_=Be(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ne(nt,((e,t)=>{it[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),it.deleteProperty=function(e,t){return it.set.call(this,e,t,void 0)},it.set=function(e,t,r){return nt.set.call(this,e[0],t,r,e[0])};function ct(e,t){const r=je(e)?We("MapSet").proxyMap_(e,t):Fe(e)?We("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Xe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=nt;r&&(i=[n],a=it);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}(e,t);return(t?t.scope_:Xe()).drafts_.push(r),r}function ut(e){if(!Le(e)||Ve(e))return e;const t=e[Re];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Be(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Be(e,!0);return Ne(r,((e,t)=>{$e(r,e,ut(t))})),t&&(t.finalized_=!1),r}var dt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...i){return n.produce(e,(e=>t.call(this,e,...i)))}}let n;if("function"!=typeof t&&Pe(6),void 0!==r&&"function"!=typeof r&&Pe(7),Le(e)){const i=Ke(this),a=ct(e,void 0);let o=!0;try{n=t(a),o=!1}finally{o?He(i):Ye(i)}return ze(i,r),Je(n,i)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===we&&(n=void 0),this.autoFreeze_&&Qe(n,!0),r){const t=[],i=[];We("Patches").generateReplacementPatches_(e,n,t,i),r(t,i)}return n}Pe(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Le(e)||Pe(8),Ae(e)&&(e=function(e){Ae(e)||Pe(10);return ut(e)}(e));const t=Ke(this),r=ct(e,void 0);return r[Re].isManual_=!0,Ye(t),r}finishDraft(e,t){const r=e&&e[Re];r&&r.isManual_||Pe(9);const{scope_:n}=r;return ze(n,t),Je(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=We("Patches").applyPatches_;return Ae(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},pt=dt.produce;"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__,"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function ft(e,t){function r(...r){if(t){let n=t(...r);if(!n)throw new Error(wt(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=t=>(0,Se.isAction)(t)&&t.type===e,r}Symbol.species;function ht(e){return Le(e)?pt(e,(()=>{})):e}function gt(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function mt(e){const t={},r=[];let n;const i={addCase(e,r){const n="string"==typeof e?e:e.type;if(!n)throw new Error(wt(28));if(n in t)throw new Error(wt(29));return t[n]=r,i},addAsyncThunk:(e,n)=>(n.pending&&(t[e.pending.type]=n.pending),n.rejected&&(t[e.rejected.type]=n.rejected),n.fulfilled&&(t[e.fulfilled.type]=n.fulfilled),n.settled&&r.push({matcher:e.settled,reducer:n.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(n=e,i)};return e(i),[t,r,n]}var bt=Symbol.for("rtk-slice-createasyncthunk");function vt(e,t){return`${e}/${t}`}function yt({creators:e}={}){const t=e?.asyncThunk?.[bt];return function(e){const{name:r,reducerPath:n=r}=e;if(!r)throw new Error(wt(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){const r="string"==typeof e?e:e.type;if(!r)throw new Error(wt(12));if(r in o.sliceCaseReducersByType)throw new Error(wt(13));return o.sliceCaseReducersByType[r]=t,s},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),s),exposeAction:(e,t)=>(o.actionCreators[e]=t,s),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,s)};function l(){const[t={},r=[],n]="function"==typeof e.extraReducers?mt(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return function(e,t){let r,[n,i,a]=mt(t);if("function"==typeof e)r=()=>ht(e());else{const t=ht(e);r=()=>t}function o(e=r(),t){let o=[n[t.type],...i.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===o.filter((e=>!!e)).length&&(o=[a]),o.reduce(((e,r)=>{if(r){if(Ae(e)){const n=r(e,t);return void 0===n?e:n}if(Le(e))return pt(e,(e=>r(e,t)));{const n=r(e,t);if(void 0===n){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}}return e}),e)}return o.getInitialState=r,o}(e.initialState,(e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of r)e.addMatcher(t.matcher,t.reducer);n&&e.addDefaultCase(n)}))}a.forEach((n=>{const a=i[n],o={reducerName:n,type:vt(r,n),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(a)?function({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(n))throw new Error(wt(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ft(e,o):ft(e))}(o,a,s):function({type:e,reducerName:t},r,n,i){if(!i)throw new Error(wt(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=r,d=i(e,a,u);n.exposeAction(t,d),o&&n.addCase(d.fulfilled,o);s&&n.addCase(d.pending,s);l&&n.addCase(d.rejected,l);c&&n.addMatcher(d.settled,c);n.exposeCaseReducer(t,{fulfilled:o||xt,pending:s||xt,rejected:l||xt,settled:c||xt})}(o,a,s,t)}));const c=e=>e,u=new Map,d=new WeakMap;let p;function f(e,t){return p||(p=l()),p(e,t)}function h(){return p||(p=l()),p.getInitialState()}function g(t,r=!1){function n(e){let i=e[t];return void 0===i&&r&&(i=gt(d,n,h)),i}function i(t=c){const n=gt(u,r,(()=>new WeakMap));return gt(n,t,(()=>{const n={};for(const[i,a]of Object.entries(e.selectors??{}))n[i]=Ot(a,t,(()=>gt(d,t,h)),r);return n}))}return{reducerPath:t,getSelectors:i,get selectors(){return i(n)},selectSlice:n}}const m={name:r,reducer:f,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:h,...g(n),injectInto(e,{reducerPath:t,...r}={}){const i=t??n;return e.inject({reducerPath:i,reducer:f},r),{...m,...g(i,!0)}}};return m}}function Ot(e,t,r,n){function i(i,...a){let o=t(i);return void 0===o&&n&&(o=r()),e(o,...a)}return i.unwrapped=e,i}var Et=yt();function xt(){}var{assign:St}=Object;Symbol.for("rtk-state-proxy-original");function wt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Tt=b(3471),Rt=b(3354);const Pt=({children:e})=>{const t=(0,c.useStyles2)(It);return s.createElement("div",{className:t.root},s.createElement(R,{gap:2},e))},It=e=>({root:(0,a.css)({padding:e.spacing(1),backgroundColor:e.colors.background.secondary,borderRadius:e.shape.radius.default})}),At=e=>{var t;const{label:r,optional:n,tooltip:i,tooltipInteractive:a,children:o,width:l,...u}=e,d=(0,c.useStyles2)(Lt,l),p=(null==u?void 0:u.htmlFor)||(null==(t=c.ReactUtils)?void 0:t.getChildId(o)),f=s.createElement(s.Fragment,null,s.createElement("label",{className:d.label,htmlFor:p},r,n&&s.createElement("span",{className:d.optional}," - optional"),i&&s.createElement(c.Tooltip,{placement:"top",content:i,theme:"info",interactive:a},s.createElement(c.Icon,{tabIndex:0,name:"info-circle",size:"sm",className:d.icon}))),s.createElement(c.Space,{v:.5}));return s.createElement("div",{className:d.root},s.createElement(c.Field,{className:d.field,label:f,...u},o))},Lt=(e,t)=>({root:(0,a.css)({minWidth:e.spacing(null!=t?t:0)}),label:(0,a.css)({fontSize:12,fontWeight:e.typography.fontWeightMedium}),optional:(0,a.css)({fontStyle:"italic",color:e.colors.text.secondary}),field:(0,a.css)({marginBottom:0}),icon:(0,a.css)({color:e.colors.text.secondary,marginLeft:e.spacing(1),":hover":{color:e.colors.text.primary}})}),Ct=({children:e})=>s.createElement(R,{gap:1},e),_t=s.forwardRef((function({items:e,renderItem:t,onChange:r},n){return s.createElement(R,null,e.map(((n,i)=>s.createElement("div",{key:i},t(n,(t=>((t,n)=>{const i=[...e];i[t]=n,r(i)})(i,t)),(()=>(t=>{const n=[...e];n.splice(t,1),r(n)})(i)))))),s.createElement(c.Button,{ref:n,onClick:()=>{const t=[...e,{}];r(t)},variant:"secondary",size:"md",icon:"plus","aria-label":"Add",type:"button"}))}));var Nt=b(9992);const Dt=({children:e})=>{const t=(0,c.useStyles2)($t),r=s.Children.map(e,(e=>(0,s.isValidElement)(e)&&e.props.invalid?(0,s.cloneElement)(e,{className:(0,a.cx)(e.props.className,t.invalidChild)}):e));return s.createElement("div",{className:t.root},r)},kt=["","base","hovered","invalid","focused"],$t=()=>({root:(0,a.css)({display:"flex","> *":{"&:not(:first-child)":{marginLeft:-1},"&:first-child":{borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-child":{borderTopLeftRadius:0,borderBottomLeftRadius:0},"&:not(:first-child):not(:last-child)":{borderRadius:0},position:"relative",zIndex:kt.indexOf("base"),"&:hover":{zIndex:kt.indexOf("hovered")},"&:focus-within":{zIndex:kt.indexOf("focused")}}}),invalidChild:(0,a.css)({zIndex:kt.indexOf("invalid")})}),jt=({className:e,...t})=>{const r=(0,c.useStyles2)(Ft);return s.createElement(c.Button,{...t,className:(0,a.cx)(e,r.button)})},Ft=e=>({button:(0,a.css)({paddingLeft:e.spacing(1.5),paddingRight:e.spacing(1.5)})});function Mt({item:e,items:t,defaultOp:n,onChange:i,onDelete:a,onGetLabelNames:l,onGetLabelValues:u,invalidLabel:d,invalidValue:p,multiValueSeparator:f="|"}){var h;const[g,m]=(0,s.useState)({}),[b,v]=(0,s.useState)(!1),[y,O]=(0,s.useState)(!1),E=(t=e.op)=>{var r;return null==(r=Bt.find((e=>e.label===t)))?void 0:r.isMultiValue},S=e=>e?e.indexOf(f)>0?e.split(f):[e]:[],w=function(e,t){if(!e.label||!e.op||!e.value)return!1;if(t.length<2)return!1;const r=e.op.toString().startsWith("!"),n=t.filter((t=>t.label===e.label&&t.value===e.value&&t.op!==e.op)).some((e=>{var t,n;return!(!r||!1!==(null==(t=null==e?void 0:e.op)?void 0:t.toString().startsWith("!")))||!(!1!==r||!(null==(n=null==e?void 0:e.op)?void 0:n.toString().startsWith("!")))}));return n}(e,t),{current:T}=(0,s.useRef)((0,Nt.A)());return s.createElement("div",{"data-testid":"visual-query-builder-dimensions-filter-item"},s.createElement(c.InlineField,{error:"You have conflicting label filters",invalid:!!w||void 0},s.createElement(Dt,null,s.createElement(c.Select,{placeholder:"Select label","data-testid":x.Tp.components.QueryBuilder.labelSelect,inputId:`visual-query-builder-dimensions-filter-item-key-${T}`,width:"auto",value:e.label?(0,r.toOption)(e.label):null,allowCustomValue:!0,onOpenMenu:async()=>{m({isLoadingLabelNames:!0});const t=await l(e);v(!0),m({labelNames:t,isLoadingLabelNames:void 0})},onCloseMenu:()=>{v(!1)},isOpen:b,isLoading:g.isLoadingLabelNames,options:g.labelNames,onChange:t=>{var r;t.value&&i({...e,op:null!=(r=e.op)?r:n,label:t.value})},invalid:w||d}),s.createElement(c.Select,{"data-testid":x.Tp.components.QueryBuilder.matchOperatorSelect,value:(0,r.toOption)(null!=(h=e.op)?h:n),options:Bt,width:"auto",onChange:t=>{t.value&&i({...e,op:t.value,value:E(t.value)?e.value:S(null==e?void 0:e.value)[0]})},invalid:w}),s.createElement(c.Select,{placeholder:"Select value","data-testid":x.Tp.components.QueryBuilder.valueSelect,inputId:`visual-query-builder-dimensions-filter-item-value-${T}`,width:"auto",value:E()?S(null==e?void 0:e.value).map(r.toOption):S(null==e?void 0:e.value).map(r.toOption)[0],allowCustomValue:!0,onOpenMenu:async()=>{m({isLoadingLabelValues:!0});const t=await u(e);m({...g,labelValues:t,isLoadingLabelValues:void 0}),O(!0)},onCloseMenu:()=>{O(!1)},isOpen:y,isMulti:E(),isLoading:g.isLoadingLabelValues,options:(()=>{const t=g.labelValues?[...g.labelValues]:[],n=S(null==e?void 0:e.value).map(r.toOption);return(0,o.uniqBy)([...n,...t],"value")})(),onChange:t=>{var r,a;if(t.value)i({...e,value:t.value,op:null!=(r=e.op)?r:n});else{const r=t.map((e=>e.value?e.value:void 0)).filter((e=>void 0!==e)).join(f);i({...e,value:r,op:null!=(a=e.op)?a:n})}},invalid:w||p}),s.createElement(jt,{"aria-label":"remove",icon:"times",variant:"secondary",onClick:a}))))}const Bt=[{label:"=",value:"=",description:"Equals",isMultiValue:!1},{label:"!=",value:"!=",description:"Does not equal",isMultiValue:!1},{label:"=~",value:"=~",description:"Matches regex",isMultiValue:!0},{label:"!~",value:"!~",description:"Does not match regex",isMultiValue:!0}];function Qt({labelsFilters:e,onChange:t,onGetLabelNames:r,onGetLabelValues:n,labelFilterRequired:i,multiValueSeparator:a}){const[l,c]=(0,s.useState)([{op:"="}]);(0,s.useEffect)((()=>{e.length>0?c(e):c([{op:"="}])}),[e]);const u=l.some((e=>e.label&&e.value));return s.createElement(Ct,null,s.createElement(At,{label:"Label filters",error:"Select at least 1 label filter (label and value)",invalid:i&&!u},s.createElement(_t,{items:l,onChange:r=>{c(r);const n=r.filter((e=>void 0!==e.label&&void 0!==e.value));(0,o.isEqual)(n,e)||t(n)},renderItem:(e,t,o)=>s.createElement(Mt,{item:e,items:l,defaultOp:"=",onChange:t,onDelete:o,onGetLabelNames:r,onGetLabelValues:n,invalidLabel:i&&!e.label,invalidValue:i&&!e.value,multiValueSeparator:a})})))}function Ut({title:e,stepNumber:t,markdown:n,children:i}){const a=(0,c.useStyles2)(Vt);return s.createElement("div",{className:a.box},void 0!==t&&s.createElement("div",{className:a.stepNumber},t),s.createElement("div",{className:a.boxInner},e&&s.createElement("div",{className:a.header},s.createElement("span",null,e)),s.createElement("div",{className:a.body},n&&s.createElement("div",{dangerouslySetInnerHTML:{__html:(0,r.renderMarkdown)(n)}}),i)))}const Vt=e=>({box:(0,a.css)({background:e.colors.background.secondary,padding:e.spacing(1),borderRadius:e.shape.radius.default,position:"relative"}),boxInner:(0,a.css)({marginLeft:e.spacing(4)}),stepNumber:(0,a.css)({fontWeight:e.typography.fontWeightMedium,background:e.colors.secondary.main,width:"20px",height:"20px",borderRadius:e.shape.radius.circle,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"10px",left:"11px",fontSize:e.typography.bodySmall.fontSize}),header:(0,a.css)({paddingBottom:e.spacing(.5),display:"flex",alignItems:"center",fontFamily:e.typography.fontFamilyMonospace}),body:(0,a.css)({color:e.colors.text.secondary,"p:last-child":{margin:0},a:{color:e.colors.text.link,textDecoration:"underline"}})});var qt=b(8146);function Gt({query:e,language:t,className:n}){const i=(0,c.useTheme2)(),o=Wt(i),l=qt.highlight(e,t.grammar,t.name);return s.createElement("div",{className:(0,a.cx)(o.editorField,"prism-syntax-highlight",n),"aria-label":"selector",dangerouslySetInnerHTML:{__html:r.textUtil.sanitize(l)}})}const Wt=e=>({editorField:(0,a.css)({fontFamily:e.typography.fontFamilyMonospace,fontSize:e.typography.bodySmall.fontSize})});function Xt({children:e}){const t=(0,c.useStyles2)(zt);return s.createElement("div",{className:t.root},s.createElement(R,{gap:1},e))}const zt=e=>({root:(0,a.css)({padding:e.spacing(1,1,0,1),backgroundColor:e.colors.background.secondary,borderRadius:e.shape.radius.default})});var Ht=b(8398),Yt=b.n(Ht),Kt=b(200);function Zt(e,t){var r=(0,s.useState)((function(){return{inputs:t,result:e()}}))[0],n=(0,s.useRef)(!0),i=(0,s.useRef)(r),a=n.current||Boolean(t&&i.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(t,i.current.inputs))?i.current:{inputs:t,result:e()};return(0,s.useEffect)((function(){n.current=!1,i.current=a}),[a]),a.result}var Jt=Zt,er=function(e,t){return Zt((function(){return e}),t)},tr="Invariant failed";var rr=function(e){var t=e.top,r=e.right,n=e.bottom,i=e.left;return{top:t,right:r,bottom:n,left:i,width:r-i,height:n-t,x:i,y:t,center:{x:(r+i)/2,y:(n+t)/2}}},nr=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},ir=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},ar={top:0,right:0,bottom:0,left:0},or=function(e){var t=e.borderBox,r=e.margin,n=void 0===r?ar:r,i=e.border,a=void 0===i?ar:i,o=e.padding,s=void 0===o?ar:o,l=rr(nr(t,n)),c=rr(ir(t,a)),u=rr(ir(c,s));return{marginBox:l,borderBox:rr(t),paddingBox:c,contentBox:u,margin:n,border:a,padding:s}},sr=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var r=Number(t);return isNaN(r)&&function(e){if(!e)throw new Error(tr)}(!1),r},lr=function(e,t){var r,n,i=e.borderBox,a=e.border,o=e.margin,s=e.padding,l=(n=t,{top:(r=i).top+n.y,left:r.left+n.x,bottom:r.bottom+n.y,right:r.right+n.x});return or({borderBox:l,border:a,margin:o,padding:s})},cr=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),lr(e,t)},ur=function(e,t){var r={top:sr(t.marginTop),right:sr(t.marginRight),bottom:sr(t.marginBottom),left:sr(t.marginLeft)},n={top:sr(t.paddingTop),right:sr(t.paddingRight),bottom:sr(t.paddingBottom),left:sr(t.paddingLeft)},i={top:sr(t.borderTopWidth),right:sr(t.borderRightWidth),bottom:sr(t.borderBottomWidth),left:sr(t.borderLeftWidth)};return or({borderBox:e,margin:r,padding:n,border:i})},dr=function(e){var t=e.getBoundingClientRect(),r=window.getComputedStyle(e);return ur(t,r)},pr=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function fr(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(n=e[r],i=t[r],!(n===i||pr(n)&&pr(i)))return!1;var n,i;return!0}function hr(e,t){void 0===t&&(t=fr);var r=null;function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(r&&r.lastThis===this&&t(n,r.lastArgs))return r.lastResult;var a=e.apply(this,n);return r={lastResult:a,lastArgs:n,lastThis:this},a}return n.clear=function(){r=null},n}const gr=function(e){var t=[],r=null,n=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];t=i,r||(r=requestAnimationFrame((function(){r=null,e.apply(void 0,t)})))};return n.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},n};function mr(){return mr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mr.apply(null,arguments)}function br(e,t){}br.bind(null,"warn"),br.bind(null,"error");function vr(){}function yr(e,t,r){const n=t.map((t=>{const n=function(e,t){return{...e,...t}}(r,t.options);return e.addEventListener(t.eventName,t.fn,n),function(){e.removeEventListener(t.eventName,t.fn,n)}}));return function(){n.forEach((e=>{e()}))}}const Or="Invariant failed";class Er extends Error{}function xr(e,t){throw new Er(Or)}Er.prototype.toString=function(){return this.message};class Sr extends l().Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=vr,this.onWindowError=e=>{const t=this.getCallbacks();t.isDragging()&&t.tryAbort();e.error instanceof Er&&e.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=e=>{this.callbacks=e}}componentDidMount(){this.unbind=yr(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(!(e instanceof Er))throw e;this.setState({})}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const wr=e=>e+1,Tr=(e,t)=>{const r=e.droppableId===t.droppableId,n=wr(e.index),i=wr(t.index);return r?`\n You have moved the item from position ${n}\n to position ${i}\n `:`\n You have moved the item from position ${n}\n in list ${e.droppableId}\n to list ${t.droppableId}\n in position ${i}\n `},Rr=(e,t,r)=>t.droppableId===r.droppableId?`\n The item ${e}\n has been combined with ${r.draggableId}`:`\n The item ${e}\n in list ${t.droppableId}\n has been combined with ${r.draggableId}\n in list ${r.droppableId}\n `,Pr=e=>`\n The item has returned to its starting position\n of ${wr(e.index)}\n`,Ir={dragHandleUsageInstructions:"\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n",onDragStart:e=>`\n You have lifted an item in position ${wr(e.source.index)}\n`,onDragUpdate:e=>{const t=e.destination;if(t)return Tr(e.source,t);const r=e.combine;return r?Rr(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},onDragEnd:e=>{if("CANCEL"===e.reason)return`\n Movement cancelled.\n ${Pr(e.source)}\n `;const t=e.destination,r=e.combine;return t?`\n You have dropped the item.\n ${Tr(e.source,t)}\n `:r?`\n You have dropped the item.\n ${Rr(e.draggableId,e.source,r)}\n `:`\n The item has been dropped while not over a drop area.\n ${Pr(e.source)}\n `}},Ar={x:0,y:0},Lr=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Cr=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),_r=(e,t)=>e.x===t.x&&e.y===t.y,Nr=e=>({x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}),Dr=(e,t,r=0)=>"x"===e?{x:t,y:r}:{x:r,y:t},kr=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),$r=(e,t)=>Math.min(...t.map((t=>kr(e,t)))),jr=e=>t=>({x:e(t.x),y:e(t.y)});const Fr=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Mr=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],Br=(e,t)=>t&&t.shouldClipSubject?((e,t)=>{const r=rr({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r})(t.pageMarginBox,e):rr(e);var Qr=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const i=((e,t)=>t?Fr(e,t.scroll.diff.displacement):e)(e.marginBox,n),a=((e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e)(i,r,t);return{page:e,withPlaceholder:t,active:Br(a,n)}},Ur=(e,t)=>{e.frame||xr();const r=e.frame,n=Cr(t,r.scroll.initial),i=Nr(n),a={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:i},max:r.scroll.max}},o=Qr({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:a});return{...e,frame:a,subject:o}};const Vr=hr((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),qr=hr((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),Gr=hr((e=>Object.values(e))),Wr=hr((e=>Object.values(e)));var Xr=hr(((e,t)=>{const r=Wr(t).filter((t=>e===t.descriptor.droppableId)).sort(((e,t)=>e.descriptor.index-t.descriptor.index));return r}));function zr(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function Hr(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}var Yr=hr(((e,t)=>t.filter((t=>t.descriptor.id!==e.descriptor.id)))),Kr=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const Zr={point:Ar,value:0},Jr={invisible:{},visible:{},all:[]},en={displaced:Jr,displacedBy:Zr,at:null};var tn=(e,t)=>r=>e<=r&&r<=t,rn=e=>{const t=tn(e.top,e.bottom),r=tn(e.left,e.right);return n=>{if(t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right))return!0;const i=t(n.top)||t(n.bottom),a=r(n.left)||r(n.right);if(i&&a)return!0;const o=n.top<e.top&&n.bottom>e.bottom,s=n.left<e.left&&n.right>e.right;if(o&&s)return!0;return o&&a||s&&i}},nn=e=>{const t=tn(e.top,e.bottom),r=tn(e.left,e.right);return e=>t(e.top)&&t(e.bottom)&&r(e.left)&&r(e.right)};const an={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},on={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};const sn=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:i})=>{const a=n?((e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:Ar;return Fr(e,r)})(e,t):e;return((e,t,r)=>!!t.subject.active&&r(t.subject.active)(e))(a,t,i)&&((e,t,r)=>r(t)(e))(a,r,i)},ln=e=>sn({...e,isVisibleThroughFrameFn:nn});function cn({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:i,last:a}){return e.reduce((function(e,o){const s=function(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return rr(nr(r,n))}(o,r),l=o.descriptor.id;e.all.push(l);var c;if(!(c={target:s,destination:t,viewport:n,withDroppableDisplacement:!0},sn({...c,isVisibleThroughFrameFn:rn})))return e.invisible[o.descriptor.id]=!0,e;const u=((e,t,r)=>{if("boolean"==typeof r)return r;if(!t)return!0;const{invisible:n,visible:i}=t;if(n[e])return!1;const a=i[e];return!a||a.shouldAnimate})(l,a,i),d={draggableId:l,shouldAnimate:u};return e.visible[l]=d,e}),{all:[],visible:{},invisible:{}})}function un({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const i=function(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}(e,{inHomeList:t});return{displaced:Jr,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:i}}}}function dn({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:i,last:a,index:o,forceShouldAnimate:s}){const l=Kr(e,r);if(null==o)return un({insideDestination:t,inHomeList:l,displacedBy:i,destination:r});const c=t.find((e=>e.descriptor.index===o));if(!c)return un({insideDestination:t,inHomeList:l,displacedBy:i,destination:r});const u=Yr(e,t),d=t.indexOf(c);return{displaced:cn({afterDragging:u.slice(d),destination:r,displacedBy:i,last:a,viewport:n.frame,forceShouldAnimate:s}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function pn(e,t){return Boolean(t.effected[e])}var fn=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:i,insideDestination:a,previousImpact:o,viewport:s,afterCritical:l})=>{const c=o.at;if(c||xr(),"REORDER"===c.type){const n=(({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const i=n.index,a=e?i+1:i-1,o=r[0].descriptor.index,s=r[r.length-1].descriptor.index;return a<o||a>(t?s:s+1)?null:a})({isMovingForward:e,isInHomeList:t,location:c.destination,insideDestination:a});return null==n?null:dn({draggable:r,insideDestination:a,destination:i,viewport:s,last:o.displaced,displacedBy:o.displacedBy,index:n})}const u=(({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:i})=>{if(!t.isCombineEnabled)return null;const a=n.draggableId,o=r[a].descriptor.index;return pn(a,i)?e?o:o-1:e?o+1:o})({isMovingForward:e,destination:i,displaced:o.displaced,draggables:n,combine:c.combine,afterCritical:l});return null==u?null:dn({draggable:r,insideDestination:a,destination:i,viewport:s,last:o.displaced,displacedBy:o.displacedBy,index:u})},hn=({afterCritical:e,impact:t,draggables:r})=>{const n=Hr(t);n||xr();const i=n.draggableId,a=r[i].page.borderBox.center,o=(({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const i=Boolean(e.visible[r]||e.invisible[r]);return pn(r,t)?i?Ar:Nr(n.point):i?n.point:Ar})({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return Lr(a,o)};const gn=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,mn=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,bn=({axis:e,moveRelativeTo:t,isMoving:r})=>Dr(e.line,t.marginBox[e.end]+gn(e,r),mn(e,t.marginBox,r)),vn=({axis:e,moveRelativeTo:t,isMoving:r})=>Dr(e.line,t.marginBox[e.start]-((e,t)=>t.margin[e.end]+t.borderBox[e.size]/2)(e,r),mn(e,t.marginBox,r));var yn=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i})=>{const a=Xr(n.descriptor.id,r),o=t.page,s=n.axis;if(!a.length)return(({axis:e,moveInto:t,isMoving:r})=>Dr(e.line,t.contentBox[e.start]+gn(e,r),mn(e,t.contentBox,r)))({axis:s,moveInto:n.page,isMoving:o});const{displaced:l,displacedBy:c}=e,u=l.all[0];if(u){const e=r[u];if(pn(u,i))return vn({axis:s,moveRelativeTo:e.page,isMoving:o});const t=lr(e.page,c.point);return vn({axis:s,moveRelativeTo:t,isMoving:o})}const d=a[a.length-1];if(d.descriptor.id===t.descriptor.id)return o.borderBox.center;if(pn(d.descriptor.id,i)){const e=lr(d.page,Nr(i.displacedBy.point));return bn({axis:s,moveRelativeTo:e,isMoving:o})}return bn({axis:s,moveRelativeTo:d.page,isMoving:o})},On=(e,t)=>{const r=e.frame;return r?Lr(t,r.scroll.diff.displacement):t};var En=e=>{const t=(({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:i})=>{const a=t.page.borderBox.center,o=e.at;return r&&o?"REORDER"===o.type?yn({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:i}):hn({impact:e,draggables:n,afterCritical:i}):a})(e),r=e.droppable;return r?On(r,t):t},xn=(e,t)=>{const r=Cr(t,e.scroll.initial),n=Nr(r);return{frame:rr({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}}};function Sn(e,t){return e.map((e=>t[e]))}var wn=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=((e,t)=>Lr(e.scroll.diff.displacement,t))(r,e),i=Cr(n,t.page.borderBox.center);return Lr(t.client.borderBox.center,i)},Tn=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:i,onlyOnMainAxis:a=!1})=>{const o=Cr(r,e.page.borderBox.center),s={target:Fr(e.page.borderBox,o),destination:t,withDroppableDisplacement:i,viewport:n};return a?(e=>{return sn({...e,isVisibleThroughFrameFn:(t=e.destination.axis,e=>{const r=tn(e.top,e.bottom),n=tn(e.left,e.right);return e=>t===an?r(e.top)&&r(e.bottom):n(e.left)&&n(e.right)})});var t})(s):ln(s)},Rn=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:i,viewport:a,previousPageBorderBoxCenter:o,previousClientSelection:s,afterCritical:l})=>{if(!r.isEnabled)return null;const c=Xr(r.descriptor.id,n),u=Kr(t,r),d=(({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:i})=>{if(!r.isCombineEnabled)return null;if(!zr(i))return null;function a(e){const t={type:"COMBINE",combine:{draggableId:e,droppableId:r.descriptor.id}};return{...i,at:t}}const o=i.displaced.all,s=o.length?o[0]:null;if(e)return s?a(s):null;const l=Yr(t,n);if(!s)return l.length?a(l[l.length-1].descriptor.id):null;const c=l.findIndex((e=>e.descriptor.id===s));-1===c&&xr();const u=c-1;return u<0?null:a(l[u].descriptor.id)})({isMovingForward:e,draggable:t,destination:r,insideDestination:c,previousImpact:i})||fn({isMovingForward:e,isInHomeList:u,draggable:t,draggables:n,destination:r,insideDestination:c,previousImpact:i,viewport:a,afterCritical:l});if(!d)return null;const p=En({impact:d,draggable:t,droppable:r,draggables:n,afterCritical:l});if(Tn({draggable:t,destination:r,newPageBorderBoxCenter:p,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})){return{clientSelection:wn({pageBorderBoxCenter:p,draggable:t,viewport:a}),impact:d,scrollJumpRequest:null}}const f=Cr(p,o),h=(({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:i})=>{const a=xn(t,Lr(t.scroll.current,i)),o=r.frame?Ur(r,Lr(r.frame.scroll.current,i)):r,s=e.displaced,l=cn({afterDragging:Sn(s.all,n),destination:r,displacedBy:e.displacedBy,viewport:a.frame,last:s,forceShouldAnimate:!1}),c=cn({afterDragging:Sn(s.all,n),destination:o,displacedBy:e.displacedBy,viewport:t.frame,last:s,forceShouldAnimate:!1}),u={},d={},p=[s,l,c];return s.all.forEach((e=>{const t=function(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}(e,p);t?d[e]=t:u[e]=!0})),{...e,displaced:{all:s.all,invisible:u,visible:d}}})({impact:d,viewport:a,destination:r,draggables:n,maxScrollChange:f});return{clientSelection:s,impact:h,scrollJumpRequest:f}};const Pn=e=>{const t=e.subject.active;return t||xr(),t};const In=(e,t)=>{const r=e.page.borderBox.center;return pn(e.descriptor.id,t)?Cr(r,t.displacedBy.point):r},An=(e,t)=>{const r=e.page.borderBox;return pn(e.descriptor.id,t)?Fr(r,Nr(t.displacedBy.point)):r};var Ln=hr((function(e,t){const r=t[e.line];return{value:r,point:Dr(e.line,r)}}));const Cn=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),_n=(e,t,r)=>{const n=e.frame;Kr(t,e)&&xr(),e.subject.withPlaceholder&&xr();const i=Ln(e.axis,t.displaceBy).point,a=((e,t,r)=>{const n=e.axis;if("virtual"===e.descriptor.mode)return Dr(n.line,t[n.line]);const i=e.subject.page.contentBox[n.size],a=Xr(e.descriptor.id,r).reduce(((e,t)=>e+t.client.marginBox[n.size]),0)+t[n.line]-i;return a<=0?null:Dr(n.line,a)})(e,i,r),o={placeholderSize:i,increasedBy:a,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const t=Qr({page:e.subject.page,withPlaceholder:o,axis:e.axis,frame:e.frame});return{...e,subject:t}}const s=a?Lr(n.scroll.max,a):n.scroll.max,l=Cn(n,s),c=Qr({page:e.subject.page,withPlaceholder:o,axis:e.axis,frame:l});return{...e,subject:c,frame:l}};var Nn=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:i,droppables:a,viewport:o,afterCritical:s})=>{const l=(({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:i})=>{const a=r.subject.active;if(!a)return null;const o=r.axis,s=tn(a[o.start],a[o.end]),l=Gr(n).filter((e=>e!==r)).filter((e=>e.isEnabled)).filter((e=>Boolean(e.subject.active))).filter((e=>rn(i.frame)(Pn(e)))).filter((t=>{const r=Pn(t);return e?a[o.crossAxisEnd]<r[o.crossAxisEnd]:r[o.crossAxisStart]<a[o.crossAxisStart]})).filter((e=>{const t=Pn(e),r=tn(t[o.start],t[o.end]);return s(t[o.start])||s(t[o.end])||r(a[o.start])||r(a[o.end])})).sort(((t,r)=>{const n=Pn(t)[o.crossAxisStart],i=Pn(r)[o.crossAxisStart];return e?n-i:i-n})).filter(((e,t,r)=>Pn(e)[o.crossAxisStart]===Pn(r[0])[o.crossAxisStart]));if(!l.length)return null;if(1===l.length)return l[0];const c=l.filter((e=>tn(Pn(e)[o.start],Pn(e)[o.end])(t[o.line])));return 1===c.length?c[0]:c.length>1?c.sort(((e,t)=>Pn(e)[o.start]-Pn(t)[o.start]))[0]:l.sort(((e,r)=>{const n=$r(t,Mr(Pn(e))),i=$r(t,Mr(Pn(r)));return n!==i?n-i:Pn(e)[o.start]-Pn(r)[o.start]}))[0]})({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:a,viewport:o});if(!l)return null;const c=Xr(l.descriptor.id,i),u=(({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:i})=>{const a=n.filter((e=>ln({target:An(e,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0}))).sort(((t,n)=>{const a=kr(e,On(r,In(t,i))),o=kr(e,On(r,In(n,i)));return a<o?-1:o<a?1:t.descriptor.index-n.descriptor.index}));return a[0]||null})({pageBorderBoxCenter:t,viewport:o,destination:l,insideDestination:c,afterCritical:s}),d=(({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:i,destination:a,viewport:o,afterCritical:s})=>{if(!t){if(r.length)return null;const e={displaced:Jr,displacedBy:Zr,at:{type:"REORDER",destination:{droppableId:a.descriptor.id,index:0}}},t=En({impact:e,draggable:n,droppable:a,draggables:i,afterCritical:s}),l=Kr(n,a)?a:_n(a,n,i);return Tn({draggable:n,destination:l,newPageBorderBoxCenter:t,viewport:o.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?e:null}const l=Boolean(e[a.axis.line]<=t.page.borderBox.center[a.axis.line]),c=(()=>{const e=t.descriptor.index;return t.descriptor.id===n.descriptor.id||l?e:e+1})(),u=Ln(a.axis,n.displaceBy);return dn({draggable:n,insideDestination:r,destination:a,viewport:o,displacedBy:u,last:Jr,index:c})})({previousPageBorderBoxCenter:t,destination:l,draggable:r,draggables:i,moveRelativeTo:u,insideDestination:c,viewport:o,afterCritical:s});if(!d)return null;const p=En({impact:d,draggable:r,droppable:l,draggables:i,afterCritical:s});return{clientSelection:wn({pageBorderBoxCenter:p,draggable:r,viewport:o}),impact:d,scrollJumpRequest:null}},Dn=e=>{const t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null};var kn=({state:e,type:t})=>{const r=((e,t)=>{const r=Dn(e);return r?t[r]:null})(e.impact,e.dimensions.droppables),n=Boolean(r),i=e.dimensions.droppables[e.critical.droppable.id],a=r||i,o=a.axis.direction,s="vertical"===o&&("MOVE_UP"===t||"MOVE_DOWN"===t)||"horizontal"===o&&("MOVE_LEFT"===t||"MOVE_RIGHT"===t);if(s&&!n)return null;const l="MOVE_DOWN"===t||"MOVE_RIGHT"===t,c=e.dimensions.draggables[e.critical.draggable.id],u=e.current.page.borderBoxCenter,{draggables:d,droppables:p}=e.dimensions;return s?Rn({isMovingForward:l,previousPageBorderBoxCenter:u,draggable:c,destination:a,draggables:d,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):Nn({isMovingForward:l,previousPageBorderBoxCenter:u,draggable:c,isOver:a,draggables:d,droppables:p,viewport:e.viewport,afterCritical:e.afterCritical})};function $n(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}function jn(e){const t=tn(e.top,e.bottom),r=tn(e.left,e.right);return function(e){return t(e.y)&&r(e.x)}}function Fn({pageBorderBox:e,draggable:t,droppables:r}){const n=Gr(r).filter((t=>{if(!t.isEnabled)return!1;const r=t.subject.active;if(!r)return!1;if(i=r,!((n=e).left<i.right&&n.right>i.left&&n.top<i.bottom&&n.bottom>i.top))return!1;var n,i;if(jn(r)(e.center))return!0;const a=t.axis,o=r.center[a.crossAxisLine],s=e[a.crossAxisStart],l=e[a.crossAxisEnd],c=tn(r[a.crossAxisStart],r[a.crossAxisEnd]),u=c(s),d=c(l);return!u&&!d||(u?s<o:l>o)}));return n.length?1===n.length?n[0].descriptor.id:function({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,i=r.map((t=>{const r=t.axis,i=Dr(t.axis.line,e.center[r.line],t.page.borderBox.center[r.crossAxisLine]);return{id:t.descriptor.id,distance:kr(n,i)}})).sort(((e,t)=>t.distance-e.distance));return i[0]?i[0].id:null}({pageBorderBox:e,draggable:t,candidates:n}):null}const Mn=(e,t)=>rr(Fr(e,t));function Bn({displaced:e,id:t}){return Boolean(e.visible[t]||e.invisible[t])}var Qn=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:i,viewport:a,afterCritical:o})=>{const s=Mn(t.page.borderBox,e),l=Fn({pageBorderBox:s,draggable:t,droppables:n});if(!l)return en;const c=n[l],u=Xr(c.descriptor.id,r),d=((e,t)=>{const r=e.frame;return r?Mn(t,r.scroll.diff.value):t})(c,s);return(({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:i,afterCritical:a})=>{if(!n.isCombineEnabled)return null;const o=n.axis,s=Ln(n.axis,e.displaceBy),l=s.value,c=t[o.start],u=t[o.end],d=Yr(e,i).find((e=>{const t=e.descriptor.id,n=e.page.borderBox,i=n[o.size]/4,s=pn(t,a),d=Bn({displaced:r.displaced,id:t});return s?d?u>n[o.start]+i&&u<n[o.end]-i:c>n[o.start]-l+i&&c<n[o.end]-l-i:d?u>n[o.start]+l+i&&u<n[o.end]+l-i:c>n[o.start]+i&&c<n[o.end]-i}));return d?{displacedBy:s,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:d.descriptor.id,droppableId:n.descriptor.id}}}:null})({pageBorderBoxWithDroppableScroll:d,draggable:t,previousImpact:i,destination:c,insideDestination:u,afterCritical:o})||(({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:i,viewport:a,afterCritical:o})=>{const s=r.axis,l=Ln(r.axis,t.displaceBy),c=l.value,u=e[s.start],d=e[s.end],p=function({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}({draggable:t,closest:Yr(t,n).find((e=>{const t=e.descriptor.id,r=e.page.borderBox.center[s.line],n=pn(t,o),a=Bn({displaced:i,id:t});return n?a?d<=r:u<r-c:a?d<=r+c:u<r}))||null,inHomeList:Kr(t,r)});return dn({draggable:t,insideDestination:n,destination:r,viewport:a,last:i,displacedBy:l,index:p})})({pageBorderBoxWithDroppableScroll:d,draggable:t,destination:c,insideDestination:u,last:i.displaced,viewport:a,afterCritical:o})},Un=(e,t)=>({...e,[t.descriptor.id]:t});const Vn=({previousImpact:e,impact:t,droppables:r})=>{const n=Dn(e),i=Dn(t);if(!n)return r;if(n===i)return r;const a=r[n];if(!a.subject.withPlaceholder)return r;const o=(e=>{const t=e.subject.withPlaceholder;t||xr();const r=e.frame;if(!r){const t=Qr({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:t}}const n=t.oldFrameMaxScroll;n||xr();const i=Cn(r,n),a=Qr({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:a,frame:i}})(a);return Un(r,o)};var qn=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:i,scrollJumpRequest:a})=>{const o=n||e.viewport,s=r||e.dimensions,l=t||e.current.client.selection,c=Cr(l,e.initial.client.selection),u={offset:c,selection:l,borderBoxCenter:Lr(e.initial.client.borderBoxCenter,c)},d={selection:Lr(u.selection,o.scroll.current),borderBoxCenter:Lr(u.borderBoxCenter,o.scroll.current),offset:Lr(u.offset,o.scroll.diff.value)},p={client:u,page:d};if("COLLECTING"===e.phase)return{...e,dimensions:s,viewport:o,current:p};const f=s.draggables[e.critical.draggable.id],h=i||Qn({pageOffset:d.offset,draggable:f,draggables:s.draggables,droppables:s.droppables,previousImpact:e.impact,viewport:o,afterCritical:e.afterCritical}),g=(({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:i})=>{const a=Vn({previousImpact:n,impact:i,droppables:r}),o=Dn(i);if(!o)return a;const s=r[o];if(Kr(e,s))return a;if(s.subject.withPlaceholder)return a;const l=_n(s,e,t);return Un(a,l)})({draggable:f,impact:h,previousImpact:e.impact,draggables:s.draggables,droppables:s.droppables});return{...e,current:p,dimensions:{draggables:s.draggables,droppables:g},impact:h,viewport:o,scrollJumpRequest:a||null,forceShouldAnimate:!a&&null}};var Gn=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:i})=>{const a=e.displaced,o=function(e,t){return e.map((e=>t[e]))}(a.all,r),s=cn({afterDragging:o,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:a});return{...e,displaced:s}},Wn=({impact:e,draggable:t,droppable:r,draggables:n,viewport:i,afterCritical:a})=>{const o=En({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:a});return wn({pageBorderBoxCenter:o,draggable:t,viewport:i})},Xn=({state:e,dimensions:t,viewport:r})=>{"SNAP"!==e.movementMode&&xr();const n=e.impact,i=r||e.viewport,a=t||e.dimensions,{draggables:o,droppables:s}=a,l=o[e.critical.draggable.id],c=Dn(n);c||xr();const u=s[c],d=Gn({impact:n,viewport:i,destination:u,draggables:o}),p=Wn({impact:d,draggable:l,droppable:u,draggables:o,viewport:i,afterCritical:e.afterCritical});return qn({impact:d,clientSelection:p,state:e,dimensions:a,viewport:i})},zn=({draggable:e,home:t,draggables:r,viewport:n})=>{const i=Ln(t.axis,e.displaceBy),a=Xr(t.descriptor.id,r),o=a.indexOf(e);-1===o&&xr();const s=a.slice(o+1),l=s.reduce(((e,t)=>(e[t.descriptor.id]=!0,e)),{}),c={inVirtualList:"virtual"===t.descriptor.mode,displacedBy:i,effected:l};var u;return{impact:{displaced:cn({afterDragging:s,destination:t,displacedBy:i,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:(u=e.descriptor,{index:u.index,droppableId:u.droppableId})}},afterCritical:c}};const Hn=e=>{0},Yn=e=>{0};var Kn=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map((e=>{const i=e.descriptor.droppableId,a=(e=>{const t=e.frame;return t||xr(),t})(t[i]),o=a.scroll.diff.value,s=(({draggable:e,offset:t,initialWindowScroll:r})=>{const n=lr(e.client,t),i=cr(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:i}})({draggable:e,offset:Lr(n,o),initialWindowScroll:r.scroll.initial});return s}))};const Zn=e=>"SNAP"===e.movementMode,Jn=(e,t,r)=>{const n=((e,t)=>({draggables:e.draggables,droppables:Un(e.droppables,t)}))(e.dimensions,t);return!Zn(e)||r?qn({state:e,dimensions:n}):Xn({state:e,dimensions:n})};function ei(e){return e.isDragging&&"SNAP"===e.movementMode?{...e,scrollJumpRequest:null}:e}const ti={phase:"IDLE",completed:null,shouldFlush:!1};var ri=(e=ti,t)=>{if("FLUSH"===t.type)return{...ti,shouldFlush:!0};if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&xr();const{critical:r,clientSelection:n,viewport:i,dimensions:a,movementMode:o}=t.payload,s=a.draggables[r.draggable.id],l=a.droppables[r.droppable.id],c={selection:n,borderBoxCenter:s.client.borderBox.center,offset:Ar},u={client:c,page:{selection:Lr(c.selection,i.scroll.initial),borderBoxCenter:Lr(c.selection,i.scroll.initial),offset:Lr(c.selection,i.scroll.diff.value)}},d=Gr(a.droppables).every((e=>!e.isFixedOnPage)),{impact:p,afterCritical:f}=zn({draggable:s,home:l,draggables:a.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:o,dimensions:a,initial:u,current:u,isWindowScrollAllowed:d,impact:p,afterCritical:f,onLiftImpact:p,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if("COLLECTION_STARTING"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&xr();return{...e,phase:"COLLECTING"}}if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&xr(),(({state:e,published:t})=>{Hn();const r=t.modified.map((t=>{const r=e.dimensions.droppables[t.droppableId];return Ur(r,t.scroll)})),n={...e.dimensions.droppables,...Vr(r)},i=qr(Kn({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),a={...e.dimensions.draggables,...i};t.removals.forEach((e=>{delete a[e]}));const o={droppables:n,draggables:a},s=Dn(e.impact),l=s?o.droppables[s]:null,c=o.draggables[e.critical.draggable.id],u=o.droppables[e.critical.droppable.id],{impact:d,afterCritical:p}=zn({draggable:c,home:u,draggables:a,viewport:e.viewport}),f=l&&l.isCombineEnabled?e.impact:d,h=Qn({pageOffset:e.current.page.offset,draggable:o.draggables[e.critical.draggable.id],draggables:o.draggables,droppables:o.droppables,previousImpact:f,viewport:e.viewport,afterCritical:p});Yn();const g={...e,phase:"DRAGGING",impact:h,onLiftImpact:d,dimensions:o,afterCritical:p,forceShouldAnimate:!1};return"COLLECTING"===e.phase?g:{...g,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}})({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;$n(e)||xr();const{client:r}=t.payload;return _r(r,e.current.client.selection)?e:qn({state:e,clientSelection:r,impact:Zn(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return ei(e);if("COLLECTING"===e.phase)return ei(e);$n(e)||xr();const{id:r,newScroll:n}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const a=Ur(i,n);return Jn(e,a,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;$n(e)||xr();const{id:r,isEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||xr(),i.isEnabled===n&&xr();const a={...i,isEnabled:n};return Jn(e,a,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;$n(e)||xr();const{id:r,isCombineEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||xr(),i.isCombineEnabled===n&&xr();const a={...i,isCombineEnabled:n};return Jn(e,a,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;$n(e)||xr(),e.isWindowScrollAllowed||xr();const r=t.payload.newScroll;if(_r(e.viewport.scroll.current,r))return ei(e);const n=xn(e.viewport,r);return Zn(e)?Xn({state:e,viewport:n}):qn({state:e,viewport:n})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!$n(e))return e;const r=t.payload.maxScroll;if(_r(r,e.viewport.scroll.max))return e;const n={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:n}}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&xr();const r=kn({state:e,type:t.type});return r?qn({state:e,impact:r.impact,clientSelection:r.clientSelection,scrollJumpRequest:r.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){const r=t.payload.reason;"COLLECTING"!==e.phase&&xr();return{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if("DROP_ANIMATE"===t.type){const{completed:r,dropDuration:n,newHomeClientOffset:i}=t.payload;"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&xr();return{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:i,dimensions:e.dimensions}}if("DROP_COMPLETE"===t.type){const{completed:e}=t.payload;return{phase:"IDLE",completed:e,shouldFlush:!1}}return e};function ni(e,t){return e instanceof Object&&"type"in e&&e.type===t}const ii=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),ai=()=>({type:"COLLECTION_STARTING",payload:null}),oi=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),si=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),li=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),ci=e=>({type:"MOVE",payload:e}),ui=()=>({type:"MOVE_UP",payload:null}),di=()=>({type:"MOVE_DOWN",payload:null}),pi=()=>({type:"MOVE_RIGHT",payload:null}),fi=()=>({type:"MOVE_LEFT",payload:null}),hi=e=>({type:"DROP_COMPLETE",payload:e}),gi=e=>({type:"DROP",payload:e}),mi=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});const bi="cubic-bezier(.2,1,.1,1)",vi={drop:0,combining:.7},yi={drop:.75},Oi={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Ei=`${Oi.outOfTheWay}s ${"cubic-bezier(0.2, 0, 0, 1)"}`,xi={fluid:`opacity ${Ei}`,snap:`transform ${Ei}, opacity ${Ei}`,drop:e=>{const t=`${e}s ${bi}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Ei}`,placeholder:`height ${Ei}, width ${Ei}, margin ${Ei}`},Si=e=>_r(e,Ar)?void 0:`translate(${e.x}px, ${e.y}px)`,wi=Si,Ti=(e,t)=>{const r=Si(e);if(r)return t?`${r} scale(${yi.drop})`:r},{minDropTime:Ri,maxDropTime:Pi}=Oi,Ii=Pi-Ri;const Ai=({getState:e,dispatch:t})=>r=>n=>{if(!ni(n,"DROP"))return void r(n);const i=e(),a=n.payload.reason;if("COLLECTING"===i.phase)return void t((e=>({type:"DROP_PENDING",payload:e}))({reason:a}));if("IDLE"===i.phase)return;"DROP_PENDING"===i.phase&&i.isWaiting&&xr(),"DRAGGING"!==i.phase&&"DROP_PENDING"!==i.phase&&xr();const o=i.critical,s=i.dimensions,l=s.draggables[i.critical.draggable.id],{impact:c,didDropInsideDroppable:u}=(({draggables:e,reason:t,lastImpact:r,home:n,viewport:i,onLiftImpact:a})=>{if(!r.at||"DROP"!==t)return{impact:Gn({draggables:e,impact:a,destination:n,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1};return"REORDER"===r.at.type?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:Jr},didDropInsideDroppable:!0}})({reason:a,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),d=u?zr(c):null,p=u?Hr(c):null,f={index:o.draggable.index,droppableId:o.droppable.id},h={draggableId:l.descriptor.id,type:l.descriptor.type,source:f,reason:a,mode:i.movementMode,destination:d,combine:p},g=(({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:i})=>{const{draggables:a,droppables:o}=r,s=Dn(e),l=s?o[s]:null,c=o[t.descriptor.droppableId],u=Wn({impact:e,draggable:t,draggables:a,afterCritical:i,droppable:l||c,viewport:n});return Cr(u,t.client.borderBox.center)})({impact:c,draggable:l,dimensions:s,viewport:i.viewport,afterCritical:i.afterCritical}),m={critical:i.critical,afterCritical:i.afterCritical,result:h,impact:c};if(!(!_r(i.current.client.offset,g)||Boolean(h.combine)))return void t(hi({completed:m}));const b=(({current:e,destination:t,reason:r})=>{const n=kr(e,t);if(n<=0)return Ri;if(n>=1500)return Pi;const i=Ri+Ii*(n/1500);return Number(("CANCEL"===r?.6*i:i).toFixed(2))})({current:i.current.client.offset,destination:g,reason:a});t((e=>({type:"DROP_ANIMATE",payload:e}))({newHomeClientOffset:g,dropDuration:b,completed:m}))};var Li=()=>({x:window.pageXOffset,y:window.pageYOffset});function Ci({onWindowScroll:e}){const t=gr((function(){e(Li())})),r=function(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}(t);let n=vr;function i(){return n!==vr}return{start:function(){i()&&xr(),n=yr(window,[r])},stop:function(){i()||xr(),t.cancel(),n(),n=vr},isActive:i}}const _i=e=>{const t=Ci({onWindowScroll:t=>{e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return e=>r=>{!t.isActive()&&ni(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&(e=>ni(e,"DROP_COMPLETE")||ni(e,"DROP_ANIMATE")||ni(e,"FLUSH"))(r)&&t.stop(),e(r)}};var Ni=()=>{const e=[];return{add:t=>{const r=setTimeout((()=>(t=>{const r=e.findIndex((e=>e.timerId===t));-1===r&&xr();const[n]=e.splice(r,1);n.callback()})(r))),n={timerId:r,callback:t};e.push(n)},flush:()=>{if(!e.length)return;const t=[...e];e.length=0,t.forEach((e=>{clearTimeout(e.timerId),e.callback()}))}}};const Di=(e,t)=>{Hn(),t(),Yn()},ki=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function $i(e,t,r,n){if(!e)return void r(n(t));const i=(e=>{let t=!1,r=!1;const n=setTimeout((()=>{r=!0})),i=i=>{t||r||(t=!0,e(i),clearTimeout(n))};return i.wasCalled=()=>t,i})(r);e(t,{announce:i}),i.wasCalled()||r(n(t))}var ji=(e,t)=>{const r=((e,t)=>{const r=Ni();let n=null;const i=r=>{n||xr(),n=null,Di(0,(()=>$i(e().onDragEnd,r,t,Ir.onDragEnd)))};return{beforeCapture:(t,r)=>{n&&xr(),Di(0,(()=>{const n=e().onBeforeCapture;n&&n({draggableId:t,mode:r})}))},beforeStart:(t,r)=>{n&&xr(),Di(0,(()=>{const n=e().onBeforeDragStart;n&&n(ki(t,r))}))},start:(i,a)=>{n&&xr();const o=ki(i,a);n={mode:a,lastCritical:i,lastLocation:o.source,lastCombine:null},r.add((()=>{Di(0,(()=>$i(e().onDragStart,o,t,Ir.onDragStart)))}))},update:(i,a)=>{const o=zr(a),s=Hr(a);n||xr();const l=!((e,t)=>{if(e===t)return!0;const r=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&n})(i,n.lastCritical);l&&(n.lastCritical=i);const c=(d=o,!(null==(u=n.lastLocation)&&null==d||null!=u&&null!=d&&u.droppableId===d.droppableId&&u.index===d.index));var u,d;c&&(n.lastLocation=o);const p=!((e,t)=>null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId)(n.lastCombine,s);if(p&&(n.lastCombine=s),!l&&!c&&!p)return;const f={...ki(i,n.mode),combine:s,destination:o};r.add((()=>{Di(0,(()=>$i(e().onDragUpdate,f,t,Ir.onDragUpdate)))}))},flush:()=>{n||xr(),r.flush()},drop:i,abort:()=>{if(!n)return;const e={...ki(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};i(e)}}})(e,t);return e=>t=>n=>{if(ni(n,"BEFORE_INITIAL_CAPTURE"))return void r.beforeCapture(n.payload.draggableId,n.payload.movementMode);if(ni(n,"INITIAL_PUBLISH")){const e=n.payload.critical;return r.beforeStart(e,n.payload.movementMode),t(n),void r.start(e,n.payload.movementMode)}if(ni(n,"DROP_COMPLETE")){const e=n.payload.completed.result;return r.flush(),t(n),void r.drop(e)}if(t(n),ni(n,"FLUSH"))return void r.abort();const i=e.getState();"DRAGGING"===i.phase&&r.update(i.critical,i.impact)}};const Fi=e=>t=>r=>{if(!ni(r,"DROP_ANIMATION_FINISHED"))return void t(r);const n=e.getState();"DROP_ANIMATING"!==n.phase&&xr(),e.dispatch(hi({completed:n.completed}))},Mi=e=>{let t=null,r=null;return n=>i=>{if((ni(i,"FLUSH")||ni(i,"DROP_COMPLETE")||ni(i,"DROP_ANIMATION_FINISHED"))&&(r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)),n(i),!ni(i,"DROP_ANIMATE"))return;const a={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){"DROP_ANIMATING"===e.getState().phase&&e.dispatch({type:"DROP_ANIMATION_FINISHED",payload:null})}};r=requestAnimationFrame((()=>{r=null,t=yr(window,[a])}))}};var Bi=e=>t=>r=>n=>{if((e=>ni(e,"DROP_COMPLETE")||ni(e,"DROP_ANIMATE")||ni(e,"FLUSH"))(n))return e.stop(),void r(n);if(ni(n,"INITIAL_PUBLISH")){r(n);const i=t.getState();return"DRAGGING"!==i.phase&&xr(),void e.start(i)}r(n),e.scroll(t.getState())};const Qi=e=>t=>r=>{if(t(r),!ni(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();"DROP_PENDING"===n.phase&&(n.isWaiting||e.dispatch(gi({reason:n.reason})))},Ui=Se.compose;var Vi=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:i,autoScroller:a})=>{return(0,Se.createStore)(ri,Ui((0,Se.applyMiddleware)((o=r,()=>e=>t=>{ni(t,"INITIAL_PUBLISH")&&o.dragging(),ni(t,"DROP_ANIMATE")&&o.dropping(t.payload.completed.result.reason),(ni(t,"FLUSH")||ni(t,"DROP_COMPLETE"))&&o.resting(),e(t)}),(e=>()=>t=>r=>{(ni(r,"DROP_COMPLETE")||ni(r,"FLUSH")||ni(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)})(e),(e=>({getState:t,dispatch:r})=>n=>i=>{if(!ni(i,"LIFT"))return void n(i);const{id:a,clientSelection:o,movementMode:s}=i.payload,l=t();"DROP_ANIMATING"===l.phase&&r(hi({completed:l.completed})),"IDLE"!==t().phase&&xr(),r({type:"FLUSH",payload:null}),r({type:"BEFORE_INITIAL_CAPTURE",payload:{draggableId:a,movementMode:s}});const c={draggableId:a,scrollOptions:{shouldPublishImmediately:"SNAP"===s}},{critical:u,dimensions:d,viewport:p}=e.startPublishing(c);r({type:"INITIAL_PUBLISH",payload:{critical:u,dimensions:d,clientSelection:o,movementMode:s,viewport:p}})})(e),Ai,Fi,Mi,Qi,Bi(a),_i,(e=>{let t=!1;return()=>r=>n=>{if(ni(n,"INITIAL_PUBLISH"))return t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),void e.tryRestoreFocusRecorded();if(r(n),t){if(ni(n,"FLUSH"))return t=!1,void e.tryRestoreFocusRecorded();if(ni(n,"DROP_COMPLETE")){t=!1;const r=n.payload.completed.result;r.combine&&e.tryShiftRecord(r.draggableId,r.combine.draggableId),e.tryRestoreFocusRecorded()}}}})(t),ji(n,i))));var o};var qi=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const i=Cr({x:t,y:e},{x:n,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},Gi=()=>{const e=document.documentElement;return e||xr(),e},Wi=()=>{const e=Gi();return qi({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},Xi=({critical:e,scrollOptions:t,registry:r})=>{Hn();const n=(()=>{const e=Li(),t=Wi(),r=e.y,n=e.x,i=Gi(),a=i.clientWidth,o=i.clientHeight;return{frame:rr({top:r,left:n,right:n+a,bottom:r+o}),scroll:{initial:e,current:e,max:t,diff:{value:Ar,displacement:Ar}}}})(),i=n.scroll.current,a=e.droppable,o=r.droppable.getAllByType(a.type).map((e=>e.callbacks.getDimensionAndWatchScroll(i,t))),s=r.draggable.getAllByType(e.draggable.type).map((e=>e.getDimension(i))),l={draggables:qr(s),droppables:Vr(o)};Yn();return{dimensions:l,critical:e,viewport:n}};function zi(e,t,r){if(r.descriptor.id===t.id)return!1;if(r.descriptor.type!==t.type)return!1;return"virtual"===e.droppable.getById(r.descriptor.droppableId).descriptor.mode}var Hi=(e,t)=>{let r=null;const n=function({registry:e,callbacks:t}){let r={additions:{},removals:{},modified:{}},n=null;const i=()=>{n||(t.collectionStarting(),n=requestAnimationFrame((()=>{n=null,Hn();const{additions:i,removals:a,modified:o}=r,s=Object.keys(i).map((t=>e.draggable.getById(t).getDimension(Ar))).sort(((e,t)=>e.descriptor.index-t.descriptor.index)),l=Object.keys(o).map((t=>({droppableId:t,scroll:e.droppable.getById(t).callbacks.getScrollWhileDragging()}))),c={additions:s,removals:Object.keys(a),modified:l};r={additions:{},removals:{},modified:{}},Yn(),t.publish(c)})))};return{add:e=>{const t=e.descriptor.id;r.additions[t]=e,r.modified[e.descriptor.droppableId]=!0,r.removals[t]&&delete r.removals[t],i()},remove:e=>{const t=e.descriptor;r.removals[t.id]=!0,r.modified[t.droppableId]=!0,r.additions[t.id]&&delete r.additions[t.id],i()},stop:()=>{n&&(cancelAnimationFrame(n),n=null,r={additions:{},removals:{},modified:{}})}}}({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=t=>{r||xr();const i=r.critical.draggable;"ADDITION"===t.type&&zi(e,i,t.value)&&n.add(t.value),"REMOVAL"===t.type&&zi(e,i,t.value)&&n.remove(t.value)},a={updateDroppableIsEnabled:(n,i)=>{e.droppable.exists(n)||xr(),r&&t.updateDroppableIsEnabled({id:n,isEnabled:i})},updateDroppableIsCombineEnabled:(n,i)=>{r&&(e.droppable.exists(n)||xr(),t.updateDroppableIsCombineEnabled({id:n,isCombineEnabled:i}))},scrollDroppable:(t,n)=>{r&&e.droppable.getById(t).callbacks.scroll(n)},updateDroppableScroll:(n,i)=>{r&&(e.droppable.exists(n)||xr(),t.updateDroppableScroll({id:n,newScroll:i}))},startPublishing:t=>{r&&xr();const n=e.draggable.getById(t.draggableId),a=e.droppable.getById(n.descriptor.droppableId),o={draggable:n.descriptor,droppable:a.descriptor},s=e.subscribe(i);return r={critical:o,unsubscribe:s},Xi({critical:o,registry:e,scrollOptions:t.scrollOptions})},stopPublishing:()=>{if(!r)return;n.stop();const t=r.critical.droppable;e.droppable.getAllByType(t.type).forEach((e=>e.callbacks.dragStopped())),r.unsubscribe(),r=null}};return a},Yi=(e,t)=>"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason),Ki=e=>{window.scrollBy(e.x,e.y)};const Zi=hr((e=>Gr(e).filter((e=>!!e.isEnabled&&!!e.frame))));var Ji=({center:e,destination:t,droppables:r})=>{if(t){const e=r[t];return e.frame?e:null}const n=((e,t)=>{const r=Zi(t).find((t=>(t.frame||xr(),jn(t.frame.pageMarginBox)(e))))||null;return r})(e,r);return n};const ea={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var ta=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;if(0===n)return 0;return(r-e)/n},ra=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:i})=>{const a=((e,t,r=()=>ea)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return 1;const i=1-ta({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),a=n.maxPixelScroll*n.ease(i);return Math.ceil(a)})(e,t,i);return 0===a?0:n?Math.max(((e,t,r)=>{const n=r(),i=n.durationDampening.accelerateAt,a=n.durationDampening.stopDampeningAt,o=t,s=a,l=Date.now()-o;if(l>=a)return e;if(l<i)return 1;const c=ta({startOfRange:i,endOfRange:s,current:l}),u=e*n.ease(c);return Math.ceil(u)})(a,r,i),1):a},na=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:i,getAutoScrollerOptions:a})=>{const o=((e,t,r=()=>ea)=>{const n=r();return{startScrollingFrom:e[t.size]*n.startFromPercentage,maxScrollValueAt:e[t.size]*n.maxScrollAtPercentage}})(e,n,a);return t[n.end]<t[n.start]?ra({distanceToEdge:t[n.end],thresholds:o,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:a}):-1*ra({distanceToEdge:t[n.start],thresholds:o,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:a})};const ia=jr((e=>0===e?0:e));var aa=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:a})=>{const o={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},s=na({container:t,distanceToEdges:o,dragStartTime:e,axis:an,shouldUseTimeDampening:i,getAutoScrollerOptions:a}),l=na({container:t,distanceToEdges:o,dragStartTime:e,axis:on,shouldUseTimeDampening:i,getAutoScrollerOptions:a}),c=ia({x:l,y:s});if(_r(c,Ar))return null;const u=(({container:e,subject:t,proposedScroll:r})=>{const n=t.height>e.height,i=t.width>e.width;return i||n?i&&n?null:{x:i?0:r.x,y:n?0:r.y}:r})({container:t,subject:r,proposedScroll:c});return u?_r(u,Ar)?null:u:null};const oa=jr((e=>0===e?0:e>0?1:-1)),sa=(()=>{const e=(e,t)=>e<0?e:e>t?e-t:0;return({current:t,max:r,change:n})=>{const i=Lr(t,n),a={x:e(i.x,r.x),y:e(i.y,r.y)};return _r(a,Ar)?null:a}})(),la=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=oa(r),a=sa({max:n,current:t,change:i});return!a||(0!==i.x&&0===a.x||0!==i.y&&0===a.y)},ca=(e,t)=>la({current:e.scroll.current,max:e.scroll.max,change:t}),ua=(e,t)=>{const r=e.frame;return!!r&&la({current:r.scroll.current,max:r.scroll.max,change:t})};var da=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:i,getAutoScrollerOptions:a})=>{const o=e.current.page.borderBoxCenter,s=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const i=(({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:a})=>{const o=aa({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:a});return o&&ca(e,o)?o:null})({dragStartTime:t,viewport:e.viewport,subject:s,center:o,shouldUseTimeDampening:r,getAutoScrollerOptions:a});if(i)return void n(i)}const l=Ji({center:o,destination:Dn(e.impact),droppables:e.dimensions.droppables});if(!l)return;const c=(({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:a})=>{const o=e.frame;if(!o)return null;const s=aa({dragStartTime:n,container:o.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:a});return s&&ua(e,s)?s:null})({dragStartTime:t,droppable:l,subject:s,center:o,shouldUseTimeDampening:r,getAutoScrollerOptions:a});c&&i(l.descriptor.id,c)},pa=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(e,r)=>{if(!ua(e,r))return r;const n=((e,t)=>{const r=e.frame;return r&&ua(e,t)?sa({current:r.scroll.current,max:r.scroll.max,change:t}):null})(e,r);if(!n)return t(e.descriptor.id,r),null;const i=Cr(r,n);t(e.descriptor.id,i);return Cr(r,i)},i=(e,t,n)=>{if(!e)return n;if(!ca(t,n))return n;const i=((e,t)=>{if(!ca(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return sa({current:n,max:r,change:t})})(t,n);if(!i)return r(n),null;const a=Cr(n,i);r(a);return Cr(n,a)};return t=>{const r=t.scrollJumpRequest;if(!r)return;const a=Dn(t.impact);a||xr();const o=n(t.dimensions.droppables[a],r);if(!o)return;const s=t.viewport,l=i(t.isWindowScrollAllowed,s,o);l&&((t,r)=>{const n=Lr(t.current.client.selection,r);e({client:n})})(t,l)}},fa=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const i=(({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>ea})=>{const n=gr(e),i=gr(t);let a=null;const o=e=>{a||xr();const{shouldUseTimeDampening:t,dragStartTime:o}=a;da({state:e,scrollWindow:n,scrollDroppable:i,dragStartTime:o,shouldUseTimeDampening:t,getAutoScrollerOptions:r})};return{start:e=>{Hn(),a&&xr();const t=Date.now();let n=!1;const i=()=>{n=!0};da({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:i,scrollDroppable:i,getAutoScrollerOptions:r}),a={dragStartTime:t,shouldUseTimeDampening:n},Yn(),n&&o(e)},stop:()=>{a&&(n.cancel(),i.cancel(),a=null)},scroll:o}})({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),a=pa({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:e=>{n().disabled||"DRAGGING"!==e.phase||("FLUID"!==e.movementMode?e.scrollJumpRequest&&a(e):i.scroll(e))},start:i.start,stop:i.stop}};const ha="data-rfd",ga=(()=>{const e=`${ha}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),ma=(()=>{const e=`${ha}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),ba=(()=>{const e=`${ha}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),va={contextId:`${ha}-scroll-container-context-id`},ya=(e,t)=>e.map((e=>{const r=e.styles[t];return r?`${e.selector} { ${r} }`:""})).join(" ");const Oa="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?s.useLayoutEffect:s.useEffect,Ea=()=>{const e=document.querySelector("head");return e||xr(),e},xa=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function Sa(e,t){const r=Jt((()=>(e=>{const t=(e=>t=>`[${t}="${e}"]`)(e),r=(()=>{const e="\n cursor: -webkit-grab;\n cursor: grab;\n ";return{selector:t(ga.contextId),styles:{always:"\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",resting:e,dragging:"pointer-events: none;",dropAnimating:e}}})(),n=[(()=>{const e=`\n transition: ${xi.outOfTheWay};\n `;return{selector:t(ma.contextId),styles:{dragging:e,dropAnimating:e,userCancel:e}}})(),r,{selector:t(ba.contextId),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n "}}];return{always:ya(n,"always"),resting:ya(n,"resting"),dragging:ya(n,"dragging"),dropAnimating:ya(n,"dropAnimating"),userCancel:ya(n,"userCancel")}})(e)),[e]),n=(0,s.useRef)(null),i=(0,s.useRef)(null),a=er(hr((e=>{const t=i.current;t||xr(),t.textContent=e})),[]),o=er((e=>{const t=n.current;t||xr(),t.textContent=e}),[]);Oa((()=>{(n.current||i.current)&&xr();const s=xa(t),l=xa(t);return n.current=s,i.current=l,s.setAttribute(`${ha}-always`,e),l.setAttribute(`${ha}-dynamic`,e),Ea().appendChild(s),Ea().appendChild(l),o(r.always),a(r.resting),()=>{const e=e=>{const t=e.current;t||xr(),Ea().removeChild(t),e.current=null};e(n),e(i)}}),[t,o,a,r.always,r.resting,e]);const l=er((()=>a(r.dragging)),[a,r.dragging]),c=er((e=>{a("DROP"!==e?r.userCancel:r.dropAnimating)}),[a,r.dropAnimating,r.userCancel]),u=er((()=>{i.current&&a(r.resting)}),[a,r.resting]);return Jt((()=>({dragging:l,dropping:c,resting:u})),[l,c,u])}function wa(e,t){return Array.from(e.querySelectorAll(t))}var Ta=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Ra(e){return e instanceof Ta(e).HTMLElement}function Pa(e,t){const r=`[${ga.contextId}="${e}"]`,n=wa(document,r);if(!n.length)return null;const i=n.find((e=>e.getAttribute(ga.draggableId)===t));return i&&Ra(i)?i:null}function Ia(){const e={draggables:{},droppables:{}},t=[];function r(e){t.length&&t.forEach((t=>t(e)))}function n(t){return e.draggables[t]||null}function i(t){return e.droppables[t]||null}return{draggable:{register:t=>{e.draggables[t.descriptor.id]=t,r({type:"ADDITION",value:t})},update:(t,r)=>{const n=e.draggables[r.descriptor.id];n&&n.uniqueId===t.uniqueId&&(delete e.draggables[r.descriptor.id],e.draggables[t.descriptor.id]=t)},unregister:t=>{const i=t.descriptor.id,a=n(i);a&&t.uniqueId===a.uniqueId&&(delete e.draggables[i],e.droppables[t.descriptor.droppableId]&&r({type:"REMOVAL",value:t}))},getById:function(e){const t=n(e);return t||xr(),t},findById:n,exists:e=>Boolean(n(e)),getAllByType:t=>Object.values(e.draggables).filter((e=>e.descriptor.type===t))},droppable:{register:t=>{e.droppables[t.descriptor.id]=t},unregister:t=>{const r=i(t.descriptor.id);r&&t.uniqueId===r.uniqueId&&delete e.droppables[t.descriptor.id]},getById:function(e){const t=i(e);return t||xr(),t},findById:i,exists:e=>Boolean(i(e)),getAllByType:t=>Object.values(e.droppables).filter((e=>e.descriptor.type===t))},subscribe:function(e){return t.push(e),function(){const r=t.indexOf(e);-1!==r&&t.splice(r,1)}},clean:function(){e.draggables={},e.droppables={},t.length=0}}}var Aa=l().createContext(null),La=()=>{const e=document.body;return e||xr(),e};const Ca={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"};const _a={separator:"::"};function Na(e,t=_a){const r=l().useId();return Jt((()=>`${e}${t.separator}${r}`),[t.separator,e,r])}var Da=l().createContext(null);function ka(e){0}function $a(e,t){ka()}function ja(){$a()}function Fa(e){const t=(0,s.useRef)(e);return(0,s.useEffect)((()=>{t.current=e})),t}function Ma(e){return"IDLE"!==e.phase&&"DROP_ANIMATING"!==e.phase&&e.isDragging}const Ba=9,Qa=13,Ua=33,Va=34,qa=35,Ga=36,Wa={[Qa]:!0,[Ba]:!0};var Xa=e=>{Wa[e.keyCode]&&e.preventDefault()};const za=(()=>{const e="visibilitychange";if("undefined"==typeof document)return e;return[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find((e=>`on${e}`in document))||e})();const Ha={type:"IDLE"};function Ya({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:e=>{const{button:t,clientX:i,clientY:a}=e;if(0!==t)return;const o={x:i,y:a},s=r();if("DRAGGING"===s.type)return e.preventDefault(),void s.actions.move(o);"PENDING"!==s.type&&xr();if(!function(e,t){return Math.abs(t.x-e.x)>=5||Math.abs(t.y-e.y)>=5}(s.point,o))return;e.preventDefault();const l=s.actions.fluidLift(o);n({type:"DRAGGING",actions:l})}},{eventName:"mouseup",fn:n=>{const i=r();"DRAGGING"===i.type?(n.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()):e()}},{eventName:"mousedown",fn:t=>{"DRAGGING"===r().type&&t.preventDefault(),e()}},{eventName:"keydown",fn:t=>{if("PENDING"!==r().type)return 27===t.keyCode?(t.preventDefault(),void e()):void Xa(t);e()}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{"PENDING"===r().type&&e()}},{eventName:"webkitmouseforcedown",fn:t=>{const n=r();"IDLE"===n.type&&xr(),n.actions.shouldRespectForcePress()?e():t.preventDefault()}},{eventName:za,fn:e}]}function Ka(){}const Za={[Va]:!0,[Ua]:!0,[Ga]:!0,[qa]:!0};function Ja(e,t){function r(){t(),e.cancel()}return[{eventName:"keydown",fn:n=>27===n.keyCode?(n.preventDefault(),void r()):32===n.keyCode?(n.preventDefault(),t(),void e.drop()):40===n.keyCode?(n.preventDefault(),void e.moveDown()):38===n.keyCode?(n.preventDefault(),void e.moveUp()):39===n.keyCode?(n.preventDefault(),void e.moveRight()):37===n.keyCode?(n.preventDefault(),void e.moveLeft()):void(Za[n.keyCode]?n.preventDefault():Xa(n))},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:za,fn:r}]}const eo={type:"IDLE"};const to=["input","button","textarea","select","option","optgroup","video","audio"];function ro(e,t){if(null==t)return!1;if(to.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return"true"===r||""===r||t!==e&&ro(e,t.parentElement)}function no(e,t){const r=t.target;return!!Ra(r)&&ro(e,r)}var io=e=>rr(e.getBoundingClientRect()).center;const ao=(()=>{const e="matches";if("undefined"==typeof document)return e;return[e,"msMatchesSelector","webkitMatchesSelector"].find((e=>e in Element.prototype))||e})();function oo(e,t){return null==e?null:e[ao](t)?e:oo(e.parentElement,t)}function so(e,t){return e.closest?e.closest(t):oo(e,t)}function lo(e,t){const r=t.target;if(!((n=r)instanceof Ta(n).Element))return null;var n;const i=function(e){return`[${ga.contextId}="${e}"]`}(e),a=so(r,i);return a&&Ra(a)?a:null}function co(e){e.preventDefault()}function uo({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!!r()&&e===t}function po({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const i=r.draggable.findById(n);return!!i&&(!!i.options.isEnabled&&!!Yi(t.getState(),n))}function fo({lockAPI:e,contextId:t,store:r,registry:n,draggableId:i,forceSensorStop:a,sourceEvent:o}){if(!po({lockAPI:e,store:r,registry:n,draggableId:i}))return null;const s=n.draggable.getById(i),l=function(e,t){const r=`[${ma.contextId}="${e}"]`,n=wa(document,r).find((e=>e.getAttribute(ma.id)===t));return n&&Ra(n)?n:null}(t,s.descriptor.id);if(!l)return null;if(o&&!s.options.canDragInteractiveElements&&no(l,o))return null;const c=e.claim(a||vr);let u="PRE_DRAG";function d(){return s.options.shouldRespectForcePress}function p(){return e.isActive(c)}const f=function(e,t){uo({expected:e,phase:u,isLockActive:p,shouldWarn:!0})&&r.dispatch(t())}.bind(null,"DRAGGING");function h(t){function n(){e.release(),u="COMPLETED"}function i(e,i={shouldBlockNextClick:!1}){if(t.cleanup(),i.shouldBlockNextClick){const e=yr(window,[{eventName:"click",fn:co,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(e)}n(),r.dispatch(gi({reason:e}))}return"PRE_DRAG"!==u&&(n(),xr()),r.dispatch((e=>({type:"LIFT",payload:e}))(t.liftActionArgs)),u="DRAGGING",{isActive:()=>uo({expected:"DRAGGING",phase:u,isLockActive:p,shouldWarn:!1}),shouldRespectForcePress:d,drop:e=>i("DROP",e),cancel:e=>i("CANCEL",e),...t.actions}}return{isActive:()=>uo({expected:"PRE_DRAG",phase:u,isLockActive:p,shouldWarn:!1}),shouldRespectForcePress:d,fluidLift:function(e){const t=gr((e=>{f((()=>ci({client:e})))}));return{...h({liftActionArgs:{id:i,clientSelection:e,movementMode:"FLUID"},cleanup:()=>t.cancel(),actions:{move:t}}),move:t}},snapLift:function(){const e={moveUp:()=>f(ui),moveRight:()=>f(pi),moveDown:()=>f(di),moveLeft:()=>f(fi)};return h({liftActionArgs:{id:i,clientSelection:io(l),movementMode:"SNAP"},cleanup:vr,actions:e})},abort:function(){uo({expected:"PRE_DRAG",phase:u,isLockActive:p,shouldWarn:!0})&&e.release()}}}const ho=[function(e){const t=(0,s.useRef)(Ha),r=(0,s.useRef)(vr),n=Jt((()=>({eventName:"mousedown",fn:function(t){if(t.defaultPrevented)return;if(0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;const n=e.findClosestDraggableId(t);if(!n)return;const i=e.tryGetLock(n,o,{sourceEvent:t});if(!i)return;t.preventDefault();const a={x:t.clientX,y:t.clientY};r.current(),u(i,a)}})),[e]),i=Jt((()=>({eventName:"webkitmouseforcewillbegin",fn:t=>{if(t.defaultPrevented)return;const r=e.findClosestDraggableId(t);if(!r)return;const n=e.findOptionsForDraggable(r);n&&(n.shouldRespectForcePress||e.canGetLock(r)&&t.preventDefault())}})),[e]),a=er((function(){r.current=yr(window,[i,n],{passive:!1,capture:!0})}),[i,n]),o=er((()=>{"IDLE"!==t.current.type&&(t.current=Ha,r.current(),a())}),[a]),l=er((()=>{const e=t.current;o(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[o]),c=er((function(){const e=Ya({cancel:l,completed:o,getPhase:()=>t.current,setPhase:e=>{t.current=e}});r.current=yr(window,e,{capture:!0,passive:!1})}),[l,o]),u=er((function(e,r){"IDLE"!==t.current.type&&xr(),t.current={type:"PENDING",point:r,actions:e},c()}),[c]);Oa((function(){return a(),function(){r.current()}}),[a])},function(e){const t=(0,s.useRef)(Ka),r=Jt((()=>({eventName:"keydown",fn:function(r){if(r.defaultPrevented)return;if(32!==r.keyCode)return;const i=e.findClosestDraggableId(r);if(!i)return;const a=e.tryGetLock(i,l,{sourceEvent:r});if(!a)return;r.preventDefault();let o=!0;const s=a.snapLift();function l(){o||xr(),o=!1,t.current(),n()}t.current(),t.current=yr(window,Ja(s,l),{capture:!0,passive:!1})}})),[e]),n=er((function(){t.current=yr(window,[r],{passive:!1,capture:!0})}),[r]);Oa((function(){return n(),function(){t.current()}}),[n])},function(e){const t=(0,s.useRef)(eo),r=(0,s.useRef)(vr),n=er((function(){return t.current}),[]),i=er((function(e){t.current=e}),[]),a=Jt((()=>({eventName:"touchstart",fn:function(t){if(t.defaultPrevented)return;const n=e.findClosestDraggableId(t);if(!n)return;const i=e.tryGetLock(n,l,{sourceEvent:t});if(!i)return;const a=t.touches[0],{clientX:o,clientY:s}=a,c={x:o,y:s};r.current(),p(i,c)}})),[e]),o=er((function(){r.current=yr(window,[a],{capture:!0,passive:!1})}),[a]),l=er((()=>{const e=t.current;"IDLE"!==e.type&&("PENDING"===e.type&&clearTimeout(e.longPressTimerId),i(eo),r.current(),o())}),[o,i]),c=er((()=>{const e=t.current;l(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[l]),u=er((function(){const e={capture:!0,passive:!1},t={cancel:c,completed:l,getPhase:n},i=yr(window,function({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:t=>{const n=r();if("DRAGGING"!==n.type)return void e();n.hasMoved=!0;const{clientX:i,clientY:a}=t.touches[0],o={x:i,y:a};t.preventDefault(),n.actions.move(o)}},{eventName:"touchend",fn:n=>{const i=r();"DRAGGING"===i.type?(n.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()):e()}},{eventName:"touchcancel",fn:t=>{"DRAGGING"===r().type?(t.preventDefault(),e()):e()}},{eventName:"touchforcechange",fn:t=>{const n=r();"IDLE"===n.type&&xr();const i=t.touches[0];if(!i)return;if(!(i.force>=.15))return;const a=n.actions.shouldRespectForcePress();if("PENDING"!==n.type)return a?n.hasMoved?void t.preventDefault():void e():void t.preventDefault();a&&e()}},{eventName:za,fn:e}]}(t),e),a=yr(window,function({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:e=>{e.preventDefault()}},{eventName:"keydown",fn:r=>{"DRAGGING"===t().type?(27===r.keyCode&&r.preventDefault(),e()):e()}},{eventName:za,fn:e}]}(t),e);r.current=function(){i(),a()}}),[c,n,l]),d=er((function(){const e=n();"PENDING"!==e.type&&xr();const t=e.actions.fluidLift(e.point);i({type:"DRAGGING",actions:t,hasMoved:!1})}),[n,i]),p=er((function(e,t){"IDLE"!==n().type&&xr();const r=setTimeout(d,120);i({type:"PENDING",point:t,actions:e,longPressTimerId:r}),u()}),[u,n,i,d]);Oa((function(){return o(),function(){r.current();const e=n();"PENDING"===e.type&&(clearTimeout(e.longPressTimerId),i(eo))}}),[n,o,i]),Oa((function(){return yr(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])}),[])}];function go({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:i}){const a=[...i?ho:[],...n||[]],o=(0,s.useState)((()=>function(){let e=null;function t(){e||xr(),e=null}return{isClaimed:function(){return Boolean(e)},isActive:function(t){return t===e},claim:function(t){e&&xr();const r={abandon:t};return e=r,r},release:t,tryAbandon:function(){e&&(e.abandon(),t())}}}()))[0],l=er((function(e,t){Ma(e)&&!Ma(t)&&o.tryAbandon()}),[o]);Oa((function(){let e=t.getState();return t.subscribe((()=>{const r=t.getState();l(e,r),e=r}))}),[o,t,l]),Oa((()=>o.tryAbandon),[o.tryAbandon]);const c=er((e=>po({lockAPI:o,registry:r,store:t,draggableId:e})),[o,r,t]),u=er(((n,i,a)=>fo({lockAPI:o,registry:r,contextId:e,store:t,draggableId:n,forceSensorStop:i||null,sourceEvent:a&&a.sourceEvent?a.sourceEvent:null})),[e,o,r,t]),d=er((t=>function(e,t){const r=lo(e,t);return r?r.getAttribute(ga.draggableId):null}(e,t)),[e]),p=er((e=>{const t=r.draggable.findById(e);return t?t.options:null}),[r.draggable]),f=er((function(){o.isClaimed()&&(o.tryAbandon(),"IDLE"!==t.getState().phase&&t.dispatch({type:"FLUSH",payload:null}))}),[o,t]),h=er((()=>o.isClaimed()),[o]),g=Jt((()=>({canGetLock:c,tryGetLock:u,findClosestDraggableId:d,findOptionsForDraggable:p,tryReleaseLock:f,isLockClaimed:h})),[c,u,d,p,f,h]);ka();for(let e=0;e<a.length;e++)a[e](g)}function mo(e){return e.current||xr(),e.current}function bo(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:i,dragHandleUsageInstructions:a}=e,o=(0,s.useRef)(null);ja();const c=Fa(e),u=er((()=>(e=>({onBeforeCapture:t=>{(0,Ht.flushSync)((()=>{e.onBeforeCapture&&e.onBeforeCapture(t)}))},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}))(c.current)),[c]),d=er((()=>(e=>({...ea,...e.autoScrollerOptions,durationDampening:{...ea.durationDampening,...e.autoScrollerOptions}}))(c.current)),[c]),p=function(e){const t=Jt((()=>(e=>`rfd-announcement-${e}`)(e)),[e]),r=(0,s.useRef)(null);return(0,s.useEffect)((function(){const e=document.createElement("div");return r.current=e,e.id=t,e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),mr(e.style,Ca),La().appendChild(e),function(){setTimeout((function(){const t=La();t.contains(e)&&t.removeChild(e),e===r.current&&(r.current=null)}))}}),[t]),er((e=>{const t=r.current;t&&(t.textContent=e)}),[])}(t),f=function({contextId:e,text:t}){const r=Na("hidden-text",{separator:"-"}),n=Jt((()=>function({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}({contextId:e,uniqueId:r})),[r,e]);return(0,s.useEffect)((function(){const e=document.createElement("div");return e.id=n,e.textContent=t,e.style.display="none",La().appendChild(e),function(){const t=La();t.contains(e)&&t.removeChild(e)}}),[n,t]),n}({contextId:t,text:a}),h=Sa(t,i),g=er((e=>{mo(o).dispatch(e)}),[]),m=Jt((()=>(0,Se.bindActionCreators)({publishWhileDragging:ii,updateDroppableScroll:oi,updateDroppableIsEnabled:si,updateDroppableIsCombineEnabled:li,collectionStarting:ai},g)),[g]),b=function(){const e=Jt(Ia,[]);return(0,s.useEffect)((()=>function(){e.clean()}),[e]),e}(),v=Jt((()=>Hi(b,m)),[b,m]),y=Jt((()=>fa({scrollWindow:Ki,scrollDroppable:v.scrollDroppable,getAutoScrollerOptions:d,...(0,Se.bindActionCreators)({move:ci},g)})),[v.scrollDroppable,g,d]),O=function(e){const t=(0,s.useRef)({}),r=(0,s.useRef)(null),n=(0,s.useRef)(null),i=(0,s.useRef)(!1),a=er((function(e,r){const n={id:e,focus:r};return t.current[e]=n,function(){const r=t.current;r[e]!==n&&delete r[e]}}),[]),o=er((function(t){const r=Pa(e,t);r&&r!==document.activeElement&&r.focus()}),[e]),l=er((function(e,t){r.current===e&&(r.current=t)}),[]),c=er((function(){n.current||i.current&&(n.current=requestAnimationFrame((()=>{n.current=null;const e=r.current;e&&o(e)})))}),[o]),u=er((function(e){r.current=null;const t=document.activeElement;t&&t.getAttribute(ga.draggableId)===e&&(r.current=e)}),[]);return Oa((()=>(i.current=!0,function(){i.current=!1;const e=n.current;e&&cancelAnimationFrame(e)})),[]),Jt((()=>({register:a,tryRecordFocus:u,tryRestoreFocusRecorded:c,tryShiftRecord:l})),[a,u,c,l])}(t),E=Jt((()=>Vi({announce:p,autoScroller:y,dimensionMarshal:v,focusMarshal:O,getResponders:u,styleMarshal:h})),[p,y,v,O,u,h]);o.current=E;const x=er((()=>{const e=mo(o);"IDLE"!==e.getState().phase&&e.dispatch({type:"FLUSH",payload:null})}),[]),S=er((()=>{const e=mo(o).getState();return"DROP_ANIMATING"===e.phase||"IDLE"!==e.phase&&e.isDragging}),[]);r(Jt((()=>({isDragging:S,tryAbort:x})),[S,x]));const w=er((e=>Yi(mo(o).getState(),e)),[]),T=er((()=>$n(mo(o).getState())),[]),R=Jt((()=>({marshal:v,focus:O,contextId:t,canLift:w,isMovementAllowed:T,dragHandleUsageInstructionsId:f,registry:b})),[t,v,f,O,w,T,b]);return go({contextId:t,store:E,registry:b,customSensors:n||null,enableDefaultSensors:!1!==e.enableDefaultSensors}),(0,s.useEffect)((()=>x),[x]),l().createElement(Da.Provider,{value:R},l().createElement(Kt.Provider,{context:Aa,store:E},e.children))}function vo(e){const t=l().useId(),r=e.dragHandleUsageInstructions||Ir.dragHandleUsageInstructions;return l().createElement(Sr,null,(n=>l().createElement(bo,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:r,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children)))}const yo=5e3,Oo=4500,Eo=(e,t)=>t?xi.drop(t.duration):e?xi.snap:xi.fluid,xo=(e,t)=>{if(e)return t?vi.drop:vi.combining};function So(e){return"DRAGGING"===e.type?function(e){const t=e.dimension.client,{offset:r,combineWith:n,dropping:i}=e,a=Boolean(n),o=(e=>null!=e.forceShouldAnimate?e.forceShouldAnimate:"SNAP"===e.mode)(e),s=Boolean(i),l=s?Ti(r,a):wi(r);return{position:"fixed",top:t.marginBox.top,left:t.marginBox.left,boxSizing:"border-box",width:t.borderBox.width,height:t.borderBox.height,transition:Eo(o,i),transform:l,opacity:xo(a,s),zIndex:s?Oo:yo,pointerEvents:"none"}}(e):{transform:wi((t=e).offset),transition:t.shouldAnimateDisplacement?void 0:"none"};var t}function wo(e){const t=Na("draggable"),{descriptor:r,registry:n,getDraggableRef:i,canDragInteractiveElements:a,shouldRespectForcePress:o,isEnabled:l}=e,c=Jt((()=>({canDragInteractiveElements:a,shouldRespectForcePress:o,isEnabled:l})),[a,l,o]),u=er((e=>{const t=i();return t||xr(),function(e,t,r=Ar){const n=window.getComputedStyle(t),i=t.getBoundingClientRect(),a=ur(i,n),o=cr(a,r);return{descriptor:e,placeholder:{client:a,tagName:t.tagName.toLowerCase(),display:n.display},displaceBy:{x:a.marginBox.width,y:a.marginBox.height},client:a,page:o}}(r,t,e)}),[r,i]),d=Jt((()=>({uniqueId:t,descriptor:r,options:c,getDimension:u})),[r,u,c,t]),p=(0,s.useRef)(d),f=(0,s.useRef)(!0);Oa((()=>(n.draggable.register(p.current),()=>n.draggable.unregister(p.current))),[n.draggable]),Oa((()=>{if(f.current)return void(f.current=!1);const e=p.current;p.current=d,n.draggable.update(d,e)}),[d,n.draggable])}var To=l().createContext(null);function Ro(e){const t=(0,s.useContext)(e);return t||xr(),t}function Po(e){e.preventDefault()}var Io=(e,t)=>e===t,Ao=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};function Lo(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const Co={mapped:{type:"SECONDARY",offset:Ar,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Lo(null)}};const _o={dropAnimationFinished:mi},No=(0,Kt.connect)((()=>{const e=function(){const e=hr(((e,t)=>({x:e,y:t}))),t=hr(((e,t,r=null,n=null,i=null)=>({isDragging:!0,isClone:t,isDropAnimating:Boolean(i),dropAnimation:i,mode:e,draggingOver:r,combineWith:n,combineTargetFor:null}))),r=hr(((e,r,n,i,a=null,o=null,s=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:a,combineWith:o,mode:r,offset:e,dimension:n,forceShouldAnimate:s,snapshot:t(r,i,a,o,null)}})));return(n,i)=>{if(Ma(n)){if(n.critical.draggable.id!==i.draggableId)return null;const t=n.current.client.offset,o=n.dimensions.draggables[i.draggableId],s=Dn(n.impact),l=(a=n.impact).at&&"COMBINE"===a.at.type?a.at.combine.draggableId:null,c=n.forceShouldAnimate;return r(e(t.x,t.y),n.movementMode,o,i.isClone,s,l,c)}var a;if("DROP_ANIMATING"===n.phase){const e=n.completed;if(e.result.draggableId!==i.draggableId)return null;const r=i.isClone,a=n.dimensions.draggables[i.draggableId],o=e.result,s=o.mode,l=Ao(o),c=(e=>e.combine?e.combine.draggableId:null)(o),u={duration:n.dropDuration,curve:bi,moveTo:n.newHomeClientOffset,opacity:c?vi.drop:null,scale:c?yi.drop:null};return{mapped:{type:"DRAGGING",offset:n.newHomeClientOffset,dimension:a,dropping:u,draggingOver:l,combineWith:c,mode:s,forceShouldAnimate:null,snapshot:t(s,r,l,c,u)}}}return null}}(),t=function(){const e=hr(((e,t)=>({x:e,y:t}))),t=hr(Lo),r=hr(((e,r=null,n)=>({mapped:{type:"SECONDARY",offset:e,combineTargetFor:r,shouldAnimateDisplacement:n,snapshot:t(r)}}))),n=e=>e?r(Ar,e,!0):null,i=(t,i,a,o)=>{const s=a.displaced.visible[t],l=Boolean(o.inVirtualList&&o.effected[t]),c=Hr(a),u=c&&c.draggableId===t?i:null;if(!s){if(!l)return n(u);if(a.displaced.invisible[t])return null;const i=Nr(o.displacedBy.point),s=e(i.x,i.y);return r(s,u,!0)}if(l)return n(u);const d=a.displacedBy.point,p=e(d.x,d.y);return r(p,u,s.shouldAnimate)};return(e,t)=>{if(Ma(e))return e.critical.draggable.id===t.draggableId?null:i(t.draggableId,e.critical.draggable.id,e.impact,e.afterCritical);if("DROP_ANIMATING"===e.phase){const r=e.completed;return r.result.draggableId===t.draggableId?null:i(t.draggableId,r.result.draggableId,r.impact,r.afterCritical)}return null}}();return(r,n)=>e(r,n)||t(r,n)||Co}),_o,null,{context:Aa,areStatePropsEqual:Io})((e=>{const t=(0,s.useRef)(null),r=er(((e=null)=>{t.current=e}),[]),n=er((()=>t.current),[]),{contextId:i,dragHandleUsageInstructionsId:a,registry:o}=Ro(Da),{type:c,droppableId:u}=Ro(To),d=Jt((()=>({id:e.draggableId,index:e.index,type:c,droppableId:u})),[e.draggableId,e.index,c,u]),{children:p,draggableId:f,isEnabled:h,shouldRespectForcePress:g,canDragInteractiveElements:m,isClone:b,mapped:v,dropAnimationFinished:y}=e;if($a(),ka(),!b){wo(Jt((()=>({descriptor:d,registry:o,getDraggableRef:n,canDragInteractiveElements:m,shouldRespectForcePress:g,isEnabled:h})),[d,o,n,m,g,h]))}const O=Jt((()=>h?{tabIndex:0,role:"button","aria-describedby":a,"data-rfd-drag-handle-draggable-id":f,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:Po}:null),[i,a,f,h]),E=er((e=>{"DRAGGING"===v.type&&v.dropping&&"transform"===e.propertyName&&(0,Ht.flushSync)(y)}),[y,v]),x=Jt((()=>{const e=So(v),t="DRAGGING"===v.type&&v.dropping?E:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":f,style:e,onTransitionEnd:t},dragHandleProps:O}}),[i,O,f,v,E,r]),S=Jt((()=>({draggableId:d.id,type:d.type,source:{index:d.index,droppableId:d.droppableId}})),[d.droppableId,d.id,d.index,d.type]);return l().createElement(l().Fragment,null,p(x,v.snapshot,S))}));function Do(e){return Ro(To).isUsingCloneFor!==e.draggableId||e.isClone?l().createElement(No,e):null}function ko(e){const t="boolean"!=typeof e.isDragDisabled||!e.isDragDisabled,r=Boolean(e.disableInteractiveElementBlocking),n=Boolean(e.shouldRespectForcePress);return l().createElement(Do,mr({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const $o=e=>t=>e===t,jo=$o("scroll"),Fo=$o("auto"),Mo=($o("visible"),(e,t)=>t(e.overflowX)||t(e.overflowY)),Bo=e=>null==e||e===document.body||e===document.documentElement?null:(e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return Mo(r,jo)||Mo(r,Fo)})(e)?e:Bo(e.parentElement);var Qo=e=>({x:e.scrollLeft,y:e.scrollTop});const Uo=e=>{if(!e)return!1;return"fixed"===window.getComputedStyle(e).position||Uo(e.parentElement)};var Vo=({ref:e,descriptor:t,env:r,windowScroll:n,direction:i,isDropDisabled:a,isCombineEnabled:o,shouldClipSubject:s})=>{const l=r.closestScrollable,c=((e,t)=>{const r=dr(e);if(!t)return r;if(e!==t)return r;const n=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,a=n+t.scrollHeight,o=i+t.scrollWidth,s=nr({top:n,right:o,bottom:a,left:i},r.border);return or({borderBox:s,margin:r.margin,border:r.border,padding:r.padding})})(e,l),u=cr(c,n),d=(()=>{if(!l)return null;const e=dr(l),t={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:e,page:cr(e,n),scroll:Qo(l),scrollSize:t,shouldClipSubject:s}})(),p=(({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:i,client:a,page:o,closest:s})=>{const l=(()=>{if(!s)return null;const{scrollSize:e,client:t}=s,r=qi({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,height:t.paddingBox.height,width:t.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:t,scrollSize:e,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:r,diff:{value:Ar,displacement:Ar}}}})(),c="vertical"===i?an:on;return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:c,isEnabled:t,client:a,page:o,frame:l,subject:Qr({page:o,withPlaceholder:null,axis:c,frame:l})}})({descriptor:t,isEnabled:!a,isCombineEnabled:o,isFixedOnPage:r.isFixedOnPage,direction:i,client:c,page:u,closest:d});return p};const qo={passive:!1},Go={passive:!0};var Wo=e=>e.shouldPublishImmediately?qo:Go;const Xo=e=>e&&e.env.closestScrollable||null;function zo(e){const t=(0,s.useRef)(null),r=Ro(Da),n=Na("droppable"),{registry:i,marshal:a}=r,o=Fa(e),l=Jt((()=>({id:e.droppableId,type:e.type,mode:e.mode})),[e.droppableId,e.mode,e.type]),c=(0,s.useRef)(l),u=Jt((()=>hr(((e,r)=>{t.current||xr();const n={x:e,y:r};a.updateDroppableScroll(l.id,n)}))),[l.id,a]),d=er((()=>{const e=t.current;return e&&e.env.closestScrollable?Qo(e.env.closestScrollable):Ar}),[]),p=er((()=>{const e=d();u(e.x,e.y)}),[d,u]),f=Jt((()=>gr(p)),[p]),h=er((()=>{const e=t.current,r=Xo(e);e&&r||xr();e.scrollOptions.shouldPublishImmediately?p():f()}),[f,p]),g=er(((e,n)=>{t.current&&xr();const i=o.current,a=i.getDroppableRef();a||xr();const s=(e=>({closestScrollable:Bo(e),isFixedOnPage:Uo(e)}))(a),c={ref:a,descriptor:l,env:s,scrollOptions:n};t.current=c;const u=Vo({ref:a,descriptor:l,env:s,windowScroll:e,direction:i.direction,isDropDisabled:i.isDropDisabled,isCombineEnabled:i.isCombineEnabled,shouldClipSubject:!i.ignoreContainerClipping}),d=s.closestScrollable;return d&&(d.setAttribute(va.contextId,r.contextId),d.addEventListener("scroll",h,Wo(c.scrollOptions))),u}),[r.contextId,l,h,o]),m=er((()=>{const e=t.current,r=Xo(e);return e&&r||xr(),Qo(r)}),[]),b=er((()=>{const e=t.current;e||xr();const r=Xo(e);t.current=null,r&&(f.cancel(),r.removeAttribute(va.contextId),r.removeEventListener("scroll",h,Wo(e.scrollOptions)))}),[h,f]),v=er((e=>{const r=t.current;r||xr();const n=Xo(r);n||xr(),n.scrollTop+=e.y,n.scrollLeft+=e.x}),[]),y=Jt((()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:m,dragStopped:b,scroll:v})),[b,g,m,v]),O=Jt((()=>({uniqueId:n,descriptor:l,callbacks:y})),[y,l,n]);Oa((()=>(c.current=O.descriptor,i.droppable.register(O),()=>{t.current&&b(),i.droppable.unregister(O)})),[y,l,b,O,a,i.droppable]),Oa((()=>{t.current&&a.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)}),[e.isDropDisabled,a]),Oa((()=>{t.current&&a.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)}),[e.isCombineEnabled,a])}function Ho(){}const Yo={width:0,height:0,margin:{top:0,right:0,bottom:0,left:0}},Ko=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=(({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||"close"===r?Yo:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin})({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:n.width,height:n.height,marginTop:n.margin.top,marginRight:n.margin.right,marginBottom:n.margin.bottom,marginLeft:n.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:"none"!==r?xi.placeholder:null}};var Zo=l().memo((e=>{const t=(0,s.useRef)(null),r=er((()=>{t.current&&(clearTimeout(t.current),t.current=null)}),[]),{animate:n,onTransitionEnd:i,onClose:a,contextId:o}=e,[c,u]=(0,s.useState)("open"===e.animate);(0,s.useEffect)((()=>c?"open"!==n?(r(),u(!1),Ho):t.current?Ho:(t.current=setTimeout((()=>{t.current=null,u(!1)})),r):Ho),[n,c,r]);const d=er((e=>{"height"===e.propertyName&&(i(),"close"===n&&a())}),[n,a,i]),p=Ko({isAnimatingOpenOnMount:c,animate:e.animate,placeholder:e.placeholder});return l().createElement(e.placeholder.tagName,{style:p,"data-rfd-placeholder-context-id":o,onTransitionEnd:d,ref:e.innerRef})}));class Jo extends l().PureComponent{constructor(...e){super(...e),this.state={isVisible:Boolean(this.props.on),data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{"close"===this.state.animate&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,t){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:t.isVisible?{isVisible:!0,data:t.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(e.on),data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}}const es={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:function(){return document.body||xr(),document.body}},ts=e=>{let t,r={...e};for(t in es)void 0===e[t]&&(r={...r,[t]:es[t]});return r},rs=(e,t)=>e===t.droppable.type,ns=(e,t)=>t.draggables[e.draggable.id],is={updateViewportMaxScroll:e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e})},as=(0,Kt.connect)((()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=hr((e=>({draggableId:e.id,type:e.type,source:{index:e.index,droppableId:e.droppableId}}))),n=hr(((n,i,a,o,s,l)=>{const c=s.descriptor.id;if(s.descriptor.droppableId===n){const e=l?{render:l,dragging:r(s.descriptor)}:null,t={isDraggingOver:a,draggingOverWith:a?c:null,draggingFromThisWith:c,isUsingPlaceholder:!0};return{placeholder:s.placeholder,shouldAnimatePlaceholder:!1,snapshot:t,useClone:e}}if(!i)return t;if(!o)return e;const u={isDraggingOver:a,draggingOverWith:c,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:s.placeholder,shouldAnimatePlaceholder:!0,snapshot:u,useClone:null}}));return(r,i)=>{const a=ts(i),o=a.droppableId,s=a.type,l=!a.isDropDisabled,c=a.renderClone;if(Ma(r)){const e=r.critical;if(!rs(s,e))return t;const i=ns(e,r.dimensions),a=Dn(r.impact)===o;return n(o,l,a,a,i,c)}if("DROP_ANIMATING"===r.phase){const e=r.completed;if(!rs(s,e.critical))return t;const i=ns(e.critical,r.dimensions);return n(o,l,Ao(e.result)===o,Dn(e.impact)===o,i,c)}if("IDLE"===r.phase&&r.completed&&!r.shouldFlush){const n=r.completed;if(!rs(s,n.critical))return t;const i=Dn(n.impact)===o,a=Boolean(n.impact.at&&"COMBINE"===n.impact.at.type),l=n.critical.droppable.id===o;return i?a?e:t:l?e:t}return t}}),is,((e,t,r)=>({...ts(r),...e,...t})),{context:Aa,areStatePropsEqual:Io})((e=>{const t=(0,s.useContext)(Da);t||xr();const{contextId:r,isMovementAllowed:n}=t,i=(0,s.useRef)(null),a=(0,s.useRef)(null),{children:o,droppableId:c,type:u,mode:d,direction:p,ignoreContainerClipping:f,isDropDisabled:h,isCombineEnabled:g,snapshot:m,useClone:b,updateViewportMaxScroll:v,getContainerForClone:y}=e,O=er((()=>i.current),[]),E=er(((e=null)=>{i.current=e}),[]),x=(er((()=>a.current),[]),er(((e=null)=>{a.current=e}),[]));$a();const S=er((()=>{n()&&v({maxScroll:Wi()})}),[n,v]);zo({droppableId:c,type:u,mode:d,direction:p,isDropDisabled:h,isCombineEnabled:g,ignoreContainerClipping:f,getDroppableRef:O});const w=Jt((()=>l().createElement(Jo,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},(({onClose:e,data:t,animate:n})=>l().createElement(Zo,{placeholder:t,onClose:e,innerRef:x,animate:n,contextId:r,onTransitionEnd:S})))),[r,S,e.placeholder,e.shouldAnimatePlaceholder,x]),T=Jt((()=>({innerRef:E,placeholder:w,droppableProps:{"data-rfd-droppable-id":c,"data-rfd-droppable-context-id":r}})),[r,c,w,E]),R=b?b.dragging.draggableId:null,P=Jt((()=>({droppableId:c,type:u,isUsingCloneFor:R})),[c,R,u]);return l().createElement(To.Provider,{value:P},o(T,m),function(){if(!b)return null;const{dragging:e,render:t}=b,r=l().createElement(Do,{draggableId:e.draggableId,index:e.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},((r,n)=>t(r,n,e)));return Yt().createPortal(r,y())}())}));var os=as;function ss(){var e=(0,s.useRef)(!1),t=(0,s.useCallback)((function(){return e.current}),[]);return(0,s.useEffect)((function(){return e.current=!0,function(){e.current=!1}}),[]),t}function ls(){return ls=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ls.apply(null,arguments)}function cs(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function us(e){return e instanceof cs(e).Element||e instanceof Element}function ds(e){return e instanceof cs(e).HTMLElement||e instanceof HTMLElement}function ps(e){return"undefined"!=typeof ShadowRoot&&(e instanceof cs(e).ShadowRoot||e instanceof ShadowRoot)}var fs=Math.max,hs=Math.min,gs=Math.round;function ms(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function bs(){return!/^((?!chrome|android).)*safari/i.test(ms())}function vs(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);var n=e.getBoundingClientRect(),i=1,a=1;t&&ds(e)&&(i=e.offsetWidth>0&&gs(n.width)/e.offsetWidth||1,a=e.offsetHeight>0&&gs(n.height)/e.offsetHeight||1);var o=(us(e)?cs(e):window).visualViewport,s=!bs()&&r,l=(n.left+(s&&o?o.offsetLeft:0))/i,c=(n.top+(s&&o?o.offsetTop:0))/a,u=n.width/i,d=n.height/a;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l,x:l,y:c}}function ys(e){var t=cs(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Os(e){return e?(e.nodeName||"").toLowerCase():null}function Es(e){return((us(e)?e.ownerDocument:e.document)||window.document).documentElement}function xs(e){return vs(Es(e)).left+ys(e).scrollLeft}function Ss(e){return cs(e).getComputedStyle(e)}function ws(e){var t=Ss(e),r=t.overflow,n=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+i+n)}function Ts(e,t,r){void 0===r&&(r=!1);var n,i,a=ds(t),o=ds(t)&&function(e){var t=e.getBoundingClientRect(),r=gs(t.width)/e.offsetWidth||1,n=gs(t.height)/e.offsetHeight||1;return 1!==r||1!==n}(t),s=Es(t),l=vs(e,o,r),c={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(a||!a&&!r)&&(("body"!==Os(t)||ws(s))&&(c=(n=t)!==cs(n)&&ds(n)?{scrollLeft:(i=n).scrollLeft,scrollTop:i.scrollTop}:ys(n)),ds(t)?((u=vs(t,!0)).x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=xs(s))),{x:l.left+c.scrollLeft-u.x,y:l.top+c.scrollTop-u.y,width:l.width,height:l.height}}function Rs(e){var t=vs(e),r=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:n}}function Ps(e){return"html"===Os(e)?e:e.assignedSlot||e.parentNode||(ps(e)?e.host:null)||Es(e)}function Is(e){return["html","body","#document"].indexOf(Os(e))>=0?e.ownerDocument.body:ds(e)&&ws(e)?e:Is(Ps(e))}function As(e,t){var r;void 0===t&&(t=[]);var n=Is(e),i=n===(null==(r=e.ownerDocument)?void 0:r.body),a=cs(n),o=i?[a].concat(a.visualViewport||[],ws(n)?n:[]):n,s=t.concat(o);return i?s:s.concat(As(Ps(o)))}function Ls(e){return["table","td","th"].indexOf(Os(e))>=0}function Cs(e){return ds(e)&&"fixed"!==Ss(e).position?e.offsetParent:null}function _s(e){for(var t=cs(e),r=Cs(e);r&&Ls(r)&&"static"===Ss(r).position;)r=Cs(r);return r&&("html"===Os(r)||"body"===Os(r)&&"static"===Ss(r).position)?t:r||function(e){var t=/firefox/i.test(ms());if(/Trident/i.test(ms())&&ds(e)&&"fixed"===Ss(e).position)return null;var r=Ps(e);for(ps(r)&&(r=r.host);ds(r)&&["html","body"].indexOf(Os(r))<0;){var n=Ss(r);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||t&&"filter"===n.willChange||t&&n.filter&&"none"!==n.filter)return r;r=r.parentNode}return null}(e)||t}var Ns="top",Ds="bottom",ks="right",$s="left",js="auto",Fs=[Ns,Ds,ks,$s],Ms="start",Bs="end",Qs="viewport",Us="popper",Vs=Fs.reduce((function(e,t){return e.concat([t+"-"+Ms,t+"-"+Bs])}),[]),qs=[].concat(Fs,[js]).reduce((function(e,t){return e.concat([t,t+"-"+Ms,t+"-"+Bs])}),[]),Gs=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Ws(e){var t=new Map,r=new Set,n=[];function i(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var n=t.get(e);n&&i(n)}})),n.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||i(e)})),n}var Xs={placement:"bottom",modifiers:[],strategy:"absolute"};function zs(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function Hs(e){void 0===e&&(e={});var t=e,r=t.defaultModifiers,n=void 0===r?[]:r,i=t.defaultOptions,a=void 0===i?Xs:i;return function(e,t,r){void 0===r&&(r=a);var i,o,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},Xs,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,u={state:s,setOptions:function(r){var i="function"==typeof r?r(s.options):r;d(),s.options=Object.assign({},a,s.options,i),s.scrollParents={reference:us(e)?As(e):e.contextElement?As(e.contextElement):[],popper:As(t)};var o,c,p=function(e){var t=Ws(e);return Gs.reduce((function(e,r){return e.concat(t.filter((function(e){return e.phase===r})))}),[])}((o=[].concat(n,s.options.modifiers),c=o.reduce((function(e,t){var r=e[t.name];return e[t.name]=r?Object.assign({},r,t,{options:Object.assign({},r.options,t.options),data:Object.assign({},r.data,t.data)}):t,e}),{}),Object.keys(c).map((function(e){return c[e]}))));return s.orderedModifiers=p.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,r=e.options,n=void 0===r?{}:r,i=e.effect;if("function"==typeof i){var a=i({state:s,name:t,instance:u,options:n}),o=function(){};l.push(a||o)}})),u.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference,r=e.popper;if(zs(t,r)){s.rects={reference:Ts(t,_s(r),"fixed"===s.options.strategy),popper:Rs(r)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)}));for(var n=0;n<s.orderedModifiers.length;n++)if(!0!==s.reset){var i=s.orderedModifiers[n],a=i.fn,o=i.options,l=void 0===o?{}:o,d=i.name;"function"==typeof a&&(s=a({state:s,options:l,name:d,instance:u})||s)}else s.reset=!1,n=-1}}},update:(i=function(){return new Promise((function(e){u.forceUpdate(),e(s)}))},function(){return o||(o=new Promise((function(e){Promise.resolve().then((function(){o=void 0,e(i())}))}))),o}),destroy:function(){d(),c=!0}};if(!zs(e,t))return u;function d(){l.forEach((function(e){return e()})),l=[]}return u.setOptions(r).then((function(e){!c&&r.onFirstUpdate&&r.onFirstUpdate(e)})),u}}var Ys={passive:!0};function Ks(e){return e.split("-")[0]}function Zs(e){return e.split("-")[1]}function Js(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function el(e){var t,r=e.reference,n=e.element,i=e.placement,a=i?Ks(i):null,o=i?Zs(i):null,s=r.x+r.width/2-n.width/2,l=r.y+r.height/2-n.height/2;switch(a){case Ns:t={x:s,y:r.y-n.height};break;case Ds:t={x:s,y:r.y+r.height};break;case ks:t={x:r.x+r.width,y:l};break;case $s:t={x:r.x-n.width,y:l};break;default:t={x:r.x,y:r.y}}var c=a?Js(a):null;if(null!=c){var u="y"===c?"height":"width";switch(o){case Ms:t[c]=t[c]-(r[u]/2-n[u]/2);break;case Bs:t[c]=t[c]+(r[u]/2-n[u]/2)}}return t}var tl={top:"auto",right:"auto",bottom:"auto",left:"auto"};function rl(e){var t,r=e.popper,n=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,u=e.roundOffsets,d=e.isFixed,p=o.x,f=void 0===p?0:p,h=o.y,g=void 0===h?0:h,m="function"==typeof u?u({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var b=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),y=$s,O=Ns,E=window;if(c){var x=_s(r),S="clientHeight",w="clientWidth";if(x===cs(r)&&"static"!==Ss(x=Es(r)).position&&"absolute"===s&&(S="scrollHeight",w="scrollWidth"),i===Ns||(i===$s||i===ks)&&a===Bs)O=Ds,g-=(d&&x===E&&E.visualViewport?E.visualViewport.height:x[S])-n.height,g*=l?1:-1;if(i===$s||(i===Ns||i===Ds)&&a===Bs)y=ks,f-=(d&&x===E&&E.visualViewport?E.visualViewport.width:x[w])-n.width,f*=l?1:-1}var T,R=Object.assign({position:s},c&&tl),P=!0===u?function(e,t){var r=e.x,n=e.y,i=t.devicePixelRatio||1;return{x:gs(r*i)/i||0,y:gs(n*i)/i||0}}({x:f,y:g},cs(r)):{x:f,y:g};return f=P.x,g=P.y,l?Object.assign({},R,((T={})[O]=v?"0":"",T[y]=b?"0":"",T.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",T)):Object.assign({},R,((t={})[O]=v?g+"px":"",t[y]=b?f+"px":"",t.transform="",t))}const nl={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},n=t.attributes[e]||{},i=t.elements[e];ds(i)&&Os(i)&&(Object.assign(i.style,r),Object.keys(n).forEach((function(e){var t=n[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var n=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});ds(n)&&Os(n)&&(Object.assign(n.style,a),Object.keys(i).forEach((function(e){n.removeAttribute(e)})))}))}},requires:["computeStyles"]};const il={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,n=e.name,i=r.offset,a=void 0===i?[0,0]:i,o=qs.reduce((function(e,r){return e[r]=function(e,t,r){var n=Ks(e),i=[$s,Ns].indexOf(n)>=0?-1:1,a="function"==typeof r?r(Object.assign({},t,{placement:e})):r,o=a[0],s=a[1];return o=o||0,s=(s||0)*i,[$s,ks].indexOf(n)>=0?{x:s,y:o}:{x:o,y:s}}(r,t.rects,a),e}),{}),s=o[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=o}};var al={left:"right",right:"left",bottom:"top",top:"bottom"};function ol(e){return e.replace(/left|right|bottom|top/g,(function(e){return al[e]}))}var sl={start:"end",end:"start"};function ll(e){return e.replace(/start|end/g,(function(e){return sl[e]}))}function cl(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&ps(r)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function ul(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function dl(e,t,r){return t===Qs?ul(function(e,t){var r=cs(e),n=Es(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;var c=bs();(c||!c&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:a,height:o,x:s+xs(e),y:l}}(e,r)):us(t)?function(e,t){var r=vs(e,!1,"fixed"===t);return r.top=r.top+e.clientTop,r.left=r.left+e.clientLeft,r.bottom=r.top+e.clientHeight,r.right=r.left+e.clientWidth,r.width=e.clientWidth,r.height=e.clientHeight,r.x=r.left,r.y=r.top,r}(t,r):ul(function(e){var t,r=Es(e),n=ys(e),i=null==(t=e.ownerDocument)?void 0:t.body,a=fs(r.scrollWidth,r.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=fs(r.scrollHeight,r.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-n.scrollLeft+xs(e),l=-n.scrollTop;return"rtl"===Ss(i||r).direction&&(s+=fs(r.clientWidth,i?i.clientWidth:0)-a),{width:a,height:o,x:s,y:l}}(Es(e)))}function pl(e,t,r,n){var i="clippingParents"===t?function(e){var t=As(Ps(e)),r=["absolute","fixed"].indexOf(Ss(e).position)>=0&&ds(e)?_s(e):e;return us(r)?t.filter((function(e){return us(e)&&cl(e,r)&&"body"!==Os(e)})):[]}(e):[].concat(t),a=[].concat(i,[r]),o=a[0],s=a.reduce((function(t,r){var i=dl(e,r,n);return t.top=fs(i.top,t.top),t.right=hs(i.right,t.right),t.bottom=hs(i.bottom,t.bottom),t.left=fs(i.left,t.left),t}),dl(e,o,n));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function fl(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function hl(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}function gl(e,t){void 0===t&&(t={});var r=t,n=r.placement,i=void 0===n?e.placement:n,a=r.strategy,o=void 0===a?e.strategy:a,s=r.boundary,l=void 0===s?"clippingParents":s,c=r.rootBoundary,u=void 0===c?Qs:c,d=r.elementContext,p=void 0===d?Us:d,f=r.altBoundary,h=void 0!==f&&f,g=r.padding,m=void 0===g?0:g,b=fl("number"!=typeof m?m:hl(m,Fs)),v=p===Us?"reference":Us,y=e.rects.popper,O=e.elements[h?v:p],E=pl(us(O)?O:O.contextElement||Es(e.elements.popper),l,u,o),x=vs(e.elements.reference),S=el({reference:x,element:y,strategy:"absolute",placement:i}),w=ul(Object.assign({},y,S)),T=p===Us?w:x,R={top:E.top-T.top+b.top,bottom:T.bottom-E.bottom+b.bottom,left:E.left-T.left+b.left,right:T.right-E.right+b.right},P=e.modifiersData.offset;if(p===Us&&P){var I=P[i];Object.keys(R).forEach((function(e){var t=[ks,Ds].indexOf(e)>=0?1:-1,r=[Ns,Ds].indexOf(e)>=0?"y":"x";R[e]+=I[r]*t}))}return R}function ml(e,t,r){return fs(e,hs(t,r))}const bl={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,n=e.name,i=r.mainAxis,a=void 0===i||i,o=r.altAxis,s=void 0!==o&&o,l=r.boundary,c=r.rootBoundary,u=r.altBoundary,d=r.padding,p=r.tether,f=void 0===p||p,h=r.tetherOffset,g=void 0===h?0:h,m=gl(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=Ks(t.placement),v=Zs(t.placement),y=!v,O=Js(b),E="x"===O?"y":"x",x=t.modifiersData.popperOffsets,S=t.rects.reference,w=t.rects.popper,T="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,R="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,I={x:0,y:0};if(x){if(a){var A,L="y"===O?Ns:$s,C="y"===O?Ds:ks,_="y"===O?"height":"width",N=x[O],D=N+m[L],k=N-m[C],$=f?-w[_]/2:0,j=v===Ms?S[_]:w[_],F=v===Ms?-w[_]:-S[_],M=t.elements.arrow,B=f&&M?Rs(M):{width:0,height:0},Q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},U=Q[L],V=Q[C],q=ml(0,S[_],B[_]),G=y?S[_]/2-$-q-U-R.mainAxis:j-q-U-R.mainAxis,W=y?-S[_]/2+$+q+V+R.mainAxis:F+q+V+R.mainAxis,X=t.elements.arrow&&_s(t.elements.arrow),z=X?"y"===O?X.clientTop||0:X.clientLeft||0:0,H=null!=(A=null==P?void 0:P[O])?A:0,Y=N+W-H,K=ml(f?hs(D,N+G-H-z):D,N,f?fs(k,Y):k);x[O]=K,I[O]=K-N}if(s){var Z,J="x"===O?Ns:$s,ee="x"===O?Ds:ks,te=x[E],re="y"===E?"height":"width",ne=te+m[J],ie=te-m[ee],ae=-1!==[Ns,$s].indexOf(b),oe=null!=(Z=null==P?void 0:P[E])?Z:0,se=ae?ne:te-S[re]-w[re]-oe+R.altAxis,le=ae?te+S[re]+w[re]-oe-R.altAxis:ie,ce=f&&ae?function(e,t,r){var n=ml(e,t,r);return n>r?r:n}(se,te,le):ml(f?se:ne,te,f?le:ie);x[E]=ce,I[E]=ce-te}t.modifiersData[n]=I}},requiresIfExists:["offset"]};const vl={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,n=e.name,i=e.options,a=r.elements.arrow,o=r.modifiersData.popperOffsets,s=Ks(r.placement),l=Js(s),c=[$s,ks].indexOf(s)>=0?"height":"width";if(a&&o){var u=function(e,t){return fl("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:hl(e,Fs))}(i.padding,r),d=Rs(a),p="y"===l?Ns:$s,f="y"===l?Ds:ks,h=r.rects.reference[c]+r.rects.reference[l]-o[l]-r.rects.popper[c],g=o[l]-r.rects.reference[l],m=_s(a),b=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,v=h/2-g/2,y=u[p],O=b-d[c]-u[f],E=b/2-d[c]/2+v,x=ml(y,E,O),S=l;r.modifiersData[n]=((t={})[S]=x,t.centerOffset=x-E,t)}},effect:function(e){var t=e.state,r=e.options.element,n=void 0===r?"[data-popper-arrow]":r;null!=n&&("string"!=typeof n||(n=t.elements.popper.querySelector(n)))&&cl(t.elements.popper,n)&&(t.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function yl(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Ol(e){return[Ns,ks,Ds,$s].some((function(t){return e[t]>=0}))}var El=Hs({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,r=e.instance,n=e.options,i=n.scroll,a=void 0===i||i,o=n.resize,s=void 0===o||o,l=cs(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&c.forEach((function(e){e.addEventListener("scroll",r.update,Ys)})),s&&l.addEventListener("resize",r.update,Ys),function(){a&&c.forEach((function(e){e.removeEventListener("scroll",r.update,Ys)})),s&&l.removeEventListener("resize",r.update,Ys)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,r=e.name;t.modifiersData[r]=el({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,r=e.options,n=r.gpuAcceleration,i=void 0===n||n,a=r.adaptive,o=void 0===a||a,s=r.roundOffsets,l=void 0===s||s,c={placement:Ks(t.placement),variation:Zs(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,rl(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,rl(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},nl,il,{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var i=r.mainAxis,a=void 0===i||i,o=r.altAxis,s=void 0===o||o,l=r.fallbackPlacements,c=r.padding,u=r.boundary,d=r.rootBoundary,p=r.altBoundary,f=r.flipVariations,h=void 0===f||f,g=r.allowedAutoPlacements,m=t.options.placement,b=Ks(m),v=l||(b===m||!h?[ol(m)]:function(e){if(Ks(e)===js)return[];var t=ol(e);return[ll(e),t,ll(t)]}(m)),y=[m].concat(v).reduce((function(e,r){return e.concat(Ks(r)===js?function(e,t){void 0===t&&(t={});var r=t,n=r.placement,i=r.boundary,a=r.rootBoundary,o=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?qs:l,u=Zs(n),d=u?s?Vs:Vs.filter((function(e){return Zs(e)===u})):Fs,p=d.filter((function(e){return c.indexOf(e)>=0}));0===p.length&&(p=d);var f=p.reduce((function(t,r){return t[r]=gl(e,{placement:r,boundary:i,rootBoundary:a,padding:o})[Ks(r)],t}),{});return Object.keys(f).sort((function(e,t){return f[e]-f[t]}))}(t,{placement:r,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:g}):r)}),[]),O=t.rects.reference,E=t.rects.popper,x=new Map,S=!0,w=y[0],T=0;T<y.length;T++){var R=y[T],P=Ks(R),I=Zs(R)===Ms,A=[Ns,Ds].indexOf(P)>=0,L=A?"width":"height",C=gl(t,{placement:R,boundary:u,rootBoundary:d,altBoundary:p,padding:c}),_=A?I?ks:$s:I?Ds:Ns;O[L]>E[L]&&(_=ol(_));var N=ol(_),D=[];if(a&&D.push(C[P]<=0),s&&D.push(C[_]<=0,C[N]<=0),D.every((function(e){return e}))){w=R,S=!1;break}x.set(R,D)}if(S)for(var k=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return w=t,"break"},$=h?3:1;$>0;$--){if("break"===k($))break}t.placement!==w&&(t.modifiersData[n]._skip=!0,t.placement=w,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},bl,vl,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,r=e.name,n=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=gl(t,{elementContext:"reference"}),s=gl(t,{altBoundary:!0}),l=yl(o,n),c=yl(s,i,a),u=Ol(l),d=Ol(c);t.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),xl=b(4899),Sl=b.n(xl),wl=function(e){return e.reduce((function(e,t){var r=t[0],n=t[1];return e[r]=n,e}),{})},Tl="undefined"!=typeof window&&window.document&&window.document.createElement?s.useLayoutEffect:s.useEffect,Rl=[];function Pl(e){var t=s.useRef(e);return t.current=e,s.useCallback((function(){return t.current}),[])}var Il=function(){};function Al(e,t){return void 0===e&&(e=0),void 0===t&&(t=0),function(){return{width:0,height:0,top:t,right:e,bottom:t,left:e,x:0,y:0,toJSON:function(){return null}}}}var Ll=["styles","attributes"],Cl={getBoundingClientRect:Al()},_l={closeOnOutsideClick:!0,closeOnTriggerHidden:!1,defaultVisible:!1,delayHide:0,delayShow:0,followCursor:!1,interactive:!1,mutationObserverOptions:{attributes:!0,childList:!0,subtree:!0},offset:[0,6],trigger:"hover"};function Nl(e,t){var r,n,i;void 0===e&&(e={}),void 0===t&&(t={});var a=Object.keys(_l).reduce((function(e,t){var r;return ls({},e,((r={})[t]=void 0!==e[t]?e[t]:_l[t],r))}),e),o=s.useMemo((function(){return[{name:"offset",options:{offset:a.offset}}]}),Array.isArray(a.offset)?a.offset:[]),l=ls({},t,{placement:t.placement||a.placement,modifiers:t.modifiers||o}),c=s.useState(null),u=c[0],d=c[1],p=s.useState(null),f=p[0],h=p[1],g=function(e){var t=e.initial,r=e.value,n=e.onChange,i=void 0===n?Il:n;if(void 0===t&&void 0===r)throw new TypeError('Either "value" or "initial" variable must be set. Now both are undefined');var a=s.useState(t),o=a[0],l=a[1],c=Pl(o),u=s.useCallback((function(e){var t=c(),r="function"==typeof e?e(t):e;"function"==typeof r.persist&&r.persist(),l(r),"function"==typeof i&&i(r)}),[c,i]),d=void 0!==r;return[d?r:o,d?i:u]}({initial:a.defaultVisible,value:a.visible,onChange:a.onVisibleChange}),m=g[0],b=g[1],v=s.useRef();s.useEffect((function(){return function(){return clearTimeout(v.current)}}),[]);var y=function(e,t,r){void 0===r&&(r={});var n=s.useRef(null),i={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||Rl},a=s.useState({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=a[0],l=a[1],c=s.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,r=Object.keys(t.elements);Ht.flushSync((function(){l({styles:wl(r.map((function(e){return[e,t.styles[e]||{}]}))),attributes:wl(r.map((function(e){return[e,t.attributes[e]]})))})}))},requires:["computeStyles"]}}),[]),u=s.useMemo((function(){var e={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return Sl()(n.current,e)?n.current||e:(n.current=e,e)}),[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),d=s.useRef();return Tl((function(){d.current&&d.current.setOptions(u)}),[u]),Tl((function(){if(null!=e&&null!=t){var n=(r.createPopper||El)(e,t,u);return d.current=n,function(){n.destroy(),d.current=null}}}),[e,t,r.createPopper]),{state:d.current?d.current.state:null,styles:o.styles,attributes:o.attributes,update:d.current?d.current.update:null,forceUpdate:d.current?d.current.forceUpdate:null}}(a.followCursor?Cl:u,f,l),O=y.styles,E=y.attributes,x=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(y,Ll),S=x.update,w=Pl({visible:m,triggerRef:u,tooltipRef:f,finalConfig:a}),T=s.useCallback((function(e){return Array.isArray(a.trigger)?a.trigger.includes(e):a.trigger===e}),Array.isArray(a.trigger)?a.trigger:[a.trigger]),R=s.useCallback((function(){clearTimeout(v.current),v.current=window.setTimeout((function(){return b(!1)}),a.delayHide)}),[a.delayHide,b]),P=s.useCallback((function(){clearTimeout(v.current),v.current=window.setTimeout((function(){return b(!0)}),a.delayShow)}),[a.delayShow,b]),I=s.useCallback((function(){w().visible?R():P()}),[w,R,P]);s.useEffect((function(){if(w().finalConfig.closeOnOutsideClick){var e=function(e){var t,r=w(),n=r.tooltipRef,i=r.triggerRef,a=(null==e.composedPath||null==(t=e.composedPath())?void 0:t[0])||e.target;a instanceof Node&&(null==n||null==i||n.contains(a)||i.contains(a)||R())};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}}),[w,R]),s.useEffect((function(){if(null!=u&&T("click"))return u.addEventListener("click",I),function(){return u.removeEventListener("click",I)}}),[u,T,I]),s.useEffect((function(){if(null!=u&&T("double-click"))return u.addEventListener("dblclick",I),function(){return u.removeEventListener("dblclick",I)}}),[u,T,I]),s.useEffect((function(){if(null!=u&&T("right-click")){var e=function(e){e.preventDefault(),I()};return u.addEventListener("contextmenu",e),function(){return u.removeEventListener("contextmenu",e)}}}),[u,T,I]),s.useEffect((function(){if(null!=u&&T("focus"))return u.addEventListener("focus",P),u.addEventListener("blur",R),function(){u.removeEventListener("focus",P),u.removeEventListener("blur",R)}}),[u,T,P,R]),s.useEffect((function(){if(null!=u&&T("hover"))return u.addEventListener("mouseenter",P),u.addEventListener("mouseleave",R),function(){u.removeEventListener("mouseenter",P),u.removeEventListener("mouseleave",R)}}),[u,T,P,R]),s.useEffect((function(){if(null!=f&&T("hover")&&w().finalConfig.interactive)return f.addEventListener("mouseenter",P),f.addEventListener("mouseleave",R),function(){f.removeEventListener("mouseenter",P),f.removeEventListener("mouseleave",R)}}),[f,T,P,R,w]);var A=null==x||null==(r=x.state)||null==(n=r.modifiersData)||null==(i=n.hide)?void 0:i.isReferenceHidden;s.useEffect((function(){a.closeOnTriggerHidden&&A&&R()}),[a.closeOnTriggerHidden,R,A]),s.useEffect((function(){if(a.followCursor&&null!=u)return u.addEventListener("mousemove",e),function(){return u.removeEventListener("mousemove",e)};function e(e){var t=e.clientX,r=e.clientY;Cl.getBoundingClientRect=Al(t,r),null==S||S()}}),[a.followCursor,u,S]),s.useEffect((function(){if(null!=f&&null!=S&&null!=a.mutationObserverOptions){var e=new MutationObserver(S);return e.observe(f,a.mutationObserverOptions),function(){return e.disconnect()}}}),[a.mutationObserverOptions,f,S]);return ls({getArrowProps:function(e){return void 0===e&&(e={}),ls({},e,E.arrow,{style:ls({},e.style,O.arrow),"data-popper-arrow":!0})},getTooltipProps:function(e){return void 0===e&&(e={}),ls({},e,{style:ls({},e.style,O.popper)},E.popper,{"data-popper-interactive":a.interactive})},setTooltipRef:h,setTriggerRef:d,tooltipRef:f,triggerRef:u,visible:m},x)}const Dl=s.memo((({definition:e,operation:t,innerQueryPlaceholder:n})=>{const i=(0,c.useStyles2)(kl),[a,o]=(0,s.useState)(!1),{getTooltipProps:l,setTooltipRef:u,setTriggerRef:d,visible:p}=Nl({placement:"top",visible:a,offset:[0,16],onVisibleChange:o,interactive:!0,trigger:["click"]});return s.createElement(s.Fragment,null,s.createElement(c.Button,{title:"Click to show description",ref:d,icon:"info-circle",size:"sm",variant:"secondary",fill:"text"}),p&&s.createElement(c.Portal,null,s.createElement("div",{ref:u,...l(),className:i.docBox},s.createElement("div",{className:i.docBoxHeader},s.createElement("span",null,e.renderer(t,e,n)),s.createElement(F,{grow:1}),s.createElement(c.Button,{icon:"times",onClick:()=>o(!1),fill:"text",variant:"secondary",title:"Remove operation"})),s.createElement("div",{className:i.docBoxBody,dangerouslySetInnerHTML:{__html:(f=e,h=t,(0,r.renderMarkdown)(f.explainHandler?f.explainHandler(h,f):null!=(g=f.documentation)?g:"no docs"))}}))));var f,h,g}));Dl.displayName="OperationDocs";const kl=e=>({docBox:(0,a.css)({overflow:"hidden",background:e.colors.background.primary,border:`1px solid ${e.colors.border.strong}`,boxShadow:e.shadows.z3,maxWidth:"600px",padding:e.spacing(1),borderRadius:e.shape.radius.default,zIndex:e.zIndex.tooltip}),docBoxHeader:(0,a.css)({fontSize:e.typography.h5.fontSize,fontFamily:e.typography.fontFamilyMonospace,paddingBottom:e.spacing(1),display:"flex",alignItems:"center"}),docBoxBody:(0,a.css)({marginBottom:e.spacing(-1),color:e.colors.text.secondary}),signature:(0,a.css)({fontSize:e.typography.bodySmall.fontSize,fontFamily:e.typography.fontFamilyMonospace}),dropdown:(0,a.css)({opacity:0,color:e.colors.text.secondary})});const $l=s.memo((({operation:e,definition:t,index:r,onChange:n,onRemove:i,onToggle:a,queryModeller:o,dragHandleProps:l})=>{var u;const d=(0,c.useStyles2)(jl),[p,f]=(0,s.useState)({}),h=()=>{if(p.isOpen)f({...p,isOpen:!1});else{const e=o.getAlternativeOperations(t.alternativesKey).map((e=>({label:e.name,value:e})));f({isOpen:!0,alternatives:e})}};return s.createElement("div",{className:d.header},!p.isOpen&&s.createElement(s.Fragment,null,s.createElement("div",{...l},null!=(u=t.name)?u:t.id),s.createElement(F,{grow:1}),s.createElement("div",{className:`${d.operationHeaderButtons} operation-header-show-on-hover`},s.createElement(c.Button,{icon:"angle-down",size:"sm",onClick:h,fill:"text",variant:"secondary",title:"Click to view alternative operations"}),s.createElement(Dl,{definition:t,operation:e,innerQueryPlaceholder:o.innerQueryPlaceholder}),t.toggleable&&s.createElement(c.Button,{icon:e.disabled?"eye-slash":"eye",size:"sm",onClick:()=>a(r),fill:"text",variant:"secondary",title:e.disabled?"Enable operation":"Disable operation"}),s.createElement(c.Button,{icon:"times",size:"sm",onClick:()=>i(r),fill:"text",variant:"secondary",title:"Remove operation"}))),p.isOpen&&s.createElement("div",{className:d.selectWrapper},s.createElement(c.Select,{autoFocus:!0,openMenuOnFocus:!0,placeholder:"Replace with",options:p.alternatives,isOpen:!0,onCloseMenu:h,onChange:i=>{if(i.value){const a=o.getOperationDefinition(i.value.id),s=[...a.defaultParams];for(let r=0;r<Math.min(e.params.length,s.length);r++)a.params[r].type===t.params[r].type&&(s[r]=e.params[r]);const l={...e,params:s,id:i.value.id};n(r,t.changeTypeHandler?t.changeTypeHandler(l,a):l)}}})))}));$l.displayName="OperationHeader";const jl=e=>({header:(0,a.css)({borderBottom:`1px solid ${e.colors.border.medium}`,padding:e.spacing(.5,.5,.5,1),display:"flex",alignItems:"center"}),operationHeaderButtons:(0,a.css)({opacity:1}),selectWrapper:(0,a.css)({paddingRight:e.spacing(2)})});function Fl(e){var t;return s.createElement(c.AutoSizeInput,{id:Ul(e.operationId,e.index),defaultValue:null==(t=e.value)?void 0:t.toString(),minWidth:e.paramDef.minWidth,placeholder:e.paramDef.placeholder,title:e.paramDef.description,maxWidth:3*(e.paramDef.minWidth||20),onCommitChange:t=>{e.onChange(e.index,t.currentTarget.value),e.paramDef.runQueryOnEnter&&"keydown"===t.type&&e.onRunQuery()}})}function Ml(e){return s.createElement(c.Checkbox,{id:Ul(e.operationId,e.index),value:Boolean(e.value),onChange:t=>e.onChange(e.index,t.currentTarget.checked)})}function Bl({paramDef:e,value:t,index:n,operationId:i,onChange:a}){var o,l;const u=(0,c.useStyles2)(Ql);let d=e.options;(null==(o=d[0])?void 0:o.label)||(d=e.options.map((e=>({label:e.toString(),value:e}))));let p=null!=(l=d.find((e=>e.value===t)))?l:(0,r.toOption)(t);return!t&&e.optional?s.createElement("div",{className:u.optionalParam},s.createElement(c.Button,{size:"sm",variant:"secondary",title:`Add ${e.name}`,icon:"plus",onClick:()=>a(n,d[0].value)},e.name)):s.createElement(R,{gap:.5,direction:"row",alignItems:"center"},s.createElement(c.Select,{id:Ul(i,n),value:p,options:d,placeholder:e.placeholder,allowCustomValue:!0,onChange:e=>a(n,e.value),width:e.minWidth||"auto"}),e.optional&&s.createElement(c.Button,{"data-testid":`operations.${n}.remove-param`,size:"sm",fill:"text",icon:"times",variant:"secondary",title:`Remove ${e.name}`,onClick:()=>a(n,"")}))}const Ql=e=>({optionalParam:(0,a.css)({marginTop:e.spacing(1)})});function Ul(e,t){return`operations.${e}.param.${t}`}function Vl({provided:e,flash:t,isConflicting:r,highlight:n,index:i,queryModeller:o,onChange:l,onRemove:u,onToggle:d,operation:p,definition:f,query:h,timeRange:g,onRunQuery:m,datasource:b}){const v=(0,c.useTheme2)(),y=ql(v,r),O=function(e){const[t,r]=(0,s.useState)(!0);return(0,s.useEffect)((()=>{let t;return e?t=setTimeout((()=>{r(!1)}),1e3):r(!0),()=>clearTimeout(t)}),[e]),t&&e}(t),{current:E}=(0,s.useRef)((0,Nt.A)()),x=(e,t)=>{const r={...p,params:[...p.params]};r.params[e]=t,Gl(f,r,i,e,l)},S=()=>{const e={...p,params:[...p.params,""]};Gl(f,e,i,p.params.length,l)};let w;if(f.params.length>0){const e=f.params[f.params.length-1];e.restParam&&(w=function(e,t,r,n,i){return s.createElement("div",{className:i.restParam,key:`${n}-2`},s.createElement(c.Button,{size:"sm",icon:"plus",title:`Add ${e.name}`.trimEnd(),variant:"secondary",onClick:t,"data-testid":`operations.${r}.add-rest-param`},e.name))}(e,S,i,p.params.length,y))}return s.createElement("div",{className:(0,a.cx)(y.card,{[y.cardHighlight]:O||n,[y.cardError]:r,[y.disabled]:p.disabled}),ref:e.innerRef,...e.draggableProps,"data-testid":`operations.${i}.wrapper`},s.createElement($l,{operation:p,dragHandleProps:e.dragHandleProps,definition:f,index:i,onChange:l,onRemove:u,onToggle:d,queryModeller:o}),s.createElement("div",{className:y.body},p.params.map(((e,t)=>{const r=f.params[Math.min(f.params.length-1,t)],n=function(e){return e.editor?e.editor:e.options?Bl:"boolean"===e.type?Ml:Fl}(r);return s.createElement("div",{className:y.paramRow,key:`${t}-1`},!r.hideName&&s.createElement("div",{className:y.paramName},s.createElement("label",{htmlFor:Ul(E,t)},r.name),r.description&&s.createElement(c.Tooltip,{placement:"top",content:r.description,theme:"info"},s.createElement(c.Icon,{name:"info-circle",size:"sm",className:y.infoIcon}))),s.createElement("div",{className:y.paramValue},s.createElement(R,{gap:.5,direction:"row",alignItems:"center",wrap:!1},s.createElement(n,{index:t,paramDef:r,value:p.params[t],operation:p,operationId:E,onChange:x,onRunQuery:m,query:h,datasource:b,timeRange:g,queryModeller:o}),r.restParam&&(p.params.length>f.params.length||r.optional)&&s.createElement(c.Button,{"data-testid":`operations.${i}.remove-rest-param`,size:"sm",fill:"text",icon:"times",variant:"secondary",title:`Remove ${r.name}`,onClick:()=>(e=>{const t={...p,params:[...p.params.slice(0,e),...p.params.slice(e+1)]};Gl(f,t,i,e,l)})(t)}))))}))),w,i<h.operations.length-1&&s.createElement("div",{className:y.arrow},s.createElement("div",{className:y.arrowLine}),s.createElement("div",{className:y.arrowArrow})))}const ql=(e,t)=>({cardWrapper:(0,a.css)({alignItems:"stretch"}),error:(0,a.css)({marginBottom:e.spacing(1)}),card:(0,a.css)({background:e.colors.background.primary,border:`1px solid ${e.colors.border.medium}`,cursor:"grab",borderRadius:e.shape.radius.default,position:"relative",transition:"all 0.5s ease-in 0s",height:t?"auto":"100%"}),disabled:(0,a.css)({opacity:.5,transition:"none"}),cardError:(0,a.css)({boxShadow:`0px 0px 4px 0px ${e.colors.warning.main}`,border:`1px solid ${e.colors.warning.main}`}),cardHighlight:(0,a.css)({boxShadow:`0px 0px 4px 0px ${e.colors.primary.border}`,border:`1px solid ${e.colors.primary.border}`}),infoIcon:(0,a.css)({marginLeft:e.spacing(.5),color:e.colors.text.secondary,":hover":{color:e.colors.text.primary}}),body:(0,a.css)({margin:e.spacing(1,1,.5,1),display:"table"}),paramRow:(0,a.css)({label:"paramRow",display:"table-row",verticalAlign:"middle"}),paramName:(0,a.css)({display:"table-cell",padding:e.spacing(0,1,0,0),fontSize:e.typography.bodySmall.fontSize,fontWeight:e.typography.fontWeightMedium,verticalAlign:"middle",height:"32px"}),paramValue:(0,a.css)({label:"paramValue",display:"table-cell",verticalAlign:"middle"}),restParam:(0,a.css)({padding:e.spacing(0,1,1,1)}),arrow:(0,a.css)({position:"absolute",top:"0",right:"-18px",display:"flex"}),arrowLine:(0,a.css)({height:"2px",width:"8px",backgroundColor:e.colors.border.strong,position:"relative",top:"14px"}),arrowArrow:(0,a.css)({width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderLeft:`7px solid ${e.colors.border.strong}`,position:"relative",top:"10px"})});function Gl(e,t,r,n,i){e.paramChangedHandler?i(r,e.paramChangedHandler(n,t,e)):i(r,t)}function Wl({operation:e,index:t,onRemove:r,onToggle:n,onChange:i,onRunQuery:o,queryModeller:l,query:u,datasource:d,flash:p,highlight:f,timeRange:h,isConflictingOperation:g}){const m=l.getOperationDefinition(e.id),b=(0,c.useTheme2)(),v=!!g&&g(e,u.operations),y=Xl(b);if(!m)return s.createElement("span",null,"Operation ",e.id," not found");const O=e=>{if(!e)return!!v||void 0};return s.createElement(ko,{draggableId:`operation-${t}`,index:t},((g,b)=>s.createElement(c.InlineField,{error:"You have conflicting label filters",invalid:O(b.isDragging),className:(0,a.cx)(y.error,y.cardWrapper)},s.createElement(Vl,{provided:g,flash:p,highlight:f,isConflicting:v,index:t,operation:e,definition:m,onChange:i,onRemove:r,onToggle:n,queryModeller:l,query:u,timeRange:h,onRunQuery:o,datasource:d}))))}const Xl=(e,t)=>({cardWrapper:(0,a.css)({alignItems:"stretch"}),error:(0,a.css)({marginBottom:e.spacing(1)})});function zl({query:e,datasource:t,queryModeller:r,onChange:n,onRunQuery:i,highlightedOp:a,timeRange:o,isConflictingOperation:l}){const u=(0,c.useStyles2)(Hl),{operations:d}=e,p=function(e){const t=ss(),r=E(e);if(!t())return e.map((()=>!1));if(!r)return e.map((()=>!0));let n=[];if(r.length-1===e.length&&e.every((e=>r.includes(e))))return e.map((()=>!1));if(r.length+1===e.length&&r.every((t=>e.includes(t)))){const t=e.find((e=>!r.includes(e)));n=e.map((e=>e===t))}else n=e.map(((e,t)=>{var n,i,a;return i=e.id,a=null==(n=r[t])?void 0:n.id,!(i===a||`__${i}_by`===a||i===`__${a}_by`)}));return n}(d),[f,h]=(0,s.useState)(!1),g=(t,r)=>{const i=[...d];i.splice(t,1,r),n({...e,operations:i})},m=t=>{const r=[...d.slice(0,t),...d.slice(t+1)];n({...e,operations:r})},b=e=>{g(e,{...d[e],disabled:!d[e].disabled})},v=r.getCategories().map((e=>({value:e,label:e,items:r.getOperationsForCategory(e).map((e=>({value:e.id,label:e.name,isLeaf:!0})))})));return s.createElement(R,{gap:1,direction:"column"},s.createElement(R,{gap:1},d.length>0&&s.createElement(vo,{onDragEnd:t=>{if(!t.destination)return;const r=[...d],i=r[t.source.index];r.splice(t.source.index,1),r.splice(t.destination.index,0,i),n({...e,operations:r})}},s.createElement(os,{droppableId:"sortable-field-mappings",direction:"horizontal"},(n=>s.createElement("div",{className:u.operationList,ref:n.innerRef,...n.droppableProps},d.map(((n,c)=>s.createElement(Wl,{key:n.id+JSON.stringify(n.params)+c,queryModeller:r,index:c,operation:n,query:e,datasource:t,onChange:g,onRemove:m,onToggle:b,onRunQuery:i,flash:p[c],highlight:a===n,timeRange:o,isConflictingOperation:l}))),n.placeholder)))),s.createElement("div",{className:u.addButton},f?s.createElement(c.Cascader,{options:v,onSelect:t=>{const i=r.getOperationDefinition(t);i&&(n(i.addOperationHandler(i,e,r)),h(!1))},onBlur:()=>{h(!1)},autoFocus:!0,alwaysOpen:!0,hideActiveLevelLabel:!0,placeholder:"Search"}):s.createElement(c.Button,{icon:"plus",variant:"secondary",onClick:()=>h(!0),title:"Add operation"},"Operations"))))}const Hl=e=>({heading:(0,a.css)({label:"heading",fontSize:12,fontWeight:e.typography.fontWeightMedium,marginBottom:0}),operationList:(0,a.css)({label:"operationList",display:"flex",flexWrap:"wrap",gap:e.spacing(2)}),addButton:(0,a.css)({label:"addButton",width:126,paddingBottom:e.spacing(1)})}),Yl=({datasource:e,query:t,onChange:r,data:i,queryModeller:a,buildVisualQueryFromString:o,buildDataQueryFromQueryString:l,buildQueryStringFromDataQuery:u})=>{const d=(0,c.useStyles2)(Kl),p=(0,s.useMemo)((()=>{var r;const n=l(a.renderQuery(t)),o=null==(r=e.getQueryHints)?void 0:r.call(e,n,(null==i?void 0:i.series)||[]).filter((e=>{var t;return null==(t=e.fix)?void 0:t.action}));return null!=o?o:[]}),[e,t,i,a,l]);return s.createElement(s.Fragment,null,p.length>0&&s.createElement("div",{className:d.container},p.map((i=>{var p,f,h,g;return s.createElement(c.Tooltip,{content:`${i.label} ${null==(p=i.fix)?void 0:p.label}`,key:i.type},s.createElement(c.Button,{onClick:()=>{var s,c,d;if((0,n.reportInteraction)("grafana_query_builder_hints_clicked",{hint:i.type,datasourceType:e.type}),null==(s=null==i?void 0:i.fix)?void 0:s.action){const n=l(a.renderQuery(t)),s=null==(c=e.modifyQuery)?void 0:c.call(e,n,i.fix.action);if(s){const e=o(null!=(d=u(s))?d:"");return r(e.query)}}},fill:"outline",size:"sm",className:d.hint},"hint: ",(null==(f=i.fix)?void 0:f.title)||(null==(g=null==(h=i.fix)?void 0:h.action)?void 0:g.type.toLowerCase().replace("_"," "))))}))))};Yl.displayName="QueryBuilderHints";const Kl=e=>({container:a.css` display: flex; align-items: start; `,hint:a.css` margin-right: ${e.spacing(1)}; `});function Zl({query:e,queryModeller:t,stepNumber:r,language:n,onMouseEnter:i,onMouseLeave:a}){return s.createElement(s.Fragment,null,e.operations.map(((e,o)=>{var l;const c=t.getOperationDefinition(e.id);if(!c)return`Operation ${e.id} not found`;const u=c.renderer(e,c,t.innerQueryPlaceholder),d=c.explainHandler?c.explainHandler(e,c):null!=(l=c.documentation)?l:"no docs";return s.createElement("div",{key:o,onMouseEnter:()=>null==i?void 0:i(e,o),onMouseLeave:()=>null==a?void 0:a(e,o)},s.createElement(Ut,{stepNumber:o+r,title:s.createElement(Gt,{query:u,language:n}),markdown:d}))})))}var Jl=b(601),ec=b(2954),tc=b(8116);const rc="Fetch all log lines matching label filters.",nc=(0,s.memo)((({query:e})=>{const t=(0,Rt.u_)(e||"").query,r={grammar:Jl.vB,name:"lokiql"};return(0,i.jsxs)(c.Stack,{gap:0,direction:"column",children:[(0,i.jsx)(Ut,{stepNumber:1,title:(0,i.jsx)(Gt,{query:`${Tt.y.renderLabels(t.labels)}`,language:r}),children:rc}),(0,i.jsx)(Zl,{stepNumber:2,queryModeller:Tt.y,query:t,language:r})]})}));nc.displayName="LokiQueryBuilderExplained";var ic=b(8635);function ac(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){ac(e,t,r[t])}))}return e}function sc(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const lc=(0,s.memo)((({nestedQuery:e,index:t,datasource:n,onChange:a,onRemove:o,onRunQuery:s,showExplain:l})=>{const u=(0,c.useStyles2)(uc);return(0,i.jsxs)("div",{className:u.card,children:[(0,i.jsxs)("div",{className:u.header,children:[(0,i.jsx)("div",{className:u.name,children:"Operator"}),(0,i.jsx)(c.Select,{"aria-label":"Select operator",width:"auto",options:cc,value:(0,r.toOption)(e.operator),onChange:r=>{a(t,sc(oc({},e),{operator:r.value}))}}),(0,i.jsx)("div",{className:u.name,children:"Vector matches"}),(0,i.jsxs)("div",{className:u.vectorMatchWrapper,children:[(0,i.jsx)(c.Select,{width:"auto",value:e.vectorMatchesType||"on",allowCustomValue:!0,options:[{value:"on",label:"on"},{value:"ignoring",label:"ignoring"}],onChange:r=>{a(t,sc(oc({},e),{vectorMatchesType:r.value}))}}),(0,i.jsx)(c.AutoSizeInput,{className:u.vectorMatchInput,minWidth:20,defaultValue:e.vectorMatches,onCommitChange:r=>{a(t,sc(oc({},e),{vectorMatches:r.currentTarget.value,vectorMatchesType:e.vectorMatchesType||"on"}))}})]}),(0,i.jsx)(F,{grow:1}),(0,i.jsx)(c.IconButton,{name:"times",size:"sm",onClick:()=>o(t),tooltip:"Remove nested query"})]}),(0,i.jsx)("div",{className:u.body,children:(0,i.jsx)(Q,{children:(0,i.jsx)(Oc,{showExplain:l,query:e.query,datasource:n,onRunQuery:s,onChange:r=>{a(t,sc(oc({},e),{query:r}))}})})})]})})),cc=ic.C.map((e=>({label:e.sign,value:e.sign})));lc.displayName="NestedQuery";const uc=e=>({card:(0,a.css)({label:"card",display:"flex",flexDirection:"column",gap:e.spacing(.5)}),header:(0,a.css)({label:"header",padding:e.spacing(.5,.5,.5,1),gap:e.spacing(1),display:"flex",alignItems:"center"}),name:(0,a.css)({label:"name",whiteSpace:"nowrap"}),body:(0,a.css)({label:"body",paddingLeft:e.spacing(2)}),vectorMatchInput:(0,a.css)({label:"vectorMatchInput",marginLeft:-1}),vectorMatchWrapper:(0,a.css)({label:"vectorMatchWrapper",display:"flex"})});function dc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){dc(e,t,r[t])}))}return e}function fc(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function hc({query:e,datasource:t,onChange:r,onRunQuery:n,showExplain:a}){var o;const s=null!==(o=e.binaryQueries)&&void 0!==o?o:[],l=(t,n)=>{const i=[...s];i.splice(t,1,n),r(fc(pc({},e),{binaryQueries:i}))},u=t=>{const n=[...s.slice(0,t),...s.slice(t+1)];r(fc(pc({},e),{binaryQueries:n}))};return(0,i.jsx)(c.Stack,{direction:"column",gap:1,children:s.map(((e,r)=>(0,i.jsx)(lc,{nestedQuery:e,index:r,onChange:l,datasource:t,onRemove:u,onRunQuery:n,showExplain:a},r.toString())))})}function gc(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function mc(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){gc(a,n,i,o,s,"next",e)}function s(e){gc(a,n,i,o,s,"throw",e)}o(void 0)}))}}function bc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vc(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const yc=3e5,Oc=(0,s.memo)((({datasource:e,query:t,onChange:n,onRunQuery:a,showExplain:l,timeRange:c})=>{const[d,p]=(0,s.useState)(),[f,h]=(0,s.useState)(void 0),g=E(t),m=E(c),b=t=>mc((function*(){const r=yield t;return[...e.getVariables(),...r].map((e=>({label:e,value:e})))}))(),v=(0,s.useMemo)((()=>{const{labels:e,operations:r}=t;return!(e.length||!r.length)&&(1!==r.length||r[0].id!==tc.EF.LineContains||""!==r[0].params[0])}),[t]);(0,s.useEffect)((()=>{const n=m&&c&&(Math.abs(c.to.valueOf()-m.to.valueOf())>yc||Math.abs(c.from.valueOf()-m.from.valueOf())>yc),i=!(0,o.isEqual)(g,t);(n||i)&&mc((function*(){const n={expr:Tt.y.renderQuery(t),refId:"data-samples"},i=null!=c?c:(0,r.getDefaultTimeRange)(),a={series:yield e.getDataSamples(n,i),state:r.LoadingState.Done,timeRange:i};p(a)}))().catch(console.error)}),[e,t,c,g,m]);const y={grammar:Jl.Ay,name:"logql"};return(0,i.jsxs)("div",{"data-testid":Au.editor,children:[(0,i.jsx)(Pt,{children:(0,i.jsx)(Qt,{onGetLabelNames:r=>b((r=>mc((function*(){const n=t.labels.filter((e=>e!==r)),i=n.find((e=>"="===e.op||"=~"===e.op&&!1===new RegExp(e.value).test("")));if(0===n.length||!i)return yield e.languageProvider.fetchLabels({timeRange:c});const a=Tt.y.renderLabels(n),o=yield e.languageProvider.fetchLabels({streamSelector:a,timeRange:c}),s=n.map((e=>e.label));return o.filter((e=>!s.includes(e))).sort()}))())(r)),onGetLabelValues:r=>b((r=>mc((function*(){if(!r.label)return[];let n;const i=t.labels.filter((e=>e!==r)),a=i.find((e=>"="===e.op||"=~"===e.op&&!1===new RegExp(e.value).test("")));if(0!==i.length&&a){const t=Tt.y.renderLabels(i);n=yield e.languageProvider.fetchLabelValues(r.label,{streamSelector:t,timeRange:c})}else n=yield e.languageProvider.fetchLabelValues(r.label,{timeRange:c});return n?n.map((e=>(0,u.Bb)(e,r.op))):[]}))())(r)),labelsFilters:t.labels,onChange:e=>{n(vc(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){bc(e,t,r[t])}))}return e}({},t),{labels:e}))},labelFilterRequired:v})}),l&&(0,i.jsx)(Ut,{stepNumber:1,title:(0,i.jsx)(Gt,{query:`${Tt.y.renderLabels(t.labels)}`,language:y}),children:rc}),(0,i.jsxs)(Xt,{children:[(0,i.jsx)(zl,{queryModeller:Tt.y,query:t,onChange:n,onRunQuery:a,datasource:e,highlightedOp:f,isConflictingOperation:(e,t)=>e.id===tc.EF.LabelFilter&&(0,ec.hh)(e,t)}),(0,i.jsx)(Yl,{datasource:e,query:t,onChange:n,data:d,queryModeller:Tt.y,buildVisualQueryFromString:Rt.u_,buildDataQueryFromQueryString:e=>({expr:e,refId:"hints"}),buildQueryStringFromDataQuery:e=>e.expr})]}),l&&(0,i.jsx)(Zl,{stepNumber:2,queryModeller:Tt.y,query:t,language:y,onMouseEnter:e=>{h(e)},onMouseLeave:()=>{h(void 0)}}),t.binaryQueries&&t.binaryQueries.length>0&&(0,i.jsx)(hc,{query:t,datasource:e,onChange:n,onRunQuery:a,showExplain:l})]})}));function Ec({query:e}){return(0,i.jsx)(Pt,{children:(0,i.jsx)(Ct,{children:(0,i.jsx)(Gt,{query:e,language:{grammar:Jl.vB,name:"lokiql"}})})})}function xc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sc(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function wc(e){const{query:t,onChange:r,onRunQuery:n,datasource:a,showExplain:o,timeRange:l}=e,[c,u]=(0,s.useReducer)(Tc.reducer,{expr:t.expr,visQuery:""===t.expr?{labels:[],operations:[{id:"__line_contains",params:[""]}]}:void 0});(0,s.useEffect)((()=>{u(Pc(t.expr))}),[t.expr]);return c.visQuery?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Oc,{query:c.visQuery,datasource:a,onChange:t=>{const n=Tt.y.renderQuery(t);u(Rc({visQuery:t,expr:n})),r(Sc(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){xc(e,t,r[t])}))}return e}({},e.query),{expr:n}))},onRunQuery:n,showExplain:o,"data-testid":Au.editor,timeRange:l}),""!==t.expr&&(0,i.jsx)(Ec,{query:t.expr})]}):null}Oc.displayName="LokiQueryBuilder";const Tc=Et({name:"loki-builder-container",initialState:{expr:""},reducers:{visualQueryChange:(e,t)=>{e.expr=t.payload.expr,e.visQuery=t.payload.visQuery},exprChanged:(e,t)=>{if(!e.visQuery||e.expr!==t.payload){e.expr=t.payload;const r=(0,Rt.u_)(t.payload);e.visQuery=r.query}}}}),{visualQueryChange:Rc,exprChanged:Pc}=Tc.actions;var Ic=function(e,t){return"boolean"==typeof t?t:!e};const Ac=function(e){return(0,s.useReducer)(Ic,e)};function Lc({title:e,children:t,collapsedInfo:r,queryStats:i}){const[a,o]=Ac(!1),l=(0,c.useStyles2)(Cc);return s.createElement("div",{className:l.wrapper},s.createElement(c.Collapse,{className:l.collapse,collapsible:!0,isOpen:a,onToggle:o,label:s.createElement(R,{gap:0},s.createElement("h6",{className:l.title},e),!a&&s.createElement("div",{className:l.description},r.map(((e,t)=>s.createElement("span",{key:t},e)))))},s.createElement("div",{className:l.body},t)),i&&n.config.featureToggles.lokiQuerySplitting&&s.createElement(c.Tooltip,{content:"Note: the query will be split into multiple parts and executed in sequence. Query limits will only apply each individual part."},s.createElement(c.Icon,{tabIndex:0,name:"info-circle",className:l.tooltip,size:"sm"})),i&&s.createElement("p",{className:l.stats},_c(i)))}const Cc=e=>({collapse:(0,a.css)({backgroundColor:"unset",border:"unset",marginBottom:0,"> button":{padding:e.spacing(0,1)}}),wrapper:(0,a.css)({width:"100%",display:"flex",justifyContent:"space-between",alignItems:"baseline"}),title:(0,a.css)({flexGrow:1,overflow:"hidden",fontSize:e.typography.bodySmall.fontSize,fontWeight:e.typography.fontWeightMedium,margin:0}),description:(0,a.css)({color:e.colors.text.secondary,fontSize:e.typography.bodySmall.fontSize,fontWeight:e.typography.bodySmall.fontWeight,paddingLeft:e.spacing(2),gap:e.spacing(2),display:"flex"}),body:(0,a.css)({display:"flex",gap:e.spacing(2),flexWrap:"wrap"}),stats:(0,a.css)({margin:"0px",color:e.colors.text.secondary,fontSize:e.typography.bodySmall.fontSize}),tooltip:(0,a.css)({marginRight:e.spacing(.25)})}),_c=e=>e.message?e.message:`This query will process approximately ${Nc(e)}.`,Nc=e=>{const{text:t,suffix:n}=(0,r.getValueFormat)("bytes")(e.bytes,1);return t+n};var Dc=b(9107);function kc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const jc=[{value:Dc.U3.Range,label:"Range",description:"Run query over a range of time."},{value:Dc.U3.Instant,label:"Instant",description:'Run query against a single point in time. For this query, the "To" time is used.'}],Fc=[{value:Dc.ti.Backward,label:"Backward",description:"Search in backward direction."},{value:Dc.ti.Forward,label:"Forward",description:"Search in forward direction."}];function Mc(e){const{lineLimitValue:t,onRunQuery:r,runOnBlur:a,onChange:o}=e;var s;const l=null!==(s=e.query)&&void 0!==s?s:{};function u(e){const t=Bc(e),r=$c(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){kc(e,t,r[t])}))}return e}({},l),{maxLines:t});o(r),(0,n.reportInteraction)("grafana_loki_max_lines_changed",{maxLines:t})}return(0,i.jsx)(c.Stack,{alignItems:"flex-start",gap:.5,"aria-label":"Loki extra field",children:(0,i.jsx)(c.Stack,{wrap:"nowrap",gap:0,"data-testid":"lineLimitField","aria-label":"Line limit field",children:(0,i.jsx)(c.InlineField,{label:"Line limit",tooltip:"Upper limit for number of log lines returned by query.",children:(0,i.jsx)(c.Input,{className:"width-4",placeholder:"auto",type:"number",min:0,onChange:function(e){l.maxLines!==Bc(e.currentTarget.value)&&u(e.currentTarget.value)},onKeyDown:function(e){"Enter"===e.key&&r()},value:t,onBlur:()=>{a&&r()}})})})})}n.config.featureToggles.lokiShardSplitting&&Fc.push({value:Dc.ti.Scan,label:"Scan",description:"Experimental. Split the query into smaller units and stop at the requested log line limit.",icon:"exclamation-triangle"}),n.config.featureToggles.lokiExperimentalStreaming&&jc.push({value:Dc.U3.Stream,label:"Stream",description:"Run a query and keep sending results on an interval"});function Bc(e){const t=parseInt(e,10);if(!(isNaN(t)||t<0))return t}var Qc=b(1849),Uc=b(6227);function Vc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Vc(e,t,r[t])}))}return e}function Gc(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Wc=s.memo((({app:e,query:t,onChange:a,onRunQuery:l,queryStats:u,datasource:d})=>{var p,f;const h=d.maxLines;(0,s.useEffect)((()=>{e!==r.CoreApp.Explore&&e!==r.CoreApp.Dashboard&&e!==r.CoreApp.PanelEditor||t.direction||a(Gc(qc({},t),{direction:zc(e)}))}),[e,a,t]),(0,s.useEffect)((()=>{t.step&&!(0,r.isValidGrafanaDuration)(`${t.step}`)&&parseInt(t.step,10)&&a(Gc(qc({},t),{step:`${parseInt(t.step,10)}s`}))}),[a,t]);const g=(0,s.useCallback)((e=>{a(Gc(qc({},t),{direction:e})),l()}),[a,l,t]);(0,s.useEffect)((()=>{if(e!==r.CoreApp.Dashboard&&e!==r.CoreApp.PanelEditor)return;const i=(0,n.getAppEvents)().subscribe(r.LogSortOrderChangeEvent,(e=>{if(t.direction===Dc.ti.Scan)return;const n=e.payload.order===r.LogsSortOrder.Ascending?Dc.ti.Forward:Dc.ti.Backward;n!==t.direction&&g(n)}));return()=>{i.unsubscribe()}}),[e,g,t.direction]);let m=(0,Uc.Io)(t);const b=d.interpolateVariablesInQueries([t],Qc.a);var v;const y=(0,Uc.sI)(null!==(v=null===(p=b[0])||void 0===p?void 0:p.expr)&&void 0!==v?v:""),O=y?jc.filter((e=>e.value!==Dc.U3.Instant)):jc;y&&m===Dc.U3.Instant&&(a(Gc(qc({},t),{queryType:Dc.U3.Range})),m=Dc.U3.Range);const E=(0,s.useMemo)((()=>!t.step||"string"==typeof t.step&&(!!d.getVariables().includes(t.step)||(0,r.isValidGrafanaDuration)(t.step)&&!isNaN(parseInt(t.step,10)))),[t.step,d]);var x,S,w;return(0,i.jsx)(Pt,{children:(0,i.jsxs)(Lc,{title:"Options",collapsedInfo:Xc(t,m,h,y,E,t.direction),queryStats:u,children:[(0,i.jsx)(At,{label:"Legend",tooltip:"Series name override or template. Ex. {{hostname}} will be replaced with label value for hostname.",children:(0,i.jsx)(c.AutoSizeInput,{placeholder:"{{label}}",type:"string",minWidth:14,defaultValue:t.legendFormat,onCommitChange:e=>{a(Gc(qc({},t),{legendFormat:e.currentTarget.value})),l()}})}),O.length>1&&(0,i.jsx)(At,{label:"Type",children:(0,i.jsx)(c.RadioButtonGroup,{options:O,value:m,onChange:e=>{a(Gc(qc({},t),{queryType:e})),l()}})}),y&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(At,{label:"Line limit",tooltip:"Upper limit for number of log lines returned by query.",children:(0,i.jsx)(c.AutoSizeInput,{className:"width-4",placeholder:h.toString(),type:"number",min:0,defaultValue:null!==(x=null===(f=t.maxLines)||void 0===f?void 0:f.toString())&&void 0!==x?x:"",onCommitChange:function(e){const r=Bc(e.currentTarget.value);t.maxLines!==r&&(a(Gc(qc({},t),{maxLines:r})),l())}})}),(0,i.jsx)(At,{label:"Direction",tooltip:"Direction to search for logs.",children:(0,i.jsx)(c.RadioButtonGroup,{options:Fc,value:null!==(S=t.direction)&&void 0!==S?S:zc(e),onChange:g})})]}),!y&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(At,{label:"Step",tooltip:"Use the step parameter when making metric queries to Loki. If not filled, Grafana's calculated interval will be used. Example valid values: 1s, 5m, 10h, 1d.",invalid:!E,error:"Invalid step. Example valid values: 1s, 5m, 10h, 1d.",children:(0,i.jsx)(c.AutoSizeInput,{className:"width-6",placeholder:"auto",type:"string",value:null!==(w=t.step)&&void 0!==w?w:"",onCommitChange:function(e){a(Gc(qc({},t),{step:(0,o.trim)(e.currentTarget.value)})),l()}})})})]})})}));function Xc(e,t,r,n,i,a){const o=jc.find((e=>e.value===t)),s=[];var l;(e.legendFormat&&s.push(`Legend: ${e.legendFormat}`),s.push(`Type: ${null==o?void 0:o.label}`),n&&a)?(s.push(`Line limit: ${null!==(l=e.maxLines)&&void 0!==l?l:r}`),s.push(`Direction: ${function(e){var t,r;return null!==(r=null===(t=Fc.find((t=>t.value===e)))||void 0===t?void 0:t.label)&&void 0!==r?r:"Unknown"}(a)}`)):e.step&&s.push(`Step: ${i?e.step:"Invalid value"}`);return s}function zc(e){if(e!==r.CoreApp.Explore)return Dc.ti.Backward;return(r.store.get("grafana.explore.logs.sortOrder")||r.LogsSortOrder.Descending)===r.LogsSortOrder.Ascending?Dc.ti.Forward:Dc.ti.Backward}function Hc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Hc(e,t,r[t])}))}return e}Wc.displayName="LokiQueryBuilderOptions";const Kc=(0,s.lazy)((()=>b.e(952).then(b.bind(b,1020)))),Zc=e=>(0,i.jsx)(s.Suspense,{fallback:null,children:(0,i.jsx)(Kc,Yc({},e))});function Jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eu(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const tu=e=>{const t=(0,s.useRef)(null),{onRunQuery:r,onChange:n}=e,a=eu(e,["onRunQuery","onChange"]);return(0,i.jsx)(Zc,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Jc(e,t,r[t])}))}return e}({onRunQuery:e=>{t.current=e,n(e),r()},onBlur:e=>{n(e)},onChange:n},a))};function ru(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function nu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iu(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}class au extends s.PureComponent{componentDidMount(){return(e=function*(){this._isMounted=!0,yield this.props.datasource.languageProvider.start(this.props.range),this._isMounted&&this.setState({labelsLoaded:!0})},function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){ru(a,n,i,o,s,"next",e)}function s(e){ru(a,n,i,o,s,"throw",e)}o(void 0)}))}).call(this);var e}componentWillUnmount(){this._isMounted=!1}componentDidUpdate(e){const{range:t,datasource:{languageProvider:r}}=this.props;(0,u.WV)(t,e.range)&&r.fetchLabels({timeRange:t})}render(){const{ExtraFieldElement:e,query:t,datasource:r,history:n,onRunQuery:a,range:o}=this.props;var s;const l=null!==(s=this.props.placeholder)&&void 0!==s?s:"Enter a Loki query (run with Shift+Enter)";var c;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"gf-form-inline gf-form-inline--xs-view-flex-column flex-grow-1","data-testid":this.props["data-testid"],children:(0,i.jsx)("div",{className:"gf-form--grow flex-shrink-1 min-width-15",children:(0,i.jsx)(tu,{datasource:r,history:null!=n?n:[],onChange:this.onChangeQuery,onRunQuery:a,initialValue:null!==(c=t.expr)&&void 0!==c?c:"",placeholder:l,timeRange:o})})}),e]})}constructor(e){super(e),nu(this,"_isMounted",!1),nu(this,"onChangeQuery",((e,t)=>{const{query:r,onChange:n,onRunQuery:i}=this.props;if(n){const a=iu(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){nu(e,t,r[t])}))}return e}({},r),{expr:e});n(a),t&&i&&i()}})),this.state={labelsLoaded:!1}}}function ou({query:e,datasource:t,range:r,onRunQuery:n,onChange:a,data:o,app:s,showExplain:l,history:u}){const d=(0,c.useStyles2)(su);return(0,i.jsxs)("div",{className:d.wrapper,children:[(0,i.jsx)(au,{datasource:t,query:e,range:r,onRunQuery:n,onChange:a,history:u,data:o,app:s,"data-testid":Au.editor}),l&&(0,i.jsx)(nc,{query:e.expr})]})}const su=e=>({wrapper:(0,a.css)({maxWidth:"100%",".gf-form":{marginBottom:.5}}),buttonGroup:(0,a.css)({border:`1px solid ${e.colors.border.medium}`,borderTop:"none",padding:e.spacing(.5,.5,.5,.5),marginBottom:e.spacing(.5),display:"flex",flexGrow:1,justifyContent:"end",fontSize:e.typography.bodySmall.fontSize}),hint:(0,a.css)({color:e.colors.text.disabled,whiteSpace:"nowrap",cursor:"help"})});var lu=b(3496);const cu=e=>{const{pattern:t,onPatternSelect:r,hasNewQueryOption:n,hasPreviousQuery:a,selectedPatternName:o,setSelectedPatternName:s}=e,l=(0,c.useStyles2)(uu),u={grammar:Jl.Ay,name:"logql"};return(0,i.jsxs)(c.Card,{noMargin:!0,className:l.card,children:[(0,i.jsx)(c.Card.Heading,{children:t.name}),(0,i.jsx)("div",{className:l.rawQueryContainer,children:(0,i.jsx)(Gt,{query:Tt.y.renderQuery({labels:[],operations:t.operations}),language:u,className:l.rawQuery})}),(0,i.jsx)(c.Card.Actions,{children:o!==t.name?(0,i.jsx)(c.Button,{size:"sm",onClick:()=>{a?s(t.name):r(t)},children:"Use this query"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:l.spacing,children:`If you would like to use this query, ${n?"you can either replace your current query or create a new query":"your current query will be replaced"}.`}),(0,i.jsx)(c.Button,{size:"sm",fill:"outline",onClick:()=>s(null),children:"Back"}),(0,i.jsx)(c.Button,{size:"sm",onClick:()=>{r(t)},children:"Apply to query"}),n&&(0,i.jsx)(c.Button,{size:"sm",onClick:()=>{r(t,!0)},children:"Create new query"})]})})]})},uu=e=>({card:(0,a.css)({width:"49.5%",display:"flex",flexDirection:"column"}),rawQueryContainer:(0,a.css)({flexGrow:1}),rawQuery:(0,a.css)({backgroundColor:e.colors.background.primary,padding:e.spacing(1),marginTop:e.spacing(1)}),spacing:(0,a.css)({marginBottom:e.spacing(1)})});function du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){du(e,t,r[t])}))}return e}function fu(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const hu=[tc.Ln.Formats,tc.Ln.LineFilters,tc.Ln.LabelFilters],gu=[tc.EF.Unwrap],mu=lu.sp.filter((e=>e.category&&hu.includes(e.category)&&!gu.includes(e.id))).map((e=>e.id)),bu=e=>{const{isOpen:t,onClose:a,onChange:l,onAddQuery:u,query:d,queries:p,app:f}=e,[h,g]=(0,s.useState)([]),[m,b]=(0,s.useState)(null),v=(0,c.useStyles2)(vu),y=!!u,O=(0,s.useMemo)((()=>(0,Rt.u_)(d.expr).query.operations.length>0),[d.expr]),E=(e,t=!1)=>{const i=(0,Rt.u_)(t?"":d.expr);(0,n.reportInteraction)("grafana_loki_query_patterns_selected",{version:"v2",app:null!=f?f:"",editorMode:d.editorMode,selectedPattern:e.name,preSelectedOperationsCount:i.query.operations.length,preSelectedLabelsCount:i.query.labels.length,createNewQuery:y&&t}),i.query.operations=i.query.operations.filter((e=>mu.includes(e.id)));const o=e.operations.filter((e=>i.query.operations.findIndex((t=>t.id===e.id))<0));i.query.operations=[...i.query.operations,...o],y&&t?u(fu(pu({},d),{refId:(0,r.getNextRefId)(null!=p?p:[d]),expr:Tt.y.renderQuery(i.query)})):l(fu(pu({},d),{expr:Tt.y.renderQuery(i.query)})),b(null),a()};return(0,i.jsxs)(c.Modal,{isOpen:t,title:"Kick start your query",onDismiss:a,className:v.modal,children:[(0,i.jsx)("div",{className:v.spacing,children:"Kick start your query by selecting one of these queries. You can then continue to complete your query."}),Object.values(tc.IQ).map((e=>(0,i.jsx)(c.Collapse,{label:`${(0,o.capitalize)(e)} query starters`,isOpen:h.includes(e),onToggle:()=>g((t=>t.includes(e)?t.filter((t=>t!==e)):[...t,e])),children:(0,i.jsx)(c.Stack,{wrap:!0,justifyContent:"space-between",children:Tt.y.getQueryPatterns().filter((t=>t.type===e)).map((e=>(0,i.jsx)(cu,{pattern:e,hasNewQueryOption:y,hasPreviousQuery:O,onPatternSelect:E,selectedPatternName:m,setSelectedPatternName:b},e.name)))})},e))),(0,i.jsx)(c.Button,{variant:"secondary",onClick:a,children:"Close"})]})},vu=e=>({spacing:(0,a.css)({marginBottom:e.spacing(1)}),modal:(0,a.css)({width:"85vw",[e.breakpoints.down("md")]:{width:"100%"}})});function yu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ou(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){yu(e,t,r[t])}))}return e}function Eu(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const xu="LokiQueryEditorModeDefault";function Su(e){if(null!=e&&""!==e)return S.f.Code;return"code"===window.localStorage.getItem(xu)?S.f.Code:S.f.Builder}function wu(e,t){if(!e||!t)return!1;return(0,r.isDateTime)(e)?e.isSame(t):e===t}function Tu(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function Ru(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Ru(e,t,r[t])}))}return e}function Iu(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Au={editor:"loki-editor"},Lu="LokiQueryEditorExplainDefault",Cu=(0,s.memo)((e=>{const t=(0,s.useId)(),{onChange:a,onRunQuery:l,onAddQuery:u,data:d,app:p,queries:f,datasource:h,range:g}=e,[m,b]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1),[O,T]=(0,s.useState)(!1),[R,P]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null),[L,C]=(0,s.useState)("true"===window.localStorage.getItem(Lu)),_=E(g),N=function(e){let t=e;return e.editorMode||(t=Eu(Ou({},e),{editorMode:Su(e.expr)})),null==e.expr&&(t=Eu(Ou({},t),{expr:""})),null==e.queryType&&(t=Eu(Ou({},t),{queryType:Dc.U3.Range})),t}(e.query),D=E(N.expr),k=E(N.queryType),j=N.editorMode,M=(0,s.useCallback)((e=>{var t;if((0,n.reportInteraction)("grafana_loki_editor_mode_clicked",{newEditor:e,previousEditor:null!==(t=N.editorMode)&&void 0!==t?t:"",newQuery:!N.expr,app:null!=p?p:""}),e===S.f.Builder){if((0,Rt.u_)(N.expr||"").errors.length)return void b(!0)}!function(e,t,r){""===e.expr&&window.localStorage.setItem(xu,t),r(Eu(Ou({},e),{editorMode:t}))}(N,e,a)}),[a,N,p]);(0,s.useEffect)((()=>{T(!1)}),[d]);const U=t=>{(0,o.isEqual)(t,e.query)||T(!0),a(t)};return(0,s.useEffect)((()=>{const e=function(e,t,r,n,i,a){return void 0===t||e.trim()!==t.trim()||i!==a||!wu(null==r?void 0:r.raw.from,null==n?void 0:n.raw.from)||!wu(null==r?void 0:r.raw.to,null==n?void 0:n.raw.to)}(N.expr,D,g,_,N.queryType,k);if(e&&g){(()=>{return(e=function*(){const e=yield h.getStats(Iu(Pu({},N),{refId:`${t}_${N.refId}`}),g);A(e)},function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){Tu(a,n,i,o,s,"next",e)}function s(e){Tu(a,n,i,o,s,"throw",e)}o(void 0)}))})();var e})()}}),[h,g,_,N,D,k,A,t]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.ConfirmModal,{isOpen:m,title:"Query parsing",body:"There were errors while trying to parse the query. Continuing to visual builder may lose some parts of the query.",confirmText:"Continue",onConfirm:()=>{a(Iu(Pu({},N),{editorMode:S.f.Builder})),b(!1)},onDismiss:()=>b(!1)}),(0,i.jsx)(bu,{isOpen:v,onClose:()=>y(!1),query:N,queries:f,app:p,onChange:a,onAddQuery:u}),(0,i.jsx)(Ee,{isOpen:R,datasource:h,query:N,app:p,onClose:()=>P(!1),onChange:U,onRunQuery:l,timeRange:g}),(0,i.jsxs)(w,{children:[(0,i.jsxs)(c.Stack,{gap:1,children:[(0,i.jsx)(c.Button,{"data-testid":x.Tp.components.QueryBuilder.queryPatterns,variant:"secondary",size:"sm",onClick:()=>{y((e=>!e));const e=(0,Rt.u_)(N.expr||"");(0,n.reportInteraction)("grafana_loki_query_patterns_opened",{version:"v2",app:null!=p?p:"",editorMode:N.editorMode,preSelectedOperationsCount:e.query.operations.length,preSelectedLabelsCount:e.query.labels.length})},children:"Kick start your query"}),(0,i.jsx)(c.Button,{variant:"secondary",size:"sm",onClick:()=>{(0,n.reportInteraction)("grafana_loki_label_browser_opened",{app:p}),P((e=>!e))},"data-testid":"label-browser-button",children:"Label browser"})]}),(0,i.jsx)($,{label:"Explain query",value:L,onChange:e=>{window.localStorage.setItem(Lu,e.currentTarget.checked?"true":"false"),C(e.currentTarget.checked)}}),(0,i.jsx)(F,{grow:1}),p!==r.CoreApp.Explore&&p!==r.CoreApp.Correlations&&(0,i.jsx)(c.Button,{variant:O?"primary":"secondary",size:"sm",onClick:l,icon:(null==d?void 0:d.state)===r.LoadingState.Loading?"spinner":void 0,disabled:(null==d?void 0:d.state)===r.LoadingState.Loading,children:f&&f.length>1?"Run queries":"Run query"}),(0,i.jsx)(B,{mode:j,onChange:M})]}),(0,i.jsx)(c.Space,{v:.5}),(0,i.jsxs)(Q,{children:[j===S.f.Code&&(0,i.jsx)(ou,Iu(Pu({},e),{query:N,onChange:U,showExplain:L})),j===S.f.Builder&&(0,i.jsx)(wc,{datasource:e.datasource,query:N,onChange:U,onRunQuery:e.onRunQuery,showExplain:L,timeRange:g}),(0,i.jsx)(Wc,{query:N,onChange:a,onRunQuery:l,app:p,queryStats:I,datasource:e.datasource})]})]})}));function _u(e){const{query:t,data:r,datasource:n,onChange:a,onRunQuery:o,history:s}=e;return(0,i.jsx)(au,{datasource:n,query:t,onChange:a,onRunQuery:o,history:s,data:r,placeholder:"Enter a Loki query","data-testid":Nu.editor})}Cu.displayName="LokiQueryEditor";const Nu={editor:"loki-editor-cloud-alerting"};function Du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ku(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Du(e,t,r[t])}))}return e}function $u(e){const{app:t}=e;return t===r.CoreApp.CloudAlerting?(0,i.jsx)(_u,ku({},e)):(0,i.jsx)(Cu,ku({},e))}const ju=(0,s.memo)($u),Fu=({dataSourceName:e,docsLink:t,hasRequiredFields:r=!0,className:n})=>{const i=(0,c.useTheme2)(),o={container:(0,a.css)({p:{margin:0},"p + p":{marginTop:i.spacing(2)}}),text:(0,a.css)({...i.typography.body,color:i.colors.text.secondary,a:(0,a.css)({color:i.colors.text.link,textDecoration:"underline","&:hover":{textDecoration:"none"}})})};return s.createElement("div",{className:(0,a.cx)(o.container,n)},s.createElement("p",{className:o.text},"Before you can use the ",e," data source, you must configure it below or in the config file. For detailed instructions,"," ",s.createElement("a",{href:t,target:"_blank",rel:"noreferrer"},"view the documentation"),"."),r&&s.createElement("p",{className:o.text},s.createElement("i",null,"Fields marked with * are required")))},Mu=({children:e,title:t,description:r,isCollapsible:n=!1,isInitiallyOpen:i=!0,kind:o="section",className:l})=>{const{colors:u,typography:d,spacing:p}=(0,c.useTheme2)(),[f,h]=(0,s.useState)(!n||i),g=f?"angle-up":"angle-down",m="sub-section"===o,b=`${f?"Collapse":"Expand"} section ${t}`,v={header:(0,a.css)({display:"flex",justifyContent:"space-between",alignItems:"center"}),title:(0,a.css)({margin:0}),subtitle:(0,a.css)({margin:0,fontWeight:d.fontWeightRegular}),descriptionText:(0,a.css)({marginTop:p(m?.25:.5),marginBottom:0,...d.bodySmall,color:u.text.secondary}),content:(0,a.css)({marginTop:p(2)})};return s.createElement("div",{className:l},s.createElement("div",{className:v.header},"section"===o?s.createElement("h3",{className:v.title},t):s.createElement("h6",{className:v.subtitle},t),n&&s.createElement(c.IconButton,{name:g,onClick:()=>h(!f),type:"button",size:"xl","aria-label":b})),r&&s.createElement("p",{className:v.descriptionText},r),f&&s.createElement("div",{className:v.content},e))},Bu=({children:e,...t})=>s.createElement(Mu,{...t,kind:"section"},e),Qu=({config:e,onChange:t,description:r,urlPlaceholder:n,urlTooltip:i,urlLabel:o,className:l})=>{const u=void 0!==e.url&&/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/.test(e.url),d={container:(0,a.css)({maxWidth:578})};return s.createElement(s.Fragment,null,s.createElement(Bu,{title:"Connection",description:r,className:(0,a.cx)(d.container,l)},s.createElement(c.InlineField,{htmlFor:"connection-url",label:o||"URL",labelWidth:24,tooltip:i||s.createElement(s.Fragment,null,"Specify a complete HTTP URL",s.createElement("br",null),"(for example https://example.com:8080)"),grow:!0,disabled:e.readOnly,required:!0,invalid:!u&&!e.readOnly,error:u?"":"Please enter a valid URL",interactive:!0},s.createElement(c.Input,{id:"connection-url","aria-label":"Data source connection URL",onChange:r=>t({...e,url:r.currentTarget.value}),value:e.url||"",placeholder:n||"URL"}))))},Uu=()=>({inlineFieldNoMarginRight:(0,a.css)({marginRight:0}),inlineFieldWithSecret:(0,a.css)({'[class$="layoutChildrenWrapper"]:first-child':{flexGrow:1}})}),Vu=({user:e,passwordConfigured:t,userLabel:r="User",userTooltip:n="The username of the data source account",userPlaceholder:i="User",passwordLabel:o="Password",passwordTooltip:l="The password of the data source account",passwordPlaceholder:u="Password",onUserChange:d,onPasswordChange:p,onPasswordReset:f,readOnly:h})=>{const g=Uu(),m={lastInlineField:(0,a.css)({marginBottom:0})};return s.createElement(s.Fragment,null,s.createElement(c.InlineField,{className:g.inlineFieldNoMarginRight,label:r,labelWidth:24,tooltip:n,required:!0,htmlFor:"basic-auth-user-input",interactive:!0,grow:!0,disabled:h},s.createElement(c.Input,{id:"basic-auth-user-input",placeholder:i,value:e,onChange:e=>d(e.currentTarget.value),required:!0})),s.createElement(c.InlineField,{className:(0,a.cx)(g.inlineFieldNoMarginRight,g.inlineFieldWithSecret,m.lastInlineField),label:o,labelWidth:24,tooltip:l,required:!0,htmlFor:"basic-auth-password-input",interactive:!0,grow:!0,disabled:h},s.createElement(c.SecretInput,{id:"basic-auth-password-input",isConfigured:t,onReset:h?()=>{}:f,placeholder:u,onChange:e=>p(e.currentTarget.value),required:!0})))},qu=({children:e,...t})=>s.createElement(Mu,{...t,kind:"sub-section"},e);var Gu=(e=>(e.NoAuth="NoAuth",e.BasicAuth="BasicAuth",e.OAuthForward="OAuthForward",e.CrossSiteCredentials="CrossSiteCredentials",e))(Gu||{});const Wu={[Gu.BasicAuth]:{label:"Basic authentication",value:Gu.BasicAuth,description:"Authenticate with your data source username and password"},[Gu.CrossSiteCredentials]:{label:"Enable cross-site access control requests",value:Gu.CrossSiteCredentials,description:"Allow cross-site Access-Control requests with your existing credentials and cookies. This enables the server to authenticate the user and perform authorized requests on their behalf on other domains."},[Gu.OAuthForward]:{label:"Forward OAuth Identity",value:Gu.OAuthForward,description:"Forward the OAuth access token (and if available: the OIDC ID token) of the user querying to the data source"},[Gu.NoAuth]:{label:"No Authentication",value:Gu.NoAuth,description:"Data source is available without authentication"}},Xu=({selectedMethod:e,mostCommonMethod:t,visibleMethods:r,defaultOptionsOverrides:n,customMethods:i,onAuthMethodSelect:o,basicAuth:l,readOnly:u})=>{var d,p,f,h;const[g,m]=(0,s.useState)(!1),{colors:b,spacing:v}=(0,c.useTheme2)(),y=(0,s.useMemo)((()=>{var e;return null!=r?r:[Gu.BasicAuth,Gu.OAuthForward,Gu.NoAuth,...null!=(e=null==i?void 0:i.map((e=>e.id)))?e:[]]}),[i,r]),O=y.length>1,E=(0,s.useMemo)((()=>{var e;const r=null!=(e=null==i?void 0:i.reduce(((e,t)=>(e[t.id]={label:t.label,value:t.id,description:t.description},e)),{}))?e:{},a={};let o;for(o in Wu)a[o]={...Wu[o],...null==n?void 0:n[o]};const s={...r,...a};return y.filter((e=>Boolean(s[e]))).map((e=>{const r=s[e];return e===t&&O?{...r,label:`${r.label} (most common)`}:r}))}),[y,i,n,t,O]);let x=e;O?e===Gu.NoAuth&&t&&!g&&(x=t):x=y[0];let S=null;x===Gu.BasicAuth&&l?S=s.createElement(Vu,{...l,readOnly:u}):x.startsWith("custom-")&&(S=null!=(p=null==(d=null==i?void 0:i.find((e=>e.id===x)))?void 0:d.component)?p:null);const w=O?"Authentication methods":null!=(f=E[0].label)?f:"",T=O?"Choose an authentication method to access the data source":null!=(h=E[0].description)?h:"",R={authMethods:(0,a.css)({marginTop:v(2.5),...O&&{padding:v(2),border:`1px solid ${b.border.weak}`}}),selectedMethodFields:(0,a.css)({marginTop:v(1.5)})};return s.createElement(qu,{title:w,description:T},s.createElement("div",{className:R.authMethods},O&&s.createElement(c.Field,{label:"Authentication method"},s.createElement(c.Select,{inputId:"auth-method-select",options:E,value:x,onChange:e=>{m(!0),o(e.value)},disabled:u})),S&&s.createElement("div",{className:R.selectedMethodFields},S)))},zu=({children:e,enabled:t,label:r,tooltipText:n,onToggle:i,readOnly:o})=>{const{colors:l,spacing:u}=(0,c.useTheme2)(),d={container:(0,a.css)({marginTop:3}),checkboxContainer:(0,a.css)({display:"flex",alignItems:"center"}),infoIcon:(0,a.css)({marginTop:-2,marginLeft:5,color:l.text.secondary}),content:(0,a.css)({margin:u(1,0,2,3)})};return s.createElement("div",{className:d.container},s.createElement("div",{className:d.checkboxContainer},s.createElement(c.Checkbox,{value:t,label:r,onChange:()=>i(!t),disabled:o}),s.createElement(c.Tooltip,{placement:"top",content:n,interactive:!0},s.createElement(c.Icon,{name:"info-circle",className:d.infoIcon,size:"sm"}))),t&&e&&s.createElement("div",{className:d.content},e))},Hu=({enabled:e,certificateConfigured:t,onToggle:r,onCertificateChange:n,onCertificateReset:i,tooltips:o,readOnly:l})=>{var u;const d=Uu();return s.createElement(zu,{enabled:e,label:"Add self-signed certificate",tooltipText:"Add your own Certificate Authority (CA) certificate on top of one generated by the certificate authorities for additional security measures",onToggle:e=>r(e),readOnly:l},s.createElement(c.InlineField,{label:"CA Certificate",labelWidth:24,tooltip:null!=(u=null==o?void 0:o.certificateLabel)?u:"Your self-signed certificate",required:!0,htmlFor:"self-signed-certificate-input",interactive:!0,grow:!0,className:(0,a.cx)(d.inlineFieldNoMarginRight,d.inlineFieldWithSecret),disabled:l},s.createElement(c.SecretTextArea,{id:"self-signed-certificate-input",isConfigured:t,onChange:e=>n(e.currentTarget.value),onReset:l?()=>{}:i,placeholder:"Begins with --- BEGIN CERTIFICATE ---",rows:6,required:!0})))},Yu=({enabled:e,serverName:t,clientCertificateConfigured:r,clientKeyConfigured:n,onToggle:i,onServerNameChange:o,onClientCertificateChange:l,onClientKeyChange:u,onClientCertificateReset:d,onClientKeyReset:p,tooltips:f,readOnly:h})=>{var g,m,b;const v=Uu();return s.createElement(zu,{enabled:e,label:"TLS Client Authentication",tooltipText:"Validate using TLS client authentication, in which the server authenticates the client",onToggle:e=>i(e),readOnly:h},s.createElement(c.InlineField,{label:"ServerName",labelWidth:24,tooltip:null!=(g=null==f?void 0:f.serverNameLabel)?g:"A Servername is used to verify the hostname on the returned certificate",required:!0,htmlFor:"client-auth-servername-input",interactive:!0,grow:!0,className:v.inlineFieldNoMarginRight,disabled:h},s.createElement(c.Input,{id:"client-auth-servername-input",placeholder:"domain.example.com",value:t,onChange:e=>o(e.currentTarget.value),required:!0})),s.createElement(c.InlineField,{label:"Client Certificate",labelWidth:24,tooltip:null!=(m=null==f?void 0:f.certificateLabel)?m:"The client certificate can be generated from a Certificate Authority or be self-signed",required:!0,htmlFor:"client-auth-client-certificate-input",interactive:!0,grow:!0,className:(0,a.cx)(v.inlineFieldNoMarginRight,v.inlineFieldWithSecret),disabled:h},s.createElement(c.SecretTextArea,{id:"client-auth-client-certificate-input",isConfigured:r,onChange:e=>l(e.currentTarget.value),onReset:h?()=>{}:d,placeholder:"Begins with --- BEGIN CERTIFICATE ---",rows:6,required:!0})),s.createElement(c.InlineField,{label:"Client Key",labelWidth:24,tooltip:null!=(b=null==f?void 0:f.keyLabel)?b:"The client key can be generated from a Certificate Authority or be self-signed",required:!0,htmlFor:"client-auth-client-key-input",interactive:!0,grow:!0,className:(0,a.cx)(v.inlineFieldNoMarginRight,v.inlineFieldWithSecret),disabled:h},s.createElement(c.SecretTextArea,{id:"client-auth-client-key-input",isConfigured:n,onChange:e=>u(e.currentTarget.value),onReset:h?()=>{}:p,placeholder:"Begins with --- RSA PRIVATE KEY CERTIFICATE ---",rows:6,required:!0})))},Ku=({enabled:e,onToggle:t,readOnly:r})=>s.createElement(zu,{enabled:e,label:"Skip TLS certificate validation",tooltipText:"Skipping TLS certificate validation is not recommended unless absolutely necessary or for testing",onToggle:e=>t(e),readOnly:r}),Zu=({selfSignedCertificate:e,TLSClientAuth:t,skipTLSVerification:r,readOnly:n})=>{const{spacing:i}=(0,c.useTheme2)(),o={container:(0,a.css)({marginTop:i(3)})};return s.createElement(qu,{className:o.container,title:"TLS settings",description:"Additional security measures that can be applied on top of authentication"},s.createElement(Hu,{...e,readOnly:n}),s.createElement(Yu,{...t,readOnly:n}),s.createElement(Ku,{...r,readOnly:n}))},Ju=({header:e,onChange:t,onBlur:r,onDelete:n,readOnly:i})=>{const{spacing:o}=(0,c.useTheme2)(),l=Uu(),u={container:(0,a.css)({alignItems:"center"}),input:(0,a.css)({minWidth:"100%"}),headerNameField:(0,a.css)({width:"40%",marginRight:0,paddingRight:o(1)}),headerValueField:(0,a.css)({width:"45%",marginRight:0}),removeHeaderBtn:(0,a.css)({margin:"0 0 3px 10px"})};return s.createElement(s.Fragment,null,s.createElement(c.InlineFieldRow,{className:u.container},s.createElement(c.InlineField,{label:"Header",labelWidth:9,grow:!0,className:u.headerNameField,htmlFor:`custom-header-${e.id}-name-input`,disabled:i},s.createElement(c.Input,{id:`custom-header-${e.id}-name-input`,placeholder:"X-Custom-Header",value:e.name,width:12,onChange:r=>t({...e,name:r.currentTarget.value}),onBlur:r,className:u.input})),s.createElement(c.InlineField,{label:"Value",labelWidth:9,grow:!0,className:(0,a.cx)(l.inlineFieldWithSecret,u.headerValueField),htmlFor:`custom-header-${e.id}-value-input`,disabled:i},s.createElement(c.SecretInput,{id:`custom-header-${e.id}-value-input`,isConfigured:e.configured,placeholder:"Header value",value:e.value,width:12,onChange:r=>t({...e,value:r.currentTarget.value}),onReset:i?()=>{}:()=>t({...e,configured:!1,value:""}),onBlur:r,className:u.input})),s.createElement(c.IconButton,{name:"trash-alt",tooltip:"Remove header",tooltipPlacement:"top",className:u.removeHeaderBtn,onClick:n,type:"button",disabled:i})))},ed=({headers:e,onChange:t,readOnly:r})=>{const{spacing:n}=(0,c.useTheme2)(),[i,o]=(0,s.useState)(e.map((e=>({...e,id:td(),value:""}))));(0,s.useEffect)((()=>{o((t=>{let r=!1;const n=t.map((t=>{var n;const i=null==(n=e.find((e=>e.name===t.name)))?void 0:n.configured;return void 0!==i&&t.configured!==i?(r=!0,{...t,configured:i}):t}));return r?n:t}))}),[e]);const l=()=>{t(i.map((({name:e,value:t,configured:r})=>({name:e,value:t,configured:r}))))},u={container:(0,a.css)({marginTop:n(3)}),addHeaderButton:(0,a.css)({marginTop:n(1.5)})};return s.createElement("div",{className:u.container},s.createElement(qu,{title:"HTTP headers",description:"Pass along additional context and metadata about the request/response",isCollapsible:!0,isInitiallyOpen:i.length>0},s.createElement("div",null,i.map((e=>s.createElement(Ju,{key:e.id,header:e,onChange:e=>((e,t)=>{o(i.map((r=>r.id===e?{...t}:r)))})(e.id,e),onDelete:()=>(e=>{const r=i.findIndex((t=>t.id===e));if(-1===r)return;const n=[...i];n.splice(r,1),o(n),t(n.map((({name:e,value:t,configured:r})=>({name:e,value:t,configured:r}))))})(e.id),onBlur:l,readOnly:r})))),s.createElement("div",{className:u.addHeaderButton},s.createElement(c.Button,{icon:"plus",variant:"secondary",fill:"outline",onClick:()=>{o([...i,{id:td(),name:"",value:"",configured:!1}])},disabled:r},0===i.length?"Add header":"Add another header"))))};function td(){return Math.random().toString(16).slice(2)}const rd=({selectedMethod:e,mostCommonMethod:t,visibleMethods:r,defaultOptionsOverrides:n,customMethods:i,onAuthMethodSelect:o,basicAuth:l,TLS:c,customHeaders:u,readOnly:d=!1})=>{const p={container:(0,a.css)({maxWidth:578})};return s.createElement("div",{className:p.container},s.createElement(Bu,{title:"Authentication"},s.createElement(Xu,{selectedMethod:e,mostCommonMethod:t,customMethods:i,visibleMethods:r,defaultOptionsOverrides:n,onAuthMethodSelect:o,basicAuth:l,readOnly:d}),c&&s.createElement(Zu,{...c,readOnly:d}),u&&s.createElement(ed,{...u,readOnly:d})))},nd="httpHeaderName",id="httpHeaderValue";function ad({config:e,onChange:t}){return{selectedMethod:od(e),onAuthMethodSelect:sd(e,t),basicAuth:ld(e,t),TLS:cd(e,t),customHeaders:ud(e,t),readOnly:e.readOnly}}function od(e){return e.basicAuth?Gu.BasicAuth:e.withCredentials?Gu.CrossSiteCredentials:e.jsonData.oauthPassThru?Gu.OAuthForward:Gu.NoAuth}function sd(e,t){return r=>{t({...e,basicAuth:r===Gu.BasicAuth,withCredentials:r===Gu.CrossSiteCredentials,jsonData:{...e.jsonData,oauthPassThru:r===Gu.OAuthForward}})}}function ld(e,t){return{user:e.basicAuthUser,passwordConfigured:e.secureJsonFields.basicAuthPassword,onUserChange:r=>t({...e,basicAuthUser:r}),onPasswordChange:r=>t({...e,secureJsonData:{...e.secureJsonData,basicAuthPassword:r}}),onPasswordReset:()=>t({...e,secureJsonData:{...e.secureJsonData,basicAuthPassword:""},secureJsonFields:{...e.secureJsonFields,basicAuthPassword:!1}})}}function cd(e,t){var r,n,i;return{selfSignedCertificate:{enabled:Boolean(e.jsonData.tlsAuthWithCACert),certificateConfigured:!!(null==(r=e.secureJsonFields)?void 0:r.tlsCACert),onToggle:r=>t(r?{...e,jsonData:{...e.jsonData,tlsAuthWithCACert:r}}:{...e,jsonData:{...e.jsonData,tlsAuthWithCACert:r},secureJsonData:{...e.secureJsonData,tlsCACert:""},secureJsonFields:{...e.secureJsonFields,tlsCACert:!1}}),onCertificateChange:r=>t({...e,secureJsonData:{...e.secureJsonData,tlsCACert:r}}),onCertificateReset:()=>t({...e,secureJsonData:{...e.secureJsonData,tlsCACert:""},secureJsonFields:{...e.secureJsonFields,tlsCACert:!1}})},TLSClientAuth:{enabled:e.jsonData.tlsAuth,serverName:e.jsonData.serverName,clientCertificateConfigured:!!(null==(n=e.secureJsonFields)?void 0:n.tlsClientCert),clientKeyConfigured:!!(null==(i=e.secureJsonFields)?void 0:i.tlsClientKey),onToggle:r=>t(r?{...e,jsonData:{...e.jsonData,tlsAuth:r}}:{...e,jsonData:{...e.jsonData,tlsAuth:r,serverName:""},secureJsonData:{...e.secureJsonData,tlsClientCert:"",tlsClientKey:""},secureJsonFields:{...e.secureJsonFields,tlsClientCert:!1,tlsClientKey:!1}}),onServerNameChange:r=>t({...e,jsonData:{...e.jsonData,serverName:r}}),onClientCertificateChange:r=>t({...e,secureJsonData:{...e.secureJsonData,tlsClientCert:r}}),onClientCertificateReset:()=>t({...e,secureJsonData:{...e.secureJsonData,tlsClientCert:""},secureJsonFields:{...e.secureJsonFields,tlsClientCert:!1}}),onClientKeyChange:r=>t({...e,secureJsonData:{...e.secureJsonData,tlsClientKey:r}}),onClientKeyReset:()=>t({...e,secureJsonData:{...e.secureJsonData,tlsClientKey:""},secureJsonFields:{...e.secureJsonFields,tlsClientKey:!1}})},skipTLSVerification:{enabled:e.jsonData.tlsSkipVerify,onToggle:r=>t({...e,jsonData:{...e.jsonData,tlsSkipVerify:r}})}}}function ud(e,t){return{headers:Object.keys(e.jsonData).filter((e=>e.startsWith(nd))).sort().map((t=>{var r;const n=t.slice(14);return{name:e.jsonData[t],configured:null!=(r=e.secureJsonFields[`${id}${n}`])&&r}})),onChange:r=>{const n=Object.fromEntries(Object.entries(e.jsonData).filter((([e])=>!e.startsWith(nd)))),i=Object.fromEntries(Object.entries(e.secureJsonData||{}).filter((([e])=>!e.startsWith(id)))),a=Object.fromEntries(Object.entries(e.secureJsonFields).filter((([e])=>!e.startsWith(id))));r.forEach(((e,t)=>{n[`${nd}${t+1}`]=e.name,e.configured?a[`${id}${t+1}`]=!0:i[`${id}${t+1}`]=e.value})),t({...e,jsonData:n,secureJsonData:i,secureJsonFields:a})}}}const dd=({config:e,onChange:t,className:r})=>{const n={container:(0,a.css)({maxWidth:578})};return s.createElement(qu,{title:"Advanced HTTP settings",className:(0,a.cx)(n.container,r)},s.createElement(c.InlineField,{htmlFor:"advanced-http-cookies",label:"Allowed cookies",labelWidth:24,tooltip:"Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",disabled:e.readOnly,grow:!0},s.createElement(c.TagsInput,{id:"advanced-http-cookies",placeholder:"New cookie (hit enter to add)",tags:e.jsonData.keepCookies,onChange:r=>{t({...e,jsonData:{...e.jsonData,keepCookies:r}})}})),s.createElement(c.InlineField,{htmlFor:"advanced-http-timeout",label:"Timeout",labelWidth:24,tooltip:"HTTP request timeout in seconds",disabled:e.readOnly,grow:!0},s.createElement(c.Input,{id:"advanced-http-timeout",type:"number",min:0,placeholder:"Timeout in seconds","aria-label":"Timeout in seconds",value:e.jsonData.timeout,onChange:r=>{t({...e,jsonData:{...e.jsonData,timeout:parseInt(r.currentTarget.value,10)}})}})))};function pd(e){const{description:t,suffix:r,feature:n}=e,i=`Learn more about ${n}`,a=(0,c.useStyles2)(fd);return s.createElement("span",{className:a.container},t,s.createElement("a",{"aria-label":i,href:`https://grafana.com/docs/grafana/next/datasources/${r}`,rel:"noreferrer",target:"_blank"},i))}const fd=e=>({container:(0,a.css)({color:e.colors.text.secondary,a:(0,a.css)({color:e.colors.text.link,textDecoration:"underline",marginLeft:"5px","&:hover":{textDecoration:"none"}})})});function hd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){hd(e,t,r[t])}))}return e}function md(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function bd({options:e,onOptionsChange:t}){return(0,i.jsx)(qu,{title:"Alerting",description:(0,i.jsx)(pd,{description:"Manage alert rules for the Loki data source.",suffix:"loki/configure-loki-data-source/#alerting",feature:"alerting"}),children:(0,i.jsx)(c.InlineField,{labelWidth:29,label:"Manage alert rules in Alerting UI",disabled:e.readOnly,tooltip:"Manage alert rules for this data source. To manage other alerting resources, add an Alertmanager data source.",children:(0,i.jsx)(c.InlineSwitch,{value:!1!==e.jsonData.manageAlerts,onChange:r=>t(md(gd({},e),{jsonData:md(gd({},e.jsonData),{manageAlerts:r.currentTarget.checked})}))})})})}const vd=e=>{const{derivedFields:t,className:r}=e,[a,o]=(0,s.useState)("");let l=[];return a&&t&&(l=function(e,t){return e.filter((e=>e.name&&e.matcherRegex)).map((e=>{try{const r=t.match(e.matcherRegex);let i;const a=r&&r[1];a&&(i=(0,n.getTemplateSrv)().replace(e.url,{__value:{value:{raw:a},text:"Raw value"}}));return{name:e.name,value:a||"<no match>",href:i}}catch(t){return{name:e.name,error:t}}}))}(t,a)),(0,i.jsxs)("div",{className:r,children:[(0,i.jsx)(c.InlineField,{label:"Debug log message",labelWidth:24,grow:!0,children:(0,i.jsx)(c.TextArea,{type:"text","aria-label":"Loki query",placeholder:"Paste an example log line here to test the regular expressions of your derived fields",value:a,onChange:e=>o(e.currentTarget.value)})}),!!l.length&&(0,i.jsx)(yd,{fields:l})]})},yd=({fields:e})=>(0,i.jsxs)("table",{className:"filter-table",children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:"Name"}),(0,i.jsx)("th",{children:"Value"}),(0,i.jsx)("th",{children:"Url"})]})}),(0,i.jsx)("tbody",{children:e.map((e=>{let t=e.value;return e.error&&e.error instanceof Error?t=e.error.message:e.href&&(t=(0,i.jsx)("a",{href:e.href,children:t})),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:e.name}),(0,i.jsx)("td",{children:t}),(0,i.jsx)("td",{children:e.href?(0,i.jsx)("a",{href:e.href,children:e.href}):""})]},`${e.name}=${e.value}`)}))})]});function Od(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ed(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Od(e,t,r[t])}))}return e}function xd(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Sd=e=>({row:(0,a.css)({display:"flex",alignItems:"baseline"}),nameField:(0,a.css)({flex:2,marginRight:e.spacing(.5)}),regexField:(0,a.css)({flex:3,marginRight:e.spacing(.5)}),urlField:(0,a.css)({flex:1,marginRight:e.spacing(.5)}),urlDisplayLabelField:(0,a.css)({flex:1}),internalLink:(0,a.css)({marginRight:e.spacing(1)}),openNewTab:(0,a.css)({marginRight:e.spacing(1)}),dataSource:(0,a.css)({}),nameMatcherField:(0,a.css)({width:e.spacing(20),marginRight:e.spacing(.5)})}),wd=e=>{const{value:t,onChange:r,onDelete:a,suggestions:o,className:l,validateName:u}=e,d=(0,c.useStyles2)(Sd),[p,f]=(0,s.useState)(!!t.datasourceUid),[h,g]=(0,s.useState)(!!t.targetBlank),m=E(t.datasourceUid);var b;const[v,y]=(0,s.useState)(null!==(b=t.matcherType)&&void 0!==b?b:"regex");(0,s.useEffect)((()=>{m||!t.datasourceUid||p||f(!0),m&&!t.datasourceUid&&p&&f(!1)}),[m,t.datasourceUid,p]);const O=e=>n=>{r(xd(Ed({},t),{[e]:n.currentTarget.value}))},x=!u(t.name);return(0,i.jsxs)("div",{className:l,"data-testid":"derived-field",children:[(0,i.jsxs)("div",{className:"gf-form",children:[(0,i.jsx)(c.Field,{className:d.nameField,label:"Name",invalid:x,error:"The name is already in use",children:(0,i.jsx)(c.Input,{value:t.name,onChange:O("name"),placeholder:"Field name",invalid:x})}),(0,i.jsx)(c.Field,{className:d.nameMatcherField,label:(0,i.jsx)(Td,{label:"Type",content:"Derived fields can be created from labels or by applying a regular expression to the log message."}),children:(0,i.jsx)(c.Select,{options:[{label:"Regex in log line",value:"regex"},{label:"Label",value:"label"}],value:v,onChange:e=>{"label"!==e.value&&"regex"!==e.value||(y(e.value),r(xd(Ed({},t),{matcherType:e.value})))}})}),(0,i.jsx)(c.Field,{className:d.regexField,label:(0,i.jsxs)(i.Fragment,{children:["regex"===v&&(0,i.jsx)(Td,{label:"Regex",content:"Use to parse and capture some part of the log message. You can use the captured groups in the template."}),"label"===v&&(0,i.jsx)(Td,{label:"Label",content:"Use to derive the field from a label."})]}),children:(0,i.jsx)(c.Input,{value:t.matcherRegex,onChange:O("matcherRegex")})}),(0,i.jsx)(c.Field,{label:"",children:(0,i.jsx)(c.Button,{variant:"destructive","aria-label":"Remove field",icon:"times",onClick:e=>{e.preventDefault(),a()}})})]}),(0,i.jsxs)("div",{className:"gf-form",children:[(0,i.jsx)(c.Field,{label:p?"Query":"URL",className:d.urlField,children:(0,i.jsx)(c.DataLinkInput,{placeholder:p?"${__value.raw}":"http://example.com/${__value.raw}",value:t.url||"",onChange:e=>r(xd(Ed({},t),{url:e})),suggestions:o})}),(0,i.jsx)(c.Field,{className:d.urlDisplayLabelField,label:(0,i.jsx)(Td,{label:"URL Label",content:"Use to override the button label when this derived field is found in a log."}),children:(0,i.jsx)(c.Input,{value:t.urlDisplayLabel,onChange:O("urlDisplayLabel")})})]}),(0,i.jsxs)("div",{className:"gf-form",children:[(0,i.jsx)(c.Field,{label:"Internal link",className:d.internalLink,children:(0,i.jsx)(c.Switch,{value:p,onChange:e=>{const{checked:n}=e.currentTarget;n||r(xd(Ed({},t),{datasourceUid:void 0})),f(n)}})}),p&&(0,i.jsx)(c.Field,{label:"",className:d.dataSource,children:(0,i.jsx)(n.DataSourcePicker,{tracing:!0,onChange:e=>r(xd(Ed({},t),{datasourceUid:e.uid})),current:t.datasourceUid,noDefault:!0})})]}),(0,i.jsx)("div",{className:"gf-form",children:(0,i.jsx)(c.Field,{label:"Open in new tab",className:d.openNewTab,children:(0,i.jsx)(c.Switch,{value:h,onChange:e=>{const{checked:n}=e.currentTarget;r(xd(Ed({},t),{targetBlank:n})),g(n)}})})})]})},Td=({content:e,label:t})=>(0,i.jsxs)(c.Label,{children:[t,(0,i.jsx)(c.Tooltip,{placement:"top",content:e,theme:"info",children:(0,i.jsx)(c.Icon,{tabIndex:0,name:"info-circle",size:"sm",style:{marginLeft:"10px"}})})]}),Rd=({fields:e=[],onChange:t})=>{const n=(e=>({addButton:(0,a.css)({marginRight:"10px"}),derivedField:(0,a.css)({marginBottom:e.spacing(1)}),container:(0,a.css)({marginBottom:e.spacing(4)}),debugSection:(0,a.css)({marginTop:e.spacing(4)})}))((0,c.useTheme2)()),[o,l]=(0,s.useState)(!1),u=(0,s.useCallback)((t=>e.filter((e=>e.name&&e.name===t)).length<=1),[e]);return(0,i.jsx)(qu,{title:"Derived fields",description:(0,i.jsx)(pd,{description:"Derived fields can be used to extract new fields from a log message and create a link from its value.",suffix:"loki/configure-loki-data-source/#derived-fields",feature:"derived fields"}),children:(0,i.jsxs)("div",{className:n.container,children:[e.map(((a,o)=>(0,i.jsx)(wd,{className:n.derivedField,value:a,onChange:r=>{const n=[...e];n.splice(o,1,r),t(n)},onDelete:()=>{const r=[...e];r.splice(o,1),t(r)},validateName:u,suggestions:[{value:r.DataLinkBuiltInVars.valueRaw,label:"Raw value",documentation:"Exact string captured by the regular expression",origin:r.VariableOrigin.Value}]},o))),(0,i.jsxs)("div",{children:[(0,i.jsx)(c.Button,{variant:"secondary",className:n.addButton,icon:"plus",onClick:r=>{r.preventDefault();const n=[...e,{name:"",matcherRegex:"",urlDisplayLabel:"",url:"",matcherType:"regex"}];t(n)},children:"Add"}),e.length>0&&(0,i.jsx)(c.Button,{variant:"secondary",type:"button",onClick:()=>l(!o),children:o?"Hide example log message":"Show example log message"})]}),o&&(0,i.jsx)("div",{className:n.debugSection,children:(0,i.jsx)(vd,{className:(0,a.css)({marginBottom:"10px"}),derivedFields:e})})]})})},Pd=e=>{const{maxLines:t,onMaxLinedChange:r}=e;return(0,i.jsx)(qu,{title:"Queries",description:(0,i.jsx)(pd,{description:"Additional options to customize your querying experience.",suffix:"loki/configure-loki-data-source/#queries",feature:"query settings"}),children:(0,i.jsx)(c.InlineField,{label:"Maximum lines",htmlFor:"loki_config_maxLines",labelWidth:22,tooltip:(0,i.jsx)(i.Fragment,{children:"Loki queries must contain a limit of the maximum number of lines returned (default: 1000). Increase this limit to have a bigger result set for ad-hoc analysis. Decrease this limit if your browser becomes sluggish when displaying the log results."}),children:(0,i.jsx)(c.Input,{type:"number",id:"loki_config_maxLines",value:t,onChange:e=>r(e.currentTarget.value),width:16,placeholder:"1000",spellCheck:!1})})})};function Id(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ad(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Id(e,t,r[t])}))}return e}function Ld(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Cd=e=>(t,r)=>Ld(Ad({},t),{jsonData:Ld(Ad({},t.jsonData),{[e]:r})}),_d=Cd("maxLines"),Nd=Cd("derivedFields");var Dd=b(5508);const kd="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,$d=new Set,jd="object"==typeof process&&process?process:{},Fd=(e,t,r,n)=>{"function"==typeof jd.emitWarning?jd.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)};let Md=globalThis.AbortController,Bd=globalThis.AbortSignal;if(void 0===Md){Bd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},Md=class{constructor(){t()}signal=new Bd;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==jd.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,Fd("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}Symbol("type");const Qd=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Ud=e=>Qd(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Vd:null:null;class Vd extends Array{constructor(e){super(e),this.fill(0)}}class qd{heap;length;static#e=!1;static create(e){const t=Ud(e);if(!t)return[];qd.#e=!0;const r=new qd(e,t);return qd.#e=!1,r}constructor(e,t){if(!qd.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class Gd{#t;#r;#n;#i;#a;#o;#s;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#d;#p;#f;#h;#g;#m;#b;#v;#y;#O;#E;#x;#S;#w;#T;#R;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#x,sizes:e.#O,keyMap:e.#d,keyList:e.#p,valList:e.#f,next:e.#h,prev:e.#g,get head(){return e.#m},get tail(){return e.#b},free:e.#v,isBackgroundFetch:t=>e.#P(t),backgroundFetch:(t,r,n,i)=>e.#I(t,r,n,i),moveToTail:t=>e.#A(t),indexes:t=>e.#L(t),rindexes:t=>e.#C(t),isStale:t=>e.#_(t)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#s}get dispose(){return this.#n}get onInsert(){return this.#i}get disposeAfter(){return this.#a}constructor(e){const{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:s,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:p,maxSize:f=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:m,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:E,ignoreFetchAbort:x,perf:S}=e;if(void 0!==S&&"function"!=typeof S?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#l=S??kd,0!==t&&!Qd(t))throw new TypeError("max option must be a nonnegative integer");const w=t?Ud(t):Array;if(!w)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=f,this.maxEntrySize=h||this.#r,this.sizeCalculation=g,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==b&&"function"!=typeof b)throw new TypeError("memoMethod must be a function if defined");if(this.#s=b,void 0!==m&&"function"!=typeof m)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=m,this.#w=!!m,this.#d=new Map,this.#p=new Array(t).fill(void 0),this.#f=new Array(t).fill(void 0),this.#h=new w(t),this.#g=new w(t),this.#m=0,this.#b=0,this.#v=qd.create(t),this.#c=0,this.#u=0,"function"==typeof l&&(this.#n=l),"function"==typeof c&&(this.#i=c),"function"==typeof u?(this.#a=u,this.#y=[]):(this.#a=void 0,this.#y=void 0),this.#S=!!this.#n,this.#R=!!this.#i,this.#T=!!this.#a,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.#r&&!Qd(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Qd(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#N()}if(this.allowStale=!!s,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Qd(n)||0===n?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!Qd(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(0===this.#t&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){const e="LRU_CACHE_UNBOUNDED";if((e=>!$d.has(e))(e)){$d.add(e);Fd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,Gd)}}}getRemainingTTL(e){return this.#d.has(e)?1/0:0}#D(){const e=new Vd(this.#t),t=new Vd(this.#t);this.#x=e,this.#E=t,this.#k=(r,n,i=this.#l.now())=>{if(t[r]=0!==n?i:0,e[r]=n,0!==n&&this.ttlAutopurge){const e=setTimeout((()=>{this.#_(r)&&this.#$(this.#p[r],"expire")}),n+1);e.unref&&e.unref()}},this.#j=r=>{t[r]=0!==e[r]?this.#l.now():0},this.#F=(i,a)=>{if(e[a]){const o=e[a],s=t[a];if(!o||!s)return;i.ttl=o,i.start=s,i.now=r||n();const l=i.now-s;i.remainingTTL=o-l}};let r=0;const n=()=>{const e=this.#l.now();if(this.ttlResolution>0){r=e;const t=setTimeout((()=>r=0),this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{const a=this.#d.get(i);if(void 0===a)return 0;const o=e[a],s=t[a];if(!o||!s)return 1/0;return o-((r||n())-s)},this.#_=i=>{const a=t[i],o=e[i];return!!o&&!!a&&(r||n())-a>o}}#j=()=>{};#F=()=>{};#k=()=>{};#_=()=>!1;#N(){const e=new Vd(this.#t);this.#u=0,this.#O=e,this.#M=t=>{this.#u-=e[t],e[t]=0},this.#B=(e,t,r,n)=>{if(this.#P(t))return 0;if(!Qd(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!Qd(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#Q=(t,r,n)=>{if(e[t]=r,this.#r){const r=this.#r-e[t];for(;this.#u>r;)this.#U(!0)}this.#u+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#u)}}#M=e=>{};#Q=(e,t,r)=>{};#B=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#b;this.#V(t)&&(!e&&this.#_(t)||(yield t),t!==this.#m);)t=this.#g[t]}*#C({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;this.#V(t)&&(!e&&this.#_(t)||(yield t),t!==this.#b);)t=this.#h[t]}#V(e){return void 0!==e&&this.#d.get(this.#p[e])===e}*entries(){for(const e of this.#L())void 0===this.#f[e]||void 0===this.#p[e]||this.#P(this.#f[e])||(yield[this.#p[e],this.#f[e]])}*rentries(){for(const e of this.#C())void 0===this.#f[e]||void 0===this.#p[e]||this.#P(this.#f[e])||(yield[this.#p[e],this.#f[e]])}*keys(){for(const e of this.#L()){const t=this.#p[e];void 0===t||this.#P(this.#f[e])||(yield t)}}*rkeys(){for(const e of this.#C()){const t=this.#p[e];void 0===t||this.#P(this.#f[e])||(yield t)}}*values(){for(const e of this.#L()){void 0===this.#f[e]||this.#P(this.#f[e])||(yield this.#f[e])}}*rvalues(){for(const e of this.#C()){void 0===this.#f[e]||this.#P(this.#f[e])||(yield this.#f[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#L()){const n=this.#f[r],i=this.#P(n)?n.__staleWhileFetching:n;if(void 0!==i&&e(i,this.#p[r],this))return this.get(this.#p[r],t)}}forEach(e,t=this){for(const r of this.#L()){const n=this.#f[r],i=this.#P(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#p[r],this)}}rforEach(e,t=this){for(const r of this.#C()){const n=this.#f[r],i=this.#P(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#p[r],this)}}purgeStale(){let e=!1;for(const t of this.#C({allowStale:!0}))this.#_(t)&&(this.#$(this.#p[t],"expire"),e=!0);return e}info(e){const t=this.#d.get(e);if(void 0===t)return;const r=this.#f[t],n=this.#P(r)?r.__staleWhileFetching:r;if(void 0===n)return;const i={value:n};if(this.#x&&this.#E){const e=this.#x[t],r=this.#E[t];if(e&&r){const t=e-(this.#l.now()-r);i.ttl=t,i.start=Date.now()}}return this.#O&&(i.size=this.#O[t]),i}dump(){const e=[];for(const t of this.#L({allowStale:!0})){const r=this.#p[t],n=this.#f[t],i=this.#P(n)?n.__staleWhileFetching:n;if(void 0===i||void 0===r)continue;const a={value:i};if(this.#x&&this.#E){a.ttl=this.#x[t];const e=this.#l.now()-this.#E[t];a.start=Math.floor(Date.now()-e)}this.#O&&(a.size=this.#O[t]),e.unshift([r,a])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const e=Date.now()-r.start;r.start=this.#l.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=r;let{noUpdateTTL:l=this.noUpdateTTL}=r;const c=this.#B(e,t,r.size||0,o);if(this.maxEntrySize&&c>this.maxEntrySize)return s&&(s.set="miss",s.maxEntrySizeExceeded=!0),this.#$(e,"set"),this;let u=0===this.#c?void 0:this.#d.get(e);if(void 0===u)u=0===this.#c?this.#b:0!==this.#v.length?this.#v.pop():this.#c===this.#t?this.#U(!1):this.#c,this.#p[u]=e,this.#f[u]=t,this.#d.set(e,u),this.#h[this.#b]=u,this.#g[u]=this.#b,this.#b=u,this.#c++,this.#Q(u,c,s),s&&(s.set="add"),l=!1,this.#R&&this.#i?.(t,e,"add");else{this.#A(u);const r=this.#f[u];if(t!==r){if(this.#w&&this.#P(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||a||(this.#S&&this.#n?.(t,e,"set"),this.#T&&this.#y?.push([t,e,"set"]))}else a||(this.#S&&this.#n?.(r,e,"set"),this.#T&&this.#y?.push([r,e,"set"]));if(this.#M(u),this.#Q(u,c,s),this.#f[u]=t,s){s.set="replace";const e=r&&this.#P(r)?r.__staleWhileFetching:r;void 0!==e&&(s.oldValue=e)}}else s&&(s.set="update");this.#R&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#x||this.#D(),this.#x&&(l||this.#k(u,n,i),s&&this.#F(s,u)),!a&&this.#T&&this.#y){const e=this.#y;let t;for(;t=e?.shift();)this.#a?.(...t)}return this}pop(){try{for(;this.#c;){const e=this.#f[this.#m];if(this.#U(!0),this.#P(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#T&&this.#y){const e=this.#y;let t;for(;t=e?.shift();)this.#a?.(...t)}}}#U(e){const t=this.#m,r=this.#p[t],n=this.#f[t];return this.#w&&this.#P(n)?n.__abortController.abort(new Error("evicted")):(this.#S||this.#T)&&(this.#S&&this.#n?.(n,r,"evict"),this.#T&&this.#y?.push([n,r,"evict"])),this.#M(t),e&&(this.#p[t]=void 0,this.#f[t]=void 0,this.#v.push(t)),1===this.#c?(this.#m=this.#b=0,this.#v.length=0):this.#m=this.#h[t],this.#d.delete(r),this.#c--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=this.#d.get(e);if(void 0!==i){const e=this.#f[i];if(this.#P(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#_(i))return r&&this.#j(i),n&&(n.has="hit",this.#F(n,i)),!0;n&&(n.has="stale",this.#F(n,i))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#d.get(e);if(void 0===n||!r&&this.#_(n))return;const i=this.#f[n];return this.#P(i)?i.__staleWhileFetching:i}#I(e,t,r,n){const i=void 0===t?void 0:this.#f[t];if(this.#P(i))return i;const a=new Md,{signal:o}=r;o?.addEventListener("abort",(()=>a.abort(o.reason)),{signal:a.signal});const s={signal:a.signal,options:r,context:n},l=(n,i=!1)=>{const{aborted:o}=a.signal,l=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!i?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,l&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!l&&!i)return c(a.signal.reason);const d=u,p=this.#f[t];return(p===u||l&&i&&void 0===p)&&(void 0===n?void 0!==d.__staleWhileFetching?this.#f[t]=d.__staleWhileFetching:this.#$(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,s.options))),n},c=n=>{const{aborted:i}=a.signal,o=i&&r.allowStaleOnFetchAbort,s=o||r.allowStaleOnFetchRejection,l=s||r.noDeleteOnFetchRejection,c=u;if(this.#f[t]===u){!l||void 0===c.__staleWhileFetching?this.#$(e,"fetch"):o||(this.#f[t]=c.__staleWhileFetching)}if(s)return r.status&&void 0!==c.__staleWhileFetching&&(r.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw n};r.status&&(r.status.fetchDispatched=!0);const u=new Promise(((t,n)=>{const o=this.#o?.(e,i,s);o&&o instanceof Promise&&o.then((e=>t(void 0===e?void 0:e)),n),a.signal.addEventListener("abort",(()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))}))})).then(l,(e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),c(e)))),d=Object.assign(u,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,d,{...s.options,status:void 0}),t=this.#d.get(e)):this.#f[t]=d,d}#P(e){if(!this.#w)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Md}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:h,forceRefresh:g=!1,status:m,signal:b}=t;if(!this.#w)return m&&(m.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:m});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:f,ignoreFetchAbort:p,status:m,signal:b};let y=this.#d.get(e);if(void 0===y){m&&(m.fetch="miss");const t=this.#I(e,y,v,h);return t.__returned=t}{const t=this.#f[y];if(this.#P(t)){const e=r&&void 0!==t.__staleWhileFetching;return m&&(m.fetch="inflight",e&&(m.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const i=this.#_(y);if(!g&&!i)return m&&(m.fetch="hit"),this.#A(y),n&&this.#j(y),m&&this.#F(m,y),t;const a=this.#I(e,y,v,h),o=void 0!==a.__staleWhileFetching&&r;return m&&(m.fetch=i?"stale":"refresh",o&&i&&(m.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#s;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&void 0!==o)return o;const s=r(e,o,{options:a,context:n});return this.set(e,s,a),s}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#d.get(e);if(void 0!==o){const t=this.#f[o],s=this.#P(t);return a&&this.#F(a,o),this.#_(o)?(a&&(a.get="stale"),s?(a&&r&&void 0!==t.__staleWhileFetching&&(a.returnedStale=!0),r?t.__staleWhileFetching:void 0):(i||this.#$(e,"expire"),a&&r&&(a.returnedStale=!0),r?t:void 0)):(a&&(a.get="hit"),s?t.__staleWhileFetching:(this.#A(o),n&&this.#j(o),t))}a&&(a.get="miss")}#q(e,t){this.#g[t]=e,this.#h[e]=t}#A(e){e!==this.#b&&(e===this.#m?this.#m=this.#h[e]:this.#q(this.#g[e],this.#h[e]),this.#q(this.#b,e),this.#b=e)}delete(e){return this.#$(e,"delete")}#$(e,t){let r=!1;if(0!==this.#c){const n=this.#d.get(e);if(void 0!==n)if(r=!0,1===this.#c)this.#G(t);else{this.#M(n);const r=this.#f[n];if(this.#P(r)?r.__abortController.abort(new Error("deleted")):(this.#S||this.#T)&&(this.#S&&this.#n?.(r,e,t),this.#T&&this.#y?.push([r,e,t])),this.#d.delete(e),this.#p[n]=void 0,this.#f[n]=void 0,n===this.#b)this.#b=this.#g[n];else if(n===this.#m)this.#m=this.#h[n];else{const e=this.#g[n];this.#h[e]=this.#h[n];const t=this.#h[n];this.#g[t]=this.#g[n]}this.#c--,this.#v.push(n)}}if(this.#T&&this.#y?.length){const e=this.#y;let t;for(;t=e?.shift();)this.#a?.(...t)}return r}clear(){return this.#G("delete")}#G(e){for(const t of this.#C({allowStale:!0})){const r=this.#f[t];if(this.#P(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#p[t];this.#S&&this.#n?.(r,n,e),this.#T&&this.#y?.push([r,n,e])}}if(this.#d.clear(),this.#f.fill(void 0),this.#p.fill(void 0),this.#x&&this.#E&&(this.#x.fill(0),this.#E.fill(0)),this.#O&&this.#O.fill(0),this.#m=0,this.#b=0,this.#v.length=0,this.#u=0,this.#c=0,this.#T&&this.#y){const e=this.#y;let t;for(;t=e?.shift();)this.#a?.(...t)}}}var Wd=b(4701);function Xd(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function zd(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){Xd(a,n,i,o,s,"next",e)}function s(e){Xd(a,n,i,o,s,"throw",e)}o(void 0)}))}}function Hd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Yd="{}",Kd=["__aggregated_metric__","__tenant_id__","__stream_shard__"];class Zd extends r.LanguageProvider{getLabelKeys(){return this.labelKeys}importFromAbstractQuery(e){return{refId:e.refId,expr:(0,u.tt)(e),queryType:Dc.U3.Range}}exportToAbstractQuery(e){if(!e.expr||0===e.expr.length)return{refId:e.refId,labelMatchers:[]};const t=(0,Uc.pk)(e.expr).map((e=>(0,Rt.u_)(e).query.labels.map((e=>({name:e.label,value:e.value,operator:u.sM[e.op]})))));return{refId:e.refId,labelMatchers:(0,o.flatten)(t)}}fetchLabels(e){return zd((function*(){if(n.config.featureToggles.lokiLabelNamesQueryApi||!(null==e?void 0:e.streamSelector))return this.fetchLabelsByLabelsEndpoint(e);{const t=yield this.fetchSeriesLabels(e.streamSelector,{timeRange:e.timeRange});return Object.keys(null!=t?t:{})}})).call(this)}fetchLabelsByLabelsEndpoint(e){return zd((function*(){var t;const r=null!==(t=null==e?void 0:e.timeRange)&&void 0!==t?t:this.getDefaultTimeRange(),{start:n,end:i}=this.datasource.getTimeRangeParams(r),a={start:n,end:i};(null==e?void 0:e.streamSelector)&&(null==e?void 0:e.streamSelector)!==Yd&&(a.query=e.streamSelector);const o=yield this.request("labels",a);if(Array.isArray(o)){const e=Array.from(new Set(o)).slice().sort().filter((e=>!1===Kd.includes(e)));return this.labelKeys=e,this.labelKeys}return[]})).call(this)}generateCacheKey(e,t,r,n){return[e,this.roundTime(t),this.roundTime(r),n].join()}roundTime(e){return e?Math.floor(e/1e6/1e3/60/5):0}fetchDetectedFields(e,t){return zd((function*(){const r=e.expr&&e.expr!==Yd?this.datasource.interpolateString(e.expr,e.scopedVars):void 0;if(!r)throw new Error("fetchDetectedFields requires query expression");var n;const i=null!==(n=null==e?void 0:e.timeRange)&&void 0!==n?n:this.getDefaultTimeRange(),a=this.datasource.getTimeRangeParams(i),{start:o,end:s}=a;var l;const c={start:o,end:s,limit:null!==(l=null==e?void 0:e.limit)&&void 0!==l?l:1e3};return c.query=r,new Promise(((e,r)=>zd((function*(){try{const r=yield this.request("detected_fields",c,!0,t);e(r)}catch(e){console.error("error",e),r(e)}})).call(this)))})).call(this)}fetchDetectedFieldValues(e,t,r){return zd((function*(){return this.fetchDetectedLabelValues(e,t,r)})).call(this)}fetchDetectedLabelValues(e,t,r){return zd((function*(){const n=encodeURIComponent(this.datasource.interpolateString(e)),i=(null==t?void 0:t.expr)&&t.expr!==Yd?this.datasource.interpolateString(t.expr,t.scopedVars):void 0,a=`detected_field/${n}/values`;var o;const s=null!==(o=null==t?void 0:t.timeRange)&&void 0!==o?o:this.getDefaultTimeRange(),l=this.datasource.getTimeRangeParams(s),{start:c,end:u}=l;var d;const p={start:c,end:u,limit:null!==(d=null==t?void 0:t.limit)&&void 0!==d?d:1e3};let f=n;i&&(p.query=i,f+=i);const h=this.generateCacheKey(a,c,u,f),g=this.detectedFieldValuesCache.get(h);if(g)return g;let m=this.detectedLabelValuesPromisesCache.get(h);return m||(m=new Promise(((e,n)=>zd((function*(){try{const n=yield this.request(a,p,null==t?void 0:t.throwError,r);if(Array.isArray(n)){const t=n.slice().sort();this.detectedFieldValuesCache.set(h,t),this.detectedLabelValuesPromisesCache.delete(h),e(t)}}catch(r){(null==t?void 0:t.throwError)?n(r):(console.error(r),e([]))}})).call(this))),this.detectedLabelValuesPromisesCache.set(h,m),m)})).call(this)}fetchLabelValues(e,t){return zd((function*(){const r=encodeURIComponent(this.datasource.interpolateString(e)),n=(null==t?void 0:t.streamSelector)&&t.streamSelector!==Yd?this.datasource.interpolateString(t.streamSelector):void 0,i=`label/${r}/values`;var a;const o=null!==(a=null==t?void 0:t.timeRange)&&void 0!==a?a:this.getDefaultTimeRange(),s=this.datasource.getTimeRangeParams(o),{start:l,end:c}=s,u={start:l,end:c};let d=r;n&&(u.query=n,d+=n);const p=this.generateCacheKey(i,l,c,d),f=this.labelsCache.get(p);if(f)return f;let h=this.labelsPromisesCache.get(p);return h||(h=new Promise((e=>zd((function*(){try{const t=yield this.request(i,u);if(Array.isArray(t)){const r=t.slice().sort();this.labelsCache.set(p,r),this.labelsPromisesCache.delete(p),e(r)}}catch(t){console.error(t),e([])}})).call(this))),this.labelsPromisesCache.set(p,h),h)})).call(this)}getParserAndLabelKeys(e,t){return zd((function*(){const r={extractedLabelKeys:[],structuredMetadataKeys:[],unwrapLabelKeys:[],hasJSON:!1,hasLogfmt:!1,hasPack:!1};var n;const i=yield this.datasource.getDataSamples({expr:e,refId:"data-samples",maxLines:(null==t?void 0:t.maxLines)||Yh},null!==(n=null==t?void 0:t.timeRange)&&void 0!==n?n:this.getDefaultTimeRange());if(!i.length)return r;const{hasLogfmt:a,hasJSON:o,hasPack:s}=(0,Wd.YB)(i[0]);return{extractedLabelKeys:[...(0,Wd.fV)(i[0],Dc.HD.Indexed),...(0,Wd.fV)(i[0],Dc.HD.Parsed)],structuredMetadataKeys:(0,Wd.fV)(i[0],Dc.HD.StructuredMetadata),unwrapLabelKeys:(0,Wd.aN)(i[0]),hasJSON:o,hasPack:s,hasLogfmt:a}})).call(this)}getDefaultTimeRange(){return(0,r.getDefaultTimeRange)()}constructor(e){var t;super(),Hd(t=this,"labelKeys",void 0),Hd(t,"started",!1),Hd(t,"startedTimeRange",void 0),Hd(t,"datasource",void 0),Hd(t,"seriesCache",new Gd({max:10})),Hd(t,"labelsCache",new Gd({max:10})),Hd(t,"detectedFieldValuesCache",new Gd({max:10})),Hd(t,"labelsPromisesCache",new Gd({max:10})),Hd(t,"detectedLabelValuesPromisesCache",new Gd({max:10})),Hd(t,"request",((e,r,n,i)=>zd((function*(){try{return yield t.datasource.metadataRequest(e,r,i)}catch(e){if(n)throw e;console.error(e)}}))())),Hd(t,"start",(e=>{const r=null!=e?e:t.getDefaultTimeRange(),n=t.datasource.getTimeRangeParams(r),i=t.startedTimeRange?t.datasource.getTimeRangeParams(t.startedTimeRange):null;return t.startTask&&i&&n.start===i.start&&n.end===i.end||(t.startedTimeRange=r,t.startTask=t.fetchLabels({timeRange:r}).then((()=>(t.started=!0,[])))),t.startTask})),Hd(t,"fetchSeriesLabels",((e,r)=>zd((function*(){const n=t.datasource.interpolateString(e),i="series";var a;const o=null!==(a=null==r?void 0:r.timeRange)&&void 0!==a?a:t.getDefaultTimeRange(),{start:s,end:l}=t.datasource.getTimeRangeParams(o),c=t.generateCacheKey(i,s,l,n);let d=t.seriesCache.get(c);if(!d){const e={"match[]":n,start:s,end:l},r=yield t.request(i,e);if(!Array.isArray(r))return{};const{values:a}=(0,u.P7)(r);d=a,t.seriesCache.set(c,d)}return d}))())),Hd(t,"fetchSeries",((e,r)=>zd((function*(){var n;const i=null!==(n=null==r?void 0:r.timeRange)&&void 0!==n?n:t.getDefaultTimeRange(),{start:a,end:o}=t.datasource.getTimeRangeParams(i),s={"match[]":e,start:a,end:o};return yield t.request("series",s)}))())),t.datasource=e,t.labelKeys=[]}}var Jd=function(e,t){return Jd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Jd(e,t)};function ep(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Jd(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var tp=function(){return tp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},tp.apply(this,arguments)};Object.create;function rp(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function np(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function ip(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;function ap(e){return"function"==typeof e}function op(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var sp=op((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function lp(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var cp=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=rp(a),s=o.next();!s.done;s=o.next()){s.value.remove(this)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(ap(l))try{l()}catch(e){i=e instanceof sp?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=rp(c),d=u.next();!d.done;d=u.next()){var p=d.value;try{pp(p)}catch(e){i=null!=i?i:[],e instanceof sp?i=ip(ip([],np(i)),np(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}if(i)throw new sp(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)pp(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&lp(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&lp(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),up=cp.EMPTY;function dp(e){return e instanceof cp||e&&"closed"in e&&ap(e.remove)&&ap(e.add)&&ap(e.unsubscribe)}function pp(e){ap(e)?e():e.unsubscribe()}var fp={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},hp={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=hp.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,ip([e,t],np(r))):setTimeout.apply(void 0,ip([e,t],np(r)))},clearTimeout:function(e){var t=hp.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function gp(){}var mp=bp("C",void 0,void 0);function bp(e,t,r){return{kind:e,value:t,error:r}}var vp=null;function yp(e){if(fp.useDeprecatedSynchronousErrorHandling){var t=!vp;if(t&&(vp={errorThrown:!1,error:null}),e(),t){var r=vp,n=r.errorThrown,i=r.error;if(vp=null,n)throw i}}else e()}var Op=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,dp(t)&&t.add(r)):r.destination=Pp,r}return ep(t,e),t.create=function(e,t,r){return new wp(e,t,r)},t.prototype.next=function(e){this.isStopped?Rp(function(e){return bp("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Rp(function(e){return bp("E",void 0,e)}(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Rp(mp,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(cp),Ep=Function.prototype.bind;function xp(e,t){return Ep.call(e,t)}var Sp=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Tp(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Tp(e)}else Tp(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Tp(e)}},e}(),wp=function(e){function t(t,r,n){var i,a,o=e.call(this)||this;ap(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:o&&fp.useDeprecatedNextContext?((a=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},i={next:t.next&&xp(t.next,a),error:t.error&&xp(t.error,a),complete:t.complete&&xp(t.complete,a)}):i=t;return o.destination=new Sp(i),o}return ep(t,e),t}(Op);function Tp(e){var t;fp.useDeprecatedSynchronousErrorHandling?(t=e,fp.useDeprecatedSynchronousErrorHandling&&vp&&(vp.errorThrown=!0,vp.error=t)):function(e){hp.setTimeout((function(){var t=fp.onUnhandledError;if(!t)throw e;t(e)}))}(e)}function Rp(e,t){var r=fp.onStoppedNotification;r&&hp.setTimeout((function(){return r(e,t)}))}var Pp={closed:!0,next:gp,error:function(e){throw e},complete:gp},Ip="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ap(e){return e}function Lp(e){return 0===e.length?Ap:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Cp=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,i=this,a=(n=e)&&n instanceof Op||function(e){return e&&ap(e.next)&&ap(e.error)&&ap(e.complete)}(n)&&dp(n)?e:new wp(e,t,r);return yp((function(){var e=i,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?i._subscribe(a):i._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=_p(t))((function(t,n){var i=new wp({next:function(t){try{e(t)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t});r.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Ip]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Lp(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=_p(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function _p(e){var t;return null!==(t=null!=e?e:fp.Promise)&&void 0!==t?t:Promise}var Np=op((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Dp=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return ep(t,e),t.prototype.lift=function(e){var t=new kp(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Np},t.prototype.next=function(e){var t=this;yp((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=rp(t.currentObservers),a=i.next();!a.done;a=i.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;yp((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;yp((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,a=r.observers;return n||i?up:(this.currentObservers=null,a.push(e),new cp((function(){t.currentObservers=null,lp(a,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new Cp;return e.source=this,e},t.create=function(e,t){return new kp(e,t)},t}(Cp),kp=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return ep(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:up},t}(Dp),$p={now:function(){return($p.delegate||Date).now()},delegate:void 0},jp=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=$p);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return ep(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,i=r._buffer,a=r._infiniteTimeWindow,o=r._timestampProvider,s=r._windowTime;n||(i.push(t),!a&&i.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!e.closed;i+=r?1:2)e.next(n[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,i=e._infiniteTimeWindow,a=(i?1:2)*t;if(t<1/0&&a<n.length&&n.splice(0,n.length-a),!i){for(var o=r.now(),s=0,l=1;l<n.length&&n[l]<=o;l+=2)s=l;s&&n.splice(0,s+1)}},t}(Dp),Fp={url:"",deserializer:function(e){return JSON.parse(e.data)},serializer:function(e){return JSON.stringify(e)}},Mp=function(e){function t(t,r){var n=e.call(this)||this;if(n._socket=null,t instanceof Cp)n.destination=r,n.source=t;else{var i=n._config=tp({},Fp);if(n._output=new Dp,"string"==typeof t)i.url=t;else for(var a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);if(!i.WebSocketCtor&&WebSocket)i.WebSocketCtor=WebSocket;else if(!i.WebSocketCtor)throw new Error("no WebSocket constructor can be found");n.destination=new jp}return n}return ep(t,e),t.prototype.lift=function(e){var r=new t(this._config,this.destination);return r.operator=e,r.source=this,r},t.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new jp),this._output=new Dp},t.prototype.multiplex=function(e,t,r){var n=this;return new Cp((function(i){try{n.next(e())}catch(e){i.error(e)}var a=n.subscribe({next:function(e){try{r(e)&&i.next(e)}catch(e){i.error(e)}},error:function(e){return i.error(e)},complete:function(){return i.complete()}});return function(){try{n.next(t())}catch(e){i.error(e)}a.unsubscribe()}}))},t.prototype._connectSocket=function(){var e=this,t=this._config,r=t.WebSocketCtor,n=t.protocol,i=t.url,a=t.binaryType,o=this._output,s=null;try{s=n?new r(i,n):new r(i),this._socket=s,a&&(this._socket.binaryType=a)}catch(e){return void o.error(e)}var l=new cp((function(){e._socket=null,s&&1===s.readyState&&s.close()}));s.onopen=function(t){if(!e._socket)return s.close(),void e._resetState();var r=e._config.openObserver;r&&r.next(t);var n=e.destination;e.destination=Op.create((function(t){if(1===s.readyState)try{var r=e._config.serializer;s.send(r(t))}catch(t){e.destination.error(t)}}),(function(t){var r=e._config.closingObserver;r&&r.next(void 0),t&&t.code?s.close(t.code,t.reason):o.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")),e._resetState()}),(function(){var t=e._config.closingObserver;t&&t.next(void 0),s.close(),e._resetState()})),n&&n instanceof jp&&l.add(n.subscribe(e.destination))},s.onerror=function(t){e._resetState(),o.error(t)},s.onclose=function(t){s===e._socket&&e._resetState();var r=e._config.closeObserver;r&&r.next(t),t.wasClean?o.complete():o.error(t)},s.onmessage=function(t){try{var r=e._config.deserializer;o.next(r(t))}catch(e){o.error(e)}}},t.prototype._subscribe=function(e){var t=this,r=this.source;return r?r.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add((function(){var e=t._socket;0===t._output.observers.length&&(!e||1!==e.readyState&&0!==e.readyState||e.close(),t._resetState())})),e)},t.prototype.unsubscribe=function(){var t=this._socket;!t||1!==t.readyState&&0!==t.readyState||t.close(),this._resetState(),e.prototype.unsubscribe.call(this)},t}(kp);function Bp(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function Qp(e,t){return e<<t|e>>>32-t}const Up=function(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128;const i=(e=n).length/4+2,a=Math.ceil(i/16),o=new Array(a);for(let t=0;t<a;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];o[t]=r}o[a-1][14]=8*(e.length-1)/Math.pow(2,32),o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<a;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=o[e][t];for(let e=16;e<80;++e)n[e]=Qp(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let i=r[0],a=r[1],s=r[2],l=r[3],c=r[4];for(let e=0;e<80;++e){const r=Math.floor(e/20),o=Qp(i,5)+Bp(r,a,s,l)+c+t[r]+n[e]>>>0;c=l,l=s,s=Qp(a,30)>>>0,a=i,i=o}r[0]=r[0]+i>>>0,r[1]=r[1]+a>>>0,r[2]=r[2]+s>>>0,r[3]=r[3]+l>>>0,r[4]=r[4]+c>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])},Vp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const qp=function(e){return"string"==typeof e&&Vp.test(e)};const Gp=function(e){if(!qp(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)};var Wp=b(8422);function Xp(e,t,r,n,i,a){const o="string"==typeof r?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}(r):r,s="string"==typeof n?Gp(n):n;if("string"==typeof n&&(n=Gp(n)),16!==n?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(s),l.set(o,s.length),l=t(l),l[6]=15&l[6]|e,l[8]=63&l[8]|128,i){a=a||0;for(let e=0;e<16;++e)i[a+e]=l[e];return i}return(0,Wp.k)(l)}function zp(e,t,r,n){return Xp(80,Up,e,t,r,n)}zp.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",zp.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const Hp=zp;function Yp(e,t,r,n,i){let a=Hp(`${e}_${t}_${r}`,"6ec946da-0f49-47a8-983a-1d76d17e7c92");if(a in n){const e=n[a]+1;n[a]=e,a=`${a}_${e}`}else n[a]=0;return i?`${i}_${a}`:a}function Kp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zp(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}class Jp{getStream(e,t=5e3){let n=this.streams[e.url];if(n)return n;const i=new r.CircularDataFrame({capacity:e.size});var a;return i.addField({name:"Time",type:r.FieldType.time,config:{}}),i.addField({name:"Line",type:r.FieldType.string}),i.addField({name:"id",type:r.FieldType.string}),i.meta=Zp(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Kp(e,t,r[t])}))}return e}({},i.meta),{preferredVisualisationType:"logs"}),i.refId=e.refId,n=(a=e.url,new Mp(a)).pipe((0,k.map)((e=>(function(e,t){const r=e.streams;if(!r||!r.length)return;const n=t.fields[0],i=t.fields[1],a=t.fields[2],o={};for(const e of r){const r=Object.entries(e.stream).map((([e,t])=>`${e}="${t}"`)).sort().join("");for(const[s,l]of e.values)n.values.push(new Date(parseInt(s.slice(0,-6),10)).toISOString()),i.values.push(l),a.values.push(Yp(s,r,l,o,t.refId))}}(e,i),[i]))),(0,k.retryWhen)((e=>e.pipe((0,k.mergeMap)(((e,r)=>{const n=r+1;return 1006===e.code&&n<30?(n>10&&console.warn(`Websocket connection is being disrupted. We keep reconnecting but consider starting new live tailing again. Error: ${e.reason}`),(0,D.timer)(t)):(0,D.throwError)(e)}))))),(0,k.finalize)((()=>{delete this.streams[e.url]}))),this.streams[e.url]=n,n}constructor(){Kp(this,"streams",{})}}function ef(e,t){void 0===t&&(t=[]);var r=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r={loading:!1});var n=(0,s.useRef)(0),i=ss(),a=(0,s.useState)(r),o=a[0],l=a[1],c=(0,s.useCallback)((function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var a=++n.current;return o.loading||l((function(e){return tp(tp({},e),{loading:!0})})),e.apply(void 0,t).then((function(e){return i()&&a===n.current&&l({value:e,loading:!1}),e}),(function(e){return i()&&a===n.current&&l({error:e,loading:!1}),e}))}),t);return[o,c]}(e,t,{loading:!0}),n=r[0],i=r[1];return(0,s.useEffect)((function(){i()}),[i]),n}function tf(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function rf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nf(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function af(e){return{labels:(0,a.css)({display:"flex",gap:e.spacing(.5)}),wrapper:(0,a.css)({display:"flex",flexDirection:"column",flex:1,gap:e.spacing(.5),position:"relative"}),textWrapper:(0,a.css)({display:"flex",alignItems:"center"}),hidden:(0,a.css)({visibility:"hidden"}),label:(0,a.css)({maxWidth:"100%","&:first-of-type":{marginBottom:e.spacing(2)},"&:not(:first-of-type)":{margin:e.spacing(2,0)}}),rawQueryContainer:(0,a.css)({textAlign:"start",lineBreak:"anywhere",marginTop:e.spacing(-.25),marginRight:e.spacing(6),minHeight:e.spacing(4)}),ui:(0,a.css)({backgroundColor:e.colors.background.secondary,padding:e.spacing(2)}),notification:(0,a.css)({position:"absolute",zIndex:e.zIndex.portal,top:0,right:0}),rawQuery:(0,a.css)({display:"inline"}),queryDescription:(0,a.css)({marginLeft:e.spacing(.5)}),iconButton:(0,a.css)({position:"absolute",top:e.spacing(1),right:e.spacing(1),zIndex:e.zIndex.navbarFixed}),operationsToggle:(0,a.css)({margin:e.spacing(1,0,-1,0),"& > div":{margin:0,"& > label":{padding:0}}})}}const of="isLogContextQueryUiOpen";function sf(e){const{row:t,logContextProvider:a,updateFilter:o,onClose:l,origQuery:d,runContextQuery:p}=e,f=(0,c.useStyles2)(af),[h,g]=(0,s.useState)([]),[m,b]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1),[O,E]=(0,s.useState)(!1),[x,S]=(0,s.useState)("true"===window.localStorage.getItem(of)),[w,T]=(0,s.useState)("true"===window.localStorage.getItem(xf)),R=(0,s.useRef)(),P=(0,s.useRef)(!1),I=(0,s.useRef)([]),A=(0,s.useMemo)((()=>(!v||!h.some((e=>e.nonIndexed===e.enabled)))&&(!w||!a.queryContainsValidPipelineStages(d))),[h,w,v,a,d]);(0,s.useEffect)((()=>{if(v)if(P.current){if(0!==h.filter((({enabled:e,nonIndexed:t})=>e&&!t)).length)return I.current=structuredClone(h),R.current&&clearTimeout(R.current),E(!0),R.current=window.setTimeout((()=>{o(h.filter((({enabled:e})=>e)));const e={removedLabels:[],selectedExtractedLabels:[]};h.forEach((({enabled:t,nonIndexed:r,label:n})=>{t||r||e.removedLabels.push(n),t&&r&&e.selectedExtractedLabels.push(n)})),window.localStorage.setItem(Ef,JSON.stringify(e)),E(!1)}),1500),()=>{clearTimeout(R.current)};g(I.current)}else P.current=v}),[h,v]),(0,s.useEffect)((()=>()=>{clearTimeout(R.current),l()}),[l]),ef((()=>{return(e=function*(){E(!0);const e=yield a.getInitContextFilters(t,d,{from:(0,r.dateTime)(t.timeEpochMs),to:(0,r.dateTime)(t.timeEpochMs),raw:{from:(0,r.dateTime)(t.timeEpochMs),to:(0,r.dateTime)(t.timeEpochMs)}});g(e.contextFilters),b(e.preservedFiltersApplied),y(!0),E(!1)},function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){tf(a,n,i,o,s,"next",e)}function s(e){tf(a,n,i,o,s,"throw",e)}o(void 0)}))})();var e})),(0,s.useEffect)((()=>{m&&setTimeout((()=>{b(!1)}),2e3)}),[m]),(0,s.useEffect)((()=>((0,n.reportInteraction)("grafana_explore_logs_loki_log_context_loaded",{logRowUid:t.uid,type:"load"}),()=>{(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_loaded",{logRowUid:t.uid,type:"unload"})})),[t.uid]);const L=h.filter((({nonIndexed:e})=>!e)),C=L.filter((({enabled:e})=>e)),_=h.filter((({nonIndexed:e})=>e)),N=_.filter((({enabled:e})=>e)),D=(0,s.useCallback)((e=>({label:`${e.label}="${(0,u.Bb)(e.value)}"`,value:e.label})),[]),k=_.length>0;let $=a.prepareExpression(h.filter((({enabled:e})=>e)),d);return(0,i.jsxs)("div",{className:f.wrapper,children:[m&&(0,i.jsx)(c.Alert,{className:f.notification,title:"Previously used filters have been applied.",severity:"info",elevated:!0}),(0,i.jsx)("div",{className:f.iconButton,children:(0,i.jsx)(c.Button,{tooltip:"Revert to initial log context query","data-testid":"revert-button",icon:"history-alt",variant:"secondary",disabled:A,onClick:e=>{(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_reverted",{logRowUid:t.uid}),g((e=>e.map((e=>nf(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){rf(e,t,r[t])}))}return e}({},e),{enabled:!e.nonIndexed}))))),window.localStorage.removeItem(Ef),window.localStorage.removeItem(xf),T(!1)}})}),(0,i.jsx)(c.Collapse,{isOpen:x,onToggle:()=>{window.localStorage.setItem(of,(!x).toString()),S((e=>!e)),(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_toggled",{logRowUid:t.uid,action:x?"close":"open"})},label:(0,i.jsx)("div",{className:f.rawQueryContainer,children:v?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Gt,{language:{grammar:Jl.vB,name:"loki"},query:$,className:f.rawQuery}),(0,i.jsx)(c.Tooltip,{content:"The initial log context query is created from all labels defining the stream for the selected log line. Use the editor below to customize the log context query.",children:(0,i.jsx)(c.Icon,{name:"info-circle",size:"sm",className:f.queryDescription})})]}):(0,i.jsx)(c.Spinner,{})}),children:(0,i.jsxs)("div",{className:f.ui,children:[(0,i.jsx)(c.Label,{className:f.label,description:"The initial log context query is created from all labels defining the stream for the selected log line. You can broaden your search by removing one or more of the label filters.",children:"Widen the search"}),(0,i.jsx)(c.MultiSelect,{isLoading:O,options:L.map(D),value:C.map(D),closeMenuOnSelect:!0,maxMenuHeight:200,noOptionsMessage:"No further labels available",onChange:(e,r)=>("select-option"===r.action&&(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_filtered",{logRowUid:t.uid,type:"label",action:"select"}),"remove-value"===r.action&&(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_filtered",{logRowUid:t.uid,type:"label",action:"remove"}),g(h.map((t=>(t.nonIndexed||(t.enabled=e.some((e=>e.value===t.label))),t)))))}),k&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Label,{className:f.label,description:"By using a parser in your original query, you can use filters for extracted labels. Refine your search by applying extracted labels created from the selected log line.",children:"Refine the search"}),(0,i.jsx)(c.MultiSelect,{isLoading:O,options:_.map(D),value:N.map(D),closeMenuOnSelect:!0,maxMenuHeight:200,noOptionsMessage:"No further labels available",isClearable:!0,onChange:(e,r)=>{"select-option"===r.action&&(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_filtered",{logRowUid:t.uid,type:"parsed_label",action:"select"}),"remove-value"===r.action&&(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_filtered",{logRowUid:t.uid,type:"parsed_label",action:"remove"}),g(h.map((t=>t.nonIndexed?(t.enabled=e.some((e=>e.value===t.label)),t):t)))}})]}),a.queryContainsValidPipelineStages(d)&&(0,i.jsx)(c.InlineFieldRow,{className:f.operationsToggle,children:(0,i.jsx)(c.InlineField,{label:"Include LogQL pipeline operations",tooltip:(0,i.jsx)(c.RenderUserContentAsHTML,{content:(0,r.renderMarkdown)("This will include LogQL operations such as `line_format` or `label_format`. It won't include line or label filter operations.")}),children:(0,i.jsx)(c.InlineSwitch,{value:w,showLabel:!0,transparent:!0,onChange:e=>{(0,n.reportInteraction)("grafana_explore_logs_loki_log_context_pipeline_toggled",{logRowUid:t.uid,action:e.currentTarget.checked?"enable":"disable"}),window.localStorage.setItem(xf,e.currentTarget.checked.toString()),T(e.currentTarget.checked),p&&p()}})})})]})})]})}var lf=b(3302);function cf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){cf(e,t,r[t])}))}return e}function df(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function pf(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var ff=function(e){return e[e.Ascending=0]="Ascending",e[e.Descending=1]="Descending",e}({});function hf(e,t){const{fields:n}=e,i=pf(e,["fields"]),a=n.find((e=>e.type===r.FieldType.time));if(void 0===a)throw new Error("missing timestamp field. should never happen");const o=function(e,t){const r=e.values,{nanos:n}=e,i=Array(r.length);for(let e=0;e<i.length;e++)i[e]=e;const a=0===t;return i.sort(((e,t)=>{const i=r[e],o=r[t];if(i<o)return a?-1:1;if(i>o)return a?1:-1;if(void 0===n)return 0;const s=n[e],l=n[t];return s<l?a?-1:1:s>l?a?1:-1:0})),i}(a,t);return df(uf({},i),{fields:n.map((e=>df(uf({},e),{values:gf(e.values,o),nanos:void 0===e.nanos?void 0:gf(e.nanos,o)})))})}function gf(e,t){return e.map(((r,n)=>e[t[n]]))}function mf(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function bf(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){mf(a,n,i,o,s,"next",e)}function s(e){mf(a,n,i,o,s,"throw",e)}o(void 0)}))}}function vf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){vf(e,t,r[t])}))}return e}function Of(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Ef="lokiLogContextPreservedLabels",xf="lokiLogContextShouldIncludePipelineOperations";class Sf{getQueryAndRange(e,t,n,i=!0){return bf((function*(){const a=t&&t.direction||r.LogRowContextQueryDirection.Backward,o=t&&t.limit||this.datasource.maxLines;if(0===this.cachedContextFilters.length||!i){const t=(yield this.getInitContextFilters(e,n,{from:(0,r.dateTime)(e.timeEpochMs),to:(0,r.dateTime)(e.timeEpochMs),raw:{from:(0,r.dateTime)(e.timeEpochMs),to:(0,r.dateTime)(e.timeEpochMs)}})).contextFilters.filter((e=>e.enabled));this.cachedContextFilters=t}return yield this.prepareLogRowContextQueryTarget(e,o,a,n,null==t?void 0:t.timeWindowMs)})).call(this)}prepareLogRowContextQueryTarget(e,t,n,i){return bf((function*(e,t,n,i,a=72e5){const o=this.prepareExpression(this.cachedContextFilters,i),s=n===r.LogRowContextQueryDirection.Forward?Dc.ti.Forward:Dc.ti.Backward,l={expr:o,queryType:Dc.U3.Range,refId:`${Jh}_${Math.random().toString()}`,maxLines:t,direction:s,datasource:{uid:this.datasource.uid,type:this.datasource.type}},c=new r.FieldCache(e.dataFrame).getFirstFieldOfType(r.FieldType.time);if(void 0===c)throw new Error("loki: data frame missing time-field, should never happen");const u=c.values[e.rowIndex],d=(0,r.toUtc)(u),p=s===Dc.ti.Forward?{from:d,to:(0,r.toUtc)(e.timeEpochMs+a)}:{from:(0,r.toUtc)(e.timeEpochMs-a),to:d};return{query:l,range:{from:p.from,to:p.to,raw:p}}})).apply(this,arguments)}getLogRowContextUi(e,t,r,n){r&&n&&(r=this.datasource.applyTemplateVariables(r,n));var i;return this.onContextClose=null!==(i=this.onContextClose)&&void 0!==i?i:()=>{this.cachedContextFilters=[]},sf({row:e,origQuery:r,updateFilter:e=>{this.cachedContextFilters=e,t&&t()},onClose:this.onContextClose,logContextProvider:this,runContextQuery:t})}prepareExpression(e,t){let r=this.processContextFiltersToExpr(e,t);return"true"===window.localStorage.getItem(xf)&&(r=this.processPipelineStagesToExpr(r,t)),r}constructor(e){vf(this,"datasource",void 0),vf(this,"cachedContextFilters",void 0),vf(this,"onContextClose",void 0),vf(this,"getLogRowContextQuery",((e,t,r,n=!0)=>bf((function*(){r&&(null==t?void 0:t.scopedVars)&&(r=this.datasource.applyTemplateVariables(r,null==t?void 0:t.scopedVars));const{query:i}=yield this.getQueryAndRange(e,t,r,n);return n||(this.cachedContextFilters=[]),i})).call(this))),vf(this,"getLogRowContext",((e,t,n)=>bf((function*(){n&&(null==t?void 0:t.scopedVars)&&(n=this.datasource.applyTemplateVariables(n,null==t?void 0:t.scopedVars));const i=t&&t.direction||r.LogRowContextQueryDirection.Backward,{query:a,range:o}=yield this.getQueryAndRange(e,t,n),s=r.CoreApp.Explore;return(0,D.lastValueFrom)(this.datasource.query(ng(a,o,s,`${Jh}${i}`)).pipe((0,D.catchError)((e=>{throw{message:"Error during context query. Please check JS console logs.",status:e.status,statusText:e.statusText}})),(0,D.switchMap)((e=>(0,D.of)((e=>{const t=e.data.map((e=>hf(e,ff.Descending)));return Of(yf({},e),{data:t})})(e))))))})).call(this))),vf(this,"processContextFiltersToExpr",((e,t)=>{let r=`{${e.map((e=>!e.nonIndexed&&e.enabled?`${e.label}="${(0,u.Qn)(e.value)}"`:"")).filter((e=>!!e)).join(",")}}`;if(t){let n=!1;if(1===(0,Uc.MX)(t.expr).parserCount){n=!0;const e=(0,Uc.aw)(t.expr);e&&(r=(0,lf.aH)(r,e))}const i=e.filter((e=>e.nonIndexed&&e.enabled));for(const e of i)e.enabled&&(r=(0,lf.tE)(r,e.label,"=",e.value,n?Dc.HD.Parsed:Dc.HD.StructuredMetadata))}return r})),vf(this,"processPipelineStagesToExpr",((e,t)=>{let r=e;var n;const i=null!==(n=null==t?void 0:t.expr)&&void 0!==n?n:"";if((0,Uc.MX)(i).parserCount>1)return r;const a=(0,Uc.TQ)(i,[Dd.t3,Dd.iT,Dd.c$,Dd.LM,Dd.CX,Dd.bY]),o=a.filter((e=>{var t;return(null===(t=e.type)||void 0===t?void 0:t.id)===Dd.t3})),s=a.filter((e=>{var t;return(null===(t=e.type)||void 0===t?void 0:t.id)!==Dd.t3}));for(const e of o)s.some((t=>e.contains(t)))||(r+=` ${e.getExpression(i)}`);return r})),vf(this,"queryContainsValidPipelineStages",(e=>{var t;const r=null!==(t=null==e?void 0:e.expr)&&void 0!==t?t:"",n=(0,Uc.TQ)(r,[Dd.t3,Dd.iT,Dd.CX,Dd.bY]),i=n.filter((e=>{var t;return(null===(t=e.type)||void 0===t?void 0:t.id)===Dd.t3})),a=n.filter((e=>{var t;return(null===(t=e.type)||void 0===t?void 0:t.id)!==Dd.t3}));return i.some((e=>a.every((t=>!1===e.contains(t)))))})),vf(this,"getInitContextFilters",((e,t,r)=>bf((function*(){let n=!1;if(!t||(0,o.isEmpty)(e.labels))return{contextFilters:[],preservedFiltersApplied:n};const i=e.labels;let a=[];if((0,Uc.MX)(t.expr).queryWithParser){const e=(0,Uc.pk)(t.expr);a=yield this.datasource.languageProvider.fetchLabels({streamSelector:e[0],timeRange:r})}else yield this.datasource.languageProvider.start(r),a=this.datasource.languageProvider.getLabelKeys();const s=[];let l;Object.entries(i).forEach((([t,r])=>{const n=(0,u.Ed)(t,e.dataFrame,e.rowIndex),i={label:t,value:r,enabled:a.includes(t),nonIndexed:null!==n&&n!==Dc.HD.Indexed};s.push(i)}));const c=window.localStorage.getItem(Ef);if(c)try{l=JSON.parse(c)}catch(e){}if(l){let e=!1;const t=s.map((t=>l.removedLabels.includes(t.label)?(e=!0,Of(yf({},t),{enabled:!1})):l.selectedExtractedLabels.includes(t.label)?(e=!0,Of(yf({},t),{enabled:!0})):yf({},t)));return t.some((({enabled:e,nonIndexed:t})=>e&&!t))?(e&&(n=!0),{contextFilters:t,preservedFiltersApplied:n}):{contextFilters:s,preservedFiltersApplied:n}}return{contextFilters:s,preservedFiltersApplied:n}})).call(this))),this.datasource=e,this.cachedContextFilters=[]}}function wf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){wf(e,t,r[t])}))}return e}function Rf(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Pf=/^label_names\(\)\s*$/,If=/^label_values\((?:(.+),\s*)?([a-zA-Z_$][a-zA-Z0-9_]*)\)\s*$/;const Af=[{label:"Label names",value:Dc.ie.LabelNames},{label:"Label values",value:Dc.ie.LabelValues}],Lf=({onChange:e,query:t,datasource:r,range:n})=>{const[a,o]=(0,s.useState)(void 0),[l,u]=(0,s.useState)(""),[d,p]=(0,s.useState)([]),[f,h]=(0,s.useState)(""),g=E(a);(0,s.useEffect)((()=>{if(!t)return;const e="string"==typeof t?function(e){if("string"!=typeof e)return e;const t={refId:"LokiVariableQueryEditor-VariableQuery",type:Dc.ie.LabelNames};if(e.match(Pf))return Rf(Tf({},t),{type:Dc.ie.LabelNames});const r=e.match(If);return r?Rf(Tf({},t),{type:Dc.ie.LabelValues,label:r[2]?r[2]:r[1],stream:r[2]?r[1]:void 0}):t}(t):t;o(e.type),u(e.label||""),h(e.stream||"")}),[t]),(0,s.useEffect)((()=>{a===Dc.ie.LabelValues&&g!==a&&r.languageProvider.fetchLabels({timeRange:n}).then((e=>{p(e.map((e=>({label:e,value:e}))))}))}),[r,a,n,g]);const m=()=>{void 0!==a&&e({type:a,label:l,stream:f,refId:"LokiVariableQueryEditor-VariableQuery"})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.InlineFieldRow,{children:[(0,i.jsx)(c.InlineField,{label:"Query type",labelWidth:20,children:(0,i.jsx)(c.Select,{"aria-label":"Query type",onChange:t=>{o(t.value),void 0!==t.value&&e({type:t.value,label:l,stream:f,refId:"LokiVariableQueryEditor-VariableQuery"})},onBlur:m,value:a,options:Af,width:16})}),a===Dc.ie.LabelValues&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(c.InlineField,{label:"Label",labelWidth:20,children:(0,i.jsx)(c.Select,{"aria-label":"Label",onChange:e=>{u(e.value||"")},onBlur:m,value:{label:l,value:l},options:d,width:16,allowCustomValue:!0})})})]}),a===Dc.ie.LabelValues&&(0,i.jsx)(c.InlineFieldRow,{children:(0,i.jsx)(c.InlineField,{label:"Stream selector",labelWidth:20,grow:!0,tooltip:(0,i.jsx)("div",{children:'Optional. If defined, a list of values for the specified log stream selector is returned. For example: {label="value"} or {label="$variable"}'}),children:(0,i.jsx)(c.Input,{type:"text","aria-label":"Stream selector",placeholder:"Optional stream selector",value:f,onChange:e=>{h(e.currentTarget.value)},onBlur:m})})})]})};function Cf(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function _f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nf extends r.CustomVariableSupport{execute(e,t,r){return(n=function*(){return this.datasource.metricFindQuery(e,{scopedVars:t,range:r})},function(){var e=this,t=arguments;return new Promise((function(r,i){var a=n.apply(e,t);function o(e){Cf(a,r,i,o,s,"next",e)}function s(e){Cf(a,r,i,o,s,"throw",e)}o(void 0)}))}).call(this);var n}query(e){const t=this.execute(e.targets[0],e.scopedVars,e.range);return(0,D.from)(t).pipe((0,k.map)((e=>({data:e}))))}constructor(e){super(),_f(this,"datasource",void 0),_f(this,"editor",void 0),this.datasource=e,this.editor=Lf}}function Df(e){const t=(0,n.getDataSourceSrv)(),i=e.reduce(((e,r)=>{if(r.datasourceUid){const i=t.getInstanceSettings(r.datasourceUid),a=e=>{switch(e){case"tempo":return"traceql";case"grafana-x-ray-datasource":return"getTrace";default:return}};var n;e.push({title:r.urlDisplayLabel||"",url:"",internal:{query:{query:r.url,queryType:a(null==i?void 0:i.type)},datasourceUid:r.datasourceUid,datasourceName:null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"Data source not found"},targetBlank:r.targetBlank})}else r.url&&e.push({title:r.urlDisplayLabel||"",url:r.url,targetBlank:r.targetBlank});return e}),[]);return{name:e[0].name,type:r.FieldType.string,config:{links:i},values:[]}}function kf(e){const t=e.filter((e=>void 0!==e.refId)),n=(0,o.groupBy)(t,(e=>e.refId));return Object.entries(n).map((([e,t])=>function(e,t){const n={name:"Time",config:{},values:[],type:r.FieldType.time},i={name:`Value #${t}`,config:{},values:[],type:r.FieldType.number},a=new Set(e.map((e=>e.fields.map((e=>{var t;return Object.keys(null!==(t=e.labels)&&void 0!==t?t:{})})).flat())).flat()),o=Array.from(a).sort().map((e=>({name:e,config:{filterable:!0},values:[],type:r.FieldType.string})));return e.forEach((e=>{const t=e.fields.find((e=>e.type===r.FieldType.time)),a=e.fields.find((e=>e.type===r.FieldType.number));if(null==t||null==a)return;const s=t.values,l=a.values;for(let e of s)n.values.push(e);for(let e of l)i.values.push(e);var c;const u=null!==(c=a.labels)&&void 0!==c?c:{};for(let e of o){var d;const t=null!==(d=u[e.name])&&void 0!==d?d:"";for(let r=0;r<l.length;r++)e.values.push(t)}})),{fields:[n,...o,i],refId:t,meta:{preferredVisualisationType:"table"},length:n.values.length}}(t,e)))}function $f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){$f(e,t,r[t])}))}return e}function Ff(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function Mf(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Bf(e,t){const{meta:r}=e,n=Mf(e,["meta"]),i=jf({},r,t);return Ff(jf({},n),{meta:i})}function Qf(e,t,n){var i;const a=Ff(jf({},null===(i=e.meta)||void 0===i?void 0:i.custom),{lokiQueryStatKey:"Summary: total bytes processed"});(0,Wd.nE)(e)&&(a.error="Error when parsing some of the logs");const s=Bf(e,{preferredVisualisationType:"logs",limit:null==t?void 0:t.maxLines,searchWords:t?(0,Uc.H0)(t.expr):void 0,custom:a}),l=function(e,t){if(!t.length)return[];const n=(0,o.groupBy)(t,"name"),i=Object.values(n).map(Df),a=e.fields.find((e=>e.type===r.FieldType.string));if(void 0===a)throw new Error("invalid logs-dataframe, string-field missing");const s=e.fields.find((e=>e.type===r.FieldType.other&&"labels"===e.name));for(let e=0;e<a.values.length;e++)for(const t of i)if("label"===n[t.name][0].matcherType&&s){const r=s.values[e];if(r){const e=Object.keys(r).find((e=>new RegExp(n[t.name][0].matcherRegex).test(e)));if(e){t.values.push(r[e]);continue}}t.values.push(null)}else if("regex"===n[t.name][0].matcherType||void 0===n[t.name][0].matcherType){const r=a.values[e].match(n[t.name][0].matcherRegex);if(r&&r[1]){t.values.push(r[1]);continue}t.values.push(null)}else t.values.push(null);return i}(s,n);return Ff(jf({},s),{fields:[...s.fields,...l]})}function Uf(e,t,r){return e.map((e=>Qf(e,void 0!==e.refId?t.get(e.refId):void 0,r)))}function Vf(e){const t={preferredVisualisationType:"graph"};return e.map((e=>Bf(e,t)))}function qf(e,t){const n=[],i=[],a=[];return e.forEach((e=>{if(function(e){return e.fields.every((e=>e.type===r.FieldType.time||e.type===r.FieldType.number))}(e)){var o;null!=e.refId&&(null===(o=t.get(e.refId))||void 0===o?void 0:o.queryType)===Dc.U3.Instant?i.push(e):a.push(e)}else n.push(e)})),{streamsFrames:n,metricInstantFrames:i,metricRangeFrames:a}}function Gf(e,t){if(void 0===e)return e;const{refId:r,message:n}=e;if(void 0===r||void 0===n)return e;const i=t.get(r);return void 0===i?e:n.includes("escape")&&i.expr.includes("\\")?Ff(jf({},e),{message:`${n}. Make sure that all special characters are escaped with \\. For more information on escaping of special characters visit LogQL documentation at https://grafana.com/docs/loki/latest/logql/.`}):e}function Wf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Wf(e,t,r[t])}))}return e}function zf(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const Hf=(0,s.memo)((function(e){var t;const{annotation:r,onAnnotationChange:n,history:a}=e;if(void 0===r||void 0===n)return null;const o=e=>{n(zf(Xf({},r),{expr:e.expr,maxLines:e.maxLines,queryType:"range"}))},s={refId:"",expr:r.expr,maxLines:r.maxLines,instant:r.instant,queryType:r.queryType};return(0,i.jsxs)(c.Stack,{gap:5,direction:"column",children:[(0,i.jsx)(c.Stack,{gap:0,direction:"column",children:(0,i.jsx)(au,{datasource:e.datasource,query:s,onChange:o,onRunQuery:()=>{},history:a,ExtraFieldElement:(0,i.jsx)(Mc,{lineLimitValue:(null==s||null===(t=s.maxLines)||void 0===t?void 0:t.toString())||"",query:s,onRunQuery:()=>{},onChange:o})})}),(0,i.jsxs)(Pt,{children:[(0,i.jsx)(At,{label:"Title",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance.",children:(0,i.jsx)(c.Input,{type:"text",placeholder:"alertname",value:r.titleFormat,onChange:e=>{n(zf(Xf({},r),{titleFormat:e.currentTarget.value}))}})}),(0,i.jsx)(At,{label:"Tags",children:(0,i.jsx)(c.Input,{type:"text",placeholder:"label1,label2",value:r.tagKeys,onChange:e=>{n(zf(Xf({},r),{tagKeys:e.currentTarget.value}))}})}),(0,i.jsx)(At,{label:"Text",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance.",children:(0,i.jsx)(c.Input,{type:"text",placeholder:"instance",value:r.textFormat,onChange:e=>{n(zf(Xf({},r),{textFormat:e.currentTarget.value}))}})})]})]})}));function Yf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Kf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Yf(e,t,r[t])}))}return e}function Zf(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function Jf(e){var t,n;if((null===(t=e.meta)||void 0===t?void 0:t.type)===r.DataFrameType.TimeSeriesMulti){const t=e.fields.find((e=>e.type===r.FieldType.number));if(!t)throw new Error("Unable to find number field on sharded dataframe!");let n="";return e.refId&&(n+=e.refId),e.name&&(n+=e.name),t.labels&&(n+=JSON.stringify(t.labels)),""!==n?n:void 0}return null!==(n=e.refId)&&void 0!==n?n:e.name}function eh(e,t){if(!e)return ch(t);const n=new Map;var i,a;e.data.forEach((e=>{const t=Jf(e);t&&n.set(t,e)})),t.data.forEach((t=>{let i;const a=Jf(t);void 0!==a&&n.has(a)?(i=n.get(a),function(e,t){var n,i,a,o;const s=e.fields.find((e=>e.type===r.FieldType.time)),l=e.fields.find((e=>e.type===r.FieldType.string&&"id"===e.name)),c=t.fields.find((e=>e.type===r.FieldType.time)),u=t.fields.find((e=>e.type===r.FieldType.string&&"id"===e.name));if(!s||!c)return void console.error(new Error("Time fields not found in the data frames"));var d;const p=null!==(d=null==c?void 0:c.values.slice(0))&&void 0!==d?d:[],f=Math.max(e.fields.length,t.fields.length);for(let n=0;n<p.length;n++){const i=rh(s,c,n),a=nh(s,l,i,c,u,n);for(let o=0;o<f;o++){if(!e.fields[o])continue;const s=ih(e.fields[o],t.fields,o);if(s)if(a){if(e.fields[o].type===r.FieldType.time)continue;var h;e.fields[o].type===r.FieldType.number?e.fields[o].values[i]=(null!==(h=e.fields[o].values[i])&&void 0!==h?h:0)+s.values[n]:e.fields[o].type===r.FieldType.other?"object"==typeof s.values[n]?e.fields[o].values[i]=Kf({},e.fields[o].values[i],s.values[n]):s.values[n]&&(e.fields[o].values[i]=s.values[n]):e.fields[o].values[i]=s.values[n]}else if(void 0!==s.values[n]){var g,m;if(e.fields[o].values.splice(i,0,s.values[n]),s.nanos)e.fields[o].nanos=null!==(m=e.fields[o].nanos)&&void 0!==m?m:new Array(e.fields[o].values.length-1).fill(0),null===(g=e.fields[o].nanos)||void 0===g||g.splice(i,0,s.nanos[n]);else if(e.fields[o].nanos){var b;null===(b=e.fields[o].nanos)||void 0===b||b.splice(i,0,0)}}}}var v,y,O,E;e.length=e.fields[0].values.length,e.meta=Zf(Kf({},e.meta),{stats:sh(null!==(v=null===(n=e.meta)||void 0===n?void 0:n.stats)&&void 0!==v?v:[],null!==(y=null===(i=t.meta)||void 0===i?void 0:i.stats)&&void 0!==y?y:[]),notices:lh(null!==(O=null===(a=e.meta)||void 0===a?void 0:a.notices)&&void 0!==O?O:[],null!==(E=null===(o=t.meta)||void 0===o?void 0:o.notices)&&void 0!==E?E:[])})}(i,t)):e.data.push(uh(t))}));const o=[...null!==(i=e.errors)&&void 0!==i?i:[],...null!==(a=t.errors)&&void 0!==a?a:[]];var s;o.length>0&&(e.errors=o);const l=null!==(s=e.error)&&void 0!==s?s:t.error;var c,u;null!=l&&(e.error=l);const d=[...null!==(c=e.traceIds)&&void 0!==c?c:[],...null!==(u=t.traceIds)&&void 0!==u?u:[]];return d.length>0&&(e.traceIds=d),e}function th(e,t){if(!e)return ch(t);var n,i;t.data.forEach((t=>{const n=e.data.findIndex((e=>function(e,t){var n,i,a,o,s,l;if(e.refId!==t.refId||e.name!==t.name)return!1;const c=null===(n=e.meta)||void 0===n?void 0:n.type,u=null===(i=t.meta)||void 0===i?void 0:i.type;if(c!==u)return!1;if(c===r.DataFrameType.TimeSeriesMulti){const n=e.fields.find((e=>e.type===r.FieldType.number)),i=t.fields.find((e=>e.type===r.FieldType.number));return void 0!==n&&void 0!==i&&(0,r.shallowCompare)(null!==(d=n.labels)&&void 0!==d?d:{},null!==(p=i.labels)&&void 0!==p?p:{});var d,p}const f=null===(o=e.meta)||void 0===o||null===(a=o.custom)||void 0===a?void 0:a.frameType,h=null===(l=t.meta)||void 0===l||null===(s=l.custom)||void 0===s?void 0:s.frameType;if("LabeledTimeValues"===f&&"LabeledTimeValues"===h)return!0;if(f===h)return!0;return!1}(e,t)));n<0?e.data.push(uh(t)):e.data[n]=t})),t.state===r.LoadingState.Done&&(e.data=e.data.filter((e=>e.name!==Ah)));const a=[...null!==(n=e.errors)&&void 0!==n?n:[],...null!==(i=t.errors)&&void 0!==i?i:[]];var o;a.length>0&&(e.errors=a);const s=null!==(o=e.error)&&void 0!==o?o:t.error;var l,c;null!=s&&(e.error=s);const u=[...null!==(l=e.traceIds)&&void 0!==l?l:[],...null!==(c=t.traceIds)&&void 0!==c?c:[]];return u.length>0&&(e.traceIds=u),e}function rh(e,t,n){const i=(0,r.closestIdx)(t.values[n],e.values);return i<0?0:t.values[n]===e.values[i]&&t.nanos&&e.nanos?t.nanos[n]>e.nanos[i]?i+1:i:t.values[n]>e.values[i]?i+1:i}function nh(e,t,r,n,i,a){const o=function(e,t,r,n){if(e.nanos&&r.nanos)return void 0!==e.values[t]&&e.values[t]===r.values[n]&&void 0!==e.nanos[t]&&e.nanos[t]===r.nanos[n];return void 0!==e.values[t]&&e.values[t]===r.values[n]}(e,r,n,a);return!!o&&(!t||!i||void 0!==t.values[r]&&t.values[r]===i.values[a])}function ih(e,t,n){const i=t.filter((t=>t.name===e.name));return 1===i.length?i[0]:e.labels?i.find((t=>{var n,i;return(0,r.shallowCompare)(null!==(n=e.labels)&&void 0!==n?n:{},null!==(i=t.labels)&&void 0!==i?i:{})})):t[n]}const ah="Summary: total bytes processed",oh="Summary: exec time";function sh(e,t){const r=[];for(const n of[ah,oh]){const i=e.find((e=>e.displayName===n)),a=t.find((e=>e.displayName===n));if(null!=a&&null!=i){r.push({value:a.value+i.value,displayName:n,unit:i.unit});continue}const o=null!=a?a:i;null!=o&&r.push(o)}return r}function lh(e,t){return[...e,...t].filter((e=>null!=e)).reduce(((e,t)=>(e.some((e=>e.severity===t.severity&&e.text===t.text))||e.push(t),e)),[])}function ch(e){return Zf(Kf({},e),{data:e.data.map(uh)})}function uh(e){return Zf(Kf({},e),{fields:e.fields.map((e=>Zf(Kf({},e),{values:e.values})))})}const dh="loki";var ph=b(2029);function fh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){fh(e,t,r[t])}))}return e}function gh(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}const mh=e=>ph.SY.test(e.expr),bh=e=>!!e.resolution&&1!==e.resolution,vh=e=>null!==e.maxLines&&void 0!==e.maxLines,yh=e=>!!e.legendFormat&&""!==e.legendFormat,Oh=e=>!![Zh,Jh,eg,tg,Kh].some((t=>e.startsWith(t)));function Eh(e,t,i,a={}){const{app:o,targets:s}=t;if(o!==r.CoreApp.Explore)return;let l=(e=>{let t=0;for(const l of e.data){var r,n;const e=null===(n=l.meta)||void 0===n||null===(r=n.custom)||void 0===r?void 0:r.lokiQueryStatKey;var i,a,o,s;e&&(t+=null!==(s=null===(o=l.meta)||void 0===o||null===(a=o.stats)||void 0===a||null===(i=a.find((t=>t.displayName===e)))||void 0===i?void 0:i.value)&&void 0!==s?s:0)}return t})(e);for(const r of s){var c,u,d,p;if(Oh(r.refId))return;(0,n.reportInteraction)("grafana_explore_loki_query_executed",hh({grafana_version:n.config.buildInfo.version,editor_mode:r.editorMode,has_data:e.data.some((e=>e.length>0)),has_error:void 0!==e.error,legend:r.legendFormat,line_limit:r.maxLines,obfuscated_query:(0,Uc.$F)(r.expr),query_type:(0,Uc.sI)(r.expr)?"logs":"metric",query_vector_type:r.queryType,resolution:r.resolution,simultaneously_executed_query_count:s.filter((e=>!e.hide)).length,simultaneously_hidden_query_count:s.filter((e=>e.hide)).length,time_range_from:null==t||null===(u=t.range)||void 0===u||null===(c=u.from)||void 0===c?void 0:c.toISOString(),time_range_to:null==t||null===(p=t.range)||void 0===p||null===(d=p.to)||void 0===d?void 0:d.toISOString(),time_taken:Date.now()-i.getTime(),bytes_processed:l,is_split:!1},a))}}function xh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){xh(e,t,r[t])}))}return e}function wh(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function Th(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Rh(e,t,n,i){const a=t.from.toDate().getTime(),o=t.to.toDate().getTime();return(e?function(e,t,r){if(t-e<=r)return[[e,t]];const n=[];for(let i=t;i>e;i-=r){const t=Math.max(i-r,e);n.push([t,i])}return n.reverse(),n}(a,o,i):function(e,t,r,n){if(n<r)return[[e,t]];const i=Math.trunc(n/r)*r,a=[];for(let n=e-e%r;n<t;n+=i){const e=Math.min(n+i-r,t);a.push([n,e])}return a}(a,o,n,i)).map((([e,t])=>{const n=(0,r.dateTime)(e),i=(0,r.dateTime)(t);return{from:n,to:i,raw:{from:n,to:i}}}))}function Ph(e,t){return t?e.map((e=>{if(!e.maxLines||!(0,Uc.sI)(e.expr))return e;const r=t.data.find((t=>t.refId===e.refId));if(!r)return e;const n=e.maxLines-r.length;return wh(Sh({},e),{maxLines:n<0?0:n})})).filter((e=>void 0===e.maxLines||e.maxLines>0)):e}function Ih(e,t,n={}){const i=t.length?t[0].request.queryGroupId:(0,Nt.A)();let a={data:[],state:r.LoadingState.Streaming,key:i};const o=Math.max(...t.map((({partition:e})=>e.length))),s=t.filter((({partition:e})=>e.length===o))[0].partition;let l=!1,c=null,u=new Map,d=null;const p=(i,o,f)=>{let h=!1;if(null!=c&&(c.unsubscribe(),c=null),l)return void i.complete();const g=()=>{const{nextRequestN:e,nextRequestGroup:n}=function(e,t,r){for(let n=t+1;n<e.length;n++){if(e[n].partition[r-1])return{nextRequestGroup:n,nextRequestN:r}}return{nextRequestGroup:e.findIndex((e=>void 0!==(null==e?void 0:e.partition[r-1]))),nextRequestN:r-1}}(t,f,o);e>0&&n>=0?p(i,e,n):(a.state=r.LoadingState.Done,i.next(a),i.complete())},m=e=>{if(n.disableRetry)return!1;try{if(e&&!(0,Wd.BY)(e))return!1}catch(e){return console.error(e),l=!0,!1}const t=`${o}-${f}`;var r;const a=null!==(r=u.get(t))&&void 0!==r?r:0;return!(a>0)&&(u.set(t,a+1),d=setTimeout((()=>{p(i,o,f)}),1500*Math.pow(2,a)),h=!0,!0)},b=t[f],v=b.partition[o-1],y=Ph(b.request.targets,a);if(!y.length)return void g();const O=wh(Sh({},t[f].request),{range:v,targets:y});b.request.requestId&&(O.requestId=`${b.request.requestId}_${o}`),c=e.runQuery(O).subscribe({next:e=>{var t;if((null!==(t=e.errors)&&void 0!==t?t:[]).length>0||null!=e.error){if(m(e))return;l=!0}a=eh(a,e),n.skipPartialUpdates||(a=function(e,t,n,i){if((0,Uc.sI)(t.targets[0].expr))return e;if(e.data=e.data.filter((e=>e.name!==Ah)),i<=1)return e;const a=(0,r.arrayToDataFrame)([{time:n[0].from.valueOf(),timeEnd:n[i-2].to.valueOf(),isRegion:!0,color:"rgba(120, 120, 120, 0.1)"}]);return a.name=Ah,a.meta={dataTopic:r.DataTopic.Annotations},e.data.push(a),e}(a,O,s,o))},complete:()=>{h||(n.skipPartialUpdates||i.next(a),g())},error:e=>{i.error(e),m()}})};return new D.Observable((e=>(p(e,o,0),()=>{l=!0,d&&(clearTimeout(d),d=null),null!=c&&(c.unsubscribe(),c=null)})))}const Ah="loki-splitting-progress";function Lh(e,t,n={}){const i=t.targets.filter((e=>!e.hide)).filter((e=>e.expr)).map((r=>e.applyTemplateVariables(r,t.scopedVars,t.filters))),[a,s]=(0,o.partition)(i,(e=>!function(e){return e.queryType!==Dc.U3.Instant&&!(0,Uc.Cg)(e.expr)}(e))),[l,c]=(0,o.partition)(s,(e=>(0,Uc.sI)(e.expr)));t.queryGroupId=(0,Nt.A)();const u=864e5,d=(0,o.groupBy)(l,(e=>e.direction===Dc.ti.Forward?Dc.ti.Forward:Dc.ti.Backward)),p=[];for(const e in d){const r=d[e],n=(0,o.groupBy)(r,(e=>e.resolution||1));for(const r in n){const i={request:wh(Sh({},t),{targets:n[r]}),partition:Rh(!0,t.range,t.intervalMs,u)};e===Dc.ti.Forward&&i.partition.reverse(),p.push(i)}}const f=(0,o.groupBy)(c,(e=>function(e,t,n,i){const a=/(-?\d+(?:\.\d+)?)(ms|[Mwdhmsy])/;if(null==i?void 0:i.match(a))return r.rangeUtil.intervalToMs(i)*n;const o=e*n,s=Math.round((t.to.valueOf()-t.from.valueOf())/11e3);return Math.max(o,s)}(t.intervalMs,t.range,e.resolution||1,e.step)));for(const e in f){let r=e;const n=f[r].map((e=>{const{maxLines:t}=e;return Th(e,["maxLines"])}));p.push({request:wh(Sh({},t),{targets:n}),partition:Rh(!1,t.range,Number(r),u)})}a.length&&p.push({request:wh(Sh({},t),{targets:a}),partition:[t.range]});const h=new Date;return Ih(e,p,n).pipe((0,D.tap)((e=>{e.state===r.LoadingState.Done&&function(e,t,r,n){const i={split_query_group_count:t.length,split_query_largest_partition_size:Math.max(...t.map((({partition:e})=>e.length))),split_query_total_request_count:t.reduce(((e,{partition:t})=>e+t.length),0),is_split:!0,simultaneously_executed_query_count:r.targets.filter((e=>!e.hide)).length,simultaneously_hidden_query_count:r.targets.filter((e=>e.hide)).length};for(const r of t){const t=r.partition.length;Eh(e,r.request,n,gh(hh({},i),{split_query_partition_size:t}))}}(e,p,t,h)})))}function Ch(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function _h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nh(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function Dh(e,t){const n=t.targets.filter((e=>e.expr)).filter((e=>!e.hide)).map((r=>e.applyTemplateVariables(r,t.scopedVars,t.filters)));return function(e,t,n){let i=!1,a={data:[],state:r.LoadingState.Streaming,key:(0,Nt.A)()},s=null,l=new Map,c=null;const u=(n,o,d)=>{let p=d[o].groupSize;const{shards:f,groupSize:h,cycle:g}=d[o];let m=!1;null!=s&&(s.unsubscribe(),s=null);const b=()=>{a.state=i?r.LoadingState.Error:r.LoadingState.Done,n.next(a),n.complete()};if(i)return void b();const v=()=>{const e=d[o+1]&&(void 0===d[o+1].shards||kh(d[o+1]))?d[o+1]:d.find((e=>kh(e)));void 0!==e?(d[o].groupSize=p,u(n,d.indexOf(e),d)):b()},y=e=>{try{if(e&&!(0,Wd.BY)(e))return!1}catch(e){return console.error(e),i=!0,!1}if(void 0!==h&&h>1)return d[o].groupSize=Math.floor(Math.sqrt(h)),jh(`Possible time out, new group size ${d[o].groupSize}`),m=!0,u(n,o,d),!0;const t=`${o}_${g}`;var r;const a=null!==(r=l.get(t))&&void 0!==r?r:0;return a>1?(i=!0,!1):(l.set(t,a+1),c=setTimeout((()=>{console.warn(`Retrying ${o} ${g} (${a+1})`),u(n,o,d),c=null}),1500*Math.pow(2,a)),m=!0,!0)},O=Ph(d[o].targets,a);if(!O.length)return void v();const E=f&&void 0!==g&&h?function(e,t,r){if(t===e.length)return[-1];return e.slice(t,t+r)}(f,g,h):[],x=Nh(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){_h(e,t,r[t])}))}return e}({},t),{targets:(0,Uc.Bg)(O,E)});t.requestId&&(x.requestId=E.length>0?`${t.requestId}_shard_${o}_${g}_${h}`:t.requestId),jh(E.length?`Querying ${E.join(", ")}`:"Running regular query"),s=Lh(e,x,{skipPartialUpdates:!0,disableRetry:!0}).subscribe({next:e=>{var t;((null!==(t=e.errors)&&void 0!==t?t:[]).length>0||null!=e.error)&&y(e)||(h&&void 0!==g&&void 0!==f&&(p=function(e,t,r){const n=.7;return Math.min(t,Math.max(Math.floor((r-e)*n),1))}(g+h,function(e,t){var r,n;const{groupSize:i}=t;if(!i)return 1;if(!e.data.length)return i+1;const a=null===(n=e.data[0].meta)||void 0===n||null===(r=n.stats)||void 0===r?void 0:r.find((e=>"Summary: exec time"===e.displayName));if(a){const e=Math.round(a.value);return jh(`${a.value}`),e<=1?Math.floor(1.5*i):e<6?Math.ceil(1.1*i):1===i?i:e<20?Math.ceil(.9*i):Math.floor(i/2)}return i}(e,d[o]),f.length),p!==h&&jh(`New group size ${p}`)),a=E.length>0?eh(a,e):th(a,e),0===E.length&&n.next(a))},complete:()=>{m||(n.next(a),v())},error:e=>{console.error(e,{msg:"failed to shard"}),n.next(a),y()||v()}})},d=new D.Observable((r=>(function(e,t,r){return(n=function*(){const[n,i]=(0,o.partition)(e,(e=>(0,Uc.E2)([e]))),a=[];i.length&&a.push({targets:i});const s=(0,o.groupBy)(n,(e=>(0,Uc.tO)(e.expr)));for(const e in s)try{const n=(yield t.languageProvider.fetchLabelValues("__stream_shard__",{timeRange:r.range,streamSelector:e})).map((e=>parseInt(e,10)));n&&(n.sort(((e,t)=>t-e)),jh(`Querying ${e} with shards ${n.join(", ")}`)),a.push({targets:s[e],shards:n.length?n:void 0,groupSize:n.length?$h(n):void 0,cycle:0})}catch(t){console.error(t,{msg:"failed to fetch label values for __stream_shard__"}),a.push({targets:s[e]})}return a},function(){var e=this,t=arguments;return new Promise((function(r,i){var a=n.apply(e,t);function o(e){Ch(a,r,i,o,s,"next",e)}function s(e){Ch(a,r,i,o,s,"throw",e)}o(void 0)}))})();var n}(n,e,t).then((e=>{u(r,0,e)})),()=>{i=!0,c&&clearTimeout(c),null!=s&&(s.unsubscribe(),s=null)})));return d}(e,t,n)}function kh(e){if(void 0===e.cycle||!e.groupSize||!e.shards)return!1;const{cycle:t,groupSize:r,shards:n}=e,i=Math.min(t+r,n.length);return e.cycle=i,t<n.length&&i<=n.length}function $h(e){return Math.floor(Math.sqrt(e.length))}Boolean(localStorage.getItem("loki.sharding_debug_enabled"));function jh(e){}function Fh(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function Mh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Mh(e,t,r[t])}))}return e}function Qh(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function Uh(e){return(t=function*(){var t;const r=JSON.stringify({expr:e.expr}),i=(new TextEncoder).encode(r),a=yield crypto.subtle.digest("SHA-1",i),o=Array.from(new Uint8Array(a.slice(0,8)));return`${null===(t=e.datasource)||void 0===t?void 0:t.uid}/${o.map((e=>e.toString(16).padStart(2,"0"))).join("")}/${n.config.bootData.user.orgId}`},function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function o(e){Fh(a,n,i,o,s,"next",e)}function s(e){Fh(a,n,i,o,s,"throw",e)}o(void 0)}))})();var t}const Vh=e=>{let t=`${"https:"===window.location.protocol?"wss://":"ws://"}${window.location.host}${n.config.appSubUrl}`;return t.endsWith("/")&&(t=t.slice(0,-1)),`${t}${e}`};function qh(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function Gh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){qh(a,n,i,o,s,"next",e)}function s(e){qh(a,n,i,o,s,"throw",e)}o(void 0)}))}}function Wh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Wh(e,t,r[t])}))}return e}function zh(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function Hh(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const Yh=10,Kh="loki-data-samples",Zh="annotation-",Jh="log-row-context-query-",eg="log-volume-",tg="log-sample-",rg=1e6;function ng(e,t,n,i,a){const o=r.rangeUtil.calculateInterval(t,1);return{targets:[e],requestId:i,interval:o.interval,intervalMs:o.intervalMs,range:t,scopedVars:{},timezone:"UTC",app:n,startTime:Date.now(),hideFromInspector:a}}class ig extends n.DataSourceWithBackend{getSupplementaryRequest(e,t,n){switch(e){case r.SupplementaryQueryType.LogsVolume:const i=(null==n?void 0:n.type)===r.SupplementaryQueryType.LogsVolume?n:{type:e};return this.getLogsVolumeDataProvider(t,i);case r.SupplementaryQueryType.LogsSample:const a=(null==n?void 0:n.type)===r.SupplementaryQueryType.LogsSample?n:{type:e};return this.getLogsSampleDataProvider(t,a);default:return}}getSupportedSupplementaryQueryTypes(){return[r.SupplementaryQueryType.LogsVolume,r.SupplementaryQueryType.LogsSample]}getSupplementaryQuery(e,t){if(t.hide)return;const n=(0,Uc.vV)(t);let i=(0,lf.Lv)(n.expr),a=!1;switch(e.type){case r.SupplementaryQueryType.LogsVolume:if(a=!(!i||!(0,Uc.sI)(i)||n.queryType!==Dc.U3.Range),!a)return;const t=`${i} | drop __error__`,o=e.field||"level, detected_level";return!1===(0,Uc.FV)(this.interpolateString(t,Qc.a))&&(i=t),zh(Xh({},n),{refId:`${eg}${n.refId}`,queryType:Dc.U3.Range,supportingQueryType:Dc.Q$.LogsVolume,expr:`sum by (${o}) (count_over_time(${i}[$__auto]))`});case r.SupplementaryQueryType.LogsSample:if(a=!(!i||(0,Uc.sI)(i)),!a)return;return zh(Xh({},n),{queryType:Dc.U3.Range,refId:`${tg}${n.refId}`,expr:(0,Uc.OT)(i),maxLines:Number.isNaN(Number(e.limit))?this.maxLines:Number(e.limit),supportingQueryType:Dc.Q$.LogsSample});default:return}}getLogsVolumeDataProvider(e,t){const r=(0,o.cloneDeep)(e),n=r.targets.map((e=>this.getSupplementaryQuery(t,e))).filter((e=>!!e));if(n.length)return zh(Xh({},r),{targets:n})}getLogsSampleDataProvider(e,t){const n=(0,o.cloneDeep)(e),i=n.targets.map((e=>this.getSupplementaryQuery({type:r.SupplementaryQueryType.LogsSample,limit:100},e))).filter((e=>!!e));if(i.length)return zh(Xh({},n),{targets:i})}query(e){var t;const i=e.targets.map(Uc.vV).map((t=>{var r,i;return zh(Xh({},t),{maxLines:null!==(i=t.maxLines)&&void 0!==i?i:this.maxLines,scopes:n.config.featureToggles.scopeFilters&&n.config.featureToggles.logQLScope?null===(r=e.scopes)||void 0===r?void 0:r.flatMap((e=>e.spec.filters)):void 0})})),a=zh(Xh({},e),{targets:i}),o=a.targets.filter((e=>e.queryType===Dc.U3.Stream));if(n.config.featureToggles.lokiExperimentalStreaming&&o.length>0&&"now"===(null===(t=a.rangeRaw)||void 0===t?void 0:t.to)){const t=zh(Xh({},a),{targets:o});return(0,D.merge)(...o.map((i=>function(e,t,i){const a=i.range,o=a.to.valueOf()-a.from.valueOf()+1e3;var s;let l,c=null!==(s=i.maxDataPoints)&&void 0!==s?s:1e3;c>100&&(c*=2);const u=t=>{if("message"in t&&t.message){const n=t.message;l?l.push(n):l=r.StreamingDataFrame.fromDataFrameJSON(n,{maxLength:c,maxDelta:o,displayNameFormat:e.legendFormat})}return l};return(0,D.defer)((()=>Uh(e))).pipe((0,D.mergeMap)((i=>(0,n.getGrafanaLiveSrv)().getStream({scope:r.LiveChannelScope.DataSource,namespace:t.uid,path:`tail/${i}`,data:Qh(Bh({},e),{timeRange:{from:a.from.valueOf().toString(),to:a.to.valueOf().toString()}})}).pipe((0,D.map)((e=>{const t=u(e);return{data:t?[t]:[],state:r.LoadingState.Streaming}}))))))}(this.applyTemplateVariables(i,e.scopedVars,e.filters),this,t))))}if(a.liveStreaming)return this.runLiveQueryThroughBackend(a);if(n.config.featureToggles.lokiShardSplitting&&(0,Uc.E2)(a.targets))return Dh(this,a);if(n.config.featureToggles.lokiQuerySplitting&&(0,Uc.gy)(a.targets))return Lh(this,a);const s=new Date;return this.runQuery(a).pipe((0,k.tap)((e=>Eh(e,a,s))))}runQuery(e){return super.query(e).pipe((0,k.map)((t=>{var n;return function(e,t,n){const{data:i,error:a}=e,o=Mf(e,["data","error"]),s=i.map((e=>{if(!(0,r.isDataFrame)(e))throw new Error("transformation only supports dataframe responses");return e})),l=new Map(t.map((t=>{var r;const n=null===(r=e.data.find((e=>e.refId===t.refId)))||void 0===r?void 0:r.meta.executedQueryString,i=Ff(jf({},t),{expr:n?(0,Uc.mW)(n):t.expr});return[t.refId,i]}))),{streamsFrames:c,metricInstantFrames:u,metricRangeFrames:d}=qf(s,l);return Ff(jf({},o),{error:Gf(a,l),data:[...Vf(d),...(p=u,p.length>0?kf(p):[]),...Uf(c,l,n)]});var p}(t,e.targets,null!==(n=this.instanceSettings.jsonData.derivedFields)&&void 0!==n?n:[])})))}runLiveQueryThroughBackend(e){const t=e.targets.filter((e=>""!==e.expr&&(0,Uc.sI)(e.expr)));if(0===t.length)return(0,D.of)({data:[],state:r.LoadingState.Done});const n=t.map((t=>{const r=this.applyTemplateVariables(t,e.scopedVars,e.filters),n=r.maxLines||this.maxLines;return this.runLiveQuery(r,n)}));return(0,D.merge)(...n)}createLiveTarget(e,t){const n=e.expr,i=this.instanceSettings.url,a=r.urlUtil.serializeParams({query:n});return{query:n,url:Vh(`${i}/loki/api/v1/tail?${a}`),refId:e.refId,size:t}}interpolateVariablesInQueries(e,t,r){let n=e;return e&&e.length&&(n=e.map((e=>zh(Xh({},e),{datasource:this.getRef(),expr:this.addAdHocFilters(this.templateSrv.replace(e.expr,t,this.interpolateQueryExpr),r)})))),n}getQueryDisplayText(e){return e.expr}getTimeRangeParams(e){return{start:e.from.valueOf()*rg,end:e.to.valueOf()*rg}}importFromAbstractQueries(e){return Gh((function*(){yield this.languageProvider.start();const t=this.languageProvider.labelKeys;return t&&t.length&&(e=e.map((e=>(e.labelMatchers=e.labelMatchers.filter((e=>t.includes(e.name))),e)))),e.map((e=>this.languageProvider.importFromAbstractQuery(e)))})).call(this)}exportToAbstractQueries(e){return Gh((function*(){return e.map((e=>this.languageProvider.exportToAbstractQuery(e)))})).call(this)}metadataRequest(e,t,r){return Gh((function*(){if(e.startsWith("/"))throw new Error(`invalid metadata request url: ${e}`);const n=yield this.getResource(e,t,r);var i,a,o;return!n.data&&n.values?null!==(i=n.values)&&void 0!==i?i:[]:!n.data&&n.fields?null!==(a=n.fields)&&void 0!==a?a:[]:null!==(o=n.data)&&void 0!==o?o:[]})).call(this)}statsMetadataRequest(e,t,r){return Gh((function*(){if(e.startsWith("/"))throw new Error(`invalid metadata request url: ${e}`);return yield this.getResource(e,t,r)})).call(this)}getQueryStats(e,t){return Gh((function*(){if((0,Uc.FV)(this.interpolateString(e.expr,Qc.a)))return;const r=(0,Uc.pk)(e.expr);let n={streams:0,chunks:0,bytes:0,entries:0};for(const i in r){const{start:a,end:o}=this.getStatsTimeRange(e,Number(i),t);if(void 0===a||void 0===o)return{streams:0,chunks:0,bytes:0,entries:0,message:"Query size estimate not available."};try{const t=yield this.statsMetadataRequest("index/stats",{query:r[i],start:a,end:o},{showErrorAlert:!1,requestId:`log-stats-${e.refId}`});n={streams:n.streams+t.streams,chunks:n.chunks+t.chunks,bytes:n.bytes+t.bytes,entries:n.entries+t.entries}}catch(e){break}}return n})).call(this)}getStatsTimeRange(e,t,n){let i,a;const o=(0,Uc.QH)(e.expr,[Dd.dw]).map((t=>e.expr.substring(t.from,t.to)));return(0,Uc.sI)(e.expr)?e.queryType===Dc.U3.Instant?{start:void 0,end:void 0}:this.getTimeRangeParams(n):e.queryType===Dc.U3.Instant?o[t]?(a=this.getTimeRangeParams(n).end,i=a-1e6*r.rangeUtil.intervalToMs(o[t]),{start:i,end:a}):/(\$__auto|\$__range)/.test(e.expr)?this.getTimeRangeParams(n):{start:void 0,end:void 0}:this.getTimeRangeParams(n)}getStats(e,t){return Gh((function*(){if(!e.expr)return null;const r=yield this.getQueryStats(e,t);return r?Object.values(r).every((e=>0===e))?null:r:null})).call(this)}metricFindQuery(e,t){return Gh((function*(){if(!e)return Promise.resolve([]);let r;return r="string"==typeof e?this.parseStringToVariableQuery(this.interpolateString(e,null==t?void 0:t.scopedVars)):zh(Xh({},e),{label:this.interpolateString(e.label||"",null==t?void 0:t.scopedVars),stream:this.interpolateString(e.stream||"",null==t?void 0:t.scopedVars)}),r?yield this.processMetricFindQuery(r,null==t?void 0:t.range):Promise.resolve([])})).call(this)}processMetricFindQuery(e,t){return Gh((function*(){if(e.type===Dc.ie.LabelNames){return(yield this.languageProvider.fetchLabels({timeRange:t})).map((e=>({text:e})))}if(!e.label)return[];return(yield this.languageProvider.fetchLabelValues(e.label,{streamSelector:e.stream,timeRange:t})).map((e=>({text:e})))})).call(this)}parseStringToVariableQuery(e){const t="LokiVariableQueryEditor-VariableQuery";if(e.match(Pf))return{type:Dc.ie.LabelNames,refId:t};const r=e.match(If);return r?{type:Dc.ie.LabelValues,label:r[2],stream:r[1],refId:t}:void 0}getDataSamples(e,t,n){return Gh((function*(){let i=e.expr;if((0,Uc.FV)(this.interpolateString(i,Qc.a)))return[];if(!(0,Uc.sI)(i)){if(!(null==n?void 0:n.convertMetricQueryToLogQuery))return[];i=(0,Uc.OT)(i)}const a=ng({expr:i,queryType:Dc.U3.Range,refId:Kh,maxLines:e.maxLines||Yh,supportingQueryType:Dc.Q$.DataSample},t,r.CoreApp.Unknown,Kh,!0);return yield(0,D.lastValueFrom)(this.query(a).pipe((0,k.switchMap)((e=>(0,D.of)(e.data)))))})).call(this)}getTagKeys(e){return Gh((function*(){let t="{}";var r;for(const n of null!==(r=null==e?void 0:e.filters)&&void 0!==r?r:[])t=(0,lf.tE)(t,n.key,n.operator,n.value);return(yield this.languageProvider.fetchLabels({timeRange:null==e?void 0:e.timeRange,streamSelector:t})).map((e=>({text:e})))})).call(this)}getTagValues(e){return Gh((function*(){let t="{}";var r;for(const n of null!==(r=null==e?void 0:e.filters)&&void 0!==r?r:[])t=(0,lf.tE)(t,n.key,n.operator,n.value);return(yield this.languageProvider.fetchLabelValues(e.key,{timeRange:e.timeRange,streamSelector:t})).map((e=>({text:e})))})).call(this)}interpolateQueryExpr(e,t){if(!t.multi&&!t.includeAll)return e;if("string"==typeof e)return ag(e);return(0,o.map)(e,ag).join("|")}toggleQueryFilter(e,t){var r;let n=null!==(r=e.expr)&&void 0!==r?r:"";const i=(0,u.Ed)(t.options.key,t.frame,0);switch(t.type){case"FILTER_FOR":var a,o;if((null===(a=t.options)||void 0===a?void 0:a.key)&&(null===(o=t.options)||void 0===o?void 0:o.value)){const e=(0,u.Bb)(t.options.value);n=(0,lf.je)(n,t.options.key,"=",e)?(0,lf.FN)(n,t.options.key,"=",e):(0,lf.tE)(n,t.options.key,"=",e,i)}break;case"FILTER_OUT":var s,l;if((null===(s=t.options)||void 0===s?void 0:s.key)&&(null===(l=t.options)||void 0===l?void 0:l.value)){const e=(0,u.Bb)(t.options.value);(0,lf.je)(n,t.options.key,"=",e)&&(n=(0,lf.FN)(n,t.options.key,"=",e)),n=(0,lf.tE)(n,t.options.key,"!=",e,i)}}return zh(Xh({},e),{expr:n})}queryHasFilter(e,t){var r;let n=null!==(r=e.expr)&&void 0!==r?r:"";return(0,lf.je)(n,t.key,"=",t.value)}modifyQuery(e,t){var r;let n=null!==(r=e.expr)&&void 0!==r?r:"";switch(t.type){case"ADD_FILTER":var i,a;if((null===(i=t.options)||void 0===i?void 0:i.key)&&(null===(a=t.options)||void 0===a?void 0:a.value)){const e=(0,u.Ed)(t.options.key,t.frame,0),r=(0,u.Bb)(t.options.value);n=(0,lf.tE)(n,t.options.key,"=",r,e)}break;case"ADD_FILTER_OUT":var o,s;if((null===(o=t.options)||void 0===o?void 0:o.key)&&(null===(s=t.options)||void 0===s?void 0:s.value)){const e=(0,u.Ed)(t.options.key,t.frame,0),r=(0,u.Bb)(t.options.value);n=(0,lf.tE)(n,t.options.key,"!=",r,e)}break;case"ADD_LOGFMT_PARSER":n=(0,lf.aH)(n,"logfmt");break;case"ADD_JSON_PARSER":n=(0,lf.aH)(n,"json");break;case"ADD_UNPACK_PARSER":n=(0,lf.aH)(n,"unpack");break;case"ADD_NO_PIPELINE_ERROR":n=(0,lf.yI)(n);break;case"ADD_LEVEL_LABEL_FORMAT":var l,c;(null===(l=t.options)||void 0===l?void 0:l.originalLabel)&&(null===(c=t.options)||void 0===c?void 0:c.renameTo)&&(n=(0,lf.o9)(n,{renameTo:t.options.renameTo,originalLabel:t.options.originalLabel}));break;case"ADD_LABEL_FILTER":{const t=(0,lf.cH)(e.expr),r=(0,lf.lN)(e.expr),i=(0,lf.lq)([...t,...r]),a=(0,lf.i6)("","","=");n=(0,lf.cQ)(n,[i],a);break}case"ADD_STRING_FILTER":case"ADD_LINE_FILTER":var d;n=(0,lf.OS)(n,null===(d=t.options)||void 0===d?void 0:d.value);break;case"ADD_STRING_FILTER_OUT":case"ADD_LINE_FILTER_OUT":var p;n=(0,lf.OS)(n,null===(p=t.options)||void 0===p?void 0:p.value,"!=")}return zh(Xh({},e),{expr:n})}getSupportedQueryModifications(){return["ADD_FILTER","ADD_FILTER_OUT","ADD_LOGFMT_PARSER","ADD_JSON_PARSER","ADD_UNPACK_PARSER","ADD_NO_PIPELINE_ERROR","ADD_LEVEL_LABEL_FORMAT","ADD_LABEL_FILTER","ADD_STRING_FILTER","ADD_STRING_FILTER_OUT"]}getLogRowContextUi(e,t,r,n){return this.logContextProvider.getLogRowContextUi(e,t,(0,Uc.sc)(r),n)}annotationQuery(e){return Gh((function*(){const{expr:t,maxLines:i,instant:a,tagKeys:o="",titleFormat:s="",textFormat:l=""}=e.annotation;if(!t)return[];const c=`${Zh}${e.annotation.name}`,u=ng({refId:c,expr:t,maxLines:i,instant:a,queryType:a?Dc.U3.Instant:Dc.U3.Range},e.range,r.CoreApp.Dashboard,c),{data:d}=yield(0,D.lastValueFrom)(this.query(u)),p=[],f=o.split(",").filter((e=>""!==e)),h=n.config.featureToggles.lokiLogsDataplane;for(const e of d){new r.DataFrameView(e).forEach((e=>{const{labels:t}=e,n=Object.entries(t).map((([e,t])=>[e,t.trim()])).filter((([e,t])=>""!==t&&!(f.length&&!f.includes(e)))).map((([e,t])=>t)),i=Array.from(new Set(n)),a=h?e.body:e.Line;p.push({time:h?new Date(e.timestamp).valueOf():new Date(e.Time).valueOf(),title:(0,r.renderLegendFormat)(s,t),text:(0,r.renderLegendFormat)(l,t)||a,tags:i})}))}return p})).call(this)}addAdHocFilters(e,t){if(!(null==t?void 0:t.length))return e;let r=(0,ph.qk)(e);return r=t.reduce(((e,t)=>{const{key:r,operator:n}=t;let{value:i}=t;return(0,u.N4)(n)||(i=(0,u.Bb)(i,n)),(0,lf.tE)(e,r,n,i)}),r),(0,ph.If)(r)}filterQuery(e){return!e.hide&&""!==e.expr}applyTemplateVariables(e,t,r){const n=t||{},{__auto:i,__interval:a,__interval_ms:o,__range:s,__range_s:l,__range_ms:c}=n,u=zh(Xh({},Hh(n,["__auto","__interval","__interval_ms","__range","__range_s","__range_ms"])),{__interval:{value:"$__interval"},__interval_ms:{value:"$__interval_ms"}}),d=this.addAdHocFilters(this.templateSrv.replace(e.expr,u,this.interpolateQueryExpr),r),p=this.templateSrv.replace(e.step,u),f=this.templateSrv.replace(e.legendFormat,u);return zh(Xh({},e),{expr:d,step:p,legendFormat:f})}interpolateString(e,t){return this.templateSrv.replace(e,t,this.interpolateQueryExpr)}getVariables(){return this.templateSrv.getVariables().map((e=>`$${e.name}`))}getQueryHints(e,t){return function(e,t){if(0===t.length)return[];const r=[],{queryWithParser:n,parserCount:i}=(0,Uc.MX)(e);if(!n){const{hasLogfmt:n,hasJSON:i,hasPack:a}=(0,Wd.YB)(t[0]);i&&(a?r.push({type:"ADD_UNPACK_PARSER",label:"Selected log stream selector has packed logs.",fix:{title:"add unpack parser",label:"Consider using unpack parser.",action:{type:"ADD_UNPACK_PARSER",query:e}}}):r.push({type:"ADD_JSON_PARSER",label:"Selected log stream selector has JSON formatted logs.",fix:{title:"add json parser",label:"Consider using JSON parser.",action:{type:"ADD_JSON_PARSER",query:e}}})),n&&r.push({type:"ADD_LOGFMT_PARSER",label:"Selected log stream selector has logfmt formatted logs.",fix:{title:"add logfmt parser",label:"Consider using logfmt parser to turn key-value pairs in your log lines to labels.",action:{type:"ADD_LOGFMT_PARSER",query:e}}})}if(n){if(1===i){const n=(0,Uc.d_)(e);(0,Wd.db)(t[0])&&!n&&r.push({type:"ADD_NO_PIPELINE_ERROR",label:"Some logs in your selected log streams have parsing error.",fix:{title:"remove pipeline errors",label:"Consider filtering out logs with parsing errors.",action:{type:"ADD_NO_PIPELINE_ERROR",query:e}}})}(0,Uc.pS)(e)||r.push({type:"ADD_LABEL_FILTER",label:"Consider filtering logs by their label and value.",fix:{title:"add label filter",label:"",action:{type:"ADD_LABEL_FILTER",query:e}}})}if(!(0,Uc._i)(e)){const n=(0,Wd.Ac)(t[0]),i=(0,Wd.sz)(t[0]);!n&&i&&r.push({type:"ADD_LEVEL_LABEL_FORMAT",label:`Some logs in your selected log stream have "${i}" label.`,fix:{title:"add label level format",label:`If ${i} label has level values, consider using label_format to rename it to "level". Level label can be then visualized in log volumes.`,action:{type:"ADD_LEVEL_LABEL_FORMAT",query:e,options:{renameTo:"level",originalLabel:i}}}})}return(0,Uc.Rn)(e)||r.push({type:"ADD_LINE_FILTER",label:"Consider filtering logs for specific string.",fix:{title:"add line filter",label:"",action:{type:"ADD_LINE_FILTER",query:e}}}),r}(e.expr,t)}getDefaultQuery(e){const t={refId:"A",expr:""};return e===r.CoreApp.UnifiedAlerting?zh(Xh({},t),{queryType:Dc.U3.Instant}):zh(Xh({},t),{queryType:Dc.U3.Range})}constructor(e,t=(0,n.getTemplateSrv)()){var i;super(e),Wh(i=this,"instanceSettings",void 0),Wh(i,"templateSrv",void 0),Wh(i,"streams",void 0),Wh(i,"logContextProvider",void 0),Wh(i,"languageProvider",void 0),Wh(i,"maxLines",void 0),Wh(i,"supportsAdjustableWindow",void 0),Wh(i,"runLiveQuery",void 0),Wh(i,"getLogRowContext",void 0),Wh(i,"getLogRowContextQuery",void 0),i.instanceSettings=e,i.templateSrv=t,i.streams=new Jp,i.runLiveQuery=(e,t)=>{const n=i.createLiveTarget(e,t);return i.streams.getStream(n).pipe((0,k.map)((e=>({data:e||[],key:`loki-${n.refId}`,state:r.LoadingState.Streaming}))),(0,k.catchError)((e=>(0,D.throwError)((()=>`Live tailing was stopped due to following error: ${e.reason}`)))))},i.getLogRowContext=(e,t,r)=>Gh((function*(){return yield i.logContextProvider.getLogRowContext(e,t,(0,Uc.sc)(r))}))(),i.getLogRowContextQuery=(e,t,r,n)=>Gh((function*(){return yield i.logContextProvider.getLogRowContextQuery(e,t,(0,Uc.sc)(r),n)}))(),i.languageProvider=new Zd(i);const a=e.jsonData||{};var o;i.maxLines=parseInt(null!==(o=a.maxLines)&&void 0!==o?o:"0",10)||1e3,i.annotations={QueryEditor:Hf},i.variables=new Nf(i),i.logContextProvider=new Sf(i),i.supportsAdjustableWindow=!0}}function ag(e){return"string"==typeof e?e.replace(/\\/g,"\\\\\\\\").replace(/[$^*{}\[\]+?.()|]/g,"\\\\$&"):e}const og=new r.DataSourcePlugin(ig).setQueryEditor(ju).setConfigEditor((e=>{const{options:t,onOptionsChange:r}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Fu,{dataSourceName:"Loki",docsLink:"https://grafana.com/docs/grafana/latest/datasources/loki/configure-loki-data-source/",hasRequiredFields:!1}),(0,i.jsx)(c.Divider,{spacing:4}),(0,i.jsx)(Qu,{config:t,onChange:r,urlPlaceholder:"http://localhost:3100"}),(0,i.jsx)(c.Divider,{spacing:4}),(0,i.jsx)(rd,Ad({},ad({config:t,onChange:r}))),(0,i.jsx)(c.Divider,{spacing:4}),(0,i.jsx)(Bu,{title:"Additional settings",description:"Additional settings are optional settings that can be configured for more control over your data source.",isCollapsible:!0,isInitiallyOpen:!0,children:(0,i.jsxs)(c.Stack,{gap:5,direction:"column",children:[(0,i.jsx)(dd,{config:t,onChange:r}),n.config.secureSocksDSProxyEnabled&&(0,i.jsx)(c.SecureSocksProxySettings,{options:t,onOptionsChange:r}),(0,i.jsx)(bd,{options:t,onOptionsChange:r}),(0,i.jsx)(Pd,{maxLines:t.jsonData.maxLines||"",onMaxLinedChange:e=>r(_d(t,e))}),(0,i.jsx)(Rd,{fields:t.jsonData.derivedFields,onChange:e=>r(Nd(t,e))})]})})]})})).setQueryEditorHelp(y);(0,n.getAppEvents)().subscribe(r.DashboardLoadedEvent,(({payload:{dashboardId:e,orgId:t,grafanaVersion:r,queries:i}})=>{try{var a,o;const s=null===(o=i[dh])||void 0===o||null===(a=o.filter((e=>!e.hide)))||void 0===a?void 0:a.map((e=>(0,Uc.vV)(e)));if(!(null==s?void 0:s.length))return;const l=s.filter((e=>(0,Uc.sI)(e.expr))),c=s.filter((e=>!(0,Uc.sI)(e.expr))),u=s.filter((e=>e.queryType===Dc.U3.Instant)),d=s.filter((e=>e.queryType===Dc.U3.Range)),p=s.filter((e=>e.editorMode===S.f.Builder)),f=s.filter((e=>e.editorMode===S.f.Code)),h=s.filter(mh),g=s.filter(bh),m=s.filter(vh),b=s.filter(yh),v={grafana_version:r,dashboard_id:e,org_id:t,queries_count:s.length,logs_queries_count:l.length,metric_queries_count:c.length,instant_queries_count:u.length,range_queries_count:d.length,builder_mode_queries_count:p.length,code_mode_queries_count:f.length,queries_with_template_variables_count:h.length,queries_with_changed_resolution_count:g.length,queries_with_changed_line_limit_count:m.length,queries_with_changed_legend_count:b.length};(0,n.reportInteraction)("grafana_loki_dashboard_loaded",v)}catch(e){console.error("error in loki tracking handler",e)}}))})(),v})())); //# sourceMappingURL=module.js.map
.
Edit
..
Edit
CHANGELOG.md
Edit
LICENSE
Edit
README.md
Edit
img
Edit
loki-query-field.js
Edit
loki-query-field.js.map
Edit
module.js
Edit
module.js.LICENSE.txt
Edit
module.js.map
Edit
plugin.json
Edit